From: Aidan Richmond Date: Sun, 25 Apr 2021 20:00:02 +0000 (+0100) Subject: avcodec/adpcm: Fixes output from Westwood ADPCM. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=50442540d07aa7734c2df8459c711531c21d325e;p=ffmpeg avcodec/adpcm: Fixes output from Westwood ADPCM. Fixes bug #9198 Reviewed-by: Andreas Rheinhardt Signed-off-by: Aidan Richmond Signed-off-by: Zane van Iperen --- diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index b031e249817..87ec91d6e89 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -1400,16 +1400,16 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, for (n = nb_samples / 2; n > 0; n--) { int v = bytestream2_get_byteu(&gb); - *smp++ = adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3); *smp++ = adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3); + *smp++ = adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3); } } } else { for (n = nb_samples / 2; n > 0; n--) { for (channel = 0; channel < avctx->channels; channel++) { int v = bytestream2_get_byteu(&gb); - *samples++ = adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3); - samples[st] = adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3); + *samples++ = adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3); + samples[st] = adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3); } samples += avctx->channels; } diff --git a/tests/ref/fate/adpcm-ima-ws b/tests/ref/fate/adpcm-ima-ws index d1e6b615dcd..b382812d223 100644 --- a/tests/ref/fate/adpcm-ima-ws +++ b/tests/ref/fate/adpcm-ima-ws @@ -4,43 +4,43 @@ #sample_rate 0: 22050 #channel_layout 0: 4 #channel_layout_name 0: mono -0, 0, 0, 11024, 22048, 0x0665d7f4 -0, 11024, 11024, 1470, 2940, 0x0f3c64cb -0, 12494, 12494, 1470, 2940, 0xc90b9e78 -0, 13964, 13964, 1470, 2940, 0x146246a3 -0, 15434, 15434, 1470, 2940, 0xd22c714e -0, 16904, 16904, 1470, 2940, 0xd86b681e -0, 18374, 18374, 1470, 2940, 0x12ec8186 -0, 19844, 19844, 1470, 2940, 0x69aa85b6 -0, 21314, 21314, 1470, 2940, 0xb24d33b0 -0, 22784, 22784, 1470, 2940, 0x3f7b0f0d -0, 24254, 24254, 1470, 2940, 0x64f10f7e -0, 25724, 25724, 1470, 2940, 0xd6ea379a -0, 27194, 27194, 1470, 2940, 0x7c38e830 -0, 28664, 28664, 1470, 2940, 0xc28ff132 -0, 30134, 30134, 1470, 2940, 0xe7b11629 -0, 31604, 31604, 1470, 2940, 0xeb86fdcb -0, 33074, 33074, 1470, 2940, 0x5508f586 -0, 34544, 34544, 1470, 2940, 0xf4fa1f1b -0, 36014, 36014, 1470, 2940, 0x9e5ff976 -0, 37484, 37484, 1470, 2940, 0xcfc4e08f -0, 38954, 38954, 1470, 2940, 0x74bde7ed -0, 40424, 40424, 1470, 2940, 0x3e4ae245 -0, 41894, 41894, 1470, 2940, 0x4c6a8e56 -0, 43364, 43364, 1470, 2940, 0xa09d86ab -0, 44834, 44834, 1470, 2940, 0xc8531912 -0, 46304, 46304, 1470, 2940, 0xa5f266aa -0, 47774, 47774, 1470, 2940, 0x587a4187 -0, 49244, 49244, 1470, 2940, 0x14752d45 -0, 50714, 50714, 1470, 2940, 0x558cde10 -0, 52184, 52184, 1470, 2940, 0x735fee38 -0, 53654, 53654, 1470, 2940, 0xac8bb6c8 -0, 55124, 55124, 1470, 2940, 0xa503c73b -0, 56594, 56594, 1470, 2940, 0x7cd588a3 -0, 58064, 58064, 1470, 2940, 0xa6974b04 -0, 59534, 59534, 1470, 2940, 0xbf448241 -0, 61004, 61004, 1470, 2940, 0x2a5c2759 -0, 62474, 62474, 1470, 2940, 0xd0de5ce0 -0, 63944, 63944, 1470, 2940, 0xc0486649 -0, 65414, 65414, 1470, 2940, 0x48b040af -0, 66884, 66884, 1470, 2940, 0x82a338a9 +0, 0, 0, 11024, 22048, 0x0843bbad +0, 11024, 11024, 1470, 2940, 0x16ff454e +0, 12494, 12494, 1470, 2940, 0xffc43fc2 +0, 13964, 13964, 1470, 2940, 0x4bdbdcf4 +0, 15434, 15434, 1470, 2940, 0xad9fb7c2 +0, 16904, 16904, 1470, 2940, 0x7e09e2f3 +0, 18374, 18374, 1470, 2940, 0x3fd8194d +0, 19844, 19844, 1470, 2940, 0x3f84e41c +0, 21314, 21314, 1470, 2940, 0x4d49c1bc +0, 22784, 22784, 1470, 2940, 0x802fcec0 +0, 24254, 24254, 1470, 2940, 0x73bfca27 +0, 25724, 25724, 1470, 2940, 0x55510c6d +0, 27194, 27194, 1470, 2940, 0x417dca08 +0, 28664, 28664, 1470, 2940, 0x794acbd6 +0, 30134, 30134, 1470, 2940, 0x7de4a788 +0, 31604, 31604, 1470, 2940, 0xeea8a64a +0, 33074, 33074, 1470, 2940, 0x1e45f779 +0, 34544, 34544, 1470, 2940, 0x795eda85 +0, 36014, 36014, 1470, 2940, 0xfe12f067 +0, 37484, 37484, 1470, 2940, 0x5b3bee02 +0, 38954, 38954, 1470, 2940, 0x6870b61c +0, 40424, 40424, 1470, 2940, 0xfcd8d411 +0, 41894, 41894, 1470, 2940, 0x6433d298 +0, 43364, 43364, 1470, 2940, 0xb810c944 +0, 44834, 44834, 1470, 2940, 0xa0f2deab +0, 46304, 46304, 1470, 2940, 0x1c06b258 +0, 47774, 47774, 1470, 2940, 0x0664b374 +0, 49244, 49244, 1470, 2940, 0xaafad6c2 +0, 50714, 50714, 1470, 2940, 0x7348e80a +0, 52184, 52184, 1470, 2940, 0xc3d3d384 +0, 53654, 53654, 1470, 2940, 0x58ecd933 +0, 55124, 55124, 1470, 2940, 0xe93efa02 +0, 56594, 56594, 1470, 2940, 0x71fada5c +0, 58064, 58064, 1470, 2940, 0x7ea7a8dd +0, 59534, 59534, 1470, 2940, 0x0e73c977 +0, 61004, 61004, 1470, 2940, 0x2c09c91b +0, 62474, 62474, 1470, 2940, 0xade3bc63 +0, 63944, 63944, 1470, 2940, 0x10049fba +0, 65414, 65414, 1470, 2940, 0xf873b7de +0, 66884, 66884, 1470, 2940, 0x223dcc39