From fbbcafd4d8a992ef426efc7a2c1807746ed83ade Mon Sep 17 00:00:00 2001 From: awxkee Date: Sat, 5 Oct 2024 21:49:14 +0100 Subject: [PATCH] Hotfix fft --- Cargo.lock | 2 +- src/lib/Cargo.toml | 2 +- src/lib/filter2d/filter_2d_rgba_fft.rs | 4 +-- src/main.rs | 49 +++++++++++++------------- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b40ffd5..dbb4a4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -613,7 +613,7 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libblur" -version = "0.14.0" +version = "0.14.2" dependencies = [ "colorutils-rs", "erydanos", diff --git a/src/lib/Cargo.toml b/src/lib/Cargo.toml index 88aca74..1644742 100644 --- a/src/lib/Cargo.toml +++ b/src/lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libblur" -version = "0.14.1" +version = "0.14.2" edition = "2021" description = "Fast image blurring in pure Rust" readme = "../../README.md" diff --git a/src/lib/filter2d/filter_2d_rgba_fft.rs b/src/lib/filter2d/filter_2d_rgba_fft.rs index f6a6d5a..d945d1e 100644 --- a/src/lib/filter2d/filter_2d_rgba_fft.rs +++ b/src/lib/filter2d/filter_2d_rgba_fft.rs @@ -124,8 +124,8 @@ where let mut chanel_fourth = gather_channel::(src, image_size, 3); filter_2d_fft( - &chanel_third, - &mut chanel_fourth, + &chanel_fourth, + &mut working_channel, image_size, kernel, kernel_shape, diff --git a/src/main.rs b/src/main.rs index 426bfe6..8fea1a4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ mod split; use crate::merge::merge_channels_3; use crate::split::split_channels_3; use image::{EncodableLayout, GenericImageView, ImageReader}; -use libblur::{filter_1d_exact, filter_1d_rgb_approx, filter_1d_rgba_exact, filter_2d_rgb, filter_2d_rgb_fft, generate_motion_kernel, get_gaussian_kernel_1d, get_laplacian_kernel, get_sigma_size, laplacian, make_arena, motion_blur, sobel, ArenaPads, EdgeMode, FastBlurChannels, GaussianPreciseLevel, ImageSize, KernelShape, Scalar, ThreadingPolicy}; +use libblur::{filter_1d_exact, filter_1d_rgb_approx, filter_1d_rgba_exact, filter_2d_rgb, filter_2d_rgb_fft, filter_2d_rgba, filter_2d_rgba_fft, generate_motion_kernel, get_gaussian_kernel_1d, get_laplacian_kernel, get_sigma_size, laplacian, make_arena, motion_blur, sobel, ArenaPads, EdgeMode, FastBlurChannels, GaussianPreciseLevel, ImageSize, KernelShape, Scalar, ThreadingPolicy}; use std::time::Instant; #[allow(dead_code)] @@ -314,41 +314,40 @@ fn main() { // ) // .unwrap(); - motion_blur( - &bytes, - &mut dst_bytes, - ImageSize::new(dimensions.0 as usize, dimensions.1 as usize), - 90f32, - 75, - EdgeMode::Reflect101, - Scalar::default(), - FastBlurChannels::Channels4, - ThreadingPolicy::Adaptive, - ); - - // laplacian( + // motion_blur( // &bytes, // &mut dst_bytes, // ImageSize::new(dimensions.0 as usize, dimensions.1 as usize), - // EdgeMode::Clamp, + // 90f32, + // 75, + // EdgeMode::Reflect101, // Scalar::default(), - // FastBlurChannels::Channels3, + // FastBlurChannels::Channels4, // ThreadingPolicy::Adaptive, // ); - // - // let motion_kernel = generate_motion_kernel(225, 15.); - // - // filter_2d_rgb( + + // laplacian( // &bytes, // &mut dst_bytes, // ImageSize::new(dimensions.0 as usize, dimensions.1 as usize), - // &motion_kernel, - // KernelShape::new(225, 225), // EdgeMode::Clamp, - // Scalar::new(255.0, 0., 0., 255.0), + // Scalar::default(), + // FastBlurChannels::Channels3, // ThreadingPolicy::Adaptive, - // ) - // .unwrap(); + // ); + // + let motion_kernel = generate_motion_kernel(225, 15.); + + filter_2d_rgba_fft::( + &bytes, + &mut dst_bytes, + ImageSize::new(dimensions.0 as usize, dimensions.1 as usize), + &motion_kernel, + KernelShape::new(225, 225), + EdgeMode::Clamp, + Scalar::new(255.0, 0., 0., 255.0), + ) + .unwrap(); // // filter_2d_rgba_approx::(