@@ -18,6 +18,11 @@ namespace sperr {
1818
1919class CDF97 {
2020 public:
21+ //
22+ // Destructor
23+ //
24+ ~CDF97 ();
25+
2126 //
2227 // Input
2328 //
@@ -57,49 +62,34 @@ class CDF97 {
5762 void idwt3d_multi_res (std::vector<vecd_type>&);
5863
5964 private:
60- using itd_type = vecd_type::iterator;
61- using citd_type = vecd_type::const_iterator;
62-
6365 //
6466 // Private methods helping DWT.
6567 //
6668
6769 // Multiple levels of 1D DWT/IDWT on a given array of length array_len.
68- void m_dwt1d (itd_type array, size_t array_len, size_t num_of_xforms);
69- void m_idwt1d (itd_type array, size_t array_len, size_t num_of_xforms);
70+ void m_dwt1d (double * array, size_t array_len, size_t num_of_xforms);
71+ void m_idwt1d (double * array, size_t array_len, size_t num_of_xforms);
7072
7173 // Multiple levels of 2D DWT/IDWT on a given plane by repeatedly invoking
7274 // m_dwt2d_one_level(). The plane has a dimension (len_xy[0], len_xy[1]).
73- void m_dwt2d (itd_type plane, std::array<size_t , 2 > len_xy, size_t num_of_xforms);
74- void m_idwt2d (itd_type plane, std::array<size_t , 2 > len_xy, size_t num_of_xforms);
75+ void m_dwt2d (double * plane, std::array<size_t , 2 > len_xy, size_t num_of_xforms);
76+ void m_idwt2d (double * plane, std::array<size_t , 2 > len_xy, size_t num_of_xforms);
7577
7678 // Perform one level of interleaved 3D dwt/idwt on a given volume (m_dims),
7779 // specifically on its top left (len_xyz) subset.
78- void m_dwt3d_one_level (itd_type vol, std::array<size_t , 3 > len_xyz);
79- void m_idwt3d_one_level (itd_type vol, std::array<size_t , 3 > len_xyz);
80+ void m_dwt3d_one_level (std::array<size_t , 3 > len_xyz);
81+ void m_idwt3d_one_level (std::array<size_t , 3 > len_xyz);
8082
8183 // Perform one level of 2D dwt/idwt on a given plane (m_dims),
8284 // specifically on its top left (len_xy) subset.
83- void m_dwt2d_one_level (itd_type plane, std::array<size_t , 2 > len_xy);
84- void m_idwt2d_one_level (itd_type plane, std::array<size_t , 2 > len_xy);
85-
86- // Perform one level of 1D dwt/idwt on a given array (array_len).
87- // A buffer space (tmp_buf) should be passed in for
88- // this method to work on with length at least 2*array_len.
89- void m_dwt1d_one_level (itd_type array, size_t array_len);
90- void m_idwt1d_one_level (itd_type array, size_t array_len);
85+ void m_dwt2d_one_level (double * plane, std::array<size_t , 2 > len_xy);
86+ void m_idwt2d_one_level (double * plane, std::array<size_t , 2 > len_xy);
9187
9288 // Separate even and odd indexed elements to be at the front and back of the dest array.
93- // Note 1: sufficient memory space should be allocated by the caller.
94- // Note 2: two versions for even and odd length input.
95- void m_gather_even (citd_type begin, citd_type end, itd_type dest) const ;
96- void m_gather_odd (citd_type begin, citd_type end, itd_type dest) const ;
97-
9889 // Interleave low and high pass elements to be at even and odd positions of the dest array.
99- // Note 1: sufficient memory space should be allocated by the caller.
100- // Note 2: two versions for even and odd length input.
101- void m_scatter_even (citd_type begin, citd_type end, itd_type dest) const ;
102- void m_scatter_odd (citd_type begin, citd_type end, itd_type dest) const ;
90+ // Note: sufficient memory space should be allocated by the caller.
91+ void m_gather (const double * begin, size_t len, double * dest) const ;
92+ void m_scatter (const double * begin, size_t len, double * dest) const ;
10393
10494 // Two flavors of 3D transforms.
10595 // They should be invoked by the `dwt3d()` and `idwt3d()` public methods, not users, though.
@@ -112,28 +102,24 @@ class CDF97 {
112102 // It is UB if `subdims` exceeds the full dimension (`m_dims`).
113103 // It is UB if `dst` does not point to a big enough space.
114104 auto m_sub_slice (std::array<size_t , 2 > subdims) const -> vecd_type;
115- void m_sub_volume (dims_type subdims, itd_type dst) const ;
105+ void m_sub_volume (dims_type subdims, double * dst) const ;
116106
117107 //
118- // Methods from QccPack, so keep their original names, interface, and the use of raw pointers .
108+ // Methods from QccPack with slight changes to combine the even and odd length cases .
119109 //
120- void QccWAVCDF97AnalysisSymmetricEvenEven (double * signal, size_t signal_length);
121- void QccWAVCDF97AnalysisSymmetricOddEven (double * signal, size_t signal_length);
122- void QccWAVCDF97SynthesisSymmetricEvenEven (double * signal, size_t signal_length);
123- void QccWAVCDF97SynthesisSymmetricOddEven (double * signal, size_t signal_length);
110+ void QccWAVCDF97AnalysisSymmetric (double * signal, size_t signal_length);
111+ void QccWAVCDF97SynthesisSymmetric (double * signal, size_t signal_length);
124112
125113 //
126114 // Private data members
127115 //
128116 vecd_type m_data_buf; // Holds the entire input data.
129117 dims_type m_dims = {0 , 0 , 0 }; // Dimension of the data volume
130118
131- // Temporary buffers that are big enough for any (1D column * 2) or any 2D
132- // slice. Note: `m_qcc_buf` should be used by m_***_one_level() functions and
133- // should not be used by higher-level functions. `m_slice_buf` is only used by
134- // wavelet-packet transforms.
135- vecd_type m_qcc_buf;
119+ // Temporary buffers that are big enough for any 1D column or any 2D slice.
136120 vecd_type m_slice_buf;
121+ double * m_aligned_buf = nullptr ;
122+ size_t m_aligned_buf_bytes = 0 ; // num. of bytes
137123
138124 //
139125 // Note on the coefficients and constants:
0 commit comments