Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] Convolution: implement symmetric coefficients


  • To: VSIPL++ Developers List <vsipl++@xxxxxxxxxxxxxxxx>
  • Subject: [patch] Convolution: implement symmetric coefficients
  • From: Jules Bergmann <jules@xxxxxxxxxxxxxxxx>
  • Date: Tue, 04 Oct 2005 16:21:20 -0400

This patch extends convolution to work with symmetric kernels (sym_even_len_odd and sym_even_len_even). It extends tests to cover these new cases, and also to cover cases where decimation != 1.

This uncovered a couple of specification issues:

 - First, the VSIPL++ spec defines the convolution accessor
   'kernel_size()' to return the domain having the same length for
   each dimension as 'filter_coeffs'.  However, when constructing a
   convolution with a symmetric kernel, 'filter_coeffs' only contains
   a subset of coefficients.  In those cases, the true kernel size is
   either '2 * filter_coeffs.size()' or '2 * filter_coeff.size() + 1'
   (for 1D).

   In contrast, the C-VSIPL spec defines the kernel size as M, and
   specifies the size of 'filter_coeffs' as either M if symmetry =
   non_sym, or 'floor(M/2)' if 'symmetry == sym_even_len_{odd,even}'

   (Issue #91)

 - Second, the VSIPL++ and C-VSIPL specs define the output size
   of a minimal support output convolution such that values outside
   of the input may be required for some decimations != 1.  This
   contradicts the equation that defines the output values

   (Issue #90)

Fixing the first issue is straight-forward.  The second issue is more
tricky since the C-VSIPL specs looks to be "wrong" as well and
changing the output size would break existing C-VSIPL implementations.
I've added an ifdef (VSIP_IMPL_CONV_CORRECT_MIN_SUPPORT_SIZE) that
controls whether we follow the spec or not.  When following the spec,
we treat accesses outside the input range as 0.  (This is probably the
right way to "fix" the C-VSIPL spec: keep the length defined as is and
specifiy that zero values are used when trying to access outside the
input range, similar to support_same and support_full).

				-- Jules