1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-01 00:07:33 +00:00

- 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 <ticmanis@coli.uni-sb.de>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8350 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2002-12-04 22:00:03 +00:00
parent 630f58aa8a
commit 930cfcdbe2

View File

@ -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;
}
}