% integer_transform 二维整数DCT变换
function [W]= integer_transform(X)
% X is a 4x4 block of data
% W is the trasnsformed coefficients
a = 1/4; % a^2 (a=1/2,b=sqrt(2/5))
b = 1/10; % b^2/4
c = sqrt(1/40); % ab/2
% E is the scaling factor matrix, to make it similar to DCT ?
% Refer to MPEG4-AVC slides (simplified from the H.264 white paper)
Ef = [a c a c
c b c b
a c a c
c b c b];
% C is the core transform matrix
Cf = [1 1 1 1
2 1 -1 -2
1 -1 -1 1
1 -2 2 -1];
% W = (Cf*X*Cf');
% W = (double(Cf)*double(X)*double(Cf'));
W = (Cf*X*Cf').*Ef;
% W=W.*Ef;
end