HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Wavelet.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_Wavelet.h ( UT Library, C++)
7  *
8  * COMMENTS:
9  * This is a verb class to apply various wavelet transforms
10  * to common Houdini objects.
11  */
12 
13 #ifndef __UT_Wavelet__
14 #define __UT_Wavelet__
15 
16 #include "UT_API.h"
17 
18 #include "UT_VoxelArray.h"
19 #include "UT_VectorTypes.h"
20 
22 {
23 public:
25  {
27  NUM_WAVELETS
28  };
29 
30  /// These functions build a packed pyramid of coefficients
31  /// or, for inverse, unpack it. The VoxelArray variants
32  /// work on 3d arrays but can also be used for 2d arrrays
33  /// by setting one of the dimensions to 1.
34  static void transformOrdered(WAVELET_NAMES wavelettype,
35  const UT_FloatArray &source,
36  UT_FloatArray &dest,
37  int maxlevels = -1);
38  static void inverseTransformOrdered(WAVELET_NAMES wavelettype,
39  const UT_FloatArray &source,
40  UT_FloatArray &dest,
41  int maxlevels = -1);
42 
43  static void transformOrdered(WAVELET_NAMES wavelettype,
44  const UT_VoxelArrayF &source,
45  UT_VoxelArrayF &dest,
46  int maxlevels = -1);
47  static void inverseTransformOrdered(WAVELET_NAMES wavelettype,
48  const UT_VoxelArrayF &source,
49  UT_VoxelArrayF &dest,
50  int maxlevels = -1);
51 
52  /// Extracts one of the subfields from a packed wavelet.
53  /// All subfields have the rounded-up size so are the same
54  /// dimension - missing wavelet coefficients are set to 0.
55  /// The zeroth component is the low pass filter and only
56  /// is valid if the packed pyramid was stopped at that
57  /// level.
58  /// level 0 is the first set of detail coefficients.
59  static void extractComponent(const UT_VoxelArrayF &wavelets,
60  UT_VoxelArrayF &dest,
61  int level, int component);
62 
63  /// Computes the power of the given level of a packed voxel array.
64  /// level 0 is the first set of detail coefficients.
65  /// This corresponds to computing the power for a single
66  /// frequency - this is the sum of squares of the detail coefficients.
67  static void computePowerSpectrum(const UT_VoxelArrayF &wavelets,
68  UT_VoxelArrayF &dest,
69  int level);
70 
71  /// Performs a single pass of the given wavelet transform
72  /// Does an ordered transform, so is not in place.
73  static void transformOrderedOnePass(WAVELET_NAMES wavelettype,
74  const UT_FloatArray &source,
75  UT_FloatArray &wavelets);
76  static void inverseTransformOrderedOnePass(WAVELET_NAMES wavelettype,
77  const UT_FloatArray &wavelets,
79 
80  /// Specific wavelet implementations
81  static void transformOrderedOnePassHaar(const UT_FloatArray &source,
82  UT_FloatArray &wavelets);
83  static void inverseTransformOrderedOnePassHaar(const UT_FloatArray &wavelets,
85 
86 private:
87  static fpreal computeEnergy(const UT_VoxelArrayF &wavelets,
88  int x, int y, int z,
89  int nx, int ny, int nz);
90 };
91 
92 #endif
93 
GLdouble GLdouble GLdouble z
Definition: glcorearb.h:848
GLint level
Definition: glcorearb.h:108
#define UT_API
Definition: UT_API.h:14
GLint y
Definition: glcorearb.h:103
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
GLint GLenum GLint x
Definition: glcorearb.h:409
fpreal64 fpreal
Definition: SYS_Types.h:277
GLbyte ny
Definition: glad.h:2247
GLbyte GLbyte nz
Definition: glad.h:2247
Definition: format.h:895