[FFmpeg-cvslog] avfilter/vf_chromanr: fix rounding of final output

Paul B Mahol git at videolan.org
Tue Mar 1 10:46:22 EET 2022


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Mar  1 09:22:15 2022 +0100| [5ffad29d626ec14d050d07009eed8ae3887287d2] | committer: Paul B Mahol

avfilter/vf_chromanr: fix rounding of final output

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5ffad29d626ec14d050d07009eed8ae3887287d2
---

 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);                                      \



More information about the ffmpeg-cvslog mailing list