Skip to content

Conversation

@AnriTool
Copy link
Contributor

Removed dxt-js. Decompression of DXT, as well as conversion of different palettes and raster formats is done through a helper class.

Based on: DragonFF/blob/master/gtaLib/txd.py

jest TXD test - passes successfully

Tested on canvas in browser

txd - files filled through MagicTxd selecting different formats and versions (only PC GTA III/VC/SA)

@AnriTool
Copy link
Contributor Author

maybe try to describe the code more explicitly, and add comments in order to make it more clear how the algorithms work?

@Timic3
Copy link
Owner

Timic3 commented Jun 12, 2025

Hey, thanks for the PR, the code looks great! You can add documentation on how the code works, but it's not that critical. Do it only if you have time. :)

Also, I would do some benchmarks and check the difference between dxt-js and your own implementation. If dxt-js is faster, then people might prefer to sacrifice bundle size and use it to speed up parsing. In this case, dxt-js would be added to optionalDependencies and would not get installed by default. Of course, dxt-js will then be imported and used only if it is installed. If performance is negligible, then this isn't really needed.

@Timic3 Timic3 linked an issue Jun 12, 2025 that may be closed by this pull request
@Timic3 Timic3 requested review from MegadreamsBE and Timic3 June 12, 2025 18:46
@AnriTool
Copy link
Contributor Author

lso, I would do some benchmarks and check the difference between dxt-js and your own implementation.

Ok, well, I wonder how strong the differences are, I'll do performance tests.
Should I mark the request as draft for now?

@Timic3
Copy link
Owner

Timic3 commented Jun 12, 2025

Should I mark the request as draft for now?

Not needed, I think it's fine the way it is, just some research regarding performance is required.

Thanks :)

@AnriTool
Copy link
Contributor Author

AnriTool commented Jun 15, 2025

@Timic3 I ran speed tests and the result was not comforting. The code was very slow.

After that I made some optimizations and fixes (dxt4/dxt5 implementation had artifacts)
And now the performance is decent!

How the testing was done:
I ran decoding 1024x1024 images dxt1, dxt3, dxt5, 1000 times, 10 iterations.

Comparative table:
The table shows decoding time of 1000 images (input data is always the same), in ms
image

result screen with opacity

Copy link
Owner

@Timic3 Timic3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! Everything looks good, just one minor change.

@AnriTool AnriTool requested a review from Timic3 June 15, 2025 13:06
@Timic3
Copy link
Owner

Timic3 commented Jun 16, 2025

Looks good, we can add tests in another PR.

Thanks for the contribution!

@Timic3 Timic3 merged commit b4d0812 into Timic3:master Jun 16, 2025
1 check passed
@Timic3
Copy link
Owner

Timic3 commented Jun 16, 2025

I will make a release once I get home.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Library dxt-js as optional dependency

2 participants