S832 of 56
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S8 · Lesson 32 · Rate–distortion theory and quantization

The fewest bits that describe a source to within a given distortion, the Gaussian source's 6 dB per bit, a binary source with Hamming distortion, Lloyd–Max quantizers and how close they come, entropy-coded quantization's 1.53 dB gap, and source–channel separation

Lesson 30 compressed sources without losing anything. Audio, images and sensor readings are continuous, so a finite number of bits can never describe them exactly: something must be lost. Cover and Thomas ask the right question for lossy coding: for a given amount of distortion, what's the least number of bits per sample any scheme could use? For a Gaussian source the answer is the 6 dB per bit that lesson 8 found for PCM, and it shows how far practical quantizers fall short.

  • A Gaussian source of variance σ² described with R bits per sample. The solid line is the rate–distortion bound: the least mean-squared distortion any coder can reach, D=σ22−2R, falling 6.02 dB per bit.
  • The dots are the best fixed-rate scalar quantizers (Lloyd–Max) at 1 to 4 bits. The dashed line is a uniform quantizer followed by ideal entropy coding at high rate, 1.53 dB above the bound.
  • No scheme can go below the line. Getting closer than the dashed line takes coding many samples together: vector quantization.

Predict

A Gaussian source must be described with mean-squared error a hundredth of its variance (20 dB SNR). What's the least number of bits per sample any coder can use?

Name it

The rate–distortion function

For a source X, a reconstruction X^ and a distortion measure d(x,x^), the rate–distortion function is the least mutual information between them consistent with an average distortion D:

R(D)=minp(x^|x):E[d(X,X^)]≤D⁡I(X;X^)

Cover and Thomas prove it's achievable, by coding long blocks of samples together, and that nothing does better. It decreases as D grows and reaches zero when describing nothing (always guessing the mean) is good enough.

Two sources worth knowing

  • Gaussian, squared error: R(D)=12log2⁡(σ2/D) for D ≤ σ², or D(R)=σ22−2R. Each bit cuts the distortion by a factor of four: 6.02 dB. The Gaussian is the hardest source of a given variance to compress.
  • Binary (Bernoulli 1/2), Hamming distortion: R(D)=1−H(D) for D ≤ 1/2, where H is the binary entropy. Allowing 10% of the bits to be wrong saves almost half the rate: R(0.1) = 0.531 bit.

Scalar quantizers

A Lloyd–Max quantizer is the best fixed-rate scalar quantizer: its reconstruction levels sit at the centroids (conditional means) of their cells, and its cell boundaries halfway between levels. For a Gaussian source with one bit, the levels are ±σ√(2/π) = ±0.798σ and D=(1−2/π)σ2 = 0.363σ², 1.6 dB worse than R(D) at one bit. At high rate, a uniform quantizer followed by entropy coding of its outputs comes within 10log⁡(πe/6) = 1.53 dB of the bound, a quarter of a bit: the price of quantizing one sample at a time.

Separation

Shannon's source–channel separation theorem: a source can be sent over a channel with distortion D if and only if R(D)≤C (per channel use, adjusted for how many source samples each use carries). So the best system can be built in two independent parts, a compressor down to R(D) and a channel code up to C, without loss, at least for long blocks. Modern systems are built this way: codecs designed knowing nothing of the radio, and radios knowing nothing of the content.

Worked example

A sensor's Gaussian noise-like output must be stored with 30 dB SNR. How many bits per sample does the bound require, and how many would a uniform quantizer with ideal entropy coding need?

Show the solution
  1. The bound. R=306.02=4.98bits per sample
  2. Entropy-coded uniform quantizer. It's 1.53 dB worse, which costs 1.53/6.02 = 0.25 bit: R=30+1.536.02=5.24bits per sample
  3. Fixed-rate Lloyd–Max quantizer. It would need a whole number of bits, and even 5 bits falls short of 30 dB, so it would need 6.

Answer 4.98 bits per sample at the bound, 5.24 with an entropy-coded uniform quantizer and 6 with a fixed-rate Lloyd–Max quantizer.

Worked example

A Gaussian source producing 1000 samples per second is sent over a channel with capacity 3000 bits per second. What's the smallest mean-squared distortion any system can achieve?

Show the solution
  1. Bits per sample. Each sample gets at most 3 bits on average.
  2. The distortion bound. By separation, D=σ22−2×3=σ2/64 an SNR of 18.1 dB.
  3. What reaches it. No combination of compression and channel coding can beat it, and long-block separated designs approach it.
  4. A simple scheme. A one-sample-at-a-time 3-bit Lloyd–Max quantizer with ideal channel coding gets 0.0345σ², 14.6 dB.

Answer D=σ2/64, an SNR of 18.1 dB.

Worked example

Fair random bits may be reproduced with 5% of them wrong; and a Gaussian signal must be kept at 40 dB SNR. What rates do the bounds require?

Show the solution
  1. Random bits at 5% error. R(0.05)=1−H(0.05)=1−0.286=0.714 bit per bit, a saving of 29%.
  2. Gaussian at 40 dB. R=12log2⁡(104)=6.64bits per sample
  3. Practical quantizers. A uniform quantizer with ideal entropy coding needs about a quarter bit more (1.53 dB), and a fixed-rate Lloyd–Max quantizer about 0.72 bit more at high rates (4.35 dB, the Panter–Dite constant π3/2).

Answer 0.714 bit per bit for the random bits and 6.64 bits per sample for the Gaussian signal.

Check

A Gaussian source of variance 4 must be described with mean-squared error 0.01. What's the least rate, in bits per sample?

Check

A Gaussian source is coded at the rate–distortion bound with 2.5 bits per sample. What signal-to-distortion ratio results?

Check

A stream of fair random bits may be reproduced with a fraction 0.05 of them wrong. What's the least rate, in bits per source bit?

Check

A 1-bit Lloyd–Max quantizer codes a zero-mean Gaussian of standard deviation 1. Where are its two reconstruction levels (give the positive one)?

Check

How many bits per sample does a uniform quantizer with ideal entropy coding need for 30 dB SNR on a Gaussian source, at high rate?

Check

A Gaussian source of 500 samples per second is sent over a channel of capacity 4000 bit/s. What's the best possible signal-to-distortion ratio?

Check

A Gaussian source must be kept at 35 dB SNR; separately, fair bits may be reproduced with a fraction 0.02 wrong.

(a)

What rate per sample does the Gaussian bound require?

(b)

What rate per bit does the binary bound require?

Check

A Gaussian source of variance v is coded with mean-squared error D, or at rate R.

Step 1

What is the least rate for distortion D (D < v)?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why does coding many samples together beat quantizing each sample separately, even for a source with independent samples?

Practice

Keep practicing

9 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.