diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2020-04-15 15:33:50 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2020-04-15 15:33:50 +0200 |
commit | 771e522a17b7724a698191ba6f6fe59054161125 (patch) | |
tree | 04d021bc6434fdadd913bbf440a08b7c4040f58e | |
parent | ed6c9f8a7b4c723b02361bf75fdccdc40eb427cc (diff) | |
download | nihav-771e522a17b7724a698191ba6f6fe59054161125.tar.gz |
vmd: fix RLE decoding
-rw-r--r-- | nihav-game/src/codecs/vmd.rs | 8 |
1 files 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; |