[Mplayer-cvslog] CVS: main/libmpcodecs vf_eq2.c,1.3,1.4
Arpi of Ize
arpi at mplayerhq.hu
Wed Dec 4 23:00:25 CET 2002
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv16249
Modified Files:
vf_eq2.c
Log Message:
- 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 at coli.uni-sb.de>
Index: vf_eq2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_eq2.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- vf_eq2.c 3 Nov 2002 17:20:58 -0000 1.3
+++ vf_eq2.c 4 Dec 2002 22:00:03 -0000 1.4
@@ -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;
}
}
More information about the MPlayer-cvslog
mailing list