Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

struct Rav1dFrameContext_lf::sr_p: Make into offsets #799

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4609,7 +4609,7 @@ pub(crate) unsafe fn rav1d_decode_frame_init(
// at, as long as the offsets are valid.
let has_chroma = (f.cur.p.layout != Rav1dPixelLayout::I400) as usize;
f.lf.p = array::from_fn(|i| has_chroma * i);
f.lf.sr_p = array::from_fn(|i| f.sr_cur.p.data.data[has_chroma * i].cast());
f.lf.sr_p = array::from_fn(|i| has_chroma * i);

Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ pub struct Rav1dFrameContext_lf {

// in-loop filter per-frame state keeping
pub start_of_tile_row: Vec<u8>,
pub p: [usize; 3], // Offsets into `f.cur.data.data`.
pub sr_p: [*mut DynPixel; 3],
pub p: [usize; 3], // Offsets into `f.cur.data.data`.
pub sr_p: [usize; 3], // Offsets into `f.sr_cur.p.data.data`.
pub restore_planes: c_int, // enum LrRestorePlanes
}

Expand Down
15 changes: 9 additions & 6 deletions src/recon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4671,11 +4671,14 @@ pub(crate) unsafe fn rav1d_filter_sbrow_resize<BD: BitDepth>(
.offset(y as isize * BD::pxstride(f.cur.stride[1]) >> ss_ver),
];
let sr_p: [*mut BD::Pixel; 3] = [
(f.lf.sr_p[0] as *mut BD::Pixel)
f.sr_cur.p.data.data[f.lf.sr_p[0]]
.cast::<BD::Pixel>()
.offset((y as isize * BD::pxstride(f.sr_cur.p.stride[0])) as isize),
(f.lf.sr_p[1] as *mut BD::Pixel)
f.sr_cur.p.data.data[f.lf.sr_p[1]]
.cast::<BD::Pixel>()
.offset((y as isize * BD::pxstride(f.sr_cur.p.stride[1]) >> ss_ver) as isize),
(f.lf.sr_p[2] as *mut BD::Pixel)
f.sr_cur.p.data.data[f.lf.sr_p[2]]
.cast::<BD::Pixel>()
.offset((y as isize * BD::pxstride(f.sr_cur.p.stride[1]) >> ss_ver) as isize),
];
let has_chroma =
Expand Down Expand Up @@ -4732,15 +4735,15 @@ pub(crate) unsafe fn rav1d_filter_sbrow_lr<BD: BitDepth>(
let h = (*f).sr_cur.p.p.h + 127 & !127;
let mut sr_p: [&mut [BD::Pixel]; 3] = [
slice::from_raw_parts_mut(
f.lf.sr_p[0] as *mut BD::Pixel,
f.sr_cur.p.data.data[f.lf.sr_p[0]].cast::<BD::Pixel>(),
(h as isize * BD::pxstride(f.sr_cur.p.stride[0])) as usize,
),
slice::from_raw_parts_mut(
f.lf.sr_p[1] as *mut BD::Pixel,
f.sr_cur.p.data.data[f.lf.sr_p[1]].cast::<BD::Pixel>(),
(h as isize * BD::pxstride(f.sr_cur.p.stride[1])) as usize >> ss_ver,
),
slice::from_raw_parts_mut(
f.lf.sr_p[2] as *mut BD::Pixel,
f.sr_cur.p.data.data[f.lf.sr_p[2]].cast::<BD::Pixel>(),
(h as isize * BD::pxstride(f.sr_cur.p.stride[1])) as usize >> ss_ver,
),
];
Expand Down
Loading