PR #23154 opened by James Almer (jamrial) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23154 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23154.patch
Many of the entries were downright wrong, like mistagging LFE elements as SCE, as well as trying to match the native channel ordering in the PCE by placing CPE elements before SCE ones in some cases (like with FRONT elements), which is not spec compliant and results in unparseable streams. Remove the three layouts that define top channels. It's not clear how they should be signaled in PCE. >From 9b8e82085624fe80a4ed189373d15bb11d63aece Mon Sep 17 00:00:00 2001 From: James Almer <[email protected]> Date: Tue, 19 May 2026 11:14:59 -0300 Subject: [PATCH 1/2] avcodec/aacenc: fix PCE configs for known native layouts Many of the entries were downright wrong, like mistagging LFE elements as SCE, as well as trying to match the native channel ordering in the PCE by placing CPE elements before SCE ones in some cases (like with FRONT elements), which is not spec compliant and results in unparseable streams. Remove the three layouts that define top channels. It's not clear how they should be signaled in PCE. Signed-off-by: James Almer <[email protected]> --- libavcodec/aacenc.c | 193 +++++++++++++++++++------------------------- 1 file changed, 83 insertions(+), 110 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index b8df8dc530..867406dd06 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -123,34 +123,34 @@ static const AACPCEInfo aac_pce_configs[] = { { .layout = AV_CHANNEL_LAYOUT_SURROUND, .num_ele = { 2, 0, 0, 0 }, - .pairing = { { 1, 0 }, }, + .pairing = { { 0, 1 }, }, .index = { { 0, 0 }, }, - .config_map = { 2, TYPE_CPE, TYPE_SCE, }, - .reorder_map = { 0, 1, 2 }, + .config_map = { 2, TYPE_SCE, TYPE_CPE }, + .reorder_map = { 2, 0, 1 }, }, { .layout = AV_CHANNEL_LAYOUT_3POINT1, .num_ele = { 2, 0, 0, 1 }, - .pairing = { { 1, 0 }, }, + .pairing = { { 0, 1 }, }, .index = { { 0, 0 }, { 0 }, { 0 }, { 0 }, }, - .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_LFE }, - .reorder_map = { 0, 1, 2, 3 }, + .config_map = { 3, TYPE_SCE, TYPE_CPE, TYPE_LFE }, + .reorder_map = { 2, 0, 1, 3 }, }, { .layout = AV_CHANNEL_LAYOUT_4POINT0, .num_ele = { 2, 0, 1, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 0 }, }, + .pairing = { { 0, 1 }, { 0 }, { 0 }, }, .index = { { 0, 0 }, { 0 }, { 1 } }, - .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3 }, + .config_map = { 3, TYPE_SCE, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 2, 0, 1, 3 }, }, { .layout = AV_CHANNEL_LAYOUT_4POINT1, - .num_ele = { 2, 1, 1, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 0 }, }, - .index = { { 0, 0 }, { 1 }, { 2 }, { 0 } }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4 }, + .num_ele = { 2, 0, 1, 1 }, + .pairing = { { 0, 1 }, { 0 }, { 0 }, }, + .index = { { 0, 0 }, { 0 }, { 1 }, { 0 } }, + .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_LFE }, + .reorder_map = { 2, 0, 1, 4, 3 }, }, { .layout = AV_CHANNEL_LAYOUT_2_2, @@ -171,157 +171,130 @@ static const AACPCEInfo aac_pce_configs[] = { { .layout = AV_CHANNEL_LAYOUT_5POINT0, .num_ele = { 2, 1, 0, 0 }, - .pairing = { { 1, 0 }, { 1 }, }, + .pairing = { { 0, 1 }, { 1 }, }, .index = { { 0, 0 }, { 1 } }, - .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4 }, + .config_map = { 3, TYPE_SCE, TYPE_CPE, TYPE_CPE }, + .reorder_map = { 2, 0, 1, 3, 4 }, }, { .layout = AV_CHANNEL_LAYOUT_5POINT1, - .num_ele = { 2, 1, 1, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1 }, }, - .index = { { 0, 0 }, { 1 }, { 1 } }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5 }, + .num_ele = { 2, 1, 0, 1 }, + .pairing = { { 0, 1 }, { 0 }, { 1 }, }, + .index = { { 0, 0 }, { 1 }, { 0 }, { 0 }, }, + .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_LFE }, + .reorder_map = { 2, 0, 1, 4, 5, 3 }, }, { .layout = AV_CHANNEL_LAYOUT_5POINT0_BACK, .num_ele = { 2, 0, 1, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1 } }, + .pairing = { { 0, 1 }, { 0 }, { 1 } }, .index = { { 0, 0 }, { 0 }, { 1 } }, - .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4 }, + .config_map = { 3, TYPE_SCE, TYPE_CPE, TYPE_CPE }, + .reorder_map = { 2, 0, 1, 3, 4 }, }, { .layout = AV_CHANNEL_LAYOUT_5POINT1_BACK, - .num_ele = { 2, 1, 1, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1 }, }, - .index = { { 0, 0 }, { 1 }, { 1 } }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5 }, + .num_ele = { 2, 0, 1, 1 }, + .pairing = { { 0, 1 }, { 0 }, { 1 }, }, + .index = { { 0, 0 }, { 0 }, { 1 }, { 0 } }, + .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_LFE }, + .reorder_map = { 2, 0, 1, 4, 5, 3 }, }, { .layout = AV_CHANNEL_LAYOUT_6POINT0, .num_ele = { 2, 1, 1, 0 }, - .pairing = { { 1, 0 }, { 1 }, { 0 }, }, + .pairing = { { 0, 1 }, { 1 }, { 0 }, }, .index = { { 0, 0 }, { 1 }, { 1 } }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5 }, + .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 2, 0, 1, 4, 5, 3 }, }, { .layout = AV_CHANNEL_LAYOUT_6POINT0_FRONT, .num_ele = { 2, 1, 0, 0 }, .pairing = { { 1, 1 }, { 1 } }, - .index = { { 1, 0 }, { 2 }, }, + .index = { { 0, 1 }, { 2 }, }, .config_map = { 3, TYPE_CPE, TYPE_CPE, TYPE_CPE, }, .reorder_map = { 0, 1, 2, 3, 4, 5 }, }, { .layout = AV_CHANNEL_LAYOUT_HEXAGONAL, .num_ele = { 2, 0, 2, 0 }, - .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, }, - .index = { { 0, 0 },{ 0 },{ 1, 1 } }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, }, - .reorder_map = { 0, 1, 2, 3, 4, 5 }, + .pairing = { { 0, 1 }, { 0 }, { 1, 0 } }, + .index = { { 0, 0 }, { 0 }, { 1, 1 } }, + .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 2, 0, 1, 3, 4, 5 }, }, { .layout = AV_CHANNEL_LAYOUT_6POINT1, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, }, - .index = { { 0, 0 },{ 1 },{ 1, 2 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, + .num_ele = { 2, 1, 1, 1 }, + .pairing = { { 0, 1 },{ 1 },{ 0 }, }, + .index = { { 0, 0 },{ 1 },{ 1 },{ 0 } }, + .config_map = { 5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_LFE }, + .reorder_map = { 2, 0, 1, 5, 6, 4, 3 }, }, { .layout = AV_CHANNEL_LAYOUT_6POINT1_BACK, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, }, - .index = { { 0, 0 }, { 1 }, { 1, 2 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, + .num_ele = { 2, 0, 2, 1 }, + .pairing = { { 0, 1 },{ 1, 0 },{ 0 }, }, + .index = { { 0, 0 },{ 0 },{ 1, 1 },{ 0 } }, + .config_map = { 5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_LFE }, + .reorder_map = { 2, 0, 1, 4, 5, 6, 3 }, }, { .layout = AV_CHANNEL_LAYOUT_6POINT1_FRONT, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, }, - .index = { { 0, 0 }, { 1 }, { 1, 2 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, + .num_ele = { 2, 1, 0, 1 }, + .pairing = { { 1, 1 },{ 1 } }, + .index = { { 0, 1 },{ 2 },{ 0 },{ 0 } }, + .config_map = { 4, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_LFE }, + .reorder_map = { 0, 1, 3, 4, 5, 6, 2 }, }, { .layout = AV_CHANNEL_LAYOUT_7POINT0, - .num_ele = { 2, 1, 1, 0 }, - .pairing = { { 1, 0 }, { 1 }, { 1 }, }, - .index = { { 0, 0 }, { 1 }, { 2 }, }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, + .num_ele = { 2, 0, 2, 0 }, + .pairing = { { 0, 1 }, { 0 }, { 1, 1 }, }, + .index = { { 0, 0 }, { 0 }, { 2, 1 }, }, + .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE }, + .reorder_map = { 2, 0, 1, 3, 4, 5, 6 }, }, { .layout = AV_CHANNEL_LAYOUT_7POINT0_FRONT, - .num_ele = { 2, 1, 1, 0 }, - .pairing = { { 1, 0 }, { 1 }, { 1 }, }, - .index = { { 0, 0 }, { 1 }, { 2 }, }, - .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6 }, + .num_ele = { 3, 1, 0, 0 }, + .pairing = { { 0, 1, 1 }, { 1 }, }, + .index = { { 0, 0, 1 }, { 2 }, }, + .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE }, + .reorder_map = { 2, 0, 1, 3, 4, 5, 6 }, }, { .layout = AV_CHANNEL_LAYOUT_7POINT1, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, }, - .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 }, + .num_ele = { 2, 0, 2, 1 }, + .pairing = { { 0, 1 }, { 0 }, { 1, 1 }, }, + .index = { { 0, 0 }, { 0 }, { 2, 1 }, { 0 } }, + .config_map = { 5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_LFE }, + .reorder_map = { 2, 0, 1, 4, 5, 6, 7, 3 }, }, { .layout = AV_CHANNEL_LAYOUT_7POINT1_WIDE, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 }, { 0 },{ 1, 1 }, }, - .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 }, + .num_ele = { 3, 1, 0, 1 }, + .pairing = { { 0, 1, 1 }, { 1 }, }, + .index = { { 0, 0, 1 }, { 2 }, }, + .config_map = { 5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_LFE }, + .reorder_map = { 2, 0, 1, 4, 5, 6, 7, 3 }, }, { .layout = AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, }, - .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 }, + .num_ele = { 3, 0, 1, 1 }, + .pairing = { { 0, 1, 1 }, { 0 }, { 1 } }, + .index = { { 0, 0, 2 }, { 0 }, { 1 }, { 0 } }, + .config_map = { 5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_LFE }, + .reorder_map = { 2, 0, 1, 4, 5, 6, 7, 3 }, }, { .layout = AV_CHANNEL_LAYOUT_OCTAGONAL, - .num_ele = { 2, 1, 2, 0 }, - .pairing = { { 1, 0 }, { 1 }, { 1, 0 }, }, - .index = { { 0, 0 }, { 1 }, { 2, 1 } }, - .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 }, - }, - { /* Meant for order 2/mixed ambisonics */ - .layout = { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = 9, - .u.mask = AV_CH_LAYOUT_OCTAGONAL | AV_CH_TOP_CENTER }, - .num_ele = { 2, 2, 2, 0 }, - .pairing = { { 1, 0 }, { 1, 0 }, { 1, 0 }, }, - .index = { { 0, 0 }, { 1, 1 }, { 2, 2 } }, - .config_map = { 6, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, - }, - { /* Meant for order 2/mixed ambisonics */ - .layout = { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = 10, - .u.mask = AV_CH_LAYOUT_6POINT0_FRONT | AV_CH_BACK_CENTER | - AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT | AV_CH_TOP_CENTER }, - .num_ele = { 2, 2, 2, 0 }, - .pairing = { { 1, 1 }, { 1, 0 }, { 1, 0 }, }, - .index = { { 0, 1 }, { 2, 0 }, { 3, 1 } }, - .config_map = { 6, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, - }, - { - .layout = AV_CHANNEL_LAYOUT_HEXADECAGONAL, - .num_ele = { 4, 2, 4, 0 }, - .pairing = { { 1, 0, 1, 0 }, { 1, 1 }, { 1, 0, 1, 0 }, }, - .index = { { 0, 0, 1, 1 }, { 2, 3 }, { 4, 2, 5, 3 } }, - .config_map = { 10, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE }, - .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, + .num_ele = { 2, 0, 3, 0 }, + .pairing = { { 0, 1 }, { 0 }, { 1, 1, 0 }, }, + .index = { { 0, 0 }, { 0 }, { 1, 2, 1 }, }, + .config_map = { 5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE }, + .reorder_map = { 2, 0, 1, 6, 7, 3, 4, 5 }, }, }; -- 2.52.0 >From f9e7ae0d18c79469dd1f155b4085bf60062dbb93 Mon Sep 17 00:00:00 2001 From: James Almer <[email protected]> Date: Tue, 19 May 2026 09:33:02 -0300 Subject: [PATCH 2/2] avcodec/aacenc: add missing default Channel Configurations And stop writing 7.1 as 7.1(wide) (channel conf 7). Lets not create any more non-spec compliant files that the native decoder needs to work around with now that we can use PCE configuration for it, getting rid of the ambiguity. Signed-off-by: James Almer <[email protected]> --- libavcodec/aacenc.c | 17 +++++++++-------- libavcodec/aacenctab.h | 28 ++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 867406dd06..8a6c315b39 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -339,11 +339,10 @@ static void put_pce(PutBitContext *pb, AVCodecContext *avctx) * Make AAC audio config object. * @see 1.6.2.1 "Syntax - AudioSpecificConfig" */ -static int put_audio_specific_config(AVCodecContext *avctx) +static int put_audio_specific_config(AVCodecContext *avctx, int chcfg) { PutBitContext pb; AACEncContext *s = avctx->priv_data; - int channels = (!s->needs_pce)*(s->channels - (s->channels == 8 ? 1 : 0)); const int max_size = 32; avctx->extradata = av_mallocz(max_size); @@ -353,7 +352,7 @@ static int put_audio_specific_config(AVCodecContext *avctx) init_put_bits(&pb, avctx->extradata, max_size); put_bits(&pb, 5, s->profile+1); //profile put_bits(&pb, 4, s->samplerate_index); //sample rate index - put_bits(&pb, 4, channels); + put_bits(&pb, 4, chcfg); //GASpecificConfig put_bits(&pb, 1, 0); //frame length - 1024 samples put_bits(&pb, 1, 0); //does not depend on core coder @@ -1155,6 +1154,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) { AACEncContext *s = avctx->priv_data; int i, ret = 0; + int chcfg; const uint8_t *sizes[2]; uint8_t grouping[AAC_MAX_CHANNELS]; int lengths[2]; @@ -1169,8 +1169,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) s->channels = avctx->ch_layout.nb_channels; s->needs_pce = 1; - for (i = 0; i < FF_ARRAY_ELEMS(aac_normal_chan_layouts); i++) { - if (!av_channel_layout_compare(&avctx->ch_layout, &aac_normal_chan_layouts[i])) { + for (chcfg = 1; chcfg < FF_ARRAY_ELEMS(aac_normal_chan_layouts); chcfg++) { + if (!av_channel_layout_compare(&avctx->ch_layout, &aac_normal_chan_layouts[chcfg])) { s->needs_pce = s->options.pce; break; } @@ -1190,9 +1190,10 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) s->pce = aac_pce_configs[i]; s->reorder_map = s->pce.reorder_map; s->chan_map = s->pce.config_map; + chcfg = 0; } else { - s->reorder_map = aac_chan_maps[s->channels - 1]; - s->chan_map = aac_chan_configs[s->channels - 1]; + s->reorder_map = aac_chan_maps[chcfg - 1]; + s->chan_map = aac_chan_configs[chcfg - 1]; } if (!avctx->bit_rate) { @@ -1251,7 +1252,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) if ((ret = alloc_buffers(avctx, s)) < 0) return ret; - if ((ret = put_audio_specific_config(avctx))) + if ((ret = put_audio_specific_config(avctx, chcfg))) return ret; sizes[0] = ff_aac_swb_size_1024[s->samplerate_index]; diff --git a/libavcodec/aacenctab.h b/libavcodec/aacenctab.h index fee9c245d8..addab63885 100644 --- a/libavcodec/aacenctab.h +++ b/libavcodec/aacenctab.h @@ -44,32 +44,46 @@ extern const uint8_t *const ff_aac_swb_size_1024[]; extern const uint8_t *const ff_aac_swb_size_128[]; /* Supported layouts without using a PCE */ -static const AVChannelLayout aac_normal_chan_layouts[7] = { +static const AVChannelLayout aac_normal_chan_layouts[15] = { + { 0 }, AV_CHANNEL_LAYOUT_MONO, AV_CHANNEL_LAYOUT_STEREO, AV_CHANNEL_LAYOUT_SURROUND, AV_CHANNEL_LAYOUT_4POINT0, AV_CHANNEL_LAYOUT_5POINT0_BACK, AV_CHANNEL_LAYOUT_5POINT1_BACK, + { 0 }, // AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK, disabled in favor or PCE configuration + { 0 }, + { 0 }, + { 0 }, + AV_CHANNEL_LAYOUT_6POINT1_BACK, AV_CHANNEL_LAYOUT_7POINT1, + { 0 }, + AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK, }; /** default channel configurations */ -static const uint8_t aac_chan_configs[AAC_MAX_CHANNELS][6] = { +static const uint8_t aac_chan_configs[14][6] = { {1, TYPE_SCE}, // 1 channel - single channel element {1, TYPE_CPE}, // 2 channels - channel pair {2, TYPE_SCE, TYPE_CPE}, // 3 channels - center + stereo {3, TYPE_SCE, TYPE_CPE, TYPE_SCE}, // 4 channels - front center + stereo + back center {3, TYPE_SCE, TYPE_CPE, TYPE_CPE}, // 5 channels - front center + stereo + back stereo {4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_LFE}, // 6 channels - front center + stereo + back stereo + LFE - {0}, // 7 channels - invalid without PCE + {0}, + {0}, + {0}, + {0}, + {5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_LFE}, // 7 channels - front center + front stereo + back stereo + back center + LFE {5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_LFE}, // 8 channels - front center + front stereo + side stereo + back stereo + LFE + {0}, + {5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_LFE, TYPE_CPE}, // 8 channels - front center + front stereo + back stereo + LFE + top front stereo }; /** * Table to remap channels from libavcodec's default order to AAC order. */ -static const uint8_t aac_chan_maps[AAC_MAX_CHANNELS][AAC_MAX_CHANNELS] = { +static const uint8_t aac_chan_maps[14][AAC_MAX_CHANNELS] = { { 0 }, { 0, 1 }, { 2, 0, 1 }, @@ -77,7 +91,13 @@ static const uint8_t aac_chan_maps[AAC_MAX_CHANNELS][AAC_MAX_CHANNELS] = { { 2, 0, 1, 3, 4 }, { 2, 0, 1, 4, 5, 3 }, { 0 }, + { 0 }, + { 0 }, + { 0 }, + { 2, 0, 1, 4, 5, 6, 3, }, { 2, 0, 1, 6, 7, 4, 5, 3 }, + { 0 }, + { 2, 0, 1, 4, 5, 3, 6, 7 }, }; /** bits needed to code codebook run value for long windows */ -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
