Skip to content

Commit

Permalink
Address new clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zero committed Sep 12, 2023
1 parent 4139b47 commit 7bcd541
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/activity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ mod ssim_boost_tests {
const C3: f64 = 12338f64;
const RATIO: f64 = C1 / C3;

RATIO * (svar + dvar + C2) / f64::sqrt(C1 * C1 + svar * dvar)
RATIO * (svar + dvar + C2) / f64::sqrt(C1.mul_add(C1, svar * dvar))
}

/// Test that `ssim_boost` has sufficient accuracy.
Expand Down
6 changes: 3 additions & 3 deletions src/asm/aarch64/cdef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub(crate) unsafe fn cdef_filter_block<T: Pixel>(
CDEF_FILTER_FNS[cpu.as_index()][decimate_index(xdec, ydec)],
) {
(Some(pad), Some(func)) => {
let h = if ydec == 1 { 4 } else { 8 } as i32;
let h = if ydec == 1 { 4 } else { 8 };
let tmpstride = if xdec == 1 { 8 } else { 16 } as isize;
const MAXTMPSTRIDE: isize = 16;
const TMPSIZE: usize = (12 * MAXTMPSTRIDE + 8) as usize;
Expand Down Expand Up @@ -167,7 +167,7 @@ pub(crate) unsafe fn cdef_filter_block<T: Pixel>(
// clause using Rust macros. See comments above for
// indexing/addressing notes.
(Some(pad), Some(func)) => {
let h = if ydec == 1 { 4 } else { 8 } as i32;
let h = if ydec == 1 { 4 } else { 8 };
let tmpstride = if xdec == 1 { 8 } else { 16 } as isize;
const MAXTMPSTRIDE: isize = 16;
const TMPSIZE: usize = (12 * MAXTMPSTRIDE + 8) as usize;
Expand Down Expand Up @@ -370,7 +370,7 @@ pub(crate) fn cdef_find_dir<T: Pixel>(
img.as_ptr() as *const _,
T::to_asm_stride(img.plane.cfg.stride),
var as *mut u32,
(1 << coeff_shift + 8) - 1,
(1 << (coeff_shift + 8)) - 1,
)
}
} else {
Expand Down
1 change: 1 addition & 0 deletions src/asm/aarch64/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ pub fn get_sad<T: Pixel>(
}

#[inline(always)]
#[allow(clippy::let_and_return)]
pub fn get_satd<T: Pixel>(
src: &PlaneRegion<'_, T>, dst: &PlaneRegion<'_, T>, w: usize, h: usize,
bit_depth: usize, cpu: CpuFeatureLevel,
Expand Down
6 changes: 3 additions & 3 deletions src/asm/aarch64/mc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub fn put_8tap<T: Pixel>(
// SAFETY: The assembly only supports even heights and valid uncropped
// widths
assert_eq!(height & 1, 0);
assert!(width.is_power_of_two() && 2 <= width && width <= 128);
assert!(width.is_power_of_two() && (2..=128).contains(&width));

// SAFETY: Check bounds of dst
assert!(dst.rect().width >= width && dst.rect().height >= height);
Expand Down Expand Up @@ -188,7 +188,7 @@ pub fn prep_8tap<T: Pixel>(
// SAFETY: The assembly only supports even heights and valid uncropped
// widths
assert_eq!(height & 1, 0);
assert!(width.is_power_of_two() && 2 <= width && width <= 128);
assert!(width.is_power_of_two() && (2..=128).contains(&width));

// SAFETY: Check length of tmp
assert!(tmp.len() >= width * height);
Expand Down Expand Up @@ -256,7 +256,7 @@ pub fn mc_avg<T: Pixel>(
// SAFETY: The assembly only supports even heights and valid uncropped
// widths
assert_eq!(height & 1, 0);
assert!(width.is_power_of_two() && 2 <= width && width <= 128);
assert!(width.is_power_of_two() && (2..=128).contains(&width));

// SAFETY: Check bounds of dst
assert!(dst.rect().width >= width && dst.rect().height >= height);
Expand Down
4 changes: 2 additions & 2 deletions src/asm/aarch64/predict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ unsafe fn ipred_z2<T: Pixel>(
let mut out = [MaybeUninit::<T>::uninit(); 3 * (MAX_TX_SIZE * 4 + 1)];
let out = out.as_mut_ptr() as *mut T;
let left = out.add(2 * (64 + 1));
let top = out.add(1 * (64 + 1));
let top = out.add(64 + 1);
let flipped = out;
if us_above {
ipred_z2_upsample_edge(top, w, src, bd_max);
Expand Down Expand Up @@ -586,7 +586,7 @@ pub fn dispatch_predict_intra<T: Pixel>(
let smooth_filter = ief_params
.map(IntraEdgeFilterParameters::use_smooth_filter)
.unwrap_or_default();
if angle >= 90 && angle <= 180 {
if (90..=180).contains(&angle) {
// From dav1d, bw and bh are the frame width and height rounded to 8px units
let (bw, bh) = (
((dst.plane_cfg.width + 7) >> 3) << 3,
Expand Down

0 comments on commit 7bcd541

Please sign in to comment.