Git Product home page Git Product logo

Comments (4)

fintelia avatar fintelia commented on September 26, 2024 1

I think that would be reasonable.

The uncompressed formats should be relatively straightforward and the texpresso crate supports BC1-BC5, so I it shouldn't be too difficult if you wanted to support those as well. But BC6H or BC7 or anything else would be more complicated

(There's actually also code for DXT compression in this crate, but it is both very slow and produces low quality output, so I'd really like to remove it...)

from image.

fintelia avatar fintelia commented on September 26, 2024 1

Yep. The process for decompressing DXT is deterministic* but compression is more complex. Each 4x4 block of pixels gets its assigned a shared set of parameters. Different choices of parameters will be better for some pixels in the 4x4 block and worse for others, so you generally want to search through a whole bunch of different options for them to see which is best overall. But searching all 2^32 (or closer to 2^64 for BC7!) options is very expensive, so you need to be smart about which to try

*It turns out different implementations use subtly different deterministic formulas for decoding.

from image.

drewcassidy avatar drewcassidy commented on September 26, 2024 1

Ive been doodling on a rust library for doing DXT compression (I already made one in C/Python), and there's a number of difficulties in doing it thats vastly different from other image formats.

The containers themselves have things like cube maps, mipmaps, image arrays, 3d textures, etc, which might be adaptable from the animation system here, but there's also things like how to handle alpha (is It premultiplied or not? it matters a lot if you're rescaling!) or the myriad of encoder settings that these block compression formats need. Some formats are 2-channel. some formats have 1-bit alpha. some formats are YUV

I don't think fitting it into image-rs is impossible, but the enum-based image format system kinda gets in the way. The sheer amount of code to make the encoders and decoders work well and quickly is probably better suited to a standalone library

from image.

JulianKnodt avatar JulianKnodt commented on September 26, 2024

is DXT compression not deterministic? I haven't actually looked into what it would take to implement.

from image.

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.