Improve quality of BC4 High by picking better starting endpoints #102
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.
This PR implements a minor optimization for Inter4 blocks.
Previously, it picked the starting endpoints (min/max) by ignoring values very close to 0 and 1 and getting the min/max of those. However, the threshold that defines "never" close is intentionally restrictive to ensure correctness, which can lead to some values like 0.999 not being mapped to 1 and picked as the max.
I fixed this in this PR by iteratively trying to pick lower and lower max values for the endpoint (and similarly, higher and higher min values). This successfully improves the quality of certain inter4 blocks.
Unfortunately, the quality gains are meager.
base.pnggained +0.1 dB, but that's an outliner. Most images gain around +0.01 dB from my testing. This comes at the cost of BC4 High now being +5% slower. Still worth it IMO.