PR #26382 opened by Forgejo_Fairy URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26382 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26382.patch
Fixes #26330. Initialize the first channel of each USAC element with `0x3039` and the second with `0x10932`, as specified in ISO/IEC 23003-3:2020 §7.2.4. The previous check used the element’s channel count, leaving the first seed at zero. This isolates the seed correction also present in #26113. The exhale target-level test now uses a libxaac PCM reference. The input omits AudioPreRoll from its first access unit so both decoders start with the same history. Its loudness metadata and remaining 47 packets are unchanged, and FFmpeg produces the same PCM from either input. The reference contains exactly 48,000 stereo frames at a target level of −24. The two FATE files and reference-generation details are in 50c14a3dd95d on `fairy/issue26330-tooling`. They belong under `aac/usac` in fate-suite and await public sample upload. With those files installed, `make fate-aac-usac-target-level SAMPLES=/opt/fate-suite` distinguishes the old and corrected decoders at the existing tolerance of 2. Maximum error falls from 14 to 1 on both AArch64 and x86-64. All nine USAC FATE tests pass on both architectures. From f65c27bf3e594760b2a0af9ffee3e0e67ed22f8d Mon Sep 17 00:00:00 2001 From: Fredrik Mellbin <[email protected]> Date: Tue, 24 Nov 2026 19:37:48 +0100 Subject: [PATCH] avcodec/aac/aacdec_usac: seed noise filling by channel index The element channel count is always positive, so testing it after clearing the element data leaves the first channel's seed at zero. Set the current channel's seed as specified in ISO/IEC 23003-3:2020, 7.2.4. Use a libxaac reference for the exhale loudness test. Omit AudioPreRoll from the first packet of the test stream so both decoders start with the same history. This gives identical FFmpeg PCM to the original input, preserves the v0 loudness metadata, and lets the existing oneoff tolerance distinguish the two seeds. The reference covers exactly the MP4 presentation duration. Fixes #26330. Co-Authored-By: Claude Opus 5.5 <[email protected]> Assisted-by: Fairy --- libavcodec/aac/aacdec_usac.c | 5 +---- tests/fate/aac.mak | 10 +++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_usac.c index e29457a1bd7..b8f0daad8e8 100644 --- a/libavcodec/aac/aacdec_usac.c +++ b/libavcodec/aac/aacdec_usac.c @@ -536,10 +536,7 @@ int ff_aac_usac_reset_state(AACDecContext *ac, OutputConfiguration *oc) memset(ue, 0, sizeof(*ue)); - if (!ch) - ue->noise.seed = 0x3039; - else - che->ch[1].ue.noise.seed = 0x10932; + ue->noise.seed = j ? 0x10932 : 0x3039; } } } diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak index be0420d9519..482379f464b 100644 --- a/tests/fate/aac.mak +++ b/tests/fate/aac.mak @@ -90,8 +90,9 @@ FATE_AAC += fate-aac-er_eld2100np_48_ep0 fate-aac-er_eld2100np_48_ep0: CMD = pcm -i $(TARGET_SAMPLES)/aac/er_eld2100np_48_ep0.mp4 fate-aac-er_eld2100np_48_ep0: REF = $(SAMPLES)/aac/er_eld2100np_48.s16 -# USAC (xHE-AAC); the samples and references are from the ISO/IEC 23003-3 -# conformance suite, except for xhe_target_level, which was encoded by exhale +# USAC (xHE-AAC). The samples and references are from the ISO/IEC 23003-3 +# conformance suite, except for the exhale target-level stream and its +# libxaac reference. FATE_AAC_USAC += fate-aac-usac-fd_1_c1_0x03 fate-aac-usac-fd_1_c1_0x03: CMD = pcm -i $(TARGET_SAMPLES)/aac/usac/Fd_1_c1_0x03.mp4 fate-aac-usac-fd_1_c1_0x03: REF = $(SAMPLES)/aac/usac/Fd_1_c1_0x03.s16 @@ -125,9 +126,8 @@ fate-aac-usac-ln-31: CMD = pcm -target_level -31 -i $(TARGET_SAMPLES)/aac/usac/E fate-aac-usac-ln-31: REF = $(SAMPLES)/aac/usac/Ext_2_c1_Ln_0x03__Lou-31.s16 FATE_AAC_USAC += fate-aac-usac-target-level -fate-aac-usac-target-level: CMD = pcm -target_level -24 -i $(TARGET_SAMPLES)/aac/usac/xhe_target_level.m4a -fate-aac-usac-target-level: REF = $(SAMPLES)/aac/usac/xhe_target_level.s16 -fate-aac-usac-target-level: SIZE_TOLERANCE = 512 +fate-aac-usac-target-level: CMD = pcm -target_level -24 -i $(TARGET_SAMPLES)/aac/usac/xhe_target_level_no_preroll.m4a +fate-aac-usac-target-level: REF = $(SAMPLES)/aac/usac/xhe_target_level_no_preroll.s16 FATE_AAC += $(FATE_AAC_USAC) -- 2.54.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
