% Usage: Y = blkidct2(y, m, n). % Block inverse DCT routine on array y, using m by n blocks. m % must divide number of rows in y, n divide number of colums. % Transform returned in y. For small blocks it's faster to use % matrix multiplies than to repeatedly call the "dct2" command. % If you don't have the signal processing toolbox substitute kdct() % for dct(). function y=blkidct2(Y,m,n) [r,s] = size(Y); y = zeros(r,s); C1 = idct(eye(m)); C2 = idct(eye(n))'; for i=1:(r/m) for j=1:(s/n) e = (i-1)*m+1; f = (j-1)*n+1; Z = double(Y(e:(e+m-1),(f:f+n-1))); y(e:(e+m-1),(f:f+n-1)) = C1*Z*C2; end; end;