diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2007-02-09 12:24:22 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2007-02-09 12:24:22 +0000 |
commit | 9301a0b4a9f640b24e6dcaa71ce1be53fdee7b48 (patch) | |
tree | 58296d1d5f1b4563e8edb6358554ed3708d82235 | |
parent | 7bb5c2a6ea33f4451b942201bafb8b19b60298cf (diff) | |
download | ffmpeg-9301a0b4a9f640b24e6dcaa71ce1be53fdee7b48.tar.gz |
merge asm fragments in H264_CHROMA_MC2_TMPL()
10% faster avg_h264_chroma_mc2_mmx2()
5% faster put_h264_chroma_mc2_mmx2()
Originally committed as revision 7897 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/i386/dsputil_h264_template_mmx.c | 69 |
1 files changed, 29 insertions, 40 deletions
diff --git a/libavcodec/i386/dsputil_h264_template_mmx.c b/libavcodec/i386/dsputil_h264_template_mmx.c index e09a1007e1..4eefc8b685 100644 --- a/libavcodec/i386/dsputil_h264_template_mmx.c +++ b/libavcodec/i386/dsputil_h264_template_mmx.c @@ -267,8 +267,6 @@ static void H264_CHROMA_MC2_TMPL(uint8_t *dst/*align 2*/, uint8_t *src/*align 1* { int CD=((1<<16)-1)*x*y + 8*y; int AB=((8<<16)-8)*x + 64 - CD; - int i; - asm volatile( /* mm5 = {A,B,A,B} */ /* mm6 = {C,D,C,D} */ @@ -277,50 +275,41 @@ static void H264_CHROMA_MC2_TMPL(uint8_t *dst/*align 2*/, uint8_t *src/*align 1* "punpckldq %%mm5, %%mm5\n\t" "punpckldq %%mm6, %%mm6\n\t" "pxor %%mm7, %%mm7\n\t" - :: "r"(AB), "r"(CD)); - - asm volatile( /* mm0 = src[0,1,1,2] */ - "movd %0, %%mm0\n\t" + "movd %2, %%mm0\n\t" "punpcklbw %%mm7, %%mm0\n\t" "pshufw $0x94, %%mm0, %%mm0\n\t" - :: "m"(src[0])); + :: "r"(AB), "r"(CD), "m"(src[0])); - for(i=0; i<h; i++) { - asm volatile( - /* mm1 = A * src[0,1] + B * src[1,2] */ - "movq %%mm0, %%mm1\n\t" - "pmaddwd %%mm5, %%mm1\n\t" - ::); - src += stride; - asm volatile( - /* mm0 = src[0,1,1,2] */ - "movd %0, %%mm0\n\t" - "punpcklbw %%mm7, %%mm0\n\t" - "pshufw $0x94, %%mm0, %%mm0\n\t" - :: "m"(src[0])); - - asm volatile( - /* mm1 += C * src[0,1] + D * src[1,2] */ - "movq %%mm0, %%mm2\n\t" - "pmaddwd %%mm6, %%mm2\n\t" - "paddw %%mm2, %%mm1\n\t" - ::); + asm volatile( + "1:\n\t" + "addl %4, %1\n\t" + /* mm1 = A * src[0,1] + B * src[1,2] */ + "movq %%mm0, %%mm1\n\t" + "pmaddwd %%mm5, %%mm1\n\t" + /* mm0 = src[0,1,1,2] */ + "movd (%1), %%mm0\n\t" + "punpcklbw %%mm7, %%mm0\n\t" + "pshufw $0x94, %%mm0, %%mm0\n\t" + /* mm1 += C * src[0,1] + D * src[1,2] */ + "movq %%mm0, %%mm2\n\t" + "pmaddwd %%mm6, %%mm2\n\t" + "paddw %%mm2, %%mm1\n\t" + /* dst[0,1] = pack((mm1 + 32) >> 6) */ + "paddw %3, %%mm1\n\t" + "psrlw $6, %%mm1\n\t" + "packssdw %%mm7, %%mm1\n\t" + "packuswb %%mm7, %%mm1\n\t" + /* writes garbage to the right of dst. + * ok because partitions are processed from left to right. */ + H264_CHROMA_OP4((%0), %%mm1, %%mm3) + "movd %%mm1, (%0)\n\t" + "addl %4, %0\n\t" + "subl $1, %2\n\t" + "jnz 1b\n\t" + : "+r" (dst), "+r"(src), "+r"(h) : "m" (ff_pw_32), "r"(stride)); - asm volatile( - /* dst[0,1] = pack((mm1 + 32) >> 6) */ - "paddw %1, %%mm1\n\t" - "psrlw $6, %%mm1\n\t" - "packssdw %%mm7, %%mm1\n\t" - "packuswb %%mm7, %%mm1\n\t" - /* writes garbage to the right of dst. - * ok because partitions are processed from left to right. */ - H264_CHROMA_OP4(%0, %%mm1, %%mm3) - "movd %%mm1, %0\n\t" - : "=m" (dst[0]) : "m" (ff_pw_32)); - dst += stride; - } } #endif |