arm_hft169d_f32.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: arm_hft169d_f32.c
  4. * Description: Floating-point (f32) Hft169d 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. @addtogroup WindowFlat
  36. @{
  37. */
  38. /**
  39. @defgroup WindowHFT169D Hft169d window function (169.5 dB)
  40. */
  41. /**
  42. @ingroup WindowHFT169D
  43. */
  44. /**
  45. @brief Hft169d window generating function (f32).
  46. @param[out] pDst points to the output generated window
  47. @param[in] blockSize number of samples in the window
  48. @par Parameters of the window
  49. | Parameter | Value |
  50. | ------------------------------------: | -----------------: |
  51. | Peak sidelobe level | 169.5 dB |
  52. | Normalized equivalent noise bandwidth | 4.8347 bins |
  53. | 3 dB bandwidth | 4.7588 bins |
  54. | Flatness | 0.0017 dB |
  55. | Recommended overlap | 81.2 % |
  56. Included in CMSIS-DSP with authorization from professor
  57. Gerhard Heinzel.
  58. @par Original article:
  59. Spectrum and spectral density estimation by the Discrete Fourier
  60. transform (DFT), including a comprehensive list of window
  61. functions and some new
  62. flat-top windows.
  63. @par Authors:
  64. G. Heinzel, A. Rudiger and R. Schilling,
  65. Max-Planck-Institut fur Gravitationsphysik
  66. (Albert-Einstein-Institut)
  67. Teilinstitut Hannover
  68. */
  69. void arm_hft169d_f32(
  70. float32_t * pDst,
  71. uint32_t blockSize)
  72. {
  73. float32_t k = 2.0f / ((float32_t) blockSize);
  74. float32_t w;
  75. for(uint32_t i=0;i<blockSize;i++)
  76. {
  77. w = PI * (i * k);
  78. w =
  79. (1.0f -
  80. 1.97441843f * cosf (w) +
  81. 1.65409889f * cosf (2.f * w) -
  82. 0.95788187f * cosf (3.f * w) +
  83. 0.33673420f * cosf (4.f * w) -
  84. 0.06364622f * cosf (5.f * w) +
  85. 0.00521942f * cosf (6.f * w) - 0.00010599f * cosf (7.f * w));
  86. pDst[i] = w;
  87. }
  88. }
  89. /**
  90. @} end of WindowFlat group
  91. */