dequant.m

来自「jpeg的matlab代码」· M 代码 · 共 59 行

M
59
字号
% NAME %      	dequant - unapply quantizing matrix%% SYNOPSIS%	dequant%	dequant(X)%	dequant(X, Q)%% DESCRIPTION%	dequant cuts an mxn matrix X into NxN matrices and dequantizes%	using the matrix Q. If X is not given, then X=ans. If Q is not %	given, then Q=QMAT.% 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 = dequant(X, Q)global QMATif (~exist('X'))  X = ans;endif (~exist('Q'))  Q = QMAT;endN = size(Q, 1);dim = fix(size(X)/N); m=dim(1); n=dim(2);X = X(1:N*m,1:N*n);  	%  snip trailing rows and columns from X%  Now break up X and un-quantizefor ii=1:m	  rows = N*(ii-1)+1:N*ii;  for jj=1:n    cols = N*(jj-1)+1:N*jj;    X(rows, cols) = X(rows, cols) .* Q ;  endend

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?