Skip to content

Optimize BC7 parity bit calculation - #83

Closed
Eric Lasota (elasota) wants to merge 1 commit into
microsoft:masterfrom
elasota:p-bit-optimize
Closed

Eric Lasota (elasota) wants to merge 1 commit into
microsoft:masterfrom
elasota:p-bit-optimize

Conversation

@elasota

Copy link
Copy Markdown
Contributor

Major speed optimization, reduces encode times with -bcmax in particular by more than half.

The current encoder solves parity bits by trying the block with every possible P-bit combination. Most of these combinations are redundant in partitioned modes because the P-bits are associated with independent subsets, so it can loop far fewer times by solving each subset separately instead of the entire block.

Mode 0 is the most affected, its loop count is reduced by a factor of 16.

@walbourn

Copy link
Copy Markdown
Collaborator

I'll be taking a look at this this week. I'm setting up a test run to validate quality/time between the two versions.

@elasota

Copy link
Copy Markdown
Contributor Author

This one should be producing identical output, you should be able to just compress a bunch of test images and compare their checksums.

@walbourn

Copy link
Copy Markdown
Collaborator

I'll take this PR once I have my BC validator test done... I've been focused on VS 2017 (15.7 update) and Windows 10 SDK (17134) the past month, so I'm getting back to this...

@walbourn

Copy link
Copy Markdown
Collaborator

Thanks again. Fixed in this commit

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

Labels

bc Related to DirectX Block Compression optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants