Skip to content

Commit

Permalink
Fix bug in blur, added sigmoidal color space
Browse files Browse the repository at this point in the history
  • Loading branch information
awxkee committed Jun 15, 2024
1 parent 379701b commit efcee65
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 34 deletions.
14 changes: 7 additions & 7 deletions aire-filters/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions aire-filters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ pub use surface_type::aire_reformat_surface_u8_to_luva;

mod android_bitmap;
mod bitmap_helper;
mod blur;
mod equalize_hist;
mod histogram;
mod surface_type;
mod hists;
mod blur;
mod surface_type;

#[cfg(target_os = "android")]
#[allow(non_snake_case)]
pub mod android {
extern crate jni;

use jni::JNIEnv;
use jni::objects::JObject;
use jni::sys::{jint, jobject};
use jni::JNIEnv;
use pic_scale::{
ImageSize, ImageStore, LabScaler, LinearScaler, LuvScaler, ResamplingFunction, Scaler,
Scaling, ThreadingPolicy,
Scaling, SigmoidalScaler, ThreadingPolicy,
};

use crate::android_bitmap::copy_image;
Expand Down Expand Up @@ -66,6 +66,7 @@ pub mod android {
1 => Box::new(LabScaler::new(resampling)),
2 => Box::new(LinearScaler::new(resampling)),
3 => Box::new(LuvScaler::new(resampling)),
4 => Box::new(SigmoidalScaler::new(resampling)),
_ => {
let clazz = env
.find_class("java/lang/Exception")
Expand Down
Binary file modified aire/src/main/cpp/lib/arm64-v8a/libaire_filters.so
Binary file not shown.
Binary file modified aire/src/main/cpp/lib/armeabi-v7a/libaire_filters.so
Binary file not shown.
Binary file modified aire/src/main/cpp/lib/x86/libaire_filters.so
Binary file not shown.
Binary file modified aire/src/main/cpp/lib/x86_64/libaire_filters.so
Binary file not shown.
3 changes: 2 additions & 1 deletion aire/src/main/java/com/awxkee/aire/ScaleColorSpace.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ enum class ScaleColorSpace(internal val value: Int) {
SRGB(0),
LAB(1),
LINEAR(2),
LUV(3)
LUV(3),
SIGMOIDAL(4),
}
56 changes: 34 additions & 22 deletions app/src/main/java/com/awxkee/aire/desktop/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,39 +53,51 @@ class MainActivity : ComponentActivity() {
// imagesArray.add(bitmap)
// }
//
// delay(2000L)

// var radius = 75
//// delay(2000L)
//
//// var radius = 75
////
//// var time = measureTimeMillis {
//// val image = Aire.gaussianBlur(bitmap, radius, radius.toFloat() / 6f, EdgeMode.CLAMP)
//// scope.launch {
//// imagesArray.add(image)
//// }
//// }
//// Log.d("AireMedian", "Blur timing gaussianBlur done in ${time}ms")
//// time = measureTimeMillis {
//// val image = Aire.gaussianBlur(bitmap, radius, radius.toFloat() / 6f, EdgeMode.KERNEL_CLIP)
//// scope.launch {
//// imagesArray.add(image)
//// }
//// }
//// Log.d("AireMedian", "Blur timing gaussianBlur done in ${time}ms")
// var time = measureTimeMillis {
// val image = Aire.gaussianBlur(bitmap, radius, radius.toFloat() / 6f, EdgeMode.CLAMP)
// scope.launch {
// imagesArray.add(image)
// }
// }
// Log.d("AireMedian", "Blur timing gaussianBlur done in ${time}ms")
// time = measureTimeMillis {
// val image = Aire.gaussianBlur(bitmap, radius, radius.toFloat() / 6f, EdgeMode.KERNEL_CLIP)
// scope.launch {
// imagesArray.add(image)
// }
// }
// Log.d("AireMedian", "Blur timing gaussianBlur done in ${time}ms")
// time = measureTimeMillis {
// val image = Aire.gaussianBlur(bitmap, radius, radius.toFloat() / 6f, EdgeMode.WRAP)
// val image = Aire.scale(
// bitmap,
// bitmap.width / 4,
// bitmap.height / 4,
// ResizeFunction.EwaRobidoux,
// ScaleColorSpace.SIGMOIDAL
// )
// scope.launch {
// imagesArray.add(image)
// }
// }
// Log.d("AireMedian", "Blur timing gaussianBlur done in ${time}ms")
// Log.d("AireMedian", "Blur timing SIGMOIDAL done in ${time}ms")
// time = measureTimeMillis {
// val image = Aire.stackBlur(bitmap, radius)
// val image = Aire.scale(
// bitmap,
// bitmap.width / 4,
// bitmap.height / 4,
// ResizeFunction.EwaRobidoux,
// ScaleColorSpace.LUV
// )
// scope.launch {
// imagesArray.add(image)
// }
// }
// Log.d("AireMedian", "Blur timing gaussianBlur done in ${time}ms")
//
// Log.d("AireMedian", "Blur timing LUV done in ${time}ms")
////
// time = measureTimeMillis {
// val image = Aire.stackBlur(bitmap, radius)
// scope.launch {
Expand Down

0 comments on commit efcee65

Please sign in to comment.