arm_nuttall4a_f32.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: arm_nuttall4a_f32.c
  4. * Description: Floating-point (f32) Nuttall4a 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 WindowNormal
  36. @{
  37. */
  38. /**
  39. @defgroup WindowNUTTALL4A Nuttall4a window function (82.6 dB)
  40. */
  41. /**
  42. @ingroup WindowNUTTALL4A
  43. */
  44. /**
  45. @brief Nuttall4a 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 | 82.6 dB |
  52. | Normalized equivalent noise bandwidth | 2.1253 bins |
  53. | 3 dB bandwidth | 2.0123 bins |
  54. | Flatness | -0.7321 dB |
  55. | Recommended overlap | 68.0 % |
  56. */
  57. void arm_nuttall4a_f32(
  58. float32_t * pDst,
  59. uint32_t blockSize)
  60. {
  61. float32_t k = 2.0f / ((float32_t) blockSize);
  62. float32_t w;
  63. for(uint32_t i=0;i<blockSize;i++)
  64. {
  65. w = PI * i * k;
  66. w = 0.338946f - 0.481973f * cosf (w) +
  67. 0.161054f * cosf (2.f * w) - 0.018027f * cosf (3.f * w);
  68. pDst[i] = w;
  69. }
  70. }
  71. /**
  72. @} end of WindowNormal group
  73. */