From: Kostya Shishkov Date: Thu, 3 Nov 2022 17:27:58 +0000 (+0100) Subject: rv6: fix special case for chroma motion compensation X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=2eefcf7983adde9c24942ae6fe9a2ed2164bbca3;p=nihav.git rv6: fix special case for chroma motion compensation Reported by Peter Ross --- diff --git a/nihav-realmedia/src/codecs/rv60.rs b/nihav-realmedia/src/codecs/rv60.rs index 9690f6c..4e4ee68 100644 --- a/nihav-realmedia/src/codecs/rv60.rs +++ b/nihav-realmedia/src/codecs/rv60.rs @@ -1590,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]])); } } diff --git a/nihav-realmedia/src/codecs/rv60dsp.rs b/nihav-realmedia/src/codecs/rv60dsp.rs index 829d325..be88a3e 100644 --- a/nihav-realmedia/src/codecs/rv60dsp.rs +++ b/nihav-realmedia/src/codecs/rv60dsp.rs @@ -110,10 +110,12 @@ fn chroma_mc(dst: &mut [u8], mut didx: usize, dstride: usize, src: &[u8], mut si return; } if (x > 0) && (y > 0) { - let a = ((4 - x) * (4 - y)) as u16; - let b = (( x) * (4 - y)) as u16; - let c = ((4 - x) * ( y)) as u16; - let d = (( x) * ( y)) as u16; + // 3,3 case is the same as 3,2 for some reason + let ymod = if (x == 3) && (y == 3) { 2 } else { y }; + let a = ((4 - x) * (4 - ymod)) as u16; + let b = (( x) * (4 - ymod)) as u16; + let c = ((4 - x) * ( ymod)) as u16; + let d = (( x) * ( ymod)) as u16; for _ in 0..h { for x in 0..w { dst[didx + x] = ((a * (src[sidx + x] as u16)