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

Add an Any white point #240

Merged
merged 1 commit into from
Jul 16, 2021
Merged

Add an Any white point #240

merged 1 commit into from
Jul 16, 2021

Conversation

Ogeon
Copy link
Owner

@Ogeon Ogeon commented Jul 16, 2021

This adds white_point::Any, which represents an unspecified white point. That makes it possible to remove a number of white point type parameters where they didn't matter or weren't used, other than to fill a hole in Xyz or Yxy types. This simplifies a lot of traits, removes ambiguity and presumably also reduces the amount of generated code.

Closed Issues

Breaking Change

  • Some places that would receive or return specific Xyz or Yxy types have been changed to use the Any white point. It's easy to cast between white points with the new with_white_point method.
  • WhitePoint and Primaries have been changed to be parametric over the number type, changing them toWhitePoint<T> and Primaries<T>.
  • RgbSpace, RgbStandard and LumaStandard have also been changed to RgbSpace<T>, RgbStandard<T> and LumaStandard<T> to be able to pass the type parameter on to WhitePoint and Primaries. Removing the trait bounds from the associated types would instead have required trait bounds in impls.

@Ogeon Ogeon force-pushed the white_point_rework branch from b9eaf0b to cd5c372 Compare July 16, 2021 13:06
@github-actions
Copy link

Benchmark for ae7647a

Click to view benchmark
Test PR Benchmark Master Benchmark %
Cie family/lab to lch 3.2±0.17µs 3.1±0.18µs +3.23%
Cie family/lab to xyz 907.4±53.26ns 870.6±55.41ns +4.23%
Cie family/lch to lab 2.8±0.15µs 2.8±0.09µs 0.00%
Cie family/linsrgb to xyz 3.9±0.21µs 3.6±0.20µs +8.33%
Cie family/xyz to lab 9.8±0.53µs 9.9±0.59µs -1.01%
Cie family/xyz to yxy 670.9±34.92ns 689.6±40.27ns -2.71%
Cie family/yxy to xyz 672.8±38.16ns 641.9±45.65ns +4.81%
Matrix functions/matrix_inverse 13.2±0.87ns 13.3±0.82ns -0.75%
Matrix functions/multiply_3x3 11.0±0.77ns 11.6±0.50ns -5.17%
Matrix functions/multiply_rgb_to_xyz 4.5±0.26ns 4.6±0.24ns -2.17%
Matrix functions/multiply_xyz 4.5±0.25ns 4.6±0.32ns -2.17%
Matrix functions/multiply_xyz_to_rgb 4.6±0.28ns 4.4±0.33ns +4.55%
Matrix functions/rgb_to_xyz_matrix 24.6±1.54ns 24.1±1.13ns +2.07%
Rgb family/hsl to hsv 758.3±39.01ns 818.1±80.57ns -7.31%
Rgb family/hsl to linear hsl 9.8±0.61µs 9.7±0.69µs +1.03%
Rgb family/hsl to rgb 2.3±0.19µs 2.4±0.19µs -4.17%
Rgb family/hsv to hsl 1115.4±73.08ns 1231.4±106.85ns -9.42%
Rgb family/hsv to hwb 283.9±28.62ns 290.0±23.94ns -2.10%
Rgb family/hsv to linear hsv 9.0±0.69µs 9.2±0.59µs -2.17%
Rgb family/hsv to rgb 2.2±0.13µs 2.4±0.15µs -8.33%
Rgb family/hwb to hsv 633.8±42.69ns 661.4±42.56ns -4.17%
Rgb family/hwb to linear hwb 10.7±0.77µs 10.4±0.60µs +2.88%
Rgb family/linear hsl to hsl 9.9±0.75µs 9.7±0.51µs +2.06%
Rgb family/linear hsv to hsv 9.3±0.50µs 9.4±0.35µs -1.06%
Rgb family/linear hwb to hwb 11.5±1.24µs 10.6±0.60µs +8.49%
Rgb family/linsrgb to rgb 4.8±0.33µs 4.9±0.50µs -2.04%
Rgb family/linsrgb_f32 to rgb_u8 6.5±0.47µs 6.4±0.28µs +1.56%
Rgb family/rgb to hsl 933.4±58.98ns 925.0±65.75ns +0.91%
Rgb family/rgb to hsv 694.6±110.80ns 706.9±33.23ns -1.74%
Rgb family/rgb to linsrgb 5.2±0.31µs 5.3±0.38µs -1.89%
Rgb family/rgb_u8 to linsrgb_f32 5.7±0.37µs 5.6±0.37µs +1.79%
Rgb family/xyz to linsrgb 7.0±0.48µs 7.2±0.39µs -2.78%

@Ogeon
Copy link
Owner Author

Ogeon commented Jul 16, 2021

bors r+

@bors
Copy link
Contributor

bors bot commented Jul 16, 2021

Build succeeded:

@bors bors bot merged commit e1546d0 into master Jul 16, 2021
@bors bors bot deleted the white_point_rework branch July 16, 2021 18:38
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.

Add an "anything" white point for agnostic CIE spaces
1 participant