texture2ddecoder
A pure Rust no-std texture decoder for the following formats:
- ATC - Adreno Texture Compression (detailed paper)
- ASTC - Adaptive Scalable Texture Compression
- BCn - Block Compression
- ETC - Ericsson Texture Compression
- PVRTC - PowerVR Texture Compression
- (WIP) Crunch & Unity's Crunch
Features
alloc (optional, default)
- ~35% faster pvrtc decoding
Functions
Provides a decode function for each format, as well as a block decode function all formats besides PVRTC. Besides some exceptions, the signature of the decode functions is as follows:
The exceptions are:
- ASTC: the (block) decode function takes the block size as an additional parameter
- BC6: there are two additional decode functions for the signed and unsigned variants
- PVRTC: the decode function takes the block size as an additional parameter, and there are two additional decode functions for the 2bpp and 4bpp variants To make these excetions easier to use, there are helper functions to enable decode functions with identical arguments and returns. Here is a list of the formats and their corresponding functions:
- ATC
- decode_atc_rgb4
- decode_atc_rgb4_block
- decode_atc_rgba8
- decode_atc_rgba8_block
- ASTC
- decode_astc
- decode_astc_block
- various decode_astc_(block_)_x_y functions, where x and y are the block size
- BCn
- decode_bc1
- decode_bc1_block
- decode_bc3
- decode_bc3_block
- decode_bc4
- decode_bc4_block
- decode_bc5
- decode_bc5_block
- decode_bc6
- decode_bc6_block
- decode_bc6_signed
- decode_bc6_block_signed
- decode_bc6_unsigned
- decode_bc6_block_unsigned
- decode_bc7
- decode_bc7_block
- ETC
- decode_etc1
- decode_etc1_block
- decode_etc2_rgb
- decode_etc2_rgb_block
- decode_etc2_rgba1
- decode_etc2_rgba1_block
- decode_etc2_rgba8
- decode_etc2_rgba8_block
- decode_eacr
- decode_eacr_block
- decode_eacr_signed
- decode_eacr_signed_block
- decode_eacrg
- decode_eacrg_block
- PVRTC
- decode_pvrtc
- decode_pvrtc_2bpp
- decode_pvrtc_4bpp
Roadmap
- implementing & testing all formats
- documentation
- replacing u32 color output with RGBA structure
- finding the original sources for the decoders
- supporting more than BGRA32 output
- adding additional formats
Format Progress
- ATC-RGB
- ATC-RGBA
- ASTC
- BC1
- BC3
- BC4
- BC5
- BC6
- BC7
- EAC-R
- EAC-RG
- ETC1
- ETC2
- ETC2-A1
- ETC2-A8
- PVRTCI-2bpp
- PVRTCI-4bpp
- Crunched (not implemented)
- DXT1
- DXT5
- ETC1
- ETC2-A8
License & Credits
This crate itself is dual-licensed under MIT + Apache2.
The texture compression codecs themselves have following licenses:
Codec | License | Source |
---|---|---|
ATC | MIT | Perfare/AssetStudio - Texture2DDecoderNative/atc.cpp |
ASTC | MIT* | Ishotihadus/mikunyan - ext/decoders/native/astc.c |
BCn | MIT* | Perfare/AssetStudio - Texture2DDecoderNative/bcn.cpp |
ETC | MIT* | Ishotihadus/mikunyan - ext/decoders/native/etc.c |
f16 | MIT | Maratyszcza/FP16 |
PVRTC | MIT* | Ishotihadus/mikunyan - ext/decoders/native/pvrtc.c |
Crunch | PUBLIC DOMAIN | BinomialLLC/crunch |
Crunch (Unity) | ZLIB | Unity-Technologies/crunch |
* in doubt if these are the original source and have not just taken/adopted the code from somewhere else |