Use powf instead of pow when building the gamma LUT - #287
Open
afonsojanu wants to merge 1 commit into
Open
afonsojanu wants to merge 1 commit into
afonsojanu wants to merge 1 commit into
Conversation
All the values going into this call are float, but pow() pulls in the double-precision exp/log tables anyway, which costs almost 10KB of extra binary size on some platforms for no benefit. Switched to powf() so it stays on the float LUTs the rest of the file already uses. Checked the resulting gamma_lut entries against the old code across a wide range of gamma values and they come out identical.
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.
Closes #282.
Every value going into this call is already a
float(i,max,exponentare all float), but the code calls the double-precisionpow()anyway. That pulls in the doubleexp/logLUTs, adding close to 10KB to the binary on platforms where the double and float math paths aren't otherwise linked in, even though the rest of this codebase already sticks topowf/expf-style float math where it can.Swapped it for
powf(). I checked the resultinggamma_lutvalues against the old code across a wide range of gamma settings (both the 8-bit and 16-bit LUT sizes) and every entry comes out identical, so this is purely a code-size/perf change, no behavior difference.Built with meson (
-Db_sanitize=address,undefined) and ran the test suite before and after: 165 passing / 41 expected-fail / 2 failing, same numbers on both, and the 2 failures (ch1n3p04,ch2n3p08) reproduce identically on unmodified master, unrelated to this change.