* 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.
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;
}
}
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) {
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);
reset_predict_state(&ps[i]);
}
+#define AAC_INIT_VLC_STATIC(num, size) \
+ INIT_VLC_STATIC(&vlc_spectral[num], 8, ff_aac_spectral_sizes[num], \
+ ff_aac_spectral_bits[num], sizeof( ff_aac_spectral_bits[num][0]), sizeof( ff_aac_spectral_bits[num][0]), \
+ ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), sizeof(ff_aac_spectral_codes[num][0]), \
+ size);
+
static av_cold int aac_decode_init(AVCodecContext *avctx)
{
AACContext *ac = avctx->priv_data;
- int i;
ac->avctx = avctx;
ac->m4ac.sample_rate = avctx->sample_rate;
ac->sf_offset = 60;
}
-#if !CONFIG_HARDCODED_TABLES
- for (i = 0; i < 428; i++)
- ff_aac_pow2sf_tab[i] = pow(2, (i - 200) / 4.);
-#endif /* CONFIG_HARDCODED_TABLES */
+ ff_aac_tableinit();
INIT_VLC_STATIC(&vlc_scalefactors,7,FF_ARRAY_ELEMS(ff_aac_scalefactor_code),
ff_aac_scalefactor_bits, sizeof(ff_aac_scalefactor_bits[0]), sizeof(ff_aac_scalefactor_bits[0]),
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;
}
} 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;
enum RawDataBlockType elem_type, elem_type_prev = TYPE_END;
int err, elem_id, data_size_tmp;
int buf_consumed;
- int samples = 1024, multiplier;
+ int samples = 0, multiplier;
int buf_offset;
init_get_bits(&gb, buf, buf_size * 8);
while ((elem_type = get_bits(&gb, 3)) != TYPE_END) {
elem_id = get_bits(&gb, 4);
- if (elem_type < TYPE_DSE && !(che=get_che(ac, elem_type, elem_id))) {
- av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", elem_type, elem_id);
- return -1;
+ if (elem_type < TYPE_DSE) {
+ if (!(che=get_che(ac, elem_type, elem_id))) {
+ av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n",
+ elem_type, elem_id);
+ return -1;
+ }
+ samples = 1024;
}
switch (elem_type) {
}
*data_size = data_size_tmp;
- ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
+ if (samples)
+ ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
if (ac->output_configured)
ac->output_configured = OC_LOCKED;