Digital Signal Processing Reference
In-Depth Information
r Cð0ÞX DCT ð0Þ cos p
8
1
2
3p
8
xð0Þ¼
þ Cð1ÞX DCT ð1Þ cos
5p
8
7p
8
þ Cð2ÞX DCT ð2Þ cos
þ Cð3ÞX DCT ð3Þ cos
r " 2
1
2
p
2 20 cos p
3p
8
¼
þ 1 ð1:8478Þcos
8
5p
8
7p
8
þ 1 2 cos
þ 1 0:7654 cos
¼ 10
b. With the MATLAB 1D inverse DCT function idct(), we obtain
>> idct([20 1.8478 2 0.7654])
ans ¼ 10.0000 8.0000 10.0000 12.0000
We verify that the input data samples are the same as those in Example 11.8.
In Example 11.9, we obtained an exact recovery of the input data from the DCT coefficients,
since infinite precision of each DCT coefficient is preserved. However, in transform coding,
each DCT coefficient is quantized using the number of bits per sample assigned by a bit alloca-
tion scheme. Usually the DC coefficient requires a larger number of bits to encode, since it carries
more energy of the signal, while each AC coefficient requires a smaller number of bits to enco-
de. Hence, the quantized DCT coefficients approximate the DCT coefficients in infinite precision,
and the recovered input data with the quantized DCT coefficients will certainly have quantization
errors.
EXAMPLE 11.10
Assuming the DCT coefficients
X DCT ð0Þ¼20; X DCT ð1Þ¼1:8478; X DCT ð2Þ¼2; and X DCT ð3Þ¼0:7654
in infinite precision, we recovered the exact data 10, 8, 10, and 12; this was verified in Example 11.9. If a bit
allocation scheme quantizes the DCT coefficients using a scale factor of 4 in the form
X DCT ð0Þ¼4 5 ¼ 20; X DCT ð1Þ¼4 ð0Þ¼0; X DCT ð2Þ¼4 1 ¼ 4;
and
X DCT ð3Þ¼4 0 ¼ 0
we can code the scale factor of 4 with 3 bits (magnitude bits only), the scaled DC coefficient of 5 with 4 bits
(including a sign bit), and the scaled AC coefficients of 0, 1, and 0 using 2 bits each. 13 bits in total are required.
Use the MATLAB function idct() to recover the input data samples.
Solution:
Using the MATLAB function idct() and the quantized DCT coefficients, we obtain
>> idct([20 0 4 0])
ans ¼ 12 8 8 12
As we see, the original sample requires 5 bits (4 magnitude bits and 1 sign bit) to encode each of 10, 8, 10, and 12
for a total of 20 bits. Hence, 7 bits are saved for coding this data block using the DCT. We expect many more bits to
be saved in practice, in which a longer frame of the correlated data samples is used. However, quantization errors
are introduced.
Search WWH ::




Custom Search