Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals

hifwt.cpp

Go to the documentation of this file.
00001 // hifwt.cpp
00002 //////////////////////////////////////////////////////////////////////
00003 //          (c) Copyright 1994-2002 Brown Deer Technology, LLC.
00004 //                        All rights reserved.
00005 //////////////////////////////////////////////////////////////////////
00006 
00007 #ifdef STORM_USEF
00008 #include "hifwt_.h"
00009 #include "dhifwt_.h"
00010 #include "ihifwt_.h"
00011 #include "hifwtws_.h"
00012 #include "dhifwtws_.h"
00013 #include "ihifwtws_.h"
00014 #endif
00015 
00016 #include "stormdef.h"
00017 #define INVSQRT2 STORMDEF_MATHCONST_INVSQRT2
00018 
00019 int hifwt( 
00020           const int& Sizef,
00021           const int& ns,
00022           const int& size,
00023           const float* wdata,
00024                 float* sdata
00025 ) { 
00026 
00027 #ifdef STORM_USEF
00028 
00029    int iflag;
00030    hifwt_( &Sizef, &ns, &size, wdata, sdata, &iflag );
00031    return iflag;
00032 
00033 #else
00034 
00035    int size2;
00036    int size1 = ns;
00037    float *xx = new float[Sizef];
00038 
00039 #ifdef STORM_FWT_CCHECKUSAGE
00040    if ( size < ns ) return 1;
00041 #endif
00042 
00043    if ( size == ns ) {
00044       for( int i = 0; i < size; i++ ) { sdata[i] = wdata[i]; }
00045       return 0; 
00046    }
00047    for( int i = 0; i < size; i++ ) { xx[i] = wdata[i]; }
00048    while ( size1 < size ) {
00049       size2 = size1;
00050       size1 = 2 * size1;
00051       for( int i = 0; i < size2; i++ ) {
00052          sdata[2*i] = ( xx[i] + xx[size2+i] ) * INVSQRT2;
00053          sdata[2*i+1] = ( xx[i] - xx[size2+i] ) * INVSQRT2;
00054       }
00055       for( int i = 0; i < size1; i++ ) { xx[i] = sdata[i]; }
00056    }
00057    delete [] xx;
00058 
00059 #ifdef STORM_FWT_CCHECKUSAGE
00060    if ( size1 != size ) return 2;
00061 #endif
00062 
00063    return 0;
00064 
00065 #endif
00066 
00067 } 
00068 
00069 int hifwt( 
00070           const int& Sizef,
00071           const int& ns,
00072           const int& size,
00073           const double* wdata,
00074                 double* sdata
00075 ) { 
00076 
00077 #ifdef STORM_USEF
00078 
00079    int iflag;
00080    dhifwt_( &Sizef, &ns, &size, wdata, sdata, &iflag );
00081    return iflag;
00082 
00083 #else
00084 
00085    int size2;
00086    int size1 = ns;
00087    double *xx = new double[Sizef];
00088 
00089 #ifdef STORM_FWT_CCHECKUSAGE
00090    if ( size < ns ) return 1;
00091 #endif
00092 
00093    if ( size == ns ) {
00094       for( int i = 0; i < size; i++ ) { sdata[i] = wdata[i]; }
00095       return 0;
00096    }
00097    for( int i = 0; i < size; i++ ) { xx[i] = wdata[i]; }
00098    while ( size1 < size ) {
00099       size2 = size1; 
00100       size1 = 2 * size1;
00101       for( int i = 0; i < size2; i++ ) {
00102          sdata[2*i] = ( xx[i] + xx[size2+i] ) * INVSQRT2;
00103          sdata[2*i+1] = ( xx[i] - xx[size2+i] ) * INVSQRT2;
00104       }
00105       for( int i = 0; i < size1; i++ ) { xx[i] = sdata[i]; }
00106    }
00107    delete [] xx;
00108 
00109 #ifdef STORM_FWT_CCHECKUSAGE
00110    if ( size1 != size ) return 2;
00111 #endif
00112 
00113    return 0;
00114 
00115 #endif
00116 
00117 } 
00118 
00119 
00120 int hifwt( 
00121           const int& Sizef,
00122           const int& ns,
00123           const int& size,
00124           const int* wdata,
00125                 int* sdata
00126 ) { 
00127 
00128 #ifdef STORM_USEF
00129 
00130    int iflag;
00131    ihifwt_( &Sizef, &ns, &size, wdata, sdata, &iflag );
00132    return iflag;
00133 
00134 #else
00135 
00136    int size2;
00137    int size1 = ns;
00138    int *xx = new int[Sizef];
00139 
00140 #ifdef STORM_FWT_CCHECKUSAGE
00141    if ( size < ns ) return 1;
00142 #endif
00143 
00144    if ( size == ns ) {
00145       for( int i = 0; i < size; i++ ) { sdata[i] = wdata[i]; }
00146       return 0; 
00147    }
00148    for( int i = 0; i < size; i++ ) { xx[i] = wdata[i]; }
00149    while ( size1 < size ) {
00150       size2 = size1;
00151       size1 = 2 * size1;
00152       for( int i = 0; i < size2; i++ ) {
00153          sdata[2*i] = ( xx[i] + xx[size2+i] ) / 2;
00154          sdata[2*i+1] = xx[i] - xx[size2+i];
00155       }
00156       for( int i = 0; i < size1; i++ ) { xx[i] = sdata[i]; }
00157    }
00158    delete [] xx;
00159 
00160 #ifdef STORM_FWT_CCHECKUSAGE
00161    if ( size1 != size ) return 2;
00162 #endif
00163 
00164    return 0;
00165 
00166 #endif
00167 
00168 } 
00169 
00170 
00171 int hifwt( 
00172           const int& Sizef,
00173           const int& ns,
00174           const int& size,
00175           const float* wdata,
00176                 float* sdata,
00177                 float* ws
00178 ) { 
00179 
00180 #ifdef STORM_USEF
00181 
00182    int iflag;
00183    hifwtws_( &Sizef, &ns, &size, wdata, sdata, ws, &iflag );
00184    return iflag;
00185 
00186 #else
00187 
00188    int size2;
00189    int size1 = ns;
00190 
00191 #ifdef STORM_FWT_CCHECKUSAGE
00192    if ( size < ns ) return 1;
00193 #endif
00194 
00195    if ( size == ns ) {
00196       for( int i = 0; i < size; i++ ) { sdata[i] = wdata[i]; }
00197       return 0; 
00198    }
00199    for( int i = 0; i < size; i++ ) { ws[i] = wdata[i]; }
00200    while ( size1 < size ) {
00201       size2 = size1;
00202       size1 = 2 * size1;
00203       for( int i = 0; i < size2; i++ ) {
00204          sdata[2*i] = ( ws[i] + ws[size2+i] ) * INVSQRT2;
00205          sdata[2*i+1] = ( ws[i] - ws[size2+i] ) * INVSQRT2;
00206       }
00207       for( int i = 0; i < size1; i++ ) { ws[i] = sdata[i]; }
00208    }
00209 
00210 #ifdef STORM_FWT_CCHECKUSAGE
00211    if ( size1 != size ) return 2;
00212 #endif
00213 
00214    return 0;
00215 
00216 #endif
00217 
00218 } 
00219 
00220 
00221 int hifwt( 
00222           const int& Sizef,
00223           const int& ns,
00224           const int& size,
00225           const double* wdata,
00226                 double* sdata,
00227                 double* ws
00228 ) { 
00229 
00230 #ifdef STORM_USEF
00231 
00232    int iflag;
00233    dhifwtws_( &Sizef, &ns, &size, wdata, sdata, ws, &iflag );
00234    return iflag;
00235 
00236 #else
00237 
00238    int size2;
00239    int size1 = ns;
00240 
00241 #ifdef STORM_FWT_CCHECKUSAGE
00242    if ( size < ns ) return 1;
00243 #endif
00244 
00245    if ( size == ns ) {
00246       for( int i = 0; i < size; i++ ) { sdata[i] = wdata[i]; }
00247       return 0;
00248    }
00249    for( int i = 0; i < size; i++ ) { ws[i] = wdata[i]; }
00250    while ( size1 < size ) {
00251       size2 = size1; 
00252       size1 = 2 * size1;
00253       for( int i = 0; i < size2; i++ ) {
00254          sdata[2*i] = ( ws[i] + ws[size2+i] ) * INVSQRT2;
00255          sdata[2*i+1] = ( ws[i] - ws[size2+i] ) * INVSQRT2;
00256       }
00257       for( int i = 0; i < size1; i++ ) { ws[i] = sdata[i]; }
00258    }
00259 
00260 #ifdef STORM_FWT_CCHECKUSAGE
00261    if ( size1 != size ) return 2;
00262 #endif
00263 
00264    return 0;
00265 
00266 #endif
00267 
00268 } 
00269 
00270 
00271 int hifwt( 
00272           const int& Sizef,
00273           const int& ns,
00274           const int& size,
00275           const int* wdata,
00276                 int* sdata,
00277                 int* ws
00278 ) { 
00279 
00280 #ifdef STORM_USEF
00281 
00282    int iflag;
00283    ihifwtws_( &Sizef, &ns, &size, wdata, sdata, ws, &iflag );
00284    return iflag;
00285 
00286 #else
00287 
00288    int size2;
00289    int size1 = ns;
00290 
00291    if ( size < ns ) return 1;
00292 
00293    if ( size == ns ) {
00294       for( int i = 0; i < size; i++ ) { sdata[i] = wdata[i]; }
00295       return 0; 
00296    }
00297    for( int i = 0; i < size; i++ ) { ws[i] = wdata[i]; }
00298    while ( size1 < size ) {
00299       size2 = size1;
00300       size1 = 2 * size1;
00301       for( int i = 0; i < size2; i++ ) {
00302          sdata[2*i] = ( ws[i] + ws[size2+i] ) / 2;
00303          sdata[2*i+1] = ws[i] - ws[size2+i];
00304       }
00305       for( int i = 0; i < size1; i++ ) { ws[i] = sdata[i]; }
00306    }
00307 
00308 #ifdef STORM_FWT_CCHECKUSAGE
00309    if ( size1 != size ) return 2;
00310 #endif
00311 
00312    return 0;
00313 
00314 #endif
00315 
00316 } 
00317 
00318 #undef INVSQRT2
00319 

Generated on Mon May 31 21:38:47 2004 for SR2k4 Assembler by doxygen 1.3.6