diff --git a/libavcodec/imc.c b/libavcodec/imc.c index 8e6b5bfb31..1156e8aac2 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -241,7 +241,7 @@ static av_cold int imc_decode_init(AVCodecContext *avctx) return ret; } ff_dsputil_init(&q->dsp, avctx); - avctx->sample_fmt = AV_SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; @@ -661,7 +661,7 @@ static void imc_imdct256(IMCContext *q, IMCChannel *chctx, int channels) int i; float re, im; float *dst1 = q->out_samples; - float *dst2 = q->out_samples + (COEFFS - 1) * channels; + float *dst2 = q->out_samples + (COEFFS - 1); /* prerotation */ for (i = 0; i < COEFFS / 2; i++) { @@ -683,8 +683,8 @@ static void imc_imdct256(IMCContext *q, IMCChannel *chctx, int channels) + (q->mdct_sine_window[i * 2] * re); *dst2 = (q->mdct_sine_window[i * 2] * chctx->last_fft_im[i]) - (q->mdct_sine_window[COEFFS - 1 - i * 2] * re); - dst1 += channels * 2; - dst2 -= channels * 2; + dst1 += 2; + dst2 -= 2; chctx->last_fft_im[i] = im; } } @@ -785,7 +785,6 @@ static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch) chctx->decoder_reset = 1; if (chctx->decoder_reset) { - memset(q->out_samples, 0, COEFFS * sizeof(*q->out_samples)); for (i = 0; i < BANDS; i++) chctx->old_floor[i] = 1.0; for (i = 0; i < COEFFS; i++) @@ -944,7 +943,7 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data, } for (i = 0; i < avctx->channels; i++) { - q->out_samples = (float*)q->frame.data[0] + i; + q->out_samples = (float *)q->frame.extended_data[i]; q->dsp.bswap16_buf(buf16, (const uint16_t*)buf, IMC_BLOCK_SIZE / 2); @@ -957,15 +956,8 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data, } if (avctx->channels == 2) { - float *src = (float*)q->frame.data[0], t1, t2; - - for (i = 0; i < COEFFS; i++) { - t1 = src[0]; - t2 = src[1]; - src[0] = t1 + t2; - src[1] = t1 - t2; - src += 2; - } + q->dsp.butterflies_float((float *)q->frame.extended_data[0], + (float *)q->frame.extended_data[1], COEFFS); } *got_frame_ptr = 1; @@ -995,6 +987,8 @@ AVCodec ff_imc_decoder = { .decode = imc_decode_frame, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("IMC (Intel Music Coder)"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, + AV_SAMPLE_FMT_NONE }, }; AVCodec ff_iac_decoder = { @@ -1007,4 +1001,6 @@ AVCodec ff_iac_decoder = { .decode = imc_decode_frame, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("IAC (Indeo Audio Coder)"), + .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, + AV_SAMPLE_FMT_NONE }, };