[FFmpeg-devel] [PATCH 3/5] swscale: use a function for isBayer

Clément Bœsch u at pkh.me
Sun Mar 19 23:37:30 EET 2017


On Sun, Mar 19, 2017 at 10:13:37PM +0100, Michael Niedermayer wrote:
[...]
> > > > +static av_always_inline int isBayer(enum AVPixelFormat pix_fmt)
> > > > +{
> > > > +    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
> > > > +    av_assert0(desc);
> > > > +    return !strncmp(desc->name, "bayer_", 6);
> > > 
> > > iam not sure strncmp() is a good idea speed wise
> > > 
> > 
> > In a non-bayer case, the function will return in the worst case after the
> > 2nd character, I have high doubt about this being a speed issue. We can
> > introduce a flag for this, but I don't think it's worth.
> 
> i think needing to call libc is a bit ugly here
> 

It's already how we do it in libavutil/pixdesc.c.

But anyway, how about the 2 attached patches?

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-lavu-add-AV_PIX_FMT_FLAG_BAYER.patch
Type: text/x-diff
Size: 5185 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170319/206a0b6c/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-swscale-use-a-function-for-isBayer.patch
Type: text/x-diff
Size: 1493 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170319/206a0b6c/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170319/206a0b6c/attachment.sig>


More information about the ffmpeg-devel mailing list