[FFmpeg-soc] [soc]: r1875 - libavfilter/formats.c

Vitor Sessak vitor1001 at gmail.com
Sat Feb 9 22:52:54 CET 2008


Hi

Bobby Bingham wrote:
> On Sat,  9 Feb 2008 21:58:34 +0100 (CET)
> vitor <subversion at mplayerhq.hu> wrote:
> 
>> Author: vitor
>> Date: Sat Feb  9 21:58:34 2008
>> New Revision: 1875
>>
>> Log:
>> Do not hardcode the list of pixel formats and use PIX_FMT_NB instead.
>>
>> Modified:
>>    libavfilter/formats.c
>>
>> Modified: libavfilter/formats.c
>> ==============================================================================
>> --- libavfilter/formats.c	(original)
>> +++ libavfilter/formats.c	Sat Feb  9 21:58:34 2008
>> @@ -85,23 +85,17 @@ AVFilterFormats *avfilter_make_format_li
>>  
>>  AVFilterFormats *avfilter_all_colorspaces(void)
>>  {
>> -    return avfilter_make_format_list(35,
>> -                PIX_FMT_YUV444P,  PIX_FMT_YUV422P,  PIX_FMT_YUV420P,
>> -                PIX_FMT_YUV411P,  PIX_FMT_YUV410P,
>> -                PIX_FMT_YUYV422,  PIX_FMT_UYVY422,
>> PIX_FMT_UYYVYY411,
>> -                PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ420P,
>> -                PIX_FMT_YUV440P,  PIX_FMT_YUVJ440P,
>> -                PIX_FMT_RGB32,    PIX_FMT_BGR32,
>> -                PIX_FMT_RGB32_1,  PIX_FMT_BGR32_1,
>> -                PIX_FMT_RGB24,    PIX_FMT_BGR24,
>> -                PIX_FMT_RGB565,   PIX_FMT_BGR565,
>> -                PIX_FMT_RGB555,   PIX_FMT_BGR555,
>> -                PIX_FMT_RGB8,     PIX_FMT_BGR8,
>> -                PIX_FMT_RGB4_BYTE,PIX_FMT_BGR4_BYTE,
>> -                PIX_FMT_GRAY16BE, PIX_FMT_GRAY16LE,
>> -                PIX_FMT_GRAY8,    PIX_FMT_PAL8,
>> -                PIX_FMT_MONOWHITE,PIX_FMT_MONOBLACK,
>> -                PIX_FMT_NV12,     PIX_FMT_NV21);
>> +    AVFilterFormats *ret;
>> +    int i;
>> +
>> +    ret = av_mallocz(sizeof(AVFilterFormats));
>> +    ret->formats = av_malloc(sizeof(*ret->formats) * PIX_FMT_NB);
>> +    ret->format_count = PIX_FMT_NB;
>> +
>> +    for(i = 0; i < PIX_FMT_NB; i ++)
>> +        ret->formats[i] = i;
>> +
>> +    return ret;
>>  }
>>  
> 
> Hrmmm.
> I must have missed when some of those formats were added to the list.

I added them when I saw that the missing formats stopped regression 
tests from working (he couldn't find a colorspace for vf_scale). Maybe 
it would be a nice idea to have avfilter_usual_colorspaces() for most 
filters and avfilter_all_colorspaces() for vf_scale, vf_fps, vf_setpts 
etc... Also, in the same spirit, maybe it would also be useful something 
having a avfilter_planar_colorspaces(), at least for flipping, rotating 
and transposing...

> What I originally had in mind for that function wasn't exactly listing
> "all" formats, but listing the most commonly supported subset, to avoid
> duplicating this code in every single filter.  The function name was
> obviously a little less than ideal.
> 
> Maybe how exactly this is done should be thought out a little more.
> But I think a function which returns a list of all the formats is
> pretty useless, because few if any filters will actually support them

Well, there are the timestamps-based filters...

> all.  And what about the XVMC formats?  I don't know much about XVMC,
> but is the image data even there for filtering, or is it off on the
> videocard somewhere?

I have no idea about XVMC...

BTW, are you following the thread in -devel?

-Vitor



More information about the FFmpeg-soc mailing list