summaryrefslogtreecommitdiff
path: root/libavcodec/nellymoserdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-01 23:11:31 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-01 23:11:31 +0100
commit1eb7f39c7b8172e02a7c95073036a2c327215db8 (patch)
treec3323cf0b704cdc2eda65bb202af3329a8973e2a /libavcodec/nellymoserdec.c
parent75d11b55d7c6f9417c047500171b8aa42b8b8f50 (diff)
parent0ce4fe482c27abfa7eac503a52fdc50b70ccd871 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: h264: error out on invalid bitdepth. aacsbr: use a swap index for the Y matrix rather than copy buffers. huffyuv: do not abort on unknown pix_fmt; instead, return an error. lcl: return negative error codes on decode_init() errors. rtpenc: Use MB info side data for splitting H263 packets for RFC 2190 h263enc: Add an option for outputting info about MBs as side data avpacket: Add a function for shrinking already allocated side data nellymoserdec: Saner and faster IMDCT windowing Conflicts: doc/APIchanges libavcodec/avpacket.c libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/nellymoserdec.c')
-rw-r--r--libavcodec/nellymoserdec.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index c74d54ec19..9d37983866 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);