PR #24855 opened by AYOUB NABIL BOUBAGRAT (ayoubnabil)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24855
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24855.patch

this carries the downmix fix from #23512

downmixed was set before the delay buffers had actually been downmixed.
removing that initialization fixes #11578.

the regression check fails before the patch and passes after it with both float 
and fixed decoders. 
all 21 enabled ac-3/e-ac-3 decoding tests pass on x86-64 and x86-32/x87.

the attached pcm references were regenerated with a 32-bit build and asm 
disabled. 
they use v4 names because v3 names already exist with different contents.

target paths:
ac3/monsters_inc_2.0_192_small_v4.pcm
ac3/millers_crossing_4.0_v4.pcm



>From 69f871976be842da6ff83b30d4d6684d3178d974 Mon Sep 17 00:00:00 2001
From: Paul B Mahol <[email protected]>
Date: Sat, 3 Oct 2026 00:59:18 +0200
Subject: [PATCH] avcodec/ac3dec: fix initial downmix state

the delay buffers have not been downmixed at decoder initialization.
leave downmixed clear until block decoding actually downmixes them.
this avoids corrupting the first block with mixed transform lengths
and fixes #11578.

update the affected ac-3 pcm references.

Signed-off-by: Ayoub Nabil Boubagrat 
<[email protected]>
---
 libavcodec/ac3dec.c | 1 -
 tests/fate/ac3.mak  | 6 +++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 79a8751154..33fc3457ad 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -137,7 +137,6 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
         avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
 
     ac3_downmix(avctx);
-    s->downmixed = 1;
 
     for (i = 0; i < AC3_MAX_CHANNELS; i++) {
         s->xcfptr[i] = s->transform_coeffs[i];
diff --git a/tests/fate/ac3.mak b/tests/fate/ac3.mak
index 605a411799..7a7cd61463 100644
--- a/tests/fate/ac3.mak
+++ b/tests/fate/ac3.mak
@@ -1,10 +1,10 @@
 FATE_AC3 += fate-ac3-2.0
 fate-ac3-2.0: CMD = pcm -i $(TARGET_SAMPLES)/ac3/monsters_inc_2.0_192_small.ac3
-fate-ac3-2.0: REF = $(SAMPLES)/ac3/monsters_inc_2.0_192_small_v2.pcm
+fate-ac3-2.0: REF = $(SAMPLES)/ac3/monsters_inc_2.0_192_small_v4.pcm
 
 FATE_AC3 += fate-ac3-4.0
 fate-ac3-4.0: CMD = pcm -i $(TARGET_SAMPLES)/ac3/millers_crossing_4.0.ac3
-fate-ac3-4.0: REF = $(SAMPLES)/ac3/millers_crossing_4.0_v2.pcm
+fate-ac3-4.0: REF = $(SAMPLES)/ac3/millers_crossing_4.0_v4.pcm
 
 #downmix 4.0 -> front channel
 FATE_AC3 += fate-ac3-4.0-downmix-mono
@@ -29,7 +29,7 @@ fate-ac3-5.1-downmix-stereo: REF = 
$(SAMPLES)/ac3/monsters_inc_5.1_448_small_ste
 
 FATE_AC3 += fate-ac3-fixed-2.0
 fate-ac3-fixed-2.0: CMD = pcm -c ac3_fixed -i 
$(TARGET_SAMPLES)/ac3/monsters_inc_2.0_192_small.ac3
-fate-ac3-fixed-2.0: REF = $(SAMPLES)/ac3/monsters_inc_2.0_192_small_v2.pcm
+fate-ac3-fixed-2.0: REF = $(SAMPLES)/ac3/monsters_inc_2.0_192_small_v4.pcm
 
 FATE_AC3 += fate-ac3-fixed-4.0-downmix-mono
 fate-ac3-fixed-4.0-downmix-mono: CMD = pcm -c ac3_fixed -downmix mono -i 
$(TARGET_SAMPLES)/ac3/millers_crossing_4.0.ac3
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to