[FFmpeg-devel] [PATCH] Implement avfilter_add_colorspaces()
Stefano Sabatini
stefano.sabatini-lala
Wed Dec 30 01:32:36 CET 2009
On date Tuesday 2009-12-29 14:58:49 +0100, Michael Niedermayer encoded:
> On Sat, Nov 07, 2009 at 02:28:38AM +0100, Stefano Sabatini wrote:
> > Hi all,
> >
> > this patch has a long story:
> > http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/83733
> >
> > Now that pixdescs are finally completed then this function can finally
> > be implemented.
> >
> > In attachment an example of how this function can be used to simplify
> > filters code.
> [...]
> > @@ -35,38 +36,18 @@
> > int hsub, vsub; ///< chroma subsampling
> > } CropContext;
> >
> > +static int select_colorspace(AVFilterContext *ctx, enum PixelFormat pix_fmt)
> > +{
> > + int ret = !(av_pix_fmt_descriptors[pix_fmt].flags & (PIX_FMT_BITSTREAM|PIX_FMT_HWACCEL));
> > + if (ret)
> > + av_log(ctx, AV_LOG_INFO, "%s: Selected format: %s\n", __func__, av_pix_fmt_descriptors[pix_fmt].name);
> > + return ret;
> > +}
> > +
> > static int query_formats(AVFilterContext *ctx)
> > {
> > - static const enum PixelFormat pix_fmts[] = {
> > - PIX_FMT_RGB48BE, PIX_FMT_RGB48LE,
> > - PIX_FMT_ARGB, PIX_FMT_RGBA,
> > - PIX_FMT_ABGR, PIX_FMT_BGRA,
> > - PIX_FMT_RGB24, PIX_FMT_BGR24,
> > - PIX_FMT_RGB565BE, PIX_FMT_RGB565LE,
> > - PIX_FMT_RGB555BE, PIX_FMT_RGB555LE,
> > - PIX_FMT_BGR565BE, PIX_FMT_BGR565LE,
> > - PIX_FMT_BGR555BE, PIX_FMT_BGR555LE,
> > - PIX_FMT_GRAY16BE, PIX_FMT_GRAY16LE,
> > - PIX_FMT_YUV420P16LE, PIX_FMT_YUV420P16BE,
> > - PIX_FMT_YUV422P16LE, PIX_FMT_YUV422P16BE,
> > - PIX_FMT_YUV444P16LE, PIX_FMT_YUV444P16BE,
> > - PIX_FMT_YUV444P, PIX_FMT_YUV422P,
> > - PIX_FMT_YUV420P, PIX_FMT_YUV411P,
> > - PIX_FMT_YUV410P, PIX_FMT_YUV440P,
> > - PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P,
> > - PIX_FMT_YUVJ420P, PIX_FMT_YUVJ440P,
> > - PIX_FMT_YUVA420P,
> > - PIX_FMT_NV12, PIX_FMT_NV21,
> > - PIX_FMT_YUYV422, PIX_FMT_UYVY422,
> > - PIX_FMT_UYYVYY411,
> > - PIX_FMT_RGB8, PIX_FMT_BGR8,
> > - PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE,
> > - PIX_FMT_PAL8, PIX_FMT_GRAY8,
> > - PIX_FMT_NONE
> > - };
> > + avfilter_set_common_formats(ctx, avfilter_colorspaces(ctx, select_colorspace));
>
>
> for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
> if (!(av_pix_fmt_descriptors[pix_fmt].flags & (PIX_FMT_BITSTREAM|PIX_FMT_HWACCEL)))
> avfilter_add_colorspace(formats, pix_fmt);
>
> no function pointers, fewer lines of code
Yes, nice idea thanks.
Is also OK to change avfilter_all_colorspace() like in attached?
Regards.
--
FFmpeg = Faboulous and Frenzy Merciless Plastic Epic Genius
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implement-add-colorspace.patch
Type: text/x-diff
Size: 1456 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091230/eb32cfa3/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: make-all-colorspace-skip-hw-fmts.patch
Type: text/x-diff
Size: 1033 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091230/eb32cfa3/attachment-0001.patch>
More information about the ffmpeg-devel
mailing list