• Home
  • Textbooks
  • Audio Signal Processing and Coding
  • QUANTIZATION AND ENTROPY CODING

Audio Signal Processing and Coding

Andreas Spanias, Ted Painter, Venkatraman Atti

Chapter 3

QUANTIZATION AND ENTROPY CODING - all with Video Answers

Educators


Chapter Questions

Problem 1

Derive the PCM $6 \mathrm{~dB}$ per bit rule when the quantization error has a uniform probability density function.

Check back soon!

Problem 2

For a signal with Gaussian distribution (zero mean and unit variance)
a. Design a uniform PCM quantizer with four levels.
b. Design a nonuniform four-level quantizer that is optimized for the signal PDF. Compare with the uniform PCM in terms of SNR.

Check back soon!
01:13

Problem 3

For the PDF $p(x)=\frac{1}{2} e^{-|x|}$, determine the mean, the variance, and the probability that a random variable will fall within $\pm \sigma_x$ of the mean value.
FIGURE CANT COPY
Figure 3.22. An example PDF.

Manik Pulyani
Manik Pulyani
Numerade Educator

Problem 4

For the PDF, $p(x)$, given in Figure 3.22, design a four-level PDF-optimized PCM and compare to uniform PCM in terms of SNR.

Check back soon!

Problem 5

Give and justify a formula for the number of bits in simple vector quantization with $N \times 1$ vectors and $L$ template vectors.

Check back soon!

Problem 6

Give in terms of $L$ and $N$ the order of complexity in a VQ codebook search, where $L$ is the number of codebook entries and $N$ is the codebook dimension. Consider the following cases: (i) a simple VQ, (ii) a multi-step VQ, and (iii) a split VQ. For (ii) and (iii), use configurations given in Figure 3.12 and Figure 3.14, respectively.

Check back soon!

Problem 7

Design a DPCM coder for a stationary random signal with power spectral density $S\left(e^{j \Omega}\right)=\frac{1}{\left|1+0.8 e^{j \Omega}\right|^2}$. Use a first-order predictor. Give a block diagram and all pertinent equations. Write a program that implements the DPCM coder and evaluate the MSE at the receiver. Compare the SNR (for the same data) for a PCM system operating at the same bit rate.

Check back soon!

Problem 8

In this problem, you will write a computer program to design a vector quantizer and generate a codebook of size $[L \times N]$. Here, $L$ is the number of codebook entries and $N$ is the codebook dimension.

Step 1
Generate a training set, $T_{i n}$, of size $[L n \times N]$, where $n$ is the number of training vectors per codevector. Assume $L=16, N=4$, and $n=10$. Denote the training set elements as $t_{i n}(i, j)$, for $i=0,1, \ldots, 159$ and $j=0,1,2,3$. Use Gaussian vectors of zero mean and unit variance for training.
Step 2
Using the LBG algorithm [Lind80], design a vector quantizer and generate a codebook, $\boldsymbol{C}$, of size $[L \times N]$, i.e., $[16 \times 4]$. In the LBG VQ design, choose the distortion threshold as 0.001 . Label the codevectors as $c(i, j)$, for $i=$ $0,1, \ldots, 15$ and $j=0,1,2,3$.
FIGURE CANT COPY
Figure 3.23. Four-bit VQ design specifications for Problem 3.9.

Step 3
Similar to Step 1 generate another training set, $T_{\text {out }}$ of size $[160 \times 4]$ that we will use for testing the VQ performance. Label these training set values as $t_{\text {out }}(i, j)$, for $i=0,1, \ldots, 159$ and $j=0,1,2,3$.
Step 4
Using the codebook, $\boldsymbol{C}$, designed in Step 2, perform vector quantization of $t_{\text {in }}(i, j)$ and $t_{\text {out }}(i, j)$. Let us denote the VQ results as $\hat{t}_{\text {in }}(i, j)$ and $\hat{t}_{\text {out }}(i, j)$, respectively.
a. When the test vectors are within the training sequence, compute the over-all SNR and segmental SNR values as follows,
$$
\begin{aligned}
S N R_{\text {overall }} & =\frac{\sum_{i=0}^{L n-1} \sum_{j=0}^{N-1} t_{i n}^2(i, j)}{\sum_{i=0}^{L n-1} \sum_{j=0}^{N-1}\left(t_{i n}(i, j)-\hat{t}_{i n}(i, j)\right)^2} \\
S N R_{\text {segmental }} & =\frac{1}{L n} \sum_{i=0}^{L n-1} \frac{\sum_{j=0}^{N-1} t_{i n}^2(i, j)}{\sum_{j=0}^{N-1}\left(t_{i n}(i, j)-\hat{t}_{i n}(i, j)\right)^2}
\end{aligned}
$$
b. Compute the over-all SNR and segmental SNR values when the test vectors are different from the training ones, i.e., replace $t_{i n}(i, j)$ with $t_{\text {out }}(i, j)$ and $\hat{t}_{\text {in }}(i, j)$ with $\hat{t}_{\text {out }}(i, j)$ in (3.57) and (3.58).
c. List in Table 3.6 the overall and segmental SNR values for different number of codebook entries and different codebook dimensions. Explain the effects of choosing different values of $L, n$, and $N$ on the SNR values.
d. Compute the MSE, $\quad \varepsilon\left(t_{i n}, \hat{t}_{i n}\right)=\frac{1}{L n} \frac{1}{N} \sum_{i=0}^{L n-1} \sum_{j=0}^{N-1}\left(t_{i n}(i, j)-\right.$ $\left.\hat{t}_{i n}(i, j)\right)^2$ for different cases, e.g., $L=16,64, n=10,100,1000$, $N=2,8$. Explain how the MSE varies for different values of $L, n$, and $N$.

Check back soon!

Problem 9

Write a program to design a 4-bit VQ codebook $L_1$ (i.e., use $L=16$ codebook entries) with codebook dimension, $N=4$ (Figure 3.23). Use $n=100$ training vectors per codebook entry and a distortion threshold, $\varepsilon=$ 0.00001. For VQ-training choose zero mean and unit variance Gaussian vectors.
FIGURE CANT COPY
Figure 3.24. A three-stage vector quantizer.

Check back soon!
05:46

Problem 10

Extend the VQ design in problem 3.9 to a multi-step VQ (see Figure 3.24 for an example multi-step VQ configuration). Use a total of three stages in your VQ design. Choose the MSE distortion thresholds in each of the stages as $\varepsilon_1=0.001, \varepsilon_2=0.0001$, and $\varepsilon_3=0.00001$. Comment on the MSE convergence in each of the stages. How would you compare the multi-step VQ with a simple VQ in terms of the segmental and overall SNR values. (Note: In Figure 3.24, the first VQ codebook $\left(\boldsymbol{L}_1\right)$ encodes the signal $s$ and the subsequent VQ stages $\boldsymbol{L}_2$ and $\boldsymbol{L}_3$ encode the error from the previous stage. At the decoder, the signal, $s^{\prime}$, can be reconstructed as, $\boldsymbol{s}^{\prime}=\hat{\boldsymbol{s}}+\hat{\boldsymbol{e}}_1+\hat{\boldsymbol{e}}_2$ ).

Khoobchandra Agrawal
Khoobchandra Agrawal
Numerade Educator

Problem 11

Design a two-stage split-VQ. Choose $L=16$ and $n=100$. Implement the first-stage as a 4-dimensional VQ and the second-stage as two 2dimensional VQs. Select the distortion thresholds as follows: for the first stage, $\varepsilon_1=0.001$, and for the second stage, $\varepsilon_2=0.00001$. Compare the coding accuracy in terms of a distance measure and the coding gain in terms of the number of bits/sample of the split-VQ with respect to the simple VQ in problem 3.9 and the multi-step VQ in problem 3.10. (See Figure 3.14). a data set $V=\left[\begin{array}{lll}0 & 1 & 2\end{array}\right]$ :
a. Write a program to compute the entropy, $H_e(X)$.
b. Compute the symbol probabilities $p_i, i \in V$ for the input data stream, $X$.
c. Write a program to encode $X$ using Huffman codes. Employ an appropriate Huffman bit-mapping. Give the length of the output bitstream.
d. Use arithmetic coding to encode the input data stream, $X$. Give the final codeword interval range in the binary form. Give also the length of the output bitstream. (See Example 3.9.)

Check back soon!