1 /* ----------------------------------------------------------------------
2  * Project:      CMSIS DSP Library
3  * Title:        arm_nuttall4_f32.c
4  * Description:  Floating-point (f32) Nuttall4 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   @ingroup groupWindow
34  */
35 
36 
37 
38 
39 /**
40   @addtogroup WindowNormal
41   @{
42  */
43 
44 /**
45   @defgroup WindowNUTTALL4 Nuttall4 window function (60.9 dB)
46 
47  */
48 
49 /**
50   @ingroup WindowNUTTALL4
51  */
52 
53 /**
54   @brief         Nuttall4 window generating function (f32).
55   @param[out]    pDst       points to the output generated window
56   @param[in]     blockSize  number of samples in the window
57 
58   @par Parameters of the window
59 
60   | Parameter                             | Value              |
61   | ------------------------------------: | -----------------: |
62   | Peak sidelobe level                   |           60.9 dB  |
63   | Normalized equivalent noise bandwidth |         2.31 bins  |
64   | 3 dB bandwidth                        |       2.1884 bins  |
65   | Flatness                              |        -0.6184 dB  |
66   | Recommended overlap                   |            70.5 %  |
67 
68  */
69 
70 
71 
arm_nuttall4_f32(float32_t * pDst,uint32_t blockSize)72 void arm_nuttall4_f32(
73         float32_t * pDst,
74         uint32_t blockSize)
75 {
76    float32_t k = 2.0f / ((float32_t) blockSize);
77    float32_t w;
78 
79    for(uint32_t i=0;i<blockSize;i++)
80    {
81      w = PI * i * k;
82      w =
83     0.3125f - 0.46875f * cosf (w) + 0.1875f * cosf (2.f * w) -
84     0.03125f * cosf (3.f * w);
85      pDst[i] = w;
86    }
87 }
88 
89 /**
90   @} end of WindowNormal group
91  */
92 
93