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 "UT_NonCopyable.h"
21 #include <SYS/SYS_Types.h>
22 
23 template <typename T>
25 {
26 public:
27  explicit UT_FFT(exint npnts);
28  ~UT_FFT();
29 
31 
32  void toFrequency(T *source, T *destr, T *desti, exint npnts);
33  void toFrequency(T *sourcer, T *sourcei, T *destr, T *desti, exint npnts);
34  void toTime(T *sourcer, T *sourcei, T *dest, exint npnts);
35 
36  void toTime(T *sourcer, T *sourcei, T *destr, T *desti, exint npnts);
37 
38  void resize(exint npnts);
39 
40  // two dimensional FFT'ing
41  static void toFrequency2D(T *sourcer, T *sourcei, T *destr, T *desti,
42  exint size);
43  static void toTime2D(T *sourcer, T *sourcei, T *destr, T *desti, exint size);
44 
45 private:
46 
47  int for_fft(T *yre, T *yim, T *zre, T *zim, exint npts);
48  int inv_fft(T *yre, T *yim, T *zre, T *zim, exint npts);
49 
50  void dofft(int agamma);
51  void fftcopy(T *pr_from, T *pi_from, T *p_to, exint npts, int is_plus);
52 
53  void ifftcopy(T *p_from, T *pr_to, T *pi_to, int agamma, T factr, T facti);
54  void fftfill(T *p_co, exint part, exint all);
55 
56  void make_w(int neww);
57  void butterfly(int fly,int agamma);
58 
59  static void init_bitsw();
60  static int slow_bitsw(int k,int n);
61  static exint bitswitch(exint k, exint n);
62 
63  T *x_co;
64  T *w_co;
65 
66  static unsigned char tbl[256];
67  int gamma;
68  exint fft_size;
69 
70 };
71 
72 #endif
Definition: UT_FFT.h:24
int64 exint
Definition: SYS_Types.h:125
#define UT_API
Definition: UT_API.h:14
SIM_API const UT_StringHolder all
GLdouble n
Definition: glcorearb.h:2008
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
GLsizeiptr size
Definition: glcorearb.h:664
ImageBuf OIIO_API resize(const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, ROI roi={}, int nthreads=0)