Originally committed as revision 24267 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -87,7 +87,7 @@ typedef struct {
|
| 87 | 87 |
DSPContext dsp; |
| 88 | 88 |
FFTContext fft; |
| 89 | 89 |
DECLARE_ALIGNED(16, FFTComplex, samples)[COEFFS/2]; |
| 90 |
- DECLARE_ALIGNED(16, float, out_samples)[COEFFS]; |
|
| 90 |
+ float *out_samples; |
|
| 91 | 91 |
} IMCContext; |
| 92 | 92 |
|
| 93 | 93 |
static VLC huffman_vlc[4][4]; |
| ... | ... |
@@ -116,8 +116,8 @@ static av_cold int imc_decode_init(AVCodecContext * avctx) |
| 116 | 116 |
for(i = 0; i < COEFFS; i++) |
| 117 | 117 |
q->mdct_sine_window[i] *= sqrt(2.0); |
| 118 | 118 |
for(i = 0; i < COEFFS/2; i++){
|
| 119 |
- q->post_cos[i] = cos(i / 256.0 * M_PI); |
|
| 120 |
- q->post_sin[i] = sin(i / 256.0 * M_PI); |
|
| 119 |
+ q->post_cos[i] = (1.0f / 32768) * cos(i / 256.0 * M_PI); |
|
| 120 |
+ q->post_sin[i] = (1.0f / 32768) * sin(i / 256.0 * M_PI); |
|
| 121 | 121 |
|
| 122 | 122 |
r1 = sin((i * 4.0 + 1.0) / 1024.0 * M_PI); |
| 123 | 123 |
r2 = cos((i * 4.0 + 1.0) / 1024.0 * M_PI); |
| ... | ... |
@@ -156,7 +156,7 @@ static av_cold int imc_decode_init(AVCodecContext * avctx) |
| 156 | 156 |
|
| 157 | 157 |
ff_fft_init(&q->fft, 7, 1); |
| 158 | 158 |
dsputil_init(&q->dsp, avctx); |
| 159 |
- avctx->sample_fmt = SAMPLE_FMT_S16; |
|
| 159 |
+ avctx->sample_fmt = SAMPLE_FMT_FLT; |
|
| 160 | 160 |
avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; |
| 161 | 161 |
return 0; |
| 162 | 162 |
} |
| ... | ... |
@@ -662,6 +662,7 @@ static int imc_decode_frame(AVCodecContext * avctx, |
| 662 | 662 |
for(i = 0; i < IMC_BLOCK_SIZE / 2; i++) |
| 663 | 663 |
buf16[i] = av_bswap16(((const uint16_t*)buf)[i]); |
| 664 | 664 |
|
| 665 |
+ q->out_samples = data; |
|
| 665 | 666 |
init_get_bits(&q->gb, (const uint8_t*)buf16, IMC_BLOCK_SIZE * 8); |
| 666 | 667 |
|
| 667 | 668 |
/* Check the frame header */ |
| ... | ... |
@@ -805,9 +806,7 @@ static int imc_decode_frame(AVCodecContext * avctx, |
| 805 | 805 |
|
| 806 | 806 |
imc_imdct256(q); |
| 807 | 807 |
|
| 808 |
- q->dsp.float_to_int16(data, q->out_samples, COEFFS); |
|
| 809 |
- |
|
| 810 |
- *data_size = COEFFS * sizeof(int16_t); |
|
| 808 |
+ *data_size = COEFFS * sizeof(float); |
|
| 811 | 809 |
|
| 812 | 810 |
return IMC_BLOCK_SIZE; |
| 813 | 811 |
} |