]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_hqdn3d.c
lavf/http: Properly process HTTP header on listen.
[ffmpeg] / libavfilter / vf_hqdn3d.c
index f862014a7d0503fbb8459909837fbff9551936c8..ffc1b255f5969580aaf36f51c7c109ff4a36bd5a 100644 (file)
@@ -180,9 +180,9 @@ static int16_t *precalc_coefs(double dist25, int depth)
 
     gamma = log(0.25) / log(1.0 - FFMIN(dist25,252.0)/255.0 - 0.00001);
 
-    for (i = -255<<LUT_BITS; i <= 255<<LUT_BITS; i++) {
+    for (i = -256<<LUT_BITS; i < 256<<LUT_BITS; i++) {
         double f = ((i<<(9-LUT_BITS)) + (1<<(8-LUT_BITS)) - 1) / 512.0; // midpoint of the bin
-        simil = 1.0 - FFABS(f) / 255.0;
+        simil = FFMAX(0, 1.0 - FFABS(f) / 255.0);
         C = pow(simil, gamma) * 256.0 * f;
         ct[(256<<LUT_BITS)+i] = lrint(C);
     }