vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
vspline::convolve< _vtype, _math_ele_type, _vsize > Struct Template Reference

class convolve provides the combination of class fir_filter above with a vector-friendly buffer. Calling code provides information about what should be buffered, the data are sucked into the buffer, filtered, and moved back from there. The operation is orchestrated by the code in filter.h, which is also used to 'wield' the b-spline prefilter. Both operations are sufficiently similar to share the wielding code. More...

#include <convolve.h>

Inheritance diagram for vspline::convolve< _vtype, _math_ele_type, _vsize >:
vspline::buffer_handling< _vtype, _math_ele_type, _vsize > vspline::fir_filter< _vtype< _math_ele_type, _vsize > > vspline::fir_filter_specs

Public Types

typedef _math_ele_type math_ele_type
 
typedef buffer_handling< _vtype, _math_ele_type, _vsize > buffer_handling_type
 
using allocator_t = typename vspline::allocator_traits< vtype > ::type
 
typedef vigra::MultiArray< 1, vtype, allocator_tbuffer_type
 
typedef vigra::MultiArrayView< 1, vtypebuffer_view_type
 
typedef _vtype< _math_ele_type, _vsize > simdized_math_type
 
typedef vspline::fir_filter< simdized_math_typefilter_type
 
typedef fir_filter_specs arg_type
 
- Public Types inherited from vspline::fir_filter< _vtype< _math_ele_type, _vsize > >
typedef vigra::MultiArrayView< 1, _vtype< _math_ele_type, _vsize > > in_buffer_type
 
typedef vigra::MultiArrayView< 1, _vtype< _math_ele_type, _vsize > > out_buffer_type
 
typedef _vtype< _math_ele_type, _vsize > math_type
 
using allocator_t = typename vspline::allocator_traits< math_type > ::type
 

Public Member Functions

 convolve (const fir_filter_specs &specs, size_t size)
 
void operator() ()
 
void solve (const in_buffer_type &input, out_buffer_type &output)
 public 'solve' routine. This is for calls 'from outside', like when this object is used by itself, not as a base class of class convolve below. an extrapolator for the boundary condition code 'bc' (see fir_filter_specs) is made, then the call is delegated to the protected routine below which accepts an extrapolator on top of input and output. More...
 
void solve (const in_buffer_type &input, out_buffer_type &output, const extrapolator< in_buffer_type > &source)
 protected solve routine taking an extrapolator on top of input and output. This way, the derived class (class convolve) can maintain an extrapolator fixed to it's buffer and reuse it for subsequent calls to this routine. we use the following strategy: More...
 
- Public Member Functions inherited from vspline::buffer_handling< _vtype, _math_ele_type, _vsize >
void get (const tractor &src, std::ptrdiff_t offset=0, int ni=vsize) const
 fetch data from 'source' into the buffer 'in_window' More...
 
void put (const tractor &trg, std::ptrdiff_t offset=0, int ni=vsize) const
 deposit result data from 'out_window' into target memory More...
 
- Public Member Functions inherited from vspline::fir_filter< _vtype< _math_ele_type, _vsize > >
 fir_filter (const fir_filter_specs &specs)
 
int get_support_width () const
 calling code may have to set up buffers with additional space around the actual data to allow filtering code to 'run up' to the data, shedding margin effects in the process. We stay on the safe side and return the width of the whole kernel, which is always sufficient to provide safe runup. More...
 
void solve (const in_buffer_type &input, out_buffer_type &output)
 public 'solve' routine. This is for calls 'from outside', like when this object is used by itself, not as a base class of class convolve below. an extrapolator for the boundary condition code 'bc' (see fir_filter_specs) is made, then the call is delegated to the protected routine below which accepts an extrapolator on top of input and output. More...
 
- Public Member Functions inherited from vspline::fir_filter_specs
 fir_filter_specs (vspline::bc_code _bc, int _ksize, int _headroom, const xlf_type *_kernel)
 

Static Public Member Functions

template<typename in_type , typename out_type = in_type, typename math_type = out_type>
static vspline::fir_filter< in_type, out_type, math_typeget_raw_filter (const fir_filter_specs &specs)
 

Public Attributes

buffer_type buffer
 
extrapolator< buffer_view_typebuffer_extrapolator
 
- Public Attributes inherited from vspline::fir_filter< _vtype< _math_ele_type, _vsize > >
vigra::MultiArray< 1, math_type, allocator_treactor
 
vigra::MultiArrayView< 1, math_typecircular_buffer
 
vigra::MultiArrayView< 1, math_typekernel_values
 
vigra::MultiArrayView< 1, math_typetail_buffer
 
- Public Attributes inherited from vspline::fir_filter_specs
vspline::bc_code bc
 
int ksize
 
int headroom
 
const xlf_typekernel
 

Additional Inherited Members

- Static Public Attributes inherited from vspline::fir_filter< _vtype< _math_ele_type, _vsize > >
static const bool is_single_pass
 
- Protected Types inherited from vspline::buffer_handling< _vtype, _math_ele_type, _vsize >
enum  
 
typedef _math_ele_type dtype
 
typedef _vtype< dtype, vsizevtype
 
- Protected Member Functions inherited from vspline::buffer_handling< _vtype, _math_ele_type, _vsize >
void init (vigra::MultiArrayView< 1, vtype > &_in_window, vigra::MultiArrayView< 1, vtype > &_out_window)
 
- Protected Member Functions inherited from vspline::fir_filter< _vtype< _math_ele_type, _vsize > >
void solve (const in_buffer_type &input, out_buffer_type &output, const extrapolator< in_buffer_type > &source)
 protected solve routine taking an extrapolator on top of input and output. This way, the derived class (class convolve) can maintain an extrapolator fixed to it's buffer and reuse it for subsequent calls to this routine. we use the following strategy: More...
 
- Protected Attributes inherited from vspline::buffer_handling< _vtype, _math_ele_type, _vsize >
vigra::MultiArrayView< 1, vtypein_window
 
vigra::MultiArrayView< 1, vtypeout_window
 
- Static Protected Attributes inherited from vspline::buffer_handling< _vtype, _math_ele_type, _vsize >
static const std::ptrdiff_t bf_stride
 

Detailed Description

template<template< typename, size_t > class _vtype, typename _math_ele_type, size_t _vsize>
struct vspline::convolve< _vtype, _math_ele_type, _vsize >

class convolve provides the combination of class fir_filter above with a vector-friendly buffer. Calling code provides information about what should be buffered, the data are sucked into the buffer, filtered, and moved back from there. The operation is orchestrated by the code in filter.h, which is also used to 'wield' the b-spline prefilter. Both operations are sufficiently similar to share the wielding code.

Definition at line 384 of file convolve.h.

Member Typedef Documentation

◆ allocator_t

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
using vspline::convolve< _vtype, _math_ele_type, _vsize >::allocator_t = typename vspline::allocator_traits < vtype > :: type

Definition at line 403 of file convolve.h.

◆ arg_type

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
typedef fir_filter_specs vspline::convolve< _vtype, _math_ele_type, _vsize >::arg_type

Definition at line 426 of file convolve.h.

◆ buffer_handling_type

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
typedef buffer_handling< _vtype , _math_ele_type , _vsize > vspline::convolve< _vtype, _math_ele_type, _vsize >::buffer_handling_type

Definition at line 395 of file convolve.h.

◆ buffer_type

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
typedef vigra::MultiArray< 1 , vtype , allocator_t > vspline::convolve< _vtype, _math_ele_type, _vsize >::buffer_type

Definition at line 406 of file convolve.h.

◆ buffer_view_type

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
typedef vigra::MultiArrayView< 1 , vtype > vspline::convolve< _vtype, _math_ele_type, _vsize >::buffer_view_type

Definition at line 407 of file convolve.h.

◆ filter_type

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
typedef vspline::fir_filter< simdized_math_type > vspline::convolve< _vtype, _math_ele_type, _vsize >::filter_type

Definition at line 419 of file convolve.h.

◆ math_ele_type

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
typedef _math_ele_type vspline::convolve< _vtype, _math_ele_type, _vsize >::math_ele_type

Definition at line 390 of file convolve.h.

◆ simdized_math_type

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
typedef _vtype< _math_ele_type , _vsize > vspline::convolve< _vtype, _math_ele_type, _vsize >::simdized_math_type

Definition at line 418 of file convolve.h.

Constructor & Destructor Documentation

◆ convolve()

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
vspline::convolve< _vtype, _math_ele_type, _vsize >::convolve ( const fir_filter_specs specs,
size_t  size 
)
inline

Definition at line 433 of file convolve.h.

Member Function Documentation

◆ get_raw_filter()

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
template<typename in_type , typename out_type = in_type, typename math_type = out_type>
static vspline::fir_filter< in_type, out_type, math_type > vspline::convolve< _vtype, _math_ele_type, _vsize >::get_raw_filter ( const fir_filter_specs specs)
inlinestatic

Definition at line 461 of file convolve.h.

◆ operator()()

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
void vspline::convolve< _vtype, _math_ele_type, _vsize >::operator() ( )
inline

Definition at line 447 of file convolve.h.

◆ solve() [1/2]

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
void vspline::fir_filter< in_type, out_type, _math_type >::solve ( const in_buffer_type input,
out_buffer_type output 
)
inline

public 'solve' routine. This is for calls 'from outside', like when this object is used by itself, not as a base class of class convolve below. an extrapolator for the boundary condition code 'bc' (see fir_filter_specs) is made, then the call is delegated to the protected routine below which accepts an extrapolator on top of input and output.

Definition at line 200 of file convolve.h.

◆ solve() [2/2]

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
void vspline::fir_filter< in_type, out_type, _math_type >::solve ( const in_buffer_type input,
out_buffer_type output,
const extrapolator< in_buffer_type > &  source 
)
inline

protected solve routine taking an extrapolator on top of input and output. This way, the derived class (class convolve) can maintain an extrapolator fixed to it's buffer and reuse it for subsequent calls to this routine. we use the following strategy:

  • keep a small circular buffer as large as the kernel
  • have two kernels concatenated in another buffer
  • by pointing into the concatenated kernels, we can always have ksize kernel values in sequence so that this sequence is correct for the values in the circular buffer. this strategy avoids conditionals as best as possible and should be easy to optimize. the actual code is a bit more complex to account for the fact that at the beginning and end of the data, a few extrapolated values are used. The central loop can directly read from input without using the extrapolator, which is most efficient.

Definition at line 227 of file convolve.h.

Member Data Documentation

◆ buffer

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
buffer_type vspline::convolve< _vtype, _math_ele_type, _vsize >::buffer

Definition at line 409 of file convolve.h.

◆ buffer_extrapolator

template<template< typename, size_t > class _vtype, typename _math_ele_type , size_t _vsize>
extrapolator< buffer_view_type > vspline::convolve< _vtype, _math_ele_type, _vsize >::buffer_extrapolator

Definition at line 413 of file convolve.h.


The documentation for this struct was generated from the following file: