Fix AgX sigmoid contrast curve approximation #101406
Merged
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.
Not cherry-pickable to 4.3, as AgX is only in 4.4.
This changes the polynomial function so that a lower input always results in a lower output and vice-versa. Additionally, the new function returns a value that is much closer to
1.0
when given an input of1.0
.The polynomial regression for the AgX sigmoid contrast curve was my first attempt because I was rushed to get the change in before going on holiday. Upon review, I discovered a mistake that causes incorrect behavior in some cases.
Given:
For all values of
a
andb
in the range[0.0, 1.0
],x
should always be less thany
whena
is less thanb
.This is not the case with the current function in
master
for near-zero values. Additionally, when given an input of1.0
the current function returns1.00927498
when it should return1.0
.After having more time to fiddle with polynomial regression calculators, I generated a new formula that fits the logical requirements of a tonemapper’s contrast function and gives an output of
1.0001
when given an input of1.0
.This new function reduces banding in the transition from green to white in the Compatibility renderer: