arm_welch_f64.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: arm_welch_f64.c
  4. * Description: Floating-point (f64) Welch 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. /**
  30. @ingroup groupWindow
  31. */
  32. /**
  33. @defgroup WindowNormal Regular window functions
  34. Regular window functions that can be used for
  35. detecting tones or estimating the noise.
  36. If you need to estimate the amplitude of a tones,
  37. prefer a flat top window.
  38. */
  39. /**
  40. @addtogroup WindowNormal
  41. @{
  42. */
  43. /**
  44. @ingroup WindowWELCH
  45. */
  46. /**
  47. @brief Welch window generating function (f64).
  48. @param[out] pDst points to the output generated window
  49. @param[in] blockSize number of samples in the window
  50. @par Parameters of the window
  51. | Parameter | Value |
  52. | ------------------------------------: | -----------------: |
  53. | Peak sidelobe level | 21.3 dB |
  54. | Normalized equivalent noise bandwidth | 1.2 bins |
  55. | 3 dB bandwidth | 1.1535 bins |
  56. | Flatness | -2.2248 dB |
  57. | Recommended overlap | 29.3 % |
  58. */
  59. void arm_welch_f64(
  60. float64_t * pDst,
  61. uint32_t blockSize)
  62. {
  63. float64_t k = 2.0 / ((float64_t) blockSize);
  64. float64_t w;
  65. for(uint32_t i=0;i<blockSize;i++)
  66. {
  67. w = i * k - 1.0;
  68. w = 1.0 - w * w;
  69. pDst[i] = w;
  70. }
  71. }
  72. /**
  73. @} end of WindowNormal group
  74. */