Sunteți pe pagina 1din 40

Graduate Institute of Photonics and Optoelectronics Engineering

College of Electrical Engineering and Computer Science


National Taiwan University
inal Term Paper !Tutorial"
ast #lgorithms for $iscrete Cosine and Sine Transforms
I$ %&&&'((((

Chung)*ei +uang
!"
#dvisor, -ian)-iun $ing. Ph/$/
#$%(00 &1 '
-une. 20((
ABSTRACT
or the $CT and $ST to 3e practical. the fast algorithms for their efficient
implementation in terms of reduced memory. implementation comple4ity and
recursively are essential/ The fast algorithms for one)dimensional $CTs and $STs are
the main points in this term paper/ In Chapter 2. the definitions. properties of the
relations 3etween $CTs and $STs are the first presented. followed 3y presentation of
the clear forms of orthonormal $CT and $ST matrices for N 5 2. ' and 6/ The fast ()$
rotation)3ased algorithms for the computation of $CTs and $STs 3ased on the
!recursive" sparse matri4 of the corresponding $CT and $ST matrices and represented
3y the generali7ed signal flow graphs are discussed in Chapter 8/ The matri4 reveals
various interrelations 3etween different versions of the $CT and $ST/ These selected
fast algorithms are very convenient in constructing integer appro4imations of $CTs and
$STs/
i
CONTENTS
#9ST%#CT///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////i
CONTENTS//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////ii
Chapter 1 Introduction..............................................................................................1
Chapter 2 Fast DCT/DST Alorith!s......................................................................2
2/( The definition and relations of $CT and $ST matrices/////////////////////////////////2
2/2 The e4plicit forms of $CT:$ST matrices//////////////////////////////////////////////////////;
Chapter " The #ast rotation$%ased DCT/DST alorith!s....................................1&
8/( The fast $CT)I and SCT algorithms/////////////////////////////////////////////////////////////(0
8/(/( $CT)I computation 3ased on the SCT algorithm for 2 (
m
N = + //////(0
8/(/2 $CT)I recursive sparse matri4 factori7ations//////////////////////////////////////(8
8/(/8 The split)radi4 $CT)I algorithm/////////////////////////////////////////////////////////('
8/2 The fast $ST)I and SST algorithms//////////////////////////////////////////////////////////////(1
8/2/(
$ST)I computation 3ased on the SST algorithm for
2 (
m
N +
////////(1
8/2/2 $ST)I recursive sparse matri4 factori7ations//////////////////////////////////////(6
8/2/8 The split)radi4 $ST)I algorithm//////////////////////////////////////////////////////////20
8/8 The fast $CT)II:$ST)II and $CT)III:$ST)III algorithms////////////////////////////22
8/' The fast $CT)I<:$ST)I< algorithms///////////////////////////////////////////////////////////2&
Chapter ' Conclusion..............................................................................................."1
%EE%ENCE//////////////////////////////////////////////////////////////////////////////////////////////////////////////////82
ii
Introduction
$iscrete cosine transforms !$CTs" and discrete sine transforms !$STs" are
mem3ers of the class of sinusoidal unitary transforms/ # sinusoidal unitary transform is
an inverti3le linear transform whose =ernel is defined 3y a set of complete. orthogonal
or orthonormal discrete cosine and sine 3asis functions/ The complete set of $CTs and
$STs. so)called discrete trigonometric transforms. consists of eight versions of $CT
and corresponding eight versions of $ST/ Since all present applications involve only
even $CT and $ST. the term paper considers only four types of even $CT and $ST/
The aspect for application of $CT and $ST is the e4istence of fast algorithms that allow
the efficient computation compared to the direct multiplication/ Over these years. many
fast algorithms for the efficient computation of one)dimensional $CT and $ST have
3een developed/ In general. they are 3ased on indirect computation or direct
computation. and they are generally classified as radi4)2. split)radi4 algorithms/
+owever. one of the most important re>uirements is that fast $CT or $ST algorithms
possess e4cellent numerical sta3ility/
This term paper discusses the fast rotation)3ased $CT:$ST algorithms/ #lmost all
are direct algorithms defined 3y the recursive spare matri4 of the transform matri4/ The
fast and numerically sta3le $CT:$CT algorithms with regular structure with only real
arithmetic are presented/ In particular. these rotation)3ased algorithms are very
convenient for the construction of integer transforms/ The generali7ed signal flow
graphs corresponding to the sparse matri4 decomposition of the transform matri4 are
also provided/
(
Fast DCT/DST Alorith!s
Chapter 1 The de#inition and relations o# DCT and DST
!atrices
9efore deriving the forms of orthonormal $CT and $ST matrices we recall their
definitions. 3asic mathematical properties and relations/ N is assumed to 3e an integer of
2/ # su3script in the matri4 notation denotes order of the matri4. while a superscript
denotes the type/
our orthonormal even $CTs in matri4 form denoted 3y
(
. . .
I II III IV
N N N N
C C C C
+
. are
respectively defined as
(
(
( ( (
2
cos . . 0.(. . .
. !2/("
2 !2
cos
I
N k n
kn
T
I I I
N N N
II
N k
kn
nk
C k n N
N N
C C C
C
N

+ + +
1
1
] 1
]
1 1
] ]
1
]
K
(
("
. . 0.(. . (.
2
. !2/2"
2 !2 ("
cos .
2
T
II II III
N N N
III
N n
kn
n k
k n N
N
C C C
k n
C
N N

+
1

1
]
1 1
] ]
+
1
1
] 1
]
K
(
. 0.(. . (.
. !2/8"
2 !2 ("!2 ("
cos . . 0.(. .
'
T
III III II
N N N
IV
N
kn
k n N
C C C
n k
C k n N
N N


1 1
] ]
+ +
1
1
] 1
]
K
K
(
(.
. !2/'"
T
IV IV IV
N N N
C C C

1 1
] ]
where
(
2
0 or .
( otherwise.
p
p p N

'

and the corresponding four orthonormal even $STs in matri4 form denoted 3y
2
(
. . .
I II III IV
N N N N
S S S S

( are respectively defined as


(
(
( ( (
2 ! ("! ("
sin . . 0.(. . 2.
. !2/;"
2 !2
sin
I
N
kn
T
I I I
N N N
II
N k
kn
n k
S k n N
N N
S S S
n
S
N


+ +
1
1
] 1
]
1 1
] ]
1
]
K
(
("! ("
. . 0.(. . (.
2
. !2/1"
2 !2 ("! ("
sin .
2
T
II II III
N N N
III
N n
kn
k
k n N
N
S S S
k n
S
N N

+ +
1

1
]
1 1
] ]
+ +
1
1
] 1
]
K
(
. 0.(. . (.
. !2/?"
2 !2 ("!2 ("
sin . . 0.(. . (.
'

T
III III II
N N N
IV
N
kn
k n N
S S S
n k
S k n N
N N


1 1
] ]
+ +
1
1
] 1
]
K
K
(
. !2/6"
T
IV IV IV
N N N
S S S

1 1
] ]
where
(
2
> (.
( otherwise/
q
N

'

The $CT)I matri4 given 3y !2/(" is defined for order N+1/ It is scaled version of
the symmetric cosine transform !SCT" for N = 2
m
+ 1/ The SCT matri4 denoted 3y
I
N
C
%
is of order N and it is defined as
(
2
cos . . 0.(. . .
( (
. !2/&"
I
N k n
kn
T
I I I
N N N
nk
C k n N
N N
C C C

1
1

1 ]

]
1 1
] ]
%
K
% % %
*here
(
2
0 or (.
( otherwise/
p
p p N

'

Similarly. the $ST)I given 3y !2/;" is defined for order N 1. and it is a scaled version
of the symmetric sine transform !SST" for N = 2
m
1/ The SST matri4 denoted 3y
I
N
S
%
is
8
of order N and it is defined as
(
2 ! ("! ("
sin . . 0.(. . (.
( (
/ !2/(0"
I
N
kn
T
I I I
N N N
n k
S k n N
N N
S S S

+ + 1
1

1 ]
+ +
]
1 1
] ]
%
K
% % %
The $CT)II has e4cellent energy compaction and among the currently =nown
unitary transforms it is the 3est appro4imation to the optimal @AT/ The $CT and $ST
matrices given 3y !2/("B!2/(0" are real)valued and orthonormal/ The normali7ation
factors 2:N . 2:!N)(" and 2:!NC(" in the forward and inverse transforms can 3e
merged as 2:N.
2:!N)("
and2:NC(. respectively. and moved either to the forward or
inverse transform/ If these normali7ation factors are merged these $CT and $ST
matrices will only 3e orthogonal/ The inverses of $CT and $ST matrices are simply
o3tained 3y transposing original matrices/ The matrices
(
I
N
C

.
IV
N
C .
(
I
N
S

.
IV
N
S including
I
N
C
%
and
I
N
S
%
. they are self)inverse/ The symmetry of the transform matri4 indicates that
the fast algorithms for the forward and inverse transform computation are identical/ The
matrices
II
N
C .
III
N
C are inverses of each other/ The same property holds for matrices
II
N
S
and
III
N
S / It means that fast algorithms for the inverse transform computation are
o3tained from the algorithms for forward transform computation performed in the
opposite direction/ To reduce the set of $CT and $ST matrices considered for the
efficient implementation we can e4ploit the relations 3etween $ST and their
corresponding $CT matrices/
II II
N N N N
S J C D .
III III
N N N N
S D C J !2/(("
whereas the matri4
IV
N
S is related to
IV
N
C matri4,
IV IV
N N N N
S J C D !2/(2"
'
where
N
J
is the cross)indentity matri4 and
N
D
is the diagonal odd)sign changing
matri4 given 3y ( ) { }
diag ( . 0. (. . (
k
N
D k N K
/ Conse>uently. the efficient
implementation of $ST)II and $ST)I< can 3e o3tained from those of $CT)II and $CT)
I< respectively 3y appropriate sign changes and reversal of order/
The matri4
IV
N
C is related to
II
N
C matri4
(
2
(
2 '
8 (
2 '
(
2
! ("
'
(
2
0 0 0
( 0 0 2cos 0
( ( 0 2cos
!2/(8"
( ( 0
0 2cos
( ( (
N
N IV II
N N
N
N
C C






,


,
L
L
L
L O
M M M O M
L
inally. for the $CT and $ST matrices the following relations
( ( ( ( ( ( ( (
. S .
I I I I
N N N N N N N N
C J D C J D S
+ + + +

. S .
II II II II
N N N N N N
C D C D S
. .
III III III III
N N N N N N N N
J C C D J S S D
( (
! (" . ! (" / !2/('"
N IV IV N IV IV
N N N N N N N N N N N N
C J D J D C S J D J D S


These relations allow us to limit our discussion in su3se>uent sections to
( (
. . . . and
I I II IV I I
N N N N N N
C S C C C S
+
% %
/
Chapter 2 The e)plicit #or!s o# DCT/DST !atrices
*e consider only the matrices
( (
. . . . and
I I II IV I I
N N N N N N
C S C C C S
+
% %
. and we will derive
their e4plicit orthonormal forms for values of
2. '. and 6 N
/ The elements of $CT)I
;
matri4
(
I
N
C
+
are defined 3y !2/("/ or
2. '. and 6 N
. we have the following e4plicit
forms,
( ( (
2 2
2
( (
8
2 2
( ( (
2 2
2
0
I
C
_



,
.
( ( ( ( (
2 2
2 2 2
( (
' '
2 2
( (
; 2 2
( (
' '
2 2
( ( ( ( (
2 2
2 2 2
cos 0 cos
(
0 ( 0
2
cos 0 cos
I
C


_









,
/
( ( ( ( ( ( ( ( (
2 2
2 2 2 2 2 2 2
( (
6 ' 6 6 ' 6
2 2
( (
' ' ' '
2 2
( (
6 ' 6 6 ' 6
2 2
( (
& 2 2
( (
6 ' 6 6 ' 6
2 2
(
' '
2
cos cos sin 0 sin cos cos
cos 0 cos ( cos 0 cos
sin cos cos 0 cos cos sin
(
0 ( 0 ( 0 ( 0
2
sin cos cos 0 cos cos sin
cos 0 cos (
I
C










(
' '
2
( (
6 ' 6 6 ' 6
2 2
( ( ( ( ( ( ( ( (
2 2
2 2 2 2 2 2 2
cos 0 cos
cos cos sin 0 sin cos cos


_















,
/
The elements of the $ST)I matri4
(
I
N
S

are defined 3y !2/;"/ or N 5 2. the matri4
( )
(
(
I
S
is trivial and N5' and6. we have the following forms,
' '
8
' '
sin ( sin
(
( 0 (
2
sin ( sin
I
S


_



,
.
1
6 ' 6 6 ' 6
' ' ' '
6 ' 6 6 ' 6
?
6 ' 6 6 ' 6
' ' ' '
6 ' 6 6 '
sin sin cos ( cos sin sin
sin ( sin 0 sin ( sin
cos sin sin ( sin sin cos
(
( 0 ( 0 ( 0 (
2
cos sin sin ( sin sin cos
sin ( sin 0 sin ( sin
sin sin cos ( cos sin sin
I
S












6
_









,
/
The elements of the SCT matri4
I
N
C
%
are defined 3y !2/&"/ or values of N 5 2. '
and 6. we have the following forms,
( (
2 2
2
( (
2 2
2
I
C
_

,
%
.
( ( ( (
2 2
2 2
( (
8 8
2 2
'
( (
8 8
2 2
( ( ( (
2 2
2 2
cos cos
2
cos cos 8
I
C


_







,
%
.
?
( ( ( ( ( ( ( (
2 2
2 2 2 2 2 2
2 8 8 2 ( (
? ? ? ? ? ?
2 2
2 8 8 2 ( (
? ? ? ? ? ?
2 2
8 2 2 8 ( (
? ? ? ? ? ?
2 2
6
8 2 2 8 ( (
? ? ? ? ? ?
2 2
2 (
?
2
cos cos cos cos cos cos
cos cos cos cos cos cos
cos cos cos cos cos cos
2
cos cos cos cos cos cos ?
cos
I
C



%
8 8 2 (
? ? ? ? ?
2
2 8 8 2 ( (
? ? ? ? ? ?
2 2
( ( ( ( ( ( ( (
2 2
2 2 2 2 2 2
cos cos cos cos cos
cos cos cos cos cos cos


_














,
/
The elements of the SST matri4
I
N
S
%
are defined 3y !2/(0"/ or values of N 5 2. '
and 6. we have the following forms,
2
8 8
2
2
8 8
sin sin
2
sin sin 8
I
S


_

,
%
.
2 2
; ; ; ;
2 2
; ; ; ;
'
2 2
; ; ; ;
2 2
; ; ; ;
sin sin sin sin
sin sin sin sin
2
sin sin sin sin ;
sin sin sin sin
I
S




_






,
%
.
2 ' ' 2
& & 8 & & 8 & &
2 ' ' 2
& & 8 & & 8 & &
8 8 8 8 8 8
' 2 2 '
& & 8 & & 8 & &
6
'
& & 8
sin sin sin sin sin sin sin sin
sin sin sin sin sin sin sin sin
sin sin 0 sin sin 0 sin sin
sin sin sin sin sin sin sin sin
2
sin sin sin s 8
I
S








%
2 2 '
& & 8 & &
8 8 8 8 8 8
2 ' ' 2
& & 8 & & 8 & &
2 ' ' 2
& & 8 & & 8 & &
in sin sin sin sin
sin sin 0 sin sin 0 sin sin
sin sin sin sin sin sin sin sin
sin sin sin sin sin sin sin sin




_















,
/
The elements of the $CT)II matri4
II
N
C are defined 3y !2/2"/ or values of N 5 2. '
and 6. we have the following forms,
6
( (
2 2
2
( (
2 2
II
C
_

,
.
( ( ( (
2 2 2 2
6 6 6 6
'
( ( ( (
2 2 2 2
6 6 6 6
cos sin sin cos
(
2
sin cos cos sin
II
C


_







,
.
( ( ( ( ( ( ( (
2 2 2 2 2 2 2 2
8 8 8 8
(1 (1 (1 (1 (1 (1 (1 (1
6 6 6 6 6 6 6 6
8 8 8 8
(1 (1 (1 (1 (1 (1 (1 (1
6
( ( ( ( ( ( ( (
2 2 2 2 2 2 2 2
cos cos sin sin sin sin cos cos
cos sin sin cos cos sin sin cos
cos sin cos sin sin cos sin cos
(
2
s
II
C






8 8 8 8
(1 (1 (1 (1 (1 (1 (1 (1
6 6 6 6 6 6 6 6
8 8 8 8
(1 (1 (1 (1 (1 (1 (1 (1
in cos sin cos cos sin cos sin
sin cos cos sin sin cos cos sin
sin sin cos cos cos cos sin sin



_














,
/
inally. the elements of the $CT)I< matri4
IV
N
C are defined 3y !2/'"/ or values of
N 5 2. ' and 6. we have the following forms,
6 6
2
6 6
cos sin
sin cos
IV
C


_

,
.
8 8
(1 (1 (1 (1
8 8
(1 (1 (1 (1
'
8 8
(1 (1 (1 (1
8 8
(1 (1 (1 (1
cos cos sin sin
cos sin cos sin
(
sin cos sin cos
2
sin sin cos cos
IV
C




_




,
.
&
8 ; ? ? ; 8
82 82 82 82 82 82 82 82
8 ? ; ; ? 8
82 82 82 82 82 82 82 82
; ? 8 8 ? ;
82 82 82 82 82 82 82 82
? ; 8
82 82 82
6
cos cos cos cos sin sin sin sin
cos sin sin sin cos cos cos sin
cos sin cos cos sin sin cos sin
cos sin cos
(
2
IV
C






8 ; ?
82 82 82 82 82
? ; 8 8 ; ?
82 82 82 82 82 82 82 82
; ? 8 8 ? ;
82 82 82 82 82 82 82 82
8 ? ; ; ?
82 82 82 82 82 82 82
sin cos sin cos sin
sin cos sin cos sin cos sin cos
sin cos sin sin cos cos sin cos
sin cos cos cos sin sin sin








8
82
8 ; ? ? ; 8
82 82 82 82 82 82 82 82
cos
sin sin sin sin cos cos cos cos


_












,
Investigating the 3asis vectors which rows of the matrices
( (
. . . and
I I II I I
N N N N N
C S C C S
+
% %
. we o3serve that they e4hi3it certain symmetries/ The location
of symmetry center is determined 3y the length or order of the row. which is the discrete
num3er of elements/ *hen the order of the matri4 is even. the symmetry center is
located in midpoint 3etween adDacent center elements of the row vector/
(0
The #ast rotation$%ased DCT/DST alorith!s
In this chapter. we introduce the fast $CT:$ST algorithms !radi4)2 and split)radi4"
with regular structure/ Eost of them are completely recursive and use only
permutations. 3utterfly operations and rotations/ Compared to direct matri4 vector
multiplication for a given N)length input data vector. the fast $CT:$ST algorithms of
radi4)2 reduce the computational comple4ity appro4imately from 2
2
N arithmetic
operation !
2
N multiplications and
! (" N N
additions" to
2
2 log N N
arithmetic
operations !
2 2
log
N
N
multiplications and
2
log N N
additions"/
Chapter 1 The #ast DCT$I and SCT alorith!s
(/( $CT)I computation 3ased on the SCT algorithm for
2 (
m
N = +
#ssuming 2 (
m
N + . the SCT algorithm can 3e adapted for a new fast recursive
computation of the $CT)I as follows/
Using
I
k
c%
and
n
x
to represent the k)th and n)th elements of the transformed vector
and input vector. respectively. !2/&" for ( M N can 3e e4pressed as
0
2
cos . 0.(. . /
M
I
k k n n
n
nk
c x k M
M M

% K
Ignoring the scaling factors. the essential part of the a3ove sum can 3e e4pressed as
(
0
cos ! (" ! " ! (" . 0.(. . /
M
I k k
k n M M M
n
nk
c x x a k x k M
M

+ +

% K
Splitting the sum
! "
M
a k
into even)inde4ed and odd)inde4 points and applying the
((
symmetries of transform =ernels the complete formula are given 3y
2 2 2
! " ! " ! ". 0.(. . . ! " 0/
2 2
M M M
M
M M
a k a k b k k b + K
2 2
! " ! " ! ". 0.(. . (.
2
M M
M
M
a M k a k b k k K
!8/("
where
2
2
(
2
0 2
! " cos .
M
M
n
M
n
nk
a k x

2
2
(
2 (
0 2
!2 ("
! " cos /
2! "
M
M
n
M
n
n k
b k x

!8/2"
The
! (" M +
)point $CT)I is recursively decomposed into
2
! ("
M
+
)point $CT)I and
2
M
)point $CT)II/ The corresponding generali7ed signal flow graph for the forward
and inverse $CT)I computation for N 5 8. ; and & is shown in ig/ 8/(/ The input data
se>uence{ }
n
x
is in 3it)reversed order/ ull lines in ig 8/( represent unity transfer
factors while 3ro=en lines represent transfer factor ( /
d
represents addition and
represents multiplication after addition/
(2
ig/ 8/( The generali7ed signal flow graph for the forward and inverse $CT)I
computation for N =8. ; and & 3ased on the SCT algorithmF
2
2
/ a =
On the other hand. the N)point SCT defined 3y !2/&" for 2
n
N . without the
scaling factors can 3e e4pressed as
(
0
cos ! ". 0.(. . (.
(
N
I
k n N
n
nk
c x a k k N
N

% K
and decomposed 3y similar method used in !8/(" and !8/2" into
2
N
)point SCT and
2
N
)
point $CT)II as follows
(8
2 2
! " ! " ! ". 0.(. . (.
2
N N
N
N
a k a k b k k + K
2 2
! ( " ! " ! ". 0.(. . (/
2
N N
N
N
a N k a k b k k K !8/8"
where
2
2
(
2
0
! " cos .
(
N
N
n
n
nk
a k x
N

2
2
(
2 (
0
!2 ("
! " cos /
(
N
N
n
n
n k
b k x
N


!8/'"
Unfortunately. the decomposition of the SCT given 3y !8/8" and !8/'" is not recursive
implying that the SCT matri4
I
N
C
%
does not have a recursive structure/
(/2 $CT)I recursive sparse matri4 factori7ations
The $CT)I matri4
(
I
N
C
+
for 2
m
N can 3e factori7ed into the following recursive
sparse matri4,
2 2
2
2 2 2
2 2
(
( (
0
2
0
N N
N
N N N
N N
I
I
N N
III
I J
C
C P
J C J
J I
+
+ +
_
_



,


,
. !8/;"
where
( N
P
+
is a permutation matri4. when it is applied to a data vector it corresponds to
the reordering
0 0 ( 2 2 2 (
. . . 0.(. . (
2
n n N n n
N
x x x x x x n
+ + +
% % % K / !8/1"
The
! (" N +
)point $CT)I is decomposed recursively into
2
! ("
N
+
)point $CT)I and
2
N
)point $CT)III/ The generali7ed signal flow graph for the forward and inverse $CT)I
('
computation for
2. ' and 6 N
is shown in ig/ 8/2/
ig/ 8/2 The generali7ed signal flow graph for the forward and inverse $CT)I
computation for N =2. ' and 6 3ased on recursive sparse matri4 factori7ation !8/;"F
2
2
a =
(/8 The split)radi4 $CT)I algorithm
The complete formulae of split)radi4 fast $CT)I algorithm are given 3y
2
2
2
0 2
! " cos cos . 0.(. . .
2
N
N
I
k n N n
N
n
nk N
c x x x k k

K
' (
. (. 2. .
'
I
k k k
N
c a b k

+ K
(;
' ( 0
. 0.(. . (. 3 0.
'
I
k k k
N
c a b k
+
K !8/1"
where
( )
( ) ( )
'
8
2 2 ' '
0
cos sin cos cos !' (".
'
'
N
N N N N
k n N n n n
n
n n nk
a x x x x x x k
N
N N

+

1
+ +
1
]

( )
( )
'
2 2
(
(
sin cos sin /
'
N
N N
k n N n n n
n
n n nk
b x x x x
N
N N

1

1
]
!8/?"
Thus. the first stage of split)radi4 decomposition replaces
! (" N +
)point $CT)I 3y
one
2
! ("
N
+
)point $CT)I. one $CT)I of length
'
! ("
N
+
and one $ST)I of length
'
! ("
N

/
The decomposition is used recursively/ It results in the generali7ed signal flow graph
with regular structure which is shown for N (. ' and 6 in ig/ 8/8/ The output data
se>uence{ }
I
k
c
is in 3it)reversed order/ #ccording to split)radi4 $CT)I algorithm. the
matri4
(
I
N
C
+
can 3e recursively factori7ed as follows
2 2
2
2
2 2
(
( (
0
2
0
N N
N
N
N N
I
I
N N
I J
C
C P
K
J I
+
+ +
_
_



,


,
. !8/6"
where
' '
'
2 ' ' 2
'
( (
(
( (
(
2
0
0
0 .
0
0 0
N N
N
N N N N
N
I
I
I J
S
K J I R
C
I

_
_




,
,
%
%

!8/&"
and
(
'
2
( 2 2
(
'
2
cos
( (
( (
. . /
( ( cos 2 2
I
K K C

_
_




,
,
!8/(0"
(1
( N
P
+
is a permutation matri4 for reordering from 3it)reversal to natural order/
'
(
N
I
S

%
and
'
(
N
I
C
+
%
are unnormali7ed $ST)I and $CT)I matrices respectively given 3y
' ' ' ' '
( ( ( ( (
! " .
N N N N N
I I
S J B S J

%
' ' ' ' '
( ( ( ( (
! "
N N N N N
I I
C J B C J
+ + + + +

%
.
where
'
(
N
B

and
'
(
N
B
+
are 3it)reversal permutation matrices/
2
N
R
is a rotation matri4 given
3y
' '
2
' '
2 2
! (" ! ("
'
! (" ! ("
2 2
(
2
cos 0 sin 0
cos sin
/ /
cos sin
0 cos 0
/
sin cos
/ /
sin cos
sin cos 0
0 0 0
N N
N
N N
N N
N N
N N
N N
N N
N N
R










,
*e note that the recursive sparse matri4 factori7ation of $CT)I matri4 given 3y
!8/6")!8/(0" is valid for N 2. ' and 6/
(?
ig/ 8/8 The generali7ed signal flow graph for the forward and inverse $CT)I
computation for N =2. ' and 6 3ased on the split)radi4 algorithmF
2
2
a =
Chapter 2 The #ast DST$I and SST alorith!s
2/( $ST)I computation 3ased on the SST algorithm for 2 (
m
N +
#ssuming 2 (
m
N . the SST algorithm can 3e adapted for a new fast recursive
computation of the $ST)I as follows/
%ewriting !2/(0" for ( M N + we have
(6
0
2 ! ("! ("
sin ! ". 0.(. . 2/
M
I
k n M
n
n k
s x a k k M
M M

+ +

% K
Ignoring the scaling factor we can split the sum
! "
M
a k
into even)inde4ed and odd)
inde4ed points and using the symmetries of transform =ernels. the complete formulae
are given 3y
2 2 2
! " ! " ! ". 0.(. . (. a ! (" 0.
2 2
M M M
M
M M
a k b k a k k + K
2 2
! 2" ! " ! ". 0.(. . 2.
2
M M
M
M
a M k b k a k k K !8/(("
where
2
2
2
2 (
0 2
! ("! ("
! " sin .
M
M
n
M
n
n k
a k x

+ +


2
2
(
2
0 2
!2 ("! ("
! " sin /
2! "
M
M
n
M
n
n k
b k x

+ +

!8/(2"
+ence. the
! (" M
)point $ST)I is recursively decomposed into an
2
M
)point $ST)II
and an
2
! ("
M

)point $ST)I/ The corresponding generali7ed signal flow graph for the
forward and inverse $ST)I computation for N 8 and ? is shown in ig/ 8/'/ The input
data se>uence{ }
n
x
is in 3it)reversed order/ The output data se>uence{ }
I
k
s
is in reverse
order/
(&
ig/ 8/' The generali7ed signal flow graph for the forward and inverse $ST)I
computation for N =8 and ? 3ased on the SST algorithm/
On the other hand. the N)point SST defined 3y !2/(0" for 2
n
N . without the
scaling factors can 3e e4pressed as
(
0
! ("! ("
sin ! ". 0.(. . (.
(
N
I
k n N
n
n k
s x a k k N
N

+ +

+

% K
and decomposed 3y similar methods used in !8/((" and !8/(2" into
2
N
)point SST and
2
N
)
point $ST)II as follows
2 2
! " ! " ! ". 0.(. . (.
2
N N
N
N
a k b k a k k + K
2 2
! (" ! " ! ". 0.(. . (/
2
N N
N
N
a N k b k a k k K !8/(8"
where
20
2
2
(
2 (
0
! ("! ("
! " sin .
(
N
N
n
n
n k
a k x
N

+ +

2
2
(
2
0
2 !2 ("! ("
! " sin /
(
N
N
n
n
n k
b k x
N

+ +


!8/('"
Unfortunately. the decomposition of the SST given 3y !8/(8" and !8/('" is not recursive
implying that the SST matri4
I
N
S
%
does not have a recursive structure/
2/2 $ST)I recursive sparse matri4 factori7ations
The $ST)I matri4
(
I
N
S

for 2
m
N can 3e factori7ed into the following recursive
sparse matri4,
2 2
2 2
2 2
2 2
( (
( (
( (
( (
0
2
0
N N
N N
N N
N N
III
I
N N
I
I J
B S
S B
S J
J I




_
_



,


,
. !8/(;"
where
( N
B

is a permutation matri4 permuting the transformed data se>uence from the
3it)reversal order to natural order/ The corresponding generali7ed signal flow graph for
N ' and 6 is shown in ig/ 8/;/
2(
ig/ 8/; The generali7ed signal flow graph for the forward and inverse $ST)I
computation for N =' and 6 3ased on !8/(;"
# slightly different alternative sparse matri4 factori7ation of the $ST)I matri4 for
2
m
N is defined as
2 2
2
2 2 2
2 2
( (
( (
( ( (
( (
0
2
0
N N
N
N N N
N N
III
I
N N
I
I J
S
S P
J S J
J I




_
_



,


,
. !8/(1"
where
( N
P

is a permutation matri4 which when it is applied to a data vector
corresponds to the reordering
0 0 ( 2 2 2 2 (
. . . 0.(. . 2
2
n n N n n
N
x x x x x x n
+ + +
% % % K / !8/(?"
The generali7ed signal flow graph for the forward and inverse $ST)I computation
for ' and 6 N is shown in ig/ 8/1/ In 3oth factori7ations !8/(;" and !8/(1". the
22
! (" N
)point $ST)I is decomposed recursively into
2
! ("
N

)point $ST)I and


2
N
)point
$ST)III/
ig/ 8/1 The generali7ed signal flow graph for the forward and inverse $ST)I
computation for N =' and 6 3ased on !8/(1"
2/8 The split)radi4 $ST)I algorithm
The complete formulae of split)radi4 fast $ST)I algorithm are given 3y
2
(
2
( 2
! "sin . (. . (.
2
N
I
k n N n
N
n
nk N
s x x k

K
' (
. (. 2. .
'
I
k k k
N
s a b k

K
' ( 0
. 0.(. . (. a 0.
'
I
k k k
N
s a b k
+
+ K !8/(6"
where
( )
( )
'
2 2
(
(
cos sin sin .
'
N
N N
k n N n n n
n
n n nk
a x x x x
N
N N

1
+ +
1
]

28
( )
( ) ( )
'
8
2 2 2 ' '
0
sin cos cos cos !' ("
'
'
N
N N N N N
k n N n n n
n
n n nk
b x x x x x x x k
N
N N

+

1
+ + + + +
1
]
. !8/(&"
+ence. the first stage of split)radi4 decomposition replaces
! (" N
)point $ST)I 3y
one
2
! ("
N

)point $ST)I. one $ST)I of length


'
! ("
N

and one $CT)I of length


'
! ("
N
+
/
The decomposition is used recursively/ It results in the generali7ed signal flow graph
with regular structure which is shown for N ' and 6 in ig/ 8/?/ The output data
se>uence{ }
I
k
s
is in 3it)reversed order/ #ccording to split)radi4 $ST)I algorithm. the
matri4
(
I
N
S

can 3e recursively factori7ed as follows
2 2
2
2 2
2 2
( (
( (
0
(
0
N N
N
N N
N N
I
N N I
I J
K
S P
S J
J I


_
_





,

,
. !8/20"
where
' '
'
' '
2 2 2
'
( (
(
( (
(
0 0
0
0 0
.
0
0 0 ( 0
0 0 0 (
N N
N
N N
N N N
N
I
I
I J
S
J I
K Q R
C


+
_

_


,

,
%
%

!8/2("
and
'
2 2 '
'
0 0 0 (
sin ( ( 0 0 0
(
. /
sin ( 0 ( 0 0 2
0 0 ( 0
III
K S Q

_

_




,

,

!8/22"
( N
P

is a permutation matri4 for reordering from 3it)reversal to natural order/
'
(
N
I
S

%
and
'
(
N
I
C
+
%
are unnormali7ed $ST)I and $CT)I matrices respectively given 3y
2'
' ' ' ' '
( ( ( ( (
! " .
N N N N N
I I
S J B S J

%
' ' ' ' '
( ( ( ( (
! "
N N N N N
I I
C J B C J
+ + + + +

%
.
where
'
(
N
B

and
'
(
N
B
+
are 3it)reversal permutation matrices/
2
N
R
is a rotation matri4 given
3y
' '
2
' '
2 2
! (" ! ("
'
! (" ! ("
2 2
(
2
cos 0 sin 0
cos sin
/ /
cos sin
0 sin 0
/
sin cos
/ /
sin cos
sin cos 0
0 0 0
N N
N
N N
N N
N N
N N
N N
N N
N N
R










,
*e note that the recursive sparse matri4 factori7ation of $ST)I matri4 given 3y !8/20")
!8/22" is valid for N ' and 6/
2;
ig/ 8/? The generali7ed signal flow graph for the forward and inverse $ST)I
computation for N =' and 6 3ased on split)radi4 algorithm/
Chapter " The #ast DCT$II/DST$II and DCT$III/DST$III
alorith!s
The first direct real)valued fast algorithm for the $CT)II computation which is
3ased on the recursive sparse matri4 factori7ation of $CT)II transform matri4 defined as
2 2 2
2 2 2 2
0
.
0
N N N
N N
N N
II
II
N N
IV
I J
C
C B
J I C J
_
_



, ,
)
)
!8/28"
where
2
N
II
C
)
is the $CT)II matri4 of half si7e with 3it)reverse reordered rows. and
2 2
N N
IV
C J
)
is
the $CT)I< matri4 of half si7e with 3it)reverse reordered rows and its columns in
reverse order/
N
B
is a permutation matri4 which permutes the transformed data se>uence
from the 3it)reverse order to natural order/ The recursive sparse matri4 factori7ation has
21
3ecome the fundamental form in the su3se>uent development of the direct real)valued
fast $CT)II algorithms and it has initiated an e4tensive search to find an optimal
factori7ation of the $CT)I< matri4/ Essentially. the recursive sparse matri4 factori7ation
!8/28" is evident when we consider the $CT)II in the form of a sum as follows,
(
0
!2 ("
cos . 0.(. . (/
2
N
II
k n
n
n k
c x k N
N

K
Splitting the sum into even)inde4ed and odd)inde4ed transform coefficients and using
the symmetries of the transform =ernels we get
2
(
2 (
0 2
!2 ("
! " cos .
2! "
N
II
k n N n
N
n
n k
c x x

+
+

2
(
2 ( (
0 2
!2 ("!2 ("
! " cos . 0.(. . (
'! " 2
N
II
k n N n
N
n
n k N
c x x k

+ +

K /
Thus. the N)point $CT)II is recursively decomposed into an
2
N
)point $CT)II and an
2
N
)
point $CT)I</ In general. since the factori7ation of $CT)I< matri4 is the 3asis of direct
real)valued fast $CT)II algorithms. all others proposed algorithms differ only 3y a
modified factori7ation of $CT)I< matri4 which corresponds for a given N to the lower
part in an appropriate signal flow graph/ The generali7ed signal flow graph for the $CT)
II computation with the proposed factori7ation of
2
N
IV
C
for N 2. ' and 6 is shown in
ig/ 8/6/
2?
ig/ 8/6 The generali7ed signal flow graph for the $CT)II computation for N =2. '
and 6 3ased on !8/28"/
# slightly different recursive sparse matri4 factori7ation of the $CT)II matri4 and
for completeness of the $ST)II matri4 are respectively defined as
2 2 2
2 2 2 2 2
0
.
0
N N N
N N N N N
II
II
N N
IV
I J C
C P
J I J C J
_ _


, ,
!8/2'"
2 2 2
2 2 2 2 2
0
.
0
N N N
N N N N N
IV
II
N N
II
I J S
S P
J I J S J
_ _


, ,
!8/2;"
26
where
N
P
is a permutation matri4 which reorders the transformed vector such that the
first half are even)inde4ed coefficients in natural order. while the second half are odd)
inde4ed coefficients 3ut in reverse order/ The generali7ed signal flow graph for the
$CT)II computation with the proposed factori7ation of
2
N
IV
C
for N 2. ' and 6 is shown
in ig/ 8/&
ig/ 8/& The generali7ed signal flow graph for the $CT)II computation for N =2. '
and 6 3ased on !8/2'"/
The orthogonal recursive spares matri4 factori7ation of
II
N
C matri4 for
2 . (
m
N m > is in the form
2 2 2
2 2 2
2 2 2 2
2 2 2 2
0
2
2 0
0 0
2
.
0 2 0
N N N
N N N
N N N N
N N N N
II
II T
N N
IV
II
T
N
IV
I J C
C P
I J C
I I J C
P
J J I C
_ _


, ,
_ _ _


, , ,
!8/21"
2&
where
N
P
is a permutation matri4. when it is applied to a data vector it corresponds to
the reordering
2
2 2 (
. . 0.(. . (
2
N
n n n n
N
x x x x n
+ +
% % K / !8/2?"
Note that
( T
N N
P P

/ 9y com3ining the orthogonal recursive sparse matri4


factori7ation of
2
N
II
C
and
2
N
IV
C
/ *e o3tain the following factori7ation of
II
N
C matri4,
'
2 2 '
2 2 '
'
2
2
!0"
!0"
!("
0 0
0 0
0
.
0
N
N N N
N N N
N
N
N
II
T IV
II T
N N
T II
II
N
C
I P C
C P
A P C
C
T
T
T
_

_ _



, ,


,
_


,
!8/26"
where
2
N
A
.
2
!("
N
T
and
2
!0"
N
T
.
!0"
N
T are orthogonal matrices defined as
' ' '
2
' ' ' '
( (
( (
2 0
0
2
.
0 2
0 2
N N N
N
N N N N
I I I
A
I I D J


_

_





,

,
80
'
2
'
!("
' '
' '
0
0
cos sin
2 2
2 2
cos sin
2 2
/ /
! (" ! ("
cos sin
2 2
.
! (" ! ("
sin cos
2 2
/ /
2 2
sin cos
2 2
sin cos
2 2
N
N
N
N N
N N
I
T
D
N N
N N
N N
N N
N N
N N






_


,
_










,
' ' ' ' '
2
' ' ' ' '
!0"
0
2 2
.
0 2 2
N N N N N
N
N N N N N
I J I I J
T
I J J J I
_ _ _


, , ,
*here
'
'
diagG! (" H. 0.(. (
N
k
N
D k K
is the diagonal odd)sign changing matri4/
The corresponding generali7ed signal flow graph for the $CT)II computation for 2 N
. ' and6 is shown in ig/ 8/(0/ or 6 N . each output coefficient should 3e normali7ed
3y scaling factor
2
'
to get the true $CT)II coefficients/
8(
ig/ 8/(0 The generali7ed signal flow graph for the $CT)II computation for N =
2. ' and 6 3ased on !8/26"F
2 a =
/
inally. it is important to present a practical fast algorithm from the class of fast 6)
point $CT)II algorithms generated from the full matri4 e>uation in a systematic way
using graph transformations and e>uivalence relations/ In the definition of $CT)II the
scaling constant
2
has 3een introduced which resulted in 2 (
k
for 0 k allowing
for the coefficient
0
II
c to 3e evaluated without any multiplication/ The 6)point $CT)II
computation re>uire (( multiplication and 2& additions. thus achieving the theoretical
lower 3ound of the num3er of multiplications for 6 N / The corresponding signal flow
graph for scaled $CT)II computation for 6 N is shown in ig/ 8/((/ or 6 N . each
82
output coefficient should 3e normali7ed 3y scaling factor
(
6
to get the true $CT)II
coefficients/
ig/ 8/(( The signal flow graph for the scaled $CT)II computation for N =6F
2 a =
/
In Section 8)()8. we o3serve from the split)radi4 fast $CT)I algorithm that there
e4ists a factori7ation of N )point $CT)III matri4
III
N
C 3ased on
2
! ("
N

)point $ST)I and


2
! ("
N
+
)point $CT)I/ #ctually. such orthogonal recursive sparse matri4 factori7ation of
III
N
C and
III
N
S transform matrices with scaling
2
are respectively defined as
88
2
2 2 2
2
2
2
2 2
2 2
2 2
(
( (
(
( (
( (
( (
2
0
0
2
0 2
0 ! ("
2
0 0
.
0 0
N
N N N
N
N
N
N N
N N
N N
III T
N N
I
N
I
I
I I J
C P
J
D
J I
I C
R
D S


+ +

_

_
_





,
,


,
_ _


, ,
!8/2&"
and
2
2 2 2
2
2
2
2 2
2 2
2 2
(
( (
(
( (
( (
( (
2
0
0
2
0 2
0 ! ("
2
0 0
.
0 0
N
N N N
N
N
N
N N
N N
N N
III T
N N
I
N N
I
I
I I J
S P
I
D
J I
I C
R J
D S
+


+ +

_

_
_







,
,


,
_ _


, ,
!8/80"
where
2
2 (
diagG!)(" H. 0.(. . 2
N
k
N
D k

K
. is the diagonal odd)sign changing matri4.
N
P
is a permutation matri4 defined 3y !8/2?" and
N
R
is the rotation matri4 given 3y
2 2
2 2
2 2
2 2
2 2
! (" ! ("
2 2
! (" ! ("
2 2
2 2
2 2
2 2
( 0 0
0 cos sin
cos sin
/ /
cos sin /
sin cos
/ /
sin cos
0 sin cos
N N
N N
N N
N N
N N N
N N
N N
N N
R








_





,
8'
Chapter ' The #ast DCT$I*/DST$I* alorith!s
In general. the efficient computation of $CT)I<:$ST)I< can 3e reali7ed in two
ways,
(/ 9ecause of the relationship 3etween $CT)II and $CT)I< matrices given 3y
!'/(8". the $CT)I< of si7e N may 3e converted to the $CT)II of the same si7e
at the cost of additional N pre)multiplications and ( N recursive post)
additions/ Thus. the e4isting fast $CT)II algorithms can 3e directly used for
the $CT)I< computation/
2/ The $CT)II of si7e N is decomposed into
2
N
)point $CT)II and
2
N
)point $CT)
I</ This fact leads to the following accepted conclusion, the fast N)point
$CT)I< algorithms can 3e indirectly derived from e4isting fast 2N)point
$CT)II algorithms/
8;
Conclusion
The fast ()$ $CT:$ST algorithms for all even types of $CT and $ST have 3een
discussed in detail/ #lmost all are direct algorithms defined 3y the !recursive. if it
e4ists" sparse matri4 factori7ation of the transform matri4/ The definition. 3asic
mathematical properties and relations 3etween corresponding $CT and $ST have 3een
3riefly discussed/ The e4plicit forms of orthonormal $CT and $ST matrices for N52. '
and 6 have 3een presented/ In particular. these rotation)3ased fast algorithms are very
convenient for the construction of corresponding integer transforms/ The generali7ed
signal flow graphs corresponding to the sparse matri4 factori7ation of the transform
matri4 for the fast $CT:$ST computation have also 3een provided and they are ready to
3e used in practical applications/
81
REFERENCE
I(J +/ S/ +ou. K# fast recursive algorithm for computing the discrete cosine
transform. L I T!ans" Ac#$s%"& Sp''c(& S)*na+ P!#c'ss)n*& <ol/ #SSP)8;. Oct/
(&6? . pp/ (';;)('1(/
I2J N/ #hmed. T/ NataraDan and @/ %/ %ao. K$iscrete cosine transformL. I T!ans"
,n C#mp$%'!& <ol/ C)28. No/ (. -anuary (&?'. pp/ 66)&8/
I8J @/ %/ %ao and P/ Mip. K# fast computational algorithm for the discrete sine
transformL. I T!ans" ,n C#mm$n)ca%)#ns. <ol/ COE)26. No/ 2. e3ruary
(&60. pp/ 80')80?/
I'J N/ *ang. KComments on # fast computational algorithm for the discrete sine
transformL. I T!ans" ,n C#mm$n)ca%)#ns. <ol/ COE)8'. No 2. e3ruary
(&61. pp/ 20')20;/
I;J */ +/ Chen. C/ +/ Smith and S/ C/ ralic=. K# fast computational algorithm for
the discrete cosine transformL. I T!ans" ,n C#mm$n)ca%)#ns. <ol/ COE)2;.
Septem3er (&??. pp/ ;68)10?/
I1J N/ *ang. K%econsideration of a fast computational algorithm for the discrete sine
transformL . I T!ans" ,n C#mm$n)ca%)#ns. <ol/ COE)8(. -anuary (&68. pp/
(2()(28/
I?J </ 9ritana=. P/ Mip. and @/ %/ %ao. D)sc!'%' c#s)n' an- s)n' %!ans.#!ms& #cademic
Press. Aondon. 200?/
I6J N/ #hmed and @/ %/ %ao. Orthogonal transform for digital signal processing.
#cademic Press. Aondon. (&?;/
8?

S-ar putea să vă placă și