ARM-software / astc-encoder

The Arm ASTC Encoder, a compressor for the Adaptive Scalable Texture Compression data format.
https://developer.arm.com/graphics
Apache License 2.0
1.07k stars 238 forks source link

Investigate ASTC RDO #361

Open solidpixel opened 2 years ago

solidpixel commented 2 years ago

There is some interest in rate distortion optimization to improve compressibility of ASTC textures in application package bundles for download.

Approaches

The first option would be an in-situ RDO, where the output is still valid ASTC data. This is transparent to the application, which is a major advantage, but harder to pull off (especially given the packed variable-length scrambled BISE encoding used by ASTC).

The second option would be a repack RDO, where we transcode into a light-weight packaging format. This is not transparent - the application must unpack at load time - but gives opportunity to systematically target inefficiency in the encoding. One particular strength of this approach is that we can use data tables that are built into the encoder/decoder rather than wasting bits based on dynamic tables built into the compressed stream.

In both cases it can be an advantage to add an RDO mode to the compressor, where it knows that its output will be post-processed by an RDO compressor and so tries to constrain the raw encodings to values that are more amenable to RDO compression.

Inefficiencies we can target

Static inefficiencies are those that are invariant of the texture being compressed. Dynamic inefficiencies are those that may be relevant for some types of data.

Other random ideas

Links to other projects

YunHsiao commented 7 months ago

Here's one possible way to do it: https://github.com/ARM-software/astc-encoder/compare/4.7.0...YunHsiao:astc-encoder:rdo

Still got some rough edges to be ironed out but feel free to work on top of it.