/ concept-collection / timeseries-compressibility
Sign in
concept-collection / timeseries-compressibility
timeseries-compressibility / README.md
61 lines · 3.0 KBCodeBlameHistory
3Interactive exploration of how compressible quantized time series are.
5The generating model is: i.i.d. Gaussian noise (std σ, measured in quantization
6steps) → FIR filter → optional additive uniform dither on [-½, ½) → round to
7integers. The app shows the filter (convolution kernel and frequency response,
eb36f3fMake the signal view stationary by default with a play toggleJeremy Magland 8with cutoffs in Hz against a chosen sample rate), a window of the generated
9integer signal (stationary by default, with a play toggle to let it stream
e411dffMake LPC order and compression block size controlsJeremy Magland 10endlessly), and the measured compression of a block of the generated integers
11under nine methods — zlib, zstd, and an rANS entropy coder, each raw,
36e8ceaInteractive explorer for compressibility of quantized filtered Gaussian time seriesJeremy Magland 12delta-coded, and LPC-residual-coded — as bits per sample and as ratio against
e411dffMake LPC order and compression block size controlsJeremy Magland 13raw int16 storage. The predictor order and the block size are controls, so the
14measurement can be pushed from 10k to a million samples and LPC from order 1
15to 128. Each prefilter group also carries a hollow bar: the order-0 entropy of
16the stream being coded, the limit a per-sample entropy coder cannot beat, which
17ANS misses by 1–2% (its symbol table plus its own arithmetic loss).
5bab85aRatio-first chart, quantization-floor theory formula, line-segment view, fixed latent dataJeremy Magland 19Alongside the measurements it plots a theoretical bits/sample R: quantization
20is modeled as an additive white noise floor on the spectrum, the one-step
21Wiener prediction error of the resulting process comes from the
22Szegő–Kolmogorov formula, and R is the exact entropy of that innovation
23quantized at unit step:
25```
5bab85aRatio-first chart, quantization-floor theory formula, line-segment view, fixed latent dataJeremy Magland 26S_z(f) = σ²|H(f)|² + σ_q² σ_q² = 1/12 (1/6 with dither)
27σ_e² = exp( 2 ∫₀^½ ln S_z(f) df )
28R = H_Δ(σ_e) (exact quantized-Gaussian entropy)
5bab85aRatio-first chart, quantization-floor theory formula, line-segment view, fixed latent dataJeremy Magland 31Where the spectrum sits well above one step² this reduces to the classical
32Gaussian entropy rate ½log₂(2πe) + ∫log₂S df; the noise floor keeps it finite
33and positive where a deep stopband would send that integral to −∞. LPC + ANS
34should approach R; probing where the approximation holds is the point. The
35math section is a stub for the full derivation.
37## Run it
39```sh
40npm install
41npm run dev
42```
44## Layout
46```
5bab85aRatio-first chart, quantization-floor theory formula, line-segment view, fixed latent dataJeremy Magland 47src/model/ the latent source (fixed seeded randomness indexed by sample
48 position, convolved zero-phase with the kernel on demand),
49 FIR presets, and the theoretical-rate formula
36e8ceaInteractive explorer for compressibility of quantized filtered Gaussian time seriesJeremy Magland 50src/compress/ lossless codecs run in the browser: zlib (fflate), zstd (wasm),
51 ans.ts (a bit-identical port of simple_ans), and FLAC-style
52 integer LPC; borrowed from entropy-quantized-linear-transform
53src/worker/ the codecs run off the main thread on a debounced parameter set
5bab85aRatio-first chart, quantization-floor theory formula, line-segment view, fixed latent dataJeremy Magland 54src/components/ controls, filter plots, signal canvas, compression chart
57Every reported size round-trips through the decoder and includes whatever the
5bab85aRatio-first chart, quantization-floor theory formula, line-segment view, fixed latent dataJeremy Magland 58decoder needs (ANS symbol table, LPC coefficients). The signal view and the
59compression block read the same fixed latent noise sequence — parameter changes
60transform the same underlying data rather than resampling it, and the first
61window shown is the start of the block that gets compressed.
moveopenescclose