Skip to content

Commit

Permalink
struct Rav1dTaskContext: Initialize fields with `Default::default()…
Browse files Browse the repository at this point in the history
…` except for `scratch`, which is a `union` and a WIP to make safe.
  • Loading branch information
kkysen committed Apr 23, 2024
1 parent 47317b6 commit 72bdf3e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,22 +1070,22 @@ pub(crate) struct Rav1dTaskContext {
}

impl Rav1dTaskContext {
pub(crate) unsafe fn new(task_thread: Arc<Rav1dTaskContext_task_thread>) -> Self {
pub(crate) fn new(task_thread: Arc<Rav1dTaskContext_task_thread>) -> Self {
Self {
ts: 0,
b: Default::default(),
l: mem::zeroed(),
l: Default::default(),
a: ptr::null_mut(),
rt: mem::zeroed(),
rt: Default::default(),
cf: Default::default(),
al_pal: Default::default(),
pal_sz_uv: Default::default(),
scratch: mem::zeroed(),
warpmv: mem::zeroed(),
scratch: unsafe { mem::zeroed() },
warpmv: Default::default(),
lf_mask: None,
top_pre_cdef_toggle: 0,
cur_sb_cdef_idx: 0,
tl_4x4_filter: mem::zeroed(),
tl_4x4_filter: Filter2d::Regular8Tap, // 0
frame_thread: Rav1dTaskContext_frame_thread { pass: 0 },
task_thread,
}
Expand Down
12 changes: 12 additions & 0 deletions src/refmvs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ pub(crate) struct RefMvsFrame {
pub n_frame_threads: u32,
}

#[derive(Default)]
#[repr(C)]
pub struct refmvs_tile_range {
pub start: c_int,
Expand All @@ -246,6 +247,17 @@ pub(crate) struct refmvs_tile {
pub tile_row: refmvs_tile_range,
}

impl Default for refmvs_tile {
fn default() -> Self {
Self {
r: [Default::default(); 37],
rp_proj: Default::default(),
tile_col: Default::default(),
tile_row: Default::default(),
}
}
}

#[derive(Copy, Clone, Default)]
#[repr(C)]
pub struct refmvs_candidate {
Expand Down

0 comments on commit 72bdf3e

Please sign in to comment.