Files
Strata/tools/image/gate/data
Niko1221 9b4cedd08d image: the latent's VAE input and the 8-bit picture as stable-diffusion.cpp makes them (step 5, part 3)
include/strata/image/qi21_pixels.hpp, src/image/vae/qi21_pixels.cpp: the decoded float
picture to 8-bit pixels as sd.cpp 2988060's tensor_to_sd_image / preprocessing_float_to_u8
(0 at or below 0, 255 at or above 1, else (uint8)(v x 255 + 0.5) with two roundings: no
fused multiply-add, contraction off for the file), planar in, interleaved out. The latent's
preparation for the VAE is step 2's wan_vae_denormalize (sd.cpp's diffusion_to_vae_latents
for Qwen-Image-2.1: 64 channels, x std / 1 + mean; sd.cpp unpatchifies nothing before its
VAE). Nothing joined or hooked anywhere.

Test-only: stage_hooks.py dumps vae_in (what sd.cpp's VAE decoder gets) and vae_out (its
float picture before the 8-bit step) (+ test_stage_hooks.py); strata-vae-io-check
(src/image/vae/qi21_vae_io_check_main.cpp, nvcc, links wan_vae.cu); strata-pixels-check;
tools/image/gate/png_pixels.py (a PNG reader with all five row filters, for sd-cli's PNGs).
GB10 (dgxspark-20261111-0610-e738), sd-cli with the stage hooks (build te5bvio), prompt 0
at 512 (seeds 42, 1234) and 1024 (seed 42): wan_vae_denormalize(latent) byte-identical to
vae_in on all three; our 8-bit picture of vae_out identical to the pixels of sd-cli's own
PNG on all three (4 channels; a fused-multiply-add variant gave the same bytes here).
CPU test tools/test_qi21_pixels.py: 8,184 values of that picture with sd-cli's PNG bytes
(tools/image/gate/data/qi21_pixels_fixture.bin, 729 within 1e-3 of a rounding boundary)
and edge values from numpy float32, built -O2 and -O3 -ffp-contract=fast; p1006
p1006-20261111-0618-a6f6: 58 passed (with the other image tests).
2026-11-11 06:19:11 +01:00
..