aboutsummaryrefslogtreecommitdiff
path: root/evc/src/helpers/pixel.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-12-07 23:08:11 +0100
committermetamuffin <metamuffin@disroot.org>2022-12-07 23:08:11 +0100
commit8b7792d6aa27578221fee7cc8be1ceb202602a5a (patch)
tree0675d17e616482b606fbf656575fe56144b7a361 /evc/src/helpers/pixel.rs
parente4704f1ba3ff7d9c75714d432768ce12f630e745 (diff)
downloadvideo-codec-experiments-8b7792d6aa27578221fee7cc8be1ceb202602a5a.tar
video-codec-experiments-8b7792d6aa27578221fee7cc8be1ceb202602a5a.tar.bz2
video-codec-experiments-8b7792d6aa27578221fee7cc8be1ceb202602a5a.tar.zst
implement broken value scale
Diffstat (limited to 'evc/src/helpers/pixel.rs')
-rw-r--r--evc/src/helpers/pixel.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/evc/src/helpers/pixel.rs b/evc/src/helpers/pixel.rs
index f7d6621..964040d 100644
--- a/evc/src/helpers/pixel.rs
+++ b/evc/src/helpers/pixel.rs
@@ -29,6 +29,7 @@ impl Pixel {
);
SQRT[rd + gd + bd]
}
+
#[inline]
pub fn average(a: Pixel, b: Pixel) -> Pixel {
//? this functions is broken
@@ -39,6 +40,8 @@ impl Pixel {
b: (a.b >> 1) + (b.b >> 1),
}
}
+
+ #[inline]
pub fn scale(&self, factor: f32) -> Pixel {
Pixel {
r: ((self.r as f32) * factor).clamp(0.0, 255.0) as u8,