• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/minidlna/ffmpeg-2.3.4/libavcodec/

Lines Matching defs:ac

120 static int output_configure(AACContext *ac,
150 static av_cold int che_configure(AACContext *ac,
157 if (!ac->che[type][id]) {
158 if (!(ac->che[type][id] = av_mallocz(sizeof(ChannelElement))))
160 ff_aac_sbr_ctx_init(ac, &ac->che[type][id]->sbr);
163 if (*channels >= MAX_CHANNELS - (type == TYPE_CPE || (type == TYPE_SCE && ac->oc[1].m4ac.ps == 1))) {
164 av_log(ac->avctx, AV_LOG_ERROR, "Too many channels\n");
167 ac->output_element[(*channels)++] = &ac->che[type][id]->ch[0];
169 (type == TYPE_SCE && ac->oc[1].m4ac.ps == 1)) {
170 ac->output_element[(*channels)++] = &ac->che[type][id]->ch[1];
174 if (ac->che[type][id])
175 ff_aac_sbr_ctx_close(&ac->che[type][id]->sbr);
176 av_freep(&ac->che[type][id]);
183 AACContext *ac = avctx->priv_data;
189 ChannelElement *che = ac->che[type][id];
198 av_frame_unref(ac->frame);
202 ac->frame->nb_samples = 2048;
203 if ((ret = ff_get_buffer(avctx, ac->frame, 0)) < 0)
208 if (ac->output_element[ch])
209 ac->output_element[ch]->ret = (float *)ac->frame->extended_data[ch];
427 static void push_output_configuration(AACContext *ac) {
428 if (ac->oc[1].status == OC_LOCKED) {
429 ac->oc[0] = ac->oc[1];
431 ac->oc[1].status = OC_NONE;
438 static void pop_output_configuration(AACContext *ac) {
439 if (ac->oc[1].status != OC_LOCKED && ac->oc[0].status != OC_NONE) {
440 ac->oc[1] = ac->oc[0];
441 ac->avctx->channels = ac->oc[1].channels;
442 ac->avctx->channel_layout = ac->oc[1].channel_layout;
443 output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
444 ac->oc[1].status, 0);
454 static int output_configure(AACContext *ac,
458 AVCodecContext *avctx = ac->avctx;
462 if (ac->oc[1].layout_map != layout_map) {
463 memcpy(ac->oc[1].layout_map, layout_map, tags * sizeof(layout_map[0]));
464 ac->oc[1].layout_map_tags = tags;
477 ret = che_configure(ac, position, type, id, &channels);
481 if (ac->oc[1].m4ac.ps == 1 && channels == 2) {
489 memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0]));
491 ac->oc[1].channel_layout = layout;
492 avctx->channels = ac->oc[1].channels = channels;
493 ac->oc[1].status = oc_type;
496 if ((ret = frame_configure_elements(ac->avctx)) < 0)
505 AACContext *ac= avctx->priv_data;
510 ChannelElement *che = ac->che[type][i];
562 static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
566 if (!ac->oc[1].m4ac.chan_config) {
567 return ac->tag_che_map[type][elem_id];
570 if (!ac->tags_mapped && type == TYPE_CPE &&
571 ac->oc[1].m4ac.chan_config == 1) {
574 push_output_configuration(ac);
576 av_log(ac->avctx, AV_LOG_DEBUG, "mono with CPE\n");
578 if (set_default_channel_config(ac->avctx, layout_map,
581 if (output_configure(ac, layout_map, layout_map_tags,
585 ac->oc[1].m4ac.chan_config = 2;
586 ac->oc[1].m4ac.ps = 0;
589 if (!ac->tags_mapped && type == TYPE_SCE &&
590 ac->oc[1].m4ac.chan_config == 2) {
593 push_output_configuration(ac);
595 av_log(ac->avctx, AV_LOG_DEBUG, "stereo with SCE\n");
597 if (set_default_channel_config(ac->avctx, layout_map,
600 if (output_configure(ac, layout_map, layout_map_tags,
604 ac->oc[1].m4ac.chan_config = 1;
605 if (ac->oc[1].m4ac.sbr)
606 ac->oc[1].m4ac.ps = -1;
610 switch (ac->oc[1].m4ac.chan_config) {
612 if (ac->tags_mapped == 3 && type == TYPE_CPE) {
613 ac->tags_mapped++;
614 return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2];
623 if (ac->tags_mapped == tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
624 ac->tags_mapped++;
625 return ac->tag_che_map[type][elem_id] = ac->che[TYPE_LFE][0];
628 if (ac->tags_mapped == 2 && type == TYPE_CPE) {
629 ac->tags_mapped++;
630 return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][1];
633 if (ac->tags_mapped == 2 &&
634 ac->oc[1].m4ac.chan_config == 4 &&
636 ac->tags_mapped++;
637 return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1];
641 if (ac->tags_mapped == (ac->oc[1].m4ac.chan_config != 2) &&
643 ac->tags_mapped++;
644 return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][0];
645 } else if (ac->oc[1].m4ac.chan_config == 2) {
649 if (!ac->tags_mapped && type == TYPE_SCE) {
650 ac->tags_mapped++;
651 return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][0];
763 * @param ac pointer to AACContext, may be null
768 static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
806 if (ac && (ret = output_configure(ac, layout_map, tags, OC_GLOBAL_HDR, 0)))
845 static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
884 av_log(ac->avctx, AV_LOG_ERROR, overread_err);
894 if (ac && (ret = output_configure(ac, layout_map, tags, OC_GLOBAL_HDR, 0)))
909 * @param ac pointer to AACContext, may be null
918 static int decode_audio_specific_config(AACContext *ac,
960 if ((ret = decode_ga_specific_config(ac, avctx, &gb,
965 if ((ret = decode_eld_specific_config(ac, avctx, &gb,
1047 static void aacdec_init(AACContext *ac);
1051 AACContext *ac = avctx->priv_data;
1054 ac->avctx = avctx;
1055 ac->oc[1].m4ac.sample_rate = avctx->sample_rate;
1057 aacdec_init(ac);
1062 if ((ret = decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
1073 ac->oc[1].m4ac.sampling_index = sr;
1074 ac->oc[1].m4ac.channels = avctx->channels;
1075 ac->oc[1].m4ac.sbr = -1;
1076 ac->oc[1].m4ac.ps = -1;
1084 ac->oc[1].m4ac.chan_config = i;
1086 if (ac->oc[1].m4ac.chan_config) {
1088 &layout_map_tags, ac->oc[1].m4ac.chan_config);
1090 output_configure(ac, layout_map, layout_map_tags,
1116 ff_fmt_convert_init(&ac->fmt_conv, avctx);
1117 avpriv_float_dsp_init(&ac->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
1119 ac->random_state = 0x1f2e3d4c;
1133 ff_mdct_init(&ac->mdct, 11, 1, 1.0 / (32768.0 * 1024.0));
1134 ff_mdct_init(&ac->mdct_ld, 10, 1, 1.0 / (32768.0 * 512.0));
1135 ff_mdct_init(&ac->mdct_small, 8, 1, 1.0 / (32768.0 * 128.0));
1136 ff_mdct_init(&ac->mdct_ltp, 11, 0, -2.0 * 32768.0);
1152 static int skip_data_stream_element(AACContext *ac, GetBitContext *gb)
1162 av_log(ac->avctx, AV_LOG_ERROR, "skip_data_stream_element: "overread_err);
1169 static int decode_prediction(AACContext *ac, IndividualChannelStream *ics,
1177 av_log(ac->avctx, AV_LOG_ERROR,
1182 for (sfb = 0; sfb < FFMIN(ics->max_sfb, ff_aac_pred_sfb_max[ac->oc[1].m4ac.sampling_index]); sfb++) {
1205 static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
1208 int aot = ac->oc[1].m4ac.object_type;
1211 av_log(ac->avctx, AV_LOG_ERROR, "Reserved bit set.\n");
1218 av_log(ac->avctx, AV_LOG_ERROR,
1241 ics->swb_offset = ff_swb_offset_128[ac->oc[1].m4ac.sampling_index];
1242 ics->num_swb = ff_aac_num_swb_128[ac->oc[1].m4ac.sampling_index];
1243 ics->tns_max_bands = ff_tns_max_bands_128[ac->oc[1].m4ac.sampling_index];
1249 ics->swb_offset = ff_swb_offset_512[ac->oc[1].m4ac.sampling_index];
1250 ics->num_swb = ff_aac_num_swb_512[ac->oc[1].m4ac.sampling_index];
1251 ics->tns_max_bands = ff_tns_max_bands_512[ac->oc[1].m4ac.sampling_index];
1255 ics->swb_offset = ff_swb_offset_1024[ac->oc[1].m4ac.sampling_index];
1256 ics->num_swb = ff_aac_num_swb_1024[ac->oc[1].m4ac.sampling_index];
1257 ics->tns_max_bands = ff_tns_max_bands_1024[ac->oc[1].m4ac.sampling_index];
1265 if (decode_prediction(ac, ics, gb)) {
1270 av_log(ac->avctx, AV_LOG_ERROR,
1275 av_log(ac->avctx, AV_LOG_ERROR,
1286 av_log(ac->avctx, AV_LOG_ERROR,
1307 static int decode_band_types(AACContext *ac, enum BandType band_type[120],
1320 av_log(ac->avctx, AV_LOG_ERROR, "invalid band type\n");
1327 av_log(ac->avctx, AV_LOG_ERROR, "decode_band_types: "overread_err);
1331 av_log(ac->avctx, AV_LOG_ERROR,
1356 static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
1378 avpriv_request_sample(ac->avctx,
1393 avpriv_request_sample(ac->avctx,
1404 av_log(ac->avctx, AV_LOG_ERROR,
1446 static int decode_tns(AACContext *ac, TemporalNoiseShaping *tns,
1451 const int tns_max_order = is8 ? 7 : ac->oc[1].m4ac.object_type == AOT_AAC_MAIN ? 20 : 12;
1461 av_log(ac->avctx, AV_LOG_ERROR,
1583 static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
1617 ac->random_state = lcg_random(ac->random_state);
1618 cfo[k] = ac->random_state;
1621 band_energy = ac->fdsp.scalarproduct_float(cfo, cfo, off_len);
1623 ac->fdsp.vector_fmul_scalar(cfo, cfo, scale, off_len);
1750 av_log(ac->avctx, AV_LOG_ERROR, "error in spectral data, ESC overflow\n");
1769 ac->fdsp.vector_fmul_scalar(cfo, cfo, sf[idx], off_len);
1856 static void apply_prediction(AACContext *ac, SingleChannelElement *sce)
1867 sfb < ff_aac_pred_sfb_max[ac->oc[1].m4ac.sampling_index];
1892 static int decode_ics(AACContext *ac, SingleChannelElement *sce,
1902 eld_syntax = ac->oc[1].m4ac.object_type == AOT_ER_AAC_ELD;
1903 er_syntax = ac->oc[1].m4ac.object_type == AOT_ER_AAC_LC ||
1904 ac->oc[1].m4ac.object_type == AOT_ER_AAC_LTP ||
1905 ac->oc[1].m4ac.object_type == AOT_ER_AAC_LD ||
1906 ac->oc[1].m4ac.object_type == AOT_ER_AAC_ELD;
1916 if (decode_ics_info(ac, ics, gb) < 0)
1920 if ((ret = decode_band_types(ac, sce->band_type,
1923 if ((ret = decode_scalefactors(ac, sce->sf, gb, global_gain, ics,
1931 av_log(ac->avctx, AV_LOG_ERROR,
1936 av_log(ac->avctx, AV_LOG_ERROR,
1943 if (decode_tns(ac, tns, gb, ics) < 0)
1946 avpriv_request_sample(ac->avctx, "SSR");
1952 if (decode_tns(ac, tns, gb, ics) < 0)
1956 if (decode_spectrum_and_dequant(ac, out, gb, sce->sf, pulse_present,
1960 if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN && !common_window)
1961 apply_prediction(ac, sce);
1969 static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe)
1982 ac->fdsp.butterflies_float(ch0 + group * 128 + offsets[i],
2000 static void apply_intensity_stereo(AACContext *ac,
2021 ac->fdsp.vector_fmul_scalar(coef1 + group * 128 + offsets[i],
2042 static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
2045 int eld_syntax = ac->oc[1].m4ac.object_type == AOT_ER_AAC_ELD;
2049 if (decode_ics_info(ac, &cpe->ch[0].ics, gb))
2055 (ac->oc[1].m4ac.object_type != AOT_AAC_MAIN))
2060 av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n");
2065 if ((ret = decode_ics(ac, &cpe->ch[0], gb, common_window, 0)))
2067 if ((ret = decode_ics(ac, &cpe->ch[1], gb, common_window, 0)))
2072 apply_mid_side_stereo(ac, cpe);
2073 if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN) {
2074 apply_prediction(ac, &cpe->ch[0]);
2075 apply_prediction(ac, &cpe->ch[1]);
2079 apply_intensity_stereo(ac, cpe, ms_present);
2095 static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
2122 if ((ret = decode_ics(ac, sce, gb, 0, 0)))
2233 static int decode_fill(AACContext *ac, GetBitContext *gb, int len) {
2246 if (ac->avctx->debug & FF_DEBUG_PICT_INFO)
2247 av_log(ac->avctx, AV_LOG_DEBUG, "FILL:%s\n", buf);
2250 ac->avctx->internal->skip_samples = 1024;
2266 static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
2276 av_log(ac->avctx, AV_LOG_ERROR, "SBR was found before the first channel element.\n");
2278 } else if (!ac->oc[1].m4ac.sbr) {
2279 av_log(ac->avctx, AV_LOG_ERROR, "SBR signaled to be not-present but was found in the bitstream.\n");
2282 } else if (ac->oc[1].m4ac.sbr == -1 && ac->oc[1].status == OC_LOCKED) {
2283 av_log(ac->avctx, AV_LOG_ERROR, "Implicit SBR was found with a first occurrence after the first frame.\n");
2286 } else if (ac->oc[1].m4ac.ps == -1 && ac->oc[1].status < OC_LOCKED && ac->avctx->channels == 1) {
2287 ac->oc[1].m4ac.sbr = 1;
2288 ac->oc[1].m4ac.ps = 1;
2289 ac->avctx->profile = FF_PROFILE_AAC_HE_V2;
2290 output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
2291 ac->oc[1].status, 1);
2293 ac->oc[1].m4ac.sbr = 1;
2294 ac->avctx->profile = FF_PROFILE_AAC_HE;
2296 res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type);
2299 res = decode_dynamic_range(&ac->che_drc, gb);
2302 decode_fill(ac, gb, 8 * cnt - 4);
2375 static void windowing_and_mdct_ltp(AACContext *ac, float *out,
2384 ac->fdsp.vector_fmul(in, in, lwindow_prev, 1024);
2387 ac->fdsp.vector_fmul(in + 448, in + 448, swindow_prev, 128);
2390 ac->fdsp.vector_fmul_reverse(in + 1024, in + 1024, lwindow, 1024);
2392 ac->fdsp.vector_fmul_reverse(in + 1024 + 448, in + 1024 + 448, swindow, 128);
2395 ac->mdct_ltp.mdct_calc(&ac->mdct_ltp, out, in);
2401 static void apply_ltp(AACContext *ac, SingleChannelElement *sce)
2409 float *predFreq = ac->buf_mdct;
2418 ac->windowing_and_mdct_ltp(ac, predFreq, predTime, &sce->ics);
2421 ac->apply_tns(predFreq, &sce->tns, &sce->ics, 0);
2433 static void update_ltp(AACContext *ac, SingleChannelElement *sce)
2445 ac->fdsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960, &swindow[64], 64);
2447 saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * swindow[63 - i];
2449 memcpy(saved_ltp, ac->buf_mdct + 512, 448 * sizeof(float));
2451 ac->fdsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960, &swindow[64], 64);
2453 saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * swindow[63 - i];
2455 ac->fdsp.vector_fmul_reverse(saved_ltp, ac->buf_mdct + 512, &lwindow[512], 512);
2457 saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * lwindow[511 - i];
2468 static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
2477 float *buf = ac->buf_mdct;
2478 float *temp = ac->temp;
2484 ac->mdct_small.imdct_half(&ac->mdct_small, buf + i, in + i);
2486 ac->mdct.imdct_half(&ac->mdct, buf, in);
2496 ac->fdsp.vector_fmul_window( out, saved, buf, lwindow_prev, 512);
2501 ac->fdsp.vector_fmul_window(out + 448 + 0*128, saved + 448, buf + 0*128, swindow_prev, 64);
2502 ac->fdsp.vector_fmul_window(out + 448 + 1*128, buf + 0*128 + 64, buf + 1*128, swindow, 64);
2503 ac->fdsp.vector_fmul_window(out + 448 + 2*128, buf + 1*128 + 64, buf + 2*128, swindow, 64);
2504 ac->fdsp.vector_fmul_window(out + 448 + 3*128, buf + 2*128 + 64, buf + 3*128, swindow, 64);
2505 ac->fdsp.vector_fmul_window(temp, buf + 3*128 + 64, buf + 4*128, swindow, 64);
2508 ac->fdsp.vector_fmul_window(out + 448, saved + 448, buf, swindow_prev, 64);
2516 ac->fdsp.vector_fmul_window(saved + 64, buf + 4*128 + 64, buf + 5*128, swindow, 64);
2517 ac->fdsp.vector_fmul_window(saved + 192, buf + 5*128 + 64, buf + 6*128, swindow, 64);
2518 ac->fdsp.vector_fmul_window(saved + 320, buf + 6*128 + 64, buf + 7*128, swindow, 64);
2528 static void imdct_and_windowing_ld(AACContext *ac, SingleChannelElement *sce)
2534 float *buf = ac->buf_mdct;
2537 ac->mdct.imdct_half(&ac->mdct_ld, buf, in);
2543 ac->fdsp.vector_fmul_window(out + 192, saved + 192, buf, ff_sine_128, 64);
2546 ac->fdsp.vector_fmul_window(out, saved, buf, ff_sine_512, 256);
2553 static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
2559 float *buf = ac->buf_mdct;
2575 ac->mdct.imdct_half(&ac->mdct_ld, buf, in);
2614 static void apply_dependent_coupling(AACContext *ac,
2623 if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) {
2624 av_log(ac->avctx, AV_LOG_ERROR,
2650 static void apply_independent_coupling(AACContext *ac,
2658 const int len = 1024 << (ac->oc[1].m4ac.sbr == 1);
2669 static void apply_channel_coupling(AACContext *ac, ChannelElement *cc,
2672 void (*apply_coupling_method)(AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index))
2677 ChannelElement *cce = ac->che[TYPE_CCE][i];
2686 apply_coupling_method(ac, &cc->ch[0], cce, index);
2691 apply_coupling_method(ac, &cc->ch[1], cce, index++);
2702 static void spectral_to_sample(AACContext *ac)
2705 void (*imdct_and_window)(AACContext *ac, SingleChannelElement *sce);
2706 switch (ac->oc[1].m4ac.object_type) {
2714 imdct_and_window = ac->imdct_and_windowing;
2718 ChannelElement *che = ac->che[type][i];
2721 apply_channel_coupling(ac, che, type, i, BEFORE_TNS, apply_dependent_coupling);
2722 if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) {
2725 ac->apply_ltp(ac, &che->ch[0]);
2727 ac->apply_ltp(ac, &che->ch[1]);
2731 ac->apply_tns(che->ch[0].coeffs, &che->ch[0].tns, &che->ch[0].ics, 1);
2733 ac->apply_tns(che->ch[1].coeffs, &che->ch[1].tns, &che->ch[1].ics, 1);
2735 apply_channel_coupling(ac, che, type, i, BETWEEN_TNS_AND_IMDCT, apply_dependent_coupling);
2737 imdct_and_window(ac, &che->ch[0]);
2738 if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP)
2739 ac->update_ltp(ac, &che->ch[0]);
2741 imdct_and_window(ac, &che->ch[1]);
2742 if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP)
2743 ac->update_ltp(ac, &che->ch[1]);
2745 if (ac->oc[1].m4ac.sbr > 0) {
2746 ff_sbr_apply(ac, &che->sbr, type, che->ch[0].ret, che->ch[1].ret);
2750 apply_channel_coupling(ac, che, type, i, AFTER_IMDCT, apply_independent_coupling);
2756 static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
2765 if (!ac->warned_num_aac_frames && hdr_info.num_aac_frames != 1) {
2768 avpriv_report_missing_feature(ac->avctx,
2770 ac->warned_num_aac_frames = 1;
2772 push_output_configuration(ac);
2774 ac->oc[1].m4ac.chan_config = hdr_info.chan_config;
2775 if ((ret = set_default_channel_config(ac->avctx,
2780 if ((ret = output_configure(ac, layout_map, layout_map_tags,
2781 FFMAX(ac->oc[1].status,
2785 ac->oc[1].m4ac.chan_config = 0;
2791 if (ac->dmono_mode && ac->oc[0].status == OC_NONE) {
2797 if (output_configure(ac, layout_map, layout_map_tags,
2802 ac->oc[1].m4ac.sample_rate = hdr_info.sample_rate;
2803 ac->oc[1].m4ac.sampling_index = hdr_info.sampling_index;
2804 ac->oc[1].m4ac.object_type = hdr_info.object_type;
2805 if (ac->oc[0].status != OC_LOCKED ||
2806 ac->oc[0].m4ac.chan_config != hdr_info.chan_config ||
2807 ac->oc[0].m4ac.sample_rate != hdr_info.sample_rate) {
2808 ac->oc[1].m4ac.sbr = -1;
2809 ac->oc[1].m4ac.ps = -1;
2820 AACContext *ac = avctx->priv_data;
2824 int chan_config = ac->oc[1].m4ac.chan_config;
2825 int aot = ac->oc[1].m4ac.object_type;
2830 ac->frame = data;
2837 ac->avctx->profile = ac->oc[1].m4ac.object_type - 1;
2839 ac->tags_mapped = 0;
2843 ac->oc[1].m4ac.chan_config);
2849 if (!(che=get_che(ac, elem_type, elem_id))) {
2850 av_log(ac->avctx, AV_LOG_ERROR,
2859 err = decode_ics(ac, &che->ch[0], gb, 0, 0);
2862 err = decode_cpe(ac, gb, che);
2865 err = decode_ics(ac, &che->ch[0], gb, 0, 0);
2872 spectral_to_sample(ac);
2874 ac->frame->nb_samples = samples;
2875 ac->frame->sample_rate = avctx->sample_rate;
2885 AACContext *ac = avctx->priv_data;
2892 ac->frame = data;
2895 if ((err = parse_adts_frame_header(ac, gb)) < 0) {
2899 if (ac->oc[1].m4ac.sampling_index > 12) {
2900 av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->oc[1].m4ac.sampling_index);
2911 ac->avctx->profile = ac->oc[1].m4ac.object_type - 1;
2913 ac->tags_mapped = 0;
2919 if (!(che=get_che(ac, elem_type, elem_id))) {
2920 av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n",
2931 err = decode_ics(ac, &che->ch[0], gb, 0, 0);
2937 err = decode_cpe(ac, gb, che);
2942 err = decode_cce(ac, gb, che);
2946 err = decode_ics(ac, &che->ch[0], gb, 0, 0);
2951 err = skip_data_stream_element(ac, gb);
2957 push_output_configuration(ac);
2958 tags = decode_pce(avctx, &ac->oc[1].m4ac, layout_map, gb);
2967 err = output_configure(ac, layout_map, tags, OC_TRIAL_PCE, 1);
2969 ac->oc[1].m4ac.chan_config = 0;
2984 elem_id -= decode_extension_payload(ac, gb, elem_id, che_prev, elem_type_prev);
3006 spectral_to_sample(ac);
3008 multiplier = (ac->oc[1].m4ac.sbr == 1) ? ac->oc[1].m4ac.ext_sample_rate > ac->oc[1].m4ac.sample_rate : 0;
3011 if (ac->oc[1].status && audio_found) {
3012 avctx->sample_rate = ac->oc[1].m4ac.sample_rate << multiplier;
3014 ac->oc[1].status = OC_LOCKED;
3026 ac->frame->nb_samples = samples;
3027 ac->frame->sample_rate = avctx->sample_rate;
3029 av_frame_unref(ac->frame);
3033 is_dmono = ac->dmono_mode && sce_count == 2 &&
3034 ac->oc[1].channel_layout == (AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT);
3036 if (ac->dmono_mode == 1)
3038 else if (ac->dmono_mode == 2)
3044 pop_output_configuration(ac);
3051 AACContext *ac = avctx->priv_data;
3075 push_output_configuration(ac);
3076 if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
3079 pop_output_configuration(ac);
3084 ac->dmono_mode = 0;
3086 ac->dmono_mode = 1 + *jp_dualmono;
3087 if (ac->force_dmono_mode >= 0)
3088 ac->dmono_mode = ac->force_dmono_mode;
3096 switch (ac->oc[1].m4ac.object_type) {
3119 AACContext *ac = avctx->priv_data;
3124 if (ac->che[type][i])
3125 ff_aac_sbr_ctx_close(&ac->che[type][i]->sbr);
3126 av_freep(&ac->che[type][i]);
3130 ff_mdct_end(&ac->mdct);
3131 ff_mdct_end(&ac->mdct_small);
3132 ff_mdct_end(&ac->mdct_ld);
3133 ff_mdct_end(&ac->mdct_ltp);
3160 AACContext *ac = &latmctx->aac_ctx;
3161 AVCodecContext *avctx = ac->avctx;
3188 ac->oc[1].m4ac.sample_rate != m4ac.sample_rate ||
3189 ac->oc[1].m4ac.chan_config != m4ac.chan_config) {