From 35b2a786f5ab1c116ce76f0c3e59b231962c6177 Mon Sep 17 00:00:00 2001 From: Fabrice Bellard Date: Mon, 30 Jul 2001 23:28:35 +0000 Subject: [PATCH] renamed - use of s->dct_unquantize function pointer - SHOULD add faster h263 mmx specific unquantization stuff Originally committed as revision 23 to svn://svn.ffmpeg.org/ffmpeg/trunk --- .../i386/{mpegvideo.c => mpegvideo_mmx.c} | 46 +++++++------------ 1 file changed, 17 insertions(+), 29 deletions(-) rename libavcodec/i386/{mpegvideo.c => mpegvideo_mmx.c} (89%) diff --git a/libavcodec/i386/mpegvideo.c b/libavcodec/i386/mpegvideo_mmx.c similarity index 89% rename from libavcodec/i386/mpegvideo.c rename to libavcodec/i386/mpegvideo_mmx.c index d9e5e5c114..549d019f48 100644 --- a/libavcodec/i386/mpegvideo.c +++ b/libavcodec/i386/mpegvideo_mmx.c @@ -19,6 +19,14 @@ * Optimized for ia32 cpus by Nick Kurshev */ +#include "../dsputil.h" +#include "../mpegvideo.h" + +#if 0 + +/* XXX: GL: I don't understand why this function needs optimization + (it is called only once per frame!), so I disabled it */ + void MPV_frame_start(MpegEncContext *s) { if (s->pict_type == B_TYPE) { @@ -52,10 +60,8 @@ void MPV_frame_start(MpegEncContext *s) :"eax","edx","ecx","memory"); } } +#endif -static void dct_unquantize(MpegEncContext *s, DCTELEM *block, int n, int qscale); - -#ifdef HAVE_MMX static const unsigned long long int mm_wabs __attribute__ ((aligned(8))) = 0xffffffffffffffffULL; static const unsigned long long int mm_wone __attribute__ ((aligned(8))) = 0x0001000100010001ULL; @@ -88,13 +94,8 @@ static const unsigned long long int mm_wone __attribute__ ((aligned(8))) = 0x000 high3:low3 = low1*low2 high3 += tlow1 */ -#ifdef BIN_PORTABILITY -static void dct_unquantize_mmx -#else -#define HAVE_DCT_UNQUANTIZE 1 -static void dct_unquantize -#endif -(MpegEncContext *s,DCTELEM *block, int n, int qscale) +static void dct_unquantize_mpeg1_mmx(MpegEncContext *s, + DCTELEM *block, int n, int qscale) { int i, level; const UINT16 *quant_matrix; @@ -216,24 +217,11 @@ static void dct_unquantize } } -#ifdef BIN_PORTABILITY -static void (*dct_unquantize_ptr)(MpegEncContext *s, - DCTELEM *block, int n, int qscale); - -void MPV_common_init_mmx(void) +void MPV_common_init_mmx(MpegEncContext *s) { - int mm_flags; - mm_flags = mm_support(); - if (mm_flags & MM_MMX) { - dct_unquantize_ptr = dct_unquantize_mmx; - } - else { - dct_unquantize_ptr = dct_unquantize; - } + if (mm_flags & MM_MMX) { + /* XXX: should include h263 optimization too. It would go even + faster! */ + s->dct_unquantize = dct_unquantize_mpeg1_mmx; + } } - -#define DCT_UNQUANTIZE(a,b,c,d) (*dct_unquantize_ptr)(a,b,c,d) -#else -#define DCT_UNQUANTIZE(a,b,c,d) dct_unquantize(a,b,c,d) -#endif /* BIN_PORTABILITY */ -#endif /* HAVE_MMX */