1 integer transform wen - chih hong e-mail: [email protected] graduate institute of...
TRANSCRIPT
1
Integer Integer transformtransformInteger Integer transformtransformWen - Chih HongWen - Chih Hong
E-mail: [email protected] E-mail: [email protected]
Graduate Institute of Communication Engineering Graduate Institute of Communication Engineering
National Taiwan University, Taipei, Taiwan, ROCNational Taiwan University, Taipei, Taiwan, ROC
2
Outline 1. Introduction
what is integer
why integer
2. General method
3. Matrix factorization
4. Modified matrix factorization
5. Conclusions
6. Reference
3
Introduce : what is integer transform
1. all entries are integer
i.e. -5,-3,0,2,…
2.all entries are sum of power of 2
i.e.
2 0 1 32 2 2 2
4
Introduction : Why integer transform
We can use the fix-point multiplication operation to replace floating-point one to implement it
5
Introduction : The constraints of approximated integer transform
1. if A(m,n1)=τA(m,n2) , τ=1,-1,j,-j then B(m,n1)=τB(m,n2)
2. if Re(A(m,n1)) ≥ Re(A(m,n2)) Im(A(m,n1)) ≥ Im(A(m,n2)) then Re(B(m,n1)) ≥ Re(B(m,n2)) Im(B(m,n1)) ≥ Im(B(m,n2))
6
Introduction : The constraints of Approximated integer transform
3. if sgn(Re(A(m,n1)))=sgn((Re(A(m,n1)))
then sgn(Re(B(m,n1)))=sgn((Re(B(m,n1)))
4. (*) 1
0
( , ) ( , )N
m mnk
B m k B n k C
7
Introduction : algorithms
We have three algorithms to approximate non-
integer transform 1. General method 2. Matrix factorization 3. Modified matrix factorization
8
General method 1. Forming the prototype matrix
2. Constraints for Orthogonality (Equality Constraints) 3. Constraints for Inequality (Inequality Constraints) 4. Assign the values
9
Appendix - Principle of Dyadic symmetry(1/2) Definition: a vector [a0,a1,…,am-1] m=2^n
we say it has the ith dyadic symmetry
i.i.f. aj=s . a i j
where i,j in the range [0,m-1]
s= 1 when symmetry is even
s=-1 when symmetry is odd
10
Appendix - Principle of Dyadic symmetry (2/2) For a vector of eight elements, there are seven possible dyadic
symmetries.
11
General method : Generation of the order-8 ICTs(1/8)
Take 8-order discrete cosine transform for example
for i =0
for i =1~7
where j=0,1,…,6,7 (1)
8T , 1/ 8i j (2 / 8)cos{( 0.5) /8}i j
12
General method : Generation of the order-8 ICTs (2/8)
0.3536 0.3536 0.3536 0.3536 0.3536 0.3536 0.3536 0.3536 0.4904 0.4157 0.2778 0.0975 -0.0975 -0.2778 -0.4157 -0.4904 0.4619 0.1913 -0.1913 -0.4619 -0.4619 -0.1913 0.1913 0.4619 0.4157 -0.0975 -0.4904 -0.2778 0.2778 0.4904 0.0975 -0.4157 0.3536 -0.3536 -0.3536 0.3536 0.3536 -0.3536 -0.3536 0.3536 0.2778 -0.4904 0.0975 0.4157 -0.4157 -0.0975 0.4904 -0.2778 0.1913 -0.4619 0.4619 -0.1913 -0.1913 0.4619 -0.4619 0.1913 0.0975 -0.2778 0.4157 -0.4904 0.4904 -0.4157 0.2778 -0.0975
Let T=kJ , k is diagonal matrix
13
General method : Generation of the order-8 ICTs(3/8)
1. Forming the prototype
14
General method : Generation of the order-8 ICTs(4/8)
2. Constraints for Orthogonality Sth dyadic symmetry type in basis vector Ji
15
General method : Generation of the order-8 ICTs(5/8)
2. Constraints for Orthogonality
(i) Totally C(8,2)=28 equations must be satisfied
(ii) Using principle of dyadic symmetry*, we can reduce 28 to 1 equation:
a . b=a . c + b . d + c . d (2)
16
General method : Generation of the order-8 ICTs (6/8)
3. Constraints for Inequality
the equation in page.8 imply
a ≥ b ≥ c ≥ d ,and e ≥ f (3)
17
General method : Generation of the order-8 ICTs(7/8)
4. Assign the values :
use computer to find all possible values
(of course the values must be integer)
18
General method : Generation of the order-8 ICTs(8/8)
Some example of (a, b, c, d, e, f): (3,2,1,1,3,1) ,(5,3,2,1,3,1),… infinity set
solutions we need to define a tool to recognize
which one is better
19
General method : Performance(1/2)
In the transform coding of pictures
Efficiency: (5)
where
1
1 1
n
iii
n n
pqp q
s
s
11 1
1
[ ] [ ] [ ][ ][ ]n
t tY x
n nn
s s
C E Y Y T C T
s s
20
General method : Performance(2/2)
The twelve order-8 ICTs that have the highest transform efficiencies for p equal 0.9 and a less than or equal to 255
21
General method : Disadvantage of general method
1. Too much unknowns.
2. need to satisfy a lot of equations ,C(n,2).
3. It has no reversibility.
A’≈A , (A^-1)’≈(A^-1),
but (A’)^-1≠ (A^-1)’
22
Matrix Factorization Reversible integer mapping is essential for lossless
source coding by transformation.
General method can not solve the problem of reversibility
23
Matrix Factorization :algorithm(1/9)
Goal :
1. Suppose A , and det(A) ≠ 0
(6)11 1
1
n
n nn
a a
A
a a
1 1 0N NA PS S S S
24
Matrix Factorization :algorithm(2/9) 2. There must exist a permutation matrix
for row interchanges s.t.
(7)
and
1P
(1) (1) (1)1,1 1,2 1,
(1) (1) (1)2,1 2,2 2,
1
(1) (1) (1),1 ,2 ,
N
N
N N N N
p p p
p p pPA
p p p
(1)1, 0Np
25
Matrix Factorization :algorithm(3/9) 3. There must exist a number s.t.
then we get and a product
(8)
1s(1) (1)1,1 1 1, 1Np s p
(1) (1)1 1,1 1,( 1) Ns p p
1 0,1 1
1
1
0 1
PAS PA I
s
(1) (1)1,2 1,
(1) (1) (1) (1)2,1 1 2, 2,2 2,
(1) (1) (1) (1),1 1 , ,2 ,
1
N
N N
N N N N N N
p
p s p p p
p s p p p
p
26
Matrix Factorization :algorithm(4/9) 4. Multiplying an elementary Gauss matrix
(9)
1L
(1) (1)1 2, 2,1
1 1 0,1 1 0,1
(1) (1)1 , ,1
1
1
1
N
N N N
s p pL PAS PAS
I
s p p
(2) (2)1,2 1,
(2) (2)2,2 2,
(2) (2),2 ,
1
0
0
N
N
N N N
a a
a a
a a
27
Matrix Factorization :algorithm(5/9) 5. Continuing in this way for k=1,2,…,N-1.
defines the row interchanges among the through the rows to guarantee
then we get
where
(10)
kP thkthN ( )
, 0kk Np
1 1 2 2 1 0,1 0,2 0, 1N N NL P L P L AS S S
( 1) ( 1)1,2 1,
( 1)2,
( 1),
1
0 1
0 0
N NN
NN
NN N
a a
a
a
RD U( 1)
,N iN Na e
28
Matrix Factorization :algorithm(6/9) where
(11)
RD U (1,1, ,1, )iRD diag e
( 1) ( 1)1,2 1,
( 1)2,
1
0 1
0 0 1
N NN
NN
a a
aU
29
Matrix Factorization :algorithm(7/9) 6. Multiplying all the SERMs ( ) together
(12)
0,kS
0,1 0,2 0, 1NS S S 10
1 1
1
1
1N
IS
s s
30
Matrix Factorization :algorithm(8/9)7.
(13)
where
1 1 2 2 1 1N NL P L P L P
1 1 2 1( )TN N N NL P L P
1 2 1 2 1 1 2 1( )( )T TN N NP P L P P P P P
1 TL P1
1 1 2 1 1 2 1 2 1( ) ( )T T TN N N N N NL L P L P P P L P P
1 2 1T
NP P P P
31
Matrix Factorization :algorithm (9/9)8. we obtain or
9. Theorem
(14)
i.i.f. det(LU) is integer.
1 10
TRL P AS D U
0RA PLD US
1 1 11 1 1 2 2 1( ) ( )LU LUS S LUS S S S
1 1 11 2 1 1 2 1 1 2 1( )N N N NLUS S S S S S S S S S
32
Matrix Factorization :Advantage if det(A) is integer
then
It is easy to derive the inverse of A 1 1 0N NA PS S S S
33
Modified matrix factorization:algorithm(1/6)
If A is a NxN reversible transform 1. First, scale A by a constant , where
such that :
(15)
1/
detN
A det 1G
G A
34
Modified matrix factorization:algorithm(2/6)
2. Do permutation and sign-changing operations for :
, :arbitrary permutation matrix
, :diagonal matrix
(16)
G
1 2R D PGQD P Q
1D 2D
1D [ , ] 1n n 2D [ , ] 1n n
35
Modified matrix factorization:algorithm(3/6) 3. Do triangular matrix decomposition. First, we find such that
has the following form:
(17)
where
1L1H RL
1,1 1,2 1,3 1, 1 1,
2,1
3,1 3,21
1,1 1,2 1,3
1 0 0 0
1 0 0
N N
N N N
h h h h h
h
h hH RL
h h h
,1 ,2 ,3 , 1
1 0
1N N N N Nh h h h
1,2 1,3 1, 1 1,
2,3 2, 1 2,
3, 1 3,1
1,
1
0 1
0 0 1
0 0 0 1
0 0 0 0 1
N N
N N
N N
N N
L
1 ˆˆ( )n n n nI S z t
2,1 2,2 2, 1
3,1 3,2 3, 1
,1 ,2 , 1
n
nn
n n n n
r r r
r r rS
r r r
1, 2, 2, 1,[ ]Tn n n n n n nI
2, 3, 1, ,ˆ [ ]Tn n n n n n nt r r r r
ˆ [0 0 0 1]Tnz
36
Modified matrix factorization:algorithm(4/6)
4. : Note that is also an upper-triangular matrix.
(18)
11 1T L
1T
1,2 1,3 1, 1 1,
2,3 2, 1 2,
11 1 3, 1 3,
1
0 1
0 0 1
0 0 0 0 1
N N
N N
N NT L
37
Modified matrix factorization:algorithm(5/6)
5. Decompose into and .
(19)
where ,
From (8)(9)(10) we decompose ,then,
H 2T 3T
3 2H TT2,1
3,1 3,2
2
1,1 1,2 1,3
1 0 0 0 0
1 0 0 0
1 0 0
N N N
h
h hT
h h h
,1 ,2 ,3 , 1
1 0
1N N N N Nh h h h
1 2 3 1
3
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
N N
T
11 2 1,1 1,2 1, 2[ ] [ ]N Nh h h T 1 det( ) 1R
3 2 1R TT T
1 3 2 1 2T TG P DTT TD Q
38
Modified matrix factorization:algorithm(6/6)
6. Approximates , , and by binary valued matrices , , and :
1T 2T 3T 1J 2J
3J
1,2 1,3 1, -1 1,
2,3 2, 1 2,
1 3, 1 3,
1
0 1
0 0 1
0 0 0 0 1
N N
N N
N N
t t t t
t t t
J t t
2,1
3,1 3,2
2
1,1 1,2 1,3
1 0 0 0 0
1 0 0 0
1 0 0
N N N
c
c cJ
c c c
,1 ,2 ,3 , 1
1 0
1N N N N Nc c c c
2 3 1
3
1
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
N Ns s s s
J
, ,( )m n b m nt Q , ,( )m n b m nc Q h ( )m b ms Q
( ) 2 (2 )b bbQ a round a
39
Modified matrix factorization:the process of forward transform
Step 1:
Step 2: for
1 2Tx D Q x
2 1 , 11
[ ] [ ] { [ ]}N
r n mm n
x n x n Q t x m
1 ~ 1n N
2 1[ ] [ ]x N x N
40
Modified matrix factorization:the process of forward transform
Step 3: for
Step 4:
when
1
3 2 , 21
[ ] [ ] { [ ]}n
r n mm
x n x n Q c x m
2 ~n N
3 2[1] [1]x x
4 3 32
[1] [1] { [ ]}N
r kk
x x Q s x k
4 3[ ] [ ]x n x n 1n
41
Modified matrix factorization:the process of forward transform
Step 5: 1 4Tz P D x
42
Modified matrix factorization:Accuracy analysis
Preliminaries
1. where
2. is a random variable and uniformly distribute in [ , ]
3. and
[ ]rQ a a 1 12 2r r
12 r 12 r
[ ] 0E 2[ ] 4 12rE
43
Modified matrix factorization:Accuracy analysis
The process in step (2)-(4) can be rewritten as:
1 3 2 1 2 1 2 3{ [ ( ) ] }T Tz P D J J J D Q x
44
Modified matrix factorization:Accuracy analysis
If y=Gx=σAx
then the difference between z, y is:
(20)
if b is very large in page.39
1 3 2 1 1 3 2 1 3T T Tz y P DT T P DT P D
45
Modified matrix factorization:Accuracy analysis
Using (20) to estimate the normalized root mean square error (NRMSE) and use it to measure the accuracy:
[( ) ( )]
[ ]
H
H
E z y z yNRMSE
E y y
46
Modified matrix factorization: Accuracy analysis
Notice (20) ,we find the NRMSE which is dominated by and .
So we let the entries of T2 and T3 as small as possible .
That why we multiply P, D, and Q to G.
2T 3T
47
Modified matrix factorization:Accuracy analysis
Example
48
Modified matrix factorization:Advantages
Compare to matrix factorization :
1. simpler and faster way to derive the integer transform
2. Easier to design 3. Higher accuracy
49
Conclusions
If a transform A ,which det(A) is an integer factor, we can convert it into integer transform.
Integer transform is easy to implement, but is less accuracy than non-integer transform. It is a trade-off.
50
Reference 1. W.-K. Cham, PhD “Development of integer cosine transforms by the
principle of dyadic symmetry” 2. W. K. Cham and Y. T. Chan” An Order-16 Integer Cosine Transform” 3. Pengwei Hao and Qingyun Shi “Matrix Factorizations for Reversible
Integer Mapping” 4. Soo-Chang Pei and Jian-Jiun Ding” The Integer Transforms
Analogous to Discrete Trigonometric Transforms” 5. Soo-Chang Pei and Jian-Jiun Ding” Improved Reversible Integer
Transform”