aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2012-02-29 19:39:16 +0100
committerRonald S. Bultje <rsbultje@gmail.com>2012-02-29 15:38:35 -0800
commit5cd1337f5db49b4537d83ae2a8115a90d77e3a28 (patch)
tree33efd92724670fd5f3634b8d80a3e6e4cc7b5f9b /libavcodec
parent882abda5a26ffb8e3d1c5852dfa7cdad0a291d2d (diff)
downloadffmpeg-5cd1337f5db49b4537d83ae2a8115a90d77e3a28.tar.gz
nellymoserdec: Saner and faster IMDCT windowing
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/nellymoserdec.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index 96fb0533de..1583c20c33 100644
--- a/libavcodec/nellymoserdec.c
+++ b/libavcodec/nellymoserdec.c
@@ -49,14 +49,15 @@ typedef struct NellyMoserDecodeContext {
AVCodecContext* avctx;
AVFrame frame;
float *float_buf;
- DECLARE_ALIGNED(16, float, state)[NELLY_BUF_LEN];
AVLFG random_state;
GetBitContext gb;
float scale_bias;
DSPContext dsp;
FFTContext imdct_ctx;
FmtConvertContext fmt_conv;
- DECLARE_ALIGNED(32, float, imdct_out)[NELLY_BUF_LEN * 2];
+ DECLARE_ALIGNED(32, float, imdct_buf)[2][NELLY_BUF_LEN];
+ float *imdct_out;
+ float *imdct_prev;
} NellyMoserDecodeContext;
static void nelly_decode_block(NellyMoserDecodeContext *s,
@@ -106,12 +107,9 @@ static void nelly_decode_block(NellyMoserDecodeContext *s,
memset(&aptr[NELLY_FILL_LEN], 0,
(NELLY_BUF_LEN - NELLY_FILL_LEN) * sizeof(float));
- s->imdct_ctx.imdct_calc(&s->imdct_ctx, s->imdct_out, aptr);
- /* XXX: overlapping and windowing should be part of a more
- generic imdct function */
- s->dsp.vector_fmul_reverse(s->state, s->state, ff_sine_128, NELLY_BUF_LEN);
- s->dsp.vector_fmul_add(aptr, s->imdct_out, ff_sine_128, s->state, NELLY_BUF_LEN);
- memcpy(s->state, s->imdct_out + NELLY_BUF_LEN, sizeof(float)*NELLY_BUF_LEN);
+ s->imdct_ctx.imdct_half(&s->imdct_ctx, s->imdct_out, aptr);
+ s->dsp.vector_fmul_window(aptr, s->imdct_prev + NELLY_BUF_LEN/2, s->imdct_out, ff_sine_128, NELLY_BUF_LEN/2);
+ FFSWAP(float *, s->imdct_out, s->imdct_prev);
}
}
@@ -119,6 +117,8 @@ static av_cold int decode_init(AVCodecContext * avctx) {
NellyMoserDecodeContext *s = avctx->priv_data;
s->avctx = avctx;
+ s->imdct_out = s->imdct_buf[0];
+ s->imdct_prev = s->imdct_buf[1];
av_lfg_init(&s->random_state, 0);
ff_mdct_init(&s->imdct_ctx, 8, 1, 1.0);