www.pudn.com > jpegtool_matlab.rar > invdct.m


% invdct - perform inverse cosine transform on an image
%
% SYNOPSIS
%	invdct
%	invdct(X)
%	invdct(X, N)
%
% DESCRIPTION
% 	invdct cuts an mxn image X into NxN subimages and performs an
%       inverse cosine transform. If X is not given, then X=ans. If N is 
%       not given, then N is the size of the global quantizing matrix QMAT,
%       or if QMAT is undefined or of size 0, then N=8.
%
% SEE ALSO
%	dct

% Copyright (C) 1995-1997 Darrel Hankerson and Greg A. Harris
%
% This file is part of the JPEGtool collection of scripts for Octave
% and Matlab; see http://www.dms.auburn.edu/compression
%
% The JPEGtool collection is free software; you can redistribute it
% and/or modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2, or
% (at your option) any later version.
%
% The collection is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this package; see the file COPYING.  If not, write to the
% Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
% 02111-1307, USA.

function X = invdct(X, N)

global QMAT

if (nargin == 0)
  X = ans;
end

if (nargin <= 1)
  N = 0;
  if exist('QMAT')
    N = size(QMAT,1);
  end
  if (N == 0)
    N = 8;
  end
end

X = do_dct(X, N, 1);