Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lift linearity restriction for Rgb and Luma and update docs #302

Merged
merged 1 commit into from
Jan 16, 2023

Conversation

Ogeon
Copy link
Owner

@Ogeon Ogeon commented Jan 15, 2023

This removes the requirement that Rgb and Luma colors have to be linear for arithmetic operators and a few other traits to be available. There are many cases where non-linear colors are fine (or even required) and hard blocking them ended up being a bit too harsh.

The crate root documentation is also updated to hopefully be a bit more usage oriented and give more useful examples up-front.

@Ogeon Ogeon changed the title Lift linearity restriction for Rgb and Luma and update docs Lift linearity restriction for Rgb and Luma and update docs Jan 15, 2023
@github-actions
Copy link

Benchmark for 9a83392

Click to view benchmark
Test Base PR %
Cie family/lab to lch 2.2±0.01µs 2.2±0.04µs 0.00%
Cie family/lab to xyz 547.8±4.19ns 550.3±5.40ns +0.46%
Cie family/lch to lab 1696.8±11.99ns 1704.3±25.26ns +0.44%
Cie family/linsrgb to xyz 3.1±0.02µs 3.1±0.03µs 0.00%
Cie family/linsrgb to xyz - wide::f32x8 543.6±3.86ns 557.4±2.96ns +2.54%
Cie family/xyz to lab 15.1±0.08µs 15.2±0.17µs +0.66%
Cie family/xyz to yxy 470.2±3.05ns 469.3±3.12ns -0.19%
Cie family/yxy to xyz 378.2±2.21ns 378.3±2.83ns +0.03%
Matrix functions/matrix_inverse 8.2±0.04ns 8.3±0.16ns +1.22%
Matrix functions/multiply_3x3 7.5±0.04ns 7.5±0.06ns 0.00%
Matrix functions/multiply_rgb_to_xyz 4.6±0.03ns 4.6±0.21ns 0.00%
Matrix functions/multiply_xyz 4.6±0.04ns 4.6±0.03ns 0.00%
Matrix functions/multiply_xyz_to_rgb 4.6±0.03ns 4.6±0.03ns 0.00%
Matrix functions/rgb_to_xyz_matrix 21.5±0.17ns 21.5±0.10ns 0.00%
Rgb family/hsl to hsv 460.7±3.20ns 461.0±4.73ns +0.07%
Rgb family/hsl to linear hsl 9.4±0.05µs 9.1±0.06µs -3.19%
Rgb family/hsl to rgb 1457.1±9.42ns 1422.8±12.01ns -2.35%
Rgb family/hsv to hsl 606.4±9.61ns 606.8±9.82ns +0.07%
Rgb family/hsv to hwb 162.3±1.46ns 159.9±1.09ns -1.48%
Rgb family/hsv to linear hsv 8.8±0.07µs 8.7±0.05µs -1.14%
Rgb family/hsv to rgb 1350.0±10.43ns 1326.6±8.36ns -1.73%
Rgb family/hwb to hsv 334.2±3.87ns 333.2±3.78ns -0.30%
Rgb family/hwb to linear hwb 9.1±0.05µs 9.2±0.06µs +1.10%
Rgb family/linear hsl to hsl 7.6±0.04µs 7.7±0.07µs +1.32%
Rgb family/linear hsv to hsv 7.2±0.05µs 7.2±0.06µs 0.00%
Rgb family/linear hwb to hwb 7.7±0.07µs 7.7±0.04µs 0.00%
Rgb family/linsrgb to rgb 3.9±0.03µs 3.9±0.03µs 0.00%
Rgb family/linsrgb to rgb - wide::f32x8 5.3±0.03µs 5.3±0.04µs 0.00%
Rgb family/linsrgb_f32 to rgb_u8 654.4±24.03ns 650.4±4.02ns -0.61%
Rgb family/linsrgb_f64 to rgb_u8 835.2±4.63ns 839.8±5.50ns +0.55%
Rgb family/rgb to hsl 568.7±2.63ns 572.5±19.95ns +0.67%
Rgb family/rgb to hsl - wide::f32x8 353.9±1.91ns 355.0±2.57ns +0.31%
Rgb family/rgb to hsv 362.3±3.56ns 357.5±7.09ns -1.32%
Rgb family/rgb to hsv - wide::f32x8 315.7±2.13ns 315.9±1.64ns +0.06%
Rgb family/rgb to linsrgb 5.3±0.05µs 5.4±0.06µs +1.89%
Rgb family/rgb to linsrgb - wide::f32x8 4.0±0.04µs 4.0±0.04µs 0.00%
Rgb family/rgb_u8 to linsrgb_f32 235.2±3.67ns 235.5±3.58ns +0.13%
Rgb family/rgb_u8 to linsrgb_f64 237.0±6.89ns 236.3±1.43ns -0.30%
Rgb family/xyz to linsrgb 5.7±0.13µs 5.9±0.04µs +3.51%
Rgb family/xyz to linsrgb - wide::f32x8 892.0±8.05ns 892.4±5.90ns +0.04%

@Ogeon
Copy link
Owner Author

Ogeon commented Jan 16, 2023

bors r+

@bors
Copy link
Contributor

bors bot commented Jan 16, 2023

Build succeeded:

@bors bors bot merged commit a81d3e9 into master Jan 16, 2023
@bors bors bot deleted the remove_linear_requirement branch January 16, 2023 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant