diff options
author | Loren Merritt <lorenm@u.washington.edu> | 2007-05-10 22:24:19 +0000 |
---|---|---|
committer | Loren Merritt <lorenm@u.washington.edu> | 2007-05-10 22:24:19 +0000 |
commit | eca3810e31a15c62b24408f5b4ae53f2c043911a (patch) | |
tree | 26c0b57a91d1192c0ee1df9998553ce331a2a536 | |
parent | b3a257af27f22295ba201fa3518c9a8708d6ac0b (diff) | |
download | ffmpeg-eca3810e31a15c62b24408f5b4ae53f2c043911a.tar.gz |
tweak mmx2 sad.
6% faster on core2 and k8, no change on p4.
Originally committed as revision 8984 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/i386/motion_est_mmx.c | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/libavcodec/i386/motion_est_mmx.c b/libavcodec/i386/motion_est_mmx.c index e33870e0ff..3abbbe8cbc 100644 --- a/libavcodec/i386/motion_est_mmx.c +++ b/libavcodec/i386/motion_est_mmx.c @@ -75,13 +75,11 @@ static inline void sad8_1_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h) ASMALIGN(4) "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" - "movq (%2, %%"REG_a"), %%mm2 \n\t" - "psadbw %%mm2, %%mm0 \n\t" + "psadbw (%2, %%"REG_a"), %%mm0 \n\t" "add %3, %%"REG_a" \n\t" "movq (%1, %%"REG_a"), %%mm1 \n\t" - "movq (%2, %%"REG_a"), %%mm3 \n\t" - "psadbw %%mm1, %%mm3 \n\t" - "paddw %%mm3, %%mm0 \n\t" + "psadbw (%2, %%"REG_a"), %%mm1 \n\t" + "paddw %%mm1, %%mm0 \n\t" "paddw %%mm0, %%mm6 \n\t" "add %3, %%"REG_a" \n\t" " js 1b \n\t" @@ -97,17 +95,13 @@ static inline void sad8_2_mmx2(uint8_t *blk1a, uint8_t *blk1b, uint8_t *blk2, in ASMALIGN(4) "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" - "movq (%2, %%"REG_a"), %%mm2 \n\t" - "pavgb %%mm2, %%mm0 \n\t" - "movq (%3, %%"REG_a"), %%mm2 \n\t" - "psadbw %%mm2, %%mm0 \n\t" + "pavgb (%2, %%"REG_a"), %%mm0 \n\t" + "psadbw (%3, %%"REG_a"), %%mm0 \n\t" "add %4, %%"REG_a" \n\t" "movq (%1, %%"REG_a"), %%mm1 \n\t" - "movq (%2, %%"REG_a"), %%mm3 \n\t" - "pavgb %%mm1, %%mm3 \n\t" - "movq (%3, %%"REG_a"), %%mm1 \n\t" - "psadbw %%mm1, %%mm3 \n\t" - "paddw %%mm3, %%mm0 \n\t" + "pavgb (%2, %%"REG_a"), %%mm1 \n\t" + "psadbw (%3, %%"REG_a"), %%mm1 \n\t" + "paddw %%mm1, %%mm0 \n\t" "paddw %%mm0, %%mm6 \n\t" "add %4, %%"REG_a" \n\t" " js 1b \n\t" @@ -120,30 +114,24 @@ static inline void sad8_4_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h) { //FIXME reuse src long len= -(stride*h); asm volatile( - ASMALIGN(4) "movq "MANGLE(bone)", %%mm5 \n\t" + ASMALIGN(4) "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" - "movq (%2, %%"REG_a"), %%mm2 \n\t" "movq 1(%1, %%"REG_a"), %%mm1 \n\t" - "movq 1(%2, %%"REG_a"), %%mm3 \n\t" - "pavgb %%mm2, %%mm0 \n\t" - "pavgb %%mm1, %%mm3 \n\t" - "psubusb %%mm5, %%mm3 \n\t" - "pavgb %%mm3, %%mm0 \n\t" - "movq (%3, %%"REG_a"), %%mm2 \n\t" - "psadbw %%mm2, %%mm0 \n\t" + "pavgb (%2, %%"REG_a"), %%mm0 \n\t" + "pavgb 1(%2, %%"REG_a"), %%mm1 \n\t" + "psubusb %%mm5, %%mm1 \n\t" + "pavgb %%mm1, %%mm0 \n\t" + "psadbw (%3, %%"REG_a"), %%mm0 \n\t" "add %4, %%"REG_a" \n\t" - "movq (%1, %%"REG_a"), %%mm1 \n\t" - "movq (%2, %%"REG_a"), %%mm3 \n\t" - "movq 1(%1, %%"REG_a"), %%mm2 \n\t" - "movq 1(%2, %%"REG_a"), %%mm4 \n\t" - "pavgb %%mm3, %%mm1 \n\t" - "pavgb %%mm4, %%mm2 \n\t" - "psubusb %%mm5, %%mm2 \n\t" - "pavgb %%mm1, %%mm2 \n\t" - "movq (%3, %%"REG_a"), %%mm1 \n\t" - "psadbw %%mm1, %%mm2 \n\t" + "movq (%1, %%"REG_a"), %%mm2 \n\t" + "movq 1(%1, %%"REG_a"), %%mm3 \n\t" + "pavgb (%2, %%"REG_a"), %%mm2 \n\t" + "pavgb 1(%2, %%"REG_a"), %%mm3 \n\t" + "psubusb %%mm5, %%mm3 \n\t" + "pavgb %%mm3, %%mm2 \n\t" + "psadbw (%3, %%"REG_a"), %%mm2 \n\t" "paddw %%mm2, %%mm0 \n\t" "paddw %%mm0, %%mm6 \n\t" "add %4, %%"REG_a" \n\t" |