www.pudn.com > vcmatlab20060426WaterMark.zip > images_private_dct.cpp, change:2005-05-16,size:16072b
//
// MATLAB Compiler: 2.2
// Date: Mon May 16 12:44:11 2005
// Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
// "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
// "array_indexing:on" "-O" "optimize_conditionals:on" "-B" "sglcpp" "-p" "-W"
// "main" "-L" "Cpp" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-W" "mainhg"
// "libmwsglm.mlib" "-l" "-p" "-W" "main" "-L" "Cpp" "-t" "-T" "link:exe" "-h"
// "libmmfile.mlib" "-h" "C_dct2"
//
#include "images_private_dct.hpp"
#include "libmatlbm.hpp"
#include "libmmfile.hpp"
static mxChar _array1_[154] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
'l', 'e', ':', ' ', 'i', 'm', 'a', 'g', 'e',
's', '/', 'p', 'r', 'i', 'v', 'a', 't', 'e',
'/', 'd', 'c', 't', ' ', 'L', 'i', 'n', 'e',
':', ' ', '1', ' ', 'C', 'o', 'l', 'u', 'm',
'n', ':', ' ', '1', ' ', 'T', 'h', 'e', ' ',
'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
'"', 'i', 'm', 'a', 'g', 'e', 's', '/', 'p',
'r', 'i', 'v', 'a', 't', 'e', '/', 'd', 'c',
't', '"', ' ', 'w', 'a', 's', ' ', 'c', 'a',
'l', 'l', 'e', 'd', ' ', 'w', 'i', 't', 'h',
' ', 'm', 'o', 'r', 'e', ' ', 't', 'h', 'a',
'n', ' ', 't', 'h', 'e', ' ', 'd', 'e', 'c',
'l', 'a', 'r', 'e', 'd', ' ', 'n', 'u', 'm',
'b', 'e', 'r', ' ', 'o', 'f', ' ', 'o', 'u',
't', 'p', 'u', 't', 's', ' ', '(', '1', ')',
'.' };
static mwArray _mxarray0_ = mclInitializeString(154, _array1_);
static mxChar _array3_[153] = { 'R', 'u', 'n', '-', 't', 'i', 'm', 'e', ' ',
'E', 'r', 'r', 'o', 'r', ':', ' ', 'F', 'i',
'l', 'e', ':', ' ', 'i', 'm', 'a', 'g', 'e',
's', '/', 'p', 'r', 'i', 'v', 'a', 't', 'e',
'/', 'd', 'c', 't', ' ', 'L', 'i', 'n', 'e',
':', ' ', '1', ' ', 'C', 'o', 'l', 'u', 'm',
'n', ':', ' ', '1', ' ', 'T', 'h', 'e', ' ',
'f', 'u', 'n', 'c', 't', 'i', 'o', 'n', ' ',
'"', 'i', 'm', 'a', 'g', 'e', 's', '/', 'p',
'r', 'i', 'v', 'a', 't', 'e', '/', 'd', 'c',
't', '"', ' ', 'w', 'a', 's', ' ', 'c', 'a',
'l', 'l', 'e', 'd', ' ', 'w', 'i', 't', 'h',
' ', 'm', 'o', 'r', 'e', ' ', 't', 'h', 'a',
'n', ' ', 't', 'h', 'e', ' ', 'd', 'e', 'c',
'l', 'a', 'r', 'e', 'd', ' ', 'n', 'u', 'm',
'b', 'e', 'r', ' ', 'o', 'f', ' ', 'i', 'n',
'p', 'u', 't', 's', ' ', '(', '2', ')', '.' };
static mwArray _mxarray2_ = mclInitializeString(153, _array3_);
static mwArray _mxarray4_ = mclInitializeDouble(1.0);
static mwArray _mxarray5_ = mclInitializeDouble(2.0);
static mxChar _array7_[6] = { 'd', 'o', 'u', 'b', 'l', 'e' };
static mwArray _mxarray6_ = mclInitializeString(6, _array7_);
static mwArray _mxarray8_ = mclInitializeDouble(0.0);
static mwArray _mxarray9_ = mclInitializeComplex(-0.0, -1.0);
static mwArray _mxarray10_ = mclInitializeDouble(3.141592653589793);
static mwArray _mxarray11_ = mclInitializeDouble(-2.0);
void InitializeModule_images_private_dct() {
}
void TerminateModule_images_private_dct() {
}
static mwArray Mimages_private_dct(int nargout_, mwArray a, mwArray n);
_mexLocalFunctionTable _local_function_table_images_private_dct
= { 0, (mexFunctionTableEntry *)NULL };
//
// The function "images_private_dct" contains the normal interface for the
// "images/private/dct" M-function from file
// "D:\matlab\matlab\toolbox\images\images\private\dct.m" (lines 1-85). This
// function processes any input arguments and passes them to the implementation
// version of the function, appearing above.
//
mwArray images_private_dct(mwArray a, mwArray n) {
int nargout(1);
mwArray b(mclGetUninitializedArray());
b = Mimages_private_dct(nargout, a, n);
return b;
}
//
// The function "mlxImages_private_dct" contains the feval interface for the
// "images/private/dct" M-function from file
// "D:\matlab\matlab\toolbox\images\images\private\dct.m" (lines 1-85). The
// feval function calls the implementation version of images/private/dct
// through this function. This function processes any input arguments and
// passes them to the implementation version of the function, appearing above.
//
void mlxImages_private_dct(int nlhs,
mxArray * plhs[],
int nrhs,
mxArray * prhs[]) {
MW_BEGIN_MLX();
{
mwArray mprhs[2];
mwArray mplhs[1];
int i;
mclCppUninitializeArrays(1, mplhs);
if (nlhs > 1) {
error(_mxarray0_);
}
if (nrhs > 2) {
error(_mxarray2_);
}
for (i = 0; i < 2 && i < nrhs; ++i) {
mprhs[i] = mwArray(prhs[i], 0);
}
for (; i < 2; ++i) {
mprhs[i].MakeDIN();
}
mplhs[0] = Mimages_private_dct(nlhs, mprhs[0], mprhs[1]);
plhs[0] = mplhs[0].FreezeData();
}
MW_END_MLX();
}
//
// The function "Mimages_private_dct" is the implementation version of the
// "images/private/dct" M-function from file
// "D:\matlab\matlab\toolbox\images\images\private\dct.m" (lines 1-85). It
// contains the actual compiled code for that M-function. It is a static
// function and must only be called from one of the interface functions,
// appearing below.
//
//
// function b=dct(a,n)
//
static mwArray Mimages_private_dct(int nargout_, mwArray a, mwArray n) {
mclMlineEnterFunction(
"D:\\matlab\\matlab\\toolbox\\images\\images\\private\\dct.m",
"images/private/dct")
mwLocalFunctionTable save_local_function_table_
(&_local_function_table_images_private_dct);
int nargin_(nargin(2, mwVarargin(a, n)));
mwArray b(mclGetUninitializedArray());
mwArray W(mclGetUninitializedArray());
mwArray ww(mclGetUninitializedArray());
mwArray yy(mclGetUninitializedArray());
mwArray y(mclGetUninitializedArray());
mwArray aa(mclGetUninitializedArray());
mwArray m(mclGetUninitializedArray());
mwArray do_trans(mclGetUninitializedArray());
mwArray ans(mclGetUninitializedArray());
//
// %DCT Discrete cosine transform.
// %
// % Y = DCT(X) returns the discrete cosine transform of X. The
// % vector Y is the same size as X and contains the discrete
// % cosine transform coefficients.
// %
// % Y = DCT(X,N) pads or truncates the vector X to length N
// % before transforming.
// %
// % If X is a matrix, the DCT operation is applied to each
// % column. This transform can be inverted using IDCT.
// %
// % See also FFT,IFFT, and IDCT.
//
// % Copyright 1993-2001 The MathWorks, Inc.
// % $Revision: 5.10 $ $Date: 2001/01/18 15:51:14 $
//
// % References:
// % 1) A. K. Jain, "Fundamentals of Digital Image
// % Processing", pp. 150-153.
// % 2) Wallace, "The JPEG Still Picture Compression Standard",
// % Communications of the ACM, April 1991.
//
// error(nargchk(1,2,nargin));
//
mclMline(25);
error(mwVe(nargchk(_mxarray4_, _mxarray5_, nargin_)));
//
//
// if ~isa(a, 'double')
//
mclMline(27);
if (mclNotBool(mwVe(isa(mwVa(a, "a"), _mxarray6_)))) {
//
// a = double(a);
//
mclMline(28);
a = double_func(mwVa(a, "a"));
//
// end
//
mclMline(29);
}
//
//
// if min(size(a))==1
//
mclMline(31);
if (mclEqBool(
mwVe(min(mwVe(size(mwValueVarargout(), mwVa(a, "a"))))),
_mxarray4_)) {
//
// if size(a,2)>1
//
mclMline(32);
if (mclGtBool(
mwVe(size(mwValueVarargout(), mwVa(a, "a"), _mxarray5_)),
_mxarray4_)) {
//
// do_trans = 1;
//
mclMline(33);
do_trans = _mxarray4_;
//
// else
//
mclMline(34);
} else {
//
// do_trans = 0;
//
mclMline(35);
do_trans = _mxarray8_;
//
// end
//
mclMline(36);
}
//
// a = a(:);
//
mclMline(37);
a = mclArrayRef(mwVsa(a, "a"), colon());
//
// else
//
mclMline(38);
} else {
//
// do_trans = 0;
//
mclMline(39);
do_trans = _mxarray8_;
//
// end
//
mclMline(40);
}
//
// if nargin==1,
//
mclMline(41);
if (nargin_ == 1) {
//
// n = size(a,1);
//
mclMline(42);
n = size(mwValueVarargout(), mwVa(a, "a"), _mxarray4_);
//
// end
//
mclMline(43);
}
//
// m = size(a,2);
//
mclMline(44);
m = size(mwValueVarargout(), mwVa(a, "a"), _mxarray5_);
//
//
// % Pad or truncate a if necessary
// if size(a,1)