aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2004-04-25 03:33:30 +0000
committerMike Melanson <mike@multimedia.cx>2004-04-25 03:33:30 +0000
commit38acbc3cb97cae0c36023979215e94c659a41076 (patch)
treeef78ac6add10b0fe0ebcafcbedee9359a37e4215 /libavcodec
parent78a16bfec6d8b76be256b73b61b047c46766fa70 (diff)
downloadffmpeg-38acbc3cb97cae0c36023979215e94c659a41076.tar.gz
hook up support for SSE2-optimized VP3 IDCT
Originally committed as revision 3064 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/Makefile3
-rw-r--r--libavcodec/dsputil.h7
-rw-r--r--libavcodec/i386/dsputil_mmx.c12
-rw-r--r--libavcodec/vp3.c8
4 files changed, 23 insertions, 7 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index e3a2429ec7..3b8f14b338 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -116,7 +116,8 @@ ifeq ($(TARGET_MMX),yes)
OBJS += i386/fdct_mmx.o i386/cputest.o \
i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
i386/idct_mmx.o i386/motion_est_mmx.o \
- i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o
+ i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o \
+ i386/vp3dsp_sse2.o
ifdef TARGET_BUILTIN_VECTOR
i386/fft_sse.o: CFLAGS+= -msse
depend: CFLAGS+= -msse
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index d9266581ea..9ad407db8e 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -73,6 +73,12 @@ void vp3_idct_put_mmx(int16_t *input_data, int16_t *dequant_matrix,
void vp3_idct_add_mmx(int16_t *input_data, int16_t *dequant_matrix,
int coeff_count, uint8_t *dest, int stride);
+void vp3_dsp_init_sse2(void);
+void vp3_idct_put_sse2(int16_t *input_data, int16_t *dequant_matrix,
+ int coeff_count, uint8_t *dest, int stride);
+void vp3_idct_add_sse2(int16_t *input_data, int16_t *dequant_matrix,
+ int coeff_count, uint8_t *dest, int stride);
+
/* minimum alignment rules ;)
if u notice errors in the align stuff, need more alignment for some asm code for some cpu
@@ -403,6 +409,7 @@ static inline void emms(void)
}
#define __align8 __attribute__ ((aligned (8)))
+#define __align16 __attribute__ ((aligned (16)))
void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);
diff --git a/libavcodec/i386/dsputil_mmx.c b/libavcodec/i386/dsputil_mmx.c
index 15dc8eec2e..772c9c1f03 100644
--- a/libavcodec/i386/dsputil_mmx.c
+++ b/libavcodec/i386/dsputil_mmx.c
@@ -2147,9 +2147,15 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
}
/* VP3 optimized DSP functions */
- c->vp3_dsp_init = vp3_dsp_init_mmx;
- c->vp3_idct_put = vp3_idct_put_mmx;
- c->vp3_idct_add = vp3_idct_add_mmx;
+ if (mm_flags & MM_SSE2) {
+ c->vp3_dsp_init = vp3_dsp_init_sse2;
+ c->vp3_idct_put = vp3_idct_put_sse2;
+ c->vp3_idct_add = vp3_idct_add_sse2;
+ } else {
+ c->vp3_dsp_init = vp3_dsp_init_mmx;
+ c->vp3_idct_put = vp3_idct_put_mmx;
+ c->vp3_idct_add = vp3_idct_add_mmx;
+ }
#ifdef CONFIG_ENCODERS
c->get_pixels = get_pixels_mmx;
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index eadfd39b95..0667d99eb8 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -268,9 +268,11 @@ typedef struct Vp3DecodeContext {
VLC ac_vlc_3[16];
VLC ac_vlc_4[16];
- int16_t intra_y_dequant[64];
- int16_t intra_c_dequant[64];
- int16_t inter_dequant[64];
+ /* these arrays need to be on 16-byte boundaries since SSE2 operations
+ * index into them */
+ int16_t __align16 intra_y_dequant[64];
+ int16_t __align16 intra_c_dequant[64];
+ int16_t __align16 inter_dequant[64];
/* This table contains superblock_count * 16 entries. Each set of 16
* numbers corresponds to the fragment indices 0..15 of the superblock.