Salta al contenuto
Note per Studenti Quantization Noise and SNR Report

Quantization Noise and SNR

In questa pagina 7

Quantization is the only step of analog-to-digital conversion that loses information irreversibly (Digital Representation of Audio and Image SignalsAnalog-to-digital conversion has three steps, sampling at Fs at least twice the signal bandwidth after an anti-aliasing low-pass filter, uniform quantization on L = 2^b levels, and binarization of each level into b bits, giving a nominal bit-rate R = Fs times b times the number of channels (speech 64 kbit/s, CD audio 1.411 Mbit/s); an image is a two-dimensional sampled signal with 8 bits per grey level or 24 bits per RGB pixel (12 in YCbCr 4:2:0), and quality is measured with MSE and PSNR.Digital Representation of Audio and Image Signals →), so one must be able to measure how much error it introduces and how many bits are needed to keep it below a given value. This note merges the treatment of the quantizer, of its error and of its design.

1. The quantizer

Definition (quantizer). A quantizer is a function Q:R→Aq={Q0,…,QL−1}Q:\mathbb R\to\mathcal A_q=\{Q_0,\dots,Q_{L-1}\} that associates with each sample a(mTs)a(mT_s) a level aq(mTs)=Q(a(mTs))a_q(mT_s)=Q(a(mT_s)). The real line is divided into LL disjoint regions separated by L−1L-1 thresholds; a sample in region ii becomes QiQ_i. One takes L=2bL=2^b with bb bits per sample.

Example. The thresholds {−1,0,1}\{-1,0,1\} divide R\mathbb R into four regions; with levels {−1.5,−0.5,0.5,1.5}\{-1.5,-0.5,0.5,1.5\} the sample 0.30.3 becomes 0.50.5 and the sample −4-4 becomes −1.5-1.5 (L=4L=4, b=2b=2 bits).

Uniform quantizer (PCM) and mid-riser

In PCM (pulse code modulation) all steps are equal. To design it:

  1. choose a dynamic range [−Vsat,Vsat][-V_{sat},V_{sat}] (saturation voltage VsatV_{sat});
  2. fix the number of levels L=2bL=2^b;
  3. the quantization step is Δ=2VsatL=2Vsat2b,Vsat=2b−1Δ;\boxed{\Delta=\frac{2V_{sat}}L=\frac{2V_{sat}}{2^b},}\qquad V_{sat}=2^{b-1}\Delta;
  4. divide R\mathbb R into LL disjoint regions: the L−2L-2 central regions have width Δ\Delta and the two outer ones extend to infinity; each is associated with a level QiQ_i (usually the centre point of the region).

Mid-riser. It has a threshold at the origin: 00 is not a level. The levels are

Qi=±Δ2, ±3Δ2, …, ±(L−1)Δ2,Q_i=\pm\frac\Delta2,\ \pm\frac{3\Delta}2,\ \dots,\ \pm\frac{(L-1)\Delta}2,

and the thresholds are kΔk\Delta with k=−L2+1,…,L2−1k=-\frac L2+1,\dots,\frac L2-1 (i.e. 0,±Δ,±2Δ,…0,\pm\Delta,\pm2\Delta,\dots). The mid-tread quantizer instead has the level 00: its levels are 0,±Δ,…0,\pm\Delta,\dots. The mid-riser is used here. Beyond the extreme thresholds the quantizer saturates: it always returns ±(Vsat−Δ2)\pm\left(V_{sat}-\frac\Delta2\right).

Example. L=8L=8 (b=3b=3) and Vsat=4V_{sat}=4 V: Δ=1\Delta=1 V; levels ±0.5, ±1.5, ±2.5, ±3.5\pm0.5,\ \pm1.5,\ \pm2.5,\ \pm3.5 V; thresholds −3,−2,−1,0,1,2,3-3,-2,-1,0,1,2,3 V. The input 1.21.2 V falls between the thresholds 11 and 22 and becomes 1.51.5 V (error +0.3+0.3); the input −5-5 V is beyond −Vsat-V_{sat} and saturates at the lowest level −3.5-3.5 V (error +1.5+1.5). The level 00 is never produced.

2. The quantization error

The quantization error is

eq(mTs)=aq(mTs)−a(mTs)⟺aq=a+eq,e_q(mT_s)=a_q(mT_s)-a(mT_s)\quad\Longleftrightarrow\quad a_q=a+e_q,

so the output is the signal plus an additive "noise", as if the error were due to the channel. As a function of aa the error has a sawtooth shape: inside the dynamic rangeinterval of values the quantizer represents without saturating its amplitude is at most Δ2\frac\Delta2 (granular error); outside the range it grows linearly with the distance from VsatV_{sat} (saturation error).

The statistical power of the error, with the sample density pap_a, is the sum of three integrals over the three zones of the real axis:

E[eq2]=∫−∞−Vsat(Q0−u)2pa(u)du⏟saturation+∫−VsatVsat(Q(u)−u)2pa(u)du⏟granular+∫Vsat+∞(QL−1−u)2pa(u)du⏟saturation.E\left[e_q^2\right]=\underbrace{\int_{-\infty}^{-V_{sat}}\left(Q_0-u\right)^2p_a(u)du}_{\text{saturation}}+\underbrace{\int_{-V_{sat}}^{V_{sat}}\left(Q(u)-u\right)^2p_a(u)du}_{\text{granular}}+\underbrace{\int_{V_{sat}}^{+\infty}\left(Q_{L-1}-u\right)^2p_a(u)du}_{\text{saturation}}.

It is a heavy calculation, simplified with two assumptions.

(A) The saturation probability PsatP_{sat} is small. The saturation error is neglected. The saturation probability is the probability that the sample leaves the range:

Psat=P[∣a∣>Vsat]=∫∣u∣>Vsatpa(u) du.P_{sat}=P\left[\lvert a\rvert>V_{sat}\right]=\int_{\lvert u\rvert>V_{sat}}p_a(u)\,du.

signal density PsatP_{sat}
zero-mean Gaussian, variance σ2\sigma^2 2Q(Vsatσ)2Q\left(\frac{V_{sat}}\sigma\right)
uniform in [−A,A][-A,A] 00 if Vsat≥AV_{sat}\ge A
Laplacian with parameter bLb_L, p(u)=12bLe−∣u∣/bLp(u)=\frac1{2b_L}e^{-\lvert u\rvert/b_L} e−Vsat/bLe^{-V_{sat}/b_L}
exponential λe−λu\lambda e^{-\lambda u} (u≥0u\ge0, range [0,Vsat][0,V_{sat}]) e−λVsate^{-\lambda V_{sat}}

(QQ is the Gaussian tail function, Q(y)=12π∫y∞e−x2/2dxQ(y)=\frac1{\sqrt{2\pi}}\int_y^\infty e^{-x^2/2}dx; for the Gaussian the factor 22 counts the two tails.) For a Gaussian signal Vsat=3σV_{sat}=3\sigma gives Psat=2.7⋅10−3P_{sat}=2.7\cdot10^{-3}, 4σ4\sigma gives 6.3⋅10−56.3\cdot10^{-5}, 5σ5\sigma gives 5.7⋅10−75.7\cdot10^{-7}.

(B) LL is large (Δ\Delta small compared with how the density varies). Inside each interval the density pap_a is almost constant, so the granular error is uniform in [−Δ2,Δ2]\left[-\frac\Delta2,\frac\Delta2\right]: pe(e)=1Δrect⁡(eΔ)p_e(e)=\frac1\Delta\operatorname{rect}\left(\frac e\Delta\right). Hence

me=0,Me=E[e2]=1Δ∫−Δ/2Δ/2e2de=1Δ⋅23(Δ2)3=Δ212.m_e=0,\qquad M_e=E\left[e^2\right]=\frac1\Delta\int_{-\Delta/2}^{\Delta/2}e^2de=\frac1\Delta\cdot\frac{2}{3}\left(\frac\Delta2\right)^3=\boxed{\frac{\Delta^2}{12}.}

(The integral of e2e^2 is e33\frac{e^3}3, which between −Δ2-\frac\Delta2 and Δ2\frac\Delta2 gives Δ312\frac{\Delta^3}{12}, divided by Δ\Delta.) The error is also assumed uncorrelated with the signal and with itself at different instants: the quantization noise is then white (flat spectrum). These are assumptions, not theorems: they work well for large LL. The rms error is Δ12\frac\Delta{\sqrt{12}}, not Δ2\frac\Delta2 (the maximum error): with Δ=1\Delta=1 V, Me=112=0.0833M_e=\frac1{12}=0.0833 V2^2 and the rms error is 0.2890.289 V.

Compromise in choosing VsatV_{sat} and LL.

  • To minimise PsatP_{sat} take VsatV_{sat} large.
  • But at fixed LL, Δ=2VsatL\Delta=\frac{2V_{sat}}L grows with VsatV_{sat} and the granular error Δ212\frac{\Delta^2}{12} increases: LL must be large, i.e. more bits.
  • If LL is huge and Δ\Delta tiny, the granular error becomes so small that the saturation error is no longer negligible: assumption (A) fails and the saturation term must be included.

Level probabilities. With the density one computes the probability of each level, P[Qi]=∫Ripa(u) duP[Q_i]=\int_{\mathcal R_i}p_a(u)\,du. For a Gaussian N(0,σ2)\mathcal N(0,\sigma^2) with L=8L=8, Δ=σ\Delta=\sigma (Vsat=4σV_{sat}=4\sigma): level ±Δ2\pm\frac\Delta2: Q(0)−Q(1)=0.3413Q(0)-Q(1)=0.3413; ±3Δ2\pm\frac{3\Delta}2: 0.13590.1359; ±5Δ2\pm\frac{5\Delta}2: 0.02140.0214; ±7Δ2\pm\frac{7\Delta}2: Q(3)=0.00135Q(3)=0.00135 (each for both symmetric levels). They are almost all different, so fixed-length coding is not efficient (see Source Coding and Compression - Entropy, Huffman and the Quality-Bitrate Trade-offThe information of an event of probability p is log2(1/p) bits and the entropy H = sum p log2(1/p) is the average information of a source; lossless source coding maps source words to variable-length prefix codewords (shorter for likelier words), the Kraft-McMillan inequality constrains the lengths, Shannon's theorem gives H/log2(My) <= L <= H/log2(My) + 1, Huffman coding is optimal among prefix codes; lossy compression gives up exactness to reach a lower rate, and rate, quality, complexity, delay and robustness are conflicting parameters.Source Coding and Compression - Entropy, Huffman and the Quality-Bitrate Trade-off →).

3. The quantization SNR

Definition. Λq=E[a(mTs)2]E[eq(mTs)2]=MaMe,[Λq]dB=10log⁡10Λq.\Lambda_q=\frac{E\left[a(mT_s)^2\right]}{E\left[e_q(mT_s)^2\right]}=\frac{M_a}{M_e},\qquad[\Lambda_q]_{dB}=10\log_{10}\Lambda_q. For a zero-mean signal Ma=σa2M_a=\sigma_a^2 (variance); in general Ma=σa2+ma2M_a=\sigma_a^2+m_a^2 (statistical power). The higher it is, the more faithful the quantized signal.

Example. A signal with σa2=2\sigma_a^2=2 V2^2 and noise Me=0.002M_e=0.002 V2^2: Λq=1000\Lambda_q=1000, i.e. 3030 dB.

With (A) and (B), Me=Δ212M_e=\frac{\Delta^2}{12} with Δ2=4Vsat24b\Delta^2=\frac{4V_{sat}^2}{4^b}:

Λq=σa2Δ2/12=12 σa2 4b4 Vsat2=3 σa2Vsat2 4b.\Lambda_q=\frac{\sigma_a^2}{\Delta^2/12}=\frac{12\,\sigma_a^2\,4^b}{4\,V_{sat}^2}=3\,\frac{\sigma_a^2}{V_{sat}^2}\,4^b.

In decibels (10log⁡103=4.7710\log_{10}3=4.77, 10log⁡104=6.0210\log_{10}4=6.02):

[Λq]dB=6.02 b+4.77+20log⁡10σaVsat.\boxed{[\Lambda_q]_{dB}=6.02\,b+4.77+20\log_{10}\frac{\sigma_a}{V_{sat}}.}

The ratio Vsatσa\frac{V_{sat}}{\sigma_a} is the load factor of the quantizer. The formula gathers in one line four design parameters: SNR, bb, σa\sigma_a and VsatV_{sat}. Consequences:

  • every extra bit (doubling of the levels, halved Δ\Delta, error power divided by 4) improves the SNR by 6.026.02 dB;
  • widening the range worsens it: if Vsat=kσV_{sat}=k\sigma, the term 20log⁡10σVsat=−20log⁡10k20\log_{10}\frac\sigma{V_{sat}}=-20\log_{10}k is −9.5-9.5 dB for k=3k=3, −12-12 dB for k=4k=4 and −14-14 dB for k=5k=5.

For a uniform signal at full scale (Ma=Vsat23M_a=\frac{V_{sat}^2}3) the SNR is Λq=4b\Lambda_q=4^b, i.e. 6.02 b6.02\,b dB; for a full-scale sinusoid 6.02 b+1.766.02\,b+1.76 dB (with b=16b=16 about 98 dB). Values computed for a Gaussian signal (Vsat=kσV_{sat}=k\sigma):

k=Vsatσk=\frac{V_{sat}}\sigma Psat=2Q(k)P_{sat}=2Q(k) b=4b=4 b=8b=8 b=12b=12 b=16b=16
33 2.7⋅10−32.7\cdot10^{-3} 19.319.3 dB 43.443.4 67.567.5 91.591.5
3.723.72 2⋅10−42\cdot10^{-4} 17.417.4 41.541.5 65.665.6 89.789.7
44 6.3⋅10−56.3\cdot10^{-5} 16.816.8 40.940.9 65.065.0 89.089.0
55 5.7⋅10−75.7\cdot10^{-7} 14.914.9 39.039.0 63.063.0 87.187.1

For example b=8b=8, k=4k=4: 6.02⋅8+4.77−12.04=40.896.02\cdot8+4.77-12.04=40.89 dB.

4. Designing a quantizer

Typical data: the signal density (Gaussian, Laplacian, exponential) with its parameter, a maximum saturation probabilityprobability that the sample leaves the dynamic range and/or a minimum SNR.

  1. Dynamic range from the saturation probability.
  • zero-mean Gaussian: Psat=2Q(Vsatσ)⇒Vsat=σ Q−1(Psat2)P_{sat}=2Q\left(\frac{V_{sat}}\sigma\right)\Rightarrow V_{sat}=\sigma\,Q^{-1}\left(\frac{P_{sat}}2\right);
  • Laplacian (parameter bLb_L): Psat=e−Vsat/bL⇒Vsat=bLln⁡1PsatP_{sat}=e^{-V_{sat}/b_L}\Rightarrow V_{sat}=b_L\ln\frac1{P_{sat}};
  • exponential (positive signal): use the range [0,Vsat][0,V_{sat}] with Psat=e−λVsat⇒Vsat=1λln⁡1PsatP_{sat}=e^{-\lambda V_{sat}}\Rightarrow V_{sat}=\frac1\lambda\ln\frac1{P_{sat}} and step Δ=VsatL\Delta=\frac{V_{sat}}L (it makes no sense to waste half the levels on negative values);
  • bounded signal ∣a∣≤A\lvert a\rvert\le A: Vsat=AV_{sat}=A and Psat=0P_{sat}=0.
  1. Bits from the required SNR, solving the formula for bb: b≥ΛdB−4.77−20log⁡10σVsat6.02b\ge\frac{\Lambda_{dB}-4.77-20\log_{10}\frac\sigma{V_{sat}}}{6.02}, rounded up to the next integer (with fewer bits the SNR would be below the threshold). The actual SNR with integer bb is a little higher than required.
  2. Results: L=2bL=2^b, Δ=2VsatL\Delta=\frac{2V_{sat}}L, SNR, dynamic range [−Vsat,Vsat][-V_{sat},V_{sat}], output bits bb, rate FsbF_sb.

Example 1 (Gaussian). Zero-mean Gaussian signal with σ2=2\sigma^2=2 mV2^2, mid-riser quantizer with b=3b=3 bits and Psat=2⋅10−4P_{sat}=2\cdot10^{-4}.

  • Vsat=σ Q−1(10−4)=2⋅3.719=5.26V_{sat}=\sigma\,Q^{-1}(10^{-4})=\sqrt2\cdot3.719=5.26 mV.
  • L=8L=8: Δ=2⋅5.268=1.315\Delta=\frac{2\cdot5.26}8=1.315 mV.
  • Λq=σ2Δ2/12=2⋅121.729=13.88≈11.42\Lambda_q=\frac{\sigma^2}{\Delta^2/12}=\frac{2\cdot12}{1.729}=13.88\approx11.42 dB.

Example 2 (Gaussian, SNR given). σ=0.5\sigma=0.5 V, Psat≤10−4P_{sat}\le10^{-4}, SNR ≥40\ge40 dB. Q−1(5⋅10−5)=3.891Q^{-1}(5\cdot10^{-5})=3.891, Vsat=1.945V_{sat}=1.945 V. 20log⁡101.9450.5=11.8020\log_{10}\frac{1.945}{0.5}=11.80 dB, b≥40−4.77+11.806.02=7.81⇒b=8b\ge\frac{40-4.77+11.80}{6.02}=7.81\Rightarrow b=8. L=256L=256, Δ=2⋅1.945256=0.0152\Delta=\frac{2\cdot1.945}{256}=0.0152 V, Λq=6.02⋅8+4.77−11.80=41.13\Lambda_q=6.02\cdot8+4.77-11.80=41.13 dB. With b=7b=7 it would be 35.135.1 dB, insufficient.

Example 3 (Laplacian, SNR given). bL=1b_L=1 V (σ2=2bL2=2\sigma^2=2b_L^2=2 V2^2), Psat=2⋅10−4P_{sat}=2\cdot10^{-4}, SNR ≥60\ge60 dB. Vsat=ln⁡5000=8.52V_{sat}=\ln5000=8.52 V; 20log⁡101.4148.52=−15.620\log_{10}\frac{1.414}{8.52}=-15.6 dB; b≥60−4.77+15.66.02=11.76⇒b=12b\ge\frac{60-4.77+15.6}{6.02}=11.76\Rightarrow b=12, L=4096L=4096, Δ=4.16\Delta=4.16 mV, Λq=61.4\Lambda_q=61.4 dB. With 11 bits the SNR would be 55.455.4 dB (insufficient).

Signals with non-zero mean. What counts is the statistical power Ma=σ2+ma2M_a=\sigma^2+m_a^2, not the variance. For the exponential Exp⁡(λ)\operatorname{Exp}(\lambda): Ma=2λ2M_a=\frac2{\lambda^2}. With range [0,Vsat][0,V_{sat}] and LL levels Λq=MaΔ2/12\Lambda_q=\frac{M_a}{\Delta^2/12} with Δ=VsatL\Delta=\frac{V_{sat}}L. Alternatively the mean cc is subtracted before quantizing (and added back at the receiver): the power to cover is then σa2≪Ma\sigma_a^2\ll M_a.

When the simplification is not enough. Assumption (A) holds only if PsatP_{sat} is small compared with the granular error. As bb grows, Δ2/12\Delta^2/12 falls by a factor 4 per bit, while the saturation error power MsatM_{sat} stays the same (it depends only on VsatV_{sat} and the density). Sooner or later it dominates and the SNR stops growing: the 6 dB per bit rule fails. Then Me≃(1−Psat)Δ212+Psat MsatM_e\simeq(1-P_{sat})\frac{\Delta^2}{12}+P_{sat}\,M_{sat}.

Numerical example (zero-mean Gaussian with σ2=0.01\sigma^2=0.01 V2^2, range [−0.4,0.4][-0.4,0.4] V, Psat=2Q(4)=6.3⋅10−5P_{sat}=2Q(4)=6.3\cdot10^{-5}, numerical integration):

LL Δ\Delta Mgr=Δ212M_{gr}=\frac{\Delta^2}{12} MsatM_{sat} Λq\Lambda_q granular only Λq\Lambda_q total
88 0.10.1 V 8.3⋅10−48.3\cdot10^{-4} 3.6⋅10−73.6\cdot10^{-7} 10.7910.79 dB 10.7910.79 dB
800800 0.0010.001 V 8.3⋅10−88.3\cdot10^{-8} 6.3⋅10−86.3\cdot10^{-8} 50.7950.79 dB 48.3448.34 dB

With L=8L=8 saturation does not matter; with L=800L=800 it is almost on a par with the granular error and removes 2.52.5 dB.

5. Non-uniform quantizers

If the density is not uniform (for instance speech, with many values near zero) it is better to be more precise where the samples fall more often. The typical way is the compander: a compressor block deforms the scale, a uniform quantizer works on the compressed signal and an expander restores the original scale. The optimal steps for a given density can also be chosen.

6. Analog signals sent in digital form: channel errors

An analog signal sent with the chain A/D, coding, channel, decoding, D/A is affected by two independent sources of error: quantization (deterministic, depending on bb and VsatV_{sat}) and bit errors of the digital channel (probability PbitP_{bit} per bit): a wrong bit causes a wrong level to be decoded, with a possibly large error. The performance is the ratio between signal power and the sum of the two error powers, ΛPCM=MaMq+Mc\Lambda_{PCM}=\frac{M_a}{M_q+M_c} (the powers of the uncorrelated errors add; the SNRs in dB are not added).

The levels are sent with the natural binary code: level jj (0≤j<L0\le j<L) is written with bits j=∑i=0b−1βi2ij=\sum_{i=0}^{b-1}\beta_i2^i. The bit of weight 2i2^i has weight 2iΔ2^i\Delta on the level value. If the channel flips bit ii, the decoded level differs by ±2iΔ\pm2^i\Delta and the error power is (2iΔ)2\left(2^i\Delta\right)^2. With the binary symmetric channel (see Network Key Performance IndicatorsA network is a stack of layers; the packet of one layer is the payload of the layer below, with efficiency eta = |SDU|/|PDU|; the key indicators are bit-rate R0 >= throughput S >= goodput, nodal delay d = d_proc + d_queue + d_trans + d_prop with d_trans = L/R and d_prop = x/c, jitter (delay variability), the bandwidth-delay product BDP = S times RTT, and reliability (packet error rate PER = 1 - (1 - eps)^L on a binary symmetric channel, loss rate and delivery ratio), measurable with ping.Network Key Performance Indicators →), small PbitP_{bit} and at most one wrong bit per word:

Mc=∑i=0b−1Pbit (2iΔ)2=Pbit Δ2 4b−13.M_c=\sum_{i=0}^{b-1}P_{bit}\,\left(2^i\Delta\right)^2=P_{bit}\,\Delta^2\,\frac{4^b-1}3.

The most significant bit (i=b−1i=b-1) accounts for almost 34\frac34 of the error: errors on the high bits are the most harmful. With Mq=Δ212M_q=\frac{\Delta^2}{12} and Λq=MaΔ2/12\Lambda_q=\frac{M_a}{\Delta^2/12}:

ΛPCM=Λq1+4Pbit(4b−1)(linear scale).\boxed{\Lambda_{PCM}=\frac{\Lambda_q}{1+4P_{bit}\left(4^b-1\right)}}\qquad\textbf{(linear scale)}.

Convert Λq\Lambda_q from dB to linear before using it, and convert the result back. For a uniform full-scale signal Λq=4b\Lambda_q=4^b. From the required SNR Λ\Lambda, the maximum tolerable error probability is

Pbit≤Λq−Λ4Λ(4b−1)(Λ≤Λq).P_{bit}\le\frac{\Lambda_q-\Lambda}{4\Lambda\left(4^b-1\right)}\quad(\Lambda\le\Lambda_q).

Threshold. If Pbit≪14⋅4bP_{bit}\ll\frac1{4\cdot4^b}, ΛPCM≈Λq\Lambda_{PCM}\approx\Lambda_q: every extra bit gives 6.026.02 dB. If Pbit≫14⋅4bP_{bit}\gg\frac1{4\cdot4^b}, ΛPCM≈14Pbit\Lambda_{PCM}\approx\frac1{4P_{bit}} does not depend on bb: adding bits no longer improves, and at most ΛPCM→14Pbit\Lambda_{PCM}\to\frac1{4P_{bit}} (2424 dB for Pbit=10−3P_{bit}=10^{-3}).

Example (uniform signal, b=8b=8 bits, Λq=48=48.2\Lambda_q=4^8=48.2 dB):

PbitP_{bit} ΛPCM\Lambda_{PCM}
00 48.248.2 dB
10−410^{-4} 33.833.8 dB
10−310^{-3} 24.024.0 dB
10−210^{-2} 14.014.0 dB

Sizing example (cinema hall signals). Video with SNR of at least 5050 dB (b=9b=9, Λq=54.2\Lambda_q=54.2 dB): Pbit≤49−1054⋅105(49−1)=1.55⋅10−6P_{bit}\le\frac{4^9-10^5}{4\cdot10^5(4^9-1)}=1.55\cdot10^{-6}. Audio with 9292 dB (b=16b=16, Λq=96.3\Lambda_q=96.3 dB): Pbit≤9.95⋅10−11P_{bit}\le9.95\cdot10^{-11}: audio is the tighter constraint, since it has more bits and a higher SNR.

Typical mistakes

  • Δ=VsatL\Delta=\frac{V_{sat}}L with a symmetric range: the 22 is missing. (For [0,Vsat][0,V_{sat}] it is VsatL\frac{V_{sat}}L.)
  • Writing the mid-riser with level 00: the levels are at ±Δ2,±3Δ2,…\pm\frac\Delta2,\pm\frac{3\Delta}2,\dots.
  • One tail only for a symmetric signal: Psat=2Q(Vsatσ)P_{sat}=2Q\left(\frac{V_{sat}}\sigma\right), so Q−1(Psat2)Q^{-1}\left(\frac{P_{sat}}2\right).
  • Not rounding bb up and not giving the effective SNR.
  • Using the variance instead of the statistical power for signals with non-zero mean.
  • Believing the SNR grows 6 dB per bit always: only while saturation is negligible.
  • Applying Δ212\frac{\Delta^2}{12} with small LL or large PsatP_{sat} without checking the assumptions.
  • Adding SNRs in dB instead of error powers; forgetting the factor 4b−14^b-1; using Λq\Lambda_q in dB inside the linear formula.

Versione ripasso

Uniform mid-riser quantizer. Q:R→{Q0,…,QL−1}Q:\mathbb R\to\{Q_0,\dots,Q_{L-1}\}, L=2bL=2^b. Range [−Vsat,Vsat][-V_{sat},V_{sat}], step Δ=2VsatL\Delta=\frac{2V_{sat}}L, Vsat=2b−1ΔV_{sat}=2^{b-1}\Delta. Thresholds kΔk\Delta; levels ±Δ2,±3Δ2,…,±(L−1)Δ2\pm\frac\Delta2,\pm\frac{3\Delta}2,\dots,\pm\frac{(L-1)\Delta}2; no level 00 (mid-tread has it). Saturation returns ±(Vsat−Δ2)\pm(V_{sat}-\frac\Delta2). Example: L=8L=8, Vsat=4V_{sat}=4 V: Δ=1\Delta=1 V; 1.21.2 V →\to 1.51.5 V; −5-5 V →\to −3.5-3.5 V.

Error. eq=aq−ae_q=a_q-a, so aq=a+eqa_q=a+e_q: sawtooth; granular ∣eq∣≤Δ2|e_q|\le\frac\Delta2 inside the range, saturation error outside. Power: sum of two saturation integrals and a granular one.

  • (A) Psat=P[∣a∣>Vsat]P_{sat}=P[|a|>V_{sat}] small: Gaussian 2Q(Vsatσ)2Q\left(\frac{V_{sat}}\sigma\right); uniform 00 if Vsat≥AV_{sat}\ge A; Laplacian e−Vsat/bLe^{-V_{sat}/b_L}; exponential e−λVsate^{-\lambda V_{sat}} (range from 00).
  • (B) LL large: ee uniform in [−Δ2,Δ2][-\frac\Delta2,\frac\Delta2], me=0m_e=0, Me=Δ212M_e=\frac{\Delta^2}{12} (rms Δ12\frac\Delta{\sqrt{12}}), white noise.
  • Trade-off: large VsatV_{sat} lowers PsatP_{sat} but raises Δ\Delta; with huge LL saturation matters again.
  • Gaussian level probabilities (L=8L=8, Δ=σ\Delta=\sigma): 0.34130.3413, 0.13590.1359, 0.02140.0214, 0.001350.00135 per sign.

SNR. Λq=MaMe\Lambda_q=\frac{M_a}{M_e}, Ma=σ2+ma2M_a=\sigma^2+m_a^2. With (A), (B): Λq=3σa2Vsat24b\Lambda_q=3\frac{\sigma_a^2}{V_{sat}^2}4^b and

[Λq]dB=6.02 b+4.77+20log⁡10σaVsat.[\Lambda_q]_{dB}=6.02\,b+4.77+20\log_{10}\frac{\sigma_a}{V_{sat}}.

Each bit +6.02+6.02 dB; Vsat=kσV_{sat}=k\sigma costs 20log⁡10k20\log_{10}k (9.59.5 dB at k=3k=3, 1212 at 44, 1414 at 55). Uniform full scale: 4b4^b; sinusoid: 6.02b+1.766.02b+1.76. Example: Gaussian Vsat=4σV_{sat}=4\sigma, b=8b=8: 40.8940.89 dB.

Design. (1) VsatV_{sat}: Gaussian σQ−1(Psat2)\sigma Q^{-1}(\frac{P_{sat}}2); Laplacian bLln⁡1Psatb_L\ln\frac1{P_{sat}}; exponential on [0,Vsat][0,V_{sat}]: 1λln⁡1Psat\frac1\lambda\ln\frac1{P_{sat}}; bounded: AA. (2) b≥ΛdB−4.77−20log⁡10(σ/Vsat)6.02b\ge\frac{\Lambda_{dB}-4.77-20\log_{10}(\sigma/V_{sat})}{6.02} rounded up. (3) L=2bL=2^b, Δ=2VsatL\Delta=\frac{2V_{sat}}L, actual SNR, rate FsbF_sb.

  • Gaussian σ2=2\sigma^2=2 mV2^2, b=3b=3, Psat=2⋅10−4P_{sat}=2\cdot10^{-4}: Vsat=5.26V_{sat}=5.26 mV, Δ=1.315\Delta=1.315 mV, 11.4211.42 dB.
  • Gaussian σ=0.5\sigma=0.5 V, Psat≤10−4P_{sat}\le10^{-4}, ≥40\ge40 dB: Vsat=1.945V_{sat}=1.945 V, b=8b=8, L=256L=256, Δ=0.0152\Delta=0.0152 V, 41.141.1 dB; b=7b=7 gives 35.135.1 dB.
  • Laplacian bL=1b_L=1 V, Psat=2⋅10−4P_{sat}=2\cdot10^{-4}, ≥60\ge60 dB: Vsat=8.52V_{sat}=8.52 V, b=12b=12, L=4096L=4096, Δ=4.16\Delta=4.16 mV, 61.461.4 dB; b=11b=11 gives 55.455.4 dB.
  • Non-zero mean: statistical power Ma=σ2+ma2M_a=\sigma^2+m_a^2; Exp⁡(λ)\operatorname{Exp}(\lambda): 2λ2\frac2{\lambda^2}.
  • Saturation not negligible: Me≃(1−Psat)Δ212+PsatMsatM_e\simeq(1-P_{sat})\frac{\Delta^2}{12}+P_{sat}M_{sat}; with L=800L=800 the SNR loses 2.52.5 dB (50.7950.79 vs 48.3448.34 dB).
  • Non-uniform: compander = compressor, uniform quantizer, expander.

PCM with channel errors. Error powers add: ΛPCM=MaMq+Mc\Lambda_{PCM}=\frac{M_a}{M_q+M_c}. Natural binary code, bit ii weighs 2iΔ2^i\Delta: Mc=PbitΔ24b−13M_c=P_{bit}\Delta^2\frac{4^b-1}3; high bits are the most harmful.

ΛPCM=Λq1+4Pbit(4b−1)(linear scale),Pbit≤Λq−Λ4Λ(4b−1).\Lambda_{PCM}=\frac{\Lambda_q}{1+4P_{bit}(4^b-1)}\quad\text{(linear scale)},\qquad P_{bit}\le\frac{\Lambda_q-\Lambda}{4\Lambda(4^b-1)}.

Threshold: Pbit≪14⋅4bP_{bit}\ll\frac1{4\cdot4^b} gives 6.026.02 dB per bit; beyond it ΛPCM≈14Pbit\Lambda_{PCM}\approx\frac1{4P_{bit}}, independent of bb. b=8b=8 uniform: 48.248.2, 33.833.8 (10−410^{-4}), 24.024.0 (10−310^{-3}), 14.014.0 dB (10−210^{-2}). Cinema: video b=9b=9, 5050 dB: Pbit≤1.55⋅10−6P_{bit}\le1.55\cdot10^{-6}; audio b=16b=16, 9292 dB: Pbit≤9.95⋅10−11P_{bit}\le9.95\cdot10^{-11}, the tighter.

Typical mistakes: Δ=VsatL\Delta=\frac{V_{sat}}L with a symmetric range; level 00 in the mid-riser; one Gaussian tail only; rounding bb down; variance instead of power; 66 dB per bit even with saturation; SNRs in dB added; Λq\Lambda_q in dB inside the linear formula.

More reminders.

  • Quantizer example: thresholds {−1,0,1}\{-1,0,1\}, levels {−1.5,−0.5,0.5,1.5}\{-1.5,-0.5,0.5,1.5\}: 0.3→0.50.3\to0.5, −4→−1.5-4\to-1.5 (b=2b=2).
  • Rms error Δ12=0.289\frac\Delta{\sqrt{12}}=0.289 V for Δ=1\Delta=1 V, not Δ2\frac\Delta2.
  • Gaussian PsatP_{sat}: 3σ3\sigma: 2.7⋅10−32.7\cdot10^{-3}; 4σ4\sigma: 6.3⋅10−56.3\cdot10^{-5}; 5σ5\sigma: 5.7⋅10−75.7\cdot10^{-7}.
  • SNR examples: σ2=2\sigma^2=2 V2^2, Me=0.002M_e=0.002 V2^2: 1000=301000=30 dB. Table for Gaussian, b=8b=8: 43.443.4 (k=3k=3), 41.541.5 (3.723.72), 40.940.9 (44), 39.039.0 (55) dB.
  • Saturation power: MsatM_{sat} does not depend on bb; for large bb the granular term Δ212\frac{\Delta^2}{12} (divided by 4 per bit) falls below it and the SNR stops growing.

Teoria collegata