]> git.nihav.org Git - nihav.git/blobdiff - nihav-indeo/src/codecs/ivibr.rs
indeo: fix tile end calculation
[nihav.git] / nihav-indeo / src / codecs / ivibr.rs
index a333b3a7dba9f67bb8a7e7286798d57ff9d0fc37..72a9480ec6c81de6281f33ca01948f5fc67e64ac 100644 (file)
@@ -601,7 +601,7 @@ impl IVIDecoder {
                 }
                 br.align();
                 validate!(len > 0);
-                let tile_end = tile_start + len * 8;
+                let tile_end = (tile_start & !7) + len * 8;
                 validate!(tile_end > br.tell());
                 validate!(tile_end <= br.tell() + (br.left() as usize));
                 {
@@ -628,6 +628,7 @@ impl IVIDecoder {
                 }
 
                 self.decode_tile(br, &band, tile_no, tr, tr_dc)?;
+                br.align();
 let skip_part = tile_end - br.tell();
 br.skip(skip_part as u32)?;
             } else {
@@ -819,7 +820,6 @@ br.skip(skip_part as u32)?;
             }
             dstidx += stride * band.mb_size;
         }
-        br.align();
         Ok(())
     }