From e0638cee0aa1bdd94af0e0898f24afa5e5b54e14 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Mon, 17 Mar 2025 21:01:16 +0000 Subject: [PATCH] avcodec/adpcm: improve decooding output for 4-bit ADPCM IMA WAV (cherry picked from commit f11422f1a6251e2b3c42b4044efbc722b863778d) --- libavcodec/adpcm.c | 4 ++-- tests/ref/acodec/adpcm-ima_wav | 4 ++-- tests/ref/acodec/adpcm-ima_wav-trellis | 4 ++-- tests/ref/fate/adpcm-ima_wav-stereo | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 3c6b3601f2..72fbb841a4 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -1551,8 +1551,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame, samples = &samples_p[i][1 + n * 8]; for (int m = 0; m < 8; m += 2) { int v = bytestream2_get_byteu(&gb); - samples[m ] = adpcm_ima_expand_nibble(cs, v & 0x0F, 3); - samples[m + 1] = adpcm_ima_expand_nibble(cs, v >> 4 , 3); + samples[m ] = ff_adpcm_ima_qt_expand_nibble(cs, v & 0x0F); + samples[m + 1] = ff_adpcm_ima_qt_expand_nibble(cs, v >> 4); } } } diff --git a/tests/ref/acodec/adpcm-ima_wav b/tests/ref/acodec/adpcm-ima_wav index 44ca53a565..b2cc518b1e 100644 --- a/tests/ref/acodec/adpcm-ima_wav +++ b/tests/ref/acodec/adpcm-ima_wav @@ -1,4 +1,4 @@ af0b82a719762cc6e1a952a6081231cf *tests/data/fate/acodec-adpcm-ima_wav.wav 267324 tests/data/fate/acodec-adpcm-ima_wav.wav -78a2af1c895792d0c221d127bdd48ece *tests/data/fate/acodec-adpcm-ima_wav.out.wav -stddev: 903.51 PSNR: 37.21 MAXDIFF:34026 bytes: 1058400/ 1061748 +a57d7b0ca564b5fed4bf78fc9f91d8e2 *tests/data/fate/acodec-adpcm-ima_wav.out.wav +stddev: 903.56 PSNR: 37.21 MAXDIFF:34029 bytes: 1058400/ 1061748 diff --git a/tests/ref/acodec/adpcm-ima_wav-trellis b/tests/ref/acodec/adpcm-ima_wav-trellis index 29c28edddf..008d1e4b62 100644 --- a/tests/ref/acodec/adpcm-ima_wav-trellis +++ b/tests/ref/acodec/adpcm-ima_wav-trellis @@ -1,4 +1,4 @@ 6f0df0f3275f833c341d63b9054caebb *tests/data/fate/acodec-adpcm-ima_wav-trellis.wav 267324 tests/data/fate/acodec-adpcm-ima_wav-trellis.wav -26a9b280c14737b159c56e60181f1170 *tests/data/fate/acodec-adpcm-ima_wav-trellis.out.wav -stddev: 710.03 PSNR: 39.30 MAXDIFF:25944 bytes: 1058400/ 1061748 +1af83218cde84bd7cd2297c04ef97f79 *tests/data/fate/acodec-adpcm-ima_wav-trellis.out.wav +stddev: 710.09 PSNR: 39.30 MAXDIFF:25941 bytes: 1058400/ 1061748 diff --git a/tests/ref/fate/adpcm-ima_wav-stereo b/tests/ref/fate/adpcm-ima_wav-stereo index cb6a481999..2a36800951 100644 --- a/tests/ref/fate/adpcm-ima_wav-stereo +++ b/tests/ref/fate/adpcm-ima_wav-stereo @@ -1 +1 @@ -1ee96f1efc09251a732621049dc5b66e +b4697f4f64c12afb37acfebd5f7a756c