]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_fftdnoiz: round toward nearest integer
authorPaul B Mahol <onemda@gmail.com>
Sat, 19 Oct 2019 17:07:28 +0000 (19:07 +0200)
committerPaul B Mahol <onemda@gmail.com>
Sat, 19 Oct 2019 17:07:28 +0000 (19:07 +0200)
Instead of rounding toward zero and thus producing
darker output.

libavfilter/vf_fftdnoiz.c

index 7ee7dbc19b6a36a4d3c4591aec84edfed4b53d0c..a8e0b897f2d76d7a7d2339f4776499bf6dd5f08f 100644 (file)
@@ -156,7 +156,7 @@ static void export_row8(FFTComplex *src, uint8_t *dst, int rw, float scale, int
     int j;
 
     for (j = 0; j < rw; j++)
-        dst[j] = av_clip_uint8(src[j].re * scale);
+        dst[j] = av_clip_uint8(src[j].re * scale + 0.5f);
 }
 
 static void import_row16(FFTComplex *dst, uint8_t *srcp, int rw)
@@ -176,7 +176,7 @@ static void export_row16(FFTComplex *src, uint8_t *dstp, int rw, float scale, in
     int j;
 
     for (j = 0; j < rw; j++)
-        dst[j] = av_clip_uintp2_c(src[j].re * scale, depth);
+        dst[j] = av_clip_uintp2_c(src[j].re * scale + 0.5f, depth);
 }
 
 static int config_input(AVFilterLink *inlink)