ASTC conformance testing: how rusty_dds proved every byte against astcenc
The test method behind rusty_dds 0.11.0: six decode cells, 506,671,729 blocks, a 2,888-cell census and fuzzing, all scored against ARM astcenc 5.7.1 with zero bytes off.

How was the rusty_dds ASTC decoder tested against ARM astcenc?
A differential harness decoded every test block in both rusty_dds and ARM astcenc 5.7.1 and compared the bytes in six output cells. It covered 506,671,729 random, bit-flipped and natural blocks across 24 footprints, plus a census of 2,888 footprint and block-class cells. No byte differed.
I maintain rusty_dds at Remade with Rust. Our crates come out of MATA, where a US team of security and technology engineers builds them. Release 0.11.0 brought ASTC into the crate, with decode, encode, and the file wrappers those textures arrive in. The claim I want to put on the record is small and checkable. Our ASTC decoder writes the same bytes as ARM's reference. This note walks through the ASTC conformance testing behind that sentence: what we compared, how many blocks, and what is still open.
I am not calling it the first. Other pure-Rust ASTC code was on crates.io before ours: ktx-rs, an astcenc port that encodes and decodes, and oxideav-dds, with an LDR codec. The distinction is exactness. The two standalone decoders most projects reach for, astc-decode and texture2ddecoder, disagree with ARM's output. Over 16 benchmark runs they were off on 16% to 41% of pixels, and above a third in most of those runs.
The reason fits in a sentence. Texels are interpolated at 16 bits, and the Khronos ASTC decode-mode extension says an 8-bit result is the top 8 bits of that number. Both crates round it to nearest, so many pixels come out one step high. A viewer will never notice. A byte-compare test, a golden-image check or a cache keyed on a hash will.
A user asked for an exact ASTC decoder
The format matters because phones, Apple hardware and web graphics all lean on it. ArtCraft's Material app had already swapped its DDS reading over to our crate. ASTC was the one gap, and it kept two dependencies in their tree: dds 0.2, which in turn brings in astc-decode 0.3. Their write-up in rusty_dds issue #6 set the bar. Compare against astcenc -d, exact for LDR. Time it against astc-decode with paired runs.
Two agents shared the job. The first produced a build plan, written for a reader who had never seen the research behind it. The second wrote the code to that plan. Both worked to one rule: ARM astcenc 5.7.1 defines correct, and nearly correct is a failure.
It fit inside a day. I reopened the issue at 2:33 PM MST on 21 November, the plan was committed at 3:11 PM, and the 0.11.0 release went up at 12:06 AM on the 22nd.
The evidence behind the byte match
ASTC conformance testing starts with a definition, because "bit-exact" means nothing until you say which output. astcenc changes its decode rule with the output type, so our conformance record scores six cells. Linear and sRGB LDR each get 8-bit and half-float output, then HDR colour with LDR alpha, then HDR. Half floats are compared bit pattern by bit pattern.
506,671,729 blocks against the reference
Per footprint, the differential harness sent ten million uniform random blocks, ten million corpus blocks with one to eight flipped bits, and one million blocks biased toward legal encodings. Add 2,671,729 unique blocks from 956 files that astcenc itself encoded. Across all 24 footprints, flat and 3D, every block went through all six cells, roughly three billion decodes. Not one byte differed.
Counting every corner of the format
Random blocks cluster in the common cases, the classic blind spot of ASTC conformance testing. To be sure the rare ones were hit, the harness counts each reachable combination of footprint and block class, including endpoint sub-modes, and needs 32 or more exact blocks per combination. All 2,888 cells passed. The 2,048 block modes in each of the 24 footprints and 73,728 partition maps were compared with the reference as well.
Hostile files get an error
Garbage in should mean an Err, not a crash. libFuzzer drove the astc_decode target for one CPU-hour, about 3.4 million runs, and found nothing. The container target added half an hour, also clean. My reply on the issue puts total fuzzing near 1.8 CPU-hours with the encode round-trip target included; the artifacts in the repo document the first 1.5. A short block stream fails with TruncatedData, as the request required.
Throughput, file formats and open items
The speed record uses one core, pinned, with 8-bit output. Inputs are four 2048 by 2048 textures encoded at 4x4, 6x6, 8x8 and 12x12. Arms alternate in ABBA order inside one binary. A control arm, our decoder again under another name, shows run-to-run noise of 6% at most.
Throughput against the alternatives
Our ASTC decoder beat the faster of astc-decode 0.3.1 and texture2ddecoder 0.1.2 by 1.91 to 2.83 times. ARM's astcenc-avx2, held to one thread, was beaten by 1.45 to 2.10 times. Doubling astcenc happened in one cell out of 16, so that target stays open. Every arm ran under rusty_alloc, the allocator we also measured in the game-stream write-up.
From .astc to KTX 2.0 and DDS
Four wrappers are covered: bare .astc, KTX 1.0, KTX 2.0 and DDS with the DXGI ASTC values. Zstd-supercompressed KTX 2.0 inflates through rusty_zstd, our Rust Zstandard rebuild, when the ktx2-zstd feature is switched on. We also shipped an encoder, which nobody requested. Fastest, Fast, Medium and Thorough have measured quality against astcenc, and Exhaustive is still a first cut. Each block it wrote in those runs decoded the same in astcenc.
What we have not finished
Encoding is scalar for now, at 0.17 to 0.31 times astcenc-avx2. HDR encode quality is behind astcenc, and we make no claim for it. The Medium preset at 12x12 lands on its speed floor exactly. Testing also turned up an older defect, short mip chains for non-power-of-two BCn textures, logged as issue #12.
The issue got its answer, with these numbers, and closed once 0.11.0 was on crates.io. ArtCraft has not posted its own comparison yet, and that run is the one that counts. The crate's repository card and the Learn library have more, including our FFmpeg 9.1 jpeg_mpf landing.
FAQ
Quick answers for builders evaluating this technology.
What are the six cells in the rusty_dds ASTC conformance test?
Linear LDR and sRGB LDR, each decoded to 8-bit and to half-float output, then HDR colour with LDR alpha, then full HDR. astcenc picks its decode rule from the output type, so a decoder has to match in every cell, with half floats compared as raw bit patterns.
Where did the 506,671,729 test blocks come from?
For each of the 24 footprints: ten million uniform random blocks, ten million real blocks with one to eight bits flipped, and one million blocks biased toward legal encodings. On top of that, 2,671,729 unique blocks from 956 files that astcenc 5.7.1 encoded itself.
What does the 2,888-cell census catch that random blocks miss?
Random input piles up in common block types. The census lists every reachable pairing of footprint and block class, down to endpoint sub-modes, and requires at least 32 exact blocks in each one. All 2,888 cells passed, and block-mode tables and partition maps were also compared one by one.
Which ASTC spec rule do rounding decoders break?
The Khronos decode-mode text says an 8-bit result is the top 8 bits of the 16-bit interpolated value. astc-decode and texture2ddecoder round to nearest instead, which is why they differed from astcenc on 16% to 41% of pixels in the benchmark runs.
How was bad input tested alongside conformance?
libFuzzer ran the astc_decode target for one CPU-hour, about 3.4 million executions, and the container target for 30 minutes, both with 0 crashes. Malformed data returns an error, and a short block stream returns TruncatedData.