www.pudn.com > vcmatlab20060426WaterMark.zip > images_private_idct.cpp


// 
// MATLAB Compiler: 2.2 
// Date: Mon May 16 13:27:20 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_idct2"  
// 
#include "images_private_idct.hpp" 
#include "libmatlbm.hpp" 
#include "libmmfile.hpp" 
 
static mxChar _array1_[156] = { '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', 
                                '/', 'i', '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', '/', 'i', 
                                '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(156, _array1_); 
 
static mxChar _array3_[155] = { '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', 
                                '/', 'i', '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', '/', 'i', 
                                '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(155, _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_ = mclInitializeComplex(-0.0, -1.0); 
static mwArray _mxarray12_ = mclInitializeComplex(0.0, 3.141592653589793); 
static mwArray _mxarray13_ = mclInitializeDouble(-1.0); 
 
void InitializeModule_images_private_idct() { 
} 
 
void TerminateModule_images_private_idct() { 
} 
 
static mwArray Mimages_private_idct(int nargout_, mwArray b, mwArray n); 
 
_mexLocalFunctionTable _local_function_table_images_private_idct 
  = { 0, (mexFunctionTableEntry *)NULL }; 
 
// 
// The function "images_private_idct" contains the normal interface for the 
// "images/private/idct" M-function from file 
// "D:\matlab\matlab\toolbox\images\images\private\idct.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_idct(mwArray b, mwArray n) { 
    int nargout(1); 
    mwArray a(mclGetUninitializedArray()); 
    a = Mimages_private_idct(nargout, b, n); 
    return a; 
} 
 
// 
// The function "mlxImages_private_idct" contains the feval interface for the 
// "images/private/idct" M-function from file 
// "D:\matlab\matlab\toolbox\images\images\private\idct.m" (lines 1-85). The 
// feval function calls the implementation version of images/private/idct 
// through this function. This function processes any input arguments and 
// passes them to the implementation version of the function, appearing above. 
// 
void mlxImages_private_idct(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_idct(nlhs, mprhs[0], mprhs[1]); 
        plhs[0] = mplhs[0].FreezeData(); 
    } 
    MW_END_MLX(); 
} 
 
// 
// The function "Mimages_private_idct" is the implementation version of the 
// "images/private/idct" M-function from file 
// "D:\matlab\matlab\toolbox\images\images\private\idct.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 a = idct(b,n) 
// 
static mwArray Mimages_private_idct(int nargout_, mwArray b, mwArray n) { 
    mclMlineEnterFunction( 
      "D:\\matlab\\matlab\\toolbox\\images\\images\\private\\idct.m", 
      "images/private/idct") 
    mwLocalFunctionTable save_local_function_table_ 
      (&_local_function_table_images_private_idct); 
    int nargin_(nargin(2, mwVarargin(b, n))); 
    mwArray a(mclGetUninitializedArray()); 
    mwArray y(mclGetUninitializedArray()); 
    mwArray yy(mclGetUninitializedArray()); 
    mwArray W(mclGetUninitializedArray()); 
    mwArray ww(mclGetUninitializedArray()); 
    mwArray bb(mclGetUninitializedArray()); 
    mwArray m(mclGetUninitializedArray()); 
    mwArray do_trans(mclGetUninitializedArray()); 
    mwArray ans(mclGetUninitializedArray()); 
    // 
    // %IDCT Inverse discrete cosine transform. 
    // % 
    // %   X = IDCT(Y) inverts the DCT transform, returning the original 
    // %   vector if Y was obtained using Y = DCT(X).  
    // % 
    // %   X = IDCT(Y,N) pads or truncates the vector Y to length N 
    // %   before transforming.  
    // % 
    // %   If Y is a matrix, the IDCT operation is applied to each 
    // %   column. 
    // % 
    // %   See also FFT,IFFT,DCT. 
    //  
    // %   Copyright 1993-2001 The MathWorks, Inc.   
    // %   $Revision: 5.10 $  $Date: 2001/01/18 15:51:21 $ 
    //  
    // %   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(24); 
    error(mwVe(nargchk(_mxarray4_, _mxarray5_, nargin_))); 
    // 
    //  
    // if ~isa(b, 'double') 
    // 
    mclMline(26); 
    if (mclNotBool(mwVe(isa(mwVa(b, "b"), _mxarray6_)))) { 
        // 
        // b = double(b); 
        // 
        mclMline(27); 
        b = double_func(mwVa(b, "b")); 
    // 
    // end 
    // 
    mclMline(28); 
    } 
    // 
    //  
    // if min(size(b))==1  
    // 
    mclMline(30); 
    if (mclEqBool( 
          mwVe(min(mwVe(size(mwValueVarargout(), mwVa(b, "b"))))), 
          _mxarray4_)) { 
        // 
        // if size(b,2)>1 
        // 
        mclMline(31); 
        if (mclGtBool( 
              mwVe(size(mwValueVarargout(), mwVa(b, "b"), _mxarray5_)), 
              _mxarray4_)) { 
            // 
            // do_trans = 1; 
            // 
            mclMline(32); 
            do_trans = _mxarray4_; 
        // 
        // else 
        // 
        mclMline(33); 
        } else { 
            // 
            // do_trans = 0; 
            // 
            mclMline(34); 
            do_trans = _mxarray8_; 
        // 
        // end 
        // 
        mclMline(35); 
        } 
        // 
        // b = b(:);  
        // 
        mclMline(36); 
        b = mclArrayRef(mwVsa(b, "b"), colon()); 
    // 
    // else   
    // 
    mclMline(37); 
    } else { 
        // 
        // do_trans = 0;  
        // 
        mclMline(38); 
        do_trans = _mxarray8_; 
    // 
    // end 
    // 
    mclMline(39); 
    } 
    // 
    // if nargin==1, 
    // 
    mclMline(40); 
    if (nargin_ == 1) { 
        // 
        // n = size(b,1); 
        // 
        mclMline(41); 
        n = size(mwValueVarargout(), mwVa(b, "b"), _mxarray4_); 
    // 
    // end 
    // 
    mclMline(42); 
    } 
    // 
    // m = size(b,2); 
    // 
    mclMline(43); 
    m = size(mwValueVarargout(), mwVa(b, "b"), _mxarray5_); 
    // 
    //  
    // % Pad or truncate b if necessary 
    // if size(b,1)