This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 1d375326a1dc081cfaa0574b66e83034499cb9d9
Author:     Baptiste Coudurier <[email protected]>
AuthorDate: Wed Nov 18 13:01:42 2026 -0800
Commit:     Baptiste Coudurier <[email protected]>
CommitDate: Mon Nov 30 04:13:00 2026 +0000

    avcodec: set frame_size in QDM2, QDMC, QCELP and AMR decoders
    
    Export the number of decoded samples per channel so MOV can apply
    end trimming. The QDM2 FATE sample now decodes to 565215 frames.
    Reject nonpositive QDM2 frame sizes before exporting the sample count.
    
    Signed-off-by: Baptiste Coudurier <[email protected]>
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Assisted-by: Fairy
---
 libavcodec/amrnbdec.c         | 1 +
 libavcodec/amrwbdec.c         | 1 +
 libavcodec/qcelpdec.c         | 1 +
 libavcodec/qdm2.c             | 3 ++-
 libavcodec/qdmc.c             | 1 +
 tests/fate/mov.mak            | 2 +-
 tests/fate/qt.mak             | 2 +-
 tests/ref/fate/mov-qdmc-remux | 2 +-
 8 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c
index dc5a1dd842..213f9e1639 100644
--- a/libavcodec/amrnbdec.c
+++ b/libavcodec/amrnbdec.c
@@ -270,6 +270,7 @@ static av_cold int amrnb_decode_init(AVCodecContext *avctx)
     if (!avctx->sample_rate)
         avctx->sample_rate = 8000;
     avctx->sample_fmt     = AV_SAMPLE_FMT_FLTP;
+    avctx->frame_size     = AMR_BLOCK_SIZE;
 
     for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
         AMRContext *p = &s->ch[ch];
diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c
index f4daee37df..093e3b53f0 100644
--- a/libavcodec/amrwbdec.c
+++ b/libavcodec/amrwbdec.c
@@ -171,6 +171,7 @@ static av_cold int amrwb_decode_init(AVCodecContext *avctx)
     if (!avctx->sample_rate)
         avctx->sample_rate = 16000;
     avctx->sample_fmt     = AV_SAMPLE_FMT_FLTP;
+    avctx->frame_size     = 4 * AMRWB_SFR_SIZE_16k;
 
     for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
         AMRWBContext *ctx = &s->ch[ch];
diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c
index 4ec25a8f0f..d7e4910973 100644
--- a/libavcodec/qcelpdec.c
+++ b/libavcodec/qcelpdec.c
@@ -89,6 +89,7 @@ static av_cold int qcelp_decode_init(AVCodecContext *avctx)
     av_channel_layout_uninit(&avctx->ch_layout);
     avctx->ch_layout      = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
     avctx->sample_fmt     = AV_SAMPLE_FMT_FLT;
+    avctx->frame_size     = 160;
     if (!avctx->sample_rate)
         avctx->sample_rate = 8000;
 
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 796321f9d8..846a2e4ea5 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -1787,8 +1787,9 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
     s->group_order = av_log2(s->group_size) + 1;
     s->frame_size = s->group_size / 16; // 16 iterations per super block
 
-    if (s->frame_size > QDM2_MAX_FRAME_SIZE)
+    if (s->frame_size <= 0 || s->frame_size > QDM2_MAX_FRAME_SIZE)
         return AVERROR_INVALIDDATA;
+    avctx->frame_size = 16 * s->frame_size;
 
     s->sub_sampling = s->fft_order - 7;
     s->frequency_range = 255 / (1 << (2 - s->sub_sampling));
diff --git a/libavcodec/qdmc.c b/libavcodec/qdmc.c
index 474e5ef8fa..ebd70aecab 100644
--- a/libavcodec/qdmc.c
+++ b/libavcodec/qdmc.c
@@ -280,6 +280,7 @@ static av_cold int qdmc_decode_init(AVCodecContext *avctx)
         s->frame_bits = 11;
     }
     s->frame_size = 1 << s->frame_bits;
+    avctx->frame_size = s->frame_size;
     s->subframe_size = s->frame_size >> 5;
 
     if (avctx->ch_layout.nb_channels == 2)
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index e5f039f45e..3e65bf6ab0 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -424,7 +424,7 @@ fate-mov-aac-head-skip-duration: CMD = transcode mov 
$(TARGET_SAMPLES)/audiomatc
     "-c copy" "-show_entries packet=pts,duration:stream=duration_ts -of 
compact" "" "" "-ignore_editlist 1"
 
 # QDMC configuration must be written back in a wave atom
-FATE_MOV_FFMPEG_SAMPLES-$(call REMUX, MOV) += fate-mov-qdmc-remux
+FATE_MOV_FFMPEG_SAMPLES-$(call REMUX, MOV, QDMC_DECODER) += fate-mov-qdmc-remux
 fate-mov-qdmc-remux: CMD = transcode mov $(TARGET_SAMPLES)/qdmc/rumcoke.mov 
mov "-c copy -t 0.4" "-c copy"
 
 # Reserved colour values must not be written to colr
diff --git a/tests/fate/qt.mak b/tests/fate/qt.mak
index 436da172f1..d9874b26ce 100644
--- a/tests/fate/qt.mak
+++ b/tests/fate/qt.mak
@@ -4,7 +4,7 @@ fate-8bps: CMD = framecrc -i 
$(TARGET_SAMPLES)/8bps/full9iron-partial.mov -pix_f
 FATE_QT-$(call ENCDEC, PCM_S16LE QDM2, PCM_S16LE MOV, PIPE_PROTOCOL) += 
fate-qdm2
 fate-qdm2: CMD = pcm -i $(TARGET_SAMPLES)/qt-surge-suite/surge-2-16-B-QDM2.mov
 fate-qdm2: CMP = oneoff
-fate-qdm2: REF = $(SAMPLES)/qt-surge-suite/surge-2-16-B-QDM2.pcm
+fate-qdm2: REF = $(SAMPLES)/qt-surge-suite/surge-2-16-B-QDM2-trimmed.pcm
 fate-qdm2: FUZZ = 2
 
 FATE_QT-$(call ENCDEC, PCM_S16LE PCM_ALAW, MOV PCM_S16LE) += fate-qt-alaw-mono
diff --git a/tests/ref/fate/mov-qdmc-remux b/tests/ref/fate/mov-qdmc-remux
index 25246616f1..544219f0ab 100644
--- a/tests/ref/fate/mov-qdmc-remux
+++ b/tests/ref/fate/mov-qdmc-remux
@@ -1,4 +1,4 @@
-b3c337efc274d4585bc0444bad40c3b0 *tests/data/fate/mov-qdmc-remux.mov
+5754c0c6268e4e4f3dbd46a0e988dd7d *tests/data/fate/mov-qdmc-remux.mov
 2398 tests/data/fate/mov-qdmc-remux.mov
 #extradata 0:       64, 0x269b07fa
 #tb 0: 1/44100

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to