ONE STAGE OF A CHAIN — WHAT ARRIVES, WHAT LEAVES, WHAT BREAKS DOWNSTREAM
Where This Sits In The Encoding Pipeline
A video encoder is not one algorithm but eight stages in a fixed order, and the order is not arbitrary: each stage exists because the one before it made its job possible. This tool models one of them. The chain below links to the other seven.
Quantization Lab — divides coefficients by a step size and rounds — the one deliberately lossy step
- What arrives
- Transform coefficients of the residual, at full precision.
- What leaves
- Coarser integers, with most small high-frequency coefficients rounded away to zero.
- What the next stage assumes
- Entropy coding assumes long runs of zeros to exploit. This stage is what manufactures them.
- What goes wrong here
- This is the only stage that discards information on purpose, so it is where quality is actually decided. Too coarse a step and a smooth gradient collapses into visible bands, because neighbouring tones round to the same integer.
Problem solved in full
-
Reconciling 56.18 dB of 8-bit quantisation with the textbook rule 6 steps
8-bit quantisation gives 56.18 dB here, but the textbook rule says 6.02 × 8 + 1.76 = 49.92 dB. Both are right. Reconcile them.
-
The step size is the range divided by the gaps between levels, not by the levels — 256 levels leave 255 gaps, and the off-by-one is worth 0.017 dB nobody would notice and a wrong formula everybody would inherit.
-
Rounding to the nearest level leaves an error spread evenly across one step. Its RMS is the step over √12, which is the only piece of statistics in the whole derivation.
-
Compare that prediction with what the tool measured over the 900 samples. Agreement to within 1% is what the uniform-error assumption is worth on a real ramp.
-
SNR is the ratio of the two RMS values in decibels. Both numbers are printed, so this step is a check rather than a derivation.
-
Now the textbook rule, with its assumption made explicit. It is derived for a sine that just fills the input range.
-
Take the ratio of the two RMS values and convert. The correction closes the gap to within four hundredths of a decibel.
Answer
The 6.2 dB gap is the crest factor, and nothing else. 6.02N + 1.76 is not a law about converters, it is a law about full-scale sine waves — a sine filling the range has an RMS of 1/(2√2) = 0.354 of it. This image ramp has an RMS of 0.724, slightly over twice as much, and 20 log₁₀(2.05) is 6.22 dB. Add it and you get 56.14 against the panel's 56.18, the remaining 0.04 dB being the measured error running 0.7% under the theoretical Δ/√12. So the quoted SNR of any real system is a statement about the signal as much as the hardware, which is why audio engineers quote headroom separately and why a quiet passage on a 16-bit disc does not get 96 dB of anything.
-
References (1)
- Insight block 3 says each extra bit is worth about 6 dB. Where that number comes from, and when it stops being true: B. Widrow & I. Kollár, Quantization Noise: Roundoff Error in Digital Computation, Signal Processing, Control, and Communications. Cambridge University Press, 2008.