Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

bug in DecodeEndpoints() #10

@richgel999

Description

@richgel999

Hi,
I've been comparing the output of astc-codec vs. another ASTC decoder from Google. I found a decoding issue with void extent blocks, where the output differs from what is expected by the ASTC spec in LDR mode when sRGB enabled. Here's the relevant code:

static std::vector DecodeEndpoints(const VoidExtentData& block) {
EndpointPair eps;
// Original code:
//eps.first[0] = eps.second[0] = (block.r * 255) / 65535;
//eps.first[1] = eps.second[1] = (block.g * 255) / 65535;
//eps.first[2] = eps.second[2] = (block.b * 255) / 65535;
//eps.first[3] = eps.second[3] = (block.a * 255) / 65535;

// Corrected code that generates the expected result with void extent blocks:
eps.first[0] = eps.second[0] = (block.r >> 8);
eps.first[1] = eps.second[1] = (block.g >> 8);
eps.first[2] = eps.second[2] = (block.b >> 8);
eps.first[3] = eps.second[3] = (block.a >> 8);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions