Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Dec 6, 2021
1 parent d649a86 commit 3b91e42
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
8 changes: 4 additions & 4 deletions dssim-core/src/blur.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ const KERNEL: [f32; 9] = [

#[cfg(target_os = "macos")]
mod mac {
use imgref::*;
use crate::ffi::vImage_Buffer;
use crate::ffi::vImagePixelCount;
use super::KERNEL;
use crate::ffi::vImageConvolve_PlanarF;
use crate::ffi::vImagePixelCount;
use crate::ffi::vImage_Buffer;
use crate::ffi::vImage_Flags::kvImageEdgeExtend;
use super::KERNEL;
use imgref::*;

pub fn blur(src: ImgRef<'_, f32>, tmp: &mut [f32], mut dst: ImgRefMut<'_, f32>) {
let srcbuf = vImage_Buffer {
Expand Down
11 changes: 5 additions & 6 deletions dssim-core/src/dssim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
* If not, see <http://www.gnu.org/licenses/agpl.txt>.
*/


pub use crate::tolab::ToLABBitmap;
pub use crate::val::Dssim as Val;
use crate::blur;
use crate::image::*;
use crate::linear::ToRGBAPLU;
pub use crate::tolab::ToLABBitmap;
pub use crate::val::Dssim as Val;
use imgref::*;
use itertools::multizip;
use rayon::prelude::*;
Expand Down Expand Up @@ -264,7 +263,7 @@ impl Dssim {

all_sizes.insert(0, lab1);

return Some(DssimImage {
Some(DssimImage {
scale: all_sizes.into_par_iter().map(|s| {
DssimChanScale {
chan: s.into_par_iter().enumerate().map(|(n,l)| {
Expand All @@ -284,7 +283,7 @@ impl Dssim {
}).collect(),
}
}).collect(),
});
})
}

/// Compare original with another image. See `create_image`
Expand All @@ -308,7 +307,7 @@ impl Dssim {
|| Self::lab_chan(original_image_scale),
|| {
let img1_img2_blur = original_image_scale.chan.img1_img2_blur(&modified_image_scale.chan, &mut tmp[0 .. scale_width*scale_height]);
(img1_img2_blur, Self::lab_chan(&modified_image_scale))
(img1_img2_blur, Self::lab_chan(modified_image_scale))
});

Self::compare_scale(&original_lab, &modified_lab, &img1_img2_blur)
Expand Down
2 changes: 2 additions & 0 deletions dssim-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//! support several pixel types. It also allows replacing some parts of the algorithm with different implementations
//! (if you need higher accuracy or higher speed).
#![doc(html_logo_url = "https://kornel.ski/dssim/logo.png")]
#![allow(clippy::manual_range_contains)]
#![allow(clippy::new_without_default)]

mod blur;
mod c_api;
Expand Down
4 changes: 2 additions & 2 deletions dssim-core/src/linear.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::image::RGBAPLU;
use crate::image::RGBLU;
use rgb::*;
use rgb::alt::*;
use rgb::*;

/// See `GammaPixel` & `ToRGBAPLU`
pub trait GammaComponent {
Expand Down Expand Up @@ -144,7 +144,7 @@ impl<M> GammaPixel for GrayAlpha<M> where M: Copy + Clone + Into<f32> + GammaCom
type Component = M;
type Output = RGBAPLU;
fn to_linear(&self, gamma_lut: &M::Lut) -> RGBAPLU {
let a_unit = self.1.clone().into() / M::max_value() as f32;
let a_unit = self.1.into() / M::max_value() as f32;
let g = self.0.to_linear(gamma_lut);
RGBAPLU {
r: g * a_unit,
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! See the [dssim-core](https://lib.rs/dssim-core) crate if you'd like to use only the library part.
#![doc(html_logo_url = "https://kornel.ski/dssim/logo.png")]
#![allow(clippy::manual_range_contains)]

pub use dssim_core::*;
use imgref::*;
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the license along with DSSIM.
* If not, see <http://www.gnu.org/licenses/agpl.txt>.
*/

#![allow(clippy::manual_range_contains)]
use getopts::Options;
use rayon::prelude::*;
use std::env;
Expand Down

0 comments on commit 3b91e42

Please sign in to comment.