diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2002-02-09 17:03:53 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-02-09 17:03:53 +0000 |
commit | ac6a2e4550d27bfd23c0c096b1ee10b1d76de213 (patch) | |
tree | 8a91d3bde9e30e67a46cb0a4ea838a7fe1770d3b /postproc/swscale_template.c | |
parent | 81401c1fbc79c3350e91ef15dd25b50afa9e5d4d (diff) | |
download | ffmpeg-streaming-ac6a2e4550d27bfd23c0c096b1ee10b1d76de213.zip ffmpeg-streaming-ac6a2e4550d27bfd23c0c096b1ee10b1d76de213.tar.gz |
bgr24toY in MMX
Originally committed as revision 4613 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
Diffstat (limited to 'postproc/swscale_template.c')
-rw-r--r-- | postproc/swscale_template.c | 71 |
1 files changed, 70 insertions, 1 deletions
diff --git a/postproc/swscale_template.c b/postproc/swscale_template.c index 26e23fe..bea1377 100644 --- a/postproc/swscale_template.c +++ b/postproc/swscale_template.c @@ -1635,7 +1635,76 @@ static inline void RENAME(bgr32ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1 static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, int width) { -#ifdef HAVE_MMXFIXME +#ifdef HAVE_MMX + asm volatile( + "movl %2, %%eax \n\t" + "movq bgr2YCoeff, %%mm6 \n\t" + "movq w1111, %%mm5 \n\t" + "pxor %%mm7, %%mm7 \n\t" + "leal (%%eax, %%eax, 2), %%ebx \n\t" + ".balign 16 \n\t" + "1: \n\t" + PREFETCH" 64(%0, %%ebx) \n\t" + "movd (%0, %%ebx), %%mm0 \n\t" + "movd 3(%0, %%ebx), %%mm1 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "movd 6(%0, %%ebx), %%mm2 \n\t" + "movd 9(%0, %%ebx), %%mm3 \n\t" + "punpcklbw %%mm7, %%mm2 \n\t" + "punpcklbw %%mm7, %%mm3 \n\t" + "pmaddwd %%mm6, %%mm0 \n\t" + "pmaddwd %%mm6, %%mm1 \n\t" + "pmaddwd %%mm6, %%mm2 \n\t" + "pmaddwd %%mm6, %%mm3 \n\t" +#ifndef FAST_BGR2YV12 + "psrad $8, %%mm0 \n\t" + "psrad $8, %%mm1 \n\t" + "psrad $8, %%mm2 \n\t" + "psrad $8, %%mm3 \n\t" +#endif + "packssdw %%mm1, %%mm0 \n\t" + "packssdw %%mm3, %%mm2 \n\t" + "pmaddwd %%mm5, %%mm0 \n\t" + "pmaddwd %%mm5, %%mm2 \n\t" + "packssdw %%mm2, %%mm0 \n\t" + "psraw $7, %%mm0 \n\t" + + "movd 12(%0, %%ebx), %%mm4 \n\t" + "movd 15(%0, %%ebx), %%mm1 \n\t" + "punpcklbw %%mm7, %%mm4 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "movd 18(%0, %%ebx), %%mm2 \n\t" + "movd 21(%0, %%ebx), %%mm3 \n\t" + "punpcklbw %%mm7, %%mm2 \n\t" + "punpcklbw %%mm7, %%mm3 \n\t" + "pmaddwd %%mm6, %%mm4 \n\t" + "pmaddwd %%mm6, %%mm1 \n\t" + "pmaddwd %%mm6, %%mm2 \n\t" + "pmaddwd %%mm6, %%mm3 \n\t" +#ifndef FAST_BGR2YV12 + "psrad $8, %%mm4 \n\t" + "psrad $8, %%mm1 \n\t" + "psrad $8, %%mm2 \n\t" + "psrad $8, %%mm3 \n\t" +#endif + "packssdw %%mm1, %%mm4 \n\t" + "packssdw %%mm3, %%mm2 \n\t" + "pmaddwd %%mm5, %%mm4 \n\t" + "pmaddwd %%mm5, %%mm2 \n\t" + "addl $24, %%ebx \n\t" + "packssdw %%mm2, %%mm4 \n\t" + "psraw $7, %%mm4 \n\t" + + "packuswb %%mm4, %%mm0 \n\t" + "paddusb bgr2YOffset, %%mm0 \n\t" + + MOVNTQ(%%mm0, (%1, %%eax)) + "addl $8, %%eax \n\t" + " js 1b \n\t" + : : "r" (src+width*3), "r" (dst+width), "g" (-width) + : "%eax", "%ebx" + ); #else int i; for(i=0; i<width; i++) |