[FFmpeg-devel] [PATCH v2 1/3] avfilter/vf_colorbalance: Fix for the wrong step value for 16bit format

lance.lmwang at gmail.com lance.lmwang at gmail.com
Wed Nov 13 13:09:45 EET 2019


From: Limin Wang <lance.lmwang at gmail.com>

Please try to reproduce with below command:
./ffplay -vf format=rgba64,colorbalance=rm=.2  ../fate-suite/mpeg2/t.mpg

Without the patch, the step is 8 if you check it by gdb or print out.

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
 libavfilter/vf_colorbalance.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_colorbalance.c b/libavfilter/vf_colorbalance.c
index eb870ac2ad..3fd1426696 100644
--- a/libavfilter/vf_colorbalance.c
+++ b/libavfilter/vf_colorbalance.c
@@ -303,6 +303,7 @@ static int config_output(AVFilterLink *outlink)
     ColorBalanceContext *s = ctx->priv;
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format);
     const int depth = desc->comp[0].depth;
+    const int is16bit = depth > 8;
     const int max = 1 << depth;
     const int planar = av_pix_fmt_count_planes(outlink->format) > 1;
 
@@ -319,7 +320,7 @@ static int config_output(AVFilterLink *outlink)
     }
 
     ff_fill_rgba_map(s->rgba_map, outlink->format);
-    s->step = av_get_padded_bits_per_pixel(desc) >> 3;
+    s->step = av_get_padded_bits_per_pixel(desc) >> (3 + is16bit);
 
     return 0;
 }
-- 
2.21.0



More information about the ffmpeg-devel mailing list