pub struct Neighbors {
pub n: i32,
pub w: i32,
pub nw: i32,
pub ne: i32,
pub nn: i32,
pub ww: 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.
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 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