aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/i386
diff options
context:
space:
mode:
authorArpi <arpi@thot.banki.hu>2001-08-03 18:33:03 +0000
committerArpi <arpi@thot.banki.hu>2001-08-03 18:33:03 +0000
commit4af7bcc1857e8abfa7ae9a8e3c54c93723219438 (patch)
tree22217576fcce734d75eaac61ce399839ec168044 /libavcodec/i386
parent2d6d0c1d66accc7976325190f17dc93ebd9b665d (diff)
downloadffmpeg-4af7bcc1857e8abfa7ae9a8e3c54c93723219438.tar.gz
MMX/MMXEXT iDCT support, using external functions currently defined in libmpeg2
Gives average 13-20% mpeg decoding speedup on x86 systems. Originally committed as revision 30 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/i386')
-rw-r--r--libavcodec/i386/dsputil_mmx.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libavcodec/i386/dsputil_mmx.c b/libavcodec/i386/dsputil_mmx.c
index d4a07c3a77..d9028cf2b9 100644
--- a/libavcodec/i386/dsputil_mmx.c
+++ b/libavcodec/i386/dsputil_mmx.c
@@ -29,6 +29,16 @@ int pix_abs16x16_x2_mmx(UINT8 *blk1, UINT8 *blk2, int lx, int h);
int pix_abs16x16_y2_mmx(UINT8 *blk1, UINT8 *blk2, int lx, int h);
int pix_abs16x16_xy2_mmx(UINT8 *blk1, UINT8 *blk2, int lx, int h);
+#ifdef USE_MMX_IDCT
+/* external functions, defined in libmpeg2 */
+void mmx_idct(DCTELEM *block);
+void mmxext_idct(DCTELEM *block);
+/* this should be in dsputil.h? -- A'rpi */
+extern UINT8 ff_alternate_horizontal_scan[64];
+extern UINT8 ff_alternate_vertical_scan[64];
+extern UINT8 zigzag_direct[64];
+#endif
+
/* pixel operations */
static const unsigned long long int mm_wone __attribute__ ((aligned(8))) = 0x0001000100010001;
static const unsigned long long int mm_wtwo __attribute__ ((aligned(8))) = 0x0002000200020002;
@@ -1039,5 +1049,23 @@ void dsputil_init_mmx(void)
sub_pixels_tab[1] = sub_pixels_x2_3dnow;
sub_pixels_tab[2] = sub_pixels_y2_3dnow;
}
+
+#ifdef USE_MMX_IDCT
+ /* use MMX / MMXEXT iDCT code from libmpeg2 */
+ //printf("LIBAVCODEC: Using MMX%s iDCT code\n",(mm_flags & MM_MMXEXT)?"EXT":"");
+ ff_idct = (mm_flags & MM_MMXEXT) ? mmxext_idct : mmx_idct;
+ /* the mmx/mmxext idct uses a reordered input, so we patch scan tables */
+ { int i,j;
+ for (i = 0; i < 64; i++) {
+ j = zigzag_direct[i];
+ zigzag_direct[i] = (j & 0x38) | ((j & 6) >> 1) | ((j & 1) << 2);
+ j = ff_alternate_horizontal_scan[i];
+ ff_alternate_horizontal_scan[i] = (j & 0x38) | ((j & 6) >> 1) | ((j & 1) << 2);
+ j = ff_alternate_vertical_scan[i];
+ ff_alternate_vertical_scan[i] = (j & 0x38) | ((j & 6) >> 1) | ((j & 1) << 2);
+ }
+ }
+#endif
+
}
}