function Z=dctV2(p,X) 
[m,n]=size(X);
for i=2:n
    for j=1:n
        C(i,j)=sqrt(2/n)*cos((i-1)*(j-1/2)*pi/n);
    end
end
C(1,1:n)=ones(1,n)/sqrt(n);
Q = p*8./hilb(8);
Xc=X-128;
Y=C*Xc*C';
Yq =round(Y./Q);
Ydq = Yq.*Q;
Xdq = C'*Ydq*C;
Z = Xdq+128;
end