diff options
author | metamuffin <metamuffin@disroot.org> | 2022-12-17 18:01:51 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-12-17 18:01:51 +0100 |
commit | 0a346b8372140b56bf65a6df1c00e2cd6c6cdf86 (patch) | |
tree | e52234d5904939323e19586128d8ac2d345e450e /evc/src/helpers/pixel.rs | |
parent | 82eedf3594bf21c8b780580050a95f0bdb5fd667 (diff) | |
download | video-codec-experiments-0a346b8372140b56bf65a6df1c00e2cd6c6cdf86.tar video-codec-experiments-0a346b8372140b56bf65a6df1c00e2cd6c6cdf86.tar.bz2 video-codec-experiments-0a346b8372140b56bf65a6df1c00e2cd6c6cdf86.tar.zst |
small optimizations and info binary
Diffstat (limited to 'evc/src/helpers/pixel.rs')
-rw-r--r-- | evc/src/helpers/pixel.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/evc/src/helpers/pixel.rs b/evc/src/helpers/pixel.rs index 816d7dc..39fe98c 100644 --- a/evc/src/helpers/pixel.rs +++ b/evc/src/helpers/pixel.rs @@ -1,6 +1,6 @@ use crate::format::ser::{Ser, Sink, Source}; -#[derive(Copy, Clone, Debug, Default)] +#[derive(Copy, Clone, Debug, Default, PartialEq)] pub struct Pixel { pub r: u8, pub g: u8, @@ -24,11 +24,12 @@ impl Pixel { pub fn distance(a: Pixel, b: Pixel) -> usize { let (rd, gd, bd) = ( a.r.abs_diff(b.r) as usize, - a.r.abs_diff(b.r) as usize, - a.r.abs_diff(b.r) as usize, + a.g.abs_diff(b.g) as usize, + a.b.abs_diff(b.b) as usize, ); // fast_sqrt(rd * rd + gd * gd + bd * bd) - SQRT[rd + gd + bd] + // SQRT[rd + gd + bd] + rd + gd + bd } #[inline] |