summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodec.c
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2010-06-24 07:44:50 +0000
committerVitor Sessak <vitor1001@gmail.com>2010-06-24 07:44:50 +0000
commitbc2b368215b4fb8848c2788b773a565ec0ed1471 (patch)
treee9d56487c3bc20b02922376715171b69539412f0 /libavcodec/mpegaudiodec.c
parent3bb96f914e9f70a752b60f08aa217c717695c571 (diff)
SSE-optimized MP3 floating point windowing functions
Originally committed as revision 23750 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r--libavcodec/mpegaudiodec.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index bdf01ea45a..9ee5b604e9 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -112,7 +112,7 @@ static const int32_t scale_factor_mult2[3][3] = {
SCALE_GEN(4.0 / 9.0), /* 9 steps */
};
-DECLARE_ALIGNED(16, MPA_INT, RENAME(ff_mpa_synth_window))[512];
+DECLARE_ALIGNED(16, MPA_INT, RENAME(ff_mpa_synth_window))[512+256];
/**
* Convert region offsets to region sizes and truncate
@@ -308,7 +308,9 @@ static av_cold int decode_init(AVCodecContext * avctx)
s->avctx = avctx;
s->apply_window_mp3 = apply_window_mp3_c;
-
+#if HAVE_MMX
+ ff_mpegaudiodec_init_mmx(s);
+#endif
avctx->sample_fmt= OUT_FMT;
s->error_recognition= avctx->error_recognition;
@@ -820,7 +822,7 @@ static inline int round_sample(int64_t *sum)
void av_cold RENAME(ff_mpa_synth_init)(MPA_INT *window)
{
- int i;
+ int i, j;
/* max = 18760, max sum over all 16 coefs : 44736 */
for(i=0;i<257;i++) {
@@ -837,6 +839,15 @@ void av_cold RENAME(ff_mpa_synth_init)(MPA_INT *window)
if (i != 0)
window[512 - i] = v;
}
+
+ // Needed for avoiding shuffles in ASM implementations
+ for(i=0; i < 8; i++)
+ for(j=0; j < 16; j++)
+ window[512+16*i+j] = window[64*i+32-j];
+
+ for(i=0; i < 8; i++)
+ for(j=0; j < 16; j++)
+ window[512+128+16*i+j] = window[64*i+48-j];
}
static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window,