Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New BC7 CPU encoder #86

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

elasota
Copy link
Contributor

@elasota elasota commented Apr 5, 2018

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.

@walbourn
Copy link
Member

walbourn commented Apr 5, 2018

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).

@elasota
Copy link
Contributor Author

elasota commented Apr 5, 2018

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

@walbourn
Copy link
Member

walbourn commented Apr 5, 2018

What exactly came from libsquish?

@elasota
Copy link
Contributor Author

elasota commented Apr 5, 2018

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.

… moved the many safe-denominator switches to a function, fixed a bunch of math to handle channel weights more accurately.
@elasota
Copy link
Contributor Author

elasota commented Apr 14, 2018

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.

@Guekka
Copy link

Guekka commented Jun 21, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants