1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
template <template <typename, typename> class ConstViewT,
symmetry_type Symm,
support_region_type Supp,
typename T = VSIP_DEFAULT_VALUE_TYPE,
unsigned N_times = 0,
alg_hint_type A_hint = alg_time>
class Convolution
: public impl::profile::Accumulator<impl::profile::signal>,
#if VSIP_IMPL_REF_IMPL
public impl::cvsip::Convolution<impl::Dim_of_view<ConstViewT>::dim,
Symm, Supp, float, N_times, A_hint>
#else
public impl::dispatcher::Dispatcher<
impl::dispatcher::Conv_tag<impl::Dim_of_view<ConstViewT>::dim,
Symm,
Supp,
T,
N_times,
A_hint> >::backend_type
#endif
{
// Implementation compile-time constants.
private:
static dimension_type const dim = impl::Dim_of_view<ConstViewT>::dim;
typedef impl::profile::Accumulator<impl::profile::signal> accumulator_type;
#if VSIP_IMPL_REF_IMPL
typedef impl::cvsip::Convolution<impl::Dim_of_view<ConstViewT>::dim,
Symm, Supp, float, N_times, A_hint> base_type;
#else
typedef typename impl::dispatcher::Dispatcher<
impl::dispatcher::Conv_tag<dim,
Symm,
Supp,
T,
N_times,
A_hint> >::backend_type base_type;
#endif
public:
template <typename Block>
Convolution(ConstViewT<T, Block> filter_coeffs,
Domain<dim> const& input_size,
length_type decimation = 1)
VSIP_THROW((std::bad_alloc))
: accumulator_type(impl::signal_detail::Description<dim, T>::tag
("Convolution",
impl::extent(impl::conv_output_size
(Supp, view_domain(filter_coeffs),
input_size, decimation)),
impl::extent(filter_coeffs)),
impl::signal_detail::Op_count_conv<dim, T>::value
(impl::extent(impl::conv_output_size
(Supp, view_domain(filter_coeffs),
input_size, decimation)),
impl::extent(filter_coeffs))),
base_type(filter_coeffs, input_size, decimation)
{
assert(decimation >= 1);
assert(Symm == nonsym ? (filter_coeffs.size() <= input_size.size())
: (filter_coeffs.size() <= 2*input_size.size()));
}
|