The branch, master has been updated
       via  0828a3b6366042a2d65188c89a1f5bf0ae52ec75 (commit)
      from  e3f01682d77679397593656b741d98503ceb6d4b (commit)


- Log -----------------------------------------------------------------
commit 0828a3b6366042a2d65188c89a1f5bf0ae52ec75
Author:     Daniil Cherednik <[email protected]>
AuthorDate: Wed Aug 20 21:29:42 2025 +0200
Commit:     michaelni <[email protected]>
CommitDate: Fri Aug 29 12:29:52 2025 +0000

    avcodec/atrac3: fix inconsistent band num calculation
    
    'decode_spectrum' reads 5 bits from bitstream to get
    number of encoded subbands – so 31 means all 32
    subbands are encoded. This value also is used to
    determinate the number of used band in the hybrid
    filterbank.
    
    'subband_tab' array contains 33 values of MDCT spec
    line positions started from 0 line and used to map
    subband number in to the range of mdct lines.
    
    Since the subband_num returned by decode_spectrum
    actually is number – 1 and subband_tab started from 0
    we need to add 1 to make num_bands calculation correct.

diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
index fe156fa482..d91bdc79ac 100644
--- a/libavcodec/atrac3.c
+++ b/libavcodec/atrac3.c
@@ -616,7 +616,7 @@ static int decode_channel_sound_unit(ATRAC3Context *q, 
GetBitContext *gb,
 
     /* calculate number of used MLT/QMF bands according to the amount of coded
        spectral lines */
-    num_bands = (subband_tab[num_subbands] - 1) >> 8;
+    num_bands = (subband_tab[num_subbands + 1] - 1) >> 8;
     if (last_tonal >= 0)
         num_bands = FFMAX((last_tonal + 256) >> 8, num_bands);
 
diff --git a/tests/fate/atrac.mak b/tests/fate/atrac.mak
index 098063e298..847eed5b61 100644
--- a/tests/fate/atrac.mak
+++ b/tests/fate/atrac.mak
@@ -11,11 +11,11 @@ FATE_ATRAC1-$(call PCM, AEA, ATRAC1, ARESAMPLE_FILTER) += 
$(FATE_ATRAC1)
 
 FATE_ATRAC3 += fate-atrac3-1
 fate-atrac3-1: CMD = pcm -i $(TARGET_SAMPLES)/atrac3/mc_sich_at3_066_small.wav
-fate-atrac3-1: REF = $(SAMPLES)/atrac3/mc_sich_at3_066_small.pcm
+fate-atrac3-1: REF = $(SAMPLES)/atrac3/mc_sich_at3_066_small_with_band_fix.pcm
 
 FATE_ATRAC3 += fate-atrac3-2
 fate-atrac3-2: CMD = pcm -i $(TARGET_SAMPLES)/atrac3/mc_sich_at3_105_small.wav
-fate-atrac3-2: REF = $(SAMPLES)/atrac3/mc_sich_at3_105_small.pcm
+fate-atrac3-2: REF = $(SAMPLES)/atrac3/mc_sich_at3_105_small_with_band_fix.pcm
 
 FATE_ATRAC3 += fate-atrac3-3
 fate-atrac3-3: CMD = pcm -i $(TARGET_SAMPLES)/atrac3/mc_sich_at3_132_small.wav

-----------------------------------------------------------------------

Summary of changes:
 libavcodec/atrac3.c  | 2 +-
 tests/fate/atrac.mak | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)


hooks/post-receive
-- 

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

Reply via email to