diff options
author | metamuffin <metamuffin@disroot.org> | 2022-12-07 17:16:40 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-12-07 17:16:40 +0100 |
commit | 85d20c4f4cf3656fbf7c27b6b8bbf9536e3ae04d (patch) | |
tree | 06497577894131a66f3f4874a9865da5b814fe17 /evc/src/pixel.rs | |
parent | a713143ef9c1187c37004043b1d3322d773f9ea0 (diff) | |
download | video-codec-experiments-85d20c4f4cf3656fbf7c27b6b8bbf9536e3ae04d.tar video-codec-experiments-85d20c4f4cf3656fbf7c27b6b8bbf9536e3ae04d.tar.bz2 video-codec-experiments-85d20c4f4cf3656fbf7c27b6b8bbf9536e3ae04d.tar.zst |
refactor, matrix math
Diffstat (limited to 'evc/src/pixel.rs')
-rw-r--r-- | evc/src/pixel.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/evc/src/pixel.rs b/evc/src/pixel.rs index 4fb6772..121cb95 100644 --- a/evc/src/pixel.rs +++ b/evc/src/pixel.rs @@ -29,6 +29,14 @@ impl Pixel { ); SQRT[rd + gd + bd] } + #[inline] + pub fn average(a: Pixel, b: Pixel) -> Pixel { + Pixel { + r: (a.r >> 2) + (b.r >> 2), + g: (a.g >> 2) + (b.g >> 2), + b: (a.b >> 2) + (b.b >> 2), + } + } } const SQRT: [usize; 256 * 3] = gen_sqrt_lookup(); |