Skip to main content

Module tucker

Module tucker 

Source
Expand description

Tucker (HOSVD) codec, TTHRESH-style, on the shared quantizer / context coder / range coder stack.

  1. HOSVD. For each mode k the eigenvectors of the mode Gram X₍ₖ₎X₍ₖ₎ᵀ give an orthonormal factor Uₖ; the core C = X ×₁U₁ᵀ ×₂U₂ᵀ ×₃U₃ᵀ concentrates the energy at low indices.
  2. Ranks by rate–distortion. The core is quantized with the deadzone quantizer at step Δ; Rₖ = 1 + the last mode-k slice with a nonzero quantized coefficient.
  3. Factor quantization, equal slope. Perturbing column j of Uₖ by e costs ‖e‖²·‖C₍ₖ₎[j,:]‖², so the column gets step sⱼ = φΔ/‖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.
  4. 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).
  5. 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§

TuckerStats
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_f32 with the core step from crate::wavcodec::fast_step (a formula plus a few error checks) instead of a bisection search.