This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 2bad226f89683d1a6795512855fff69b36e09c97 Author: James Almer <[email protected]> AuthorDate: Tue May 19 09:33:02 2026 -0300 Commit: James Almer <[email protected]> CommitDate: Wed May 20 10:59:02 2026 -0300 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 7181bffab1..210eff215a 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 */ _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
