Calculation of DCT_IV using DCT_III (alternative)
Contents
Definitions
Result of transform is y=x*T, where y, x are row-vectors T is transform matrix
DCT_IV matrix definition
N=8; DCT4=cos(pi/N*[(0:N-1)+1/2]'*[(0:N-1)+1/2])
DCT4 = 0.9952 0.9569 0.8819 0.7730 0.6344 0.4714 0.2903 0.0980 0.9569 0.6344 0.0980 -0.4714 -0.8819 -0.9952 -0.7730 -0.2903 0.8819 0.0980 -0.7730 -0.9569 -0.2903 0.6344 0.9952 0.4714 0.7730 -0.4714 -0.9569 0.0980 0.9952 0.2903 -0.8819 -0.6344 0.6344 -0.8819 -0.2903 0.9952 -0.0980 -0.9569 0.4714 0.7730 0.4714 -0.9952 0.6344 0.2903 -0.9569 0.7730 0.0980 -0.8819 0.2903 -0.7730 0.9952 -0.8819 0.4714 0.0980 -0.6344 0.9569 0.0980 -0.2903 0.4714 -0.6344 0.7730 -0.8819 0.9569 -0.9952
DCT_III matrix definition
DCT3=cos(pi/N*[[(0:N-1)+1/2]'*(0:N-1)])
DCT3 = 1.0000 0.9808 0.9239 0.8315 0.7071 0.5556 0.3827 0.1951 1.0000 0.8315 0.3827 -0.1951 -0.7071 -0.9808 -0.9239 -0.5556 1.0000 0.5556 -0.3827 -0.9808 -0.7071 0.1951 0.9239 0.8315 1.0000 0.1951 -0.9239 -0.5556 0.7071 0.8315 -0.3827 -0.9808 1.0000 -0.1951 -0.9239 0.5556 0.7071 -0.8315 -0.3827 0.9808 1.0000 -0.5556 -0.3827 0.9808 -0.7071 -0.1951 0.9239 -0.8315 1.0000 -0.8315 0.3827 0.1951 -0.7071 0.9808 -0.9239 0.5556 1.0000 -0.9808 0.9239 -0.8315 0.7071 -0.5556 0.3827 -0.1951
Finding relations
We will base our derivation on already existing relations between DST_IV and DST_III transforms
where
Applying relations between dual transforms
where
we will get
B=diag(ones(1,N))+diag(ones(1,N-1),1);
D=2*diag(cos(pi/2/N*((0:N-1)+1/2)));
% K=diag((-1).^(0:N-1));
J=rot90(eye(N));
Check expression of DCT_III through DCT_IV
Check DCTIII matrix
D*DCT4*J*inv(B)*J
ans = 1.0000 0.9808 0.9239 0.8315 0.7071 0.5556 0.3827 0.1951 1.0000 0.8315 0.3827 -0.1951 -0.7071 -0.9808 -0.9239 -0.5556 1.0000 0.5556 -0.3827 -0.9808 -0.7071 0.1951 0.9239 0.8315 1.0000 0.1951 -0.9239 -0.5556 0.7071 0.8315 -0.3827 -0.9808 1.0000 -0.1951 -0.9239 0.5556 0.7071 -0.8315 -0.3827 0.9808 1.0000 -0.5556 -0.3827 0.9808 -0.7071 -0.1951 0.9239 -0.8315 1.0000 -0.8315 0.3827 0.1951 -0.7071 0.9808 -0.9239 0.5556 1.0000 -0.9808 0.9239 -0.8315 0.7071 -0.5556 0.3827 -0.1951
Check computation of DCTIII transform
x=randn(1,N); y=x*DCT3 % true result y1=x*D*DCT4*J*inv(B)*J % compute DCTIII using DCTIV transform
y = -0.7532 0.0402 2.2789 -1.9792 -3.7616 -1.9952 2.4236 -0.2508 y1 = -0.7532 0.0402 2.2789 -1.9792 -3.7616 -1.9952 2.4236 -0.2508
Check expression of DCT_IV through DCT_III
inv(D)*DCT3*J*B*J
ans = 0.9952 0.9569 0.8819 0.7730 0.6344 0.4714 0.2903 0.0980 0.9569 0.6344 0.0980 -0.4714 -0.8819 -0.9952 -0.7730 -0.2903 0.8819 0.0980 -0.7730 -0.9569 -0.2903 0.6344 0.9952 0.4714 0.7730 -0.4714 -0.9569 0.0980 0.9952 0.2903 -0.8819 -0.6344 0.6344 -0.8819 -0.2903 0.9952 -0.0980 -0.9569 0.4714 0.7730 0.4714 -0.9952 0.6344 0.2903 -0.9569 0.7730 0.0980 -0.8819 0.2903 -0.7730 0.9952 -0.8819 0.4714 0.0980 -0.6344 0.9569 0.0980 -0.2903 0.4714 -0.6344 0.7730 -0.8819 0.9569 -0.9952
Check computation of DCTIV transform
y=x*DCT4 % true result y1=x*inv(D)*DCT3*J*B*J % compute DCTIV using DCTIII transform
y = -0.6868 1.5678 0.7377 -3.6487 -3.2061 0.3256 2.0801 -1.4016 y1 = -0.6868 1.5678 0.7377 -3.6487 -3.2061 0.3256 2.0801 -1.4016
Reference
[1] Markus Pueschel, Jose M.F. Moura. The Algebraic Approach to the Discrete Cosine and Sine Transforms and their Fast Algorithms SIAM Journal of Computing 2003, Vol. 32, No. 5, pp. 1280-1316.