From 930cfcdbe2ed9be8f0998ab2a135116f570a1b86 Mon Sep 17 00:00:00 2001 From: arpi Date: Wed, 4 Dec 2002 22:00:03 +0000 Subject: - 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 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8350 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_eq2.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libmpcodecs/vf_eq2.c b/libmpcodecs/vf_eq2.c index 8f35f1ea45..57d13023f0 100644 --- a/libmpcodecs/vf_eq2.c +++ b/libmpcodecs/vf_eq2.c @@ -70,7 +70,9 @@ void create_lut (vf_eq2_t *eq2) 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 @@ void process (unsigned char *dst, int dstride, unsigned char *src, int sstride, 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; } } -- cgit v1.2.3