[FFmpeg-soc] [soc]: r263 - aac/aac.c
banan
subversion at mplayerhq.hu
Sun Jun 24 13:19:29 CEST 2007
Author: banan
Date: Sun Jun 24 13:19:29 2007
New Revision: 263
Log:
Fix float2int conversion for regular float also. Now it works just as good/bad with both.
Modified:
aac/aac.c
Modified: aac/aac.c
==============================================================================
--- aac/aac.c (original)
+++ aac/aac.c Sun Jun 24 13:19:29 2007
@@ -325,7 +325,7 @@ typedef struct {
DECLARE_ALIGNED_16(float, intensity_tab[256]);
DECLARE_ALIGNED_16(float, ivquant_tab[256]);
DECLARE_ALIGNED_16(float, revers[1024]);
- DECLARE_ALIGNED_16(float, interleaved_output[2048]);
+ float* interleaved_output;
MDCTContext mdct;
MDCTContext mdct_small;
@@ -787,6 +787,9 @@ static int aac_decode_init(AVCodecContex
}
avccontext->sample_rate = ac->sample_rate;
+ /* Allocate aligned reorder buffer */
+ ac->interleaved_output = av_malloc(ac->channels * 1024 * sizeof(float));
+
for (i = 0; i < 11; i++) {
static const int mod_cb[11] = { 3, 3, 3, 3, 9, 9, 8, 8, 13, 13, 17 };
static const int off_cb[11] = { 1, 1, 0, 0, 4, 4, 0, 0, 0, 0, 0 };
@@ -2007,10 +2010,8 @@ static int output_samples(AVCodecContext
break;
case MIXMODE_2TO2:
for (i = 0; i < 1024; i++) {
- //data[i*2] = F2U16(ac->che_cpe[mix->lr_tag]->ch[0].ret[i]);
- //data[i*2+1] = F2U16(ac->che_cpe[mix->lr_tag]->ch[1].ret[i]);
- ac->interleaved_output[i*2] = ac->che_cpe[mix->lr_tag]->ch[0].ret[i] - ac->add_bias;
- ac->interleaved_output[i*2+1] = ac->che_cpe[mix->lr_tag]->ch[1].ret[i] - ac->add_bias;
+ ac->interleaved_output[i*2] = ac->che_cpe[mix->lr_tag]->ch[0].ret[i];
+ ac->interleaved_output[i*2+1] = ac->che_cpe[mix->lr_tag]->ch[1].ret[i];
}
break;
case MIXMODE_MATRIX1:
@@ -2142,6 +2143,10 @@ static int output_samples(AVCodecContext
}
}
}
+
+ /* Convert from float to int16 */
+ ac->dsp.float_to_int16(data, ac->interleaved_output, 1024*ochannels);
+
return 0;
}
@@ -2202,7 +2207,6 @@ static int aac_decode_frame(AVCodecConte
spec_to_sample(ac);
output_samples(avccontext, data, data_size);
- ac->dsp.float_to_int16(data, ac->interleaved_output, 2048);
return buf_size;
}
@@ -2248,6 +2252,7 @@ static int aac_decode_close(AVCodecConte
ff_mdct_end(ac->mdct_ltp);
av_free(ac->mdct_ltp);
}
+ av_free(ac->interleaved_output);
return 0 ;
}
More information about the FFmpeg-soc
mailing list