HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_FFT.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_FFT.h
7  *
8  * COMMENTS:
9  *
10  * Performs a fast discrete fourier transform (or an inverse) on
11  * array data.
12  * FORWARD: Takes real data and produces complex data.
13  * INVERSE: Takes complex data and produces real data.
14  */
15 
16 #ifndef __UT_FFT__
17 #define __UT_FFT__
18 
19 #include "UT_API.h"
20 #include <SYS/SYS_Types.h>
21 
22 template <typename T>
24 {
25 public:
26  explicit UT_FFT(exint npnts);
27  ~UT_FFT();
28 
29  void toFrequency(T *source, T *destr, T *desti, exint npnts);
30  void toFrequency(T *sourcer, T *sourcei, T *destr, T *desti, exint npnts);
31  void toTime(T *sourcer, T *sourcei, T *dest, exint npnts);
32 
33  void toTime(T *sourcer, T *sourcei, T *destr, T *desti, exint npnts);
34 
35  void resize(exint npnts);
36 
37  // two dimensional FFT'ing
38  static void toFrequency2D(T *sourcer, T *sourcei, T *destr, T *desti,
39  exint size);
40  static void toTime2D(T *sourcer, T *sourcei, T *destr, T *desti, exint size);
41 
42 private:
43 
44  int for_fft(T *yre, T *yim, T *zre, T *zim, exint npts);
45  int inv_fft(T *yre, T *yim, T *zre, T *zim, exint npts);
46 
47  void dofft(int agamma);
48  void fftcopy(T *pr_from, T *pi_from, T *p_to, exint npts, int is_plus);
49 
50  void ifftcopy(T *p_from, T *pr_to, T *pi_to, int agamma, T factr, T facti);
51  void fftfill(T *p_co, exint part, exint all);
52 
53  void make_w(int neww);
54  void butterfly(int fly,int agamma);
55 
56  static void init_bitsw();
57  static int slow_bitsw(int k,int n);
58  static exint bitswitch(exint k, exint n);
59 
60  T *x_co;
61  T *w_co;
62 
63  static unsigned char tbl[256];
64  int gamma;
65  exint fft_size;
66 
67 };
68 
69 #endif
Definition: UT_FFT.h:23
int64 exint
Definition: SYS_Types.h:125
#define UT_API
Definition: UT_API.h:14
GLsizeiptr size
Definition: glcorearb.h:664
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
GLdouble n
Definition: glcorearb.h:2008
ImageBuf OIIO_API resize(const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, ROI roi={}, int nthreads=0)
bool all(const vbool4 &v)
Definition: simd.h:3467