[FFmpeg-devel] [PATCH]Add more 32bit RGB colourspaces to kerndeint

Paul B Mahol onemda at gmail.com
Sat Jan 5 12:13:25 CET 2013


On 1/5/13, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Hi!
>
> I did not test with input that contains transparency.
>
> Please review, Carl Eugen
>

When you plan to start using git send-mail ?

I was forced to copy-paste your patch manually.


> diff --git a/libavfilter/vf_kerndeint.c b/libavfilter/vf_kerndeint.c
> index 3569bfa..337f9ee 100644
> --- a/libavfilter/vf_kerndeint.c
> +++ b/libavfilter/vf_kerndeint.c
> @@ -83,6 +83,13 @@ static int query_formats(AVFilterContext *ctx)
>          AV_PIX_FMT_YUV420P,
>          AV_PIX_FMT_YUYV422,
>          AV_PIX_FMT_ARGB,
> +        AV_PIX_FMT_0RGB,
> +        AV_PIX_FMT_ABGR,
> +        AV_PIX_FMT_0BGR,
> +        AV_PIX_FMT_RGBA,
> +        AV_PIX_FMT_RGB0,
> +        AV_PIX_FMT_BGRA,
> +        AV_PIX_FMT_BGR0,

You could put similar ones in same line, using 2 columns.

>          AV_PIX_FMT_NONE
>      };
>
> @@ -103,6 +110,17 @@ static int config_props(AVFilterLink *inlink)
>                            inlink->w, inlink->h, inlink->format, 1);
>  }
>
> +#define isRGB(x) \
> +    (  x == PIX_FMT_ARGB \
> +    || x == PIX_FMT_0RGB \
> +    || x == PIX_FMT_ABGR \
> +    || x == PIX_FMT_0BGR \
> +    || x == PIX_FMT_RGBA \
> +    || x == PIX_FMT_RGB0 \
> +    || x == PIX_FMT_BGRA \
> +    || x == PIX_FMT_BGR0 \
> +    )

There is better way to check if pix fmt is rgb. No need to add 10
extra lines of code.

> +
>  static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inpic)
>  {
>      KerndeintContext *kerndeint = inlink->dst->priv;
> @@ -203,7 +221,7 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inpic)
>                      if (map) {
>                          g = x & ~3;
>
> -                        if (inlink->format == AV_PIX_FMT_RGBA) {
> +                        if (isRGB(inlink->format)) {
>                              AV_WB32(dstp + g, 0xffffffff);
>                              x = g + 3;
>                          } else if (inlink->format == AV_PIX_FMT_YUYV422) {
> @@ -214,7 +232,7 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inpic)
>                              dstp[x] = plane == 0 ? 235 : 128;
>                          }
>                      } else {
> -                        if (inlink->format == AV_PIX_FMT_RGBA) {
> +                        if (isRGB(inlink->format)) {
>                              hi = 255;
>                              lo = 0;
>                          } else if (inlink->format == AV_PIX_FMT_YUYV422) {


More information about the ffmpeg-devel mailing list