ms-adpcm: fix decoding
authorKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 21 Dec 2023 15:12:57 +0000 (16:12 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 21 Dec 2023 15:12:57 +0000 (16:12 +0100)
nihav-ms/src/codecs/msadpcm.rs

index 23769de9e30d6126a37c80b207f93433ebdeab7a..f95a691f0d8d25a1f401e878860420b264a5c5e8 100644 (file)
@@ -124,11 +124,11 @@ impl NADecoder for MSADPCMDecoder {
                 }
                 for ch in 0..channels {
                     let samp                    = br.read_u16le()? as i16;
-                    pred[ch].sample2            = i32::from(samp);
+                    pred[ch].sample1            = i32::from(samp);
                 }
                 for ch in 0..channels {
                     let samp                    = br.read_u16le()? as i16;
-                    pred[ch].sample1            = i32::from(samp);
+                    pred[ch].sample2            = i32::from(samp);
                 }
                 for ch in 0..channels {
                     dst[off[ch]]     = pred[ch].sample2 as i16;
@@ -433,7 +433,7 @@ mod test {
         ms_register_all_decoders(&mut dec_reg);
 
         test_decoding("avi", "ms-adpcm", "assets/MS/dance.avi", None, &dmx_reg, &dec_reg,
-                      ExpectedTestResult::MD5([0xf5e3fc84, 0xbcabc11c, 0x33c6874e, 0xe05ecd14]));
+                      ExpectedTestResult::MD5([0xb1d6f12c, 0x86d2821b, 0x395f6827, 0xb6be93bf]));
     }
     #[cfg(feature="encoder_ms_adpcm")]
     #[test]