Monday, August 31, 2026

XUBC7 Low-Level Format Document

GPU texture blocks (ASTC, BC7, ETC1/2, etc.) can serve as a latent representation for a modern intra codec. GPU texture formats aren't merely final compressed bitstreams; they can be treated as intermediate learned-by-hand representations upon which another serious codec can operate. So far we've shipped two latent-space GPU texture codecs in the Basis Universal library: XUASTC LDR and XUBC7.

The low-level format of the XUBC7 v1 codec (which, to my knowledge, is the first DCT-based BC7 codec) is being documented here:


More updates to this document are coming today.

It supports lossless or lossy coding of the entire BC7 format (all modes, all mode features, all partition patterns, all mode options), absolute DCT, residual DCT using dozens of predictors (like a modern image codec such as WebP), threaded decompression, all-integer deterministic decompression, and SIMD is optional (so a good fit for WASM).

XUBC7's lossless bitrate is ~3.5-5.6 bpp, and ~1.2-2.5 bpp lossy. (Plain BC7 is 8.0 bpp.) XUBC7 in lossless mode (relative to BC7) is so effective it can hold its own against lossy RDO BC7+LZ codecs, i.e. without sacrificing any quality. v2 will adaptively use 2x2-4x4 macroblocks, pushing its lossy bitrate much lower (below 1.0 bpp).

Note XUBC7 is also universal: we can transcode the BC7 latent directly to ASTC LDR 4x4's just by converting the BC7 block config to ASTC's (which is way more flexible than BC7's). In those rare cases where the BC7 partition pattern index isn't directly mappable to ASTC, we can fall back to the bc7f real-time analytical encoder running in a mode that outputs ASTC.

Sunday, August 30, 2026

In-loop deblocking of GPU textures

I posted this thread on X last night - mirroring it here:

On GPU textures the block lattice is a function of UV + known block size. This makes GPU texture seam artifacts entirely predictable, so filtering them is easy. This applies to all GPU texture formats, but is the most valuable on ASTC which supports up to 12x12 pixel block sizes.

No extra metadata is required. The geometry of GPU texture block artifacts is known before you even look at the compressed bits. It's also easy to apply the seam filter while preserving mipmapping, trilinear filtering, etc.:


For normal maps: you can apply the seam filter (which only kicks in near/on block edges) then renormalize the results.

Encoders can optimize the GPU texture block parameters taking into account the reconstruction operator (the seam filter) during compression (in-loop). We use a form of SCD: Stochastic Coordinate Descent.