aboutsummaryrefslogtreecommitdiff
path: root/evc/src/helpers/pixel.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-12-07 21:23:42 +0100
committermetamuffin <metamuffin@disroot.org>2022-12-07 21:23:42 +0100
commit2ac18802b58d671c10538e78d50a620baad9a188 (patch)
tree17f924039fd8f3dae2801902d4bdeaac8ea74624 /evc/src/helpers/pixel.rs
parent9d7986bbfd44b69a623fa29528b5d13000b91c77 (diff)
downloadvideo-codec-experiments-2ac18802b58d671c10538e78d50a620baad9a188.tar
video-codec-experiments-2ac18802b58d671c10538e78d50a620baad9a188.tar.bz2
video-codec-experiments-2ac18802b58d671c10538e78d50a620baad9a188.tar.zst
advanced transform
Diffstat (limited to 'evc/src/helpers/pixel.rs')
-rw-r--r--evc/src/helpers/pixel.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/evc/src/helpers/pixel.rs b/evc/src/helpers/pixel.rs
index 7b7c8d5..f7d6621 100644
--- a/evc/src/helpers/pixel.rs
+++ b/evc/src/helpers/pixel.rs
@@ -31,10 +31,12 @@ impl Pixel {
}
#[inline]
pub fn average(a: Pixel, b: Pixel) -> Pixel {
+ //? this functions is broken
+ // TODO dont loose accuracy
Pixel {
- r: (a.r >> 2) + (b.r >> 2),
- g: (a.g >> 2) + (b.g >> 2),
- b: (a.b >> 2) + (b.b >> 2),
+ r: (a.r >> 1) + (b.r >> 1),
+ g: (a.g >> 1) + (b.g >> 1),
+ b: (a.b >> 1) + (b.b >> 1),
}
}
pub fn scale(&self, factor: f32) -> Pixel {