[x264-devel] commit: Slightly faster predictor_difference_mmxext (Jason Garrett-Glaser )
git version control
git at videolan.org
Mon Feb 15 10:10:43 CET 2010
x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Mon Feb 1 13:04:47 2010 -0800| [08d4a999b0300e50196afb3ee0e310834028b537] | committer: Jason Garrett-Glaser
Slightly faster predictor_difference_mmxext
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=08d4a999b0300e50196afb3ee0e310834028b537
---
common/x86/util.h | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/common/x86/util.h b/common/x86/util.h
index efc700a..c8bcf4b 100644
--- a/common/x86/util.h
+++ b/common/x86/util.h
@@ -45,8 +45,9 @@ static inline void x264_median_mv_mmxext( int16_t *dst, int16_t *a, int16_t *b,
#define x264_predictor_difference x264_predictor_difference_mmxext
static inline int x264_predictor_difference_mmxext( int16_t (*mvc)[2], intptr_t i_mvc )
{
- int sum = 0;
- uint16_t output[4];
+ int sum;
+ static const uint64_t pw_1 = 0x0001000100010001ULL;
+
asm(
"pxor %%mm4, %%mm4 \n"
"test $1, %1 \n"
@@ -56,7 +57,7 @@ static inline int x264_predictor_difference_mmxext( int16_t (*mvc)[2], intptr_t
"psubw %%mm3, %%mm0 \n"
"jmp 2f \n"
"3: \n"
- "sub $1, %1 \n"
+ "dec %1 \n"
"1: \n"
"movq -8(%2,%1,4), %%mm0 \n"
"psubw -4(%2,%1,4), %%mm0 \n"
@@ -67,11 +68,13 @@ static inline int x264_predictor_difference_mmxext( int16_t (*mvc)[2], intptr_t
"pmaxsw %%mm2, %%mm0 \n"
"paddusw %%mm0, %%mm4 \n"
"jg 1b \n"
- "movq %%mm4, %0 \n"
- :"=m"(output), "+r"(i_mvc)
- :"r"(mvc), "m"(M64( mvc ))
+ "pmaddwd %4, %%mm4 \n"
+ "pshufw $14, %%mm4, %%mm0 \n"
+ "paddd %%mm0, %%mm4 \n"
+ "movd %%mm4, %0 \n"
+ :"=r"(sum), "+r"(i_mvc)
+ :"r"(mvc), "m"(M64( mvc )), "m"(pw_1)
);
- sum += output[0] + output[1] + output[2] + output[3];
return sum;
}
#define x264_cabac_amvd_sum x264_cabac_amvd_sum_mmxext
More information about the x264-devel
mailing list