Implement support for ASTC compressed KTX textures#37
Implement support for ASTC compressed KTX textures#37Erik-White wants to merge 10 commits intoSixLabors:mainfrom
Conversation
| *.dds filter=lfs diff=lfs merge=lfs -text | ||
| *.ktx filter=lfs diff=lfs merge=lfs -text | ||
| *.ktx2 filter=lfs diff=lfs merge=lfs -text | ||
| *.astc filter=lfs diff=lfs merge=lfs -text |
There was a problem hiding this comment.
This keeps getting overwritten by a target that copies gitattributes from the shared project, so I will need to update it there as well
There was a problem hiding this comment.
Here's the repo that manages that. It's loaded as a sub repository
There was a problem hiding this comment.
I opened a PR there to upstream the change SixLabors/SharedInfrastructure#56
| return (ulong)FloatHelper.PackFloatToFloat16(vector.X) | ||
| | ((ulong)FloatHelper.PackFloatToFloat16(vector.Y) << 16) | ||
| | ((ulong)FloatHelper.PackFloatToFloat16(vector.Z) << 32) | ||
| | ((ulong)FloatHelper.PackFloatToFloat16(vector.W) << 48); |
There was a problem hiding this comment.
Casting to unit could result in an overflow when shifting. Widening to a long allows for correct shifting without overflow
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net10.0</TargetFramework> |
There was a problem hiding this comment.
AstcEncoderCSharp only supports .NET10 so I kept this in a separate test project. It is very useful to be able to compare output directly with the ARM implementation.
| using SixLabors.ImageSharp.Textures.Tests.TestUtilities.Attributes; | ||
| using SixLabors.ImageSharp.Textures.Tests.TestUtilities.TextureProviders; | ||
|
|
||
| namespace SixLabors.ImageSharp.Textures.Tests.Formats.Astc.HDR; |
There was a problem hiding this comment.
I wasn't quite sure whether to use uppercase or title case (HDR vs Hdr) for this namespace. Title case is mostly used elsewhere, but there are some exceptions like IO
|
@brianpopow Hopefully this is now structured in a way that fits well with rest of the project. I'm afraid that it ends up being a massive PR though, mainly due to the complexity of ASTC. |
Thank @Erik-White for your effort here, it is highly appreciated, it really is a huge PR. If the reference to AstcSharp is removed now, I think this is now mergeable. Unfortunately I do not have the capacity currently to do a proper review (not only because of time, but also because I do not know ASTC well enough). @JimBobSquarePants what do you think, would you find some time to review this PR? |
Not just now unfortunately. I'm day and night on a massive PR to the Drawing library. I've set Copilot to review it just now though to see if there's any obvious issues. |
There was a problem hiding this comment.
Pull request overview
Adds ASTC decoding support across KTX/KTX2 (including HDR paths) and expands test coverage + assets to validate correctness against reference decoders.
Changes:
- Introduces ASTC decoding implementation (core/block decode/BISE utilities) and new texture format decoders.
- Adds extensive new test inputs/reference outputs plus new ASTC/KTX/KTX2 test suites (including HDR-specific tests).
- Updates test/benchmark infrastructure to support grouping outputs and new test formats/tools.
Reviewed changes
Copilot reviewed 273 out of 350 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderFlatTests/CanDecode_Rgba32_Blocksizes_4x4.png | Adds reference output (LFS) for KTX2 ASTC decode verification |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderFlatTests/CanDecode_Rgba32_Blocksizes_12x12.png | Adds reference output (LFS) for KTX2 ASTC decode verification |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderFlatTests/CanDecode_Rgba32_Blocksizes_12x10.png | Adds reference output (LFS) for KTX2 ASTC decode verification |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderFlatTests/CanDecode_Rgba32_Blocksizes_10x8.png | Adds reference output (LFS) for KTX2 ASTC decode verification |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderFlatTests/CanDecode_Rgba32_Blocksizes_10x6.png | Adds reference output (LFS) for KTX2 ASTC decode verification |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderFlatTests/CanDecode_Rgba32_Blocksizes_10x5.png | Adds reference output (LFS) for KTX2 ASTC decode verification |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderFlatTests/CanDecode_Rgba32_Blocksizes_10x10.png | Adds reference output (LFS) for KTX2 ASTC decode verification |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderFlatTests/CanDecode_MipMaps_4.png | Adds reference output (LFS) for KTX2 ASTC mipmaps test |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderFlatTests/CanDecode_MipMaps_3.png | Adds reference output (LFS) for KTX2 ASTC mipmaps test |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderFlatTests/CanDecode_MipMaps_2.png | Adds reference output (LFS) for KTX2 ASTC mipmaps test |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderFlatTests/CanDecode_MipMaps_1.png | Adds reference output (LFS) for KTX2 ASTC mipmaps test |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderFlatTests/CanDecode_MipMaps_0.png | Adds reference output (LFS) for KTX2 ASTC mipmaps test |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderCubemapTests/CanDecode_All_Faces_posZ.png | Adds reference output (LFS) for KTX2 ASTC cubemap face |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderCubemapTests/CanDecode_All_Faces_posY.png | Adds reference output (LFS) for KTX2 ASTC cubemap face |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderCubemapTests/CanDecode_All_Faces_posX.png | Adds reference output (LFS) for KTX2 ASTC cubemap face |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderCubemapTests/CanDecode_All_Faces_negZ.png | Adds reference output (LFS) for KTX2 ASTC cubemap face |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderCubemapTests/CanDecode_All_Faces_negY.png | Adds reference output (LFS) for KTX2 ASTC cubemap face |
| tests/Images/ReferenceOutput/Ktx2/Ktx2AstcDecoderCubemapTests/CanDecode_All_Faces_negX.png | Adds reference output (LFS) for KTX2 ASTC cubemap face |
| tests/Images/ReferenceOutput/Ktx/KtxHdrDecoderFlatTests/CanDecode_RGBA64F.png | Adds reference output (LFS) for KTX HDR decode test |
| tests/Images/ReferenceOutput/Ktx/KtxHdrDecoderFlatTests/CanDecode_RGBA128F.png | Adds reference output (LFS) for KTX HDR decode test |
| tests/Images/ReferenceOutput/Ktx/KtxHdrDecoderFlatTests/CanDecode_RGB96F.png | Adds reference output (LFS) for KTX HDR decode test |
| tests/Images/ReferenceOutput/Ktx/KtxHdrDecoderFlatTests/CanDecode_RGB48F.png | Adds reference output (LFS) for KTX HDR decode test |
| tests/Images/ReferenceOutput/Ktx/KtxHdrDecoderFlatTests/CanDecode_RG64F.png | Adds reference output (LFS) for KTX HDR decode test |
| tests/Images/ReferenceOutput/Ktx/KtxHdrDecoderFlatTests/CanDecode_RG32F.png | Adds reference output (LFS) for KTX HDR decode test |
| tests/Images/ReferenceOutput/Ktx/KtxHdrDecoderFlatTests/CanDecode_R32F.png | Adds reference output (LFS) for KTX HDR decode test |
| tests/Images/ReferenceOutput/Ktx/KtxHdrDecoderFlatTests/CanDecode_R16F.png | Adds reference output (LFS) for KTX HDR decode test |
| tests/Images/ReferenceOutput/Ktx/KtxAstcDecoderFlatTests/CanDecode_Rgba32_Blocksizes.png | Adds reference output (LFS) for KTX ASTC decode test |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_8x8.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_8x6.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_8x5.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_6x6.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_6x5.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_5x5.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_5x4.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_4x4.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_12x12.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_12x10.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_10x8.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_10x6.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_10x5.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/LogicalAstcBlockTests/UnpackLogicalBlock_FromImage_ShouldDecodeCorrectly_10x10.png | Adds reference output (LFS) for ASTC logical block tests |
| tests/Images/ReferenceOutput/Astc/AstcDecoderTests/DecompressImage_WithAstcRgbaFile_ShouldMatchExpected_8x8.png | Adds reference output (LFS) for ASTC image decode tests |
| tests/Images/ReferenceOutput/Astc/AstcDecoderTests/DecompressImage_WithAstcRgbaFile_ShouldMatchExpected_6x6.png | Adds reference output (LFS) for ASTC image decode tests |
| tests/Images/ReferenceOutput/Astc/AstcDecoderTests/DecompressImage_WithAstcRgbaFile_ShouldMatchExpected_5x5.png | Adds reference output (LFS) for ASTC image decode tests |
| tests/Images/ReferenceOutput/Astc/AstcDecoderTests/DecompressImage_WithAstcRgbaFile_ShouldMatchExpected_4x4.png | Adds reference output (LFS) for ASTC image decode tests |
| tests/Images/ReferenceOutput/Astc/AstcDecoderTests/DecompressImage_WithAstcRgbFile_ShouldMatchExpected_8x8.png | Adds reference output (LFS) for ASTC image decode tests |
| tests/Images/ReferenceOutput/Astc/AstcDecoderTests/DecompressImage_WithAstcRgbFile_ShouldMatchExpected_6x6.png | Adds reference output (LFS) for ASTC image decode tests |
| tests/Images/ReferenceOutput/Astc/AstcDecoderTests/DecompressImage_WithAstcRgbFile_ShouldMatchExpected_5x4.png | Adds reference output (LFS) for ASTC image decode tests |
| tests/Images/ReferenceOutput/Astc/AstcDecoderTests/DecompressImage_WithAstcRgbFile_ShouldMatchExpected_4x4.png | Adds reference output (LFS) for ASTC image decode tests |
| tests/Images/ReferenceOutput/Astc/AstcDecoderTests/DecompressImage_WithAstcRgbFile_ShouldMatchExpected_12x12.png | Adds reference output (LFS) for ASTC image decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_8x8_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_8x8_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_8x6_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_8x6_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_8x5_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_8x5_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_6x6_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_6x6_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_6x5_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_6x5_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_5x5_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_5x5_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_5x4_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_5x4_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_4x4_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_4x4_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_12x12_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_12x12_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_12x10_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_12x10_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_10x8_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_10x8_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_10x6_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_10x6_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_10x5_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_10x5_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_10x10_UNORM_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/valid_ASTC_10x10_SRGB_BLOCK_2D.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_8x8.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_8x6.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_8x5.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_6x6.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_6x5.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_5x5.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_5x4.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_4x4.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_12x12.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_12x10.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_10x8.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_10x6.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_10x5.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_rgba32_10x10.ktx2 | Adds input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_ldr_6x6_arraytex_7_mipmap.ktx2 | Adds input (LFS) for KTX2 ASTC array+mipmaps tests |
| tests/Images/Input/Ktx2/Flat/Astc/astc_ldr_10x5_FlightHelmet_baseColor.ktx2 | Adds input (LFS) for real-world KTX2 ASTC sample test |
| tests/Images/Input/Ktx2/Flat/Astc/Supercompressed/valid_ASTC_4x4_UNORM_BLOCK_2D_ZSTD_9.ktx2 | Adds input (LFS) for KTX2 ASTC supercompression tests |
| tests/Images/Input/Ktx2/Flat/Astc/Supercompressed/valid_ASTC_4x4_UNORM_BLOCK_2D_ZSTD_1.ktx2 | Adds input (LFS) for KTX2 ASTC supercompression tests |
| tests/Images/Input/Ktx2/Flat/Astc/Supercompressed/valid_ASTC_4x4_UNORM_BLOCK_2D_ZLIB_9.ktx2 | Adds input (LFS) for KTX2 ASTC supercompression tests |
| tests/Images/Input/Ktx2/Flat/Astc/Supercompressed/valid_ASTC_4x4_UNORM_BLOCK_2D_ZLIB_1.ktx2 | Adds input (LFS) for KTX2 ASTC supercompression tests |
| tests/Images/Input/Ktx2/Flat/Astc/HDR/hdr-rgba64-unorm.ktx2 | Adds HDR input (LFS) for KTX2 ASTC HDR decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/HDR/hdr-rgba128-sfloat.ktx2 | Adds HDR input (LFS) for KTX2 ASTC HDR decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/HDR/hdr-rgb9e5-ufloat.ktx2 | Adds HDR input (LFS) for KTX2 ASTC HDR decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/HDR/hdr-rgb96-sfloat.ktx2 | Adds HDR input (LFS) for KTX2 ASTC HDR decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/HDR/hdr-rgb48-unorm.ktx2 | Adds HDR input (LFS) for KTX2 ASTC HDR decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/HDR/hdr-rg64-sfloat.ktx2 | Adds HDR input (LFS) for KTX2 ASTC HDR decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/HDR/hdr-rg32-unorm.ktx2 | Adds HDR input (LFS) for KTX2 ASTC HDR decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/HDR/hdr-r32-sfloat.ktx2 | Adds HDR input (LFS) for KTX2 ASTC HDR decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/HDR/hdr-r16-unorm.ktx2 | Adds HDR input (LFS) for KTX2 ASTC HDR decode tests |
| tests/Images/Input/Ktx2/Flat/Astc/HDR/hdr-b10g11r11-ufloat.ktx2 | Adds HDR input (LFS) for KTX2 packed-float decode tests |
| tests/Images/Input/Ktx2/Cubemap/Astc/astc_ldr_cubemap_6x6.ktx2 | Adds cubemap input (LFS) for KTX2 ASTC decode tests |
| tests/Images/Input/Ktx/Flat/HDR/hdr-rgba64.ktx | Adds HDR input (LFS) for KTX v1 HDR decode tests |
| tests/Images/Input/Ktx/Flat/HDR/hdr-rgba128.ktx | Adds HDR input (LFS) for KTX v1 HDR decode tests |
| tests/Images/Input/Ktx/Flat/HDR/hdr-rgb96.ktx | Adds HDR input (LFS) for KTX v1 HDR decode tests |
| tests/Images/Input/Ktx/Flat/HDR/hdr-rgb48.ktx | Adds HDR input (LFS) for KTX v1 HDR decode tests |
| tests/Images/Input/Ktx/Flat/HDR/hdr-rg64.ktx | Adds HDR input (LFS) for KTX v1 HDR decode tests |
| tests/Images/Input/Ktx/Flat/HDR/hdr-rg32.ktx | Adds HDR input (LFS) for KTX v1 HDR decode tests |
| tests/Images/Input/Ktx/Flat/HDR/hdr-r32.ktx | Adds HDR input (LFS) for KTX v1 HDR decode tests |
| tests/Images/Input/Ktx/Flat/HDR/hdr-r16.ktx | Adds HDR input (LFS) for KTX v1 HDR decode tests |
| tests/Images/Input/Ktx/Flat/Astc/astc-rgba32-8x8.ktx | Adds ASTC input (LFS) for KTX v1 decode tests |
| tests/Images/Input/Astc/rgba_8x8.astc | Adds raw ASTC input (LFS) for direct ASTC decoder tests |
| tests/Images/Input/Astc/rgba_6x6.astc | Adds raw ASTC input (LFS) for direct ASTC decoder tests |
| tests/Images/Input/Astc/rgba_5x5.astc | Adds raw ASTC input (LFS) for direct ASTC decoder tests |
| tests/Images/Input/Astc/rgba_4x4.astc | Adds raw ASTC input (LFS) for direct ASTC decoder tests |
| tests/Images/Input/Astc/rgb_8x8.astc | Adds raw ASTC input (LFS) for direct ASTC decoder tests |
| tests/Images/Input/Astc/rgb_6x6.astc | Adds raw ASTC input (LFS) for direct ASTC decoder tests |
| tests/Images/Input/Astc/rgb_5x4.astc | Adds raw ASTC input (LFS) for direct ASTC decoder tests |
| tests/Images/Input/Astc/rgb_4x4.astc | Adds raw ASTC input (LFS) for direct ASTC decoder tests |
| tests/Images/Input/Astc/rgb_12x12.astc | Adds raw ASTC input (LFS) for direct ASTC decoder tests |
| tests/Images/Input/Astc/footprint_8x8.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/footprint_8x6.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/footprint_8x5.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/footprint_6x6.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/footprint_6x5.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/footprint_5x5.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/footprint_5x4.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/footprint_4x4.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/footprint_12x12.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/footprint_12x10.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/footprint_10x8.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/footprint_10x6.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/footprint_10x5.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/footprint_10x10.astc | Adds raw ASTC input (LFS) for footprint/decoding tests |
| tests/Images/Input/Astc/checkered_9.astc | Adds raw ASTC input (LFS) for decoder tests |
| tests/Images/Input/Astc/checkered_8.astc | Adds raw ASTC input (LFS) for decoder tests |
| tests/Images/Input/Astc/checkered_7.astc | Adds raw ASTC input (LFS) for decoder tests |
| tests/Images/Input/Astc/checkered_6.astc | Adds raw ASTC input (LFS) for decoder tests |
| tests/Images/Input/Astc/checkered_5.astc | Adds raw ASTC input (LFS) for decoder tests |
| tests/Images/Input/Astc/checkered_4.astc | Adds raw ASTC input (LFS) for decoder tests |
| tests/Images/Input/Astc/checkered_12.astc | Adds raw ASTC input (LFS) for decoder tests |
| tests/Images/Input/Astc/checkered_11.astc | Adds raw ASTC input (LFS) for decoder tests |
| tests/Images/Input/Astc/checkered_10.astc | Adds raw ASTC input (LFS) for decoder tests |
| tests/Images/Input/Astc/checkerboard.astc | Adds raw ASTC input (LFS) for decoder tests |
| tests/Images/Input/Astc/HDR/ldr-tile.astc | Adds raw ASTC input (LFS) for HDR/LDR crossover tests |
| tests/Images/Input/Astc/HDR/hdr.exr | Adds HDR source (LFS) for reference/comparison in HDR tests |
| tests/Images/Input/Astc/HDR/hdr-tile.astc | Adds raw ASTC input (LFS) for HDR decode tests |
| tests/Images/Input/Astc/HDR/hdr-complex.exr | Adds HDR source (LFS) for reference/comparison in HDR tests |
| tests/Images/Input/Astc/HDR/LDR-A-1x1.png | Adds LDR reference image (LFS) for HDR-related tests |
| tests/Images/Input/Astc/HDR/LDR-A-1x1.astc | Adds raw ASTC input (LFS) for HDR-related tests |
| tests/Images/Input/Astc/HDR/HDR-A-1x1.exr | Adds HDR reference image (LFS) for HDR-related tests |
| tests/Images/Input/Astc/HDR/HDR-A-1x1.astc | Adds raw ASTC input (LFS) for HDR-related tests |
| tests/ImageSharp.Textures.Tests/TestUtilities/TextureProviders/TestTextureProvider.cs | Enhances test provider to support grouped output naming |
| tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/WithFileAttribute.cs | Updates file discovery to support subpaths and group output folders |
| tests/ImageSharp.Textures.Tests/Formats/Ktx2/Ktx2AstcDecoderCubemapTests.cs | Adds KTX2 ASTC cubemap decoder tests |
| tests/ImageSharp.Textures.Tests/Formats/Ktx/KtxDecoderTests.cs | Adjusts test grouping and renames test method for consistency |
| tests/ImageSharp.Textures.Tests/Formats/Ktx/KtxAstcDecoderFlatTests.cs | Adds KTX v1 ASTC flat texture decode tests |
| tests/ImageSharp.Textures.Tests/Formats/Astc/WeightInfillTests.cs | Adds unit tests for BISE weight bit counts and weight infill |
| tests/ImageSharp.Textures.Tests/Formats/Astc/HDR/Rgba64ExtensionsTests.cs | Adds tests for HDR helper extensions |
| tests/ImageSharp.Textures.Tests/Formats/Astc/HDR/HdrImageTests.cs | Adds HDR end-to-end ASTC decode tests for real sample files |
| tests/ImageSharp.Textures.Tests/Formats/Astc/HDR/HdrDecoderTests.cs | Adds HDR decoder API tests and invariants |
| tests/ImageSharp.Textures.Tests/Formats/Astc/FootprintTests.cs | Adds footprint mapping/equality tests |
| tests/ImageSharp.Textures.Tests/Formats/Astc/BitStreamTests.cs | Adds bitstream unit tests |
| tests/ImageSharp.Textures.Tests/Formats/Astc/BitOperationsTests.cs | Adds bit operations unit tests |
| tests/ImageSharp.Textures.Tests/Enums/TestTextureTool.cs | Adds AstcEnc test tool enum value |
| tests/ImageSharp.Textures.Tests/Enums/TestTextureFormat.cs | Adds Astc test format enum value |
| tests/ImageSharp.Textures.InteractiveTest/ImageSharp.Textures.InteractiveTest.csproj | Suppresses strong-name warnings for interactive test deps |
| tests/ImageSharp.Textures.Benchmarks/Program.cs | Converts to file-scoped namespace |
| tests/ImageSharp.Textures.Benchmarks/ImageSharp.Textures.Benchmarks.csproj | Adds nullable and project reference; removes extra packages |
| tests/ImageSharp.Textures.Benchmarks/Config.cs | Converts to file-scoped namespace and expression-bodied members |
| tests/ImageSharp.Textures.Benchmarks/AstcImageDecodeBenchmark.cs | Adds low-level ASTC decode benchmark |
| tests/ImageSharp.Textures.Benchmarks/AstcDecodingBenchmark.cs | Adds ASTC parsing/endpoint/partition benchmarks |
| tests/ImageSharp.Textures.Astc.Reference.Tests/ImageSharp.Textures.Astc.Reference.Tests.csproj | Adds reference-based ASTC correctness test project |
| tests/Directory.Build.targets | Updates test dependency versions |
| tests/Directory.Build.props | Fixes import path formatting |
| src/ImageSharp.Textures/TextureFormats/Decoding/Rgbe9995PackedFloat.cs | Adds VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 decoder |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc8x8.cs | Adds ASTC 8x8 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc8x6.cs | Adds ASTC 8x6 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc8x5.cs | Adds ASTC 8x5 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc6x6.cs | Adds ASTC 6x6 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc6x5.cs | Adds ASTC 6x5 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc5x5.cs | Adds ASTC 5x5 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc5x4.cs | Adds ASTC 5x4 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc4x4.cs | Adds ASTC 4x4 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc12x12.cs | Adds ASTC 12x12 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc12x10.cs | Adds ASTC 12x10 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc10x8.cs | Adds ASTC 10x8 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc10x6.cs | Adds ASTC 10x6 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc10x5.cs | Adds ASTC 10x5 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/RgbaAstc10x10.cs | Adds ASTC 10x10 decoder block |
| src/ImageSharp.Textures/TextureFormats/Decoding/Rgb48Float.cs | Adds RGB 16-bit-float-per-channel block support |
| src/ImageSharp.Textures/TextureFormats/Decoding/Rgb111110PackedFloat.cs | Adds VK_FORMAT_B10G11R11_UFLOAT_PACK32 decoder |
| src/ImageSharp.Textures/PixelFormats/Fp32.cs | Fixes float packing and implements ToRgba32 conversion |
| src/ImageSharp.Textures/ImageSharp.Textures.csproj | Adds AstcSharp package dependency |
| src/ImageSharp.Textures/Formats/Ktx2/Ktx2DecoderCore.cs | Adjusts KTX2 stream consumption behavior after decoding |
| src/ImageSharp.Textures/Formats/Ktx/SwappingEndianHandler.cs | Adds endian swapping implementation for KTX v1 |
| src/ImageSharp.Textures/Formats/Ktx/NativeEndianHandler.cs | Adds native-endian implementation for KTX v1 |
| src/ImageSharp.Textures/Formats/Ktx/IEndianHandler.cs | Introduces endian handler abstraction for KTX v1 |
| src/ImageSharp.Textures/Formats/Ktx/Enums/GlInternalPixelFormat.cs | Adds float/HDR internal formats and ASTC enums |
| src/ImageSharp.Textures/Compression/Astc/TexelBlock/PhysicalBlockMode.cs | Adds ASTC block mode enum |
| src/ImageSharp.Textures/Compression/Astc/TexelBlock/PhysicalBlock.cs | Adds physical block wrapper around BlockInfo decoding |
| src/ImageSharp.Textures/Compression/Astc/README.md | Documents ASTC decoder background and features |
| src/ImageSharp.Textures/Compression/Astc/IO/BitStream.cs | Adds 128-bit bitstream helper |
| src/ImageSharp.Textures/Compression/Astc/IO/AstcFileHeader.cs | Adds ASTC file header parsing |
| src/ImageSharp.Textures/Compression/Astc/IO/AstcFile.cs | Adds ASTC file wrapper + footprint mapping |
| src/ImageSharp.Textures/Compression/Astc/Core/UInt128Extensions.cs | Adds UInt128 helper methods |
| src/ImageSharp.Textures/Compression/Astc/Core/Rgba64Extensions.cs | Adds HDR color helpers |
| src/ImageSharp.Textures/Compression/Astc/Core/Rgba32Extensions.cs | Adds LDR color helpers |
| src/ImageSharp.Textures/Compression/Astc/Core/FootprintType.cs | Adds footprint type enum |
| src/ImageSharp.Textures/Compression/Astc/Core/Footprint.cs | Adds footprint abstraction and mapping helpers |
| src/ImageSharp.Textures/Compression/Astc/Core/DecimationTable.cs | Adds cached decimation + weight infill logic |
| src/ImageSharp.Textures/Compression/Astc/Core/DecimationInfo.cs | Adds decimation metadata container |
| src/ImageSharp.Textures/Compression/Astc/Core/BitOperations.cs | Adds ASTC slice/precision-transfer helpers |
| src/ImageSharp.Textures/Compression/Astc/ColorEncoding/RgbaColorExtensions.cs | Adds ASTC-specific RGB(A) color transforms |
| src/ImageSharp.Textures/Compression/Astc/ColorEncoding/EndpointEncodingModeExtensions.cs | Adds endpoint-mode-to-value-count mapping |
| src/ImageSharp.Textures/Compression/Astc/ColorEncoding/EndpointEncodingMode.cs | Adds endpoint encoding mode enum |
| src/ImageSharp.Textures/Compression/Astc/ColorEncoding/ColorEndpointPair.cs | Adds LDR/HDR endpoint pair union type |
| src/ImageSharp.Textures/Compression/Astc/ColorEncoding/ColorEndpointModeExtensions.cs | Adds endpoint mode helpers incl. HDR detection |
| src/ImageSharp.Textures/Compression/Astc/ColorEncoding/ColorEndpointMode.cs | Adds endpoint mode enum definitions |
| src/ImageSharp.Textures/Compression/Astc/BlockDecoder/FusedLdrBlockDecoder.cs | Adds optimized fused LDR decode path |
| src/ImageSharp.Textures/Compression/Astc/BiseEncoding/Quantize/TritQuantizationMap.cs | Adds trit quantization map generation |
| src/ImageSharp.Textures/Compression/Astc/BiseEncoding/Quantize/QuintQuantizationMap.cs | Adds quint quantization map generation |
| src/ImageSharp.Textures/Compression/Astc/BiseEncoding/Quantize/QuantizationMap.cs | Adds base quantization map + freezing |
| src/ImageSharp.Textures/Compression/Astc/BiseEncoding/Quantize/BitQuantizationMap.cs | Adds bit-only quantization map generation |
| src/ImageSharp.Textures/Compression/Astc/BiseEncoding/BoundedIntegerSequenceEncoder.cs | Adds BISE encoder implementation |
| src/ImageSharp.Textures/Compression/Astc/BiseEncoding/BiseEncodingMode.cs | Defines BISE encoding modes |
| src/ImageSharp.Textures/Common/Helpers/FloatHelper.cs | Improves float packing/unpacking correctness and adds bias support |
| src/Directory.Build.props | Updates InternalsVisibleTo entries for benchmarks & reference tests |
| README.md | Updates license badge and lists ASTC support |
| .gitattributes | Adds .astc to Git LFS filters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Prerequisites
Description
Adds support for decoding ASTC compressed KTX and KTX2 textures, including both LDR and HDR modes. Implementing an ASTC decoder was a major challenge, but I was able to base a lot of it on existing C++ implementations from ARM and Khronos.
ASTC is very complex, with different combinations of modes, block sizes and partitions, so I'm afraid that the diff is very large.
I have added tests that compare the output vs the ARM C++ implementation to ensure correctness (see ImageSharp.Textures.Astc.Reference.Tests), however this had to be a separate test project because the C# bindings wrapper (AstcEncoderCSharp) only supports .NET10.
Decoding speed compares favorably to the reference decoder, but I couldn't include those benchmarks here, again due to the .NET10 issue. You can find some comparison benchmarks in my separate implementation: https://github.com/Erik-White/AstcSharp
KTX1 has support for ASTC, but I couldn't find a tool to create test images and had a difficult time sourcing test data. So the tests are quite limited for v1, but much better for KTX2.
Limitations
Test data
Everything used is either created by myself, or sourced from
https://github.com/KhronosGroup/KTX-Software (Apache 2.0 license)
https://github.com/KhronosGroup/KTX-Software-CTS (Apache 2.0 license)
https://github.com/ARM-software/astc-encoder (Apache-2.0 license)