1 /* ----------------------------------------------------------------------
2  * Project:      CMSIS DSP Library
3  * Title:        arm_hft90d_f64.c
4  * Description:  Floating-point (f64) Hft90d 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   @defgroup WindowFlat Flat-top window functions
41 
42   Use those windows when you need to estimate the
43   amplitude of a tone.
44 
45   If just just need to detect a tone or estimate the
46   noise, you can use the regular windows.
47 
48  */
49 
50 
51 /**
52   @addtogroup WindowFlat
53   @{
54  */
55 
56 
57 /**
58   @ingroup WindowHFT90D
59  */
60 
61 /**
62   @brief         Hft90d window generating function (f64).
63   @param[out]    pDst       points to the output generated window
64   @param[in]     blockSize  number of samples in the window
65 
66   @par Parameters of the window
67 
68   | Parameter                             | Value              |
69   | ------------------------------------: | -----------------: |
70   | Peak sidelobe level                   |           90.2 dB  |
71   | Normalized equivalent noise bandwidth |       3.8832 bins  |
72   | 3 dB bandwidth                        |       3.8320 bins  |
73   | Flatness                              |        -0.0039 dB  |
74   | Recommended overlap                   |            76.0 %  |
75 
76 Included in CMSIS-DSP with authorization from professor
77 Gerhard Heinzel.
78 
79 @par Original article:
80 Spectrum and spectral density estimation by the Discrete Fourier
81 transform (DFT), including a comprehensive list of window
82 functions and some new
83 flat-top windows.
84 
85 @par Authors:
86 G. Heinzel, A. Rudiger and R. Schilling,
87 Max-Planck-Institut fur Gravitationsphysik
88 (Albert-Einstein-Institut)
89 Teilinstitut Hannover
90  */
91 
92 
93 
arm_hft90d_f64(float64_t * pDst,uint32_t blockSize)94 ARM_DSP_ATTRIBUTE void arm_hft90d_f64(
95         float64_t * pDst,
96         uint32_t blockSize)
97 {
98    float64_t k = 2. / ((float64_t) blockSize);
99    float64_t w;
100 
101    for(uint32_t i=0;i<blockSize;i++)
102    {
103      w = PI_F64 * (i * k);
104      w =
105     1.0 -
106      1.942604 * cos (w) +
107      1.340318 * cos (2 * w) -
108      0.440811 * cos (3 * w) + 0.043097 * cos (4 * w);
109 
110      pDst[i] = w;
111    }
112 }
113 
114 /**
115   @} end of WindowFlat group
116  */
117 
118