Changeset 3702 for trunk/psLib/src/image/psImageFFT.c
- Timestamp:
- Apr 14, 2005, 2:12:09 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/image/psImageFFT.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImageFFT.c
r3671 r3702 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-04- 06 01:12:58 $7 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-04-15 00:12:08 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 74 74 // n.b. FFTW can perform a in-place transform at the same rate or faster than out-of-place. 75 75 psS32 sign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD; 76 out = psImageCopy(out, in, PS_TYPE_C32); 77 plan = fftwf_plan_dft_2d(numCols, numRows, 78 out->data.C32[0], 79 out->data.C32[0], 76 77 fftwf_complex* outBuffer = fftwf_malloc(numRows*numCols*sizeof(fftwf_complex)); 78 p_psImageCopyToRawBuffer(outBuffer, in, PS_TYPE_C32); 79 80 plan = fftwf_plan_dft_2d(numRows, numCols, 81 outBuffer, 82 outBuffer, 80 83 sign, 81 84 PS_FFTW_PLAN_RIGOR); … … 101 104 // becomes an issue, the use of fftwf_plan_dft_r2c should be considered 102 105 // as well as fftwf_plan_dft_c2r. 103 psImage* realOut = psImageCopy(NULL,out,PS_TYPE_F32); 104 psFree(out); 105 out = realOut; 106 } 106 out = psImageRecycle(out,numCols,numRows,PS_TYPE_F32); 107 int index = 0; 108 for (int row=0; row < numRows; row++) { 109 psF32* outRow = out->data.F32[row]; 110 for (int col=0; col < numCols; col++) { 111 outRow[col] = crealf(outBuffer[index++]); // take just the real part 112 } 113 } 114 } else { 115 out = psImageRecycle(out,numCols,numRows,PS_TYPE_C32); 116 int index = 0; 117 for (int row=0; row < numRows; row++) { 118 psC32* outRow = out->data.C32[row]; 119 for (int col=0; col < numCols; col++) { 120 outRow[col] = outBuffer[index++]; // take just the real part 121 } 122 } 123 // memcpy(out->rawDataBuffer, outBuffer, numRows*numCols*sizeof(fftwf_complex)); 124 } 125 126 fftwf_free(outBuffer); 107 127 108 128 return out;
Note:
See TracChangeset
for help on using the changeset viewer.
