summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-07-21 02:04:03 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-07-21 11:26:28 +0200
commit9264bb7e79a50678eca6f320e1e1fb85bf00b009 (patch)
tree9769c999f9f8344d4abb4e0ceaa35b7abc48385c /libavfilter
parent541731488e2d6cc83629abdf5f9b00c873a6d1a4 (diff)
avfilter/vf_psnr: Fix rounding error in average_max
The intermediate was rounded to an integer Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_psnr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
index 89acd3ca76..0c8d0f1a31 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -241,6 +241,7 @@ static int config_input_ref(AVFilterLink *inlink)
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
AVFilterContext *ctx = inlink->dst;
PSNRContext *s = ctx->priv;
+ double average_max;
unsigned sum;
int j;
@@ -273,10 +274,12 @@ static int config_input_ref(AVFilterLink *inlink)
sum = 0;
for (j = 0; j < s->nb_components; j++)
sum += s->planeheight[j] * s->planewidth[j];
+ average_max = 0;
for (j = 0; j < s->nb_components; j++) {
s->planeweight[j] = (double) s->planeheight[j] * s->planewidth[j] / sum;
- s->average_max += s->max[j] * s->planeweight[j];
+ average_max += s->max[j] * s->planeweight[j];
}
+ s->average_max = lrint(average_max);
s->dsp.sse_line = desc->comp[0].depth > 8 ? sse_line_16bit : sse_line_8bit;
if (ARCH_X86)