LucasArts SMUSH formats support
[nihav.git] / nihav-game / src / codecs / vx.rs
index 977e4e188c83dc39b8aef0eb823f4d7ef5124c36..c13fc493cbd6f8924b2b69b5ada74364527608b3 100644 (file)
@@ -1119,8 +1119,7 @@ impl AudioState {
 }
 
 fn apply_lpc(dst: &mut [i32], src: &[i32], hist: &mut [i32], filt: &[i32; 8]) {
-    let mut hidx = 0;
-    for (out, src) in dst.iter_mut().zip(src.iter()) {
+    for (hidx, (out, src)) in dst.iter_mut().zip(src.iter()).enumerate() {
         let mut sum = *src << 14;
         for i in 0..8 {
             sum += hist[(hidx + i) & 7] * filt[i];
@@ -1128,7 +1127,6 @@ fn apply_lpc(dst: &mut [i32], src: &[i32], hist: &mut [i32], filt: &[i32; 8]) {
         let samp = sum >> 14;
         *out = samp;
         hist[hidx & 7] = samp;
-        hidx += 1;
     }
 }
 
@@ -1333,6 +1331,7 @@ mod test {
         let mut dec_reg = RegisteredDecoders::new();
         game_register_all_decoders(&mut dec_reg);
 
+        // sample from some game
         test_decoding("vx", "vxvideo", "assets/Game/bioware.vx", Some(31), &dmx_reg, &dec_reg,
                       ExpectedTestResult::MD5Frames(vec![
                                 [0x33de14fa, 0x00948eb7, 0x028141d7, 0x1d07abd6],