#[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 average and gradient.
Average2 = 11
Average of average and left.
Average3 = 12
Average of average and top.
Average4 = 13
Average of top and top-right.
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 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