aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/imc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-02 16:25:58 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-02 17:27:52 +0200
commite88ca80dc325a0291c64e1dd3245c4943397cfa3 (patch)
treedf8abbc8d6defc5bf10932ed096ec18cd979d0eb /libavcodec/imc.c
parent82db8ee3211014a38db6b8cae03f1c3246938eee (diff)
parentbfcd4b6a1691d20aebc6d2308424c2a88334a9f0 (diff)
downloadffmpeg-e88ca80dc325a0291c64e1dd3245c4943397cfa3.tar.gz
Merge commit 'bfcd4b6a1691d20aebc6d2308424c2a88334a9f0'
* commit 'bfcd4b6a1691d20aebc6d2308424c2a88334a9f0': adpcmdec: set AVCodec.sample_fmts twinvq: use planar sample format ralf: use planar sample format mpc7/8: use planar sample format iac/imc: use planar sample format dcadec: use float planar sample format cook: use planar sample format atrac3: use float planar sample format apedec: output in planar sample format 8svx: use planar sample format Conflicts: libavcodec/8svx.c libavcodec/dcadec.c libavcodec/mpc7.c libavcodec/mpc8.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/imc.c')
-rw-r--r--libavcodec/imc.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index d12c7551e9..9da769ba38 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -242,7 +242,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;
@@ -662,7 +662,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++) {
@@ -684,8 +684,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;
}
}
@@ -786,7 +786,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++)
@@ -945,7 +944,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);
@@ -958,15 +957,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;
@@ -996,6 +988,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 },
};
#endif
#if CONFIG_IAC_DECODER
@@ -1009,5 +1003,7 @@ 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 },
};
#endif