-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fn cdef
: Make safe
#1239
fn cdef
: Make safe
#1239
Conversation
`rav1d_cdef_brow` is wrapped in TODO `unsafe` blocks since #1239 fixes that already (not merged yet).
`rav1d_cdef_brow` is wrapped in TODO `unsafe` blocks since #1239 fixes that already (not merged yet).
`rav1d_cdef_brow` is wrapped in TODO `unsafe` blocks since #1239 fixes that already (not merged yet).
`rav1d_cdef_brow` is wrapped in TODO `unsafe` blocks since #1239 fixes that already (not merged yet).
`rav1d_cdef_brow` is wrapped in TODO `unsafe` blocks since #1239 fixes that already (not merged yet).
Wait how did 093a17d close this PR? |
"Resolve" is a keyword to trigger closing a PR. |
* Fixes #848. * Fixes #855. * Fixes #841. This does add back some bounds checks since the only and final slicing is done in `fn loopfilter_sb::Fn::call`, which is inside inner loops. @fbossen, how does this look for perf? Only 2 `unsafe` ops left (after #1239 is merged, too)! Though still 122 `unsafe` ops in `neon` `fn`s. ## Addendum So it turns out the `- b4strideb` in `fn loop_filter_sb128_rust` makes the index negative, so the initial slice needs to be larger. This is difficult to safely do, though, because all of the other uses of `f.lf.level` do not go through `DisjointMut`'s safe APIs since there were overlapping `&mut`s since indices 0 and 1 are written simultaneously to 2 and 3, and thus were done `unsafe`ly. This loses the disjointedness checking, though, which is a problem for making other changes. Thus, this PR leaves the `- b4strideb` as an `unsafe` `lvl.as_ptr().sub(b4strideb)` for now. In a follow-up PR, I'm going to change the `[u8; 4]` `lvl` elements to just `u8`s. This will allow the disjoint writes to `[0..2]` and `[2..4]` to be done safely with `DisjointMut`s APIs and will remove the need for `fn unaligned_lvl_slice`. Fixed in #1273 now.
Including #1239, this is the last of non-`neon` `unsafe` ops.
Ugh, but I only linked a comment on a PR, not the PR itself. GitHub should be smarter. |
Assuming #1239 is already merged, this removes the last of `unsafe` ops when compiling for `target_arch = "arm"`. Now only `target_arch = "aarch64"` remains with 110 `unsafe` ops in `mod looprestoration::neon` (`x86`, `x86_64` are already done).
@kkysen I've reworked this to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My previous comments were just little nitpicks, so I fixed them myself and I'll merge now. I also squashed one of the commits that was broken with its fix.
Makes the remaining Rust fallback in
cdef.rs
safe by passing in additional arguments.cdef.rs
: Unsafe cleanup #850.cdef_apply.rs
: Unsafe cleanup #851.