Commit a188108e authored by Sebastian Dröge's avatar Sebastian Dröge Committed by Luca Barbato

aac: Support channel configurations 11 and 12

These are defined in ISO/IEC 14496-3:2009/PDAM 4 for 6.1 and 7.1.
It also defines another 7.1 layout with configuration 14, that one
is not added here for now.

11: 3/3.1    FC FL+FR BL+BR BC LFE
12: 3/2/2.1  FC FL+FR SiL+SiR BL+BR LFE
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent 677c804a
...@@ -507,7 +507,8 @@ static int set_default_channel_config(AVCodecContext *avctx, ...@@ -507,7 +507,8 @@ static int set_default_channel_config(AVCodecContext *avctx,
int *tags, int *tags,
int channel_config) int channel_config)
{ {
if (channel_config < 1 || channel_config > 7) { if (channel_config < 1 || (channel_config > 7 && channel_config < 11) ||
channel_config > 12) {
av_log(avctx, AV_LOG_ERROR, av_log(avctx, AV_LOG_ERROR,
"invalid default channel configuration (%d)\n", "invalid default channel configuration (%d)\n",
channel_config); channel_config);
...@@ -564,11 +565,19 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id) ...@@ -564,11 +565,19 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
/* For indexed channel configurations map the channels solely based /* For indexed channel configurations map the channels solely based
* on position. */ * on position. */
switch (ac->oc[1].m4ac.chan_config) { switch (ac->oc[1].m4ac.chan_config) {
case 12:
case 7: case 7:
if (ac->tags_mapped == 3 && type == TYPE_CPE) { if (ac->tags_mapped == 3 && type == TYPE_CPE) {
ac->tags_mapped++; ac->tags_mapped++;
return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2]; return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2];
} }
case 11:
if (ac->tags_mapped == 2 &&
ac->oc[1].m4ac.chan_config == 11 &&
type == TYPE_SCE) {
ac->tags_mapped++;
return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1];
}
case 6: case 6:
/* Some streams incorrectly code 5.1 audio as /* Some streams incorrectly code 5.1 audio as
* SCE[0] CPE[0] CPE[1] SCE[1] * SCE[0] CPE[0] CPE[1] SCE[1]
...@@ -2748,7 +2757,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data, ...@@ -2748,7 +2757,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
ac->tags_mapped = 0; ac->tags_mapped = 0;
if (chan_config < 0 || chan_config >= 8) { if (chan_config < 0 || (chan_config >= 8 && chan_config < 11) || chan_config >= 13) {
avpriv_request_sample(avctx, "Unknown ER channel configuration %d", avpriv_request_sample(avctx, "Unknown ER channel configuration %d",
chan_config); chan_config);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
......
...@@ -78,9 +78,9 @@ static const float * const tns_tmp2_map[4] = { ...@@ -78,9 +78,9 @@ static const float * const tns_tmp2_map[4] = {
}; };
// @} // @}
static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0 }; static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 4, 5, 0, 5, 0 };
static const uint8_t aac_channel_layout_map[7][5][3] = { static const uint8_t aac_channel_layout_map[16][5][3] = {
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, }, { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, },
{ { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, }, { { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, }, { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
...@@ -88,9 +88,16 @@ static const uint8_t aac_channel_layout_map[7][5][3] = { ...@@ -88,9 +88,16 @@ static const uint8_t aac_channel_layout_map[7][5][3] = {
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, }, { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, }, { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_FRONT }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, }, { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_FRONT }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{ { 0, } },
{ { 0, } },
{ { 0, } },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{ { 0, } },
/* TODO: Add 7+1 TOP configuration */
}; };
static const uint64_t aac_channel_layout[8] = { static const uint64_t aac_channel_layout[16] = {
AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO, AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_SURROUND, AV_CH_LAYOUT_SURROUND,
...@@ -99,6 +106,12 @@ static const uint64_t aac_channel_layout[8] = { ...@@ -99,6 +106,12 @@ static const uint64_t aac_channel_layout[8] = {
AV_CH_LAYOUT_5POINT1_BACK, AV_CH_LAYOUT_5POINT1_BACK,
AV_CH_LAYOUT_7POINT1_WIDE_BACK, AV_CH_LAYOUT_7POINT1_WIDE_BACK,
0, 0,
0,
0,
AV_CH_LAYOUT_6POINT1,
AV_CH_LAYOUT_7POINT1,
0,
/* AV_CH_LAYOUT_7POINT1_TOP, */
}; };
#endif /* AVCODEC_AACDECTAB_H */ #endif /* AVCODEC_AACDECTAB_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment