indeo4: fix picture header parsing
authorKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 6 Oct 2022 16:10:10 +0000 (18:10 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 6 Oct 2022 16:10:10 +0000 (18:10 +0200)
nihav-indeo/src/codecs/indeo4.rs

index c20732a92e05fc0a76c4c7c054a1bc738f87b4e7..526668bbc4c4fad37e226f125d097817f86de755 100644 (file)
@@ -76,13 +76,9 @@ impl IndeoXParser for Indeo4Parser {
         let slice_h;
         if br.read_bool()? {
             let idx = br.read(4)? as usize;
-            if idx < 15 {
-                slice_w = INDEO4_SLICE_SIZE_TAB[idx];
-                slice_h = INDEO4_SLICE_SIZE_TAB[idx];
-            } else {
-                slice_w = width;
-                slice_h = height;
-            }
+            slice_h = if idx < 15 { INDEO4_SLICE_SIZE_TAB[idx] } else { height };
+            let idx = br.read(4)? as usize;
+            slice_w = if idx < 15 { INDEO4_SLICE_SIZE_TAB[idx] } else { width };
         } else {
             slice_w = width;
             slice_h = height;