gpufilter
GPU-Efficient Recursive Filtering and Summed-Area Tables
|
#include <util.h>
Public Member Functions | |
__host__ __device__ int | rows () const |
Get number of rows of this matrix. | |
__host__ __device__ int | cols () const |
Get number of columns of this matrix. | |
__host__ __device__ const Vector< T, N > & | operator[] (int i) const |
Access (constant) operator. | |
__host__ __device__ Vector< T, N > & | operator[] (int i) |
Access operator. | |
template<int P, int Q> | |
__host__ __device__ Matrix< T, M, Q > | operator* (const Matrix< T, P, Q > &rhs) const |
Multiply operator. | |
__host__ __device__ Matrix & | operator*= (T val) |
Multiply-then-assign operator. | |
__host__ __device__ Vector< T, M > | col (int j) const |
Get column j of this matrix. | |
__host__ __device__ void | set_col (int j, const Vector< T, M > &c) |
Set column j of this matrix. | |
__host__ __device__ Matrix & | operator+= (const Matrix &rhs) |
Add-then-assign operator. | |
__host__ __device__ Matrix & | operator-= (const Matrix &rhs) |
Subtract-then-assign operator. | |
Private Attributes | |
Vector< T, N > | m_data [M] |
Matrix values. | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Matrix &m) |
Output stream operator. | |
__host__ __device__ friend Matrix | operator* (const Matrix &m, T val) |
Multiply operator. | |
__host__ __device__ friend Matrix | operator* (T val, const Matrix &m) |
Multiply operator. | |
__host__ __device__ friend Matrix | operator+ (const Matrix &lhs, const Matrix &rhs) |
Add operator. | |
__host__ __device__ friend Matrix | operator- (const Matrix &lhs, const Matrix &rhs) |
Subtract operator. | |
Related Functions | |
(Note that these are not member functions.) | |
template<class T , int M, int N> | |
__host__ __device__ Vector< T, N > | operator* (const Vector< T, M > &v, const Matrix< T, M, N > &m) |
Multiply vector-to-matrix operator. | |
template<class T , int M, int N> | |
__host__ __device__ Matrix< T, M, N > | zeros () |
Instantiate a matrix with zeros. | |
template<class T , int M, int N> | |
Matrix< T, M, N > | identity () |
Instantiate an identity matrix. | |
template<class T , int M, int N> | |
__host__ __device__ Matrix< T, N, M > | transp (const Matrix< T, M, N > &m) |
Instantiate the transposed version of a given matrix. | |
template<class T , int M, int N, int R> | |
void | fwd_inplace (const Matrix< T, M, R > &p, Matrix< T, M, N > &b, const Vector< T, R+1 > &w) |
Computes the forward operator on matrices (in-place) | |
template<class T , int M, int N, int R> | |
Matrix< T, M, N > | fwd (const Matrix< T, M, R > &p, const Matrix< T, M, N > &b, const Vector< T, R+1 > &w) |
Computes the forward operator on matrices. | |
template<class T , int M, int N, int R> | |
void | fwd_inplace (const Matrix< T, R, N > &p, Matrix< T, M, N > &b, const Vector< T, R+1 > &w) |
Computes the forward operator on matrices (in-place) | |
template<class T , int M, int N, int R> | |
Matrix< T, M, N > | fwdT (const Matrix< T, R, N > &pT, const Matrix< T, M, N > &b, const Vector< T, R+1 > &w) |
Computes the forward-transposed operator on matrices. | |
template<class T , int M, int N, int R> | |
void | rev_inplace (Matrix< T, M, N > &b, const Matrix< T, M, R > &e, const Vector< T, R+1 > &w) |
Computes the reverse operator on matrices (in-place) | |
template<class T , int M, int N, int R> | |
Matrix< T, M, N > | rev (const Matrix< T, M, N > &b, const Matrix< T, M, R > &e, const Vector< T, R+1 > &w) |
Computes the reverse operator on matrices. | |
template<class T , int M, int N, int R> | |
void | rev_inplace (Matrix< T, M, N > &b, const Matrix< T, R, N > &e, const Vector< T, R+1 > &w) |
Computes the reverse operator on matrices (in-place) | |
template<class T , int M, int N, int R> | |
Matrix< T, M, N > | revT (const Matrix< T, M, N > &b, const Matrix< T, R, N > &eT, const Vector< T, R+1 > &w) |
Computes the reverse-transposed operator on matrices. | |
template<int R, int M, int N, class T > | |
Matrix< T, M, R > | head (const Matrix< T, M, N > &mat) |
Computes the head operator on matrices. | |
template<int R, int M, int N, class T > | |
Matrix< T, R, N > | headT (const Matrix< T, M, N > &mat) |
Computes the head-transposed operator on matrices. | |
template<int R, int M, int N, class T > | |
Matrix< T, M, R > | tail (const Matrix< T, M, N > &mat) |
Computes the tail operator on matrices. | |
template<int R, int M, int N, class T > | |
Matrix< T, R, N > | tailT (const Matrix< T, M, N > &mat) |
Computes the tail-transposed operator on matrices. |
Matrix class.
Matrix class to represent special small matrices, such as and described in the paper ([Nehab:2011] cited in alg5()).
T | Matrix value type |
M | Number of rows |
N | Number of columns |
__host__ __device__ Vector<T,M> gpufilter::Matrix< T, M, N >::col | ( | int | j | ) | const [inline] |
Get column j of this matrix.
[in] | j | Index of column to get |
__host__ __device__ int gpufilter::Matrix< T, M, N >::cols | ( | ) | const [inline] |
Get number of columns of this matrix.
__host__ __device__ Matrix<T,M,Q> gpufilter::Matrix< T, M, N >::operator* | ( | const Matrix< T, P, Q > & | rhs | ) | const [inline] |
Multiply operator.
[in] | rhs | Right-hand-side matrix to multiply |
P | Number of rows of other matrix |
Q | Number of columns of other matrix |
__host__ __device__ Matrix& gpufilter::Matrix< T, M, N >::operator*= | ( | T | val | ) | [inline] |
Multiply-then-assign operator.
[in] | val | Scalar value to multilpy matrix to |
__host__ __device__ Matrix& gpufilter::Matrix< T, M, N >::operator+= | ( | const Matrix< T, M, N > & | rhs | ) | [inline] |
Add-then-assign operator.
[in] | rhs | Right-hand-side matrix in addition |
__host__ __device__ Matrix& gpufilter::Matrix< T, M, N >::operator-= | ( | const Matrix< T, M, N > & | rhs | ) | [inline] |
Subtract-then-assign operator.
[in] | rhs | Right-hand-side matrix in subtraction |
__host__ __device__ const Vector<T,N>& gpufilter::Matrix< T, M, N >::operator[] | ( | int | i | ) | const [inline] |
Access (constant) operator.
[in] | i | Row of the matrix to access |
__host__ __device__ Vector<T,N>& gpufilter::Matrix< T, M, N >::operator[] | ( | int | i | ) | [inline] |
Access operator.
[in] | i | Row of the matrix to access |
__host__ __device__ int gpufilter::Matrix< T, M, N >::rows | ( | ) | const [inline] |
Get number of rows of this matrix.
__host__ __device__ void gpufilter::Matrix< T, M, N >::set_col | ( | int | j, |
const Vector< T, M > & | c | ||
) | [inline] |
Set column j of this matrix.
[in] | j | Index of column to set |
[in] | c | Vector to place in matrix column |
Matrix< T, M, N > fwd | ( | const Matrix< T, M, R > & | p, |
const Matrix< T, M, N > & | b, | ||
const Vector< T, R+1 > & | w | ||
) | [related] |
Computes the forward operator on matrices.
Computes the matrix resulting from applying the forward operator (causal filter) given a prologue matrix (i.e. initial conditions) and an input matrix (where M is the number of rows and N is the number of columns as described in section 2 of [Nehab:2011] cited in alg5()). The resulting matrix is and it has the same size as the input .
[in] | p | Prologue matrix ( is the filter order) |
[in] | b | Input matrix |
[in] | w | Filter weights with size ( feedback coefficients) |
M | Number of rows |
N | Number of columns |
R | Number of feedback coefficients |
T | Matrix value type |
void fwd_inplace | ( | const Matrix< T, M, R > & | p, |
Matrix< T, M, N > & | b, | ||
const Vector< T, R+1 > & | w | ||
) | [related] |
Computes the forward operator on matrices (in-place)
For more information see rev().
[in] | p | Prologue matrix ( is the filter order) |
[in,out] | b | In(out)put matrix |
[in] | w | Filter weights with size ( feedback coefficients) |
M | Number of rows |
N | Number of columns |
R | Number of feedback coefficients |
T | Matrix value type |
void fwd_inplace | ( | const Matrix< T, R, N > & | p, |
Matrix< T, M, N > & | b, | ||
const Vector< T, R+1 > & | w | ||
) | [related] |
Computes the forward operator on matrices (in-place)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. For more information see fwd().
[in] | p | Prologue matrix ( is the filter order) |
[in,out] | b | In(out)put matrix |
[in] | w | Filter weights with size ( feedback coefficients) |
M | Number of rows |
N | Number of columns |
R | Number of feedback coefficients |
T | Matrix value type |
Matrix< T, M, N > fwdT | ( | const Matrix< T, R, N > & | pT, |
const Matrix< T, M, N > & | b, | ||
const Vector< T, R+1 > & | w | ||
) | [related] |
Computes the forward-transposed operator on matrices.
Computes the matrix resulting from applying the forward-transposed operator (causal filter on rows) given a prologue matrix (i.e. initial conditions) and an input matrix (where M is the number of rows and N is the number of columns as described in section 2 of [Nehab:2011] cited in alg5()). The resulting matrix is and it has the same size as the input .
[in] | pT | Prologue transposed matrix ( is the filter order) |
[in] | b | Input matrix |
[in] | w | Filter weights with size ( feedback coefficients) |
M | Number of rows |
N | Number of columns |
R | Number of feedback coefficients |
T | Matrix value type |
Matrix< T, M, R > head | ( | const Matrix< T, M, N > & | mat | ) | [related] |
Computes the head operator on matrices.
Computes the matrix resulting from applying the head operator given an input matrix . The operator extracts the submatrix in the same shape and position as the column-epilogue of the input matrix, considering filter order (see [Nehab:2011] cited in alg5() function). The following image illustrates the concept:
2D block notation showing a block and its boundary data from adjacent blocks. Note that the column-epilogue has to be extracted from the next block in column using the head operator on that block.
[in] | mat | Input matrix |
R | Number of rows to extract (feedback coefficients) |
M | Number of rows in input matrix |
N | Number of columns in input matrix |
T | Matrix value type |
Matrix< T, R, N > headT | ( | const Matrix< T, M, N > & | mat | ) | [related] |
Computes the head-transposed operator on matrices.
Computes the matrix resulting from applying the head-transposed operator given an input matrix . The operator extracts the submatrix in the same shape and position as the row-epilogue of the input matrix, considering filter order (see [Nehab:2011] cited in alg5() function).
Note that, as shown in figure in head() function, the row-epilogue has to be extracted from the next block in row using the head-transposed operator on that block.
[in] | mat | Input matrix |
R | Number of columns to extract (feedback coefficients) |
M | Number of rows in input matrix |
N | Number of columns in input matrix |
T | Matrix value type |
Matrix< T, M, N > identity | ( | ) | [related] |
Instantiate an identity matrix.
T | Matrix value type |
M | Number of rows |
N | Number of columns |
__host__ __device__ friend Matrix operator* | ( | const Matrix< T, M, N > & | m, |
T | val | ||
) | [friend] |
Multiply operator.
[in] | m | Matrix to multiply |
[in] | val | Scalar value to multiply matrix to |
__host__ __device__ friend Matrix operator* | ( | T | val, |
const Matrix< T, M, N > & | m | ||
) | [friend] |
Multiply operator.
[in] | val | Scalar value to multiply matrix to |
[in] | m | Matrix to multiply |
__host__ __device__ friend Matrix operator+ | ( | const Matrix< T, M, N > & | lhs, |
const Matrix< T, M, N > & | rhs | ||
) | [friend] |
Add operator.
[in] | lhs | Left-hand-side matrix in addition |
[in] | rhs | Right-hand-side matrix in addition |
__host__ __device__ friend Matrix operator- | ( | const Matrix< T, M, N > & | lhs, |
const Matrix< T, M, N > & | rhs | ||
) | [friend] |
Subtract operator.
[in] | lhs | Left-hand-side matrix in subtraction |
[in] | rhs | Right-hand-side matrix in subtraction |
std::ostream& operator<< | ( | std::ostream & | out, |
const Matrix< T, M, N > & | m | ||
) | [friend] |
Output stream operator.
[in,out] | out | Output stream |
[in] | m | Matrix to output values from |
Matrix< T, M, N > rev | ( | const Matrix< T, M, N > & | b, |
const Matrix< T, M, R > & | e, | ||
const Vector< T, R+1 > & | w | ||
) | [related] |
Computes the reverse operator on matrices.
Computes the matrix resulting from applying the reverse operator (anticausal filter) given an epilogue matrix (i.e. initial conditions) and an input matrix (where M is the number of rows and N is the number of columns as described in section 2 of [Nehab:2011] cited in alg5()). The resulting matrix is and it has the same size as the input .
[in] | b | Input matrix |
[in] | e | Epilogue matrix ( is the filter order) |
[in] | w | Filter weights with size ( feedback coefficients) |
M | Number of rows |
N | Number of columns |
R | Number of feedback coefficients |
T | Matrix value type |
void rev_inplace | ( | Matrix< T, M, N > & | b, |
const Matrix< T, M, R > & | e, | ||
const Vector< T, R+1 > & | w | ||
) | [related] |
Computes the reverse operator on matrices (in-place)
For more information see rev().
[in,out] | b | In(out)put matrix |
[in] | e | Epilogue matrix ( is the filter order) |
[in] | w | Filter weights with size ( feedback coefficients) |
M | Number of rows |
N | Number of columns |
R | Number of feedback coefficients |
T | Matrix value type |
void rev_inplace | ( | Matrix< T, M, N > & | b, |
const Matrix< T, R, N > & | e, | ||
const Vector< T, R+1 > & | w | ||
) | [related] |
Computes the reverse operator on matrices (in-place)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. For more information see rev().
[in,out] | b | In(out)put matrix |
[in] | e | Epilogue matrix ( is the filter order) |
[in] | w | Filter weights with size ( feedback coefficients) |
M | Number of rows |
N | Number of columns |
R | Number of feedback coefficients |
T | Matrix value type |
Matrix< T, M, N > revT | ( | const Matrix< T, M, N > & | b, |
const Matrix< T, R, N > & | eT, | ||
const Vector< T, R+1 > & | w | ||
) | [related] |
Computes the reverse-transposed operator on matrices.
Computes the matrix resulting from applying the reverse-transposed operator (anticausal filter on rows) given an epilogue matrix (i.e. initial conditions) and an input matrix (where M is the number of rows and N is the number of columns as described in section 2 of [Nehab:2011] cited in alg5()). The resulting matrix is and it has the same size as the input .
[in] | b | Input matrix |
[in] | eT | Epilogue matrix ( is the filter order) |
[in] | w | Filter weights with size ( feedback coefficients) |
M | Number of rows |
N | Number of columns |
R | Number of feedback coefficients |
T | Matrix value type |
Matrix< T, M, R > tail | ( | const Matrix< T, M, N > & | mat | ) | [related] |
Computes the tail operator on matrices.
Computes the matrix resulting from applying the tail operator given an input matrix . The operator extracts the submatrix in the same shape and position as the column-prologue of the input matrix, considering filter order (see [Nehab:2011] cited in alg5() function).
Note that, as shown in figure in head() function, the column-prologue has to be extracted from the previous block in column using the tail operator on that block.
[in] | mat | Input matrix |
R | Number of rows to extract (feedback coefficients) |
M | Number of rows in input matrix |
N | Number of columns in input matrix |
T | Matrix value type |
Matrix< T, R, N > tailT | ( | const Matrix< T, M, N > & | mat | ) | [related] |
Computes the tail-transposed operator on matrices.
Computes the matrix resulting from applying the tail-transposed operator given an input matrix . The operator extracts the submatrix in the same shape and position as the row-prologue of the input matrix, considering filter order (see [Nehab:2011] cited in alg5() function).
Note that, as shown in figure in head() function, the row-prologue has to be extracted from the previous block in row using the tail-transposed operator on that block.
[in] | mat | Input matrix |
R | Number of rows to extract (feedback coefficients) |
M | Number of rows in input matrix |
N | Number of columns in input matrix |
T | Matrix value type |
__host__ __device__ Matrix< T, N, M > transp | ( | const Matrix< T, M, N > & | m | ) | [related] |
Instantiate the transposed version of a given matrix.
[in] | m | Given matrix |
T | Matrix value type |
M | Number of rows |
N | Number of columns |
__host__ __device__ Matrix< T, M, N > zeros | ( | ) | [related] |
Instantiate a matrix with zeros.
T | Matrix value type |
M | Number of rows |
N | Number of columns |