# HG changeset patch # User superdump # Date 1218453768 0 # Node ID 5298e05f931d3be7709d8c3cb426f2fe3da27d53 # Parent 4fca7939ad488e07e9a64500d05a2b30a140dba1 Synchronise code with AAC decoder in SoC diff -r 4fca7939ad48 -r 5298e05f931d aac.c --- a/aac.c Mon Aug 11 11:16:06 2008 +0000 +++ b/aac.c Mon Aug 11 11:22:48 2008 +0000 @@ -436,7 +436,6 @@ /** * 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 @@ * @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 @@ 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 @@ 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 @@ return -1; } sf[idx] = -ff_aac_pow2sf_tab[ offset[0] + sf_offset]; - sf[idx] *= mix_gain; } } } @@ -649,7 +645,7 @@ */ 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 @@ 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_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 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);