PR #22682 opened by michaelni URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22682 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22682.patch
Signed-off-by: Michael Niedermayer <[email protected]> From 35b336f464db06586efc1ff7da7075b459dfba6a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer <[email protected]> Date: Wed, 1 Apr 2026 17:33:37 +0200 Subject: [PATCH] avcodec/aac/aacdec_usac: Split Table 39 and 109 into separate arrays Signed-off-by: Michael Niedermayer <[email protected]> --- libavcodec/aac/aacdec_usac.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_usac.c index 4d57fbfff7..c0b25d9af8 100644 --- a/libavcodec/aac/aacdec_usac.c +++ b/libavcodec/aac/aacdec_usac.c @@ -202,6 +202,18 @@ static void decode_usac_element_core(AACUsacElemConfig *e, e->sbr.ratio = sbr_ratio; } +// ISO/IEC 23003-1:2007, 5.2, Table 39 +static const uint8_t num_bands[8] = { + 0, // Reserved / unreachable + 28, 20, 14, 10, 7, 5, 4 +}; + +// ISO/IEC 23003-3:2020, Table 109 — Default value of bsOttBandsPhase +static const uint8_t bsOttBandsPhase_default[8] = { + 0, // Reserved / unreachable + 10, 10, 7, 5, 3, 2, 2 +}; + static int decode_usac_element_pair(AACDecContext *ac, AACUsacElemConfig *e, GetBitContext *gb) { @@ -218,7 +230,7 @@ static int decode_usac_element_pair(AACDecContext *ac, if (!e->mps.freq_res) return AVERROR_INVALIDDATA; /* value 0 is reserved */ - int numBands = ((int[]){0,28,20,14,10,7,5,4})[e->mps.freq_res]; // ISO/IEC 23003-1:2007, 5.2, Table 39 + int numBands = num_bands[e->mps.freq_res]; e->mps.fixed_gain = get_bits(gb, 3); /* bsFixedGainDMX */ e->mps.temp_shape_config = get_bits(gb, 2); /* bsTempShapeConfig */ @@ -227,7 +239,7 @@ static int decode_usac_element_pair(AACDecContext *ac, e->mps.phase_coding = get_bits1(gb); /* bsPhaseCoding */ e->mps.otts_bands_phase_present = get_bits1(gb); - int otts_bands_phase = ((int[]){0,10,10,7,5,3,2,2})[e->mps.freq_res]; // Table 109 — Default value of bsOttBandsPhase + int otts_bands_phase = bsOttBandsPhase_default[e->mps.freq_res]; if (e->mps.otts_bands_phase_present) { /* bsOttBandsPhasePresent */ otts_bands_phase = get_bits(gb, 5); /* bsOttBandsPhase */ if (otts_bands_phase > numBands) -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
