IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2204 for trunk/psLib/src/fft


Ignore:
Timestamp:
Oct 26, 2004, 2:57:34 PM (22 years ago)
Author:
desonia
Message:

converted native C types to ps Types, where practical.

Location:
trunk/psLib/src/fft
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fft/psImageFFT.c

    r1983 r2204  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-06 21:31:30 $
     7 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-10-27 00:57:31 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1111 */
    1212#include <unistd.h>
    13 #include <stdbool.h>
    1413#include <string.h>
    1514#include <complex.h>
     
    2726#define PS_FFTW_PLAN_RIGOR FFTW_ESTIMATE
    2827
    29 static bool p_fftwWisdomImported = false;
     28static psBool p_fftwWisdomImported = false;
    3029
    3130psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction)
    3231{
    33     unsigned int numCols;
    34     unsigned int numRows;
     32    psU32 numCols;
     33    psU32 numRows;
    3534    psElemType type;
    3635    fftwf_plan plan;
     
    7776
    7877    // n.b. FFTW can perform a in-place transform at the same rate or faster than out-of-place.
    79     int sign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD;
     78    psS32 sign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD;
    8079    out = psImageCopy(out, in, PS_TYPE_C32);
    8180    plan = fftwf_plan_dft_2d(numCols, numRows,
     
    118117{
    119118    psElemType type;
    120     unsigned int numCols;
    121     unsigned int numRows;
     119    psU32 numCols;
     120    psU32 numRows;
    122121
    123122    if (in == NULL) {
     
    140139
    141140        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
    142         for (unsigned int row = 0; row < numRows; row++) {
     141        for (psU32 row = 0; row < numRows; row++) {
    143142            outRow = out->data.F32[row];
    144143            inRow = in->data.C32[row];
    145144
    146             for (unsigned int col = 0; col < numCols; col++) {
     145            for (psU32 col = 0; col < numCols; col++) {
    147146                outRow[col] = crealf(inRow[col]);
    148147            }
     
    153152
    154153        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
    155         for (unsigned int row = 0; row < numRows; row++) {
     154        for (psU32 row = 0; row < numRows; row++) {
    156155            outRow = out->data.F64[row];
    157156            inRow = in->data.C64[row];
    158157
    159             for (unsigned int col = 0; col < numCols; col++) {
     158            for (psU32 col = 0; col < numCols; col++) {
    160159                outRow[col] = creal(inRow[col]);
    161160            }
     
    179178{
    180179    psElemType type;
    181     unsigned int numCols;
    182     unsigned int numRows;
     180    psU32 numCols;
     181    psU32 numRows;
    183182
    184183    if (in == NULL) {
     
    203202
    204203        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
    205         for (unsigned int row = 0; row < numRows; row++) {
     204        for (psU32 row = 0; row < numRows; row++) {
    206205            outRow = out->data.F32[row];
    207206            inRow = in->data.C32[row];
    208207
    209             for (unsigned int col = 0; col < numCols; col++) {
     208            for (psU32 col = 0; col < numCols; col++) {
    210209                outRow[col] = cimagf(inRow[col]);
    211210            }
     
    216215
    217216        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
    218         for (unsigned int row = 0; row < numRows; row++) {
     217        for (psU32 row = 0; row < numRows; row++) {
    219218            outRow = out->data.F64[row];
    220219            inRow = in->data.C64[row];
    221220
    222             for (unsigned int col = 0; col < numCols; col++) {
     221            for (psU32 col = 0; col < numCols; col++) {
    223222                outRow[col] = cimag(inRow[col]);
    224223            }
     
    241240{
    242241    psElemType type;
    243     unsigned int numCols;
    244     unsigned int numRows;
     242    psU32 numCols;
     243    psU32 numRows;
    245244
    246245    if (real == NULL || imag == NULL) {
     
    282281        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
    283282
    284         for (unsigned int row = 0; row < numRows; row++) {
     283        for (psU32 row = 0; row < numRows; row++) {
    285284            outRow = out->data.C32[row];
    286285            realRow = real->data.F32[row];
    287286            imagRow = imag->data.F32[row];
    288287
    289             for (unsigned int col = 0; col < numCols; col++) {
     288            for (psU32 col = 0; col < numCols; col++) {
    290289                outRow[col] = realRow[col] + I * imagRow[col];
    291290            }
     
    297296
    298297        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
    299         for (unsigned int row = 0; row < numRows; row++) {
     298        for (psU32 row = 0; row < numRows; row++) {
    300299            outRow = out->data.C64[row];
    301300            realRow = real->data.F64[row];
    302301            imagRow = imag->data.F64[row];
    303302
    304             for (unsigned int col = 0; col < numCols; col++) {
     303            for (psU32 col = 0; col < numCols; col++) {
    305304                outRow[col] = realRow[col] + I * imagRow[col];
    306305            }
     
    324323{
    325324    psElemType type;
    326     unsigned int numCols;
    327     unsigned int numRows;
     325    psU32 numCols;
     326    psU32 numRows;
    328327
    329328    if (in == NULL) {
     
    346345
    347346        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
    348         for (unsigned int row = 0; row < numRows; row++) {
     347        for (psU32 row = 0; row < numRows; row++) {
    349348            outRow = out->data.C32[row];
    350349            inRow = in->data.C32[row];
    351350
    352             for (unsigned int col = 0; col < numCols; col++) {
     351            for (psU32 col = 0; col < numCols; col++) {
    353352                outRow[col] = crealf(inRow[col]) - I * cimagf(inRow[col]);
    354353            }
     
    359358
    360359        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
    361         for (unsigned int row = 0; row < numRows; row++) {
     360        for (psU32 row = 0; row < numRows; row++) {
    362361            outRow = out->data.C64[row];
    363362            inRow = in->data.C64[row];
    364363
    365             for (unsigned int col = 0; col < numCols; col++) {
     364            for (psU32 col = 0; col < numCols; col++) {
    366365                outRow[col] = creal(inRow[col]) - I * cimag(inRow[col]);
    367366            }
     
    384383{
    385384    psElemType type;
    386     unsigned int numCols;
    387     unsigned int numRows;
    388     int numElementsSquared;
     385    psU32 numCols;
     386    psU32 numRows;
     387    psS32 numElementsSquared;
    389388
    390389    if (in == NULL) {
     
    405404
    406405        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
    407         for (unsigned int row = 0; row < numRows; row++) {
     406        for (psU32 row = 0; row < numRows; row++) {
    408407            outRow = out->data.F32[row];
    409408            inRow = in->data.C32[row];
    410409
    411             for (unsigned int col = 0; col < numCols; col++) {
     410            for (psU32 col = 0; col < numCols; col++) {
    412411                real = crealf(inRow[col]);
    413412                imag = cimagf(inRow[col]);
     
    422421
    423422        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
    424         for (unsigned int row = 0; row < numRows; row++) {
     423        for (psU32 row = 0; row < numRows; row++) {
    425424            outRow = out->data.F64[row];
    426425            inRow = in->data.C64[row];
    427426
    428             for (unsigned int col = 0; col < numCols; col++) {
     427            for (psU32 col = 0; col < numCols; col++) {
    429428                real = creal(inRow[col]);
    430429                imag = cimag(inRow[col]);
  • trunk/psLib/src/fft/psVectorFFT.c

    r2080 r2204  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-13 20:46:57 $
     7 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-10-27 00:57:31 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727#define P_FFTW_PLAN_RIGOR FFTW_ESTIMATE
    2828
    29 static bool p_fftwWisdomImported = false;
     29static psBool p_fftwWisdomImported = false;
    3030
    3131psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction)
    3232{
    33     unsigned int numElements;
     33    psU32 numElements;
    3434    psElemType type;
    3535    fftwf_plan plan;
     
    8585
    8686    if ((direction & PS_FFT_REAL_RESULT) != 0) {
    87         for (int i = 0; i < numElements; i++) {
     87        for (psS32 i = 0; i < numElements; i++) {
    8888            out->data.F32[i] = out->data.C32[i];
    8989        }
     
    9898{
    9999    psElemType type;
    100     unsigned int numElements;
     100    psU32 numElements;
    101101
    102102    if (in == NULL) {
     
    127127        outVec = out->data.F32;
    128128
    129         for (unsigned int i = 0; i < numElements; i++) {
     129        for (psU32 i = 0; i < numElements; i++) {
    130130            outVec[i] = crealf(inVec[i]);
    131131        }
     
    138138        outVec = out->data.F64;
    139139
    140         for (unsigned int i = 0; i < numElements; i++) {
     140        for (psU32 i = 0; i < numElements; i++) {
    141141            outVec[i] = creal(inVec[i]);
    142142        }
     
    158158{
    159159    psElemType type;
    160     unsigned int numElements;
     160    psU32 numElements;
    161161
    162162    if (in == NULL) {
     
    187187        outVec = out->data.F32;
    188188
    189         for (unsigned int i = 0; i < numElements; i++) {
     189        for (psU32 i = 0; i < numElements; i++) {
    190190            outVec[i] = cimagf(inVec[i]);
    191191        }
     
    198198        outVec = out->data.F64;
    199199
    200         for (unsigned int i = 0; i < numElements; i++) {
     200        for (psU32 i = 0; i < numElements; i++) {
    201201            outVec[i] = cimag(inVec[i]);
    202202        }
     
    218218{
    219219    psElemType type;
    220     unsigned int numElements;
     220    psU32 numElements;
    221221
    222222    if (real == NULL || imag == NULL) {
     
    254254        outVec = out->data.C32;
    255255
    256         for (unsigned int i = 0; i < numElements; i++) {
     256        for (psU32 i = 0; i < numElements; i++) {
    257257            outVec[i] = realVec[i] + I * imagVec[i];
    258258        }
     
    266266        outVec = out->data.C64;
    267267
    268         for (unsigned int i = 0; i < numElements; i++) {
     268        for (psU32 i = 0; i < numElements; i++) {
    269269            outVec[i] = realVec[i] + I * imagVec[i];
    270270        }
     
    286286{
    287287    psElemType type;
    288     unsigned int numElements;
     288    psU32 numElements;
    289289
    290290    if (in == NULL) {
     
    316316        outVec = out->data.C32;
    317317
    318         for (unsigned int i = 0; i < numElements; i++) {
     318        for (psU32 i = 0; i < numElements; i++) {
    319319            outVec[i] = crealf(inVec[i]) - I * cimagf(inVec[i]);
    320320        }
     
    327327        outVec = out->data.C64;
    328328
    329         for (unsigned int i = 0; i < numElements; i++) {
     329        for (psU32 i = 0; i < numElements; i++) {
    330330            outVec[i] = creal(inVec[i]) - I * cimag(inVec[i]);
    331331        }
     
    347347{
    348348    psElemType type;
    349     unsigned int outNumElements;
    350     unsigned int inNumElements;
    351     unsigned int inHalfNumElements;
    352     unsigned int inNumElementsSquared;
     349    psU32 outNumElements;
     350    psU32 inNumElements;
     351    psU32 inHalfNumElements;
     352    psU32 inNumElementsSquared;
    353353
    354354    if (in == NULL) {
     
    378378
    379379        // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
    380         for (unsigned int i = 1; i < inHalfNumElements; i++) {
     380        for (psU32 i = 1; i < inHalfNumElements; i++) {
    381381            inAbs1 = cabsf(inVec[i]);
    382382            inAbs2 = cabsf(inVec[inNumElements - i]);
     
    402402
    403403        // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
    404         for (unsigned int i = 1; i < inHalfNumElements; i++) {
     404        for (psU32 i = 1; i < inHalfNumElements; i++) {
    405405            inAbs1 = cabs(inVec[i]);
    406406            inAbs2 = cabs(inVec[inNumElements - i]);
Note: See TracChangeset for help on using the changeset viewer.