Expand description
Tucker (HOSVD) codec, TTHRESH-style, on the shared quantizer / context coder / range coder stack.
- HOSVD. For each mode
kthe eigenvectors of the mode GramX₍ₖ₎X₍ₖ₎ᵀgive an orthonormal factorUₖ; the coreC = X ×₁U₁ᵀ ×₂U₂ᵀ ×₃U₃ᵀconcentrates the energy at low indices. - Ranks by rate–distortion. The core is quantized with the deadzone
quantizer at step
Δ;Rₖ= 1 + the last mode-kslice with a nonzero quantized coefficient. - Factor quantization, equal slope. Perturbing column
jofUₖbyecosts‖e‖²·‖C₍ₖ₎[j,:]‖², so the column gets stepsⱼ = φΔ/‖C₍ₖ₎[j,:]‖(stored as a quarter-octave exponent). Columns are coded as DPCM residuals (order 0/1/2, chosen per column) with a Rice split: adaptive Elias-gamma high part + raw low bits. - Error feedback. The core is recomputed by least squares against the
quantized factors,
C = X ×ₖ (ÛₖᵀÛₖ)⁻¹Ûₖᵀ, then quantized and coded with the wavelet coefficient coder over a dyadic pseudo-pyramid in core index space (energy decays with index the way it does across wavelet levels, so the same band / parent / neighbour contexts apply). - Rate control.
Δis bisected on the measured RMSE of the decoder’s own reconstruction.
Reconstruction uses faer GEMMs (sequential): deterministic on a given CPU; across ISAs the float output may differ in the last ulp. The bitstream itself is integer-coded and identical everywhere. No max-abs mode (TTHRESH has none either).
Structs§
- Tucker
Stats - What the encoder did.
Constants§
- MAGIC
- Stream magic.
Functions§
- decode
- Decode a Tucker stream.
- encode_
f32 - Encode f32 samples (1D–3D, row-major) at a PSNR or RMSE target.
- encode_
fast_ f32 encode_f32with the core step fromcrate::wavcodec::fast_step(a formula plus a few error checks) instead of a bisection search.