Coder Social home page Coder Social logo

Comments (1)

solidpixel avatar solidpixel commented on August 14, 2024

Triage notes:

  • Bug isn't a regression; it's always been broken
  • Only impacts sRGB constant color blocks

Cause is this bit of code:

int mask = (decode_mode == DECODE_LDR_SRGB) ? 0xFF00 : 0xFFFF;
...
alpha = sf16_to_float(unorm16_to_sf16(scb->constant_color[3] & mask));

... applying the 0xFF00 mask results in a 0.996 (254) floating point value. In real hardware decode this isn't a bug - the top 8 bits are sent off to a sRGB-to-linear conversion unit which would handle this correctly. However, the reference compressor doesn't linearize (we want to write sRGB encoded data back into the output texture) so when using the entire 16-bit result the loss of precision seeps though into the output.

For textures compressed with astcenc itself we'd be safe just removing the masking, but we've got no guarantee that another compressor writes anything sensible into those bottom 8 bits. The correct fix is therefore to take the top 8 bits and rescale them to fill the whole 16-bit range (replicate the top 8 bits in the bottom 8).

from astc-encoder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.