# HG changeset patch # User arpi # Date 1039039203 0 # Node ID 916d5392dcc907f182847675963780ee690fe068 # Parent 1cf5d8a5bbe8bb8ecab0ada2c207249364b73e7b - It fixes a small bug where a byte value is divided by 255.0 to convert to a float within [0.0, 1.0] and later multiplied by 256.0 to convert back. This makes the luminance lookup table more correct, although the visual difference is relatively small. - speedup of inner loop, using dst[i] instead of *dst++ based on patch by Linards Ticmanis diff -r 1cf5d8a5bbe8 -r 916d5392dcc9 libmpcodecs/vf_eq2.c --- a/libmpcodecs/vf_eq2.c Wed Dec 04 21:48:15 2002 +0000 +++ b/libmpcodecs/vf_eq2.c Wed Dec 04 22:00:03 2002 +0000 @@ -70,7 +70,9 @@ eq2->lut[i] = 255; } else { - eq2->lut[i] = (unsigned char) (256.0 * v); + /* we divided by 255.0 so now we also multiply by 255.0, not + by 256.0. "+ 0.5" ensures proper rounding */ + eq2->lut[i] = (unsigned char) (255.0 * v + 0.5); } } } @@ -85,11 +87,10 @@ for (j = 0; j < h; j++) { for (i = 0; i < w; i++) { - *(dst++) = lut[*(src++)]; + dst[i] = lut[src[i]]; } - - src += sstride - w; - dst += dstride - w; + src += sstride; + dst += dstride; } }