From 3a21c9f12121f3e8bcaa704422750a8f45c7e50e Mon Sep 17 00:00:00 2001
From: tangsha <[email protected]>
Date: Thu, 28 Aug 2025 17:45:19 +0800
Subject: [PATCH] avcodec/adpcm: Fix the decoding error caused by incorrect
 retrieval of step_index in ADPCM module

---
 libavcodec/adpcm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 4c15be6207..d01d6cd8e4 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1345,7 +1345,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,

Those line offsets are not from the master branch. Are you writing this targeting a release branch?

             ADPCMChannelStatus *cs = &c->status[i];
             cs->predictor = samples_p[i][0] = 
sign_extend(bytestream2_get_le16u(&gb), 16);
- cs->step_index = sign_extend(bytestream2_get_le16u(&gb), 16);
+            cs->step_index = bytestream2_get_byteu(&gb);
+            bytestream2_skip(&gb, sizeof(uint8_t));

What's in this byte if not a part of step_index? Also, do you have a sample that gets fixed by this change?

             if (cs->step_index > 88u){
                 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
                        i, cs->step_index);
--
2.25.1

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

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

Reply via email to