Mercurial > libavcodec.hg
diff aacdec.c @ 11886:2d81202be6e2 libavcodec
Add HE-AAC v2 support to the AAC decoder.
author | alexc |
---|---|
date | Sat, 19 Jun 2010 14:14:51 +0000 |
parents | 758c052eb8a9 |
children | c883aa4aa616 |
line wrap: on
line diff
--- a/aacdec.c Sat Jun 19 09:56:05 2010 +0000 +++ b/aacdec.c Sat Jun 19 14:14:51 2010 +0000 @@ -67,7 +67,7 @@ * Y (not in this code) Layer-2 * Y (not in this code) Layer-3 * N SinuSoidal Coding (Transient, Sinusoid, Noise) - * N (planned) Parametric Stereo + * Y Parametric Stereo * N Direct Stream Transfer * * Note: - HE AAC v1 comprises LC AAC with Spectral Band Replication. @@ -200,7 +200,8 @@ ff_aac_sbr_ctx_init(&ac->che[type][id]->sbr); if (type != TYPE_CCE) { ac->output_data[(*channels)++] = ac->che[type][id]->ch[0].ret; - if (type == TYPE_CPE) { + if (type == TYPE_CPE || + (type == TYPE_SCE && ac->m4ac.ps == 1)) { ac->output_data[(*channels)++] = ac->che[type][id]->ch[1].ret; } } @@ -228,6 +229,7 @@ AVCodecContext *avctx = ac->avctx; int i, type, channels = 0, ret; + if (new_che_pos != che_pos) memcpy(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); if (channel_config) { @@ -471,6 +473,8 @@ av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index); return -1; } + if (ac->m4ac.sbr == 1 && ac->m4ac.ps == -1) + ac->m4ac.ps = 1; skip_bits_long(&gb, i); @@ -1667,6 +1671,10 @@ av_log(ac->avctx, AV_LOG_ERROR, "Implicit SBR was found with a first occurrence after the first frame.\n"); skip_bits_long(gb, 8 * cnt - 4); return res; + } else if (ac->m4ac.ps == -1 && ac->output_configured < OC_LOCKED && ac->avctx->channels == 1) { + ac->m4ac.sbr = 1; + ac->m4ac.ps = 1; + output_configure(ac, ac->che_pos, ac->che_pos, ac->m4ac.chan_config, ac->output_configured); } else { ac->m4ac.sbr = 1; } @@ -1946,8 +1954,10 @@ } else if (ac->output_configured != OC_LOCKED) { ac->output_configured = OC_NONE; } - if (ac->output_configured != OC_LOCKED) + if (ac->output_configured != OC_LOCKED) { ac->m4ac.sbr = -1; + ac->m4ac.ps = -1; + } ac->m4ac.sample_rate = hdr_info.sample_rate; ac->m4ac.sampling_index = hdr_info.sampling_index; ac->m4ac.object_type = hdr_info.object_type;