[PR] avcodec/libfdk-aacdec: add support for more height channels (PR #24260)
James Almer via ffmpeg-devel <[email protected]>
| Newsgroups | gmane.comp.video.ffmpeg.devel |
|---|---|
| Message-ID | <[email protected]> |
PR #24260 opened by James Almer (jamrial) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24260 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24260.patch >From cf2b0693219715e5bb49aab57551646f6c7c27a4 Mon Sep 17 00:00:00 2001 From: James Almer <[email protected]> Date: Mon, 24 Aug 2026 22:06:52 -0300 Subject: [PATCH 1/2] avcodec/libfdk-aacdec: add support for top back and top side channels While PCE can signal these, libfdk-aac supports only up to 8 channels, so any sample that could contain these will most likely have more channels than can be decoded anyway. Signed-off-by: James Almer <[email protected]> --- libavcodec/libfdk-aacdec.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c index d1008e2a36..9aa9ef5e09 100644 --- a/libavcodec/libfdk-aacdec.c +++ b/libavcodec/libfdk-aacdec.c @@ -239,6 +239,42 @@ static int get_stream_info(AVCodecContext *avctx, AVFrame *frame) break; } } + if (channel_counts[ACT_BACK_TOP] > 0) { + switch (channel_counts[ACT_BACK_TOP]) { + case 3: + case 2: + ch_layout |= AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT; + av_fallthrough; + case 1: + if (channel_counts[ACT_BACK_TOP] & 1) + ch_layout |= AV_CH_TOP_BACK_CENTER; + break; + default: + av_log(avctx, AV_LOG_WARNING, + "unsupported number of top back channels: %d\n", + channel_counts[ACT_BACK_TOP]); + ch_error = 1; + break; + } + } + if (channel_counts[ACT_SIDE_TOP] > 0) { + switch (channel_counts[ACT_SIDE_TOP]) { + case 3: + case 2: + ch_layout |= AV_CH_TOP_SIDE_LEFT | AV_CH_TOP_SIDE_RIGHT; + av_fallthrough; + case 1: + if (channel_counts[ACT_SIDE_TOP] & 1) + ch_layout |= AV_CH_TOP_CENTER; + break; + default: + av_log(avctx, AV_LOG_WARNING, + "unsupported number of top side channels: %d\n", + channel_counts[ACT_SIDE_TOP]); + ch_error = 1; + break; + } + } av_channel_layout_uninit(&avctx->ch_layout); av_channel_layout_from_mask(&avctx->ch_layout, ch_layout); -- 2.52.0 >From 9dfcf1a2eb212bea727030b89d8fb544dff34c15 Mon Sep 17 00:00:00 2001 From: James Almer <[email protected]> Date: Mon, 24 Aug 2026 23:05:57 -0300 Subject: [PATCH 2/2] avcodec/libfdk-aacdec: add support for bottom front channels Same as the previous commit, actual samples with less than eight channels including these is very unlikely. Signed-off-by: James Almer <[email protected]> --- libavcodec/libfdk-aacdec.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c index 9aa9ef5e09..41ff4887a6 100644 --- a/libavcodec/libfdk-aacdec.c +++ b/libavcodec/libfdk-aacdec.c @@ -151,12 +151,14 @@ static int get_stream_info(AVCodecContext *avctx, AVFrame *frame) channel_counts[ctype]++; } av_log(avctx, AV_LOG_DEBUG, - "%d channels - front:%d side:%d back:%d lfe:%d top:%d\n", + "%d channels - front:%d side:%d back:%d lfe:%d top:%d bottom %d\n", info->numChannels, channel_counts[ACT_FRONT], channel_counts[ACT_SIDE], channel_counts[ACT_BACK], channel_counts[ACT_LFE], channel_counts[ACT_FRONT_TOP] + channel_counts[ACT_SIDE_TOP] + - channel_counts[ACT_BACK_TOP] + channel_counts[ACT_TOP]); + channel_counts[ACT_BACK_TOP] + channel_counts[ACT_TOP], + channel_counts[ACT_FRONT_BOTTOM] + channel_counts[ACT_SIDE_BOTTOM] + + channel_counts[ACT_BACK_BOTTOM] + channel_counts[ACT_BOTTOM]); switch (channel_counts[ACT_FRONT]) { case 5: @@ -275,6 +277,24 @@ static int get_stream_info(AVCodecContext *avctx, AVFrame *frame) break; } } + if (channel_counts[ACT_FRONT_BOTTOM] > 0) { + switch (channel_counts[ACT_FRONT_BOTTOM]) { + case 3: + case 2: + ch_layout |= AV_CH_BOTTOM_FRONT_LEFT | AV_CH_BOTTOM_FRONT_RIGHT; + av_fallthrough; + case 1: + if (channel_counts[ACT_FRONT_BOTTOM] & 1) + ch_layout |= AV_CH_BOTTOM_FRONT_CENTER; + break; + default: + av_log(avctx, AV_LOG_WARNING, + "unsupported number of bottom front channels: %d\n", + channel_counts[ACT_FRONT_BOTTOM]); + ch_error = 1; + break; + } + } av_channel_layout_uninit(&avctx->ch_layout); av_channel_layout_from_mask(&avctx->ch_layout, ch_layout); -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]