[FFmpeg-devel] Extend/optimize RGB to RGB conversions funcsintorgb2rgb.c

yann.lepetitcorps at free.fr yann.lepetitcorps at free.fr
Tue Sep 11 01:00:22 CEST 2012


Selon Clément B½sch <ubitux at gmail.com>:

> On Tue, Sep 11, 2012 at 12:25:32AM +0200, yann.lepetitcorps at free.fr wrote:
> > And found this at
> >
>
http://stackoverflow.com/questions/7194452/fast-vectorized-conversion-from-rgb-to-bgra
> >
> > #include <tmmintrin.h>
> >
> > /* in and out must be 16-byte aligned */
> > void rgb_to_bgrx_sse(unsigned w, const void *in, void *out)
> > {
> >     const __m128i *in_vec = in;
> >     __m128i *out_vec = out;
> >
> >     w /= 16;
> >
> >     while (w-- > 0) {
> >         /*             0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15
> >          * in_vec[0]   Ra Ga Ba Rb Gb Bb Rc Gc Bc Rd Gd Bd Re Ge Be Rf
> >          * in_vec[1]   Gg Bg Rh Gh Bh Ri Gi Bi Rj Gj Bj Rk Gk Bk Rl Gl
> >          * in_vec[2]   Bl Rm Gm Bm Rn Gn Bn Ro Go Bo Rp Gp Bp Rq Gq Bq
> >          */
> >         __m128i in1, in2, in3;
> >         __m128i out;
> >
> [...]
>
> If you are willing to add SSE optims or similar, you should check
> libswscale/x86/rgb2rgb_template.c and related files. It's likely they
> already exist.
>
> Also, it's hard to follow the thread when you are top posting.
>
> Regards,
>
> --
> Clément B.

Thanks for your feedback,

I have first wanted to accellerate the current **C standard** versions of
rgb24to32() and rgb32to24() but alls versions that I have found seem run at the
best on the same speed as the FFMPEG versions

=> the "C standardized" FFMPEG's versions of rgb2rgba() and  rgba2rgb() seem now
to me near optimals (with only using a standard C coding of course ...)

So it's why now I begin to take a look at the level of MMX/SSE ways :)

==> I will now go for a ride on the side of libswscale/x86/rgb2rgb_template.c :)


@+
Yannoo





More information about the ffmpeg-devel mailing list