Skip to content

Commit

Permalink
fn loop_restoration_filter::Fn::call: Mark it and callers safe (#1230)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkysen authored Jun 21, 2024
2 parents db847b3 + 8ada302 commit 1449ec4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
11 changes: 7 additions & 4 deletions src/looprestoration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl loop_restoration_filter::Fn {
/// aligned writes past the right edge of the buffer,
/// aligned up to the minimum loop restoration unit size
/// (which is 32 pixels for subsampled chroma and 64 pixels for luma).
pub unsafe fn call<BD: BitDepth>(
pub fn call<BD: BitDepth>(
&self,
dst: Rav1dPictureDataComponentOffset,
left: &[LeftPixelRow<BD::Pixel>],
Expand Down Expand Up @@ -187,9 +187,12 @@ impl loop_restoration_filter::Fn {
let bd = bd.into_c();
let dst = FFISafe::new(&dst);
let lpf = FFISafe::new(lpf);
self.get()(
dst_ptr, dst_stride, left, lpf_ptr, w, h, params, edges, bd, dst, lpf,
)
// SAFETY: Fallbacks `fn wiener_rust`, `fn sgr_{3x3,5x5,mix}_rust` are safe; asm is supposed to do the same.
unsafe {
self.get()(
dst_ptr, dst_stride, left, lpf_ptr, w, h, params, edges, bd, dst, lpf,
)
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/lr_apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub const LR_RESTORE_V: LrRestorePlanes = 4;
pub const LR_RESTORE_U: LrRestorePlanes = 2;
pub const LR_RESTORE_Y: LrRestorePlanes = 1;

unsafe fn lr_stripe<BD: BitDepth>(
fn lr_stripe<BD: BitDepth>(
c: &Rav1dContext,
f: &Rav1dFrameData,
mut p: Rav1dPictureDataComponentOffset,
Expand Down Expand Up @@ -135,7 +135,7 @@ fn backup4xU<BD: BitDepth>(
}
}

unsafe fn lr_sbrow<BD: BitDepth>(
fn lr_sbrow<BD: BitDepth>(
c: &Rav1dContext,
f: &Rav1dFrameData,
mut p: Rav1dPictureDataComponentOffset,
Expand Down Expand Up @@ -239,7 +239,7 @@ unsafe fn lr_sbrow<BD: BitDepth>(
}
}

pub(crate) unsafe fn rav1d_lr_sbrow<BD: BitDepth>(
pub(crate) fn rav1d_lr_sbrow<BD: BitDepth>(
c: &Rav1dContext,
f: &Rav1dFrameData,
dst: [Rav1dPictureDataComponentOffset; 3],
Expand Down
2 changes: 1 addition & 1 deletion src/recon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4072,7 +4072,7 @@ pub(crate) unsafe fn rav1d_filter_sbrow_resize<BD: BitDepth>(
}
}

pub(crate) unsafe fn rav1d_filter_sbrow_lr<BD: BitDepth>(
pub(crate) fn rav1d_filter_sbrow_lr<BD: BitDepth>(
c: &Rav1dContext,
f: &Rav1dFrameData,
_t: &mut Rav1dTaskContext,
Expand Down

0 comments on commit 1449ec4

Please sign in to comment.