From c2a4fa57b414ec496948a1812344a60bd72e1845 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Tue, 14 May 2019 13:50:28 +0200 Subject: [PATCH] fix clippy errors --- nihav-commonfmt/src/codecs/clearvideo.rs | 1 + nihav-duck/src/codecs/truemotion2.rs | 1 + nihav-indeo/src/codecs/mod.rs | 1 + nihav-rad/src/codecs/bink2.rs | 8 ++++++-- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nihav-commonfmt/src/codecs/clearvideo.rs b/nihav-commonfmt/src/codecs/clearvideo.rs index 0594869..4aee1fe 100644 --- a/nihav-commonfmt/src/codecs/clearvideo.rs +++ b/nihav-commonfmt/src/codecs/clearvideo.rs @@ -223,6 +223,7 @@ fn dct_row(blk: &mut [i32]) { } #[allow(non_snake_case)] +#[allow(clippy::erasing_op)] fn dct_col(blk: &mut [i32; 64], col: usize) { let dshift = 8; let shift = 14; diff --git a/nihav-duck/src/codecs/truemotion2.rs b/nihav-duck/src/codecs/truemotion2.rs index 1abe444..2e0ff5e 100644 --- a/nihav-duck/src/codecs/truemotion2.rs +++ b/nihav-duck/src/codecs/truemotion2.rs @@ -223,6 +223,7 @@ struct DeltaState { dc: [[i32; 2]; 2], } +#[allow(clippy::erasing_op)] impl DeltaState { fn apply_y(&mut self, dst: &mut [u8], mut yoff: usize, ystride: usize, ydeltas: &[i32; 16], last: &mut [i32]) { for y in 0..4 { diff --git a/nihav-indeo/src/codecs/mod.rs b/nihav-indeo/src/codecs/mod.rs index 63bad83..a5d2f5c 100644 --- a/nihav-indeo/src/codecs/mod.rs +++ b/nihav-indeo/src/codecs/mod.rs @@ -20,6 +20,7 @@ mod ivi; #[cfg(any(feature="decoder_indeo4", feature="decoder_indeo5"))] mod ivibr; #[cfg(any(feature="decoder_indeo4", feature="decoder_indeo5"))] +#[allow(clippy::erasing_op)] mod ividsp; #[cfg(feature="decoder_imc")] diff --git a/nihav-rad/src/codecs/bink2.rs b/nihav-rad/src/codecs/bink2.rs index 0bcfdd4..eb3158b 100644 --- a/nihav-rad/src/codecs/bink2.rs +++ b/nihav-rad/src/codecs/bink2.rs @@ -53,7 +53,7 @@ macro_rules! idct { }; (float; $src: expr, $sstep: expr, $off: expr, $dst: expr, $dstep: expr, $doff: expr, $bias: expr, $shift: expr) => { let t00 = $src[$off + $sstep * 2] + $src[$off + $sstep * 6]; - let t01 = ($src[$off + $sstep * 2] - $src[$off + $sstep * 6]) * 1.4142135 - t00; + let t01 = ($src[$off + $sstep * 2] - $src[$off + $sstep * 6]) * std::f32::consts::SQRT_2 - t00; let t02 = $src[$off + $sstep * 0] + $src[$off + $sstep * 4]; let t03 = $src[$off + $sstep * 0] - $src[$off + $sstep * 4]; let t04 = $src[$off + $sstep * 3] + $src[$off + $sstep * 5]; @@ -65,7 +65,7 @@ macro_rules! idct { let t10 = t03 + t01; let t11 = t03 - t01; let t12 = t06 + t04; - let t13 = (t06 - t04) * 1.4142135; + let t13 = (t06 - t04) * std::f32::consts::SQRT_2; let t14 = (t07 - t05) * 1.847759; let t15 = t05 * 2.613126 + t14 - t12; let t16 = t13 - t15; @@ -82,6 +82,7 @@ macro_rules! idct { }; } +#[allow(clippy::erasing_op)] fn bink2_idct(coeffs: &mut [i32; 64]) { let mut tmp: [i32; 64] = [0; 64]; for i in 0..8 { @@ -92,6 +93,7 @@ fn bink2_idct(coeffs: &mut [i32; 64]) { } } +#[allow(clippy::erasing_op)] fn bink2_idct_old(coeffs: &mut [f32; 64]) { let mut tmp: [f32; 64] = [0.0; 64]; coeffs[0] += 512.5; @@ -148,6 +150,7 @@ macro_rules! avg_tree { ($a: expr, $b: expr, $c: expr, $d: expr) => (avg_tree!(avg_tree!($a, $b), avg_tree!($c, $d))); } +#[allow(clippy::erasing_op)] impl Bink2DSP { fn calc_dc(src: &[u8], stride: usize) -> i32 { let mut sums = [0u16; 8]; @@ -1017,6 +1020,7 @@ struct Bink2Decoder { codes: Bink2Codes, } +#[allow(clippy::erasing_op)] impl Bink2Decoder { fn new() -> Self { Self::default() -- 2.39.5