[FFmpeg-devel] [PATCH] [1/??] [3/3] Colorspace negotiation

Michael Niedermayer michaelni
Sat Feb 9 21:27:58 CET 2008


On Sat, Feb 09, 2008 at 07:33:04PM +0100, Vitor Sessak wrote:
>

> /*
>  * Filter layer - format negotiation
[...]
>     /* merge list of formats */
>     ret->formats = av_malloc(sizeof(int) * FFMIN(a->format_count,
>                                                  b->format_count));

sizeof(*ret->formats)


[...]
>     /* merge and update all the references */
>     ret->refs = av_malloc(sizeof(AVFilterFormats**)*(a->refcount+b->refcount));
>     for(i = 0; i < a->refcount; i ++) {
>         ret->refs[ret->refcount] = a->refs[i];
>         *ret->refs[ret->refcount++] = ret;
>     }
>     for(i = 0; i < b->refcount; i ++) {
>         ret->refs[ret->refcount] = b->refs[i];
>         *ret->refs[ret->refcount++] = ret;
>     }
> 
>     av_free(a->refs);
>     av_free(a->formats);
>     av_free(a);
> 
>     av_free(b->refs);
>     av_free(b->formats);
>     av_free(b);

that could be factored into a merge_ref or so function and
merge_ref(ret, a);
merge_ref(ret, b);


[...]
>     ret->formats = av_malloc(sizeof(int) * len);

sizeof(*ret->formats)


[...]
> 
> 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);

I dont like this, something based on PIX_FMT_NB should work better


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080209/57b93421/attachment.pgp>



More information about the ffmpeg-devel mailing list