Skip to content

Commit

Permalink
struct Rav1dFrameData: Add inner mutability to lowest_pixel_mem (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rinon authored Apr 16, 2024
2 parents 54a947c + 2105c1b commit dda4fde
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3026,7 +3026,7 @@ unsafe fn decode_b_inner(

if t.frame_thread.pass == 1 && b.intra == 0 && frame_hdr.frame_type.is_inter_or_switch() {
let sby = t.b.y - ts.tiling.row_start >> f.sb_shift;
let lowest_px = &mut f.lowest_pixel_mem[ts.lowest_pixel + sby as usize];
let mut lowest_px = f.lowest_pixel_mem.index_mut(ts.lowest_pixel + sby as usize);
// keep track of motion vectors for each reference
if b.comp_type().is_none() {
// y
Expand Down Expand Up @@ -3061,7 +3061,7 @@ unsafe fn decode_b_inner(
&*f.ts.offset(t.ts as isize),
f.cur.p.layout,
&f.svc,
lowest_px,
&mut lowest_px,
false,
b_dim,
bx4,
Expand Down Expand Up @@ -3172,7 +3172,7 @@ unsafe fn decode_b_inner(
&*f.ts.offset(t.ts as isize),
f.cur.p.layout,
&f.svc,
lowest_px,
&mut lowest_px,
true,
b_dim,
bx4,
Expand Down Expand Up @@ -3885,7 +3885,7 @@ pub(crate) unsafe fn rav1d_decode_tile_sbrow(

if frame_hdr.frame_type.is_inter_or_switch() && c.n_fc > 1 {
let sby = t.b.y - ts.tiling.row_start >> f.sb_shift;
f.lowest_pixel_mem[ts.lowest_pixel + sby as usize] = [[i32::MIN; 2]; 7];
*f.lowest_pixel_mem.index_mut(ts.lowest_pixel + sby as usize) = [[i32::MIN; 2]; 7];
}

reset_context(
Expand Down
2 changes: 1 addition & 1 deletion src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ pub(crate) struct Rav1dFrameData {
pub frame_thread_progress: Rav1dFrameContext_frame_thread_progress,
pub lf: Rav1dFrameContext_lf,
pub task_thread: Rav1dFrameContext_task_thread,
pub lowest_pixel_mem: Vec<[[c_int; 2]; 7]>,
pub lowest_pixel_mem: DisjointMut<Vec<[[c_int; 2]; 7]>>,
}

impl Rav1dFrameData {
Expand Down
4 changes: 3 additions & 1 deletion src/thread_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,9 @@ unsafe fn check_tile(t_idx: Rav1dTaskIndex, f: &Rav1dFrameData, frame_mt: c_int)
((*p).p.p.layout as c_uint == Rav1dPixelLayout::I420 as c_int as c_uint) as c_int;
let p_b: c_uint = (((*t).sby + 1) << f.sb_shift + 2) as c_uint;
let tile_sby = (*t).sby - ((*ts).tiling.row_start >> f.sb_shift);
let lowest_px = &f.lowest_pixel_mem[(*ts).lowest_pixel + tile_sby as usize];
let lowest_px = f
.lowest_pixel_mem
.index((*ts).lowest_pixel + tile_sby as usize);
for n in t.deps_skip..7 {
'next: {
let lowest = if tp {
Expand Down

0 comments on commit dda4fde

Please sign in to comment.