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

Paul B Mahol onemda at gmail.com
Sat Dec 22 01:41:26 CET 2012


On 12/22/12, Stefano Sabatini <stefasab at gmail.com> wrote:
> On date Friday 2012-12-21 21:18:13 +0000, Paul B Mahol encoded:
>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>> ---
>>  libavfilter/vf_swapuv.c | 20 +++++++++++---------
>>  1 file changed, 11 insertions(+), 9 deletions(-)
>>
>> diff --git a/libavfilter/vf_swapuv.c b/libavfilter/vf_swapuv.c
>> index e7e5e88..efa9fc2 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"
>> @@ -50,16 +51,17 @@ static int filter_frame(AVFilterLink *link,
>> AVFilterBufferRef *inpicref)
>>
>>  static int query_formats(AVFilterContext *ctx)
>>  {
>> -    static const enum AVPixelFormat pix_fmts[] = {
>> -        AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVA420P,
>> -        AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVA444P,
>> -        AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ440P,
>> -        AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVJ422P,
>> -        AV_PIX_FMT_YUV411P,
>> -        AV_PIX_FMT_NONE,
>> -    };
>> +    AVFilterFormats *formats = NULL;
>> +    int fmt;
>>
>> -    ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
>> +    for (fmt = 0; fmt < AV_PIX_FMT_NB; fmt++) {
>> +        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
>
>> +        if (!(desc->flags & ~(PIX_FMT_BE | PIX_FMT_PLANAR |
>> PIX_FMT_ALPHA)) &&
>> +            desc->nb_components >= 3)
>
> Is this rejecting explicitly non YUV pixel formats?

Ah, it adds nv21, bad design indeed.


More information about the ffmpeg-devel mailing list