vsip_vview_f* vsip_vcreate_blackman_f(vsip_length n, vsip_memory_hint hint);
This function creates and initializes a vector with coefficients of a Blackman window of length
. The Blackman window is
defined by the formula:
![( ) ( )
w[k]=0.42-0.5cos 2πk- +0.08cos 4πk- , 0 ≤k <n
n-1 n-1](VSIPLCoreRef_PG188x.png)
vsip_length n: The length of the window (number of elements in the vector).
vsip_memory_hint hint: Memory allocation hint that can be used to optimize memory access:
VSIP_MEM_NONE - No memory hint
VSIP_MEM_RDONLY - The memory is to be used read-only
VSIP_MEM_CONST - The memory will hold constants
VSIP_MEM_SHARED - The memory will be shared
VSIP_MEM_SHARED_RDONLY - The memory will be shared and is read-only
VSIP_MEM_SHARED_CONST - The memory will be shared and will hold constants
On success, returns a pointer to the newly created and initialized vector containing the Blackman window coefficients.
On error (e.g., if memory allocation fails), returns NULL.
vsip_vview_f *blackman_window; vsip_length i, n = 64; // Create a Blackman window of length 64 blackman_window = vsip_vcreate_blackman_f(n, VSIP_MEM_NONE); if (blackman_window == NULL) { // Handle error } // Print the first 10 coefficients printf("First 10 Blackman window coefficients:\n"); for (i = 0; i < 10; i++) { printf("%2ld: %f\n", i, vsip_vget_f(blackman_window, i)); } // Use the window in a signal processing application // For example, apply it to a signal vector vsip_vview_f *signal = vsip_vcreate_f(n, VSIP_MEM_NONE); vsip_vview_f *windowed_signal = vsip_vcreate_f(n, VSIP_MEM_NONE); // Initialize signal with some values... // vsip_vfill_f(signal, 1.0f); // Example: constant signal // Apply the window: windowed_signal = signal * blackman_window vsip_vmul_f(signal, blackman_window, windowed_signal); // Clean up vsip_valldestroy_f(blackman_window); vsip_valldestroy_f(signal); vsip_valldestroy_f(windowed_signal);
The window is symmetric for even-length vectors and nearly symmetric for odd-length vectors.