[FFmpeg-devel] [RFC] Make swscale-test perform only one convertion

Michael Niedermayer michaelni
Fri Feb 19 13:12:15 CET 2010


On Fri, Feb 19, 2010 at 09:11:11AM +0100, Stefano Sabatini wrote:
> On date Friday 2010-02-19 01:33:59 +0100, Michael Niedermayer encoded:
> > On Fri, Feb 19, 2010 at 12:23:36AM +0100, Stefano Sabatini wrote:
> [...]
> > > Index: ffmpeg/libswscale/swscale.c
> > > ===================================================================
> > > --- ffmpeg.orig/libswscale/swscale.c	2010-02-18 23:04:51.000000000 +0100
> > > +++ ffmpeg/libswscale/swscale.c	2010-02-18 23:55:23.000000000 +0100
> > > @@ -1430,6 +1430,11 @@
> > >          || (x) == PIX_FMT_ABGR   \
> > >          )
> > >  
> > > +#define isRGB24(x) (             \
> > > +           (x) == PIX_FMT_RGB24  \
> > > +        || (x) == PIX_FMT_BGR24  \
> > > +        )
> > > +
> > >  /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */
> > >  static int rgbToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
> > >                             int srcSliceH, uint8_t* dst[], int dstStride[])
> > > @@ -1458,6 +1463,16 @@
> > >          else if (CONV_IS(BGRA, ABGR)
> > >                || CONV_IS(RGBA, ARGB)) conv = shuffle_bytes_3012;
> > >      } else
> > > +        if (isRGB24(srcFormat) && isRGBA32(dstFormat)) {
> > > +        if      (CONV_IS(RGB24, RGBA)
> > > +              || CONV_IS(BGR24, BGRA)) conv = shuffle_bytes_012X;
> > > +        else if (CONV_IS(RGB24, ARGB)
> > > +              || CONV_IS(BGR24, ABGR)) conv = shuffle_bytes_X012;
> > > +        else if (CONV_IS(RGB24, ABGR)
> > > +              || CONV_IS(BGR24, ARGB)) conv = shuffle_bytes_X210;
> > > +        else if (CONV_IS(RGB24, BGRA)
> > > +              || CONV_IS(BGR24, RGBA)) conv = shuffle_bytes_210X;
> > 
> > this should be using switch/case as a jump table likely is faster
> > 
> > also iam against adding a converter for each format pair.
> > there are too many and there are too many that have no practical
> > relevance at all.
> > swscale has a generic converter path, does it even support all these
> > cases?
> 
> I currently have no idea, unless you're referring to
> pixdesc.c:read_line()/write_line(), yes that could work.

I refered to the scaled converter path not pixdesc.c:read_line()/write_line()

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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- 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/20100219/20dbee58/attachment.pgp>



More information about the ffmpeg-devel mailing list