X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-indeo%2Fsrc%2Fcodecs%2Fivibr.rs;h=5831f801693d23181716b4ecc4e00c7f305432e5;hb=385258b6e72414869796e56b38f1d11776ef150c;hp=a333b3a7dba9f67bb8a7e7286798d57ff9d0fc37;hpb=1443a08c53fb825cc0df5be7cc674d1c52c2a576;p=nihav.git diff --git a/nihav-indeo/src/codecs/ivibr.rs b/nihav-indeo/src/codecs/ivibr.rs index a333b3a..5831f80 100644 --- a/nihav-indeo/src/codecs/ivibr.rs +++ b/nihav-indeo/src/codecs/ivibr.rs @@ -488,10 +488,12 @@ pub struct IVIDecoder { tiles: Vec, num_tiles: [[usize; 4]; 4], tile_start: [[usize; 4]; 4], + + scalable: bool, } impl IVIDecoder { - pub fn new() -> Self { + pub fn new(scalable: bool) -> Self { let mut bands: Vec = Vec::with_capacity(12); bands.resize(12, BandHeader::new_empty(42, 42)); IVIDecoder { @@ -506,6 +508,8 @@ impl IVIDecoder { bands, band_tiles: 0, tiles: Vec::new(), tile_start: [[0; 4]; 4], num_tiles: [[0; 4]; 4], + + scalable, } } @@ -601,7 +605,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 +632,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 +824,6 @@ br.skip(skip_part as u32)?; } dstidx += stride * band.mb_size; } - br.align(); Ok(()) } @@ -943,6 +947,11 @@ br.skip(skip_part as u32)?; self.ftype = IVIFrameType::Intra; } } + if self.bref.is_some() && self.ftype == IVIFrameType::Inter { + let mut bref: Option = Some(res.unwrap()); + mem::swap(&mut bref, &mut self.bref); + return Ok(bref.unwrap()); + } if let Ok(NABufferType::None) = res { if self.bref.is_some() { let mut bref: Option = None;