BinomialLLC / basis_universal

Basis Universal GPU Texture Codec
Apache License 2.0
2.72k stars 267 forks source link

Lossless EAC R11 transcoding for solid color ETC1S #264

Open lexaknyazev opened 3 years ago

lexaknyazev commented 3 years ago

Currently the transcoder uses the same approach for generating solid-color EAC R11 blocks as for the solid-color EAC A8. This leads to a minor loss due to EAC R11 decoding process being slightly different.

Specifically, ETC1S value of 255/255 is converted to 2044/2047 instead of 2047/2047; ETC1S value of 0/255 is converted to 4/2047 instead of 0/2047.

To achieve lossless conversion within the 11-bit target precision, the table index and selectors would need to depend on the base codeword; the multiplier would be zero in this case.

richgel999 commented 3 years ago

Ok - I'll look more closely at this after our milestone is shipped. I believe we decode to 4/2047 and 2044/2047 (the center of the bins) purposely, but it's been a while since I looked at that code.