aacdec: Rename avccontext to avctx.
Originally committed as revision 23488 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
4cd5100caf
commit
dd8871a63b
116
libavcodec/aac.c
116
libavcodec/aac.c
@ -120,7 +120,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
|
|||||||
int err_printed = 0;
|
int err_printed = 0;
|
||||||
while (ac->tags_seen_this_frame[type][elem_id] && elem_id < MAX_ELEM_ID) {
|
while (ac->tags_seen_this_frame[type][elem_id] && elem_id < MAX_ELEM_ID) {
|
||||||
if (ac->output_configured < OC_LOCKED && !err_printed) {
|
if (ac->output_configured < OC_LOCKED && !err_printed) {
|
||||||
av_log(ac->avccontext, AV_LOG_WARNING, "Duplicate channel tag found, attempting to remap.\n");
|
av_log(ac->avctx, AV_LOG_WARNING, "Duplicate channel tag found, attempting to remap.\n");
|
||||||
err_printed = 1;
|
err_printed = 1;
|
||||||
}
|
}
|
||||||
elem_id++;
|
elem_id++;
|
||||||
@ -225,7 +225,7 @@ static av_cold int output_configure(AACContext *ac,
|
|||||||
enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
|
enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
|
||||||
int channel_config, enum OCStatus oc_type)
|
int channel_config, enum OCStatus oc_type)
|
||||||
{
|
{
|
||||||
AVCodecContext *avctx = ac->avccontext;
|
AVCodecContext *avctx = ac->avctx;
|
||||||
int i, type, channels = 0, ret;
|
int i, type, channels = 0, ret;
|
||||||
|
|
||||||
memcpy(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
|
memcpy(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
|
||||||
@ -308,7 +308,7 @@ static int decode_pce(AACContext *ac, enum ChannelPosition new_che_pos[4][MAX_EL
|
|||||||
|
|
||||||
sampling_index = get_bits(gb, 4);
|
sampling_index = get_bits(gb, 4);
|
||||||
if (ac->m4ac.sampling_index != sampling_index)
|
if (ac->m4ac.sampling_index != sampling_index)
|
||||||
av_log(ac->avccontext, AV_LOG_WARNING, "Sample rate index in program config element does not match the sample rate index configured by the container.\n");
|
av_log(ac->avctx, AV_LOG_WARNING, "Sample rate index in program config element does not match the sample rate index configured by the container.\n");
|
||||||
|
|
||||||
num_front = get_bits(gb, 4);
|
num_front = get_bits(gb, 4);
|
||||||
num_side = get_bits(gb, 4);
|
num_side = get_bits(gb, 4);
|
||||||
@ -339,7 +339,7 @@ static int decode_pce(AACContext *ac, enum ChannelPosition new_che_pos[4][MAX_EL
|
|||||||
/* comment field, first byte is length */
|
/* comment field, first byte is length */
|
||||||
comment_len = get_bits(gb, 8) * 8;
|
comment_len = get_bits(gb, 8) * 8;
|
||||||
if (get_bits_left(gb) < comment_len) {
|
if (get_bits_left(gb) < comment_len) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, overread_err);
|
av_log(ac->avctx, AV_LOG_ERROR, overread_err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
skip_bits_long(gb, comment_len);
|
skip_bits_long(gb, comment_len);
|
||||||
@ -359,7 +359,7 @@ static av_cold int set_default_channel_config(AACContext *ac,
|
|||||||
int channel_config)
|
int channel_config)
|
||||||
{
|
{
|
||||||
if (channel_config < 1 || channel_config > 7) {
|
if (channel_config < 1 || channel_config > 7) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "invalid default channel configuration (%d)\n",
|
av_log(ac->avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n",
|
||||||
channel_config);
|
channel_config);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -404,7 +404,7 @@ static int decode_ga_specific_config(AACContext *ac, GetBitContext *gb,
|
|||||||
int extension_flag, ret;
|
int extension_flag, ret;
|
||||||
|
|
||||||
if (get_bits1(gb)) { // frameLengthFlag
|
if (get_bits1(gb)) { // frameLengthFlag
|
||||||
av_log_missing_feature(ac->avccontext, "960/120 MDCT window is", 1);
|
av_log_missing_feature(ac->avctx, "960/120 MDCT window is", 1);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,7 +468,7 @@ static int decode_audio_specific_config(AACContext *ac, void *data,
|
|||||||
if ((i = ff_mpeg4audio_get_config(&ac->m4ac, data, data_size)) < 0)
|
if ((i = ff_mpeg4audio_get_config(&ac->m4ac, data, data_size)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (ac->m4ac.sampling_index > 12) {
|
if (ac->m4ac.sampling_index > 12) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index);
|
av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +481,7 @@ static int decode_audio_specific_config(AACContext *ac, void *data,
|
|||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Audio object type %s%d is not supported.\n",
|
av_log(ac->avctx, AV_LOG_ERROR, "Audio object type %s%d is not supported.\n",
|
||||||
ac->m4ac.sbr == 1? "SBR+" : "", ac->m4ac.object_type);
|
ac->m4ac.sbr == 1? "SBR+" : "", ac->m4ac.object_type);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -524,20 +524,20 @@ static void reset_predictor_group(PredictorState *ps, int group_num)
|
|||||||
reset_predict_state(&ps[i]);
|
reset_predict_state(&ps[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int aac_decode_init(AVCodecContext *avccontext)
|
static av_cold int aac_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
AACContext *ac = avccontext->priv_data;
|
AACContext *ac = avctx->priv_data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ac->avccontext = avccontext;
|
ac->avctx = avctx;
|
||||||
ac->m4ac.sample_rate = avccontext->sample_rate;
|
ac->m4ac.sample_rate = avctx->sample_rate;
|
||||||
|
|
||||||
if (avccontext->extradata_size > 0) {
|
if (avctx->extradata_size > 0) {
|
||||||
if (decode_audio_specific_config(ac, avccontext->extradata, avccontext->extradata_size))
|
if (decode_audio_specific_config(ac, avctx->extradata, avctx->extradata_size))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
avccontext->sample_fmt = SAMPLE_FMT_S16;
|
avctx->sample_fmt = SAMPLE_FMT_S16;
|
||||||
|
|
||||||
AAC_INIT_VLC_STATIC( 0, 304);
|
AAC_INIT_VLC_STATIC( 0, 304);
|
||||||
AAC_INIT_VLC_STATIC( 1, 270);
|
AAC_INIT_VLC_STATIC( 1, 270);
|
||||||
@ -553,7 +553,7 @@ static av_cold int aac_decode_init(AVCodecContext *avccontext)
|
|||||||
|
|
||||||
ff_aac_sbr_init();
|
ff_aac_sbr_init();
|
||||||
|
|
||||||
dsputil_init(&ac->dsp, avccontext);
|
dsputil_init(&ac->dsp, avctx);
|
||||||
|
|
||||||
ac->random_state = 0x1f2e3d4c;
|
ac->random_state = 0x1f2e3d4c;
|
||||||
|
|
||||||
@ -607,7 +607,7 @@ static int skip_data_stream_element(AACContext *ac, GetBitContext *gb)
|
|||||||
align_get_bits(gb);
|
align_get_bits(gb);
|
||||||
|
|
||||||
if (get_bits_left(gb) < 8 * count) {
|
if (get_bits_left(gb) < 8 * count) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, overread_err);
|
av_log(ac->avctx, AV_LOG_ERROR, overread_err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
skip_bits_long(gb, 8 * count);
|
skip_bits_long(gb, 8 * count);
|
||||||
@ -621,7 +621,7 @@ static int decode_prediction(AACContext *ac, IndividualChannelStream *ics,
|
|||||||
if (get_bits1(gb)) {
|
if (get_bits1(gb)) {
|
||||||
ics->predictor_reset_group = get_bits(gb, 5);
|
ics->predictor_reset_group = get_bits(gb, 5);
|
||||||
if (ics->predictor_reset_group == 0 || ics->predictor_reset_group > 30) {
|
if (ics->predictor_reset_group == 0 || ics->predictor_reset_group > 30) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Invalid Predictor Reset Group.\n");
|
av_log(ac->avctx, AV_LOG_ERROR, "Invalid Predictor Reset Group.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -640,7 +640,7 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
|
|||||||
GetBitContext *gb, int common_window)
|
GetBitContext *gb, int common_window)
|
||||||
{
|
{
|
||||||
if (get_bits1(gb)) {
|
if (get_bits1(gb)) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Reserved bit set.\n");
|
av_log(ac->avctx, AV_LOG_ERROR, "Reserved bit set.\n");
|
||||||
memset(ics, 0, sizeof(IndividualChannelStream));
|
memset(ics, 0, sizeof(IndividualChannelStream));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -681,11 +681,11 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (ac->m4ac.object_type == AOT_AAC_LC) {
|
} else if (ac->m4ac.object_type == AOT_AAC_LC) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Prediction is not allowed in AAC-LC.\n");
|
av_log(ac->avctx, AV_LOG_ERROR, "Prediction is not allowed in AAC-LC.\n");
|
||||||
memset(ics, 0, sizeof(IndividualChannelStream));
|
memset(ics, 0, sizeof(IndividualChannelStream));
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
av_log_missing_feature(ac->avccontext, "Predictor bit set but LTP is", 1);
|
av_log_missing_feature(ac->avctx, "Predictor bit set but LTP is", 1);
|
||||||
memset(ics, 0, sizeof(IndividualChannelStream));
|
memset(ics, 0, sizeof(IndividualChannelStream));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -693,7 +693,7 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ics->max_sfb > ics->num_swb) {
|
if (ics->max_sfb > ics->num_swb) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Number of scalefactor bands in group (%d) exceeds limit (%d).\n",
|
"Number of scalefactor bands in group (%d) exceeds limit (%d).\n",
|
||||||
ics->max_sfb, ics->num_swb);
|
ics->max_sfb, ics->num_swb);
|
||||||
memset(ics, 0, sizeof(IndividualChannelStream));
|
memset(ics, 0, sizeof(IndividualChannelStream));
|
||||||
@ -724,18 +724,18 @@ static int decode_band_types(AACContext *ac, enum BandType band_type[120],
|
|||||||
int sect_len_incr;
|
int sect_len_incr;
|
||||||
int sect_band_type = get_bits(gb, 4);
|
int sect_band_type = get_bits(gb, 4);
|
||||||
if (sect_band_type == 12) {
|
if (sect_band_type == 12) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "invalid band type\n");
|
av_log(ac->avctx, AV_LOG_ERROR, "invalid band type\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
while ((sect_len_incr = get_bits(gb, bits)) == (1 << bits) - 1)
|
while ((sect_len_incr = get_bits(gb, bits)) == (1 << bits) - 1)
|
||||||
sect_end += sect_len_incr;
|
sect_end += sect_len_incr;
|
||||||
sect_end += sect_len_incr;
|
sect_end += sect_len_incr;
|
||||||
if (get_bits_left(gb) < 0) {
|
if (get_bits_left(gb) < 0) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, overread_err);
|
av_log(ac->avctx, AV_LOG_ERROR, overread_err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (sect_end > ics->max_sfb) {
|
if (sect_end > ics->max_sfb) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Number of bands (%d) exceeds limit (%d).\n",
|
"Number of bands (%d) exceeds limit (%d).\n",
|
||||||
sect_end, ics->max_sfb);
|
sect_end, ics->max_sfb);
|
||||||
return -1;
|
return -1;
|
||||||
@ -780,7 +780,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
|
|||||||
for (; i < run_end; i++, idx++) {
|
for (; i < run_end; i++, idx++) {
|
||||||
offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
|
offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
|
||||||
if (offset[2] > 255U) {
|
if (offset[2] > 255U) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"%s (%d) out of range.\n", sf_str[2], offset[2]);
|
"%s (%d) out of range.\n", sf_str[2], offset[2]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -793,7 +793,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
|
|||||||
else
|
else
|
||||||
offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
|
offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
|
||||||
if (offset[1] > 255U) {
|
if (offset[1] > 255U) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"%s (%d) out of range.\n", sf_str[1], offset[1]);
|
"%s (%d) out of range.\n", sf_str[1], offset[1]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -803,7 +803,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
|
|||||||
for (; i < run_end; i++, idx++) {
|
for (; i < run_end; i++, idx++) {
|
||||||
offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
|
offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
|
||||||
if (offset[0] > 255U) {
|
if (offset[0] > 255U) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"%s (%d) out of range.\n", sf_str[0], offset[0]);
|
"%s (%d) out of range.\n", sf_str[0], offset[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -860,7 +860,7 @@ static int decode_tns(AACContext *ac, TemporalNoiseShaping *tns,
|
|||||||
tns->length[w][filt] = get_bits(gb, 6 - 2 * is8);
|
tns->length[w][filt] = get_bits(gb, 6 - 2 * is8);
|
||||||
|
|
||||||
if ((tns->order[w][filt] = get_bits(gb, 5 - 2 * is8)) > tns_max_order) {
|
if ((tns->order[w][filt] = get_bits(gb, 5 - 2 * is8)) > tns_max_order) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "TNS filter order %d is greater than maximum %d.\n",
|
av_log(ac->avctx, AV_LOG_ERROR, "TNS filter order %d is greater than maximum %d.\n",
|
||||||
tns->order[w][filt], tns_max_order);
|
tns->order[w][filt], tns_max_order);
|
||||||
tns->order[w][filt] = 0;
|
tns->order[w][filt] = 0;
|
||||||
return -1;
|
return -1;
|
||||||
@ -1179,7 +1179,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
|
|||||||
b = 31 - av_log2(~b);
|
b = 31 - av_log2(~b);
|
||||||
|
|
||||||
if (b > 8) {
|
if (b > 8) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "error in spectral data, ESC overflow\n");
|
av_log(ac->avctx, AV_LOG_ERROR, "error in spectral data, ESC overflow\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1232,7 +1232,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_cb_overflow:
|
err_cb_overflow:
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Read beyond end of ff_aac_codebook_vectors[%d][]. index %d >= %d\n",
|
"Read beyond end of ff_aac_codebook_vectors[%d][]. index %d >= %d\n",
|
||||||
band_type[idx], err_idx, ff_aac_spectral_sizes[band_type[idx]]);
|
band_type[idx], err_idx, ff_aac_spectral_sizes[band_type[idx]]);
|
||||||
return -1;
|
return -1;
|
||||||
@ -1353,18 +1353,18 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
|
|||||||
if (!scale_flag) {
|
if (!scale_flag) {
|
||||||
if ((pulse_present = get_bits1(gb))) {
|
if ((pulse_present = get_bits1(gb))) {
|
||||||
if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
|
if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Pulse tool not allowed in eight short sequence.\n");
|
av_log(ac->avctx, AV_LOG_ERROR, "Pulse tool not allowed in eight short sequence.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (decode_pulses(&pulse, gb, ics->swb_offset, ics->num_swb)) {
|
if (decode_pulses(&pulse, gb, ics->swb_offset, ics->num_swb)) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Pulse data corrupt or invalid.\n");
|
av_log(ac->avctx, AV_LOG_ERROR, "Pulse data corrupt or invalid.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((tns->present = get_bits1(gb)) && decode_tns(ac, tns, gb, ics))
|
if ((tns->present = get_bits1(gb)) && decode_tns(ac, tns, gb, ics))
|
||||||
return -1;
|
return -1;
|
||||||
if (get_bits1(gb)) {
|
if (get_bits1(gb)) {
|
||||||
av_log_missing_feature(ac->avccontext, "SSR", 1);
|
av_log_missing_feature(ac->avctx, "SSR", 1);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1464,7 +1464,7 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
|
|||||||
cpe->ch[1].ics.use_kb_window[1] = i;
|
cpe->ch[1].ics.use_kb_window[1] = i;
|
||||||
ms_present = get_bits(gb, 2);
|
ms_present = get_bits(gb, 2);
|
||||||
if (ms_present == 3) {
|
if (ms_present == 3) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "ms_present = 3 is reserved.\n");
|
av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n");
|
||||||
return -1;
|
return -1;
|
||||||
} else if (ms_present)
|
} else if (ms_present)
|
||||||
decode_mid_side_stereo(cpe, gb, ms_present);
|
decode_mid_side_stereo(cpe, gb, ms_present);
|
||||||
@ -1651,14 +1651,14 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
|
|||||||
crc_flag++;
|
crc_flag++;
|
||||||
case EXT_SBR_DATA:
|
case EXT_SBR_DATA:
|
||||||
if (!che) {
|
if (!che) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "SBR was found before the first channel element.\n");
|
av_log(ac->avctx, AV_LOG_ERROR, "SBR was found before the first channel element.\n");
|
||||||
return res;
|
return res;
|
||||||
} else if (!ac->m4ac.sbr) {
|
} else if (!ac->m4ac.sbr) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "SBR signaled to be not-present but was found in the bitstream.\n");
|
av_log(ac->avctx, AV_LOG_ERROR, "SBR signaled to be not-present but was found in the bitstream.\n");
|
||||||
skip_bits_long(gb, 8 * cnt - 4);
|
skip_bits_long(gb, 8 * cnt - 4);
|
||||||
return res;
|
return res;
|
||||||
} else if (ac->m4ac.sbr == -1 && ac->output_configured == OC_LOCKED) {
|
} else if (ac->m4ac.sbr == -1 && ac->output_configured == OC_LOCKED) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Implicit SBR was found with a first occurrence after the first frame.\n");
|
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);
|
skip_bits_long(gb, 8 * cnt - 4);
|
||||||
return res;
|
return res;
|
||||||
} else {
|
} else {
|
||||||
@ -1744,7 +1744,7 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce, float
|
|||||||
// imdct
|
// imdct
|
||||||
if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
|
if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
|
||||||
if (ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE)
|
if (ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE)
|
||||||
av_log(ac->avccontext, AV_LOG_WARNING,
|
av_log(ac->avctx, AV_LOG_WARNING,
|
||||||
"Transition from an ONLY_LONG or LONG_STOP to an EIGHT_SHORT sequence detected. "
|
"Transition from an ONLY_LONG or LONG_STOP to an EIGHT_SHORT sequence detected. "
|
||||||
"If you heard an audible artifact, please submit the sample to the FFmpeg developers.\n");
|
"If you heard an audible artifact, please submit the sample to the FFmpeg developers.\n");
|
||||||
for (i = 0; i < 1024; i += 128)
|
for (i = 0; i < 1024; i += 128)
|
||||||
@ -1810,7 +1810,7 @@ static void apply_dependent_coupling(AACContext *ac,
|
|||||||
const float *src = cce->ch[0].coeffs;
|
const float *src = cce->ch[0].coeffs;
|
||||||
int g, i, group, k, idx = 0;
|
int g, i, group, k, idx = 0;
|
||||||
if (ac->m4ac.object_type == AOT_AAC_LTP) {
|
if (ac->m4ac.object_type == AOT_AAC_LTP) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Dependent coupling is not supported together with LTP\n");
|
"Dependent coupling is not supported together with LTP\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1945,25 +1945,25 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
|
|||||||
ac->m4ac.sample_rate = hdr_info.sample_rate;
|
ac->m4ac.sample_rate = hdr_info.sample_rate;
|
||||||
ac->m4ac.sampling_index = hdr_info.sampling_index;
|
ac->m4ac.sampling_index = hdr_info.sampling_index;
|
||||||
ac->m4ac.object_type = hdr_info.object_type;
|
ac->m4ac.object_type = hdr_info.object_type;
|
||||||
if (!ac->avccontext->sample_rate)
|
if (!ac->avctx->sample_rate)
|
||||||
ac->avccontext->sample_rate = hdr_info.sample_rate;
|
ac->avctx->sample_rate = hdr_info.sample_rate;
|
||||||
if (hdr_info.num_aac_frames == 1) {
|
if (hdr_info.num_aac_frames == 1) {
|
||||||
if (!hdr_info.crc_absent)
|
if (!hdr_info.crc_absent)
|
||||||
skip_bits(gb, 16);
|
skip_bits(gb, 16);
|
||||||
} else {
|
} else {
|
||||||
av_log_missing_feature(ac->avccontext, "More than one AAC RDB per ADTS frame is", 0);
|
av_log_missing_feature(ac->avctx, "More than one AAC RDB per ADTS frame is", 0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int aac_decode_frame(AVCodecContext *avccontext, void *data,
|
static int aac_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
int *data_size, AVPacket *avpkt)
|
int *data_size, AVPacket *avpkt)
|
||||||
{
|
{
|
||||||
const uint8_t *buf = avpkt->data;
|
const uint8_t *buf = avpkt->data;
|
||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
AACContext *ac = avccontext->priv_data;
|
AACContext *ac = avctx->priv_data;
|
||||||
ChannelElement *che = NULL, *che_prev = NULL;
|
ChannelElement *che = NULL, *che_prev = NULL;
|
||||||
GetBitContext gb;
|
GetBitContext gb;
|
||||||
enum RawDataBlockType elem_type, elem_type_prev = TYPE_END;
|
enum RawDataBlockType elem_type, elem_type_prev = TYPE_END;
|
||||||
@ -1976,11 +1976,11 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data,
|
|||||||
|
|
||||||
if (show_bits(&gb, 12) == 0xfff) {
|
if (show_bits(&gb, 12) == 0xfff) {
|
||||||
if (parse_adts_frame_header(ac, &gb) < 0) {
|
if (parse_adts_frame_header(ac, &gb) < 0) {
|
||||||
av_log(avccontext, AV_LOG_ERROR, "Error decoding AAC frame header.\n");
|
av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ac->m4ac.sampling_index > 12) {
|
if (ac->m4ac.sampling_index > 12) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index);
|
av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1991,7 +1991,7 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data,
|
|||||||
elem_id = get_bits(&gb, 4);
|
elem_id = get_bits(&gb, 4);
|
||||||
|
|
||||||
if (elem_type < TYPE_DSE && !(che=get_che(ac, elem_type, elem_id))) {
|
if (elem_type < TYPE_DSE && !(che=get_che(ac, elem_type, elem_id))) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", 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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2023,7 +2023,7 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data,
|
|||||||
if ((err = decode_pce(ac, new_che_pos, &gb)))
|
if ((err = decode_pce(ac, new_che_pos, &gb)))
|
||||||
break;
|
break;
|
||||||
if (ac->output_configured > OC_TRIAL_PCE)
|
if (ac->output_configured > OC_TRIAL_PCE)
|
||||||
av_log(avccontext, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"Not evaluating a further program_config_element as this construct is dubious at best.\n");
|
"Not evaluating a further program_config_element as this construct is dubious at best.\n");
|
||||||
else
|
else
|
||||||
err = output_configure(ac, ac->che_pos, new_che_pos, 0, OC_TRIAL_PCE);
|
err = output_configure(ac, ac->che_pos, new_che_pos, 0, OC_TRIAL_PCE);
|
||||||
@ -2034,7 +2034,7 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data,
|
|||||||
if (elem_id == 15)
|
if (elem_id == 15)
|
||||||
elem_id += get_bits(&gb, 8) - 1;
|
elem_id += get_bits(&gb, 8) - 1;
|
||||||
if (get_bits_left(&gb) < 8 * elem_id) {
|
if (get_bits_left(&gb) < 8 * elem_id) {
|
||||||
av_log(avccontext, AV_LOG_ERROR, overread_err);
|
av_log(avctx, AV_LOG_ERROR, overread_err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
while (elem_id > 0)
|
while (elem_id > 0)
|
||||||
@ -2054,7 +2054,7 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data,
|
|||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (get_bits_left(&gb) < 3) {
|
if (get_bits_left(&gb) < 3) {
|
||||||
av_log(avccontext, AV_LOG_ERROR, overread_err);
|
av_log(avctx, AV_LOG_ERROR, overread_err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2064,20 +2064,20 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data,
|
|||||||
multiplier = (ac->m4ac.sbr == 1) ? ac->m4ac.ext_sample_rate > ac->m4ac.sample_rate : 0;
|
multiplier = (ac->m4ac.sbr == 1) ? ac->m4ac.ext_sample_rate > ac->m4ac.sample_rate : 0;
|
||||||
samples <<= multiplier;
|
samples <<= multiplier;
|
||||||
if (ac->output_configured < OC_LOCKED) {
|
if (ac->output_configured < OC_LOCKED) {
|
||||||
avccontext->sample_rate = ac->m4ac.sample_rate << multiplier;
|
avctx->sample_rate = ac->m4ac.sample_rate << multiplier;
|
||||||
avccontext->frame_size = samples;
|
avctx->frame_size = samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
data_size_tmp = samples * avccontext->channels * sizeof(int16_t);
|
data_size_tmp = samples * avctx->channels * sizeof(int16_t);
|
||||||
if (*data_size < data_size_tmp) {
|
if (*data_size < data_size_tmp) {
|
||||||
av_log(avccontext, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n",
|
"Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n",
|
||||||
*data_size, data_size_tmp);
|
*data_size, data_size_tmp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*data_size = data_size_tmp;
|
*data_size = data_size_tmp;
|
||||||
|
|
||||||
ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avccontext->channels);
|
ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
|
||||||
|
|
||||||
if (ac->output_configured)
|
if (ac->output_configured)
|
||||||
ac->output_configured = OC_LOCKED;
|
ac->output_configured = OC_LOCKED;
|
||||||
@ -2090,9 +2090,9 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data,
|
|||||||
return buf_size > buf_offset ? buf_consumed : buf_size;
|
return buf_size > buf_offset ? buf_consumed : buf_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int aac_decode_close(AVCodecContext *avccontext)
|
static av_cold int aac_decode_close(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
AACContext *ac = avccontext->priv_data;
|
AACContext *ac = avctx->priv_data;
|
||||||
int i, type;
|
int i, type;
|
||||||
|
|
||||||
for (i = 0; i < MAX_ELEM_ID; i++) {
|
for (i = 0; i < MAX_ELEM_ID; i++) {
|
||||||
|
@ -241,7 +241,7 @@ typedef struct {
|
|||||||
* main AAC context
|
* main AAC context
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
AVCodecContext * avccontext;
|
AVCodecContext * avctx;
|
||||||
|
|
||||||
MPEG4AudioConfig m4ac;
|
MPEG4AudioConfig m4ac;
|
||||||
|
|
||||||
|
@ -293,15 +293,15 @@ static void make_bands(int16_t* bands, int start, int stop, int num_bands)
|
|||||||
bands[num_bands-1] = stop - previous;
|
bands[num_bands-1] = stop - previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_n_master(AVCodecContext *avccontext, int n_master, int bs_xover_band)
|
static int check_n_master(AVCodecContext *avctx, int n_master, int bs_xover_band)
|
||||||
{
|
{
|
||||||
// Requirements (14496-3 sp04 p205)
|
// Requirements (14496-3 sp04 p205)
|
||||||
if (n_master <= 0) {
|
if (n_master <= 0) {
|
||||||
av_log(avccontext, AV_LOG_ERROR, "Invalid n_master: %d\n", n_master);
|
av_log(avctx, AV_LOG_ERROR, "Invalid n_master: %d\n", n_master);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (bs_xover_band >= n_master) {
|
if (bs_xover_band >= n_master) {
|
||||||
av_log(avccontext, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"Invalid bitstream, crossover band index beyond array bounds: %d\n",
|
"Invalid bitstream, crossover band index beyond array bounds: %d\n",
|
||||||
bs_xover_band);
|
bs_xover_band);
|
||||||
return -1;
|
return -1;
|
||||||
@ -349,7 +349,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
sbr_offset_ptr = sbr_offset[5];
|
sbr_offset_ptr = sbr_offset[5];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Unsupported sample rate for SBR: %d\n", sbr->sample_rate);
|
"Unsupported sample rate for SBR: %d\n", sbr->sample_rate);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -367,7 +367,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
} else if (spectrum->bs_stop_freq == 15) {
|
} else if (spectrum->bs_stop_freq == 15) {
|
||||||
sbr->k[2] = 3*sbr->k[0];
|
sbr->k[2] = 3*sbr->k[0];
|
||||||
} else {
|
} else {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Invalid bs_stop_freq: %d\n", spectrum->bs_stop_freq);
|
"Invalid bs_stop_freq: %d\n", spectrum->bs_stop_freq);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -382,7 +382,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
max_qmf_subbands = 32;
|
max_qmf_subbands = 32;
|
||||||
|
|
||||||
if (sbr->k[2] - sbr->k[0] > max_qmf_subbands) {
|
if (sbr->k[2] - sbr->k[0] > max_qmf_subbands) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Invalid bitstream, too many QMF subbands: %d\n", sbr->k[2] - sbr->k[0]);
|
"Invalid bitstream, too many QMF subbands: %d\n", sbr->k[2] - sbr->k[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -393,7 +393,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
|
|
||||||
dk = spectrum->bs_alter_scale + 1;
|
dk = spectrum->bs_alter_scale + 1;
|
||||||
sbr->n_master = ((sbr->k[2] - sbr->k[0] + (dk&2)) >> dk) << 1;
|
sbr->n_master = ((sbr->k[2] - sbr->k[0] + (dk&2)) >> dk) << 1;
|
||||||
if (check_n_master(ac->avccontext, sbr->n_master, sbr->spectrum_params.bs_xover_band))
|
if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (k = 1; k <= sbr->n_master; k++)
|
for (k = 1; k <= sbr->n_master; k++)
|
||||||
@ -428,7 +428,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
num_bands_0 = lrintf(half_bands * log2f(sbr->k[1] / (float)sbr->k[0])) * 2;
|
num_bands_0 = lrintf(half_bands * log2f(sbr->k[1] / (float)sbr->k[0])) * 2;
|
||||||
|
|
||||||
if (num_bands_0 <= 0) { // Requirements (14496-3 sp04 p205)
|
if (num_bands_0 <= 0) { // Requirements (14496-3 sp04 p205)
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Invalid num_bands_0: %d\n", num_bands_0);
|
av_log(ac->avctx, AV_LOG_ERROR, "Invalid num_bands_0: %d\n", num_bands_0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,7 +442,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
vk0[0] = sbr->k[0];
|
vk0[0] = sbr->k[0];
|
||||||
for (k = 1; k <= num_bands_0; k++) {
|
for (k = 1; k <= num_bands_0; k++) {
|
||||||
if (vk0[k] <= 0) { // Requirements (14496-3 sp04 p205)
|
if (vk0[k] <= 0) { // Requirements (14496-3 sp04 p205)
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", k, vk0[k]);
|
av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", k, vk0[k]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
vk0[k] += vk0[k-1];
|
vk0[k] += vk0[k-1];
|
||||||
@ -472,14 +472,14 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
vk1[0] = sbr->k[1];
|
vk1[0] = sbr->k[1];
|
||||||
for (k = 1; k <= num_bands_1; k++) {
|
for (k = 1; k <= num_bands_1; k++) {
|
||||||
if (vk1[k] <= 0) { // Requirements (14496-3 sp04 p205)
|
if (vk1[k] <= 0) { // Requirements (14496-3 sp04 p205)
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", k, vk1[k]);
|
av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", k, vk1[k]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
vk1[k] += vk1[k-1];
|
vk1[k] += vk1[k-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
sbr->n_master = num_bands_0 + num_bands_1;
|
sbr->n_master = num_bands_0 + num_bands_1;
|
||||||
if (check_n_master(ac->avccontext, sbr->n_master, sbr->spectrum_params.bs_xover_band))
|
if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
|
||||||
return -1;
|
return -1;
|
||||||
memcpy(&sbr->f_master[0], vk0,
|
memcpy(&sbr->f_master[0], vk0,
|
||||||
(num_bands_0 + 1) * sizeof(sbr->f_master[0]));
|
(num_bands_0 + 1) * sizeof(sbr->f_master[0]));
|
||||||
@ -488,7 +488,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
sbr->n_master = num_bands_0;
|
sbr->n_master = num_bands_0;
|
||||||
if (check_n_master(ac->avccontext, sbr->n_master, sbr->spectrum_params.bs_xover_band))
|
if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
|
||||||
return -1;
|
return -1;
|
||||||
memcpy(sbr->f_master, vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0]));
|
memcpy(sbr->f_master, vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0]));
|
||||||
}
|
}
|
||||||
@ -524,7 +524,7 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
|
|||||||
// illegal however the Coding Technologies decoder check stream has a final
|
// illegal however the Coding Technologies decoder check stream has a final
|
||||||
// count of 6 patches
|
// count of 6 patches
|
||||||
if (sbr->num_patches > 5) {
|
if (sbr->num_patches > 5) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Too many patches: %d\n", sbr->num_patches);
|
av_log(ac->avctx, AV_LOG_ERROR, "Too many patches: %d\n", sbr->num_patches);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,12 +563,12 @@ static int sbr_make_f_derived(AACContext *ac, SpectralBandReplication *sbr)
|
|||||||
|
|
||||||
// Requirements (14496-3 sp04 p205)
|
// Requirements (14496-3 sp04 p205)
|
||||||
if (sbr->kx[1] + sbr->m[1] > 64) {
|
if (sbr->kx[1] + sbr->m[1] > 64) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Stop frequency border too high: %d\n", sbr->kx[1] + sbr->m[1]);
|
"Stop frequency border too high: %d\n", sbr->kx[1] + sbr->m[1]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (sbr->kx[1] > 32) {
|
if (sbr->kx[1] > 32) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Start frequency border too high: %d\n", sbr->kx[1]);
|
av_log(ac->avctx, AV_LOG_ERROR, "Start frequency border too high: %d\n", sbr->kx[1]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,7 +580,7 @@ static int sbr_make_f_derived(AACContext *ac, SpectralBandReplication *sbr)
|
|||||||
sbr->n_q = FFMAX(1, lrintf(sbr->spectrum_params.bs_noise_bands *
|
sbr->n_q = FFMAX(1, lrintf(sbr->spectrum_params.bs_noise_bands *
|
||||||
log2f(sbr->k[2] / (float)sbr->kx[1]))); // 0 <= bs_noise_bands <= 3
|
log2f(sbr->k[2] / (float)sbr->kx[1]))); // 0 <= bs_noise_bands <= 3
|
||||||
if (sbr->n_q > 5) {
|
if (sbr->n_q > 5) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Too many noise floor scale factors: %d\n", sbr->n_q);
|
av_log(ac->avctx, AV_LOG_ERROR, "Too many noise floor scale factors: %d\n", sbr->n_q);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,7 +638,7 @@ static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
ch_data->bs_amp_res = 0;
|
ch_data->bs_amp_res = 0;
|
||||||
|
|
||||||
if (ch_data->bs_num_env > 4) {
|
if (ch_data->bs_num_env > 4) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n",
|
"Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n",
|
||||||
ch_data->bs_num_env);
|
ch_data->bs_num_env);
|
||||||
return -1;
|
return -1;
|
||||||
@ -693,7 +693,7 @@ static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
ch_data->bs_num_env = num_rel_lead + num_rel_trail + 1;
|
ch_data->bs_num_env = num_rel_lead + num_rel_trail + 1;
|
||||||
|
|
||||||
if (ch_data->bs_num_env > 5) {
|
if (ch_data->bs_num_env > 5) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n",
|
"Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n",
|
||||||
ch_data->bs_num_env);
|
ch_data->bs_num_env);
|
||||||
return -1;
|
return -1;
|
||||||
@ -714,7 +714,7 @@ static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bs_pointer > ch_data->bs_num_env + 1) {
|
if (bs_pointer > ch_data->bs_num_env + 1) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n",
|
"Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n",
|
||||||
bs_pointer);
|
bs_pointer);
|
||||||
return -1;
|
return -1;
|
||||||
@ -722,7 +722,7 @@ static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
|
|
||||||
for (i = 1; i <= ch_data->bs_num_env; i++) {
|
for (i = 1; i <= ch_data->bs_num_env; i++) {
|
||||||
if (ch_data->t_env[i-1] > ch_data->t_env[i]) {
|
if (ch_data->t_env[i-1] > ch_data->t_env[i]) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Non monotone time borders\n");
|
av_log(ac->avctx, AV_LOG_ERROR, "Non monotone time borders\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -907,21 +907,21 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
switch (bs_extension_id) {
|
switch (bs_extension_id) {
|
||||||
case EXTENSION_ID_PS:
|
case EXTENSION_ID_PS:
|
||||||
if (!ac->m4ac.ps) {
|
if (!ac->m4ac.ps) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR, "Parametric Stereo signaled to be not-present but was found in the bitstream.\n");
|
av_log(ac->avctx, AV_LOG_ERROR, "Parametric Stereo signaled to be not-present but was found in the bitstream.\n");
|
||||||
skip_bits_long(gb, *num_bits_left); // bs_fill_bits
|
skip_bits_long(gb, *num_bits_left); // bs_fill_bits
|
||||||
*num_bits_left = 0;
|
*num_bits_left = 0;
|
||||||
} else {
|
} else {
|
||||||
#if 0
|
#if 0
|
||||||
*num_bits_left -= ff_ps_data(gb, ps);
|
*num_bits_left -= ff_ps_data(gb, ps);
|
||||||
#else
|
#else
|
||||||
av_log_missing_feature(ac->avccontext, "Parametric Stereo is", 0);
|
av_log_missing_feature(ac->avctx, "Parametric Stereo is", 0);
|
||||||
skip_bits_long(gb, *num_bits_left); // bs_fill_bits
|
skip_bits_long(gb, *num_bits_left); // bs_fill_bits
|
||||||
*num_bits_left = 0;
|
*num_bits_left = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
av_log_missing_feature(ac->avccontext, "Reserved SBR extensions are", 1);
|
av_log_missing_feature(ac->avctx, "Reserved SBR extensions are", 1);
|
||||||
skip_bits_long(gb, *num_bits_left); // bs_fill_bits
|
skip_bits_long(gb, *num_bits_left); // bs_fill_bits
|
||||||
*num_bits_left = 0;
|
*num_bits_left = 0;
|
||||||
break;
|
break;
|
||||||
@ -1006,7 +1006,7 @@ static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
return get_bits_count(gb) - cnt;
|
return get_bits_count(gb) - cnt;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Invalid bitstream - cannot apply SBR to element type %d\n", id_aac);
|
"Invalid bitstream - cannot apply SBR to element type %d\n", id_aac);
|
||||||
sbr->start = 0;
|
sbr->start = 0;
|
||||||
return get_bits_count(gb) - cnt;
|
return get_bits_count(gb) - cnt;
|
||||||
@ -1033,7 +1033,7 @@ static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr)
|
|||||||
if (err >= 0)
|
if (err >= 0)
|
||||||
err = sbr_make_f_derived(ac, sbr);
|
err = sbr_make_f_derived(ac, sbr);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"SBR reset failed. Switching SBR to pure upsampling mode.\n");
|
"SBR reset failed. Switching SBR to pure upsampling mode.\n");
|
||||||
sbr->start = 0;
|
sbr->start = 0;
|
||||||
}
|
}
|
||||||
@ -1085,7 +1085,7 @@ int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
bytes_read = ((num_sbr_bits + num_align_bits + 4) >> 3);
|
bytes_read = ((num_sbr_bits + num_align_bits + 4) >> 3);
|
||||||
|
|
||||||
if (bytes_read > cnt) {
|
if (bytes_read > cnt) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"Expected to read %d SBR bytes actually read %d.\n", cnt, bytes_read);
|
"Expected to read %d SBR bytes actually read %d.\n", cnt, bytes_read);
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
@ -1380,7 +1380,7 @@ static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
g--;
|
g--;
|
||||||
|
|
||||||
if (g < 0) {
|
if (g < 0) {
|
||||||
av_log(ac->avccontext, AV_LOG_ERROR,
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
"ERROR : no subband found for frequency %d\n", k);
|
"ERROR : no subband found for frequency %d\n", k);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user