diff options
Diffstat (limited to 'test2/src/main.rs')
-rw-r--r-- | test2/src/main.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/test2/src/main.rs b/test2/src/main.rs index 0b69026..aca978e 100644 --- a/test2/src/main.rs +++ b/test2/src/main.rs @@ -43,6 +43,7 @@ impl Frame { buf.extend(&self.data[y_off as usize..(y_off + BLOCK_SIZE) as usize]); } } + #[allow(unused)] fn import_block(&mut self, off: IVec2, buf: &[u8]) -> usize { let mut p = 0; // Luma @@ -68,8 +69,7 @@ impl Frame { let y_off = off.x + (y + off.y) * self.res.x; let i = y * BLOCK_SIZE; for x in 0..BLOCK_SIZE { - self.data[(y_off + x) as usize] = self.data[(y_off + x) as usize] - .saturating_add_signed(buf[(i + x) as usize] as i8 - 127); + self.data[(y_off + x) as usize] += buf[(i + x) as usize] as u8; } } // Chroma @@ -78,8 +78,7 @@ impl Frame { let y_off = uvplane_off + (off.x & !1) + (y + off.y / 2) * self.res.x; let i = BLOCK_SIZE * BLOCK_SIZE + y * BLOCK_SIZE; for x in 0..BLOCK_SIZE { - self.data[(y_off + x) as usize] = self.data[(y_off + x) as usize] - .saturating_add_signed(buf[(i + x) as usize] as i8 - 127); + self.data[(y_off + x) as usize] += buf[(i + x) as usize] as u8; } } (BLOCK_SIZE * BLOCK_SIZE + BLOCK_SIZE * BLOCK_SIZE / 2) as usize |