some concepts in discrete cosine transforms class 2.pdf · some concepts in discrete cosine...
TRANSCRIPT
SOME CONCEPTS IN DISCRETE COSINE TRANSFORMS
~ Jennie G. Abraham
Fall 2009, EE5355
Under Digital Image and Video Processing files by Dr. Min Wu
Please see -
lecture10 - Unitary Transform
lecture11 - Transform Coding and JPEG
Also refer, Fundamentals of Digital Image Processing by A.K. Jain
ORTHOGONALITY
From last class we, revisit the Orthogonality Property.
Unitary vs Orthogonality
Unitary matrix: A is unitary if A-1 = A*T = AH
– Denote A*T as AH ~ “Hermitian”
Orthogonal matrix ~ A-1 = AT
– Row vectors of real orthogonal matrix A form orthonormal basis vectors
Real-valued unitary matrix is also an orthogonal matrix as is the case with DCT matrix
Exercise: Are the matrix here unitary or orthogonal?
– If yes, what are the basis vectors?
−=
22
1 jjA
=
11
21
2 jj
A
=
2132
3A
−=
21
21
21
21
4A
ROTATION :
Consider a vector in planar space, rotation of this vector (or coordinate points) is about the origin. The
rotation of this vector can be clockwise or counterclockwise in a plane oriented in the standard way.
In linear algebra, a rotation matrix is any matrix that acts as a rotation in Euclidean space. It is
important to understand the frame of reference when discussing rotations.
Consider the coordinate (x,y); here (x,y) is rotated by θ degrees and the coordinates after rotation are
(x',y'). The magnitude of the vector (x, y) is the same as the magnitude of vector (x′, y′).
Clockwise Rotation
Here (x,y) is rotated clockwise by θ.
Here, we can write this in matrix form as
or
Counterclockwise Rotation
Here, the coordinates will be rotated
counterclockwise about the origin.:
or
(x,y)
(x’,y’)
x-axis
y-axis
(x,y)
(x’,y’)
x-axis
y-axis
For completeness, we will mention about complex planes.
Complex plane
A complex number can be seen as a two-dimensional vector in the complex plane, with its tail at the
origin and its head given by the complex number. Let be such a complex number. Its
real component is the abscissa and its imaginary component its ordinate.
Then z can be rotated counterclockwise by an angle θ by pre-multiplying it with eiθ (see Euler's
formula, viz.
Algebraically,
a rotation matrix is an orthogonal matrix whose determinant is equal to 1:
R = rotation matrix when,
Rotation matrices are always square, and are usually assumed to have real entries.
Rotation matrix applied to an input vector rotates it at an angle (theta) about the origin (of x and y
axis). In image compression context, applying rotation does not modify the pixel values; they simple
shuffle the pixels within a block, in a deterministic way (called isometries). There are many
isometries. The following eight are commonly used:
• identity (no rotation or flip operation),
• orthogonal reflection about mid-vertical axis of block,
• orthogonal reflection about mid-horizontal axis of block,
• orthogonal reflection about first diagonal of block,
• orthogonal reflection about second diagonal of block,
• rotation around center of block, through +90◦,
• rotation around center of block, through +180◦,
• rotation around center of block, through −90◦.
In effect, these operations are able to generate, from a single block, a whole family of geometrically
related transformed blocks, which provides a pool in which matching blocks will be sought during the
encoding. More complex transformations can be used. But more bits will be required to identify each
transformation.
[Question(?)] Any orthogonal transform (say Q) can be decomposed into a series of rotations. This
helps in reducing the number of multiplies (though it may increase the adds).
(4 Multiplies, 2 Adds) (3 Multiplies and 3 Adds)
….ie for
Consider the example in the following paper-
Mutiplies 0 8 4 2 = 14Adds 8 8 8 2 = 26
Notations:
0
1
2
3
4
5
6
7
0
4
2
6
7
3
5
1
Stage 1 Stage 3 Stage 4 DCT Coeff.
DataA
C1
C1
V2 C6
C3
C3
S3
- S3
S1
- S1
V2 C6
Stage 2
The DCT Matrix F = A4A3A2A1, where A4, A3, A2, A1 are Sparse Matrix Factors (SMF).
Here, A1 and A4 remains as is, but we can write A2 and A3 as follows
A2 = diag [ , [A2’”. A2”. A2’] ]
and portion of A3= [A3’”. A3”. A3’]
For that we re-draw- A2”’ A2” A2’
As
(4 Multiplies, 2 Adds) (3 Multiplies and 3 Adds)
From this diagram, we can write the
decomposition SMFs A2’”, A2”, A2’
Similarly for A3. …….
For each time this transformation is substituted, we are changing 4M, 2A 3M, 3A.
Therefore
Mutiplies 0 6 3 2 = 11Adds 8 10 9 2 = 29
C3
C3
S3
- S3
S3 – C3
-(S3 – C3)
- SQRT(2)
The figure can be re-drawn as follows:
Previous works achieved thus -
[Question(?)] Conclusion :
The block diagram can be expressed as the flowgraph which yields the –
• DCT coefficients in the order 0,4,2,6,7,3,5,1.
• Input is the data sequence in natural order 0,1,2,3,4,5,6,7
• Using the algorithm express the DCT matrix as [A4 .A33. A3
2. A31. A2
3. A22. A2
1.A1]. This DCT
matrix has rows rearranged as 0,4,2,6,7,3,5,1.
Inverse DCT matrix (IDCT) is the transpose of DCT Matrix
To get the sparse matrix of IDCT, all we need to do is take the transpose matrix of the sparse matrices
of DCT as : [IDCT Matrix] =
The flowgraph of an IDCT (as shown below) is the same as for forward DCT with the direction
reversed, i.e. from left to right.
To show that DCT is Orthogonal -
EIGEN AND BASIS IMAGES
Like the 1D-DCT, which has basis functions, the 2D-DCT has basis images. Mapping of a 2D data
array into the 2D-DCT domain implies decomposing the 2D data array into the basis images of the
DCT. This can be illustrated with 2D (4x4) DCT. The basis images are numbered as below -
Basic Process of Transform Coding
M. Wu: ENEE631 Digital Image Processing (Spring'09) Lec11 – Transf. Coding & JPEG [27]
How to Encode Quantized How to Encode Quantized CoeffCoeff. in Each Block. in Each Block Basic tools
– Entropy coding (Huffman, etc.) and run-length coding– Predictive coding ~ esp. for DC
Ordering– zig-zag scan for block-DCT to better achieve run-length coding gain
Horizontal frequency
Vertical frequency
DCAC01
AC07
AC70AC77
⇒ low-frequency coefficients,then high frequency coefficients
UM
CP
EN
EE4
08G
Slid
es (c
reat
ed b
y M
.Wu
& R
.Liu
©20
02)