/ proof-of-concept / timeseries-compressibility
Sign in
proof-of-concept / timeseries-compressibility
timeseries-compressibility / README.md
50 lines · 2.1 KBPreviewCodeBlameHistoryRaw
1# timeseries-compressibility
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,
8with cutoffs in Hz against a chosen sample rate), an endlessly scrolling view of
9the generated integer signal, and the measured compression of a 120,000-sample
10block under nine methods — zlib, zstd, and an rANS entropy coder, each raw,
11delta-coded, and LPC-residual-coded — as bits per sample and as ratio against
12raw int16 storage.
14Alongside the measurements it plots the theoretical bits/sample: the entropy
15rate of the stationary filtered Gaussian process quantized at unit step, in the
16high-resolution limit,
18```
19R = ½ log₂(2πe) + ∫₀^½ log₂ S(f) df, S(f) = σ² |H(f)|²
20```
22LPC + ANS should approach R — and does, where the formula is valid. Where the
23filter's stopband pushes S(f) below one step² (see the dashed threshold on the
24response plot), the formula under-predicts and can go negative; making that
25breakdown visible is part of the point. The math section is a stub for the full
26derivation.
28## Run it
30```sh
31npm install
32npm run dev
33```
35## Layout
37```
38src/model/ the pipeline (seeded Gaussian stream, FIR presets, dither,
39 rounding) and the entropy-rate integral
40src/compress/ lossless codecs run in the browser: zlib (fflate), zstd (wasm),
41 ans.ts (a bit-identical port of simple_ans), and FLAC-style
42 integer LPC; borrowed from entropy-quantized-linear-transform
43src/worker/ the codecs run off the main thread on a debounced parameter set
44src/components/ controls, filter plots, scrolling canvas, compression chart
45```
47Every reported size round-trips through the decoder and includes whatever the
48decoder needs (ANS symbol table, LPC coefficients). The compression block and
49the scrolling display are fed by the same `Pipeline`, so what is compressed is
50what is shown.
↑↓ move↵openescclose