diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-09-16 14:48:45 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-09-16 14:55:00 +0200 |
commit | e80cbdbc57292a4687339f6a7d30e0dcff42f9e8 (patch) | |
tree | c71ab556c3aa7a3307a39e24f7250d9645958aa8 /libavcodec/nellymoserdec.c | |
parent | 744e4429cf9a2ac5c7c1e4ed8bfbb6f9f09a882a (diff) | |
parent | 2568646abb6568b1d329f800a046832adc48acd4 (diff) | |
download | ffmpeg-e80cbdbc57292a4687339f6a7d30e0dcff42f9e8.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
mpegvideo: drop unnecessary arguments to hpel_motion()
mpegvideo: drop 'inline' from some functions
nellymoserdec: drop support for s16 output.
bmpdec: only initialize palette for pal8.
build: Properly remove object files while cleaning
flacdsp: arm optimised lpc filter
compat/vsnprintf: return number of bytes required on truncation.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/nellymoserdec.c')
-rw-r--r-- | libavcodec/nellymoserdec.c | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index 20ab8f84cb..ae98bf5c31 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -48,13 +48,11 @@ typedef struct NellyMoserDecodeContext { AVCodecContext* avctx; AVFrame frame; - float *float_buf; AVLFG random_state; GetBitContext gb; float scale_bias; DSPContext dsp; FFTContext imdct_ctx; - FmtConvertContext fmt_conv; DECLARE_ALIGNED(32, float, imdct_buf)[2][NELLY_BUF_LEN]; float *imdct_out; float *imdct_prev; @@ -124,19 +122,8 @@ static av_cold int decode_init(AVCodecContext * avctx) { ff_dsputil_init(&s->dsp, avctx); - if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) { - s->scale_bias = 1.0/(32768*8); - avctx->sample_fmt = AV_SAMPLE_FMT_FLT; - } else { - s->scale_bias = 1.0/(1*8); - avctx->sample_fmt = AV_SAMPLE_FMT_S16; - ff_fmt_convert_init(&s->fmt_conv, avctx); - s->float_buf = av_mallocz(NELLY_SAMPLES * sizeof(*s->float_buf)); - if (!s->float_buf) { - av_log(avctx, AV_LOG_ERROR, "error allocating float buffer\n"); - return AVERROR(ENOMEM); - } - } + s->scale_bias = 1.0/(32768*8); + avctx->sample_fmt = AV_SAMPLE_FMT_FLT; /* Generate overlap window */ if (!ff_sine_128[127]) @@ -158,7 +145,6 @@ static int decode_tag(AVCodecContext *avctx, void *data, int buf_size = avpkt->size; NellyMoserDecodeContext *s = avctx->priv_data; int blocks, i, ret; - int16_t *samples_s16; float *samples_flt; blocks = buf_size / NELLY_BLOCK_LEN; @@ -188,18 +174,11 @@ static int decode_tag(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } - samples_s16 = (int16_t *)s->frame.data[0]; samples_flt = (float *)s->frame.data[0]; for (i=0 ; i<blocks ; i++) { - if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) { - nelly_decode_block(s, buf, samples_flt); - samples_flt += NELLY_SAMPLES; - } else { - nelly_decode_block(s, buf, s->float_buf); - s->fmt_conv.float_to_int16(samples_s16, s->float_buf, NELLY_SAMPLES); - samples_s16 += NELLY_SAMPLES; - } + nelly_decode_block(s, buf, samples_flt); + samples_flt += NELLY_SAMPLES; buf += NELLY_BLOCK_LEN; } @@ -212,7 +191,6 @@ static int decode_tag(AVCodecContext *avctx, void *data, static av_cold int decode_end(AVCodecContext * avctx) { NellyMoserDecodeContext *s = avctx->priv_data; - av_freep(&s->float_buf); ff_mdct_end(&s->imdct_ctx); return 0; @@ -229,6 +207,5 @@ AVCodec ff_nellymoser_decoder = { .capabilities = CODEC_CAP_DR1 | CODEC_CAP_PARAM_CHANGE, .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"), .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT, - AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, }; |