arm_hft90d_f64.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. #include "dsp/window_functions.h"
  29. #include "dsp/fast_math_functions.h"
  30. #include <math.h>
  31. /**
  32. @ingroup groupWindow
  33. */
  34. /**
  35. @defgroup WindowFlat Flat-top window functions
  36. Use those windows when you need to estimate the
  37. amplitude of a tone.
  38. If just just need to detect a tone or estimate the
  39. noise, you can use the regular windows.
  40. */
  41. /**
  42. @addtogroup WindowFlat
  43. @{
  44. */
  45. /**
  46. @ingroup WindowHFT90D
  47. */
  48. /**
  49. @brief Hft90d window generating function (f64).
  50. @param[out] pDst points to the output generated window
  51. @param[in] blockSize number of samples in the window
  52. @par Parameters of the window
  53. | Parameter | Value |
  54. | ------------------------------------: | -----------------: |
  55. | Peak sidelobe level | 90.2 dB |
  56. | Normalized equivalent noise bandwidth | 3.8832 bins |
  57. | 3 dB bandwidth | 3.8320 bins |
  58. | Flatness | -0.0039 dB |
  59. | Recommended overlap | 76.0 % |
  60. Included in CMSIS-DSP with authorization from professor
  61. Gerhard Heinzel.
  62. @par Original article:
  63. Spectrum and spectral density estimation by the Discrete Fourier
  64. transform (DFT), including a comprehensive list of window
  65. functions and some new
  66. flat-top windows.
  67. @par Authors:
  68. G. Heinzel, A. Rudiger and R. Schilling,
  69. Max-Planck-Institut fur Gravitationsphysik
  70. (Albert-Einstein-Institut)
  71. Teilinstitut Hannover
  72. */
  73. void arm_hft90d_f64(
  74. float64_t * pDst,
  75. uint32_t blockSize)
  76. {
  77. float64_t k = 2. / ((float64_t) blockSize);
  78. float64_t w;
  79. for(uint32_t i=0;i<blockSize;i++)
  80. {
  81. w = PI_F64 * (i * k);
  82. w =
  83. 1.0 -
  84. 1.942604 * cos (w) +
  85. 1.340318 * cos (2 * w) -
  86. 0.440811 * cos (3 * w) + 0.043097 * cos (4 * w);
  87. pDst[i] = w;
  88. }
  89. }
  90. /**
  91. @} end of WindowFlat group
  92. */