jansol / texpresso

A pure Rust texture compression suite
28 stars 2 forks source link

Fix decompression for images that have a height which is more than one block and not a multiple of 4 #9

Closed chieltbest closed 1 month ago

chieltbest commented 4 months ago

The bounds checks for decompression seem to have been copied over from the compression algorithm, but the check has changed because of the block size division

jansol commented 3 months ago

Thanks for pointing this out! Would you happen to have a small test file that could be added to lib/src/test_data.rs so we can keep an eye on this case in the test suite?

Aerocatia commented 1 month ago

I can confirm this with the following compressed bytes (dxt1, made with libsquish) 8E 73 71 8C AA AA AA AA 8E 73 71 8C AA AA FF FF It should decompress to 4x6 with each pixel being 0x7F7F7F.

jansol commented 1 month ago

Awesome, thanks! I'll merge this and add a regression test with that data when I get to my PC which has the appropriate dev setup (might not happen until next week).

jansol commented 1 month ago

Sorry, ended up bike shedding a bit more on the actual test implementation than I had planned.