/ Drivers / CMSIS / DSP / Include / dsp / transform_functions_f16.h
transform_functions_f16.h
  1  /******************************************************************************
  2   * @file     transform_functions_f16.h
  3   * @brief    Public header file for CMSIS DSP Library
  4   * @version  V1.9.0
  5   * @date     23 April 2021
  6   * Target Processor: Cortex-M and Cortex-A cores
  7   ******************************************************************************/
  8  /*
  9   * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved.
 10   *
 11   * SPDX-License-Identifier: Apache-2.0
 12   *
 13   * Licensed under the Apache License, Version 2.0 (the License); you may
 14   * not use this file except in compliance with the License.
 15   * You may obtain a copy of the License at
 16   *
 17   * www.apache.org/licenses/LICENSE-2.0
 18   *
 19   * Unless required by applicable law or agreed to in writing, software
 20   * distributed under the License is distributed on an AS IS BASIS, WITHOUT
 21   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 22   * See the License for the specific language governing permissions and
 23   * limitations under the License.
 24   */
 25  
 26   
 27  #ifndef _TRANSFORM_FUNCTIONS_F16_H_
 28  #define _TRANSFORM_FUNCTIONS_F16_H_
 29  
 30  #include "arm_math_types_f16.h"
 31  #include "arm_math_memory.h"
 32  
 33  #include "dsp/none.h"
 34  #include "dsp/utils.h"
 35  
 36  #ifdef   __cplusplus
 37  extern "C"
 38  {
 39  #endif
 40  
 41  
 42  
 43  #if defined(ARM_FLOAT16_SUPPORTED)
 44  
 45  
 46    /**
 47     * @brief Instance structure for the floating-point CFFT/CIFFT function.
 48     */
 49    typedef struct
 50    {
 51            uint16_t fftLen;                   /**< length of the FFT. */
 52            uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
 53            uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
 54      const float16_t *pTwiddle;               /**< points to the Twiddle factor table. */
 55      const uint16_t *pBitRevTable;            /**< points to the bit reversal table. */
 56            uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
 57            uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
 58            float16_t onebyfftLen;             /**< value of 1/fftLen. */
 59    } arm_cfft_radix2_instance_f16;
 60  
 61    /**
 62     * @brief Instance structure for the floating-point CFFT/CIFFT function.
 63     */
 64    typedef struct
 65    {
 66            uint16_t fftLen;                   /**< length of the FFT. */
 67            uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
 68            uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
 69      const float16_t *pTwiddle;               /**< points to the Twiddle factor table. */
 70      const uint16_t *pBitRevTable;            /**< points to the bit reversal table. */
 71            uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
 72            uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
 73            float16_t onebyfftLen;             /**< value of 1/fftLen. */
 74    } arm_cfft_radix4_instance_f16;
 75  
 76    /**
 77     * @brief Instance structure for the floating-point CFFT/CIFFT function.
 78     */
 79    typedef struct
 80    {
 81            uint16_t fftLen;                   /**< length of the FFT. */
 82      const float16_t *pTwiddle;         /**< points to the Twiddle factor table. */
 83      const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */
 84            uint16_t bitRevLength;             /**< bit reversal table length. */
 85  #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
 86     const uint32_t *rearranged_twiddle_tab_stride1_arr;        /**< Per stage reordered twiddle pointer (offset 1) */                                                       \
 87     const uint32_t *rearranged_twiddle_tab_stride2_arr;        /**< Per stage reordered twiddle pointer (offset 2) */                                                       \
 88     const uint32_t *rearranged_twiddle_tab_stride3_arr;        /**< Per stage reordered twiddle pointer (offset 3) */                                                       \
 89     const float16_t *rearranged_twiddle_stride1; /**< reordered twiddle offset 1 storage */                                                                   \
 90     const float16_t *rearranged_twiddle_stride2; /**< reordered twiddle offset 2 storage */                                                                   \
 91     const float16_t *rearranged_twiddle_stride3;
 92  #endif
 93    } arm_cfft_instance_f16;
 94  
 95  
 96    arm_status arm_cfft_init_f16(
 97    arm_cfft_instance_f16 * S,
 98    uint16_t fftLen);
 99  
100    void arm_cfft_f16(
101    const arm_cfft_instance_f16 * S,
102          float16_t * p1,
103          uint8_t ifftFlag,
104          uint8_t bitReverseFlag);
105  
106    /**
107     * @brief Instance structure for the floating-point RFFT/RIFFT function.
108     */
109  typedef struct
110    {
111            arm_cfft_instance_f16 Sint;      /**< Internal CFFT structure. */
112            uint16_t fftLenRFFT;             /**< length of the real sequence */
113      const float16_t * pTwiddleRFFT;        /**< Twiddle factors real stage  */
114    } arm_rfft_fast_instance_f16 ;
115  
116  arm_status arm_rfft_fast_init_f16 (
117           arm_rfft_fast_instance_f16 * S,
118           uint16_t fftLen);
119  
120  
121    void arm_rfft_fast_f16(
122          const arm_rfft_fast_instance_f16 * S,
123          float16_t * p, float16_t * pOut,
124          uint8_t ifftFlag);
125  
126  /* Deprecated */
127    arm_status arm_cfft_radix4_init_f16(
128          arm_cfft_radix4_instance_f16 * S,
129          uint16_t fftLen,
130          uint8_t ifftFlag,
131          uint8_t bitReverseFlag);
132  
133  /* Deprecated */
134    void arm_cfft_radix4_f16(
135    const arm_cfft_radix4_instance_f16 * S,
136          float16_t * pSrc);
137  
138  
139  /* Deprecated */
140    arm_status arm_cfft_radix2_init_f16(
141          arm_cfft_radix2_instance_f16 * S,
142          uint16_t fftLen,
143          uint8_t ifftFlag,
144          uint8_t bitReverseFlag);
145  
146  /* Deprecated */
147    void arm_cfft_radix2_f16(
148    const arm_cfft_radix2_instance_f16 * S,
149          float16_t * pSrc);
150    
151  #endif /* defined(ARM_FLOAT16_SUPPORTED)*/
152  
153  #ifdef   __cplusplus
154  }
155  #endif
156  
157  #endif /* ifndef _TRANSFORM_FUNCTIONS_F16_H_ */