-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
struct Rav1dFrameContext_lf::level
: Change [u8; 4]
s to u8
s and …
…remove `unsafe`s and UB (#1273) Previously usages of `level` were UB. Accesses to the disjoint `[0..2]` Y and `[2..4]` UV elements were done `unsafe`ly since they overlapped, but this meant that the other safe `DisjointMut` usages of `level` were unchecked, overlapping with those writes, and thus UB. This fixes that by making the elements just `u8`s instead of `[u8; 4]`s, multiplying all previous indices/offsets by 4. Thus we can now index the `[0..2]` Y and `[2..4]` UV elements independently with `DisjointMut`'s safe APIs. We can also remove `fn unaligned_lvl_slice`, since that now just translates to a normal offset by `y`, just not multiplied by 4 like the `x`s were. We can also allocate only 3 extra bytes for asm like C does, rather than a whole extra element (4 bytes). And finally, we can move the `DisjointMut` immutable indexing to `fn loop_filter_sb128_rust`, where it can be fine-grained and not overlap with other uses.
- Loading branch information
Showing
7 changed files
with
66 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.