Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
elbertronnie committed Oct 14, 2024
1 parent 4b066dc commit fdfe2e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
1 change: 0 additions & 1 deletion libraries/raw-rs/src/metadata/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pub mod camera_data;
pub mod identify;

13 changes: 3 additions & 10 deletions libraries/raw-rs/src/preprocessing/scale_to_16bit.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{RawImage, SubtractBlack, RawPixel};
use crate::{RawImage, RawPixel, SubtractBlack};

impl RawImage {
pub fn scale_to_16bit_fn(&self) -> impl Fn(RawPixel) -> u16 {
Expand All @@ -8,15 +8,8 @@ impl RawImage {
};

let maximum = self.maximum - black_level.iter().max().unwrap();
let scale_to_16bit_multiplier = if maximum > 0 {
u16::MAX as f64 / maximum as f64
} else {
1.
};
let scale_to_16bit_multiplier = if maximum > 0 { u16::MAX as f64 / maximum as f64 } else { 1. };

move |pixel: RawPixel| {
((pixel.value as f64) * scale_to_16bit_multiplier).min(u16::MAX as f64).max(0.) as u16
}
move |pixel: RawPixel| ((pixel.value as f64) * scale_to_16bit_multiplier).min(u16::MAX as f64).max(0.) as u16
}
}

0 comments on commit fdfe2e9

Please sign in to comment.