Skip to content

Commit

Permalink
src/filmgrain.rs: Fix GrainLut and Scaling args and make them r…
Browse files Browse the repository at this point in the history
…efs (#542)
  • Loading branch information
kkysen authored Nov 7, 2023
2 parents 6751f65 + 9dd31ac commit ad2f593
Show file tree
Hide file tree
Showing 8 changed files with 200 additions and 179 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ num_cpus = "1.0"
paste = "1.0.14"
raw-cpuid = "11.0.1"
strum = { version = "0.25.0", features = ["derive"] }
to_method = "1.1.0"

[build-dependencies]
cc = "1.0.79"
Expand Down
8 changes: 6 additions & 2 deletions include/common/bitdepth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,14 @@ pub trait BitDepth: Clone + Copy {
+ Mul<Output = Self::Pixel>
+ Shr<u8, Output = Self::Pixel>
+ From<u8>
+ Into<u16>
+ Into<usize>
+ Into<i32>
+ TryFrom<i32>
+ FromPrimitive<c_int>
+ FromPrimitive<c_uint>
+ ToPrimitive<c_int>
+ ToPrimitive<c_uint>
+ ToPrimitive<isize>;
+ ToPrimitive<c_uint>;

type Coef: Copy
+ FromPrimitive<c_int>
Expand Down Expand Up @@ -380,6 +381,9 @@ pub struct DynCoef(c_void);
#[repr(transparent)]
pub struct DynEntry(c_void);

#[repr(transparent)]
pub struct DynScaling([u8; 1]);

pub type LeftPixelRow<Pixel> = [Pixel; 4];
pub type LeftPixelRow2px<Pixel> = [Pixel; 2];

Expand Down
6 changes: 3 additions & 3 deletions src/fg_apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ pub(crate) unsafe fn rav1d_apply_grain_row<BD: BitDepth>(
out.stride[0],
data,
out.p.w as usize,
scaling[0].as_ref().as_ptr(),
scaling[0].as_ref().as_ptr().cast(),
grain_lut[0].as_ptr().cast(),
bh,
row,
Expand Down Expand Up @@ -236,7 +236,7 @@ pub(crate) unsafe fn rav1d_apply_grain_row<BD: BitDepth>(
r#in.stride[1],
data,
cpw as usize,
scaling[0].as_ref().as_ptr(),
scaling[0].as_ref().as_ptr().cast(),
grain_lut[1 + pl].as_ptr().cast(),
bh,
row,
Expand All @@ -260,7 +260,7 @@ pub(crate) unsafe fn rav1d_apply_grain_row<BD: BitDepth>(
r#in.stride[1],
data,
cpw as usize,
scaling[1 + pl].as_ref().as_ptr(),
scaling[1 + pl].as_ref().as_ptr().cast(),
grain_lut[1 + pl].as_ptr().cast(),
bh,
row,
Expand Down
Loading

0 comments on commit ad2f593

Please sign in to comment.