typedef enum _vsip_alg_hint { VSIP_ALG_TIME = 0, VSIP_ALG_SPACE = 1, VSIP_ALG_NOISE = 2 } vsip_alg_hint; typedef enum _vsip_support_region { VSIP_SUPPORT_FULL = 0, VSIP_SUPPORT_SAME = 1, VSIP_SUPPORT_MIN = 2, } vsip_support_region; typedef enum _vsip_symmetry { VSIP_NONSYM = 0, VSIP_SYM_EVEN_LEN_ODD = 1, VSIP_SYM_EVEN_LEN_EVEN = 2 } vsip_symmetry; vsip_conv1d_f* vsip_conv1d_create_f(const vsip_vview_f *h, vsip_symmetry symm, vsip_length n, vsip_length d, vsip_support_region support, vsip_length ntimes, vsip_alg_hint hint);
This function creates a one-dimensional convolution object. The convolution object can handle various types of impulse responses and supports different output regions and decimation factors.
const vsip_dvview_p* h: Vector containing the impulse response (filter coefficients).
vsip_symmetry symm: Symmetry of the impulse response:
VSIP_SYM_EVEN_LEN_ODD: Even symmetry, odd length
VSIP_SYM_ODD_LEN_EVEN: Odd symmetry, even length
VSIP_NOSYM: No symmetry
vsip_length n: Length of the input signal.
vsip_length d: Decimation factor (1 for no decimation).
vsip_support_region support: Support region for the convolution:
VSIP_SUPPORT_FULL: Full convolution. Output length is
VSIP_SUPPORT_SAME: Same-length output. Output length is
VSIP_SUPPORT_MIN: Minimum-length output. Output length is 
vsip_length ntimes: Number of times the convolution will be applied.
vsip_alg_hint hint: Algorithm hint for optimization:
VSIP_ALG_TIME: Optimize for computation time
VSIP_ALG_SPACE: Optimize for memory usage
VSIP_ALG_NOHINT: No specific optimization
On success: Pointer to the newly created 1D convolution object.
On error (e.g., memory allocation failure): NULL.
vsip_conv1d_f *conv; vsip_vview_f *h; vsip_length h_len = 31; // Impulse response length vsip_length n = 1024; // Input signal length vsip_length d = 1; // No decimation // Create impulse response vector h = vsip_vcreate_f(h_len, VSIP_MEM_NONE); // Initialize impulse response (e.g., Gaussian kernel) // vsip_vramp_f(0.0f, 1.0f, h); // Apply window function or other modifications to h... // Create convolution object for full convolution conv = vsip_conv1d_create_f(h, VSIP_SYM_NONE, n, d, VSIP_SUPPORT_FULL, 100, VSIP_ALG_TIME); if (conv == NULL) { fprintf(stderr, "Error: Could not create convolution object\n"); return; } // Use the convolution object for your signal processing // vsip_vview_f *input = vsip_vcreate_f(n, VSIP_MEM_NONE); // vsip_vview_f *output = vsip_vcreate_f(n + h_len - 1, VSIP_MEM_NONE); // vsip_conv1d_f(conv, input, output); // Clean up when done vsip_conv1d_destroy_f(conv); vsip_vdestroy_f(h);
The convolution object should be destroyed with vsip_dconv1d_destroy_p when no longer needed.
The decimation factor
allows for downsampling the output.