typedef enum _vsip_support_region { VSIP_SUPPORT_FULL = 0, VSIP_SUPPORT_SAME = 1, VSIP_SUPPORT_MIN = 2, } vsip_support_region; typedef enum _vsip_alg_hint { VSIP_ALG_TIME = 0, VSIP_ALG_SPACE = 1, VSIP_ALG_NOISE = 2 } vsip_alg_hint; vsip_corr1d_f* vsip_corr1d_create_f(vsip_length m, vsip_length n, vsip_support_region support, vsip_length ntimes, vsip_alg_hint hint); vsip_ccorr1d_f* vsip_ccorr1d_create_f(vsip_length m, vsip_length n, vsip_support_region support, vsip_length ntimes, vsip_alg_hint hint);
This function creates a one-dimensional correlation object that can be used to compute the correlation between an input signal and a reference signal.
The correlation object is optimized for repeated use, allowing efficient computation of correlations between signals of length
and reference signals of length
.
vsip_length m: Length of the input signal.
vsip_length n: Length of the reference signal.
vsip_support_region support: Specifies the support region for the correlation:
VSIP_SUPPORT_FULL: Compute full correlation. Output length is
.
VSIP_SUPPORT_SAME: Compute correlation with same-length output
.
VSIP_SUPPORT_MIN: Compute minimum-length correlation. Output length is
.
vsip_length ntimes: Number of times the correlation 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 correlation object.
On error (e.g., memory allocation failure): NULL.
vsip_corr1d_f *corr; vsip_length m = 1024; // Input signal length vsip_length n = 64; // Reference signal length vsip_length ntimes = 100; // Number of times to reuse object // Create correlation object for full correlation corr = vsip_corr1d_create_f(m, n, VSIP_SUPPORT_FULL, ntimes, VSIP_ALG_TIME); if (corr == NULL) { fprintf(stderr, "Error: Could not create correlation object\n"); return -1; } // Use the correlation object for your signal processing // vsip_vview_f *input = vsip_vcreate_f(m, VSIP_MEM_NONE); // vsip_vview_f *reference = vsip_vcreate_f(n, VSIP_MEM_NONE); // vsip_vview_f *result = vsip_vcreate_f(m + n - 1, VSIP_MEM_NONE); // // vsip_corr1d_f(corr, input, reference, result); // Clean up when done vsip_corr1d_destroy_f(corr);
The correlation object should be destroyed with vsip_dcorr1d_destroy_p when no longer needed.
The choice of support affects the length of the output correlation vector:
VSIP_SUPPORT_FULL: Output length is
VSIP_SUPPORT_SAME: Output length is
VSIP_SUPPORT_MIN: Output length is 
The ntimes parameter helps the library optimize memory allocation for repeated use.