gpufilter
GPU-Efficient Recursive Filtering and Summed-Area Tables
|
Classes | |
class | gpufilter::dvector< T > |
Device Vector class. More... | |
struct | gpufilter::_clamp |
Access pattern: clamp-to-border. More... | |
struct | gpufilter::_repeat |
Access pattern: repeat. More... | |
struct | gpufilter::_mirror |
Access pattern: mirror. More... | |
class | gpufilter::base_timer |
Base timer class. More... | |
class | gpufilter::gpu_timer |
GPU specialization of the timer class. More... | |
class | gpufilter::cpu_timer |
CPU specialization of the timer class. More... | |
class | gpufilter::scoped_timer_stop |
Scope-limited timer class. More... | |
class | gpufilter::timer_pool |
Pool of timers. More... | |
class | gpufilter::Vector< T, N > |
Vector class. More... | |
class | gpufilter::Matrix< T, M, N > |
Matrix class. More... | |
Enumerations | |
enum | gpufilter::initcond { gpufilter::zero, gpufilter::clamp, gpufilter::repeat, gpufilter::mirror } |
Enumerates possible initial conditions for 2D-image access. More... | |
Functions | |
template<class T > | |
T * | gpufilter::cuda_new (size_t elements) |
Allocates a new memory space in the GPU. | |
template<class T > | |
void | gpufilter::cuda_delete (T *d_ptr) |
Deallocates a memory space in the GPU. | |
void | gpufilter::calc_borders (int &left, int &top, int &right, int &bottom, const int &w, const int &h, const int &extb) |
Calculate image borders. | |
bool | gpufilter::extend (const int &w, const int &h, const int &extb) |
Verify if an image needs to be extended. | |
void | gpufilter::cuda_error (const std::string &msg) |
Check error in device. | |
template<class T > | |
T | gpufilter::lookat (const T *in, const int &i, const int &n, const initcond &ic, const int &p=1) |
Look in an input at a given index range. | |
template<class T > | |
T | gpufilter::lookat (const T *img, const int &i, const int &j, const int &h, const int &w, const initcond &ic) |
Look in an image at a given position. | |
template<class T > | |
T | gpufilter::qs (const T &s) |
Compute recursive filtering scaling factor. | |
template<class T > | |
std::complex< T > | gpufilter::ds (const std::complex< T > &d, const T &s) |
Rescale poles of the recursive filtering z-transform. | |
template<class T > | |
T | gpufilter::ds (const T &d, const T &s) |
Rescale poles in the real-axis of the recursive filtering z-transform. | |
template<class T1 , class T2 > | |
void | gpufilter::weights1 (const T1 &s, T2 &b0, T2 &a1) |
Compute first-order weights. | |
template<class T1 , class T2 > | |
void | gpufilter::weights2 (const T1 &s, T2 &b0, T2 &a1, T2 &a2) |
Compute first- and second-order weights. | |
template<class T > | |
void | gpufilter::copy_to_symbol (const std::string &name, const T &value) |
Copy value(s) to symbol. | |
void | gpufilter::copy_to_symbol (const std::string &name, unsigned long value) |
void | gpufilter::copy_to_symbol (const std::string &name, long value) |
template<class T > | |
void | gpufilter::copy_to_symbol (const std::string &name, const std::string &size_name, const std::vector< T > &items) |
template<class T > | |
void | gpufilter::copy_to_symbol (const std::string &name, const std::vector< T > &items) |
Variables | |
timer_pool | gpufilter::timers |
Global pool of timers. |
enum gpufilter::initcond |
void gpufilter::calc_borders | ( | int & | left, |
int & | top, | ||
int & | right, | ||
int & | bottom, | ||
const int & | w, | ||
const int & | h, | ||
const int & | extb | ||
) |
Calculate image borders.
Given the image size and an extension to consider calculates the four-directional border pixels (left, top, right and bottom) needed by algorithm 4 and 5.
[out] | left | Extension (in pixels) in the left border of the image |
[out] | top | Extension (in pixels) in the top border of the image |
[out] | right | Extension (in pixels) in the right border of the image |
[out] | bottom | Extension (in pixels) in the bottom border of the image |
[in] | w | Width of the image |
[in] | h | Height of the image |
[in] | extb | Extension (in blocks) to consider outside image (default 0) |
void gpufilter::copy_to_symbol | ( | const std::string & | name, |
const T & | value | ||
) |
Copy value(s) to symbol.
[in] | name | Name of the symbol in device (GPU) |
[in] | value | Value to copy to symbol |
T | Value type used in the GPU |
void gpufilter::copy_to_symbol | ( | const std::string & | name, |
unsigned long | value | ||
) | [inline] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[in] | name | Name of the symbol in device (GPU) |
[in] | value | Value to copy to symbol |
void gpufilter::copy_to_symbol | ( | const std::string & | name, |
long | value | ||
) | [inline] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[in] | name | Name of the symbol in device (GPU) |
[in] | value | Value to copy to symbol |
void gpufilter::copy_to_symbol | ( | const std::string & | name, |
const std::string & | size_name, | ||
const std::vector< T > & | items | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[in] | name | Name of the symbol in device (GPU) |
[in] | size_name | Name of the symbol storing the size of the items to be copied |
[in] | items | Host (STL) Vector values |
T | Vector values type used in the CPU and the GPU |
void gpufilter::copy_to_symbol | ( | const std::string & | name, |
const std::vector< T > & | items | ||
) |
void gpufilter::cuda_delete | ( | T * | d_ptr | ) |
Deallocates a memory space in the GPU.
This function deletes device (GPU) memory space.
[in] | d_ptr | Device pointer (in the GPU memory) |
T | Memory values type |
void gpufilter::cuda_error | ( | const std::string & | msg | ) | [inline] |
Check error in device.
This function checks if there is a device error.
[in] | msg | Message to appear in case of a device error |
T* gpufilter::cuda_new | ( | size_t | elements | ) |
Allocates a new memory space in the GPU.
This function allocates device (GPU) memory space.
[in] | elements | Number of elements to allocate |
T | Memory values type |
std::complex<T> gpufilter::ds | ( | const std::complex< T > & | d, |
const T & | s | ||
) |
Rescale poles of the recursive filtering z-transform.
Given a complex-valued pole on |z|=1 ROC of the recursive filter z-transform compute a rescaled pole representing a true Gaussian filter convolution with arbitrary support sigma.
[in] | d | Complex-valued pole of a stable recursive filter |
[in] | s | Sigma support of the true Gaussian filter |
T | Sigma value type |
T gpufilter::ds | ( | const T & | d, |
const T & | s | ||
) |
Rescale poles in the real-axis of the recursive filtering z-transform.
Given a real pole on |z|=1 ROC of the recursive filter z-transform compute a rescaled pole representing a true Gaussian filter convolution with arbitrary support sigma.
[in] | d | Real pole of a stable recursive filter |
[in] | s | Sigma support of the true Gaussian filter |
T | Sigma value type |
bool gpufilter::extend | ( | const int & | w, |
const int & | h, | ||
const int & | extb | ||
) |
Verify if an image needs to be extended.
Given the image size and an extension to consider verifies if the image should be extended to met the requirement of each dimension be a multiple of 32.
[in] | w | Width of the image |
[in] | h | Height of the image |
[in] | extb | Extension (in blocks) to consider outside image (default 0) |
T gpufilter::lookat | ( | const T * | in, |
const int & | i, | ||
const int & | n, | ||
const initcond & | ic, | ||
const int & | p = 1 |
||
) |
Look in an input at a given index range.
This function looks in an input array at an arbitrary index (possibly outside the input array) using a given initial condition and a pitch value for arrays with 2D geometry.
[in] | in | Input array |
[in] | i | Index to look at |
[in] | n | Input range [0,n) |
[in] | ic | Initial condition |
[in] | p | Pitch (e.g. image width represented by the input array) |
T | Input array value type |
T gpufilter::lookat | ( | const T * | img, |
const int & | i, | ||
const int & | j, | ||
const int & | h, | ||
const int & | w, | ||
const initcond & | ic | ||
) |
Look in an image at a given position.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function looks in an input image at an arbitrary position (possibly outside the image) using a given initial condition and the 2D image size.
[in] | img | Input image |
[in] | i | Row index |
[in] | j | Column index |
[in] | h | Image height |
[in] | w | Image width |
[in] | ic | Initial condition |
T | Input image value type |
T gpufilter::qs | ( | const T & | s | ) |
Compute recursive filtering scaling factor.
Compute the scaling factor of the recursive filter representing a true Gaussian filter convolution with arbitrary support sigma.
[in] | s | Sigma support of the true Gaussian filter |
T | Sigma value type |
void gpufilter::weights1 | ( | const T1 & | s, |
T2 & | b0, | ||
T2 & | a1 | ||
) |
Compute first-order weights.
Given a Gaussian sigma value compute the feedforward and feedback first-order coefficients.
[in] | s | Gaussian sigma |
[out] | b0 | Feedforward coefficient |
[out] | a1 | Feedback first-order coefficient |
T1 | Sigma value type |
T2 | Coefficients value type |
void gpufilter::weights2 | ( | const T1 & | s, |
T2 & | b0, | ||
T2 & | a1, | ||
T2 & | a2 | ||
) |
Compute first- and second-order weights.
Given a Gaussian sigma value compute the feedforward and feedback first- and second-order coefficients. Refer to the following paper for more information:
@inproceedings{vanVliet:1998, author = {L. J. {van Vliet} and I. T. Young and P. W. Verbeek}, title = {Recursive {Gaussian} derivative filters}, booktitle = {Proceedings of the 14th International Conference on Pattern Recognition}, year = {1998}, pages = {509--514 (v. 1)} }
[in] | s | Gaussian sigma |
[out] | b0 | Feedforward coefficient |
[out] | a1 | Feedback first-order coefficient |
[out] | a2 | Feedback second-order coefficient |
T1 | Sigma value type |
T2 | Coefficients value type |