diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-09-21 21:17:09 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-09-21 21:17:09 +0000 |
commit | 12e9668119df1539b1f967aff2e351923ddd043c (patch) | |
tree | 2c8c8a0f259bf1c21e42efa10204c3819b680b7e /libavcodec/i386/mpegvideo_mmx_template.c | |
parent | dc9f52602f6493b33d1ac0d729ffb188e6a676fa (diff) | |
download | ffmpeg-12e9668119df1539b1f967aff2e351923ddd043c.tar.gz |
replace a few mov + psrlq with pshufw, there are more cases which could benefit from this but they would require us to duplicate some functions ...
the trick is from various places (my own code in libpostproc, a patch on the x264 list, ...)
Originally committed as revision 4608 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/i386/mpegvideo_mmx_template.c')
-rw-r--r-- | libavcodec/i386/mpegvideo_mmx_template.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/libavcodec/i386/mpegvideo_mmx_template.c b/libavcodec/i386/mpegvideo_mmx_template.c index c9354dc1bb..93f156ee55 100644 --- a/libavcodec/i386/mpegvideo_mmx_template.c +++ b/libavcodec/i386/mpegvideo_mmx_template.c @@ -22,7 +22,11 @@ #ifdef HAVE_MMX2 #define SPREADW(a) "pshufw $0, " #a ", " #a " \n\t" #define PMAXW(a,b) "pmaxsw " #a ", " #b " \n\t" - +#define PMAX(a,b) \ + "pshufw $0x0E," #a ", " #b " \n\t"\ + PMAXW(b, a)\ + "pshufw $0x01," #a ", " #b " \n\t"\ + PMAXW(b, a) #else #define SPREADW(a) \ "punpcklwd " #a ", " #a " \n\t"\ @@ -30,6 +34,14 @@ #define PMAXW(a,b) \ "psubusw " #a ", " #b " \n\t"\ "paddw " #a ", " #b " \n\t" +#define PMAX(a,b) \ + "movq " #a ", " #b " \n\t"\ + "psrlq $32, " #a " \n\t"\ + PMAXW(b, a)\ + "movq " #a ", " #b " \n\t"\ + "psrlq $16, " #a " \n\t"\ + PMAXW(b, a) + #endif static int RENAME(dct_quantize)(MpegEncContext *s, @@ -119,12 +131,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s, PMAXW(%%mm0, %%mm3) "add $8, %%"REG_a" \n\t" " js 1b \n\t" - "movq %%mm3, %%mm0 \n\t" - "psrlq $32, %%mm3 \n\t" - PMAXW(%%mm0, %%mm3) - "movq %%mm3, %%mm0 \n\t" - "psrlq $16, %%mm3 \n\t" - PMAXW(%%mm0, %%mm3) + PMAX(%%mm3, %%mm0) "movd %%mm3, %%"REG_a" \n\t" "movzb %%al, %%"REG_a" \n\t" // last_non_zero_p1 : "+a" (last_non_zero_p1) @@ -170,12 +177,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s, PMAXW(%%mm0, %%mm3) "add $8, %%"REG_a" \n\t" " js 1b \n\t" - "movq %%mm3, %%mm0 \n\t" - "psrlq $32, %%mm3 \n\t" - PMAXW(%%mm0, %%mm3) - "movq %%mm3, %%mm0 \n\t" - "psrlq $16, %%mm3 \n\t" - PMAXW(%%mm0, %%mm3) + PMAX(%%mm3, %%mm0) "movd %%mm3, %%"REG_a" \n\t" "movzb %%al, %%"REG_a" \n\t" // last_non_zero_p1 : "+a" (last_non_zero_p1) |