X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-realmedia%2Fsrc%2Fcodecs%2Frv60.rs;h=4e4ee6814062ed8df97a3ef0d629dd0320a57e90;hb=2eefcf7983adde9c24942ae6fe9a2ed2164bbca3;hp=ca04fb1f958373575b96711b556f5d92f6f8cd18;hpb=a15d97ad1e674adeebbc73f36aed9cf826d4af31;p=nihav.git diff --git a/nihav-realmedia/src/codecs/rv60.rs b/nihav-realmedia/src/codecs/rv60.rs index ca04fb1..4e4ee68 100644 --- a/nihav-realmedia/src/codecs/rv60.rs +++ b/nihav-realmedia/src/codecs/rv60.rs @@ -49,7 +49,9 @@ struct FrameHeader { osvquant: u8, ts: u32, width: usize, + awidth: usize, height: usize, + aheight: usize, two_f_refs: bool, qp_off_type: u8, deblock: bool, @@ -78,6 +80,8 @@ impl FrameHeader { let width = ((br.read(11)? as usize) + 1) * 4; let height = ((br.read(11)? as usize) + 0) * 4; validate!(height > 0); + let awidth = (width + 15) & !15; + let aheight = (height + 15) & !15; let _some_flag = br.read_bool()?; let two_f_refs; if ftype == FrameType::I { @@ -110,8 +114,8 @@ impl FrameHeader { } Ok(FrameHeader { - profile, ftype, qp, osvquant, ts, width, height, two_f_refs, qp_off_type, - deblock, deblock_chroma, + profile, ftype, qp, osvquant, ts, width, height, awidth, aheight, + two_f_refs, qp_off_type, deblock, deblock_chroma, }) } fn parse_slice_sizes(&self, br: &mut BitReader, sizes: &mut Vec) -> DecoderResult<()> { @@ -716,10 +720,10 @@ println!(" left {} bits", br.left()); } #[allow(clippy::cognitive_complexity)] fn decode_cb_tree(&mut self, buf: &mut NASimpleVideoFrame, hdr: &FrameHeader, br: &mut BitReader, xpos: usize, ypos: usize, log_size: u8) -> DecoderResult<()> { - if (xpos >= hdr.width) || (ypos >= hdr.height) { return Ok(()); } + if (xpos >= hdr.awidth) || (ypos >= hdr.aheight) { return Ok(()); } let size = 1 << log_size; - let split = (xpos + size > hdr.width) || (ypos + size > hdr.height) || (size > 8 && br.read_bool()?); + let split = (xpos + size > hdr.awidth) || (ypos + size > hdr.aheight) || (size > 8 && br.read_bool()?); self.cu_splits.push(split); if split { let hsize = size >> 1; @@ -1486,7 +1490,7 @@ println!("???"); self.blk_info.clear(); self.blk_info.resize(self.blk_stride * (cu_h << 4), BlockInfo::default()); if hdr.deblock { - self.dblk.reinit(hdr.width, hdr.height); + self.dblk.reinit(hdr.awidth, hdr.aheight); } let mut off = hsize + ((br.tell() >> 3) as usize); let mut dframe = NASimpleVideoFrame::from_video_buf(&mut buf).unwrap(); @@ -1586,10 +1590,10 @@ mod test { [0x7fd46b65, 0x9e56b770, 0xffa13e3b, 0x73d47eb6], [0xa3ec74e1, 0xc33617ab, 0xb49c744b, 0x7d1c8127], [0x830d85c2, 0x1df398c3, 0x40f33a4f, 0x445d95b3], - [0xa5471116, 0x9299e39f, 0x98da1680, 0x1aabeed5], - [0xd89ef645, 0x66c684fe, 0x6d5e4207, 0x5e480550], - [0xdf434d0c, 0xf0018799, 0x935aa650, 0xcfc702fc], - [0x9770cae6, 0x8a7caa6a, 0x87b6438d, 0x7b161519], - [0x9a2dfade, 0x3ff56dbe, 0x5fbc6999, 0x827770e9]])); + [0x78285852, 0x99938567, 0xcfd029ce, 0xc81aed7c], + [0xa9af569f, 0xe6af1b84, 0x68aebddd, 0x20369b2d], + [0xba0eade4, 0x00c059fd, 0x4111a989, 0x8818ae46], + [0x7c14962d, 0x78b91893, 0x829e528b, 0xc0c7ddb0], + [0xccbc4bfa, 0x1dc6c04c, 0xc70eba90, 0x59a10dbd]])); } }