Skip to content

Commit

Permalink
filmgrain.rs: remove unnecessary casts when invoking BD::pxstride
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Bossen authored and fbossen committed Feb 29, 2024
1 parent cf9bab0 commit c47a038
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/filmgrain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,11 +612,11 @@ unsafe fn fgy_32x32xn_rust<BD: BitDepth>(

let add_noise_y = |x, y, grain| {
let src = src_row
.offset(y as isize * BD::pxstride(stride as usize) as isize)
.offset(y as isize * BD::pxstride(stride))
.add(x)
.add(bx);
let dst = dst_row
.offset(y as isize * BD::pxstride(stride as usize) as isize)
.offset(y as isize * BD::pxstride(stride))
.add(x)
.add(bx);
let noise = round2(
Expand Down Expand Up @@ -750,18 +750,18 @@ unsafe fn fguv_32x32xn_rust<BD: BitDepth>(
let lx = bx.wrapping_add(x) << sx;
let ly = y << sy;
let luma = luma_row
.offset(ly as isize * BD::pxstride(luma_stride as usize) as isize)
.offset(ly as isize * BD::pxstride(luma_stride))
.offset(lx as isize);
let mut avg = *luma.offset(0);
if is_sx {
avg = ((avg.as_::<c_int>() + (*luma.offset(1)).as_::<c_int>() + 1) >> 1)
.as_::<BD::Pixel>();
}
let src = src_row
.offset(y as isize * BD::pxstride(stride as usize) as isize)
.offset(y as isize * BD::pxstride(stride))
.add(bx.wrapping_add(x));
let dst = dst_row
.offset(y as isize * BD::pxstride(stride as usize) as isize)
.offset(y as isize * BD::pxstride(stride))
.add(bx.wrapping_add(x));
let mut val = avg.as_::<c_int>();
if !data.chroma_scaling_from_luma {
Expand Down

0 comments on commit c47a038

Please sign in to comment.