summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_eq2.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-04 22:00:03 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-04 22:00:03 +0000
commit930cfcdbe2ed9be8f0998ab2a135116f570a1b86 (patch)
tree0d9849f56371a4250feb3a1b99ce84c3b7540a1a /libmpcodecs/vf_eq2.c
parent630f58aa8a9e43d4781d8f9ffe291b7e2d04b42f (diff)
downloadmpv-930cfcdbe2ed9be8f0998ab2a135116f570a1b86.tar.bz2
mpv-930cfcdbe2ed9be8f0998ab2a135116f570a1b86.tar.xz
- 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
Diffstat (limited to 'libmpcodecs/vf_eq2.c')
-rw-r--r--libmpcodecs/vf_eq2.c11
1 files 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;
}
}