From 771e522a17b7724a698191ba6f6fe59054161125 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 15 Apr 2020 15:33:50 +0200 Subject: [PATCH] vmd: fix RLE decoding --- nihav-game/src/codecs/vmd.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nihav-game/src/codecs/vmd.rs b/nihav-game/src/codecs/vmd.rs index b81b4f5..520b57c 100644 --- a/nihav-game/src/codecs/vmd.rs +++ b/nihav-game/src/codecs/vmd.rs @@ -85,9 +85,11 @@ fn rle_unpack(br: &mut ByteReader, len: usize, dst: &mut [u8]) -> DecoderResult< let dst = &mut dst[dpos..][..len]; br.read_buf(dst)?; } else { - let val = br.read_byte()?; - for i in 0..len { - dst[dpos + i] = val; + let val1 = br.read_byte()?; + let val2 = br.read_byte()?; + for i in (0..len).step_by(2) { + dst[dpos + i] = val1; + dst[dpos + i + 1] = val2; } } dpos += len; -- 2.39.5