aboutsummaryrefslogtreecommitdiff
path: root/evc/src/pixel.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-12-07 17:16:40 +0100
committermetamuffin <metamuffin@disroot.org>2022-12-07 17:16:40 +0100
commit85d20c4f4cf3656fbf7c27b6b8bbf9536e3ae04d (patch)
tree06497577894131a66f3f4874a9865da5b814fe17 /evc/src/pixel.rs
parenta713143ef9c1187c37004043b1d3322d773f9ea0 (diff)
downloadvideo-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.rs8
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();