From 5ffad29d626ec14d050d07009eed8ae3887287d2 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Tue, 1 Mar 2022 09:22:15 +0100 Subject: [PATCH] avfilter/vf_chromanr: fix rounding of final output --- libavfilter/vf_chromanr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_chromanr.c b/libavfilter/vf_chromanr.c index 63ec8ff075..385a26c8a6 100644 --- a/libavfilter/vf_chromanr.c +++ b/libavfilter/vf_chromanr.c @@ -161,8 +161,8 @@ static int distance ## _slice##name(AVFilterContext *ctx, void *arg, } \ } \ \ - out_uptr[x] = su / cn; \ - out_vptr[x] = sv / cn; \ + out_uptr[x] = (su + (cn >> 1)) / cn; \ + out_vptr[x] = (sv + (cn >> 1)) / cn; \ } \ \ out_uptr += out_ulinesize / sizeof(type); \