Skip to content

Commit

Permalink
fn rav1d_apply_grain_row: Make nominally safe.
Browse files Browse the repository at this point in the history
  • Loading branch information
kkysen committed May 28, 2024
1 parent 3bd941e commit 3093ff8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/fg_apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub(crate) unsafe fn rav1d_prep_grain<BD: BitDepth>(
}
}

pub(crate) unsafe fn rav1d_apply_grain_row<BD: BitDepth>(
pub(crate) fn rav1d_apply_grain_row<BD: BitDepth>(
dsp: &Rav1dFilmGrainDSPContext,
out: &Rav1dPicture,
r#in: &Rav1dPicture,
Expand Down
34 changes: 14 additions & 20 deletions src/thread_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,29 +751,23 @@ fn delayed_fg_task<'l, 'ttd: 'l>(
match &delayed_fg.grain {
#[cfg(feature = "bitdepth_8")]
Grain::Bpc8(grain) => {
// SAFETY: TODO make safe
unsafe {
rav1d_apply_grain_row::<BitDepth8>(
dsp,
&delayed_fg.out,
&delayed_fg.in_0,
grain,
row as usize,
);
}
rav1d_apply_grain_row::<BitDepth8>(
dsp,
&delayed_fg.out,
&delayed_fg.in_0,
grain,
row as usize,
);
}
#[cfg(feature = "bitdepth_16")]
Grain::Bpc16(grain) => {
// SAFETY: TODO make safe
unsafe {
rav1d_apply_grain_row::<BitDepth16>(
dsp,
&delayed_fg.out,
&delayed_fg.in_0,
grain,
row as usize,
);
}
rav1d_apply_grain_row::<BitDepth16>(
dsp,
&delayed_fg.out,
&delayed_fg.in_0,
grain,
row as usize,
);
}
}
}
Expand Down

0 comments on commit 3093ff8

Please sign in to comment.