diff mbox series

[FFmpeg-devel] avfilter/vf_eq: add support for alpha channel

Message ID 20211018112948.3106094-1-konstantin@boffins.se
State New
Headers show
Series [FFmpeg-devel] avfilter/vf_eq: add support for alpha channel
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Konstantin Mamalakis Oct. 18, 2021, 11:29 a.m. UTC
From: KM <the.real.laplace@gmail.com>

---
 libavfilter/vf_eq.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Comments

Michael Niedermayer Oct. 20, 2021, 12:19 p.m. UTC | #1
On Mon, Oct 18, 2021 at 02:29:48PM +0300, konstantin@boffins.se wrote:
> From: KM <the.real.laplace@gmail.com>
> 
> ---
>  libavfilter/vf_eq.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c
> index 4a0d85e8e5..80ab21efb3 100644
> --- a/libavfilter/vf_eq.c
> +++ b/libavfilter/vf_eq.c
> @@ -236,9 +236,9 @@ static const enum AVPixelFormat pixel_fmts_eq[] = {
>      AV_PIX_FMT_GRAY8,
>      AV_PIX_FMT_YUV410P,
>      AV_PIX_FMT_YUV411P,
> -    AV_PIX_FMT_YUV420P,
> -    AV_PIX_FMT_YUV422P,
> -    AV_PIX_FMT_YUV444P,
> +    AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P,
> +    AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA422P,
> +    AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P,
>      AV_PIX_FMT_NONE
>  };
>  
> @@ -281,12 +281,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
>              h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h);
>          }
>  
> -        if (eq->param[i].adjust)
> -            eq->param[i].adjust(&eq->param[i], out->data[i], out->linesize[i],
> -                                 in->data[i], in->linesize[i], w, h);
> -        else
> +        if (i == 3 || !eq->param[i].adjust)
>              av_image_copy_plane(out->data[i], out->linesize[i],
>                                  in->data[i], in->linesize[i], w, h);
> +
> +        else
> +            eq->param[i].adjust(&eq->param[i], out->data[i], out->linesize[i],
> +                                 in->data[i], in->linesize[i], w, h);
>      }

change LGTM
not sure you want or dont want a real name in the author field but iam asking
as it cannot be changed later ?

thx

[...]
Konstantin Mamalakis Oct. 21, 2021, 11:23 a.m. UTC | #2
Thanks, I'd rather _not_ have my real name on it

On Wed, 20 Oct 2021 at 15:19, Michael Niedermayer <michael@niedermayer.cc>
wrote:

> On Mon, Oct 18, 2021 at 02:29:48PM +0300, konstantin@boffins.se wrote:
> > From: KM <the.real.laplace@gmail.com>
> >
> > ---
> >  libavfilter/vf_eq.c | 15 ++++++++-------
> >  1 file changed, 8 insertions(+), 7 deletions(-)
> >
> > diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c
> > index 4a0d85e8e5..80ab21efb3 100644
> > --- a/libavfilter/vf_eq.c
> > +++ b/libavfilter/vf_eq.c
> > @@ -236,9 +236,9 @@ static const enum AVPixelFormat pixel_fmts_eq[] = {
> >      AV_PIX_FMT_GRAY8,
> >      AV_PIX_FMT_YUV410P,
> >      AV_PIX_FMT_YUV411P,
> > -    AV_PIX_FMT_YUV420P,
> > -    AV_PIX_FMT_YUV422P,
> > -    AV_PIX_FMT_YUV444P,
> > +    AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P,
> > +    AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA422P,
> > +    AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P,
> >      AV_PIX_FMT_NONE
> >  };
> >
> > @@ -281,12 +281,13 @@ static int filter_frame(AVFilterLink *inlink,
> AVFrame *in)
> >              h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h);
> >          }
> >
> > -        if (eq->param[i].adjust)
> > -            eq->param[i].adjust(&eq->param[i], out->data[i],
> out->linesize[i],
> > -                                 in->data[i], in->linesize[i], w, h);
> > -        else
> > +        if (i == 3 || !eq->param[i].adjust)
> >              av_image_copy_plane(out->data[i], out->linesize[i],
> >                                  in->data[i], in->linesize[i], w, h);
> > +
> > +        else
> > +            eq->param[i].adjust(&eq->param[i], out->data[i],
> out->linesize[i],
> > +                                 in->data[i], in->linesize[i], w, h);
> >      }
>
> change LGTM
> not sure you want or dont want a real name in the author field but iam
> asking
> as it cannot be changed later ?
>
> thx
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Those who are best at talking, realize last or never when they are wrong.
> _______________________________________________
> 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".
>
Michael Niedermayer Oct. 21, 2021, 12:19 p.m. UTC | #3
On Thu, Oct 21, 2021 at 02:23:37PM +0300, Konstantin Mamalakis wrote:
> Thanks, I'd rather _not_ have my real name on it

ok ill apply the patch as is then

thx

[...]
diff mbox series

Patch

diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c
index 4a0d85e8e5..80ab21efb3 100644
--- a/libavfilter/vf_eq.c
+++ b/libavfilter/vf_eq.c
@@ -236,9 +236,9 @@  static const enum AVPixelFormat pixel_fmts_eq[] = {
     AV_PIX_FMT_GRAY8,
     AV_PIX_FMT_YUV410P,
     AV_PIX_FMT_YUV411P,
-    AV_PIX_FMT_YUV420P,
-    AV_PIX_FMT_YUV422P,
-    AV_PIX_FMT_YUV444P,
+    AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P,
+    AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA422P,
+    AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P,
     AV_PIX_FMT_NONE
 };
 
@@ -281,12 +281,13 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h);
         }
 
-        if (eq->param[i].adjust)
-            eq->param[i].adjust(&eq->param[i], out->data[i], out->linesize[i],
-                                 in->data[i], in->linesize[i], w, h);
-        else
+        if (i == 3 || !eq->param[i].adjust)
             av_image_copy_plane(out->data[i], out->linesize[i],
                                 in->data[i], in->linesize[i], w, h);
+
+        else
+            eq->param[i].adjust(&eq->param[i], out->data[i], out->linesize[i],
+                                 in->data[i], in->linesize[i], w, h);
     }
 
     av_frame_free(&in);