arm_hft116d_f32.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: arm_hft116d_f32.c
  4. * Description: Floating-point (f32) Hft116d 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 WindowHFT116D Hft116d window function (116.8 dB)
  40. */
  41. /**
  42. @ingroup WindowHFT116D
  43. */
  44. /**
  45. @brief Hft116d 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 | 116.8 dB |
  52. | Normalized equivalent noise bandwidth | 4.2186 bins |
  53. | 3 dB bandwidth | 4.1579 bins |
  54. | Flatness | -0.0028 dB |
  55. | Recommended overlap | 78.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_hft116d_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.9575375f * cosf (w) +
  81. 1.4780705f * cosf (2.f * w) -
  82. 0.6367431f * cosf (3.f * w) +
  83. 0.1228389f * cosf (4.f * w) - 0.0066288f * cosf (5.f * w));
  84. pDst[i] = w;
  85. }
  86. }
  87. /**
  88. @} end of WindowFlat group
  89. */