Skip to content

Commit

Permalink
Rav1dFrameContext_frame_thread: Make pal_sz a getter
Browse files Browse the repository at this point in the history
  • Loading branch information
randomPoison committed Feb 16, 2024
1 parent 6c2b709 commit 24badfd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4388,12 +4388,11 @@ pub(crate) unsafe fn rav1d_decode_frame_init(
}

if frame_hdr.allow_screen_content_tools != 0 {
if num_sb128 != f.frame_thread.pal_sz {
if num_sb128 as usize != f.frame_thread.pal_sz() {
// TODO: Fallible allocation
f.frame_thread
.pal
.resize_with(num_sb128 as usize * 16 * 16, Default::default);
f.frame_thread.pal_sz = num_sb128;
}

let pal_idx_sz = num_sb128 * size_mul[1] as c_int;
Expand All @@ -4413,7 +4412,6 @@ pub(crate) unsafe fn rav1d_decode_frame_init(
let _ = mem::take(&mut f.frame_thread.pal);
rav1d_freep_aligned(&mut f.frame_thread.pal_idx as *mut *mut u8 as *mut c_void);
f.frame_thread.pal_idx_sz = 0;
f.frame_thread.pal_sz = f.frame_thread.pal_idx_sz;
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,18 @@ pub struct Rav1dFrameContext_frame_thread {
// iterated over inside tile state
pub pal_idx: *mut u8,
pub cf: *mut DynCoef,
pub pal_sz: c_int,
pub pal_idx_sz: c_int,
pub cf_sz: c_int,
// start offsets per tile
pub tile_start_off: *mut c_int,
}

impl Rav1dFrameContext_frame_thread {
pub fn pal_sz(&self) -> usize {
self.pal.len() / (16 * 16)
}
}

/// loopfilter
#[repr(C)]
pub struct Rav1dFrameContext_lf {
Expand Down

0 comments on commit 24badfd

Please sign in to comment.