#[repr(u8)]pub enum Predictor {
Show 14 variants
Zero = 0,
Left = 1,
Top = 2,
Average0 = 3,
Select = 4,
Gradient = 5,
Weighted = 6,
TopRight = 7,
TopLeft = 8,
LeftLeft = 9,
Average1 = 10,
Average2 = 11,
Average3 = 12,
Average4 = 13,
}Expand description
Available predictors for modular encoding.
Variants§
Zero = 0
Always predicts 0.
Left = 1
Uses the left neighbor (west).
Top = 2
Uses the top neighbor (north).
Average0 = 3
Average of left and top.
Select = 4
Select between left/top based on top-left.
Gradient = 5
Gradient: left + top - topleft (clamped).
Weighted = 6
Weighted average favoring left.
TopRight = 7
Top-right neighbor.
TopLeft = 8
Top-left neighbor.
LeftLeft = 9
Left-left neighbor (2 pixels left).
Average1 = 10
Average of west and north-west: (W + NW) / 2
Average2 = 11
Average of north and north-west: (N + NW) / 2
Average3 = 12
Average of north and north-east: (N + NE) / 2
Average4 = 13
Weighted average: (6N - 2NN + 7W + WW + NE2 + 3NE + 8) / 16
Implementations§
Source§impl Predictor
impl Predictor
Sourcepub const NUM_SIMPLE: usize = 14
pub const NUM_SIMPLE: usize = 14
Number of simple predictors (excluding weighted/variable).
Sourcepub fn all_simple() -> &'static [Predictor]
pub fn all_simple() -> &'static [Predictor]
Returns all simple predictors.
Sourcepub fn predict(self, channel: &Channel, x: usize, y: usize) -> i32
pub fn predict(self, channel: &Channel, x: usize, y: usize) -> i32
Predicts the value at (x, y) using this predictor.
Sourcepub fn predict_from_neighbors(self, n: &Neighbors) -> i32
pub fn predict_from_neighbors(self, n: &Neighbors) -> i32
Predicts from pre-gathered neighbor values.
Trait Implementations§
impl Copy for Predictor
impl Eq for Predictor
impl StructuralPartialEq for Predictor
Auto Trait Implementations§
impl Freeze for Predictor
impl RefUnwindSafe for Predictor
impl Send for Predictor
impl Sync for Predictor
impl Unpin for Predictor
impl UnsafeUnpin for Predictor
impl UnwindSafe for Predictor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more