compressonator icon indicating copy to clipboard operation
compressonator copied to clipboard

Imprecise BC6H interpolation

Open lexaknyazev opened this issue 3 years ago • 4 comments

Consider the first pixel of this BC6H block (Mode 3, unsigned)

23 0F 00 00 00 00 00 00 04 00 00 00 00 00 00 00

Following the spec, we get:

  • RGB_0: (121, 0, 0)
  • RGB_1: (0, 0, 0)
  • Weight_0: 2

After unquantization:

  • RGB_0_unq: (7776, 0, 0)
  • RGB_1_unq: (0, 0, 0)
  • Weight_0_unq: 9

Interpolation & final unquantization (red channel):

((64 - 9) * 7776 + 9 * 0 + 32) >> 6 = 6683
(6683 * 31) >> 6 = 3237 (0x0CA5)

Compressonator (4.0.4855) decodes that value as 0x0CA4.

lexaknyazev avatar Sep 20 '20 18:09 lexaknyazev

@lexaknyazev what decoder API are you using Compressonators LIB or CMP_Core?

NPCompress avatar Sep 20 '20 18:09 NPCompress

I simply run

> CompressonatorCLI.exe input.dds output.dds

lexaknyazev avatar Sep 20 '20 18:09 lexaknyazev

FWIW, this command gives precise results:

> CompressonatorCLI.exe -UseGPUDecompress -DecodeWith DirectX input.dds output.dds

lexaknyazev avatar Sep 20 '20 19:09 lexaknyazev

@lexaknyazev Thanks for providing the updated info.

NPCompress avatar Sep 20 '20 20:09 NPCompress