#include <packcontainer.h>
Public Methods | |
packcontainer (packnode< double > *node) | |
This version of teh packcontainer object is used as a container in calculating the forward wavelet packet transform. More... | |
packcontainer (size_t n) | |
This version is used when calculating the inverse wavelet packet transform. More... | |
void* | operator new (unsigned int num_bytes) |
This is a local implementation of new. More... | |
double& | operator[] (const size_t i) |
LHS [] operator. More... | |
double | operator[] (const size_t i) const |
RHS [] operator. More... | |
double* | lhsData () |
return the left hand size array. More... | |
double* | rhsData () |
return the right hand size array. More... | |
void | lhsData (double *l) |
set the left hand size array. More... | |
void | rhsData (double *r) |
set the right hand size array. More... | |
size_t | length () |
return the length of the data in the packet container. More... | |
Private Methods | |
packcontainer (const packcontainer &rhs) | |
disallow the copy constructor. More... | |
packcontainer () | |
disallow default constructor. More... | |
Private Attributes | |
size_t | N |
number of elements at this packet tree level. More... | |
double* | lhs |
left (low pass) half of the packcontainer data. More... | |
double* | rhs |
right (high pass) half of the packnode data. More... |
By overriding the LHS and RHS versions of the [] operator, packcontainer class allows a block of data to be treated as an array while a wavelet transform step is being calculated. After the wavelet transform step the data can be referenced as a left hand side half (the result of the wavelet scaling function) and a right hand side half (the result of the wavelet function). By allowing the two halves of the array to be referenced, copying is avoided.
Definition at line 52 of file packcontainer.h.
|
disallow the copy constructor.
Definition at line 63 of file packcontainer.h. 00063 {}; |
|
disallow default constructor.
Definition at line 65 of file packcontainer.h. 00065 {}; |
|
This version of teh packcontainer object is used as a container in calculating the forward wavelet packet transform. The packcontainer constructor is passed a pointer to a packnode object. As the wavelet packet tree is being built this packnode object contain the data from the previous level. The length of the packnode object is N. The constructor will dynamically allocate two vectors (lhs and rhs), each with N/2 elements. After the wavelet transform step has been calculated on the packcontainer object, the lhs vector will contain the wavelet scaling function, or low pass, result. The rhs vector will contain the wavelet function, or high pass, result. These will be used to construct two new packnode objects which will be children of the object passed to the constructor. Definition at line 88 of file packcontainer.h. 00089 { 00090 assert( node != 0 ); 00091 N = node->length(); 00092 assert( N > 1 ); 00093 00094 size_t half = N >> 1; 00095 block_pool mem_pool; 00096 size_t num_bytes = half * sizeof(double); 00097 00098 lhs = (double *)mem_pool.pool_alloc( num_bytes ); 00099 rhs = (double *)mem_pool.pool_alloc( num_bytes ); 00100 00101 for (size_t i = 0; i < N; i++) { 00102 (*this)[i] = (*node)[i]; 00103 } 00104 } // packcontainer |
|
This version is used when calculating the inverse wavelet packet transform. The constructor is passed the size of the container (or at least the size that the container will be, when the left and right hand size arrays are initialized). The lhs and rhs arrays are then initialized and the inverse transform step is calculated. Definition at line 117 of file packcontainer.h. 00118 { 00119 N = n; 00120 lhs = 0; 00121 rhs = 0; 00122 } |
|
return the length of the data in the packet container. Note that this length is the length of the rhs plus the length of the lhs arrays. Definition at line 180 of file packcontainer.h. Referenced by invpacktree::add_elem(), invpacktree::invpacktree(), and invpacktree::reduce().
00180 { return N; } |
|
set the left hand size array.
Definition at line 171 of file packcontainer.h. 00171 { lhs = l; } |
|
return the left hand size array.
Definition at line 166 of file packcontainer.h. Referenced by invpacktree::invpacktree(), packtree_base::newLevel(), invpacktree::new_level(), and invpacktree::reduce().
00166 { return lhs; } |
|
This is a local implementation of new. When new is applied to a packcontainer object, memory will be allocated from a memory pool, rather than from the system memory pool. Definition at line 130 of file packcontainer.h. 00131 { 00132 block_pool mem_pool; 00133 00134 void *mem_addr = mem_pool.pool_alloc( num_bytes ); 00135 return mem_addr; 00136 } // new |
|
RHS [] operator.
Definition at line 153 of file packcontainer.h. 00154 { 00155 assert( i < N ); 00156 size_t half = N >> 1; 00157 00158 if (i < half) 00159 return lhs[i]; 00160 else { 00161 return rhs[i-half]; 00162 } 00163 } |
|
LHS [] operator.
Definition at line 140 of file packcontainer.h. 00141 { 00142 assert( i < N ); 00143 size_t half = N >> 1; 00144 00145 if (i < half) 00146 return lhs[i]; 00147 else { 00148 return rhs[i-half]; 00149 } 00150 } |
|
set the right hand size array.
Definition at line 173 of file packcontainer.h. 00173 { rhs = r; } |
|
return the right hand size array.
Definition at line 168 of file packcontainer.h. Referenced by invpacktree::add_elem(), packtree_base::newLevel(), and invpacktree::reduce().
00168 { return rhs; } |
|
number of elements at this packet tree level.
Definition at line 55 of file packcontainer.h. |
|
left (low pass) half of the packcontainer data.
Definition at line 57 of file packcontainer.h. |
|
right (high pass) half of the packnode data.
Definition at line 59 of file packcontainer.h. |