Opencl / cpu maths part 5#20752
Merged
TurboGit merged 3 commits intodarktable-org:masterfrom Apr 6, 2026
Merged
Conversation
1. We make use of the __FAST_MATH__ (cpu) and __FAST_RELAXED_MATH__ (OpenCL) switches delivered by compiler options to switch between code paths performance vs precision. 2. deduplicated scharr operator code in OpenCL 3. made Y0 mask generation identical for OpenCL and CPU (slightly better performance here). 4. removed two unused functions in colorspace inline conversions
1. Instead of calculating 2*PI, PI/2 and PI/4 we use existing defines M_PI_2f M_PI_4f and introduce DT_2PI_F. 2. root(2.0) is replaced by M_SQRT2_F
Don't interpolate/mix where simpler maths will do it.
45a3eff to
1c287d3
Compare
ralfbrown
reviewed
Apr 6, 2026
| case DT_IOP_COLORZONES_h: | ||
| select = h; | ||
| blend = pow(1.0f - C/128.0f, 2.0f); | ||
| blend = dtcl_pow(1.0f - C/128.0f, 2.0f); |
Collaborator
There was a problem hiding this comment.
pow(x,2.0f) -> x*x, or sqf(x) in CPU path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make some more use of fast-maths switch
Code maintenance using predefined math defines
Color equalizer simplifications
Don't interpolate/mix where simpler maths will do it.
Nothing relevant while testing integration suite, here is the current (commented) status
Analysis.log