X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fnellymoserdec.c;h=5033282061e21b6827c6e071262e63adf20bde6c;hb=1da2a20763ae9ca579d5fd20763065871ddf6311;hp=b6aa6f5f82f9b47a841ef069199ad104abc3580e;hpb=594d4d5df3c70404168701dd5c90b7e6e5587793;p=ffmpeg diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index b6aa6f5f82f..5033282061e 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -32,12 +32,11 @@ */ #include "libavutil/channel_layout.h" +#include "libavutil/float_dsp.h" #include "libavutil/lfg.h" #include "libavutil/random_seed.h" #include "avcodec.h" -#include "dsputil.h" #include "fft.h" -#include "fmtconvert.h" #include "internal.h" #include "nellymoser.h" #include "sinewin.h" @@ -48,11 +47,10 @@ typedef struct NellyMoserDecodeContext { AVCodecContext* avctx; - AVFrame frame; AVLFG random_state; GetBitContext gb; float scale_bias; - DSPContext dsp; + AVFloatDSPContext fdsp; FFTContext imdct_ctx; DECLARE_ALIGNED(32, float, imdct_buf)[2][NELLY_BUF_LEN]; float *imdct_out; @@ -107,7 +105,9 @@ static void nelly_decode_block(NellyMoserDecodeContext *s, (NELLY_BUF_LEN - NELLY_FILL_LEN) * sizeof(float)); 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); + s->fdsp.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); } } @@ -121,7 +121,7 @@ static av_cold int decode_init(AVCodecContext * avctx) { av_lfg_init(&s->random_state, 0); ff_mdct_init(&s->imdct_ctx, 8, 1, 1.0); - ff_dsputil_init(&s->dsp, avctx); + avpriv_float_dsp_init(&s->fdsp, avctx->flags & AV_CODEC_FLAG_BITEXACT); s->scale_bias = 1.0/(32768*8); avctx->sample_fmt = AV_SAMPLE_FMT_FLT; @@ -133,15 +133,13 @@ static av_cold int decode_init(AVCodecContext * avctx) { avctx->channels = 1; avctx->channel_layout = AV_CH_LAYOUT_MONO; - avcodec_get_frame_defaults(&s->frame); - avctx->coded_frame = &s->frame; - return 0; } static int decode_tag(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { + AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; NellyMoserDecodeContext *s = avctx->priv_data; @@ -166,12 +164,12 @@ static int decode_tag(AVCodecContext *avctx, void *data, */ /* get output buffer */ - s->frame.nb_samples = NELLY_SAMPLES * blocks; - if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { + frame->nb_samples = NELLY_SAMPLES * blocks; + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } - samples_flt = (float *)s->frame.data[0]; + samples_flt = (float *)frame->data[0]; for (i=0 ; iframe; + *got_frame_ptr = 1; return buf_size; } @@ -195,14 +192,14 @@ static av_cold int decode_end(AVCodecContext * avctx) { AVCodec ff_nellymoser_decoder = { .name = "nellymoser", + .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"), .type = AVMEDIA_TYPE_AUDIO, .id = AV_CODEC_ID_NELLYMOSER, .priv_data_size = sizeof(NellyMoserDecodeContext), .init = decode_init, .close = decode_end, .decode = decode_tag, - .capabilities = CODEC_CAP_DR1 | CODEC_CAP_PARAM_CHANGE, - .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"), + .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_PARAM_CHANGE, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE }, };