diff mbox

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

Message ID 20191113110947.7767-1-lance.lmwang@gmail.com
State New
Headers show

Commit Message

Lance Wang Nov. 13, 2019, 11:09 a.m. UTC
From: Limin Wang <lance.lmwang@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@gmail.com>
---
 libavfilter/vf_colorbalance.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Paul B Mahol Nov. 13, 2019, 11:38 a.m. UTC | #1
Do not touch this file I actively working on it.

On 11/13/19, lance.lmwang@gmail.com <lance.lmwang@gmail.com> wrote:
> From: Limin Wang <lance.lmwang@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@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
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Paul B Mahol Nov. 13, 2019, 11:48 a.m. UTC | #2
Also step is later divided by 2.

On 11/13/19, lance.lmwang@gmail.com <lance.lmwang@gmail.com> wrote:
> From: Limin Wang <lance.lmwang@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@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
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox

Patch

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;
 }