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 conversion matrix and Convert{Once} traits #406

Merged
merged 1 commit into from
Aug 1, 2024
Merged

Conversation

Ogeon
Copy link
Owner

@Ogeon Ogeon commented Jul 31, 2024

Adds a few basic tools for reusable converters, similar to what's discussed in #396:

  • convert::Matrix3, which represents a 3x3 conversion matrix from one type to another. It may speed up multi-step conversions that can be simplified as a single matrix.
  • convert::Convert and convert::ConvertOnce traits for abstracting over types that can convert other types, similar to Fn and FnOnce in relation to each other. They are implemented by convert::Matrix3 and cam16::BakedParameters.
  • Rgb::matrix_from_xyz, Xyz::matrix_from_rgb, Xyz::matrix_from_lms and Lms::matrix_from_xyz as initial building blocks for composing conversion matrices.

Some old matrix code has also been cleaned up or replaced. The matrix module is not considered public, so its content should not be relied upon.

@Ogeon Ogeon force-pushed the conversion_matrix branch from 8093752 to 808c070 Compare July 31, 2024 15:00
Copy link

codspeed-hq bot commented Jul 31, 2024

CodSpeed Performance Report

Merging #406 will degrade performances by 11.73%

Comparing conversion_matrix (b907852) with master (7971660)

Summary

❌ 1 regressions
✅ 42 untouched benchmarks

🆕 4 new benchmarks
⁉️ 3 (👁 3) dropped benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark master conversion_matrix Change
🆕 linsrgb to xyz - Matrix3 N/A 5.9 µs N/A
matrix_inverse 438.9 ns 497.2 ns -11.73%
👁 multiply_rgb_to_xyz 0 s N/A N/A
👁 multiply_xyz 0 s N/A N/A
👁 multiply_xyz_to_rgb 0 s N/A N/A
🆕 lms to linsrgb N/A 3.2 µs N/A
🆕 lms to linsrgb - Matrix3 N/A 2.2 µs N/A
🆕 xyz to linsrgb - Matrix3 N/A 5.9 µs N/A

Copy link

codecov bot commented Jul 31, 2024

Codecov Report

Attention: Patch coverage is 87.87879% with 36 lines in your changes missing coverage. Please review.

Project coverage is 82.62%. Comparing base (7971660) to head (b907852).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #406      +/-   ##
==========================================
- Coverage   82.66%   82.62%   -0.04%     
==========================================
  Files         127      128       +1     
  Lines       19539    19688     +149     
  Branches    19539    19688     +149     
==========================================
+ Hits        16151    16267     +116     
- Misses       3285     3315      +30     
- Partials      103      106       +3     
Components Coverage Δ
palette 82.67% <87.87%> (-0.04%) ⬇️
palette_derive 81.98% <ø> (ø)

@Ogeon Ogeon force-pushed the conversion_matrix branch 2 times, most recently from 29eccde to 784e3b3 Compare July 31, 2024 15:18
@Ogeon Ogeon force-pushed the conversion_matrix branch from 784e3b3 to b907852 Compare August 1, 2024 09:58
@Ogeon Ogeon merged commit 0a69512 into master Aug 1, 2024
17 of 20 checks passed
@Ogeon Ogeon deleted the conversion_matrix branch August 1, 2024 10:13
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