summaryrefslogtreecommitdiff
path: root/libavcodec/i386/dsputil_mmx.c
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2006-03-23 20:16:36 +0000
committerLoren Merritt <lorenm@u.washington.edu>2006-03-23 20:16:36 +0000
commit513fbd8e5ab9ca266394112b177a40b6eb1d8208 (patch)
tree2cc484711e334dcf1633a231212758ed3b2d2bff /libavcodec/i386/dsputil_mmx.c
parent7e815047e5621683ab7a91a23c93906cf916ff36 (diff)
prefetch pixels for future motion compensation. 2-5% faster h264.
Originally committed as revision 5203 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/i386/dsputil_mmx.c')
-rw-r--r--libavcodec/i386/dsputil_mmx.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavcodec/i386/dsputil_mmx.c b/libavcodec/i386/dsputil_mmx.c
index f1d45c0826..1aa5c850b2 100644
--- a/libavcodec/i386/dsputil_mmx.c
+++ b/libavcodec/i386/dsputil_mmx.c
@@ -2489,6 +2489,18 @@ static void add_8x8basis_mmx(int16_t rem[64], int16_t basis[64], int scale){
}
}
+#define PREFETCH(name, op) \
+void name(void *mem, int stride, int h){\
+ const uint8_t *p= mem;\
+ do{\
+ asm volatile(#op" %0" :: "m"(*p));\
+ p+= stride;\
+ }while(--h);\
+}
+PREFETCH(prefetch_mmx2, prefetcht0)
+PREFETCH(prefetch_3dnow, prefetch)
+#undef PREFETCH
+
#include "h264dsp_mmx.c"
/* external functions, from idct_mmx.c */
@@ -2749,6 +2761,8 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->h264_idct8_add= ff_h264_idct8_add_mmx;
if (mm_flags & MM_MMXEXT) {
+ c->prefetch = prefetch_mmx2;
+
c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2;
c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2;
@@ -2879,6 +2893,8 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_mmx2;
#endif //CONFIG_ENCODERS
} else if (mm_flags & MM_3DNOW) {
+ c->prefetch = prefetch_3dnow;
+
c->put_pixels_tab[0][1] = put_pixels16_x2_3dnow;
c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow;