avrec crash/math fix (sheepy here, committing koda's fix because I'm tired of having it lying around in my repo :P
authorkoda
Sun, 15 May 2016 10:43:18 +0200
changeset 11807 93621207563b
parent 11806 2af936302bab
child 11820 fe339879cf75
avrec crash/math fix (sheepy here, committing koda's fix because I'm tired of having it lying around in my repo :P
hedgewars/avwrapper/avwrapper.c
--- a/hedgewars/avwrapper/avwrapper.c	Tue May 10 13:28:37 2016 -0400
+++ b/hedgewars/avwrapper/avwrapper.c	Sun May 15 10:43:18 2016 +0200
@@ -447,11 +447,11 @@
 
             if (!(x & 1) && !(y & 1)) {
                 int r = (buf[x * 4 + 0]          + buf[(x + 1) * 4 + 0] +
-                         buf[x * 4 + 0 + stride] + buf[(x + 1) * 4 + 0 + stride]) / 4;
+                         buf[x * 4 + 0 - stride] + buf[(x + 1) * 4 + 0 - stride]) / 4;
                 int g = (buf[x * 4 + 1]          + buf[(x + 1) * 4 + 1] +
-                         buf[x * 4 + 1 + stride] + buf[(x + 1) * 4 + 1 + stride]) / 4;
+                         buf[x * 4 + 1 - stride] + buf[(x + 1) * 4 + 1 - stride]) / 4;
                 int b = (buf[x * 4 + 2]          + buf[(x + 1) * 4 + 2] +
-                         buf[x * 4 + 2 + stride] + buf[(x + 1) * 4 + 2 + stride]) / 4;
+                         buf[x * 4 + 2 - stride] + buf[(x + 1) * 4 + 2 - stride]) / 4;
 
                 int cr = (int)(-0.14713f * r - 0.28886f * g + 0.436f   * b);
                 int cb = (int)( 0.615f   * r - 0.51499f * g - 0.10001f * b);