Changeset 2204 for trunk/psLib/src/fft/psImageFFT.c
- Timestamp:
- Oct 26, 2004, 2:57:34 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/fft/psImageFFT.c (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/fft/psImageFFT.c
r1983 r2204 5 5 * @author Robert DeSonia, MHPCC 6 6 * 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 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 11 */ 12 12 #include <unistd.h> 13 #include <stdbool.h>14 13 #include <string.h> 15 14 #include <complex.h> … … 27 26 #define PS_FFTW_PLAN_RIGOR FFTW_ESTIMATE 28 27 29 static bool p_fftwWisdomImported = false;28 static psBool p_fftwWisdomImported = false; 30 29 31 30 psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction) 32 31 { 33 unsigned intnumCols;34 unsigned intnumRows;32 psU32 numCols; 33 psU32 numRows; 35 34 psElemType type; 36 35 fftwf_plan plan; … … 77 76 78 77 // n.b. FFTW can perform a in-place transform at the same rate or faster than out-of-place. 79 intsign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD;78 psS32 sign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD; 80 79 out = psImageCopy(out, in, PS_TYPE_C32); 81 80 plan = fftwf_plan_dft_2d(numCols, numRows, … … 118 117 { 119 118 psElemType type; 120 unsigned intnumCols;121 unsigned intnumRows;119 psU32 numCols; 120 psU32 numRows; 122 121 123 122 if (in == NULL) { … … 140 139 141 140 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); 142 for ( unsigned introw = 0; row < numRows; row++) {141 for (psU32 row = 0; row < numRows; row++) { 143 142 outRow = out->data.F32[row]; 144 143 inRow = in->data.C32[row]; 145 144 146 for ( unsigned intcol = 0; col < numCols; col++) {145 for (psU32 col = 0; col < numCols; col++) { 147 146 outRow[col] = crealf(inRow[col]); 148 147 } … … 153 152 154 153 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); 155 for ( unsigned introw = 0; row < numRows; row++) {154 for (psU32 row = 0; row < numRows; row++) { 156 155 outRow = out->data.F64[row]; 157 156 inRow = in->data.C64[row]; 158 157 159 for ( unsigned intcol = 0; col < numCols; col++) {158 for (psU32 col = 0; col < numCols; col++) { 160 159 outRow[col] = creal(inRow[col]); 161 160 } … … 179 178 { 180 179 psElemType type; 181 unsigned intnumCols;182 unsigned intnumRows;180 psU32 numCols; 181 psU32 numRows; 183 182 184 183 if (in == NULL) { … … 203 202 204 203 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); 205 for ( unsigned introw = 0; row < numRows; row++) {204 for (psU32 row = 0; row < numRows; row++) { 206 205 outRow = out->data.F32[row]; 207 206 inRow = in->data.C32[row]; 208 207 209 for ( unsigned intcol = 0; col < numCols; col++) {208 for (psU32 col = 0; col < numCols; col++) { 210 209 outRow[col] = cimagf(inRow[col]); 211 210 } … … 216 215 217 216 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); 218 for ( unsigned introw = 0; row < numRows; row++) {217 for (psU32 row = 0; row < numRows; row++) { 219 218 outRow = out->data.F64[row]; 220 219 inRow = in->data.C64[row]; 221 220 222 for ( unsigned intcol = 0; col < numCols; col++) {221 for (psU32 col = 0; col < numCols; col++) { 223 222 outRow[col] = cimag(inRow[col]); 224 223 } … … 241 240 { 242 241 psElemType type; 243 unsigned intnumCols;244 unsigned intnumRows;242 psU32 numCols; 243 psU32 numRows; 245 244 246 245 if (real == NULL || imag == NULL) { … … 282 281 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); 283 282 284 for ( unsigned introw = 0; row < numRows; row++) {283 for (psU32 row = 0; row < numRows; row++) { 285 284 outRow = out->data.C32[row]; 286 285 realRow = real->data.F32[row]; 287 286 imagRow = imag->data.F32[row]; 288 287 289 for ( unsigned intcol = 0; col < numCols; col++) {288 for (psU32 col = 0; col < numCols; col++) { 290 289 outRow[col] = realRow[col] + I * imagRow[col]; 291 290 } … … 297 296 298 297 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); 299 for ( unsigned introw = 0; row < numRows; row++) {298 for (psU32 row = 0; row < numRows; row++) { 300 299 outRow = out->data.C64[row]; 301 300 realRow = real->data.F64[row]; 302 301 imagRow = imag->data.F64[row]; 303 302 304 for ( unsigned intcol = 0; col < numCols; col++) {303 for (psU32 col = 0; col < numCols; col++) { 305 304 outRow[col] = realRow[col] + I * imagRow[col]; 306 305 } … … 324 323 { 325 324 psElemType type; 326 unsigned intnumCols;327 unsigned intnumRows;325 psU32 numCols; 326 psU32 numRows; 328 327 329 328 if (in == NULL) { … … 346 345 347 346 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); 348 for ( unsigned introw = 0; row < numRows; row++) {347 for (psU32 row = 0; row < numRows; row++) { 349 348 outRow = out->data.C32[row]; 350 349 inRow = in->data.C32[row]; 351 350 352 for ( unsigned intcol = 0; col < numCols; col++) {351 for (psU32 col = 0; col < numCols; col++) { 353 352 outRow[col] = crealf(inRow[col]) - I * cimagf(inRow[col]); 354 353 } … … 359 358 360 359 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); 361 for ( unsigned introw = 0; row < numRows; row++) {360 for (psU32 row = 0; row < numRows; row++) { 362 361 outRow = out->data.C64[row]; 363 362 inRow = in->data.C64[row]; 364 363 365 for ( unsigned intcol = 0; col < numCols; col++) {364 for (psU32 col = 0; col < numCols; col++) { 366 365 outRow[col] = creal(inRow[col]) - I * cimag(inRow[col]); 367 366 } … … 384 383 { 385 384 psElemType type; 386 unsigned intnumCols;387 unsigned intnumRows;388 intnumElementsSquared;385 psU32 numCols; 386 psU32 numRows; 387 psS32 numElementsSquared; 389 388 390 389 if (in == NULL) { … … 405 404 406 405 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); 407 for ( unsigned introw = 0; row < numRows; row++) {406 for (psU32 row = 0; row < numRows; row++) { 408 407 outRow = out->data.F32[row]; 409 408 inRow = in->data.C32[row]; 410 409 411 for ( unsigned intcol = 0; col < numCols; col++) {410 for (psU32 col = 0; col < numCols; col++) { 412 411 real = crealf(inRow[col]); 413 412 imag = cimagf(inRow[col]); … … 422 421 423 422 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); 424 for ( unsigned introw = 0; row < numRows; row++) {423 for (psU32 row = 0; row < numRows; row++) { 425 424 outRow = out->data.F64[row]; 426 425 inRow = in->data.C64[row]; 427 426 428 for ( unsigned intcol = 0; col < numCols; col++) {427 for (psU32 col = 0; col < numCols; col++) { 429 428 real = creal(inRow[col]); 430 429 imag = cimag(inRow[col]);
Note:
See TracChangeset
for help on using the changeset viewer.
