From 9edae4ad817dc51baae127368662d090f86482c2 Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Mon, 11 Aug 2008 11:22:48 +0000 Subject: [PATCH] Synchronise code with AAC decoder in SoC Originally committed as revision 14695 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/aac.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/libavcodec/aac.c b/libavcodec/aac.c index d28e1d7df9..f8e2a9de01 100644 --- a/libavcodec/aac.c +++ b/libavcodec/aac.c @@ -436,7 +436,6 @@ static int decode_band_types(AACContext * ac, enum BandType band_type[120], /** * Decode scalefactors; reference: table 4.47. * - * @param mix_gain channel gain (Not used by AAC bitstream.) * @param global_gain first scalefactor value as scalefactors are differentially coded * @param band_type array of the used band type * @param band_type_run_end array of the last scalefactor band of a band type run @@ -445,7 +444,7 @@ static int decode_band_types(AACContext * ac, enum BandType band_type[120], * @return Returns error status. 0 - OK, !0 - error */ static int decode_scalefactors(AACContext * ac, float sf[120], GetBitContext * gb, - float mix_gain, unsigned int global_gain, IndividualChannelStream * ics, + unsigned int global_gain, IndividualChannelStream * ics, enum BandType band_type[120], int band_type_run_end[120]) { const int sf_offset = ac->sf_offset + (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE ? 12 : 0); int g, i, idx = 0; @@ -469,7 +468,6 @@ static int decode_scalefactors(AACContext * ac, float sf[120], GetBitContext * g return -1; } sf[idx] = ff_aac_pow2sf_tab[-offset[2] + 300]; - sf[idx] *= mix_gain; } }else if(band_type[idx] == NOISE_BT) { for(; i < run_end; i++, idx++) { @@ -483,7 +481,6 @@ static int decode_scalefactors(AACContext * ac, float sf[120], GetBitContext * g return -1; } sf[idx] = -ff_aac_pow2sf_tab[ offset[1] + sf_offset]; - sf[idx] *= mix_gain; } }else { for(; i < run_end; i++, idx++) { @@ -494,7 +491,6 @@ static int decode_scalefactors(AACContext * ac, float sf[120], GetBitContext * g return -1; } sf[idx] = -ff_aac_pow2sf_tab[ offset[0] + sf_offset]; - sf[idx] *= mix_gain; } } } @@ -649,7 +645,7 @@ static int decode_cpe(AACContext * ac, GetBitContext * gb, int elem_id) { */ static int decode_sbr_extension(AACContext * ac, GetBitContext * gb, int crc, int cnt) { // TODO : sbr_extension implementation - av_log(ac->avccontext, AV_LOG_DEBUG, "aac: SBR not yet supported.\n"); + av_log_missing_feature(ac->avccontext, "SBR", 0); skip_bits_long(gb, 8*cnt - 4); // -4 due to reading extension type return cnt; } @@ -769,11 +765,10 @@ static void apply_dependent_coupling(AACContext * ac, SingleChannelElement * sce for (g = 0; g < ics->num_window_groups; g++) { for (i = 0; i < ics->max_sfb; i++, idx++) { if (cc->ch[0].band_type[idx] != ZERO_BT) { - float gain = cc->coup.gain[index][idx] * sce->mixing_gain; for (group = 0; group < ics->group_len[g]; group++) { for (k = offsets[i]; k < offsets[i+1]; k++) { // XXX dsputil-ize - dest[group*128+k] += gain * src[group*128+k]; + dest[group*128+k] += cc->coup.gain[index][idx] * src[group*128+k]; } } } @@ -790,9 +785,8 @@ static void apply_dependent_coupling(AACContext * ac, SingleChannelElement * sce */ static void apply_independent_coupling(AACContext * ac, SingleChannelElement * sce, ChannelElement * cc, int index) { int i; - float gain = cc->coup.gain[index][0] * sce->mixing_gain; for (i = 0; i < 1024; i++) - sce->ret[i] += gain * (cc->ch[0].ret[i] - ac->add_bias); + sce->ret[i] += cc->coup.gain[index][0] * (cc->ch[0].ret[i] - ac->add_bias); } if (!ac->is_saved) { @@ -817,11 +811,11 @@ static void apply_independent_coupling(AACContext * ac, SingleChannelElement * s static av_cold int aac_decode_close(AVCodecContext * avccontext) { AACContext * ac = avccontext->priv_data; - int i, j; + int i, type; for (i = 0; i < MAX_ELEM_ID; i++) { - for(j = 0; j < 4; j++) - av_freep(&ac->che[j][i]); + for(type = 0; type < 4; type++) + av_freep(&ac->che[type][i]); } ff_mdct_end(&ac->mdct);