Connect to the BC6 decoding from Python #1
Closed
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.
Helps python-pillow#6449
Two changes here.
After this PR, with your code as well,
gives
bc6_finalize
for unsigned data.As per the comment in the code, the
half_to_float
function is taken from https://gist.github.com/rygorous/2144712. It ishalf_to_float_fast5
. Except, that code is for converting FP16 into FP32. FP16 has 1 sign bit, 5 exponent bits and then 10 bits for the fraction. Unsigned BC6H has 5 exponent bits and then 11 bits for the fraction. So instead of scaling it down from 65535 to 31743, I'm just scaling it down to 255.