DirectXTex icon indicating copy to clipboard operation
DirectXTex copied to clipboard

New BC7 CPU encoder

Open elasota opened this issue 6 years ago • 6 comments

New BC7 CPU encoder, significantly improves speed and quality.

Uses a mix of existing techniques (PCA + k-means clustering/LLS refinement) and a new one that tries to trade index precision for endpoint precision, and processes 8 blocks at once using SSE2.

Based on benchmarks against every other BC7 compressor that I'm aware of (both existing DirectXTex encoders, FasTC, Intel ISPC Texture Compressor, NVTT, Compressonator, bc7_gpu), it's roughly tied for best quality with NVTT and Compressonator, but is about 35x as fast as both of those and 10x as fast as the existing BC7 CPU encoder.

elasota avatar Apr 05 '18 02:04 elasota

Thanks. I appreciate the work here and the contribution. I do need to take some time to review it in detail, and I'm a little concerned about the comingling of various licenses here (i.e. it's just not MIT).

walbourn avatar Apr 05 '18 16:04 walbourn

The Squish license and the Convection license are both MIT, so it's all one license.

elasota avatar Apr 05 '18 16:04 elasota

What exactly came from libsquish?

walbourn avatar Apr 05 '18 16:04 walbourn

Just the initial endpoint selector code (a.k.a. the EndpointSelectorRGB and EndpointSelectorRGBA).

It's just 8-round Power Method so it can probably be rewritten if that's a problem.

elasota avatar Apr 05 '18 17:04 elasota

Replaced the Squish dependency with a fresh implementation and fixed channel weighting in the process, merged in an important speed optimization. I think that should be it for any significant changes until review.

elasota avatar Apr 14 '18 04:04 elasota

Is this PR still in progress? It would be very useful on Linux

Edit: I just tried it. It is indeed way faster than the current version, but still 4-10 times slower than bc7_enc_rdo. So I will keep using the latter

Guekka avatar Jun 21 '23 09:06 Guekka