static int assign_pair(struct elem_to_channel e2c_vec[MAX_ELEM_ID],
uint8_t (*layout_map)[3], int offset, uint64_t left,
- uint64_t right, int pos)
+ uint64_t right, int pos, uint64_t *layout)
{
if (layout_map[offset][0] == TYPE_CPE) {
e2c_vec[offset] = (struct elem_to_channel) {
.elem_id = layout_map[offset][1],
.aac_position = pos
};
+ if (e2c_vec[offset].av_position != UINT64_MAX)
+ *layout |= e2c_vec[offset].av_position;
+
return 1;
} else {
e2c_vec[offset] = (struct elem_to_channel) {
.elem_id = layout_map[offset + 1][1],
.aac_position = pos
};
+ if (left != UINT64_MAX)
+ *layout |= left;
+
+ if (right != UINT64_MAX)
+ *layout |= right;
+
return 2;
}
}
return num_pos_channels;
}
+#define PREFIX_FOR_22POINT2 (AV_CH_LAYOUT_7POINT1_WIDE_BACK|AV_CH_BACK_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_LOW_FREQUENCY_2)
static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
{
int i, n, total_non_cc_elements;
struct elem_to_channel e2c_vec[4 * MAX_ELEM_ID] = { { 0 } };
int num_front_channels, num_side_channels, num_back_channels;
- uint64_t layout;
+ uint64_t layout = 0;
if (FF_ARRAY_ELEMS(e2c_vec) < tags)
return 0;
.elem_id = layout_map[i][1],
.aac_position = AAC_CHANNEL_FRONT
};
+ layout |= e2c_vec[i].av_position;
i++;
num_front_channels--;
}
i += assign_pair(e2c_vec, layout_map, i,
AV_CH_FRONT_LEFT_OF_CENTER,
AV_CH_FRONT_RIGHT_OF_CENTER,
- AAC_CHANNEL_FRONT);
+ AAC_CHANNEL_FRONT, &layout);
num_front_channels -= 2;
}
if (num_front_channels >= 2) {
i += assign_pair(e2c_vec, layout_map, i,
AV_CH_FRONT_LEFT,
AV_CH_FRONT_RIGHT,
- AAC_CHANNEL_FRONT);
+ AAC_CHANNEL_FRONT, &layout);
num_front_channels -= 2;
}
while (num_front_channels >= 2) {
i += assign_pair(e2c_vec, layout_map, i,
UINT64_MAX,
UINT64_MAX,
- AAC_CHANNEL_FRONT);
+ AAC_CHANNEL_FRONT, &layout);
num_front_channels -= 2;
}
i += assign_pair(e2c_vec, layout_map, i,
AV_CH_SIDE_LEFT,
AV_CH_SIDE_RIGHT,
- AAC_CHANNEL_FRONT);
+ AAC_CHANNEL_FRONT, &layout);
num_side_channels -= 2;
}
while (num_side_channels >= 2) {
i += assign_pair(e2c_vec, layout_map, i,
UINT64_MAX,
UINT64_MAX,
- AAC_CHANNEL_SIDE);
+ AAC_CHANNEL_SIDE, &layout);
num_side_channels -= 2;
}
i += assign_pair(e2c_vec, layout_map, i,
UINT64_MAX,
UINT64_MAX,
- AAC_CHANNEL_BACK);
+ AAC_CHANNEL_BACK, &layout);
num_back_channels -= 2;
}
if (num_back_channels >= 2) {
i += assign_pair(e2c_vec, layout_map, i,
AV_CH_BACK_LEFT,
AV_CH_BACK_RIGHT,
- AAC_CHANNEL_BACK);
+ AAC_CHANNEL_BACK, &layout);
num_back_channels -= 2;
}
if (num_back_channels) {
.elem_id = layout_map[i][1],
.aac_position = AAC_CHANNEL_BACK
};
+ layout |= e2c_vec[i].av_position;
i++;
num_back_channels--;
}
.elem_id = layout_map[i][1],
.aac_position = AAC_CHANNEL_LFE
};
+ layout |= e2c_vec[i].av_position;
+ i++;
+ }
+ if (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) {
+ e2c_vec[i] = (struct elem_to_channel) {
+ .av_position = AV_CH_LOW_FREQUENCY_2,
+ .syn_ele = TYPE_LFE,
+ .elem_id = layout_map[i][1],
+ .aac_position = AAC_CHANNEL_LFE
+ };
+ layout |= e2c_vec[i].av_position;
i++;
}
while (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) {
i++;
}
- // Must choose a stable sort
+ // The previous checks would end up at 8 at this point for 22.2
+ if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) {
+ const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[12];
+ for (int j = 0; j < tags; j++) {
+ if (layout_map[j][0] != reference_layout_map[j][0] ||
+ layout_map[j][2] != reference_layout_map[j][2])
+ goto end_of_layout_definition;
+ }
+
+ e2c_vec[i] = (struct elem_to_channel) {
+ .av_position = AV_CH_TOP_FRONT_CENTER,
+ .syn_ele = layout_map[i][0],
+ .elem_id = layout_map[i][1],
+ .aac_position = layout_map[i][2]
+ }; layout |= e2c_vec[i].av_position; i++;
+ i += assign_pair(e2c_vec, layout_map, i,
+ AV_CH_TOP_FRONT_LEFT,
+ AV_CH_TOP_FRONT_RIGHT,
+ AAC_CHANNEL_FRONT,
+ &layout);
+ i += assign_pair(e2c_vec, layout_map, i,
+ AV_CH_TOP_SIDE_LEFT,
+ AV_CH_TOP_SIDE_RIGHT,
+ AAC_CHANNEL_SIDE,
+ &layout);
+ e2c_vec[i] = (struct elem_to_channel) {
+ .av_position = AV_CH_TOP_CENTER,
+ .syn_ele = layout_map[i][0],
+ .elem_id = layout_map[i][1],
+ .aac_position = layout_map[i][2]
+ }; layout |= e2c_vec[i].av_position; i++;
+ i += assign_pair(e2c_vec, layout_map, i,
+ AV_CH_TOP_BACK_LEFT,
+ AV_CH_TOP_BACK_RIGHT,
+ AAC_CHANNEL_BACK,
+ &layout);
+ e2c_vec[i] = (struct elem_to_channel) {
+ .av_position = AV_CH_TOP_BACK_CENTER,
+ .syn_ele = layout_map[i][0],
+ .elem_id = layout_map[i][1],
+ .aac_position = layout_map[i][2]
+ }; layout |= e2c_vec[i].av_position; i++;
+ e2c_vec[i] = (struct elem_to_channel) {
+ .av_position = AV_CH_BOTTOM_FRONT_CENTER,
+ .syn_ele = layout_map[i][0],
+ .elem_id = layout_map[i][1],
+ .aac_position = layout_map[i][2]
+ }; layout |= e2c_vec[i].av_position; i++;
+ i += assign_pair(e2c_vec, layout_map, i,
+ AV_CH_BOTTOM_FRONT_LEFT,
+ AV_CH_BOTTOM_FRONT_RIGHT,
+ AAC_CHANNEL_FRONT,
+ &layout);
+ }
+
+end_of_layout_definition:
+
total_non_cc_elements = n = i;
- do {
- int next_n = 0;
- for (i = 1; i < n; i++)
- if (e2c_vec[i - 1].av_position > e2c_vec[i].av_position) {
- FFSWAP(struct elem_to_channel, e2c_vec[i - 1], e2c_vec[i]);
- next_n = i;
- }
- n = next_n;
- } while (n > 0);
- layout = 0;
+ if (layout == AV_CH_LAYOUT_22POINT2) {
+ // For 22.2 reorder the result as needed
+ FFSWAP(struct elem_to_channel, e2c_vec[2], e2c_vec[0]); // FL & FR first (final), FC third
+ FFSWAP(struct elem_to_channel, e2c_vec[2], e2c_vec[1]); // FC second (final), FLc & FRc third
+ FFSWAP(struct elem_to_channel, e2c_vec[6], e2c_vec[2]); // LFE1 third (final), FLc & FRc seventh
+ FFSWAP(struct elem_to_channel, e2c_vec[4], e2c_vec[3]); // BL & BR fourth (final), SiL & SiR fifth
+ FFSWAP(struct elem_to_channel, e2c_vec[6], e2c_vec[4]); // FLc & FRc fifth (final), SiL & SiR seventh
+ FFSWAP(struct elem_to_channel, e2c_vec[7], e2c_vec[6]); // LFE2 seventh (final), SiL & SiR eight (final)
+ FFSWAP(struct elem_to_channel, e2c_vec[9], e2c_vec[8]); // TpFL & TpFR ninth (final), TFC tenth (final)
+ FFSWAP(struct elem_to_channel, e2c_vec[11], e2c_vec[10]); // TC eleventh (final), TpSiL & TpSiR twelth
+ FFSWAP(struct elem_to_channel, e2c_vec[12], e2c_vec[11]); // TpBL & TpBR twelth (final), TpSiL & TpSiR thirteenth (final)
+ } else {
+ // For everything else, utilize the AV channel position define as a
+ // stable sort.
+ do {
+ int next_n = 0;
+ for (i = 1; i < n; i++)
+ if (e2c_vec[i - 1].av_position > e2c_vec[i].av_position) {
+ FFSWAP(struct elem_to_channel, e2c_vec[i - 1], e2c_vec[i]);
+ next_n = i;
+ }
+ n = next_n;
+ } while (n > 0);
+
+ }
+
for (i = 0; i < total_non_cc_elements; i++) {
layout_map[i][0] = e2c_vec[i].syn_ele;
layout_map[i][1] = e2c_vec[i].elem_id;
layout_map[i][2] = e2c_vec[i].aac_position;
- if (e2c_vec[i].av_position != UINT64_MAX) {
- layout |= e2c_vec[i].av_position;
- }
}
return layout;
*
* @return Returns error status. 0 - OK, !0 - error
*/
-static int set_default_channel_config(AVCodecContext *avctx,
+static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx,
uint8_t (*layout_map)[3],
int *tags,
int channel_config)
{
if (channel_config < 1 || (channel_config > 7 && channel_config < 11) ||
- channel_config > 12) {
+ channel_config > 13) {
av_log(avctx, AV_LOG_ERROR,
"invalid default channel configuration (%d)\n",
channel_config);
* 7.1 layout was intended.
*/
if (channel_config == 7 && avctx->strict_std_compliance < FF_COMPLIANCE_STRICT) {
- av_log(avctx, AV_LOG_INFO, "Assuming an incorrectly encoded 7.1 channel layout"
- " instead of a spec-compliant 7.1(wide) layout, use -strict %d to decode"
- " according to the specification instead.\n", FF_COMPLIANCE_STRICT);
layout_map[2][2] = AAC_CHANNEL_SIDE;
+
+ if (!ac || !ac->warned_71_wide++) {
+ av_log(avctx, AV_LOG_INFO, "Assuming an incorrectly encoded 7.1 channel layout"
+ " instead of a spec-compliant 7.1(wide) layout, use -strict %d to decode"
+ " according to the specification instead.\n", FF_COMPLIANCE_STRICT);
+ }
}
return 0;
av_log(ac->avctx, AV_LOG_DEBUG, "mono with CPE\n");
- if (set_default_channel_config(ac->avctx, layout_map,
+ if (set_default_channel_config(ac, ac->avctx, layout_map,
&layout_map_tags, 2) < 0)
return NULL;
if (output_configure(ac, layout_map, layout_map_tags,
av_log(ac->avctx, AV_LOG_DEBUG, "stereo with SCE\n");
- if (set_default_channel_config(ac->avctx, layout_map,
+ if (set_default_channel_config(ac, ac->avctx, layout_map,
&layout_map_tags, 1) < 0)
return NULL;
if (output_configure(ac, layout_map, layout_map_tags,
/* For indexed channel configurations map the channels solely based
* on position. */
switch (ac->oc[1].m4ac.chan_config) {
+ case 13:
+ if (ac->tags_mapped > 3 && ((type == TYPE_CPE && elem_id < 8) ||
+ (type == TYPE_SCE && elem_id < 6) ||
+ (type == TYPE_LFE && elem_id < 2))) {
+ ac->tags_mapped++;
+ return ac->tag_che_map[type][elem_id] = ac->che[type][elem_id];
+ }
case 12:
case 7:
if (ac->tags_mapped == 3 && type == TYPE_CPE) {
if (tags < 0)
return tags;
} else {
- if ((ret = set_default_channel_config(avctx, layout_map,
+ if ((ret = set_default_channel_config(ac, avctx, layout_map,
&tags, channel_config)))
return ret;
}
skip_bits_long(gb, 8 * len);
}
- if ((ret = set_default_channel_config(avctx, layout_map,
+ if ((ret = set_default_channel_config(ac, avctx, layout_map,
&tags, channel_config)))
return ret;
int i, ret;
GetBitContext gbc = *gb;
- if ((i = ff_mpeg4audio_get_config_gb(m4ac, &gbc, sync_extension)) < 0)
+ if ((i = ff_mpeg4audio_get_config_gb(m4ac, &gbc, sync_extension, avctx)) < 0)
return AVERROR_INVALIDDATA;
if (m4ac->sampling_index > 12) {
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 void aacdec_init(AACContext *ac);
static av_cold void aac_static_table_init(void)
{
- AAC_INIT_VLC_STATIC( 0, 304);
- AAC_INIT_VLC_STATIC( 1, 270);
- AAC_INIT_VLC_STATIC( 2, 550);
- AAC_INIT_VLC_STATIC( 3, 300);
- AAC_INIT_VLC_STATIC( 4, 328);
- AAC_INIT_VLC_STATIC( 5, 294);
- AAC_INIT_VLC_STATIC( 6, 306);
- AAC_INIT_VLC_STATIC( 7, 268);
- AAC_INIT_VLC_STATIC( 8, 510);
- AAC_INIT_VLC_STATIC( 9, 366);
- AAC_INIT_VLC_STATIC(10, 462);
+ static VLC_TYPE vlc_buf[304 + 270 + 550 + 300 + 328 +
+ 294 + 306 + 268 + 510 + 366 + 462][2];
+ for (unsigned i = 0, offset = 0; i < 11; i++) {
+ vlc_spectral[i].table = &vlc_buf[offset];
+ vlc_spectral[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset;
+ ff_init_vlc_sparse(&vlc_spectral[i], 8, ff_aac_spectral_sizes[i],
+ ff_aac_spectral_bits[i], sizeof(ff_aac_spectral_bits[i][0]),
+ sizeof(ff_aac_spectral_bits[i][0]),
+ ff_aac_spectral_codes[i], sizeof(ff_aac_spectral_codes[i][0]),
+ sizeof(ff_aac_spectral_codes[i][0]),
+ ff_aac_codebook_vector_idx[i], sizeof(ff_aac_codebook_vector_idx[i][0]),
+ sizeof(ff_aac_codebook_vector_idx[i][0]),
+ INIT_VLC_STATIC_OVERLONG);
+ offset += vlc_spectral[i].table_size;
+ }
AAC_RENAME(ff_aac_sbr_init)();
352);
// window initialization
- AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(ff_aac_kbd_long_1024), 4.0, 1024);
- AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(ff_aac_kbd_short_128), 6.0, 128);
#if !USE_FIXED
- AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(ff_aac_kbd_long_960), 4.0, 960);
- AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(ff_aac_kbd_short_120), 6.0, 120);
- AAC_RENAME(ff_sine_window_init)(AAC_RENAME(ff_sine_960), 960);
- AAC_RENAME(ff_sine_window_init)(AAC_RENAME(ff_sine_120), 120);
+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_long_960), 4.0, 960);
+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(aac_kbd_short_120), 6.0, 120);
+ AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_960), 960);
+ AAC_RENAME(ff_sine_window_init)(AAC_RENAME(sine_120), 120);
+ AAC_RENAME(ff_init_ff_sine_windows)(9);
+ ff_aac_float_common_init();
+#else
+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_long_1024), 4.0, 1024);
+ AAC_RENAME(ff_kbd_window_init)(AAC_RENAME2(aac_kbd_short_128), 6.0, 128);
+ init_sine_windows_fixed();
#endif
- AAC_RENAME(ff_init_ff_sine_windows)(10);
- AAC_RENAME(ff_init_ff_sine_windows)( 9);
- AAC_RENAME(ff_init_ff_sine_windows)( 7);
AAC_RENAME(ff_cbrt_tableinit)();
}
AACContext *ac = avctx->priv_data;
int ret;
+ if (avctx->sample_rate > 96000)
+ return AVERROR_INVALIDDATA;
+
ret = ff_thread_once(&aac_table_init, &aac_static_table_init);
if (ret != 0)
return AVERROR_UNKNOWN;
ac->oc[1].m4ac.chan_config = i;
if (ac->oc[1].m4ac.chan_config) {
- int ret = set_default_channel_config(avctx, layout_map,
+ int ret = set_default_channel_config(ac, avctx, layout_map,
&layout_map_tags, ac->oc[1].m4ac.chan_config);
if (!ret)
output_configure(ac, layout_map, layout_map_tags,
}
} else if (cbt_m1 == NOISE_BT - 1) {
for (group = 0; group < (AAC_SIGNE)g_len; group++, cfo+=128) {
-#if !USE_FIXED
- float scale;
-#endif /* !USE_FIXED */
INTFLOAT band_energy;
-
+#if USE_FIXED
for (k = 0; k < off_len; k++) {
ac->random_state = lcg_random(ac->random_state);
-#if USE_FIXED
cfo[k] = ac->random_state >> 3;
-#else
- cfo[k] = ac->random_state;
-#endif /* USE_FIXED */
}
-#if USE_FIXED
band_energy = ac->fdsp->scalarproduct_fixed(cfo, cfo, off_len);
band_energy = fixed_sqrt(band_energy, 31);
noise_scale(cfo, sf[idx], band_energy, off_len);
#else
+ float scale;
+
+ for (k = 0; k < off_len; k++) {
+ ac->random_state = lcg_random(ac->random_state);
+ cfo[k] = ac->random_state;
+ }
+
band_energy = ac->fdsp->scalarproduct_float(cfo, cfo, off_len);
scale = sf[idx] / sqrtf(band_energy);
ac->fdsp->vector_fmul_scalar(cfo, cfo, scale, off_len);
#if !USE_FIXED
const float *vq = ff_aac_codebook_vector_vals[cbt_m1];
#endif /* !USE_FIXED */
- const uint16_t *cb_vector_idx = ff_aac_codebook_vector_idx[cbt_m1];
VLC_TYPE (*vlc_tab)[2] = vlc_spectral[cbt_m1].table;
OPEN_READER(re, gb);
UPDATE_CACHE(re, gb);
GET_VLC(code, re, gb, vlc_tab, 8, 2);
- cb_idx = cb_vector_idx[code];
+ cb_idx = code;
#if USE_FIXED
cf = DEC_SQUAD(cf, cb_idx);
#else
UPDATE_CACHE(re, gb);
GET_VLC(code, re, gb, vlc_tab, 8, 2);
- cb_idx = cb_vector_idx[code];
+ cb_idx = code;
nnz = cb_idx >> 8 & 15;
bits = nnz ? GET_CACHE(re, gb) : 0;
LAST_SKIP_BITS(re, gb, nnz);
UPDATE_CACHE(re, gb);
GET_VLC(code, re, gb, vlc_tab, 8, 2);
- cb_idx = cb_vector_idx[code];
+ cb_idx = code;
#if USE_FIXED
cf = DEC_SPAIR(cf, cb_idx);
#else
UPDATE_CACHE(re, gb);
GET_VLC(code, re, gb, vlc_tab, 8, 2);
- cb_idx = cb_vector_idx[code];
+ cb_idx = code;
nnz = cb_idx >> 8 & 15;
sign = nnz ? SHOW_UBITS(re, gb, nnz) << (cb_idx >> 12) : 0;
LAST_SKIP_BITS(re, gb, nnz);
UPDATE_CACHE(re, gb);
GET_VLC(code, re, gb, vlc_tab, 8, 2);
+ cb_idx = code;
- if (!code) {
+ if (cb_idx == 0x0000) {
*icf++ = 0;
*icf++ = 0;
continue;
}
- cb_idx = cb_vector_idx[code];
nnz = cb_idx >> 12;
nzt = cb_idx >> 8;
bits = SHOW_UBITS(re, gb, nnz) << (32-nnz);
if (cbt_m1 < NOISE_BT - 1) {
for (group = 0; group < (int)g_len; group++, cfo+=128) {
ac->vector_pow43(cfo, off_len);
- ac->subband_scale(cfo, cfo, sf[idx], 34, off_len);
+ ac->subband_scale(cfo, cfo, sf[idx], 34, off_len, ac->avctx);
}
}
}
coef0 + group * 128 + offsets[i],
scale,
23,
- offsets[i + 1] - offsets[i]);
+ offsets[i + 1] - offsets[i] ,ac->avctx);
#else
ac->fdsp->vector_fmul_scalar(coef1 + group * 128 + offsets[i],
coef0 + group * 128 + offsets[i],
INTFLOAT tmp[TNS_MAX_ORDER+1];
UINTFLOAT *coef = coef_param;
+ if(!mmm)
+ return;
+
for (w = 0; w < ics->num_windows; w++) {
bottom = ics->num_swb;
for (filt = 0; filt < tns->n_filt[w]; filt++) {
static void windowing_and_mdct_ltp(AACContext *ac, INTFLOAT *out,
INTFLOAT *in, IndividualChannelStream *ics)
{
- const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_RENAME(ff_aac_kbd_long_1024) : AAC_RENAME(ff_sine_1024);
- const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME(ff_aac_kbd_short_128) : AAC_RENAME(ff_sine_128);
- const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME(ff_aac_kbd_long_1024) : AAC_RENAME(ff_sine_1024);
- const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME(ff_aac_kbd_short_128) : AAC_RENAME(ff_sine_128);
+ const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
+ const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
+ const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
+ const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
if (ics->window_sequence[0] != LONG_STOP_SEQUENCE) {
ac->fdsp->vector_fmul(in, in, lwindow_prev, 1024);
IndividualChannelStream *ics = &sce->ics;
INTFLOAT *saved = sce->saved;
INTFLOAT *saved_ltp = sce->coeffs;
- const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_RENAME(ff_aac_kbd_long_1024) : AAC_RENAME(ff_sine_1024);
- const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME(ff_aac_kbd_short_128) : AAC_RENAME(ff_sine_128);
+ const INTFLOAT *lwindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
+ const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
int i;
if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
INTFLOAT *in = sce->coeffs;
INTFLOAT *out = sce->ret;
INTFLOAT *saved = sce->saved;
- const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME(ff_aac_kbd_short_128) : AAC_RENAME(ff_sine_128);
- const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME(ff_aac_kbd_long_1024) : AAC_RENAME(ff_sine_1024);
- const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME(ff_aac_kbd_short_128) : AAC_RENAME(ff_sine_128);
+ const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
+ const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_long_1024) : AAC_RENAME2(sine_1024);
+ const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME2(aac_kbd_short_128) : AAC_RENAME2(sine_128);
INTFLOAT *buf = ac->buf_mdct;
INTFLOAT *temp = ac->temp;
int i;
ac->mdct.imdct_half(&ac->mdct, buf, in);
#if USE_FIXED
for (i=0; i<1024; i++)
- buf[i] = (buf[i] + 4) >> 3;
+ buf[i] = (buf[i] + 4LL) >> 3;
#endif /* USE_FIXED */
}
INTFLOAT *in = sce->coeffs;
INTFLOAT *out = sce->ret;
INTFLOAT *saved = sce->saved;
- const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME(ff_aac_kbd_short_120) : AAC_RENAME(ff_sine_120);
- const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME(ff_aac_kbd_long_960) : AAC_RENAME(ff_sine_960);
- const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME(ff_aac_kbd_short_120) : AAC_RENAME(ff_sine_120);
+ const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME(aac_kbd_short_120) : AAC_RENAME(sine_120);
+ const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME(aac_kbd_long_960) : AAC_RENAME(sine_960);
+ const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME(aac_kbd_short_120) : AAC_RENAME(sine_120);
INTFLOAT *buf = ac->buf_mdct;
INTFLOAT *temp = ac->temp;
int i;
if (ics->use_kb_window[1]) {
// AAC LD uses a low overlap sine window instead of a KBD window
memcpy(out, saved, 192 * sizeof(*out));
- ac->fdsp->vector_fmul_window(out + 192, saved + 192, buf, AAC_RENAME(ff_sine_128), 64);
+ ac->fdsp->vector_fmul_window(out + 192, saved + 192, buf, AAC_RENAME2(sine_128), 64);
memcpy( out + 320, buf + 64, 192 * sizeof(*out));
} else {
- ac->fdsp->vector_fmul_window(out, saved, buf, AAC_RENAME(ff_sine_512), 256);
+ ac->fdsp->vector_fmul_window(out, saved, buf, AAC_RENAME2(sine_512), 256);
}
// buffer update
static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce)
{
- INTFLOAT *in = sce->coeffs;
+ UINTFLOAT *in = sce->coeffs;
INTFLOAT *out = sce->ret;
INTFLOAT *saved = sce->saved;
INTFLOAT *buf = ac->buf_mdct;
push_output_configuration(ac);
if (hdr_info.chan_config) {
ac->oc[1].m4ac.chan_config = hdr_info.chan_config;
- if ((ret = set_default_channel_config(ac->avctx,
+ if ((ret = set_default_channel_config(ac, ac->avctx,
layout_map,
&layout_map_tags,
hdr_info.chan_config)) < 0)
}
static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
- int *got_frame_ptr, GetBitContext *gb, AVPacket *avpkt)
+ int *got_frame_ptr, GetBitContext *gb,
+ const AVPacket *avpkt)
{
AACContext *ac = avctx->priv_data;
ChannelElement *che = NULL, *che_prev = NULL;
if (elem_type < TYPE_DSE) {
if (che_presence[elem_type][elem_id]) {
- av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d duplicate\n",
+ int error = che_presence[elem_type][elem_id] > 1;
+ av_log(ac->avctx, error ? AV_LOG_ERROR : AV_LOG_DEBUG, "channel element %d.%d duplicate\n",
elem_type, elem_id);
- err = AVERROR_INVALIDDATA;
- goto fail;
+ if (error) {
+ err = AVERROR_INVALIDDATA;
+ goto fail;
+ }
}
- che_presence[elem_type][elem_id] = 1;
+ che_presence[elem_type][elem_id]++;
if (!(che=get_che(ac, elem_type, elem_id))) {
av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n",
break;
case TYPE_PCE: {
- uint8_t layout_map[MAX_ELEM_ID*4][3];
+ uint8_t layout_map[MAX_ELEM_ID*4][3] = {{0}};
int tags;
int pushed = push_output_configuration(ac);
err = AVERROR_INVALIDDATA;
goto fail;
}
- while (elem_id > 0)
- elem_id -= decode_extension_payload(ac, gb, elem_id, che_prev, che_prev_type);
- err = 0; /* FIXME */
+ err = 0;
+ while (elem_id > 0) {
+ int ret = decode_extension_payload(ac, gb, elem_id, che_prev, che_prev_type);
+ if (ret < 0) {
+ err = ret;
+ break;
+ }
+ elem_id -= ret;
+ }
break;
default:
int buf_consumed;
int buf_offset;
int err;
- int new_extradata_size;
+ size_t new_extradata_size;
const uint8_t *new_extradata = av_packet_get_side_data(avpkt,
AV_PKT_DATA_NEW_EXTRADATA,
&new_extradata_size);
- int jp_dualmono_size;
+ size_t jp_dualmono_size;
const uint8_t *jp_dualmono = av_packet_get_side_data(avpkt,
AV_PKT_DATA_JP_DUALMONO,
&jp_dualmono_size);