Expand description
A complete, bit-exact pure-Rust Basis Universal transcoder.
Open a .ktx2 or .basis Basis Universal texture and transcode any image
level to a GPU format. For every supported target the output matches the
canonical Basis Universal transcoder byte for byte.
use basisu::{Transcoder, TargetFormat, DecodeFlags};
let bytes = std::fs::read("texture.ktx2").unwrap();
let tex = Transcoder::new(&bytes).unwrap();
let astc = tex.transcode(0, TargetFormat::Astc4x4Rgba, DecodeFlags::NONE).unwrap();The Transcoder high-level API is the stable surface. The lower-level
codec modules are exposed (currently pub) for power users and the
conformance harness; they are not yet covered by semver stability.
Without the default std feature the crate is #![no_std] (it still needs
alloc); the zstd feature implies std.
Structs§
- Decode
Flags - Decode behavior flags. Values match
basist::basisd_decode_flags; combine with|. - Global
Codebook - A shared ETC1S codebook lifted out of one Basis texture to decode
“global codebook”
.basisfiles that reference it. - Image
Level Info - Dimensions and block counts of one image level.
- Transcoder
- A parsed + prepared Basis Universal texture, ready to transcode.
- Video
State - Cross-frame decode state for ETC1S video.
Enums§
- Astc
Block - An ASTC LDR block footprint: the 14 block sizes the format defines, in
basis_tex_formatdeclaration order (cASTC_LDR_4x4= 19 ..cASTC_LDR_12x12= 32). Every block is 16 bytes regardless of footprint; larger footprints trade quality for fewer bits per texel. - Error
- Transcode failures.
- Source
Format - The Basis source codec a container carries.
- Supercompression
- The KTX2 supercompression scheme applied to level data.
- Target
Format - A GPU texture format to transcode to. Values match
basist::transcoder_texture_format.
Functions§
- is_
format_ supported - Whether
targetcan be transcoded fromsource.