#color-space #color-conversion #color #xyz #format-conversion #lab #hsv

colorutils-rs

High performance utilities for color format handling and conversion

59 releases (6 breaking)

new 0.7.3 Nov 13, 2024
0.6.1 Oct 9, 2024
0.5.5 Jul 25, 2024

#342 in Video

Download history 359/week @ 2024-07-29 199/week @ 2024-08-05 61/week @ 2024-08-12 41/week @ 2024-08-19 14/week @ 2024-08-26 28/week @ 2024-09-02 44/week @ 2024-09-09 327/week @ 2024-09-16 604/week @ 2024-09-23 137/week @ 2024-09-30 697/week @ 2024-10-07 589/week @ 2024-10-14 197/week @ 2024-10-21 104/week @ 2024-10-28 281/week @ 2024-11-04 211/week @ 2024-11-11

829 downloads per month
Used in 5 crates (4 directly)

BSD-3-Clause OR Apache-2.0

770KB
19K SLoC

Rust utilities for color handling and conversion.

The goal is to provide support for common conversion and SIMD options for most common conversion path for high-performance

Available SIMD fast paths generally 5-10 times faster than naive implementations

Allows conversion between

  • Rgb/Rgba/Rgba1010102/Rgb565/RgbF16
  • HSL
  • HSV
  • CIE LAB
  • CIE LUV
  • CIE LCh
  • XYZ
  • Sigmoidal
  • Oklab
  • Oklch
  • Jzazbz
  • Jzczhz
  • lαβ (l-alpha-beta)
  • XYB

Performance

There are some prebuilt functions for ex.

srgb_to_lab(src_bytes, width * components, &mut lab_store, width * 3 * std::mem::size_of::<f32>() as u32, width, height);

Prebuilt solutions ~3-5 times faster than naive implementation. If your case fits that you prebuilt function. Speed increasing done with AVX, NEON and SSE, if you are disabled or not using CPU with this features then you won't receive any benefits.

Also, fma target feature for x86-64 is available.

Target feature at compile time +avx2 must be activated to properly compile avx2 instructions. This is an important step even when runtime dispatch are used.

This project is licensed under either of

  • BSD-3-Clause License (see LICENSE)
  • Apache License, Version 2.0 (see LICENSE)

at your option.

Dependencies

~2MB
~44K SLoC