Adelsbach/VSIPL
Core Programming Reference Guide
DD-00016-015
Core

This manual is preliminary and incomplete.
While our Core implementation implements all functions given in the standard we are still working on completing this documentation.

Please refer to the VSIPL standard for a complete function reference of the Core profile until we have completed work on this documentation.

5.3.4 vsip_vcreate_hanning_p - Create a Hanning Window Vector

vsip_vview_f* vsip_vcreate_hanning_f(vsip_length n, vsip_memory_hint hint);
Description

This function creates and initializes a vector with coefficients of a Hanning window (also known as Hann window) of length  n. The Hanning window is defined by:

        (      (2πk ))
w[k]= 0.5 1-cos  ---- ,  0≤ k< n
                n-1
Parameters
Return Value
Example

vsip_vview_f *hanning_win; 
vsip_length n = 64; 
 
// Create a Hanning window 
hanning_win = vsip_vcreate_hanning_f(n, VSIP_MEM_NONE); 
 
if (hanning_win == NULL) { 
    // Handle error 
} 
 
// Print first 5 coefficients 
printf("First 5 Hanning window coefficients:\n"); 
for (int i = 0; i < 5; i++) { 
    printf("%f\n", vsip_vget_f(hanning_win, 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 (e.g., a sine wave) 
// vsip_vramp_f(0.0f, 1.0f, signal); 
 
// Apply the window: windowed_signal = signal * hanning_win 
vsip_vmul_f(signal, hanning_win, windowed_signal); 
 
// Clean up 
vsip_valldestroy_f(hanning_win); 
vsip_valldestroy_f(signal); 
vsip_valldestroy_f(windowed_signal);
Notes