From 4e2917a4328c39e10b0211d0b2147d286a9a9e1a Mon Sep 17 00:00:00 2001 From: Nicole LeGare Date: Wed, 24 Apr 2024 11:51:39 -0700 Subject: [PATCH] Code review cleanup --- src/ipred_prepare.rs | 2 ++ src/recon.rs | 18 ++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ipred_prepare.rs b/src/ipred_prepare.rs index 00927b520..b57c8f208 100644 --- a/src/ipred_prepare.rs +++ b/src/ipred_prepare.rs @@ -127,6 +127,8 @@ pub fn rav1d_prepare_intra_edges( edge_flags: EdgeFlags, dst: &[BD::Pixel], // contains 4*h first rows of picture, last row in slice contains 4*w samples stride: ptrdiff_t, + // Buffer and offset pair. `isize` value is the base offset that should be used + // when indexing into the buffer. prefilter_toplevel_sb_edge: Option<(&DisjointMut>, isize)>, mut mode: IntraPredMode, angle: &mut c_int, diff --git a/src/recon.rs b/src/recon.rs index 616a9cb88..398e6b9ea 100644 --- a/src/recon.rs +++ b/src/recon.rs @@ -4526,12 +4526,12 @@ pub(crate) unsafe fn rav1d_backup_ipred_edge( .offset((x_off * 4) as isize) .offset((((t.b.y + f.sb_step) * 4 - 1) as isize * BD::pxstride(f.cur.stride[0])) as isize); let ipred_edge_off = (f.ipred_edge_off * 0) + (sby_off + x_off * 4) as usize; - let n = (4 * (ts.tiling.col_end - x_off)).try_into().unwrap(); + let n = 4 * (ts.tiling.col_end - x_off) as usize; BD::pixel_copy( &mut f .ipred_edge .mut_slice_as(ipred_edge_off..ipred_edge_off + n), - slice::from_raw_parts(y, (4 * (ts.tiling.col_end - x_off)).try_into().unwrap()), + slice::from_raw_parts(y, n), n, ); if f.cur.p.layout as c_uint != Rav1dPixelLayout::I400 as c_int as c_uint { @@ -4545,19 +4545,17 @@ pub(crate) unsafe fn rav1d_backup_ipred_edge( while pl <= 2 { let ipred_edge_off = (f.ipred_edge_off * pl) + (sby_off + (x_off * 4 >> ss_hor)) as usize; - let n = (4 * (ts.tiling.col_end - x_off) >> ss_hor) - .try_into() - .unwrap(); + let n = 4 * (ts.tiling.col_end - x_off) as usize >> ss_hor; BD::pixel_copy( &mut f .ipred_edge .mut_slice_as(ipred_edge_off..ipred_edge_off + n), &slice::from_raw_parts( - f.cur.data.as_ref().unwrap().data[pl].cast(), - (uv_off + (4 * (ts.tiling.col_end - x_off) >> ss_hor) as isize) - .try_into() - .unwrap(), - )[uv_off.try_into().unwrap()..], + f.cur.data.as_ref().unwrap().data[pl] + .cast::() + .offset(uv_off), + n, + ), n, ); pl += 1;