pub struct Neighbors {
pub n: i32,
pub w: i32,
pub nw: i32,
pub ne: i32,
pub nn: i32,
pub ww: i32,
pub nee: i32,
}Expand description
Neighbor values for prediction.
Fields§
§n: i32North (top) neighbor.
w: i32West (left) neighbor.
nw: i32Northwest (top-left) neighbor.
ne: i32Northeast (top-right) neighbor.
nn: i32North-north (2 pixels above) neighbor.
ww: i32West-west (2 pixels left) neighbor.
nee: i32Northeast-east (top-right of top-right, pixel at x+2, y-1). Used by AverageAll predictor.
Implementations§
Source§impl Neighbors
impl Neighbors
Sourcepub fn gather(channel: &Channel, x: usize, y: usize) -> Self
pub fn gather(channel: &Channel, x: usize, y: usize) -> Self
Gathers neighbor values from a channel, matching the JXL spec’s edge handling.
Edge clamping rules (from jxl-rs PredictionData::get_rows):
- left:
x>0 ? row[x-1] : (y>0 ? top_row[0] : 0) - top:
y>0 ? top_row[x] : left - topleft:
x>0 && y>0 ? top_row[x-1] : left - topright:
x+1 < width && y>0 ? top_row[x+1] : top - leftleft:
x>1 ? row[x-2] : left - toptop:
y>1 ? toptop_row[x] : top
Trait Implementations§
impl Copy for Neighbors
Auto Trait Implementations§
impl Freeze for Neighbors
impl RefUnwindSafe for Neighbors
impl Send for Neighbors
impl Sync for Neighbors
impl Unpin for Neighbors
impl UnsafeUnpin for Neighbors
impl UnwindSafe for Neighbors
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<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