[FFmpeg-devel] [PATCH] lavfi/swapuv: support all planar yuv pixel formats

Stefano Sabatini stefasab at gmail.com
Sat Dec 22 13:02:33 CET 2012


On date Saturday 2012-12-22 01:48:17 +0000, Paul B Mahol encoded:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavfilter/vf_swapuv.c | 39 +++++++++++++++++++++++++++++----------
>  1 file changed, 29 insertions(+), 10 deletions(-)
> 
> diff --git a/libavfilter/vf_swapuv.c b/libavfilter/vf_swapuv.c
> index e7e5e88..82cc07c 100644
> --- a/libavfilter/vf_swapuv.c
> +++ b/libavfilter/vf_swapuv.c
> @@ -23,6 +23,7 @@
>   * swap UV filter
>   */
>  
> +#include "libavutil/pixdesc.h"
>  #include "avfilter.h"
>  #include "formats.h"
>  #include "internal.h"
> @@ -48,18 +49,36 @@ static int filter_frame(AVFilterLink *link, AVFilterBufferRef *inpicref)
>      return ff_filter_frame(link->dst->outputs[0], inpicref);
>  }
>  
> +static int is_planar_yuv(const AVPixFmtDescriptor *desc)
> +{
> +    int i;
> +

> +    if (desc->flags & ~(PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA) ||
> +        desc->nb_components < 3 ||
> +        (desc->comp[1].depth_minus1 != desc->comp[2].depth_minus1))
> +        return 0;

what about !PIX_FMT_RGB && nb_planes >= 3?

Should be simpler and consider also YUVA variants. As for PLANAR, this
violates the minimality principle so we better should avoid make use
of it.
-- 
FFmpeg = Fancy Forgiving Martial Picky Erratic Gnome


More information about the ffmpeg-devel mailing list