1 /* ----------------------------------------------------------------------
2  * Project:      CMSIS DSP Library
3  * Title:        arm_nuttall4a_f32.c
4  * Description:  Floating-point (f32) Nuttall4a window
5  *
6  * $Date:        14 December 2022
7  * $Revision:    v1.15.0
8  *
9  * Target Processor: Cortex-M and Cortex-A cores
10  * -------------------------------------------------------------------- */
11 /*
12  * Copyright (C) 2010-2022 ARM Limited or its affiliates. All rights reserved.
13  *
14  * SPDX-License-Identifier: Apache-2.0
15  *
16  * Licensed under the Apache License, Version 2.0 (the License); you may
17  * not use this file except in compliance with the License.
18  * You may obtain a copy of the License at
19  *
20  * www.apache.org/licenses/LICENSE-2.0
21  *
22  * Unless required by applicable law or agreed to in writing, software
23  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
24  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25  * See the License for the specific language governing permissions and
26  * limitations under the License.
27  */
28 
29 #include "dsp/window_functions.h"
30 #include "dsp/fast_math_functions.h"
31 #include <math.h>
32 
33 /**
34   @ingroup groupWindow
35  */
36 
37 
38 
39 
40 /**
41   @addtogroup WindowNormal
42   @{
43  */
44 
45 /**
46   @defgroup WindowNUTTALL4A Nuttall4a window function (82.6 dB)
47 
48  */
49 
50 /**
51   @ingroup WindowNUTTALL4A
52  */
53 
54 /**
55   @brief         Nuttall4a window generating function (f32).
56   @param[out]    pDst       points to the output generated window
57   @param[in]     blockSize  number of samples in the window
58 
59   @par Parameters of the window
60 
61   | Parameter                             | Value              |
62   | ------------------------------------: | -----------------: |
63   | Peak sidelobe level                   |           82.6 dB  |
64   | Normalized equivalent noise bandwidth |       2.1253 bins  |
65   | 3 dB bandwidth                        |       2.0123 bins  |
66   | Flatness                              |        -0.7321 dB  |
67   | Recommended overlap                   |            68.0 %  |
68 
69  */
70 
71 
72 
arm_nuttall4a_f32(float32_t * pDst,uint32_t blockSize)73 void arm_nuttall4a_f32(
74         float32_t * pDst,
75         uint32_t blockSize)
76 {
77    float32_t k = 2.0f / ((float32_t) blockSize);
78    float32_t w;
79 
80    for(uint32_t i=0;i<blockSize;i++)
81    {
82      w = PI * i * k;
83      w = 0.338946f - 0.481973f * cosf (w) +
84     0.161054f * cosf (2.f * w) - 0.018027f * cosf (3.f * w);
85 
86      pDst[i] = w;
87    }
88 }
89 
90 /**
91   @} end of WindowNormal group
92  */
93 
94