summaryrefslogtreecommitdiff
path: root/src/libffmpeg/libavcodec/wmadec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libffmpeg/libavcodec/wmadec.c')
-rw-r--r--src/libffmpeg/libavcodec/wmadec.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/src/libffmpeg/libavcodec/wmadec.c b/src/libffmpeg/libavcodec/wmadec.c
index 227c9695b..684aea2c8 100644
--- a/src/libffmpeg/libavcodec/wmadec.c
+++ b/src/libffmpeg/libavcodec/wmadec.c
@@ -2,18 +2,20 @@
* WMA compatible decoder
* Copyright (c) 2002 The FFmpeg Project.
*
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -130,6 +132,7 @@ typedef struct WMADecodeContext {
float lsp_pow_e_table[256];
float lsp_pow_m_table1[(1 << LSP_POW_BITS)];
float lsp_pow_m_table2[(1 << LSP_POW_BITS)];
+ DSPContext dsp;
#ifdef TRACE
int frame_count;
@@ -228,6 +231,8 @@ static int wma_decode_init(AVCodecContext * avctx)
s->bit_rate = avctx->bit_rate;
s->block_align = avctx->block_align;
+ dsputil_init(&s->dsp, avctx);
+
if (avctx->codec->id == CODEC_ID_WMAV1) {
s->version = 1;
} else {
@@ -712,13 +717,8 @@ static int wma_decode_block(WMADecodeContext *s)
{
int n, v, a, ch, code, bsize;
int coef_nb_bits, total_gain, parse_exponents;
- float window[BLOCK_MAX_SIZE * 2];
-// XXX: FIXME!! there's a bug somewhere which makes this mandatory under altivec
-#ifdef HAVE_ALTIVEC
- volatile int nb_coefs[MAX_CHANNELS] __attribute__((aligned(16)));
-#else
+ DECLARE_ALIGNED_16(float, window[BLOCK_MAX_SIZE * 2]);
int nb_coefs[MAX_CHANNELS];
-#endif
float mdct_norm;
#ifdef TRACE
@@ -873,7 +873,7 @@ static int wma_decode_block(WMADecodeContext *s)
VLC *coef_vlc;
int level, run, sign, tindex;
int16_t *ptr, *eptr;
- const int16_t *level_table, *run_table;
+ const uint16_t *level_table, *run_table;
/* special VLC tables are used for ms stereo because
there is potentially less energy there */
@@ -1109,36 +1109,26 @@ static int wma_decode_block(WMADecodeContext *s)
if (s->channel_coded[ch]) {
DECLARE_ALIGNED_16(FFTSample, output[BLOCK_MAX_SIZE * 2]);
float *ptr;
- int i, n4, index, n;
+ int n4, index, n;
n = s->block_len;
n4 = s->block_len / 2;
- ff_imdct_calc(&s->mdct_ctx[bsize],
+ s->mdct_ctx[bsize].fft.imdct_calc(&s->mdct_ctx[bsize],
output, s->coefs[ch], s->mdct_tmp);
/* XXX: optimize all that by build the window and
multipying/adding at the same time */
- /* multiply by the window */
- for(i=0;i<n * 2;i++) {
- output[i] *= window[i];
- }
- /* add in the frame */
+ /* multiply by the window and add in the frame */
index = (s->frame_len / 2) + s->block_pos - n4;
ptr = &s->frame_out[ch][index];
- for(i=0;i<n * 2;i++) {
- *ptr += output[i];
- ptr++;
- }
+ s->dsp.vector_fmul_add_add(ptr,window,output,ptr,0,2*n,1);
/* specific fast case for ms-stereo : add to second
channel if it is not coded */
if (s->ms_stereo && !s->channel_coded[1]) {
ptr = &s->frame_out[1][index];
- for(i=0;i<n * 2;i++) {
- *ptr += output[i];
- ptr++;
- }
+ s->dsp.vector_fmul_add_add(ptr,window,output,ptr,0,2*n,1);
}
}
}