Skip to content

Commit

Permalink
Started working on LCh, refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
awxkee committed Jun 17, 2024
1 parent c92719f commit 6246138
Show file tree
Hide file tree
Showing 21 changed files with 1,022 additions and 541 deletions.
4 changes: 2 additions & 2 deletions src/app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn main() {
lab_store.resize(width as usize * components * height as usize, 0f32);
let src_stride = width * components as u32;
let start_time = Instant::now();
rgb_to_sigmoidal(
rgb_to_lch(
src_bytes,
src_stride,
&mut lab_store,
Expand Down Expand Up @@ -92,7 +92,7 @@ fn main() {
// }

let start_time = Instant::now();
sigmoidal_to_rgb(
lch_to_rgb(
&lab_store,
store_stride as u32,
&mut dst_slice,
Expand Down
12 changes: 8 additions & 4 deletions src/image_to_sigmoidal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,16 @@ fn image_to_sigmoidal<const CHANNELS_CONFIGURATION: u8, const USE_ALPHA: bool>(
let px = x * channels;
let src = unsafe { src_ptr.add(px) };
let r = unsafe {
src.add(image_configuration.get_r_channel_offset()).read_unaligned()
src.add(image_configuration.get_r_channel_offset())
.read_unaligned()
};
let g = unsafe {
src.add(image_configuration.get_g_channel_offset()).read_unaligned()
src.add(image_configuration.get_g_channel_offset())
.read_unaligned()
};
let b = unsafe {
src.add(image_configuration.get_b_channel_offset()).read_unaligned()
src.add(image_configuration.get_b_channel_offset())
.read_unaligned()
};

let rgb = Rgb::<u8>::new(r, g, b);
Expand All @@ -135,7 +138,8 @@ fn image_to_sigmoidal<const CHANNELS_CONFIGURATION: u8, const USE_ALPHA: bool>(

if image_configuration.has_alpha() {
let a = unsafe {
src.add(image_configuration.get_a_channel_offset()).read_unaligned()
src.add(image_configuration.get_a_channel_offset())
.read_unaligned()
} as f32
* COLOR_SCALE;

Expand Down
Loading

0 comments on commit 6246138

Please sign in to comment.