Maybe a Mistake of Figure 3.31 in Iain E. Richardson's H.264 Book on page 47?
Contents
Recently, I re-read Iain E. Richardson’s book: The H.264 Advanced Video Compression Standard, 2nd edition. I always focused on the theoretically part of the book and never pay attention to the detail of the calculation. But today I hit upon to check calculation of the book using Python for fun. The first part of the calculation I tried to check is about DCT which is printed on page 43-48. And I found that there maybe a mistake of figure 3.31 DCT coefficients on page 47.
I use two ways to check the result of DCT coefficients.
The first way is to use matrix A provided by the book to calculate the Y of X. Here is the formula:
and here is the matrix of A:
The code is very simple, here is the sample code:
|
|
The result of Y is:
The second way is to use the dct function of SciPy itself. Here is the sample code:
|
|
The result of Y is following which is the same as the first way:
But the result printed on page 47 is:
The second row and fourth row of the DCT coefficients is not the same as my result. The sign of the numbers is just the opposite! I also use inverse DCT to check my result, the inverse DCT result is the same as X. So I think the printed numbers on the book has some mistakes.
Author Watterry
LastMod 2019-12-18