Chetan Sharma / Mbed OS HKCC_Controller_MBed_OS

Dependencies:   FastPWM3

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_math.h Source File

arm_math.h

00001 /******************************************************************************
00002  * @file     arm_math.h
00003  * @brief    Public header file for CMSIS DSP Library
00004  * @version  V1.7.0
00005  * @date     18. March 2019
00006  ******************************************************************************/
00007 /*
00008  * Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved.
00009  *
00010  * SPDX-License-Identifier: Apache-2.0
00011  *
00012  * Licensed under the Apache License, Version 2.0 (the License); you may
00013  * not use this file except in compliance with the License.
00014  * You may obtain a copy of the License at
00015  *
00016  * www.apache.org/licenses/LICENSE-2.0
00017  *
00018  * Unless required by applicable law or agreed to in writing, software
00019  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00020  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00021  * See the License for the specific language governing permissions and
00022  * limitations under the License.
00023  */
00024 
00025 /**
00026    \mainpage CMSIS DSP Software Library
00027    *
00028    * Introduction
00029    * ------------
00030    *
00031    * This user manual describes the CMSIS DSP software library,
00032    * a suite of common signal processing functions for use on Cortex-M and Cortex-A processor 
00033    * based devices.
00034    *
00035    * The library is divided into a number of functions each covering a specific category:
00036    * - Basic math functions
00037    * - Fast math functions
00038    * - Complex math functions
00039    * - Filtering functions
00040    * - Matrix functions
00041    * - Transform functions
00042    * - Motor control functions
00043    * - Statistical functions
00044    * - Support functions
00045    * - Interpolation functions
00046    * - Support Vector Machine functions (SVM)
00047    * - Bayes classifier functions
00048    * - Distance functions
00049    *
00050    * The library has generally separate functions for operating on 8-bit integers, 16-bit integers,
00051    * 32-bit integer and 32-bit floating-point values.
00052    *
00053    * Using the Library
00054    * ------------
00055    *
00056    * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
00057    *
00058    * Here is the list of pre-built libraries :
00059    * - arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit)
00060    * - arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit)
00061    * - arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit)
00062    * - arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on)
00063    * - arm_cortexM7l_math.lib (Cortex-M7, Little endian)
00064    * - arm_cortexM7b_math.lib (Cortex-M7, Big endian)
00065    * - arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit)
00066    * - arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit)
00067    * - arm_cortexM4l_math.lib (Cortex-M4, Little endian)
00068    * - arm_cortexM4b_math.lib (Cortex-M4, Big endian)
00069    * - arm_cortexM3l_math.lib (Cortex-M3, Little endian)
00070    * - arm_cortexM3b_math.lib (Cortex-M3, Big endian)
00071    * - arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian)
00072    * - arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian)
00073    * - arm_ARMv8MBLl_math.lib (Armv8-M Baseline, Little endian)
00074    * - arm_ARMv8MMLl_math.lib (Armv8-M Mainline, Little endian)
00075    * - arm_ARMv8MMLlfsp_math.lib (Armv8-M Mainline, Little endian, Single Precision Floating Point Unit)
00076    * - arm_ARMv8MMLld_math.lib (Armv8-M Mainline, Little endian, DSP instructions)
00077    * - arm_ARMv8MMLldfsp_math.lib (Armv8-M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit)
00078    *
00079    * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
00080    * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
00081    * public header file <code> arm_math.h</code> for Cortex-M cores with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
00082    *
00083    *
00084    * Examples
00085    * --------
00086    *
00087    * The library ships with a number of examples which demonstrate how to use the library functions.
00088    *
00089    * Toolchain Support
00090    * ------------
00091    *
00092    * The library is now tested on Fast Models building with cmake.
00093    * Core M0, M7, A5 are tested.
00094    * 
00095    * 
00096    *
00097    * Building the Library
00098    * ------------
00099    *
00100    * The library installer contains a project file to rebuild libraries on MDK toolchain in the <code>CMSIS\\DSP\\Projects\\ARM</code> folder.
00101    * - arm_cortexM_math.uvprojx
00102    *
00103    *
00104    * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional preprocessor macros detailed above.
00105    *
00106    * There is also a work in progress cmake build. The README file is giving more details.
00107    *
00108    * Preprocessor Macros
00109    * ------------
00110    *
00111    * Each library project have different preprocessor macros.
00112    *
00113    * - ARM_MATH_BIG_ENDIAN:
00114    *
00115    * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
00116    *
00117    * - ARM_MATH_MATRIX_CHECK:
00118    *
00119    * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
00120    *
00121    * - ARM_MATH_ROUNDING:
00122    *
00123    * Define macro ARM_MATH_ROUNDING for rounding on support functions
00124    *
00125    * - ARM_MATH_LOOPUNROLL:
00126    *
00127    * Define macro ARM_MATH_LOOPUNROLL to enable manual loop unrolling in DSP functions
00128    *
00129    * - ARM_MATH_NEON:
00130    *
00131    * Define macro ARM_MATH_NEON to enable Neon versions of the DSP functions.
00132    * It is not enabled by default when Neon is available because performances are 
00133    * dependent on the compiler and target architecture.
00134    *
00135    * - ARM_MATH_NEON_EXPERIMENTAL:
00136    *
00137    * Define macro ARM_MATH_NEON_EXPERIMENTAL to enable experimental Neon versions of 
00138    * of some DSP functions. Experimental Neon versions currently do not have better
00139    * performances than the scalar versions.
00140    *
00141    * - ARM_MATH_HELIUM:
00142    *
00143    * It implies the flags ARM_MATH_MVEF and ARM_MATH_MVEI and ARM_MATH_FLOAT16.
00144    *
00145    * - ARM_MATH_MVEF:
00146    *
00147    * Select Helium versions of the f32 algorithms.
00148    * It implies ARM_MATH_FLOAT16 and ARM_MATH_MVEI.
00149    *
00150    * - ARM_MATH_MVEI:
00151    *
00152    * Select Helium versions of the int and fixed point algorithms.
00153    *
00154    * - ARM_MATH_FLOAT16:
00155    *
00156    * Float16 implementations of some algorithms (Requires MVE extension).
00157    *
00158    * <hr>
00159    * CMSIS-DSP in ARM::CMSIS Pack
00160    * -----------------------------
00161    *
00162    * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
00163    * |File/Folder                      |Content                                                                 |
00164    * |---------------------------------|------------------------------------------------------------------------|
00165    * |\b CMSIS\\Documentation\\DSP     | This documentation                                                     |
00166    * |\b CMSIS\\DSP\\DSP_Lib_TestSuite | DSP_Lib test suite                                                     |
00167    * |\b CMSIS\\DSP\\Examples          | Example projects demonstrating the usage of the library functions      |
00168    * |\b CMSIS\\DSP\\Include           | DSP_Lib include files                                                  |
00169    * |\b CMSIS\\DSP\\Lib               | DSP_Lib binaries                                                       |
00170    * |\b CMSIS\\DSP\\Projects          | Projects to rebuild DSP_Lib binaries                                   |
00171    * |\b CMSIS\\DSP\\Source            | DSP_Lib source files                                                   |
00172    *
00173    * <hr>
00174    * Revision History of CMSIS-DSP
00175    * ------------
00176    * Please refer to \ref ChangeLog_pg.
00177    */
00178 
00179 
00180 /**
00181  * @defgroup groupMath Basic Math Functions
00182  */
00183 
00184 /**
00185  * @defgroup groupFastMath Fast Math Functions
00186  * This set of functions provides a fast approximation to sine, cosine, and square root.
00187  * As compared to most of the other functions in the CMSIS math library, the fast math functions
00188  * operate on individual values and not arrays.
00189  * There are separate functions for Q15, Q31, and floating-point data.
00190  *
00191  */
00192 
00193 /**
00194  * @defgroup groupCmplxMath Complex Math Functions
00195  * This set of functions operates on complex data vectors.
00196  * The data in the complex arrays is stored in an interleaved fashion
00197  * (real, imag, real, imag, ...).
00198  * In the API functions, the number of samples in a complex array refers
00199  * to the number of complex values; the array contains twice this number of
00200  * real values.
00201  */
00202 
00203 /**
00204  * @defgroup groupFilters Filtering Functions
00205  */
00206 
00207 /**
00208  * @defgroup groupMatrix Matrix Functions
00209  *
00210  * This set of functions provides basic matrix math operations.
00211  * The functions operate on matrix data structures.  For example,
00212  * the type
00213  * definition for the floating-point matrix structure is shown
00214  * below:
00215  * <pre>
00216  *     typedef struct
00217  *     {
00218  *       uint16_t numRows;     // number of rows of the matrix.
00219  *       uint16_t numCols;     // number of columns of the matrix.
00220  *       float32_t *pData;     // points to the data of the matrix.
00221  *     } arm_matrix_instance_f32;
00222  * </pre>
00223  * There are similar definitions for Q15 and Q31 data types.
00224  *
00225  * The structure specifies the size of the matrix and then points to
00226  * an array of data.  The array is of size <code>numRows X numCols</code>
00227  * and the values are arranged in row order.  That is, the
00228  * matrix element (i, j) is stored at:
00229  * <pre>
00230  *     pData[i*numCols + j]
00231  * </pre>
00232  *
00233  * \par Init Functions
00234  * There is an associated initialization function for each type of matrix
00235  * data structure.
00236  * The initialization function sets the values of the internal structure fields.
00237  * Refer to \ref arm_mat_init_f32(), \ref arm_mat_init_q31() and \ref arm_mat_init_q15()
00238  * for floating-point, Q31 and Q15 types,  respectively.
00239  *
00240  * \par
00241  * Use of the initialization function is optional. However, if initialization function is used
00242  * then the instance structure cannot be placed into a const data section.
00243  * To place the instance structure in a const data
00244  * section, manually initialize the data structure.  For example:
00245  * <pre>
00246  * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
00247  * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
00248  * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
00249  * </pre>
00250  * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
00251  * specifies the number of columns, and <code>pData</code> points to the
00252  * data array.
00253  *
00254  * \par Size Checking
00255  * By default all of the matrix functions perform size checking on the input and
00256  * output matrices. For example, the matrix addition function verifies that the
00257  * two input matrices and the output matrix all have the same number of rows and
00258  * columns. If the size check fails the functions return:
00259  * <pre>
00260  *     ARM_MATH_SIZE_MISMATCH
00261  * </pre>
00262  * Otherwise the functions return
00263  * <pre>
00264  *     ARM_MATH_SUCCESS
00265  * </pre>
00266  * There is some overhead associated with this matrix size checking.
00267  * The matrix size checking is enabled via the \#define
00268  * <pre>
00269  *     ARM_MATH_MATRIX_CHECK
00270  * </pre>
00271  * within the library project settings.  By default this macro is defined
00272  * and size checking is enabled. By changing the project settings and
00273  * undefining this macro size checking is eliminated and the functions
00274  * run a bit faster. With size checking disabled the functions always
00275  * return <code>ARM_MATH_SUCCESS</code>.
00276  */
00277 
00278 /**
00279  * @defgroup groupTransforms Transform Functions
00280  */
00281 
00282 /**
00283  * @defgroup groupController Controller Functions
00284  */
00285 
00286 /**
00287  * @defgroup groupStats Statistics Functions
00288  */
00289 
00290 /**
00291  * @defgroup groupSupport Support Functions
00292  */
00293 
00294 /**
00295  * @defgroup groupInterpolation Interpolation Functions
00296  * These functions perform 1- and 2-dimensional interpolation of data.
00297  * Linear interpolation is used for 1-dimensional data and
00298  * bilinear interpolation is used for 2-dimensional data.
00299  */
00300 
00301 /**
00302  * @defgroup groupExamples Examples
00303  */
00304 
00305 /**
00306  * @defgroup groupSVM SVM Functions
00307  * This set of functions is implementing SVM classification on 2 classes.
00308  * The training must be done from scikit-learn. The parameters can be easily
00309  * generated from the scikit-learn object. Some examples are given in
00310  * DSP/Testing/PatternGeneration/SVM.py
00311  *
00312  * If more than 2 classes are needed, the functions in this folder 
00313  * will have to be used, as building blocks, to do multi-class classification.
00314  *
00315  * No multi-class classification is provided in this SVM folder.
00316  * 
00317  */
00318 
00319 
00320 /**
00321  * @defgroup groupBayes Bayesian estimators
00322  *
00323  * Implement the naive gaussian Bayes estimator.
00324  * The training must be done from scikit-learn.
00325  *
00326  * The parameters can be easily
00327  * generated from the scikit-learn object. Some examples are given in
00328  * DSP/Testing/PatternGeneration/Bayes.py
00329  */
00330 
00331 /**
00332  * @defgroup groupDistance Distance functions
00333  *
00334  * Distance functions for use with clustering algorithms.
00335  * There are distance functions for float vectors and boolean vectors.
00336  *
00337  */
00338 
00339 
00340 #ifndef _ARM_MATH_H
00341 #define _ARM_MATH_H
00342 
00343 #ifdef   __cplusplus
00344 extern "C"
00345 {
00346 #endif
00347 
00348 /* Compiler specific diagnostic adjustment */
00349 #if   defined ( __CC_ARM )
00350 
00351 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
00352 
00353 #elif defined ( __GNUC__ )
00354   #pragma GCC diagnostic push
00355   #pragma GCC diagnostic ignored "-Wsign-conversion"
00356   #pragma GCC diagnostic ignored "-Wconversion"
00357   #pragma GCC diagnostic ignored "-Wunused-parameter"
00358 
00359 #elif defined ( __ICCARM__ )
00360 
00361 #elif defined ( __TI_ARM__ )
00362 
00363 #elif defined ( __CSMC__ )
00364 
00365 #elif defined ( __TASKING__ )
00366 
00367 #elif defined ( _MSC_VER )
00368 
00369 #else
00370   #error Unknown compiler
00371 #endif
00372 
00373 
00374 /* Included for instrinsics definitions */
00375 #if defined (_MSC_VER ) 
00376 #include <stdint.h>
00377 #define __STATIC_FORCEINLINE static __forceinline
00378 #define __STATIC_INLINE static __inline
00379 #define __ALIGNED(x) __declspec(align(x))
00380 
00381 #elif defined (__GNUC_PYTHON__)
00382 #include <stdint.h>
00383 #define  __ALIGNED(x) __attribute__((aligned(x)))
00384 #define __STATIC_FORCEINLINE static __attribute__((inline))
00385 #define __STATIC_INLINE static __attribute__((inline))
00386 #pragma GCC diagnostic ignored "-Wunused-function"
00387 #pragma GCC diagnostic ignored "-Wattributes"
00388 
00389 #else
00390 #include "cmsis_compiler.h"
00391 #endif
00392 
00393 
00394 
00395 #include <string.h>
00396 #include <math.h>
00397 #include <float.h>
00398 #include <limits.h>
00399 
00400 
00401 #define F64_MAX   ((float64_t)DBL_MAX)
00402 #define F32_MAX   ((float32_t)FLT_MAX)
00403 
00404 #if defined(ARM_MATH_FLOAT16)
00405 #define F16_MAX   ((float16_t)FLT_MAX)
00406 #endif
00407 
00408 #define F64_MIN   (-DBL_MAX)
00409 #define F32_MIN   (-FLT_MAX)
00410 
00411 #if defined(ARM_MATH_FLOAT16)
00412 #define F16_MIN   (-(float16_t)FLT_MAX)
00413 #endif
00414 
00415 #define F64_ABSMAX   ((float64_t)DBL_MAX)
00416 #define F32_ABSMAX   ((float32_t)FLT_MAX)
00417 
00418 #if defined(ARM_MATH_FLOAT16)
00419 #define F16_ABSMAX   ((float16_t)FLT_MAX)
00420 #endif
00421 
00422 #define F64_ABSMIN   ((float64_t)0.0)
00423 #define F32_ABSMIN   ((float32_t)0.0)
00424 
00425 #if defined(ARM_MATH_FLOAT16)
00426 #define F16_ABSMIN   ((float16_t)0.0)
00427 #endif
00428 
00429 #define Q31_MAX   ((q31_t)(0x7FFFFFFFL))
00430 #define Q15_MAX   ((q15_t)(0x7FFF))
00431 #define Q7_MAX    ((q7_t)(0x7F))
00432 #define Q31_MIN   ((q31_t)(0x80000000L))
00433 #define Q15_MIN   ((q15_t)(0x8000))
00434 #define Q7_MIN    ((q7_t)(0x80))
00435 
00436 #define Q31_ABSMAX   ((q31_t)(0x7FFFFFFFL))
00437 #define Q15_ABSMAX   ((q15_t)(0x7FFF))
00438 #define Q7_ABSMAX    ((q7_t)(0x7F))
00439 #define Q31_ABSMIN   ((q31_t)0)
00440 #define Q15_ABSMIN   ((q15_t)0)
00441 #define Q7_ABSMIN    ((q7_t)0)
00442 
00443 /* evaluate ARM DSP feature */
00444 #if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
00445   #define ARM_MATH_DSP                   1
00446 #endif
00447 
00448 #if defined(ARM_MATH_NEON)
00449 #include <arm_neon.h>
00450 #endif
00451 
00452 #if defined (ARM_MATH_HELIUM)
00453   #define ARM_MATH_MVEF
00454   #define ARM_MATH_FLOAT16
00455 #endif
00456 
00457 #if defined (ARM_MATH_MVEF)
00458   #define ARM_MATH_MVEI
00459   #define ARM_MATH_FLOAT16
00460 #endif
00461 
00462 #if defined (ARM_MATH_HELIUM) || defined(ARM_MATH_MVEF) || defined(ARM_MATH_MVEI)
00463 #include <arm_mve.h>
00464 #endif
00465 
00466 
00467   /**
00468    * @brief Macros required for reciprocal calculation in Normalized LMS
00469    */
00470 
00471 #define DELTA_Q31          ((q31_t)(0x100))
00472 #define DELTA_Q15          ((q15_t)0x5)
00473 #define INDEX_MASK         0x0000003F
00474 #ifndef PI
00475   #define PI               3.14159265358979f
00476 #endif
00477 
00478   /**
00479    * @brief Macros required for SINE and COSINE Fast math approximations
00480    */
00481 
00482 #define FAST_MATH_TABLE_SIZE  512
00483 #define FAST_MATH_Q31_SHIFT   (32 - 10)
00484 #define FAST_MATH_Q15_SHIFT   (16 - 10)
00485 #define CONTROLLER_Q31_SHIFT  (32 - 9)
00486 #define TABLE_SPACING_Q31     0x400000
00487 #define TABLE_SPACING_Q15     0x80
00488 
00489   /**
00490    * @brief Macros required for SINE and COSINE Controller functions
00491    */
00492   /* 1.31(q31) Fixed value of 2/360 */
00493   /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
00494 #define INPUT_SPACING         0xB60B61
00495 
00496   /**
00497    * @brief Macros for complex numbers
00498    */
00499 
00500   /* Dimension C vector space */
00501   #define CMPLX_DIM 2
00502 
00503   /**
00504    * @brief Error status returned by some functions in the library.
00505    */
00506 
00507   typedef enum
00508   {
00509     ARM_MATH_SUCCESS        =  0,        /**< No error */
00510     ARM_MATH_ARGUMENT_ERROR = -1,        /**< One or more arguments are incorrect */
00511     ARM_MATH_LENGTH_ERROR   = -2,        /**< Length of data buffer is incorrect */
00512     ARM_MATH_SIZE_MISMATCH  = -3,        /**< Size of matrices is not compatible with the operation */
00513     ARM_MATH_NANINF         = -4,        /**< Not-a-number (NaN) or infinity is generated */
00514     ARM_MATH_SINGULAR       = -5,        /**< Input matrix is singular and cannot be inverted */
00515     ARM_MATH_TEST_FAILURE   = -6         /**< Test Failed */
00516   } arm_status;
00517 
00518   /**
00519    * @brief 8-bit fractional data type in 1.7 format.
00520    */
00521   typedef int8_t q7_t;
00522 
00523   /**
00524    * @brief 16-bit fractional data type in 1.15 format.
00525    */
00526   typedef int16_t q15_t;
00527 
00528   /**
00529    * @brief 32-bit fractional data type in 1.31 format.
00530    */
00531   typedef int32_t q31_t;
00532 
00533   /**
00534    * @brief 64-bit fractional data type in 1.63 format.
00535    */
00536   typedef int64_t q63_t;
00537 
00538   /**
00539    * @brief 32-bit floating-point type definition.
00540    */
00541   typedef float float32_t;
00542 
00543   /**
00544    * @brief 64-bit floating-point type definition.
00545    */
00546   typedef double float64_t;
00547 
00548   /**
00549    * @brief vector types
00550    */
00551 #if defined(ARM_MATH_NEON) || defined (ARM_MATH_MVEI)
00552   /**
00553    * @brief 64-bit fractional 128-bit vector data type in 1.63 format
00554    */
00555   typedef int64x2_t q63x2_t;
00556 
00557   /**
00558    * @brief 32-bit fractional 128-bit vector data type in 1.31 format.
00559    */
00560   typedef int32x4_t q31x4_t;
00561 
00562   /**
00563    * @brief 16-bit fractional 128-bit vector data type with 16-bit alignement in 1.15 format.
00564    */
00565   typedef __ALIGNED(2) int16x8_t q15x8_t;
00566 
00567  /**
00568    * @brief 8-bit fractional 128-bit vector data type with 8-bit alignement in 1.7 format.
00569    */
00570   typedef __ALIGNED(1) int8x16_t q7x16_t;
00571 
00572     /**
00573    * @brief 32-bit fractional 128-bit vector pair data type in 1.31 format.
00574    */
00575   typedef int32x4x2_t q31x4x2_t;
00576 
00577   /**
00578    * @brief 32-bit fractional 128-bit vector quadruplet data type in 1.31 format.
00579    */
00580   typedef int32x4x4_t q31x4x4_t;
00581 
00582   /**
00583    * @brief 16-bit fractional 128-bit vector pair data type in 1.15 format.
00584    */
00585   typedef int16x8x2_t q15x8x2_t;
00586 
00587   /**
00588    * @brief 16-bit fractional 128-bit vector quadruplet data type in 1.15 format.
00589    */
00590   typedef int16x8x4_t q15x8x4_t;
00591 
00592   /**
00593    * @brief 8-bit fractional 128-bit vector pair data type in 1.7 format.
00594    */
00595   typedef int8x16x2_t q7x16x2_t;
00596 
00597   /**
00598    * @brief 8-bit fractional 128-bit vector quadruplet data type in 1.7 format.
00599    */
00600    typedef int8x16x4_t q7x16x4_t;
00601 
00602   /**
00603    * @brief 32-bit fractional data type in 9.23 format.
00604    */
00605   typedef int32_t q23_t;
00606 
00607   /**
00608    * @brief 32-bit fractional 128-bit vector data type in 9.23 format.
00609    */
00610   typedef int32x4_t q23x4_t;
00611 
00612   /**
00613    * @brief 64-bit status 128-bit vector data type.
00614    */
00615   typedef int64x2_t status64x2_t;
00616 
00617   /**
00618    * @brief 32-bit status 128-bit vector data type.
00619    */
00620   typedef int32x4_t status32x4_t;
00621 
00622   /**
00623    * @brief 16-bit status 128-bit vector data type.
00624    */
00625   typedef int16x8_t status16x8_t;
00626 
00627   /**
00628    * @brief 8-bit status 128-bit vector data type.
00629    */
00630   typedef int8x16_t status8x16_t;
00631 
00632 
00633 #endif
00634 
00635 #if defined(ARM_MATH_NEON) || defined(ARM_MATH_MVEF) /* floating point vector*/
00636   /**
00637    * @brief 32-bit floating-point 128-bit vector type
00638    */
00639   typedef float32x4_t f32x4_t;
00640 
00641 #if defined(ARM_MATH_FLOAT16)
00642   /**
00643    * @brief 16-bit floating-point 128-bit vector data type
00644    */
00645   typedef __ALIGNED(2) float16x8_t f16x8_t;
00646 #endif
00647 
00648   /**
00649    * @brief 32-bit floating-point 128-bit vector pair data type
00650    */
00651   typedef float32x4x2_t f32x4x2_t;
00652 
00653   /**
00654    * @brief 32-bit floating-point 128-bit vector quadruplet data type
00655    */
00656   typedef float32x4x4_t f32x4x4_t;
00657 
00658 #if defined(ARM_MATH_FLOAT16)
00659   /**
00660    * @brief 16-bit floating-point 128-bit vector pair data type
00661    */
00662   typedef float16x8x2_t f16x8x2_t;
00663 
00664   /**
00665    * @brief 16-bit floating-point 128-bit vector quadruplet data type
00666    */
00667   typedef float16x8x4_t f16x8x4_t;
00668 #endif
00669 
00670   /**
00671    * @brief 32-bit ubiquitous 128-bit vector data type
00672    */
00673   typedef union _any32x4_t
00674   {
00675       float32x4_t     f;
00676       int32x4_t       i;
00677   } any32x4_t;
00678 
00679 #if defined(ARM_MATH_FLOAT16)
00680   /**
00681    * @brief 16-bit ubiquitous 128-bit vector data type
00682    */
00683   typedef union _any16x8_t
00684   {
00685       float16x8_t     f;
00686       int16x8_t       i;
00687   } any16x8_t;
00688 #endif
00689 
00690 #endif
00691 
00692 #if defined(ARM_MATH_NEON)
00693   /**
00694    * @brief 32-bit fractional 64-bit vector data type in 1.31 format.
00695    */
00696   typedef int32x2_t  q31x2_t;
00697 
00698   /**
00699    * @brief 16-bit fractional 64-bit vector data type in 1.15 format.
00700    */
00701   typedef  __ALIGNED(2) int16x4_t q15x4_t;
00702 
00703   /**
00704    * @brief 8-bit fractional 64-bit vector data type in 1.7 format.
00705    */
00706   typedef  __ALIGNED(1) int8x8_t q7x8_t;
00707 
00708   /**
00709    * @brief 32-bit float 64-bit vector data type.
00710    */
00711   typedef float32x2_t  f32x2_t;
00712 
00713 #if defined(ARM_MATH_FLOAT16)
00714   /**
00715    * @brief 16-bit float 64-bit vector data type.
00716    */
00717   typedef  __ALIGNED(2) float16x4_t f16x4_t;
00718 #endif 
00719 
00720   /**
00721    * @brief 32-bit floating-point 128-bit vector triplet data type
00722    */
00723   typedef float32x4x3_t f32x4x3_t;
00724 
00725 #if defined(ARM_MATH_FLOAT16)
00726   /**
00727    * @brief 16-bit floating-point 128-bit vector triplet data type
00728    */
00729   typedef float16x8x3_t f16x8x3_t;
00730 #endif
00731 
00732   /**
00733    * @brief 32-bit fractional 128-bit vector triplet data type in 1.31 format
00734    */
00735   typedef int32x4x3_t q31x4x3_t;
00736 
00737   /**
00738    * @brief 16-bit fractional 128-bit vector triplet data type in 1.15 format
00739    */
00740   typedef int16x8x3_t q15x8x3_t;
00741 
00742   /**
00743    * @brief 8-bit fractional 128-bit vector triplet data type in 1.7 format
00744    */
00745   typedef int8x16x3_t q7x16x3_t;
00746 
00747   /**
00748    * @brief 32-bit floating-point 64-bit vector pair data type
00749    */
00750   typedef float32x2x2_t f32x2x2_t;
00751 
00752   /**
00753    * @brief 32-bit floating-point 64-bit vector triplet data type
00754    */
00755   typedef float32x2x3_t f32x2x3_t;
00756 
00757   /**
00758    * @brief 32-bit floating-point 64-bit vector quadruplet data type
00759    */
00760   typedef float32x2x4_t f32x2x4_t;
00761 
00762 #if defined(ARM_MATH_FLOAT16)
00763   /**
00764    * @brief 16-bit floating-point 64-bit vector pair data type
00765    */
00766   typedef float16x4x2_t f16x4x2_t;
00767 
00768   /**
00769    * @brief 16-bit floating-point 64-bit vector triplet data type
00770    */
00771   typedef float16x4x3_t f16x4x3_t;
00772 
00773   /**
00774    * @brief 16-bit floating-point 64-bit vector quadruplet data type
00775    */
00776   typedef float16x4x4_t f16x4x4_t;
00777 #endif 
00778 
00779   /**
00780    * @brief 32-bit fractional 64-bit vector pair data type in 1.31 format
00781    */
00782   typedef int32x2x2_t q31x2x2_t;
00783 
00784   /**
00785    * @brief 32-bit fractional 64-bit vector triplet data type in 1.31 format
00786    */
00787   typedef int32x2x3_t q31x2x3_t;
00788 
00789   /**
00790    * @brief 32-bit fractional 64-bit vector quadruplet data type in 1.31 format
00791    */
00792   typedef int32x4x3_t q31x2x4_t;
00793 
00794   /**
00795    * @brief 16-bit fractional 64-bit vector pair data type in 1.15 format
00796    */
00797   typedef int16x4x2_t q15x4x2_t;
00798 
00799   /**
00800    * @brief 16-bit fractional 64-bit vector triplet data type in 1.15 format
00801    */
00802   typedef int16x4x2_t q15x4x3_t;
00803 
00804   /**
00805    * @brief 16-bit fractional 64-bit vector quadruplet data type in 1.15 format
00806    */
00807   typedef int16x4x3_t q15x4x4_t;
00808 
00809   /**
00810    * @brief 8-bit fractional 64-bit vector pair data type in 1.7 format
00811    */
00812   typedef int8x8x2_t q7x8x2_t;
00813 
00814   /**
00815    * @brief 8-bit fractional 64-bit vector triplet data type in 1.7 format
00816    */
00817   typedef int8x8x3_t q7x8x3_t;
00818 
00819   /**
00820    * @brief 8-bit fractional 64-bit vector quadruplet data type in 1.7 format
00821    */
00822   typedef int8x8x4_t q7x8x4_t;
00823 
00824   /**
00825    * @brief 32-bit ubiquitous 64-bit vector data type
00826    */
00827   typedef union _any32x2_t
00828   {
00829       float32x2_t     f;
00830       int32x2_t       i;
00831   } any32x2_t;
00832 
00833 #if defined(ARM_MATH_FLOAT16)
00834   /**
00835    * @brief 16-bit ubiquitous 64-bit vector data type
00836    */
00837   typedef union _any16x4_t
00838   {
00839       float16x4_t     f;
00840       int16x4_t       i;
00841   } any16x4_t;
00842 #endif 
00843 
00844   /**
00845    * @brief 32-bit status 64-bit vector data type.
00846    */
00847   typedef int32x4_t status32x2_t;
00848 
00849   /**
00850    * @brief 16-bit status 64-bit vector data type.
00851    */
00852   typedef int16x8_t status16x4_t;
00853 
00854   /**
00855    * @brief 8-bit status 64-bit vector data type.
00856    */
00857   typedef int8x16_t status8x8_t;
00858 
00859 #endif
00860 
00861 
00862 
00863 /**
00864   @brief definition to read/write two 16 bit values.
00865   @deprecated
00866  */
00867 #if   defined ( __CC_ARM )
00868   #define __SIMD32_TYPE int32_t __packed
00869 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
00870   #define __SIMD32_TYPE int32_t
00871 #elif defined ( __GNUC__ )
00872   #define __SIMD32_TYPE int32_t
00873 #elif defined ( __ICCARM__ )
00874   #define __SIMD32_TYPE int32_t __packed
00875 #elif defined ( __TI_ARM__ )
00876   #define __SIMD32_TYPE int32_t
00877 #elif defined ( __CSMC__ )
00878   #define __SIMD32_TYPE int32_t
00879 #elif defined ( __TASKING__ )
00880   #define __SIMD32_TYPE __un(aligned) int32_t
00881 #elif defined(_MSC_VER )
00882   #define __SIMD32_TYPE int32_t
00883 #else
00884   #error Unknown compiler
00885 #endif
00886 
00887 #define __SIMD32(addr)        (*(__SIMD32_TYPE **) & (addr))
00888 #define __SIMD32_CONST(addr)  ( (__SIMD32_TYPE * )   (addr))
00889 #define _SIMD32_OFFSET(addr)  (*(__SIMD32_TYPE * )   (addr))
00890 #define __SIMD64(addr)        (*(      int64_t **) & (addr))
00891 
00892 #define STEP(x) (x) <= 0 ? 0 : 1
00893 #define SQ(x) ((x) * (x))
00894 
00895 /* SIMD replacement */
00896 
00897 
00898 /**
00899   @brief         Read 2 Q15 from Q15 pointer.
00900   @param[in]     pQ15      points to input value
00901   @return        Q31 value
00902  */
00903 __STATIC_FORCEINLINE q31_t read_q15x2 (
00904   q15_t * pQ15)
00905 {
00906   q31_t val;
00907 
00908 #ifdef __ARM_FEATURE_UNALIGNED
00909   memcpy (&val, pQ15, 4);
00910 #else
00911   val = (pQ15[1] << 16) | (pQ15[0] & 0x0FFFF) ;
00912 #endif
00913 
00914   return (val);
00915 }
00916 
00917 /**
00918   @brief         Read 2 Q15 from Q15 pointer and increment pointer afterwards.
00919   @param[in]     pQ15      points to input value
00920   @return        Q31 value
00921  */
00922 __STATIC_FORCEINLINE q31_t read_q15x2_ia (
00923   q15_t ** pQ15)
00924 {
00925   q31_t val;
00926 
00927 #ifdef __ARM_FEATURE_UNALIGNED
00928   memcpy (&val, *pQ15, 4);
00929 #else
00930   val = ((*pQ15)[1] << 16) | ((*pQ15)[0] & 0x0FFFF);
00931 #endif
00932 
00933  *pQ15 += 2;
00934  return (val);
00935 }
00936 
00937 /**
00938   @brief         Read 2 Q15 from Q15 pointer and decrement pointer afterwards.
00939   @param[in]     pQ15      points to input value
00940   @return        Q31 value
00941  */
00942 __STATIC_FORCEINLINE q31_t read_q15x2_da (
00943   q15_t ** pQ15)
00944 {
00945   q31_t val;
00946 
00947 #ifdef __ARM_FEATURE_UNALIGNED
00948   memcpy (&val, *pQ15, 4);
00949 #else
00950   val = ((*pQ15)[1] << 16) | ((*pQ15)[0] & 0x0FFFF);
00951 #endif
00952 
00953   *pQ15 -= 2;
00954   return (val);
00955 }
00956 
00957 /**
00958   @brief         Write 2 Q15 to Q15 pointer and increment pointer afterwards.
00959   @param[in]     pQ15      points to input value
00960   @param[in]     value     Q31 value
00961   @return        none
00962  */
00963 __STATIC_FORCEINLINE void write_q15x2_ia (
00964   q15_t ** pQ15,
00965   q31_t    value)
00966 {
00967   q31_t val = value;
00968 #ifdef __ARM_FEATURE_UNALIGNED
00969   memcpy (*pQ15, &val, 4);
00970 #else
00971   (*pQ15)[0] = (val & 0x0FFFF);
00972   (*pQ15)[1] = (val >> 16) & 0x0FFFF;
00973 #endif
00974 
00975  *pQ15 += 2;
00976 }
00977 
00978 /**
00979   @brief         Write 2 Q15 to Q15 pointer.
00980   @param[in]     pQ15      points to input value
00981   @param[in]     value     Q31 value
00982   @return        none
00983  */
00984 __STATIC_FORCEINLINE void write_q15x2 (
00985   q15_t * pQ15,
00986   q31_t   value)
00987 {
00988   q31_t val = value;
00989 
00990 #ifdef __ARM_FEATURE_UNALIGNED
00991   memcpy (pQ15, &val, 4);
00992 #else
00993   pQ15[0] = val & 0x0FFFF;
00994   pQ15[1] = val >> 16;
00995 #endif
00996 }
00997 
00998 
00999 /**
01000   @brief         Read 4 Q7 from Q7 pointer and increment pointer afterwards.
01001   @param[in]     pQ7       points to input value
01002   @return        Q31 value
01003  */
01004 __STATIC_FORCEINLINE q31_t read_q7x4_ia (
01005   q7_t ** pQ7)
01006 {
01007   q31_t val;
01008 
01009 
01010 #ifdef __ARM_FEATURE_UNALIGNED
01011   memcpy (&val, *pQ7, 4);
01012 #else
01013   val =(((*pQ7)[3] & 0x0FF) << 24)  | (((*pQ7)[2] & 0x0FF) << 16)  | (((*pQ7)[1] & 0x0FF) << 8)  | ((*pQ7)[0] & 0x0FF);
01014 #endif 
01015 
01016   *pQ7 += 4;
01017 
01018   return (val);
01019 }
01020 
01021 /**
01022   @brief         Read 4 Q7 from Q7 pointer and decrement pointer afterwards.
01023   @param[in]     pQ7       points to input value
01024   @return        Q31 value
01025  */
01026 __STATIC_FORCEINLINE q31_t read_q7x4_da (
01027   q7_t ** pQ7)
01028 {
01029   q31_t val;
01030 #ifdef __ARM_FEATURE_UNALIGNED
01031   memcpy (&val, *pQ7, 4);
01032 #else
01033   val = ((((*pQ7)[3]) & 0x0FF) << 24) | ((((*pQ7)[2]) & 0x0FF) << 16)   | ((((*pQ7)[1]) & 0x0FF) << 8)  | ((*pQ7)[0] & 0x0FF);
01034 #endif 
01035   *pQ7 -= 4;
01036 
01037   return (val);
01038 }
01039 
01040 /**
01041   @brief         Write 4 Q7 to Q7 pointer and increment pointer afterwards.
01042   @param[in]     pQ7       points to input value
01043   @param[in]     value     Q31 value
01044   @return        none
01045  */
01046 __STATIC_FORCEINLINE void write_q7x4_ia (
01047   q7_t ** pQ7,
01048   q31_t   value)
01049 {
01050   q31_t val = value;
01051 #ifdef __ARM_FEATURE_UNALIGNED
01052   memcpy (*pQ7, &val, 4);
01053 #else
01054   (*pQ7)[0] = val & 0x0FF;
01055   (*pQ7)[1] = (val >> 8) & 0x0FF;
01056   (*pQ7)[2] = (val >> 16) & 0x0FF;
01057   (*pQ7)[3] = (val >> 24) & 0x0FF;
01058 
01059 #endif
01060   *pQ7 += 4;
01061 }
01062 
01063 /*
01064 
01065 Normally those kind of definitions are in a compiler file
01066 in Core or Core_A.
01067 
01068 But for MSVC compiler it is a bit special. The goal is very specific
01069 to CMSIS-DSP and only to allow the use of this library from other
01070 systems like Python or Matlab.
01071 
01072 MSVC is not going to be used to cross-compile to ARM. So, having a MSVC
01073 compiler file in Core or Core_A would not make sense.
01074 
01075 */
01076 #if defined ( _MSC_VER ) || defined(__GNUC_PYTHON__)
01077     __STATIC_FORCEINLINE uint8_t __CLZ(uint32_t data)
01078     {
01079       if (data == 0U) { return 32U; }
01080 
01081       uint32_t count = 0U;
01082       uint32_t mask = 0x80000000U;
01083 
01084       while ((data & mask) == 0U)
01085       {
01086         count += 1U;
01087         mask = mask >> 1U;
01088       }
01089       return count;
01090     }
01091 
01092   __STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)
01093   {
01094     if ((sat >= 1U) && (sat <= 32U))
01095     {
01096       const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
01097       const int32_t min = -1 - max ;
01098       if (val > max)
01099       {
01100         return max;
01101       }
01102       else if (val < min)
01103       {
01104         return min;
01105       }
01106     }
01107     return val;
01108   }
01109 
01110   __STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
01111   {
01112     if (sat <= 31U)
01113     {
01114       const uint32_t max = ((1U << sat) - 1U);
01115       if (val > (int32_t)max)
01116       {
01117         return max;
01118       }
01119       else if (val < 0)
01120       {
01121         return 0U;
01122       }
01123     }
01124     return (uint32_t)val;
01125   }
01126 #endif
01127 
01128 #ifndef ARM_MATH_DSP
01129   /**
01130    * @brief definition to pack two 16 bit values.
01131    */
01132   #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) <<    0) & (int32_t)0x0000FFFF) | \
01133                                       (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000)  )
01134   #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) <<    0) & (int32_t)0xFFFF0000) | \
01135                                       (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF)  )
01136 #endif
01137 
01138    /**
01139    * @brief definition to pack four 8 bit values.
01140    */
01141 #ifndef ARM_MATH_BIG_ENDIAN
01142   #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) <<  0) & (int32_t)0x000000FF) | \
01143                                   (((int32_t)(v1) <<  8) & (int32_t)0x0000FF00) | \
01144                                   (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
01145                                   (((int32_t)(v3) << 24) & (int32_t)0xFF000000)  )
01146 #else
01147   #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) <<  0) & (int32_t)0x000000FF) | \
01148                                   (((int32_t)(v2) <<  8) & (int32_t)0x0000FF00) | \
01149                                   (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
01150                                   (((int32_t)(v0) << 24) & (int32_t)0xFF000000)  )
01151 #endif
01152 
01153 
01154   /**
01155    * @brief Clips Q63 to Q31 values.
01156    */
01157   __STATIC_FORCEINLINE q31_t clip_q63_to_q31(
01158   q63_t x)
01159   {
01160     return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
01161       ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
01162   }
01163 
01164   /**
01165    * @brief Clips Q63 to Q15 values.
01166    */
01167   __STATIC_FORCEINLINE q15_t clip_q63_to_q15(
01168   q63_t x)
01169   {
01170     return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
01171       ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
01172   }
01173 
01174   /**
01175    * @brief Clips Q31 to Q7 values.
01176    */
01177   __STATIC_FORCEINLINE q7_t clip_q31_to_q7(
01178   q31_t x)
01179   {
01180     return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
01181       ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
01182   }
01183 
01184   /**
01185    * @brief Clips Q31 to Q15 values.
01186    */
01187   __STATIC_FORCEINLINE q15_t clip_q31_to_q15(
01188   q31_t x)
01189   {
01190     return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
01191       ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
01192   }
01193 
01194   /**
01195    * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
01196    */
01197   __STATIC_FORCEINLINE q63_t mult32x64(
01198   q63_t x,
01199   q31_t y)
01200   {
01201     return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
01202             (((q63_t) (x >> 32)                * y)      )  );
01203   }
01204 
01205   /**
01206    * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
01207    */
01208   __STATIC_FORCEINLINE uint32_t arm_recip_q31(
01209         q31_t in,
01210         q31_t * dst,
01211   const q31_t * pRecipTable)
01212   {
01213     q31_t out;
01214     uint32_t tempVal;
01215     uint32_t index, i;
01216     uint32_t signBits;
01217 
01218     if (in > 0)
01219     {
01220       signBits = ((uint32_t) (__CLZ( in) - 1));
01221     }
01222     else
01223     {
01224       signBits = ((uint32_t) (__CLZ(-in) - 1));
01225     }
01226 
01227     /* Convert input sample to 1.31 format */
01228     in = (in << signBits);
01229 
01230     /* calculation of index for initial approximated Val */
01231     index = (uint32_t)(in >> 24);
01232     index = (index & INDEX_MASK);
01233 
01234     /* 1.31 with exp 1 */
01235     out = pRecipTable[index];
01236 
01237     /* calculation of reciprocal value */
01238     /* running approximation for two iterations */
01239     for (i = 0U; i < 2U; i++)
01240     {
01241       tempVal = (uint32_t) (((q63_t) in * out) >> 31);
01242       tempVal = 0x7FFFFFFFu - tempVal;
01243       /*      1.31 with exp 1 */
01244       /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */
01245       out = clip_q63_to_q31(((q63_t) out * tempVal) >> 30);
01246     }
01247 
01248     /* write output */
01249     *dst = out;
01250 
01251     /* return num of signbits of out = 1/in value */
01252     return (signBits + 1U);
01253   }
01254 
01255 
01256   /**
01257    * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
01258    */
01259   __STATIC_FORCEINLINE uint32_t arm_recip_q15(
01260         q15_t in,
01261         q15_t * dst,
01262   const q15_t * pRecipTable)
01263   {
01264     q15_t out = 0;
01265     uint32_t tempVal = 0;
01266     uint32_t index = 0, i = 0;
01267     uint32_t signBits = 0;
01268 
01269     if (in > 0)
01270     {
01271       signBits = ((uint32_t)(__CLZ( in) - 17));
01272     }
01273     else
01274     {
01275       signBits = ((uint32_t)(__CLZ(-in) - 17));
01276     }
01277 
01278     /* Convert input sample to 1.15 format */
01279     in = (in << signBits);
01280 
01281     /* calculation of index for initial approximated Val */
01282     index = (uint32_t)(in >>  8);
01283     index = (index & INDEX_MASK);
01284 
01285     /*      1.15 with exp 1  */
01286     out = pRecipTable[index];
01287 
01288     /* calculation of reciprocal value */
01289     /* running approximation for two iterations */
01290     for (i = 0U; i < 2U; i++)
01291     {
01292       tempVal = (uint32_t) (((q31_t) in * out) >> 15);
01293       tempVal = 0x7FFFu - tempVal;
01294       /*      1.15 with exp 1 */
01295       out = (q15_t) (((q31_t) out * tempVal) >> 14);
01296       /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */
01297     }
01298 
01299     /* write output */
01300     *dst = out;
01301 
01302     /* return num of signbits of out = 1/in value */
01303     return (signBits + 1);
01304   }
01305 
01306 /**
01307  * @brief Integer exponentiation
01308  * @param[in]    x           value
01309  * @param[in]    nb          integer exponent >= 1
01310  * @return x^nb
01311  *
01312  */
01313 __STATIC_INLINE float32_t arm_exponent_f32(float32_t x, int32_t nb)
01314 {
01315     float32_t r = x;
01316     nb --;
01317     while(nb > 0)
01318     {
01319         r = r * x;
01320         nb--;
01321     }
01322     return(r);
01323 }
01324 
01325 /**
01326  * @brief  64-bit to 32-bit unsigned normalization
01327  * @param[in]  in           is input unsigned long long value
01328  * @param[out] normalized   is the 32-bit normalized value
01329  * @param[out] norm         is norm scale
01330  */
01331 __STATIC_INLINE  void arm_norm_64_to_32u(uint64_t in, int32_t * normalized, int32_t *norm)
01332 {
01333     int32_t     n1;
01334     int32_t     hi = (int32_t) (in >> 32);
01335     int32_t     lo = (int32_t) ((in << 32) >> 32);
01336 
01337     n1 = __CLZ(hi) - 32;
01338     if (!n1)
01339     {
01340         /*
01341          * input fits in 32-bit
01342          */
01343         n1 = __CLZ(lo);
01344         if (!n1)
01345         {
01346             /*
01347              * MSB set, need to scale down by 1
01348              */
01349             *norm = -1;
01350             *normalized = (((uint32_t) lo) >> 1);
01351         } else
01352         {
01353             if (n1 == 32)
01354             {
01355                 /*
01356                  * input is zero
01357                  */
01358                 *norm = 0;
01359                 *normalized = 0;
01360             } else
01361             {
01362                 /*
01363                  * 32-bit normalization
01364                  */
01365                 *norm = n1 - 1;
01366                 *normalized = lo << *norm;
01367             }
01368         }
01369     } else
01370     {
01371         /*
01372          * input fits in 64-bit
01373          */
01374         n1 = 1 - n1;
01375         *norm = -n1;
01376         /*
01377          * 64 bit normalization
01378          */
01379         *normalized = (((uint32_t) lo) >> n1) | (hi << (32 - n1));
01380     }
01381 }
01382 
01383 __STATIC_INLINE q31_t arm_div_q63_to_q31(q63_t num, q31_t den)
01384 {
01385     q31_t   result;
01386     uint64_t   absNum;
01387     int32_t   normalized;
01388     int32_t   norm;
01389 
01390     /*
01391      * if sum fits in 32bits
01392      * avoid costly 64-bit division
01393      */
01394     absNum = num > 0 ? num : -num;
01395     arm_norm_64_to_32u(absNum, &normalized, &norm);
01396     if (norm > 0)
01397         /*
01398          * 32-bit division
01399          */
01400         result = (q31_t) num / den;
01401     else
01402         /*
01403          * 64-bit division
01404          */
01405         result = (q31_t) (num / den);
01406 
01407     return result;
01408 }
01409 
01410 
01411 /*
01412  * @brief C custom defined intrinsic functions
01413  */
01414 #if !defined (ARM_MATH_DSP)
01415 
01416   /*
01417    * @brief C custom defined QADD8
01418    */
01419   __STATIC_FORCEINLINE uint32_t __QADD8(
01420   uint32_t x,
01421   uint32_t y)
01422   {
01423     q31_t r, s, t, u;
01424 
01425     r = __SSAT(((((q31_t)x << 24) >> 24) + (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
01426     s = __SSAT(((((q31_t)x << 16) >> 24) + (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
01427     t = __SSAT(((((q31_t)x <<  8) >> 24) + (((q31_t)y <<  8) >> 24)), 8) & (int32_t)0x000000FF;
01428     u = __SSAT(((((q31_t)x      ) >> 24) + (((q31_t)y      ) >> 24)), 8) & (int32_t)0x000000FF;
01429 
01430     return ((uint32_t)((u << 24) | (t << 16) | (s <<  8) | (r      )));
01431   }
01432 
01433 
01434   /*
01435    * @brief C custom defined QSUB8
01436    */
01437   __STATIC_FORCEINLINE uint32_t __QSUB8(
01438   uint32_t x,
01439   uint32_t y)
01440   {
01441     q31_t r, s, t, u;
01442 
01443     r = __SSAT(((((q31_t)x << 24) >> 24) - (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
01444     s = __SSAT(((((q31_t)x << 16) >> 24) - (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
01445     t = __SSAT(((((q31_t)x <<  8) >> 24) - (((q31_t)y <<  8) >> 24)), 8) & (int32_t)0x000000FF;
01446     u = __SSAT(((((q31_t)x      ) >> 24) - (((q31_t)y      ) >> 24)), 8) & (int32_t)0x000000FF;
01447 
01448     return ((uint32_t)((u << 24) | (t << 16) | (s <<  8) | (r      )));
01449   }
01450 
01451 
01452   /*
01453    * @brief C custom defined QADD16
01454    */
01455   __STATIC_FORCEINLINE uint32_t __QADD16(
01456   uint32_t x,
01457   uint32_t y)
01458   {
01459 /*  q31_t r,     s;  without initialisation 'arm_offset_q15 test' fails  but 'intrinsic' tests pass! for armCC */
01460     q31_t r = 0, s = 0;
01461 
01462     r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
01463     s = __SSAT(((((q31_t)x      ) >> 16) + (((q31_t)y      ) >> 16)), 16) & (int32_t)0x0000FFFF;
01464 
01465     return ((uint32_t)((s << 16) | (r      )));
01466   }
01467 
01468 
01469   /*
01470    * @brief C custom defined SHADD16
01471    */
01472   __STATIC_FORCEINLINE uint32_t __SHADD16(
01473   uint32_t x,
01474   uint32_t y)
01475   {
01476     q31_t r, s;
01477 
01478     r = (((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
01479     s = (((((q31_t)x      ) >> 16) + (((q31_t)y      ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
01480 
01481     return ((uint32_t)((s << 16) | (r      )));
01482   }
01483 
01484 
01485   /*
01486    * @brief C custom defined QSUB16
01487    */
01488   __STATIC_FORCEINLINE uint32_t __QSUB16(
01489   uint32_t x,
01490   uint32_t y)
01491   {
01492     q31_t r, s;
01493 
01494     r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
01495     s = __SSAT(((((q31_t)x      ) >> 16) - (((q31_t)y      ) >> 16)), 16) & (int32_t)0x0000FFFF;
01496 
01497     return ((uint32_t)((s << 16) | (r      )));
01498   }
01499 
01500 
01501   /*
01502    * @brief C custom defined SHSUB16
01503    */
01504   __STATIC_FORCEINLINE uint32_t __SHSUB16(
01505   uint32_t x,
01506   uint32_t y)
01507   {
01508     q31_t r, s;
01509 
01510     r = (((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
01511     s = (((((q31_t)x      ) >> 16) - (((q31_t)y      ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
01512 
01513     return ((uint32_t)((s << 16) | (r      )));
01514   }
01515 
01516 
01517   /*
01518    * @brief C custom defined QASX
01519    */
01520   __STATIC_FORCEINLINE uint32_t __QASX(
01521   uint32_t x,
01522   uint32_t y)
01523   {
01524     q31_t r, s;
01525 
01526     r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y      ) >> 16)), 16) & (int32_t)0x0000FFFF;
01527     s = __SSAT(((((q31_t)x      ) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
01528 
01529     return ((uint32_t)((s << 16) | (r      )));
01530   }
01531 
01532 
01533   /*
01534    * @brief C custom defined SHASX
01535    */
01536   __STATIC_FORCEINLINE uint32_t __SHASX(
01537   uint32_t x,
01538   uint32_t y)
01539   {
01540     q31_t r, s;
01541 
01542     r = (((((q31_t)x << 16) >> 16) - (((q31_t)y      ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
01543     s = (((((q31_t)x      ) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
01544 
01545     return ((uint32_t)((s << 16) | (r      )));
01546   }
01547 
01548 
01549   /*
01550    * @brief C custom defined QSAX
01551    */
01552   __STATIC_FORCEINLINE uint32_t __QSAX(
01553   uint32_t x,
01554   uint32_t y)
01555   {
01556     q31_t r, s;
01557 
01558     r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y      ) >> 16)), 16) & (int32_t)0x0000FFFF;
01559     s = __SSAT(((((q31_t)x      ) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
01560 
01561     return ((uint32_t)((s << 16) | (r      )));
01562   }
01563 
01564 
01565   /*
01566    * @brief C custom defined SHSAX
01567    */
01568   __STATIC_FORCEINLINE uint32_t __SHSAX(
01569   uint32_t x,
01570   uint32_t y)
01571   {
01572     q31_t r, s;
01573 
01574     r = (((((q31_t)x << 16) >> 16) + (((q31_t)y      ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
01575     s = (((((q31_t)x      ) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
01576 
01577     return ((uint32_t)((s << 16) | (r      )));
01578   }
01579 
01580 
01581   /*
01582    * @brief C custom defined SMUSDX
01583    */
01584   __STATIC_FORCEINLINE uint32_t __SMUSDX(
01585   uint32_t x,
01586   uint32_t y)
01587   {
01588     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y      ) >> 16)) -
01589                        ((((q31_t)x      ) >> 16) * (((q31_t)y << 16) >> 16))   ));
01590   }
01591 
01592   /*
01593    * @brief C custom defined SMUADX
01594    */
01595   __STATIC_FORCEINLINE uint32_t __SMUADX(
01596   uint32_t x,
01597   uint32_t y)
01598   {
01599     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y      ) >> 16)) +
01600                        ((((q31_t)x      ) >> 16) * (((q31_t)y << 16) >> 16))   ));
01601   }
01602 
01603 
01604   /*
01605    * @brief C custom defined QADD
01606    */
01607   __STATIC_FORCEINLINE int32_t __QADD(
01608   int32_t x,
01609   int32_t y)
01610   {
01611     return ((int32_t)(clip_q63_to_q31((q63_t)x + (q31_t)y)));
01612   }
01613 
01614 
01615   /*
01616    * @brief C custom defined QSUB
01617    */
01618   __STATIC_FORCEINLINE int32_t __QSUB(
01619   int32_t x,
01620   int32_t y)
01621   {
01622     return ((int32_t)(clip_q63_to_q31((q63_t)x - (q31_t)y)));
01623   }
01624 
01625 
01626   /*
01627    * @brief C custom defined SMLAD
01628    */
01629   __STATIC_FORCEINLINE uint32_t __SMLAD(
01630   uint32_t x,
01631   uint32_t y,
01632   uint32_t sum)
01633   {
01634     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
01635                        ((((q31_t)x      ) >> 16) * (((q31_t)y      ) >> 16)) +
01636                        ( ((q31_t)sum    )                                  )   ));
01637   }
01638 
01639 
01640   /*
01641    * @brief C custom defined SMLADX
01642    */
01643   __STATIC_FORCEINLINE uint32_t __SMLADX(
01644   uint32_t x,
01645   uint32_t y,
01646   uint32_t sum)
01647   {
01648     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y      ) >> 16)) +
01649                        ((((q31_t)x      ) >> 16) * (((q31_t)y << 16) >> 16)) +
01650                        ( ((q31_t)sum    )                                  )   ));
01651   }
01652 
01653 
01654   /*
01655    * @brief C custom defined SMLSDX
01656    */
01657   __STATIC_FORCEINLINE uint32_t __SMLSDX(
01658   uint32_t x,
01659   uint32_t y,
01660   uint32_t sum)
01661   {
01662     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y      ) >> 16)) -
01663                        ((((q31_t)x      ) >> 16) * (((q31_t)y << 16) >> 16)) +
01664                        ( ((q31_t)sum    )                                  )   ));
01665   }
01666 
01667 
01668   /*
01669    * @brief C custom defined SMLALD
01670    */
01671   __STATIC_FORCEINLINE uint64_t __SMLALD(
01672   uint32_t x,
01673   uint32_t y,
01674   uint64_t sum)
01675   {
01676 /*  return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */
01677     return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
01678                        ((((q31_t)x      ) >> 16) * (((q31_t)y      ) >> 16)) +
01679                        ( ((q63_t)sum    )                                  )   ));
01680   }
01681 
01682 
01683   /*
01684    * @brief C custom defined SMLALDX
01685    */
01686   __STATIC_FORCEINLINE uint64_t __SMLALDX(
01687   uint32_t x,
01688   uint32_t y,
01689   uint64_t sum)
01690   {
01691 /*  return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */
01692     return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y      ) >> 16)) +
01693                        ((((q31_t)x      ) >> 16) * (((q31_t)y << 16) >> 16)) +
01694                        ( ((q63_t)sum    )                                  )   ));
01695   }
01696 
01697 
01698   /*
01699    * @brief C custom defined SMUAD
01700    */
01701   __STATIC_FORCEINLINE uint32_t __SMUAD(
01702   uint32_t x,
01703   uint32_t y)
01704   {
01705     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
01706                        ((((q31_t)x      ) >> 16) * (((q31_t)y      ) >> 16))   ));
01707   }
01708 
01709 
01710   /*
01711    * @brief C custom defined SMUSD
01712    */
01713   __STATIC_FORCEINLINE uint32_t __SMUSD(
01714   uint32_t x,
01715   uint32_t y)
01716   {
01717     return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) -
01718                        ((((q31_t)x      ) >> 16) * (((q31_t)y      ) >> 16))   ));
01719   }
01720 
01721 
01722   /*
01723    * @brief C custom defined SXTB16
01724    */
01725   __STATIC_FORCEINLINE uint32_t __SXTB16(
01726   uint32_t x)
01727   {
01728     return ((uint32_t)(((((q31_t)x << 24) >> 24) & (q31_t)0x0000FFFF) |
01729                        ((((q31_t)x <<  8) >>  8) & (q31_t)0xFFFF0000)  ));
01730   }
01731 
01732   /*
01733    * @brief C custom defined SMMLA
01734    */
01735   __STATIC_FORCEINLINE int32_t __SMMLA(
01736   int32_t x,
01737   int32_t y,
01738   int32_t sum)
01739   {
01740     return (sum + (int32_t) (((int64_t) x * y) >> 32));
01741   }
01742 
01743 #endif /* !defined (ARM_MATH_DSP) */
01744 
01745 
01746   /**
01747    * @brief Instance structure for the Q7 FIR filter.
01748    */
01749   typedef struct
01750   {
01751           uint16_t numTaps;        /**< number of filter coefficients in the filter. */
01752           q7_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
01753     const q7_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/
01754   } arm_fir_instance_q7;
01755 
01756   /**
01757    * @brief Instance structure for the Q15 FIR filter.
01758    */
01759   typedef struct
01760   {
01761           uint16_t numTaps;         /**< number of filter coefficients in the filter. */
01762           q15_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
01763     const q15_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/
01764   } arm_fir_instance_q15;
01765 
01766   /**
01767    * @brief Instance structure for the Q31 FIR filter.
01768    */
01769   typedef struct
01770   {
01771           uint16_t numTaps;         /**< number of filter coefficients in the filter. */
01772           q31_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
01773     const q31_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps. */
01774   } arm_fir_instance_q31;
01775 
01776   /**
01777    * @brief Instance structure for the floating-point FIR filter.
01778    */
01779   typedef struct
01780   {
01781           uint16_t numTaps;     /**< number of filter coefficients in the filter. */
01782           float32_t *pState;    /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
01783     const float32_t *pCoeffs;   /**< points to the coefficient array. The array is of length numTaps. */
01784   } arm_fir_instance_f32;
01785 
01786   /**
01787    * @brief Processing function for the Q7 FIR filter.
01788    * @param[in]  S          points to an instance of the Q7 FIR filter structure.
01789    * @param[in]  pSrc       points to the block of input data.
01790    * @param[out] pDst       points to the block of output data.
01791    * @param[in]  blockSize  number of samples to process.
01792    */
01793   void arm_fir_q7(
01794   const arm_fir_instance_q7 * S,
01795   const q7_t * pSrc,
01796         q7_t * pDst,
01797         uint32_t blockSize);
01798 
01799   /**
01800    * @brief  Initialization function for the Q7 FIR filter.
01801    * @param[in,out] S          points to an instance of the Q7 FIR structure.
01802    * @param[in]     numTaps    Number of filter coefficients in the filter.
01803    * @param[in]     pCoeffs    points to the filter coefficients.
01804    * @param[in]     pState     points to the state buffer.
01805    * @param[in]     blockSize  number of samples that are processed.
01806    */
01807   void arm_fir_init_q7(
01808         arm_fir_instance_q7 * S,
01809         uint16_t numTaps,
01810   const q7_t * pCoeffs,
01811         q7_t * pState,
01812         uint32_t blockSize);
01813 
01814   /**
01815    * @brief Processing function for the Q15 FIR filter.
01816    * @param[in]  S          points to an instance of the Q15 FIR structure.
01817    * @param[in]  pSrc       points to the block of input data.
01818    * @param[out] pDst       points to the block of output data.
01819    * @param[in]  blockSize  number of samples to process.
01820    */
01821   void arm_fir_q15(
01822   const arm_fir_instance_q15 * S,
01823   const q15_t * pSrc,
01824         q15_t * pDst,
01825         uint32_t blockSize);
01826 
01827   /**
01828    * @brief Processing function for the fast Q15 FIR filter (fast version).
01829    * @param[in]  S          points to an instance of the Q15 FIR filter structure.
01830    * @param[in]  pSrc       points to the block of input data.
01831    * @param[out] pDst       points to the block of output data.
01832    * @param[in]  blockSize  number of samples to process.
01833    */
01834   void arm_fir_fast_q15(
01835   const arm_fir_instance_q15 * S,
01836   const q15_t * pSrc,
01837         q15_t * pDst,
01838         uint32_t blockSize);
01839 
01840   /**
01841    * @brief  Initialization function for the Q15 FIR filter.
01842    * @param[in,out] S          points to an instance of the Q15 FIR filter structure.
01843    * @param[in]     numTaps    Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
01844    * @param[in]     pCoeffs    points to the filter coefficients.
01845    * @param[in]     pState     points to the state buffer.
01846    * @param[in]     blockSize  number of samples that are processed at a time.
01847    * @return     The function returns either
01848    * <code>ARM_MATH_SUCCESS</code> if initialization was successful or
01849    * <code>ARM_MATH_ARGUMENT_ERROR</code> if <code>numTaps</code> is not a supported value.
01850    */
01851   arm_status arm_fir_init_q15(
01852         arm_fir_instance_q15 * S,
01853         uint16_t numTaps,
01854   const q15_t * pCoeffs,
01855         q15_t * pState,
01856         uint32_t blockSize);
01857 
01858   /**
01859    * @brief Processing function for the Q31 FIR filter.
01860    * @param[in]  S          points to an instance of the Q31 FIR filter structure.
01861    * @param[in]  pSrc       points to the block of input data.
01862    * @param[out] pDst       points to the block of output data.
01863    * @param[in]  blockSize  number of samples to process.
01864    */
01865   void arm_fir_q31(
01866   const arm_fir_instance_q31 * S,
01867   const q31_t * pSrc,
01868         q31_t * pDst,
01869         uint32_t blockSize);
01870 
01871   /**
01872    * @brief Processing function for the fast Q31 FIR filter (fast version).
01873    * @param[in]  S          points to an instance of the Q31 FIR filter structure.
01874    * @param[in]  pSrc       points to the block of input data.
01875    * @param[out] pDst       points to the block of output data.
01876    * @param[in]  blockSize  number of samples to process.
01877    */
01878   void arm_fir_fast_q31(
01879   const arm_fir_instance_q31 * S,
01880   const q31_t * pSrc,
01881         q31_t * pDst,
01882         uint32_t blockSize);
01883 
01884   /**
01885    * @brief  Initialization function for the Q31 FIR filter.
01886    * @param[in,out] S          points to an instance of the Q31 FIR structure.
01887    * @param[in]     numTaps    Number of filter coefficients in the filter.
01888    * @param[in]     pCoeffs    points to the filter coefficients.
01889    * @param[in]     pState     points to the state buffer.
01890    * @param[in]     blockSize  number of samples that are processed at a time.
01891    */
01892   void arm_fir_init_q31(
01893         arm_fir_instance_q31 * S,
01894         uint16_t numTaps,
01895   const q31_t * pCoeffs,
01896         q31_t * pState,
01897         uint32_t blockSize);
01898 
01899   /**
01900    * @brief Processing function for the floating-point FIR filter.
01901    * @param[in]  S          points to an instance of the floating-point FIR structure.
01902    * @param[in]  pSrc       points to the block of input data.
01903    * @param[out] pDst       points to the block of output data.
01904    * @param[in]  blockSize  number of samples to process.
01905    */
01906   void arm_fir_f32(
01907   const arm_fir_instance_f32 * S,
01908   const float32_t * pSrc,
01909         float32_t * pDst,
01910         uint32_t blockSize);
01911 
01912   /**
01913    * @brief  Initialization function for the floating-point FIR filter.
01914    * @param[in,out] S          points to an instance of the floating-point FIR filter structure.
01915    * @param[in]     numTaps    Number of filter coefficients in the filter.
01916    * @param[in]     pCoeffs    points to the filter coefficients.
01917    * @param[in]     pState     points to the state buffer.
01918    * @param[in]     blockSize  number of samples that are processed at a time.
01919    */
01920   void arm_fir_init_f32(
01921         arm_fir_instance_f32 * S,
01922         uint16_t numTaps,
01923   const float32_t * pCoeffs,
01924         float32_t * pState,
01925         uint32_t blockSize);
01926 
01927   /**
01928    * @brief Instance structure for the Q15 Biquad cascade filter.
01929    */
01930   typedef struct
01931   {
01932           int8_t numStages;        /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
01933           q15_t *pState;           /**< Points to the array of state coefficients.  The array is of length 4*numStages. */
01934     const q15_t *pCoeffs;          /**< Points to the array of coefficients.  The array is of length 5*numStages. */
01935           int8_t postShift;        /**< Additional shift, in bits, applied to each output sample. */
01936   } arm_biquad_casd_df1_inst_q15;
01937 
01938   /**
01939    * @brief Instance structure for the Q31 Biquad cascade filter.
01940    */
01941   typedef struct
01942   {
01943           uint32_t numStages;      /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
01944           q31_t *pState;           /**< Points to the array of state coefficients.  The array is of length 4*numStages. */
01945     const q31_t *pCoeffs;          /**< Points to the array of coefficients.  The array is of length 5*numStages. */
01946           uint8_t postShift;       /**< Additional shift, in bits, applied to each output sample. */
01947   } arm_biquad_casd_df1_inst_q31;
01948 
01949   /**
01950    * @brief Instance structure for the floating-point Biquad cascade filter.
01951    */
01952   typedef struct
01953   {
01954           uint32_t numStages;      /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
01955           float32_t *pState;       /**< Points to the array of state coefficients.  The array is of length 4*numStages. */
01956     const float32_t *pCoeffs;      /**< Points to the array of coefficients.  The array is of length 5*numStages. */
01957   } arm_biquad_casd_df1_inst_f32;
01958 
01959 #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
01960   /**
01961    * @brief Instance structure for the modified Biquad coefs required by vectorized code.
01962    */
01963   typedef struct
01964   {
01965       float32_t coeffs[8][4]; /**< Points to the array of modified coefficients.  The array is of length 32. There is one per stage */
01966   } arm_biquad_mod_coef_f32;
01967 #endif 
01968 
01969   /**
01970    * @brief Processing function for the Q15 Biquad cascade filter.
01971    * @param[in]  S          points to an instance of the Q15 Biquad cascade structure.
01972    * @param[in]  pSrc       points to the block of input data.
01973    * @param[out] pDst       points to the block of output data.
01974    * @param[in]  blockSize  number of samples to process.
01975    */
01976   void arm_biquad_cascade_df1_q15(
01977   const arm_biquad_casd_df1_inst_q15 * S,
01978   const q15_t * pSrc,
01979         q15_t * pDst,
01980         uint32_t blockSize);
01981 
01982   /**
01983    * @brief  Initialization function for the Q15 Biquad cascade filter.
01984    * @param[in,out] S          points to an instance of the Q15 Biquad cascade structure.
01985    * @param[in]     numStages  number of 2nd order stages in the filter.
01986    * @param[in]     pCoeffs    points to the filter coefficients.
01987    * @param[in]     pState     points to the state buffer.
01988    * @param[in]     postShift  Shift to be applied to the output. Varies according to the coefficients format
01989    */
01990   void arm_biquad_cascade_df1_init_q15(
01991         arm_biquad_casd_df1_inst_q15 * S,
01992         uint8_t numStages,
01993   const q15_t * pCoeffs,
01994         q15_t * pState,
01995         int8_t postShift);
01996 
01997   /**
01998    * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
01999    * @param[in]  S          points to an instance of the Q15 Biquad cascade structure.
02000    * @param[in]  pSrc       points to the block of input data.
02001    * @param[out] pDst       points to the block of output data.
02002    * @param[in]  blockSize  number of samples to process.
02003    */
02004   void arm_biquad_cascade_df1_fast_q15(
02005   const arm_biquad_casd_df1_inst_q15 * S,
02006   const q15_t * pSrc,
02007         q15_t * pDst,
02008         uint32_t blockSize);
02009 
02010   /**
02011    * @brief Processing function for the Q31 Biquad cascade filter
02012    * @param[in]  S          points to an instance of the Q31 Biquad cascade structure.
02013    * @param[in]  pSrc       points to the block of input data.
02014    * @param[out] pDst       points to the block of output data.
02015    * @param[in]  blockSize  number of samples to process.
02016    */
02017   void arm_biquad_cascade_df1_q31(
02018   const arm_biquad_casd_df1_inst_q31 * S,
02019   const q31_t * pSrc,
02020         q31_t * pDst,
02021         uint32_t blockSize);
02022 
02023   /**
02024    * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
02025    * @param[in]  S          points to an instance of the Q31 Biquad cascade structure.
02026    * @param[in]  pSrc       points to the block of input data.
02027    * @param[out] pDst       points to the block of output data.
02028    * @param[in]  blockSize  number of samples to process.
02029    */
02030   void arm_biquad_cascade_df1_fast_q31(
02031   const arm_biquad_casd_df1_inst_q31 * S,
02032   const q31_t * pSrc,
02033         q31_t * pDst,
02034         uint32_t blockSize);
02035 
02036   /**
02037    * @brief  Initialization function for the Q31 Biquad cascade filter.
02038    * @param[in,out] S          points to an instance of the Q31 Biquad cascade structure.
02039    * @param[in]     numStages  number of 2nd order stages in the filter.
02040    * @param[in]     pCoeffs    points to the filter coefficients.
02041    * @param[in]     pState     points to the state buffer.
02042    * @param[in]     postShift  Shift to be applied to the output. Varies according to the coefficients format
02043    */
02044   void arm_biquad_cascade_df1_init_q31(
02045         arm_biquad_casd_df1_inst_q31 * S,
02046         uint8_t numStages,
02047   const q31_t * pCoeffs,
02048         q31_t * pState,
02049         int8_t postShift);
02050 
02051   /**
02052    * @brief Processing function for the floating-point Biquad cascade filter.
02053    * @param[in]  S          points to an instance of the floating-point Biquad cascade structure.
02054    * @param[in]  pSrc       points to the block of input data.
02055    * @param[out] pDst       points to the block of output data.
02056    * @param[in]  blockSize  number of samples to process.
02057    */
02058   void arm_biquad_cascade_df1_f32(
02059   const arm_biquad_casd_df1_inst_f32 * S,
02060   const float32_t * pSrc,
02061         float32_t * pDst,
02062         uint32_t blockSize);
02063 
02064   /**
02065    * @brief  Initialization function for the floating-point Biquad cascade filter.
02066    * @param[in,out] S          points to an instance of the floating-point Biquad cascade structure.
02067    * @param[in]     numStages  number of 2nd order stages in the filter.
02068    * @param[in]     pCoeffs    points to the filter coefficients.
02069    * @param[in]     pCoeffsMod points to the modified filter coefficients (only MVE version).
02070    * @param[in]     pState     points to the state buffer.
02071    */
02072 #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
02073   void arm_biquad_cascade_df1_mve_init_f32(
02074       arm_biquad_casd_df1_inst_f32 * S,
02075       uint8_t numStages,
02076       const float32_t * pCoeffs, 
02077       arm_biquad_mod_coef_f32 * pCoeffsMod, 
02078       float32_t * pState);
02079 #endif
02080   
02081   void arm_biquad_cascade_df1_init_f32(
02082         arm_biquad_casd_df1_inst_f32 * S,
02083         uint8_t numStages,
02084   const float32_t * pCoeffs,
02085         float32_t * pState);
02086 
02087 
02088   /**
02089    * @brief         Compute the logical bitwise AND of two fixed-point vectors.
02090    * @param[in]     pSrcA      points to input vector A
02091    * @param[in]     pSrcB      points to input vector B
02092    * @param[out]    pDst       points to output vector
02093    * @param[in]     blockSize  number of samples in each vector
02094    * @return        none
02095    */
02096   void arm_and_u16(
02097     const uint16_t * pSrcA,
02098     const uint16_t * pSrcB,
02099           uint16_t * pDst,
02100           uint32_t blockSize);
02101 
02102   /**
02103    * @brief         Compute the logical bitwise AND of two fixed-point vectors.
02104    * @param[in]     pSrcA      points to input vector A
02105    * @param[in]     pSrcB      points to input vector B
02106    * @param[out]    pDst       points to output vector
02107    * @param[in]     blockSize  number of samples in each vector
02108    * @return        none
02109    */
02110   void arm_and_u32(
02111     const uint32_t * pSrcA,
02112     const uint32_t * pSrcB,
02113           uint32_t * pDst,
02114           uint32_t blockSize);
02115 
02116   /**
02117    * @brief         Compute the logical bitwise AND of two fixed-point vectors.
02118    * @param[in]     pSrcA      points to input vector A
02119    * @param[in]     pSrcB      points to input vector B
02120    * @param[out]    pDst       points to output vector
02121    * @param[in]     blockSize  number of samples in each vector
02122    * @return        none
02123    */
02124   void arm_and_u8(
02125     const uint8_t * pSrcA,
02126     const uint8_t * pSrcB,
02127           uint8_t * pDst,
02128           uint32_t blockSize);
02129 
02130   /**
02131    * @brief         Compute the logical bitwise OR of two fixed-point vectors.
02132    * @param[in]     pSrcA      points to input vector A
02133    * @param[in]     pSrcB      points to input vector B
02134    * @param[out]    pDst       points to output vector
02135    * @param[in]     blockSize  number of samples in each vector
02136    * @return        none
02137    */
02138   void arm_or_u16(
02139     const uint16_t * pSrcA,
02140     const uint16_t * pSrcB,
02141           uint16_t * pDst,
02142           uint32_t blockSize);
02143 
02144   /**
02145    * @brief         Compute the logical bitwise OR of two fixed-point vectors.
02146    * @param[in]     pSrcA      points to input vector A
02147    * @param[in]     pSrcB      points to input vector B
02148    * @param[out]    pDst       points to output vector
02149    * @param[in]     blockSize  number of samples in each vector
02150    * @return        none
02151    */
02152   void arm_or_u32(
02153     const uint32_t * pSrcA,
02154     const uint32_t * pSrcB,
02155           uint32_t * pDst,
02156           uint32_t blockSize);
02157 
02158   /**
02159    * @brief         Compute the logical bitwise OR of two fixed-point vectors.
02160    * @param[in]     pSrcA      points to input vector A
02161    * @param[in]     pSrcB      points to input vector B
02162    * @param[out]    pDst       points to output vector
02163    * @param[in]     blockSize  number of samples in each vector
02164    * @return        none
02165    */
02166   void arm_or_u8(
02167     const uint8_t * pSrcA,
02168     const uint8_t * pSrcB,
02169           uint8_t * pDst,
02170           uint32_t blockSize);
02171 
02172   /**
02173    * @brief         Compute the logical bitwise NOT of a fixed-point vector.
02174    * @param[in]     pSrc       points to input vector 
02175    * @param[out]    pDst       points to output vector
02176    * @param[in]     blockSize  number of samples in each vector
02177    * @return        none
02178    */
02179   void arm_not_u16(
02180     const uint16_t * pSrc,
02181           uint16_t * pDst,
02182           uint32_t blockSize);
02183 
02184   /**
02185    * @brief         Compute the logical bitwise NOT of a fixed-point vector.
02186    * @param[in]     pSrc       points to input vector 
02187    * @param[out]    pDst       points to output vector
02188    * @param[in]     blockSize  number of samples in each vector
02189    * @return        none
02190    */
02191   void arm_not_u32(
02192     const uint32_t * pSrc,
02193           uint32_t * pDst,
02194           uint32_t blockSize);
02195 
02196   /**
02197    * @brief         Compute the logical bitwise NOT of a fixed-point vector.
02198    * @param[in]     pSrc       points to input vector 
02199    * @param[out]    pDst       points to output vector
02200    * @param[in]     blockSize  number of samples in each vector
02201    * @return        none
02202    */
02203   void arm_not_u8(
02204     const uint8_t * pSrc,
02205           uint8_t * pDst,
02206           uint32_t blockSize);
02207 
02208 /**
02209    * @brief         Compute the logical bitwise XOR of two fixed-point vectors.
02210    * @param[in]     pSrcA      points to input vector A
02211    * @param[in]     pSrcB      points to input vector B
02212    * @param[out]    pDst       points to output vector
02213    * @param[in]     blockSize  number of samples in each vector
02214    * @return        none
02215    */
02216   void arm_xor_u16(
02217     const uint16_t * pSrcA,
02218     const uint16_t * pSrcB,
02219           uint16_t * pDst,
02220           uint32_t blockSize);
02221 
02222   /**
02223    * @brief         Compute the logical bitwise XOR of two fixed-point vectors.
02224    * @param[in]     pSrcA      points to input vector A
02225    * @param[in]     pSrcB      points to input vector B
02226    * @param[out]    pDst       points to output vector
02227    * @param[in]     blockSize  number of samples in each vector
02228    * @return        none
02229    */
02230   void arm_xor_u32(
02231     const uint32_t * pSrcA,
02232     const uint32_t * pSrcB,
02233           uint32_t * pDst,
02234           uint32_t blockSize);
02235 
02236   /**
02237    * @brief         Compute the logical bitwise XOR of two fixed-point vectors.
02238    * @param[in]     pSrcA      points to input vector A
02239    * @param[in]     pSrcB      points to input vector B
02240    * @param[out]    pDst       points to output vector
02241    * @param[in]     blockSize  number of samples in each vector
02242    * @return        none
02243    */
02244   void arm_xor_u8(
02245     const uint8_t * pSrcA,
02246     const uint8_t * pSrcB,
02247           uint8_t * pDst,
02248     uint32_t blockSize);
02249 
02250   /**
02251    * @brief Struct for specifying sorting algorithm
02252    */
02253   typedef enum
02254   {
02255     ARM_SORT_BITONIC   = 0,
02256              /**< Bitonic sort   */
02257     ARM_SORT_BUBBLE    = 1,
02258              /**< Bubble sort    */
02259     ARM_SORT_HEAP      = 2,
02260              /**< Heap sort      */
02261     ARM_SORT_INSERTION = 3,
02262              /**< Insertion sort */
02263     ARM_SORT_QUICK     = 4,
02264              /**< Quick sort     */
02265     ARM_SORT_SELECTION = 5
02266              /**< Selection sort */
02267   } arm_sort_alg;
02268 
02269   /**
02270    * @brief Struct for specifying sorting algorithm
02271    */
02272   typedef enum
02273   {
02274     ARM_SORT_DESCENDING = 0,
02275              /**< Descending order (9 to 0) */
02276     ARM_SORT_ASCENDING = 1
02277              /**< Ascending order (0 to 9) */
02278   } arm_sort_dir;
02279 
02280   /**
02281    * @brief Instance structure for the sorting algorithms.
02282    */
02283   typedef struct            
02284   {
02285     arm_sort_alg alg;        /**< Sorting algorithm selected */
02286     arm_sort_dir dir;        /**< Sorting order (direction)  */
02287   } arm_sort_instance_f32;  
02288 
02289   /**
02290    * @param[in]  S          points to an instance of the sorting structure.
02291    * @param[in]  pSrc       points to the block of input data.
02292    * @param[out] pDst       points to the block of output data.
02293    * @param[in]  blockSize  number of samples to process.
02294    */
02295   void arm_sort_f32(
02296     const arm_sort_instance_f32 * S, 
02297           float32_t * pSrc, 
02298           float32_t * pDst, 
02299           uint32_t blockSize);
02300 
02301   /**
02302    * @param[in,out]  S            points to an instance of the sorting structure.
02303    * @param[in]      alg          Selected algorithm.
02304    * @param[in]      dir          Sorting order.
02305    */
02306   void arm_sort_init_f32(
02307     arm_sort_instance_f32 * S, 
02308     arm_sort_alg alg, 
02309     arm_sort_dir dir); 
02310 
02311   /**
02312    * @brief Instance structure for the sorting algorithms.
02313    */
02314   typedef struct            
02315   {
02316     arm_sort_dir dir;        /**< Sorting order (direction)  */
02317     float32_t * buffer;      /**< Working buffer */
02318   } arm_merge_sort_instance_f32;  
02319 
02320   /**
02321    * @param[in]      S          points to an instance of the sorting structure.
02322    * @param[in,out]  pSrc       points to the block of input data.
02323    * @param[out]     pDst       points to the block of output data
02324    * @param[in]      blockSize  number of samples to process.
02325    */
02326   void arm_merge_sort_f32(
02327     const arm_merge_sort_instance_f32 * S,
02328           float32_t *pSrc,
02329           float32_t *pDst,
02330           uint32_t blockSize);
02331 
02332   /**
02333    * @param[in,out]  S            points to an instance of the sorting structure.
02334    * @param[in]      dir          Sorting order.
02335    * @param[in]      buffer       Working buffer.
02336    */
02337   void arm_merge_sort_init_f32(
02338     arm_merge_sort_instance_f32 * S,
02339     arm_sort_dir dir,
02340     float32_t * buffer);
02341 
02342   /**
02343    * @brief Struct for specifying cubic spline type
02344    */
02345   typedef enum
02346   {
02347     ARM_SPLINE_NATURAL = 0,           /**< Natural spline */
02348     ARM_SPLINE_PARABOLIC_RUNOUT = 1   /**< Parabolic runout spline */
02349   } arm_spline_type;
02350 
02351   /**
02352    * @brief Instance structure for the floating-point cubic spline interpolation.
02353    */
02354   typedef struct
02355   {
02356     arm_spline_type type;      /**< Type (boundary conditions) */
02357     const float32_t * x;       /**< x values */
02358     const float32_t * y;       /**< y values */
02359     uint32_t n_x;              /**< Number of known data points */
02360     float32_t * coeffs;        /**< Coefficients buffer (b,c, and d) */
02361   } arm_spline_instance_f32;
02362 
02363   /**
02364    * @brief Processing function for the floating-point cubic spline interpolation.
02365    * @param[in]  S          points to an instance of the floating-point spline structure.
02366    * @param[in]  xq         points to the x values ot the interpolated data points.
02367    * @param[out] pDst       points to the block of output data.
02368    * @param[in]  blockSize  number of samples of output data.
02369    */
02370   void arm_spline_f32(
02371         arm_spline_instance_f32 * S, 
02372   const float32_t * xq,
02373         float32_t * pDst,
02374         uint32_t blockSize);
02375 
02376   /**
02377    * @brief Initialization function for the floating-point cubic spline interpolation.
02378    * @param[in,out] S        points to an instance of the floating-point spline structure.
02379    * @param[in]     type     type of cubic spline interpolation (boundary conditions)
02380    * @param[in]     x        points to the x values of the known data points.
02381    * @param[in]     y        points to the y values of the known data points.
02382    * @param[in]     n        number of known data points.
02383    * @param[in]     coeffs   coefficients array for b, c, and d
02384    * @param[in]     tempBuffer   buffer array for internal computations
02385    */
02386   void arm_spline_init_f32(
02387           arm_spline_instance_f32 * S,
02388           arm_spline_type type,
02389     const float32_t * x,
02390     const float32_t * y,
02391           uint32_t n, 
02392           float32_t * coeffs,
02393           float32_t * tempBuffer);
02394 
02395   /**
02396    * @brief Instance structure for the floating-point matrix structure.
02397    */
02398   typedef struct
02399   {
02400     uint16_t numRows;     /**< number of rows of the matrix.     */
02401     uint16_t numCols;     /**< number of columns of the matrix.  */
02402     float32_t *pData;     /**< points to the data of the matrix. */
02403   } arm_matrix_instance_f32;
02404  
02405  /**
02406    * @brief Instance structure for the floating-point matrix structure.
02407    */
02408   typedef struct
02409   {
02410     uint16_t numRows;     /**< number of rows of the matrix.     */
02411     uint16_t numCols;     /**< number of columns of the matrix.  */
02412     float64_t *pData;     /**< points to the data of the matrix. */
02413   } arm_matrix_instance_f64;
02414 
02415   /**
02416    * @brief Instance structure for the Q15 matrix structure.
02417    */
02418   typedef struct
02419   {
02420     uint16_t numRows;     /**< number of rows of the matrix.     */
02421     uint16_t numCols;     /**< number of columns of the matrix.  */
02422     q15_t *pData;         /**< points to the data of the matrix. */
02423   } arm_matrix_instance_q15;
02424 
02425   /**
02426    * @brief Instance structure for the Q31 matrix structure.
02427    */
02428   typedef struct
02429   {
02430     uint16_t numRows;     /**< number of rows of the matrix.     */
02431     uint16_t numCols;     /**< number of columns of the matrix.  */
02432     q31_t *pData;         /**< points to the data of the matrix. */
02433   } arm_matrix_instance_q31;
02434 
02435   /**
02436    * @brief Floating-point matrix addition.
02437    * @param[in]  pSrcA  points to the first input matrix structure
02438    * @param[in]  pSrcB  points to the second input matrix structure
02439    * @param[out] pDst   points to output matrix structure
02440    * @return     The function returns either
02441    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02442    */
02443 arm_status arm_mat_add_f32(
02444   const arm_matrix_instance_f32 * pSrcA,
02445   const arm_matrix_instance_f32 * pSrcB,
02446         arm_matrix_instance_f32 * pDst);
02447 
02448   /**
02449    * @brief Q15 matrix addition.
02450    * @param[in]   pSrcA  points to the first input matrix structure
02451    * @param[in]   pSrcB  points to the second input matrix structure
02452    * @param[out]  pDst   points to output matrix structure
02453    * @return     The function returns either
02454    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02455    */
02456 arm_status arm_mat_add_q15(
02457   const arm_matrix_instance_q15 * pSrcA,
02458   const arm_matrix_instance_q15 * pSrcB,
02459         arm_matrix_instance_q15 * pDst);
02460 
02461   /**
02462    * @brief Q31 matrix addition.
02463    * @param[in]  pSrcA  points to the first input matrix structure
02464    * @param[in]  pSrcB  points to the second input matrix structure
02465    * @param[out] pDst   points to output matrix structure
02466    * @return     The function returns either
02467    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02468    */
02469 arm_status arm_mat_add_q31(
02470   const arm_matrix_instance_q31 * pSrcA,
02471   const arm_matrix_instance_q31 * pSrcB,
02472         arm_matrix_instance_q31 * pDst);
02473 
02474   /**
02475    * @brief Floating-point, complex, matrix multiplication.
02476    * @param[in]  pSrcA  points to the first input matrix structure
02477    * @param[in]  pSrcB  points to the second input matrix structure
02478    * @param[out] pDst   points to output matrix structure
02479    * @return     The function returns either
02480    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02481    */
02482 arm_status arm_mat_cmplx_mult_f32(
02483   const arm_matrix_instance_f32 * pSrcA,
02484   const arm_matrix_instance_f32 * pSrcB,
02485         arm_matrix_instance_f32 * pDst);
02486 
02487   /**
02488    * @brief Q15, complex,  matrix multiplication.
02489    * @param[in]  pSrcA  points to the first input matrix structure
02490    * @param[in]  pSrcB  points to the second input matrix structure
02491    * @param[out] pDst   points to output matrix structure
02492    * @return     The function returns either
02493    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02494    */
02495 arm_status arm_mat_cmplx_mult_q15(
02496   const arm_matrix_instance_q15 * pSrcA,
02497   const arm_matrix_instance_q15 * pSrcB,
02498         arm_matrix_instance_q15 * pDst,
02499         q15_t * pScratch);
02500 
02501   /**
02502    * @brief Q31, complex, matrix multiplication.
02503    * @param[in]  pSrcA  points to the first input matrix structure
02504    * @param[in]  pSrcB  points to the second input matrix structure
02505    * @param[out] pDst   points to output matrix structure
02506    * @return     The function returns either
02507    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02508    */
02509 arm_status arm_mat_cmplx_mult_q31(
02510   const arm_matrix_instance_q31 * pSrcA,
02511   const arm_matrix_instance_q31 * pSrcB,
02512         arm_matrix_instance_q31 * pDst);
02513 
02514   /**
02515    * @brief Floating-point matrix transpose.
02516    * @param[in]  pSrc  points to the input matrix
02517    * @param[out] pDst  points to the output matrix
02518    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
02519    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02520    */
02521 arm_status arm_mat_trans_f32(
02522   const arm_matrix_instance_f32 * pSrc,
02523         arm_matrix_instance_f32 * pDst);
02524 
02525   /**
02526    * @brief Q15 matrix transpose.
02527    * @param[in]  pSrc  points to the input matrix
02528    * @param[out] pDst  points to the output matrix
02529    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
02530    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02531    */
02532 arm_status arm_mat_trans_q15(
02533   const arm_matrix_instance_q15 * pSrc,
02534         arm_matrix_instance_q15 * pDst);
02535 
02536   /**
02537    * @brief Q31 matrix transpose.
02538    * @param[in]  pSrc  points to the input matrix
02539    * @param[out] pDst  points to the output matrix
02540    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
02541    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02542    */
02543 arm_status arm_mat_trans_q31(
02544   const arm_matrix_instance_q31 * pSrc,
02545         arm_matrix_instance_q31 * pDst);
02546 
02547   /**
02548    * @brief Floating-point matrix multiplication
02549    * @param[in]  pSrcA  points to the first input matrix structure
02550    * @param[in]  pSrcB  points to the second input matrix structure
02551    * @param[out] pDst   points to output matrix structure
02552    * @return     The function returns either
02553    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02554    */
02555 arm_status arm_mat_mult_f32(
02556   const arm_matrix_instance_f32 * pSrcA,
02557   const arm_matrix_instance_f32 * pSrcB,
02558         arm_matrix_instance_f32 * pDst);
02559 
02560   /**
02561    * @brief Q15 matrix multiplication
02562    * @param[in]  pSrcA   points to the first input matrix structure
02563    * @param[in]  pSrcB   points to the second input matrix structure
02564    * @param[out] pDst    points to output matrix structure
02565    * @param[in]  pState  points to the array for storing intermediate results
02566    * @return     The function returns either
02567    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02568    */
02569 arm_status arm_mat_mult_q15(
02570   const arm_matrix_instance_q15 * pSrcA,
02571   const arm_matrix_instance_q15 * pSrcB,
02572         arm_matrix_instance_q15 * pDst,
02573         q15_t * pState);
02574 
02575   /**
02576    * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
02577    * @param[in]  pSrcA   points to the first input matrix structure
02578    * @param[in]  pSrcB   points to the second input matrix structure
02579    * @param[out] pDst    points to output matrix structure
02580    * @param[in]  pState  points to the array for storing intermediate results
02581    * @return     The function returns either
02582    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02583    */
02584 arm_status arm_mat_mult_fast_q15(
02585   const arm_matrix_instance_q15 * pSrcA,
02586   const arm_matrix_instance_q15 * pSrcB,
02587         arm_matrix_instance_q15 * pDst,
02588         q15_t * pState);
02589 
02590   /**
02591    * @brief Q31 matrix multiplication
02592    * @param[in]  pSrcA  points to the first input matrix structure
02593    * @param[in]  pSrcB  points to the second input matrix structure
02594    * @param[out] pDst   points to output matrix structure
02595    * @return     The function returns either
02596    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02597    */
02598 arm_status arm_mat_mult_q31(
02599   const arm_matrix_instance_q31 * pSrcA,
02600   const arm_matrix_instance_q31 * pSrcB,
02601         arm_matrix_instance_q31 * pDst);
02602 
02603   /**
02604    * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
02605    * @param[in]  pSrcA  points to the first input matrix structure
02606    * @param[in]  pSrcB  points to the second input matrix structure
02607    * @param[out] pDst   points to output matrix structure
02608    * @return     The function returns either
02609    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02610    */
02611 arm_status arm_mat_mult_fast_q31(
02612   const arm_matrix_instance_q31 * pSrcA,
02613   const arm_matrix_instance_q31 * pSrcB,
02614         arm_matrix_instance_q31 * pDst);
02615 
02616   /**
02617    * @brief Floating-point matrix subtraction
02618    * @param[in]  pSrcA  points to the first input matrix structure
02619    * @param[in]  pSrcB  points to the second input matrix structure
02620    * @param[out] pDst   points to output matrix structure
02621    * @return     The function returns either
02622    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02623    */
02624 arm_status arm_mat_sub_f32(
02625   const arm_matrix_instance_f32 * pSrcA,
02626   const arm_matrix_instance_f32 * pSrcB,
02627         arm_matrix_instance_f32 * pDst);
02628 
02629   /**
02630    * @brief Q15 matrix subtraction
02631    * @param[in]  pSrcA  points to the first input matrix structure
02632    * @param[in]  pSrcB  points to the second input matrix structure
02633    * @param[out] pDst   points to output matrix structure
02634    * @return     The function returns either
02635    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02636    */
02637 arm_status arm_mat_sub_q15(
02638   const arm_matrix_instance_q15 * pSrcA,
02639   const arm_matrix_instance_q15 * pSrcB,
02640         arm_matrix_instance_q15 * pDst);
02641 
02642   /**
02643    * @brief Q31 matrix subtraction
02644    * @param[in]  pSrcA  points to the first input matrix structure
02645    * @param[in]  pSrcB  points to the second input matrix structure
02646    * @param[out] pDst   points to output matrix structure
02647    * @return     The function returns either
02648    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02649    */
02650 arm_status arm_mat_sub_q31(
02651   const arm_matrix_instance_q31 * pSrcA,
02652   const arm_matrix_instance_q31 * pSrcB,
02653         arm_matrix_instance_q31 * pDst);
02654 
02655   /**
02656    * @brief Floating-point matrix scaling.
02657    * @param[in]  pSrc   points to the input matrix
02658    * @param[in]  scale  scale factor
02659    * @param[out] pDst   points to the output matrix
02660    * @return     The function returns either
02661    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02662    */
02663 arm_status arm_mat_scale_f32(
02664   const arm_matrix_instance_f32 * pSrc,
02665         float32_t scale,
02666         arm_matrix_instance_f32 * pDst);
02667 
02668   /**
02669    * @brief Q15 matrix scaling.
02670    * @param[in]  pSrc        points to input matrix
02671    * @param[in]  scaleFract  fractional portion of the scale factor
02672    * @param[in]  shift       number of bits to shift the result by
02673    * @param[out] pDst        points to output matrix
02674    * @return     The function returns either
02675    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02676    */
02677 arm_status arm_mat_scale_q15(
02678   const arm_matrix_instance_q15 * pSrc,
02679         q15_t scaleFract,
02680         int32_t shift,
02681         arm_matrix_instance_q15 * pDst);
02682 
02683   /**
02684    * @brief Q31 matrix scaling.
02685    * @param[in]  pSrc        points to input matrix
02686    * @param[in]  scaleFract  fractional portion of the scale factor
02687    * @param[in]  shift       number of bits to shift the result by
02688    * @param[out] pDst        points to output matrix structure
02689    * @return     The function returns either
02690    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
02691    */
02692 arm_status arm_mat_scale_q31(
02693   const arm_matrix_instance_q31 * pSrc,
02694         q31_t scaleFract,
02695         int32_t shift,
02696         arm_matrix_instance_q31 * pDst);
02697 
02698   /**
02699    * @brief  Q31 matrix initialization.
02700    * @param[in,out] S         points to an instance of the floating-point matrix structure.
02701    * @param[in]     nRows     number of rows in the matrix.
02702    * @param[in]     nColumns  number of columns in the matrix.
02703    * @param[in]     pData     points to the matrix data array.
02704    */
02705 void arm_mat_init_q31(
02706         arm_matrix_instance_q31 * S,
02707         uint16_t nRows,
02708         uint16_t nColumns,
02709         q31_t * pData);
02710 
02711   /**
02712    * @brief  Q15 matrix initialization.
02713    * @param[in,out] S         points to an instance of the floating-point matrix structure.
02714    * @param[in]     nRows     number of rows in the matrix.
02715    * @param[in]     nColumns  number of columns in the matrix.
02716    * @param[in]     pData     points to the matrix data array.
02717    */
02718 void arm_mat_init_q15(
02719         arm_matrix_instance_q15 * S,
02720         uint16_t nRows,
02721         uint16_t nColumns,
02722         q15_t * pData);
02723 
02724   /**
02725    * @brief  Floating-point matrix initialization.
02726    * @param[in,out] S         points to an instance of the floating-point matrix structure.
02727    * @param[in]     nRows     number of rows in the matrix.
02728    * @param[in]     nColumns  number of columns in the matrix.
02729    * @param[in]     pData     points to the matrix data array.
02730    */
02731 void arm_mat_init_f32(
02732         arm_matrix_instance_f32 * S,
02733         uint16_t nRows,
02734         uint16_t nColumns,
02735         float32_t * pData);
02736 
02737 
02738   /**
02739    * @brief Instance structure for the Q15 PID Control.
02740    */
02741   typedef struct
02742   {
02743           q15_t A0;           /**< The derived gain, A0 = Kp + Ki + Kd . */
02744 #if !defined (ARM_MATH_DSP)
02745           q15_t A1;
02746           q15_t A2;
02747 #else
02748           q31_t A1;           /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
02749 #endif
02750           q15_t state[3];     /**< The state array of length 3. */
02751           q15_t Kp;           /**< The proportional gain. */
02752           q15_t Ki;           /**< The integral gain. */
02753           q15_t Kd;           /**< The derivative gain. */
02754   } arm_pid_instance_q15;
02755 
02756   /**
02757    * @brief Instance structure for the Q31 PID Control.
02758    */
02759   typedef struct
02760   {
02761           q31_t A0;            /**< The derived gain, A0 = Kp + Ki + Kd . */
02762           q31_t A1;            /**< The derived gain, A1 = -Kp - 2Kd. */
02763           q31_t A2;            /**< The derived gain, A2 = Kd . */
02764           q31_t state[3];      /**< The state array of length 3. */
02765           q31_t Kp;            /**< The proportional gain. */
02766           q31_t Ki;            /**< The integral gain. */
02767           q31_t Kd;            /**< The derivative gain. */
02768   } arm_pid_instance_q31;
02769 
02770   /**
02771    * @brief Instance structure for the floating-point PID Control.
02772    */
02773   typedef struct
02774   {
02775           float32_t A0;          /**< The derived gain, A0 = Kp + Ki + Kd . */
02776           float32_t A1;          /**< The derived gain, A1 = -Kp - 2Kd. */
02777           float32_t A2;          /**< The derived gain, A2 = Kd . */
02778           float32_t state[3];    /**< The state array of length 3. */
02779           float32_t Kp;          /**< The proportional gain. */
02780           float32_t Ki;          /**< The integral gain. */
02781           float32_t Kd;          /**< The derivative gain. */
02782   } arm_pid_instance_f32;
02783 
02784 
02785 
02786   /**
02787    * @brief  Initialization function for the floating-point PID Control.
02788    * @param[in,out] S               points to an instance of the PID structure.
02789    * @param[in]     resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.
02790    */
02791   void arm_pid_init_f32(
02792         arm_pid_instance_f32 * S,
02793         int32_t resetStateFlag);
02794 
02795 
02796   /**
02797    * @brief  Reset function for the floating-point PID Control.
02798    * @param[in,out] S  is an instance of the floating-point PID Control structure
02799    */
02800   void arm_pid_reset_f32(
02801         arm_pid_instance_f32 * S);
02802 
02803 
02804   /**
02805    * @brief  Initialization function for the Q31 PID Control.
02806    * @param[in,out] S               points to an instance of the Q15 PID structure.
02807    * @param[in]     resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.
02808    */
02809   void arm_pid_init_q31(
02810         arm_pid_instance_q31 * S,
02811         int32_t resetStateFlag);
02812 
02813 
02814   /**
02815    * @brief  Reset function for the Q31 PID Control.
02816    * @param[in,out] S   points to an instance of the Q31 PID Control structure
02817    */
02818 
02819   void arm_pid_reset_q31(
02820         arm_pid_instance_q31 * S);
02821 
02822 
02823   /**
02824    * @brief  Initialization function for the Q15 PID Control.
02825    * @param[in,out] S               points to an instance of the Q15 PID structure.
02826    * @param[in]     resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.
02827    */
02828   void arm_pid_init_q15(
02829         arm_pid_instance_q15 * S,
02830         int32_t resetStateFlag);
02831 
02832 
02833   /**
02834    * @brief  Reset function for the Q15 PID Control.
02835    * @param[in,out] S  points to an instance of the q15 PID Control structure
02836    */
02837   void arm_pid_reset_q15(
02838         arm_pid_instance_q15 * S);
02839 
02840 
02841   /**
02842    * @brief Instance structure for the floating-point Linear Interpolate function.
02843    */
02844   typedef struct
02845   {
02846           uint32_t nValues;           /**< nValues */
02847           float32_t x1;               /**< x1 */
02848           float32_t xSpacing;         /**< xSpacing */
02849           float32_t *pYData;          /**< pointer to the table of Y values */
02850   } arm_linear_interp_instance_f32;
02851 
02852   /**
02853    * @brief Instance structure for the floating-point bilinear interpolation function.
02854    */
02855   typedef struct
02856   {
02857           uint16_t numRows;   /**< number of rows in the data table. */
02858           uint16_t numCols;   /**< number of columns in the data table. */
02859           float32_t *pData;   /**< points to the data table. */
02860   } arm_bilinear_interp_instance_f32;
02861 
02862    /**
02863    * @brief Instance structure for the Q31 bilinear interpolation function.
02864    */
02865   typedef struct
02866   {
02867           uint16_t numRows;   /**< number of rows in the data table. */
02868           uint16_t numCols;   /**< number of columns in the data table. */
02869           q31_t *pData;       /**< points to the data table. */
02870   } arm_bilinear_interp_instance_q31;
02871 
02872    /**
02873    * @brief Instance structure for the Q15 bilinear interpolation function.
02874    */
02875   typedef struct
02876   {
02877           uint16_t numRows;   /**< number of rows in the data table. */
02878           uint16_t numCols;   /**< number of columns in the data table. */
02879           q15_t *pData;       /**< points to the data table. */
02880   } arm_bilinear_interp_instance_q15;
02881 
02882    /**
02883    * @brief Instance structure for the Q15 bilinear interpolation function.
02884    */
02885   typedef struct
02886   {
02887           uint16_t numRows;   /**< number of rows in the data table. */
02888           uint16_t numCols;   /**< number of columns in the data table. */
02889           q7_t *pData;        /**< points to the data table. */
02890   } arm_bilinear_interp_instance_q7;
02891 
02892 
02893   /**
02894    * @brief Q7 vector multiplication.
02895    * @param[in]  pSrcA      points to the first input vector
02896    * @param[in]  pSrcB      points to the second input vector
02897    * @param[out] pDst       points to the output vector
02898    * @param[in]  blockSize  number of samples in each vector
02899    */
02900   void arm_mult_q7(
02901   const q7_t * pSrcA,
02902   const q7_t * pSrcB,
02903         q7_t * pDst,
02904         uint32_t blockSize);
02905 
02906 
02907   /**
02908    * @brief Q15 vector multiplication.
02909    * @param[in]  pSrcA      points to the first input vector
02910    * @param[in]  pSrcB      points to the second input vector
02911    * @param[out] pDst       points to the output vector
02912    * @param[in]  blockSize  number of samples in each vector
02913    */
02914   void arm_mult_q15(
02915   const q15_t * pSrcA,
02916   const q15_t * pSrcB,
02917         q15_t * pDst,
02918         uint32_t blockSize);
02919 
02920 
02921   /**
02922    * @brief Q31 vector multiplication.
02923    * @param[in]  pSrcA      points to the first input vector
02924    * @param[in]  pSrcB      points to the second input vector
02925    * @param[out] pDst       points to the output vector
02926    * @param[in]  blockSize  number of samples in each vector
02927    */
02928   void arm_mult_q31(
02929   const q31_t * pSrcA,
02930   const q31_t * pSrcB,
02931         q31_t * pDst,
02932         uint32_t blockSize);
02933 
02934 
02935   /**
02936    * @brief Floating-point vector multiplication.
02937    * @param[in]  pSrcA      points to the first input vector
02938    * @param[in]  pSrcB      points to the second input vector
02939    * @param[out] pDst       points to the output vector
02940    * @param[in]  blockSize  number of samples in each vector
02941    */
02942   void arm_mult_f32(
02943   const float32_t * pSrcA,
02944   const float32_t * pSrcB,
02945         float32_t * pDst,
02946         uint32_t blockSize);
02947 
02948 
02949   /**
02950    * @brief Instance structure for the Q15 CFFT/CIFFT function.
02951    */
02952   typedef struct
02953   {
02954           uint16_t fftLen;                 /**< length of the FFT. */
02955           uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
02956           uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
02957     const q15_t *pTwiddle;                 /**< points to the Sin twiddle factor table. */
02958     const uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
02959           uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
02960           uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
02961   } arm_cfft_radix2_instance_q15;
02962 
02963 /* Deprecated */
02964   arm_status arm_cfft_radix2_init_q15(
02965         arm_cfft_radix2_instance_q15 * S,
02966         uint16_t fftLen,
02967         uint8_t ifftFlag,
02968         uint8_t bitReverseFlag);
02969 
02970 /* Deprecated */
02971   void arm_cfft_radix2_q15(
02972   const arm_cfft_radix2_instance_q15 * S,
02973         q15_t * pSrc);
02974 
02975 
02976   /**
02977    * @brief Instance structure for the Q15 CFFT/CIFFT function.
02978    */
02979   typedef struct
02980   {
02981           uint16_t fftLen;                 /**< length of the FFT. */
02982           uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
02983           uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
02984     const q15_t *pTwiddle;                 /**< points to the twiddle factor table. */
02985     const uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
02986           uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
02987           uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
02988   } arm_cfft_radix4_instance_q15;
02989 
02990 /* Deprecated */
02991   arm_status arm_cfft_radix4_init_q15(
02992         arm_cfft_radix4_instance_q15 * S,
02993         uint16_t fftLen,
02994         uint8_t ifftFlag,
02995         uint8_t bitReverseFlag);
02996 
02997 /* Deprecated */
02998   void arm_cfft_radix4_q15(
02999   const arm_cfft_radix4_instance_q15 * S,
03000         q15_t * pSrc);
03001 
03002   /**
03003    * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
03004    */
03005   typedef struct
03006   {
03007           uint16_t fftLen;                 /**< length of the FFT. */
03008           uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
03009           uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
03010     const q31_t *pTwiddle;                 /**< points to the Twiddle factor table. */
03011     const uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
03012           uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
03013           uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
03014   } arm_cfft_radix2_instance_q31;
03015 
03016 /* Deprecated */
03017   arm_status arm_cfft_radix2_init_q31(
03018         arm_cfft_radix2_instance_q31 * S,
03019         uint16_t fftLen,
03020         uint8_t ifftFlag,
03021         uint8_t bitReverseFlag);
03022 
03023 /* Deprecated */
03024   void arm_cfft_radix2_q31(
03025   const arm_cfft_radix2_instance_q31 * S,
03026         q31_t * pSrc);
03027 
03028   /**
03029    * @brief Instance structure for the Q31 CFFT/CIFFT function.
03030    */
03031   typedef struct
03032   {
03033           uint16_t fftLen;                 /**< length of the FFT. */
03034           uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
03035           uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
03036     const q31_t *pTwiddle;                 /**< points to the twiddle factor table. */
03037     const uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
03038           uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
03039           uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
03040   } arm_cfft_radix4_instance_q31;
03041 
03042 /* Deprecated */
03043   void arm_cfft_radix4_q31(
03044   const arm_cfft_radix4_instance_q31 * S,
03045         q31_t * pSrc);
03046 
03047 /* Deprecated */
03048   arm_status arm_cfft_radix4_init_q31(
03049         arm_cfft_radix4_instance_q31 * S,
03050         uint16_t fftLen,
03051         uint8_t ifftFlag,
03052         uint8_t bitReverseFlag);
03053 
03054   /**
03055    * @brief Instance structure for the floating-point CFFT/CIFFT function.
03056    */
03057   typedef struct
03058   {
03059           uint16_t fftLen;                   /**< length of the FFT. */
03060           uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
03061           uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
03062     const float32_t *pTwiddle;               /**< points to the Twiddle factor table. */
03063     const uint16_t *pBitRevTable;            /**< points to the bit reversal table. */
03064           uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
03065           uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
03066           float32_t onebyfftLen;             /**< value of 1/fftLen. */
03067   } arm_cfft_radix2_instance_f32;
03068 
03069 /* Deprecated */
03070   arm_status arm_cfft_radix2_init_f32(
03071         arm_cfft_radix2_instance_f32 * S,
03072         uint16_t fftLen,
03073         uint8_t ifftFlag,
03074         uint8_t bitReverseFlag);
03075 
03076 /* Deprecated */
03077   void arm_cfft_radix2_f32(
03078   const arm_cfft_radix2_instance_f32 * S,
03079         float32_t * pSrc);
03080 
03081   /**
03082    * @brief Instance structure for the floating-point CFFT/CIFFT function.
03083    */
03084   typedef struct
03085   {
03086           uint16_t fftLen;                   /**< length of the FFT. */
03087           uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
03088           uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
03089     const float32_t *pTwiddle;               /**< points to the Twiddle factor table. */
03090     const uint16_t *pBitRevTable;            /**< points to the bit reversal table. */
03091           uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
03092           uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
03093           float32_t onebyfftLen;             /**< value of 1/fftLen. */
03094   } arm_cfft_radix4_instance_f32;
03095 
03096 /* Deprecated */
03097   arm_status arm_cfft_radix4_init_f32(
03098         arm_cfft_radix4_instance_f32 * S,
03099         uint16_t fftLen,
03100         uint8_t ifftFlag,
03101         uint8_t bitReverseFlag);
03102 
03103 /* Deprecated */
03104   void arm_cfft_radix4_f32(
03105   const arm_cfft_radix4_instance_f32 * S,
03106         float32_t * pSrc);
03107 
03108   /**
03109    * @brief Instance structure for the fixed-point CFFT/CIFFT function.
03110    */
03111   typedef struct
03112   {
03113           uint16_t fftLen;                   /**< length of the FFT. */
03114     const q15_t *pTwiddle;             /**< points to the Twiddle factor table. */
03115     const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */
03116           uint16_t bitRevLength;             /**< bit reversal table length. */
03117 #if defined(ARM_MATH_MVEI)
03118    const uint32_t *rearranged_twiddle_tab_stride1_arr;        /**< Per stage reordered twiddle pointer (offset 1) */                                                       \
03119    const uint32_t *rearranged_twiddle_tab_stride2_arr;        /**< Per stage reordered twiddle pointer (offset 2) */                                                       \
03120    const uint32_t *rearranged_twiddle_tab_stride3_arr;        /**< Per stage reordered twiddle pointer (offset 3) */                                                       \
03121    const q15_t *rearranged_twiddle_stride1; /**< reordered twiddle offset 1 storage */                                                                   \
03122    const q15_t *rearranged_twiddle_stride2; /**< reordered twiddle offset 2 storage */                                                                   \
03123    const q15_t *rearranged_twiddle_stride3;
03124 #endif
03125   } arm_cfft_instance_q15;
03126 
03127 arm_status arm_cfft_init_q15(
03128   arm_cfft_instance_q15 * S,
03129   uint16_t fftLen);
03130 
03131 void arm_cfft_q15(
03132     const arm_cfft_instance_q15 * S,
03133           q15_t * p1,
03134           uint8_t ifftFlag,
03135           uint8_t bitReverseFlag);
03136 
03137   /**
03138    * @brief Instance structure for the fixed-point CFFT/CIFFT function.
03139    */
03140   typedef struct
03141   {
03142           uint16_t fftLen;                   /**< length of the FFT. */
03143     const q31_t *pTwiddle;             /**< points to the Twiddle factor table. */
03144     const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */
03145           uint16_t bitRevLength;             /**< bit reversal table length. */
03146 #if defined(ARM_MATH_MVEI)
03147    const uint32_t *rearranged_twiddle_tab_stride1_arr;        /**< Per stage reordered twiddle pointer (offset 1) */                                                       \
03148    const uint32_t *rearranged_twiddle_tab_stride2_arr;        /**< Per stage reordered twiddle pointer (offset 2) */                                                       \
03149    const uint32_t *rearranged_twiddle_tab_stride3_arr;        /**< Per stage reordered twiddle pointer (offset 3) */                                                       \
03150    const q31_t *rearranged_twiddle_stride1; /**< reordered twiddle offset 1 storage */                                                                   \
03151    const q31_t *rearranged_twiddle_stride2; /**< reordered twiddle offset 2 storage */                                                                   \
03152    const q31_t *rearranged_twiddle_stride3;
03153 #endif
03154   } arm_cfft_instance_q31;
03155 
03156 arm_status arm_cfft_init_q31(
03157   arm_cfft_instance_q31 * S,
03158   uint16_t fftLen);
03159 
03160 void arm_cfft_q31(
03161     const arm_cfft_instance_q31 * S,
03162           q31_t * p1,
03163           uint8_t ifftFlag,
03164           uint8_t bitReverseFlag);
03165 
03166   /**
03167    * @brief Instance structure for the floating-point CFFT/CIFFT function.
03168    */
03169   typedef struct
03170   {
03171           uint16_t fftLen;                   /**< length of the FFT. */
03172     const float32_t *pTwiddle;         /**< points to the Twiddle factor table. */
03173     const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */
03174           uint16_t bitRevLength;             /**< bit reversal table length. */
03175 #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
03176    const uint32_t *rearranged_twiddle_tab_stride1_arr;        /**< Per stage reordered twiddle pointer (offset 1) */                                                       \
03177    const uint32_t *rearranged_twiddle_tab_stride2_arr;        /**< Per stage reordered twiddle pointer (offset 2) */                                                       \
03178    const uint32_t *rearranged_twiddle_tab_stride3_arr;        /**< Per stage reordered twiddle pointer (offset 3) */                                                       \
03179    const float32_t *rearranged_twiddle_stride1; /**< reordered twiddle offset 1 storage */                                                                   \
03180    const float32_t *rearranged_twiddle_stride2; /**< reordered twiddle offset 2 storage */                                                                   \
03181    const float32_t *rearranged_twiddle_stride3;
03182 #endif
03183   } arm_cfft_instance_f32;
03184 
03185 
03186   arm_status arm_cfft_init_f32(
03187   arm_cfft_instance_f32 * S,
03188   uint16_t fftLen);
03189 
03190   void arm_cfft_f32(
03191   const arm_cfft_instance_f32 * S,
03192         float32_t * p1,
03193         uint8_t ifftFlag,
03194         uint8_t bitReverseFlag);
03195 
03196 
03197   /**
03198    * @brief Instance structure for the Double Precision Floating-point CFFT/CIFFT function.
03199    */
03200   typedef struct
03201   {
03202           uint16_t fftLen;                   /**< length of the FFT. */
03203     const float64_t *pTwiddle;         /**< points to the Twiddle factor table. */
03204     const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */
03205           uint16_t bitRevLength;             /**< bit reversal table length. */
03206   } arm_cfft_instance_f64;
03207 
03208   void arm_cfft_f64(
03209   const arm_cfft_instance_f64 * S,
03210         float64_t * p1,
03211         uint8_t ifftFlag,
03212         uint8_t bitReverseFlag);
03213 
03214   /**
03215    * @brief Instance structure for the Q15 RFFT/RIFFT function.
03216    */
03217   typedef struct
03218   {
03219           uint32_t fftLenReal;                      /**< length of the real FFT. */
03220           uint8_t ifftFlagR;                        /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
03221           uint8_t bitReverseFlagR;                  /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
03222           uint32_t twidCoefRModifier;               /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
03223     const q15_t *pTwiddleAReal;                     /**< points to the real twiddle factor table. */
03224     const q15_t *pTwiddleBReal;                     /**< points to the imag twiddle factor table. */
03225 #if defined(ARM_MATH_MVEI)
03226     arm_cfft_instance_q15 cfftInst;
03227 #else
03228     const arm_cfft_instance_q15 *pCfft;       /**< points to the complex FFT instance. */
03229 #endif
03230   } arm_rfft_instance_q15;
03231 
03232   arm_status arm_rfft_init_q15(
03233         arm_rfft_instance_q15 * S,
03234         uint32_t fftLenReal,
03235         uint32_t ifftFlagR,
03236         uint32_t bitReverseFlag);
03237 
03238   void arm_rfft_q15(
03239   const arm_rfft_instance_q15 * S,
03240         q15_t * pSrc,
03241         q15_t * pDst);
03242 
03243   /**
03244    * @brief Instance structure for the Q31 RFFT/RIFFT function.
03245    */
03246   typedef struct
03247   {
03248           uint32_t fftLenReal;                        /**< length of the real FFT. */
03249           uint8_t ifftFlagR;                          /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
03250           uint8_t bitReverseFlagR;                    /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
03251           uint32_t twidCoefRModifier;                 /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
03252     const q31_t *pTwiddleAReal;                       /**< points to the real twiddle factor table. */
03253     const q31_t *pTwiddleBReal;                       /**< points to the imag twiddle factor table. */
03254 #if defined(ARM_MATH_MVEI)
03255     arm_cfft_instance_q31 cfftInst;
03256 #else
03257     const arm_cfft_instance_q31 *pCfft;         /**< points to the complex FFT instance. */
03258 #endif
03259   } arm_rfft_instance_q31;
03260 
03261   arm_status arm_rfft_init_q31(
03262         arm_rfft_instance_q31 * S,
03263         uint32_t fftLenReal,
03264         uint32_t ifftFlagR,
03265         uint32_t bitReverseFlag);
03266 
03267   void arm_rfft_q31(
03268   const arm_rfft_instance_q31 * S,
03269         q31_t * pSrc,
03270         q31_t * pDst);
03271 
03272   /**
03273    * @brief Instance structure for the floating-point RFFT/RIFFT function.
03274    */
03275   typedef struct
03276   {
03277           uint32_t fftLenReal;                        /**< length of the real FFT. */
03278           uint16_t fftLenBy2;                         /**< length of the complex FFT. */
03279           uint8_t ifftFlagR;                          /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
03280           uint8_t bitReverseFlagR;                    /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
03281           uint32_t twidCoefRModifier;                     /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
03282     const float32_t *pTwiddleAReal;                   /**< points to the real twiddle factor table. */
03283     const float32_t *pTwiddleBReal;                   /**< points to the imag twiddle factor table. */
03284           arm_cfft_radix4_instance_f32 *pCfft;        /**< points to the complex FFT instance. */
03285   } arm_rfft_instance_f32;
03286 
03287   arm_status arm_rfft_init_f32(
03288         arm_rfft_instance_f32 * S,
03289         arm_cfft_radix4_instance_f32 * S_CFFT,
03290         uint32_t fftLenReal,
03291         uint32_t ifftFlagR,
03292         uint32_t bitReverseFlag);
03293 
03294   void arm_rfft_f32(
03295   const arm_rfft_instance_f32 * S,
03296         float32_t * pSrc,
03297         float32_t * pDst);
03298 
03299   /**
03300    * @brief Instance structure for the Double Precision Floating-point RFFT/RIFFT function.
03301    */
03302 typedef struct
03303   {
03304           arm_cfft_instance_f64 Sint;      /**< Internal CFFT structure. */
03305           uint16_t fftLenRFFT;             /**< length of the real sequence */
03306     const float64_t * pTwiddleRFFT;        /**< Twiddle factors real stage  */
03307   } arm_rfft_fast_instance_f64 ;
03308 
03309 arm_status arm_rfft_fast_init_f64 (
03310          arm_rfft_fast_instance_f64 * S,
03311          uint16_t fftLen);
03312 
03313 
03314 void arm_rfft_fast_f64(
03315     arm_rfft_fast_instance_f64 * S,
03316     float64_t * p, float64_t * pOut,
03317     uint8_t ifftFlag);
03318 
03319 
03320   /**
03321    * @brief Instance structure for the floating-point RFFT/RIFFT function.
03322    */
03323 typedef struct
03324   {
03325           arm_cfft_instance_f32 Sint;      /**< Internal CFFT structure. */
03326           uint16_t fftLenRFFT;             /**< length of the real sequence */
03327     const float32_t * pTwiddleRFFT;        /**< Twiddle factors real stage  */
03328   } arm_rfft_fast_instance_f32 ;
03329 
03330 arm_status arm_rfft_fast_init_f32 (
03331          arm_rfft_fast_instance_f32 * S,
03332          uint16_t fftLen);
03333 
03334 
03335   void arm_rfft_fast_f32(
03336         const arm_rfft_fast_instance_f32 * S,
03337         float32_t * p, float32_t * pOut,
03338         uint8_t ifftFlag);
03339 
03340   /**
03341    * @brief Instance structure for the floating-point DCT4/IDCT4 function.
03342    */
03343   typedef struct
03344   {
03345           uint16_t N;                          /**< length of the DCT4. */
03346           uint16_t Nby2;                       /**< half of the length of the DCT4. */
03347           float32_t normalize;                 /**< normalizing factor. */
03348     const float32_t *pTwiddle;                 /**< points to the twiddle factor table. */
03349     const float32_t *pCosFactor;               /**< points to the cosFactor table. */
03350           arm_rfft_instance_f32 *pRfft;        /**< points to the real FFT instance. */
03351           arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
03352   } arm_dct4_instance_f32;
03353 
03354 
03355   /**
03356    * @brief  Initialization function for the floating-point DCT4/IDCT4.
03357    * @param[in,out] S          points to an instance of floating-point DCT4/IDCT4 structure.
03358    * @param[in]     S_RFFT     points to an instance of floating-point RFFT/RIFFT structure.
03359    * @param[in]     S_CFFT     points to an instance of floating-point CFFT/CIFFT structure.
03360    * @param[in]     N          length of the DCT4.
03361    * @param[in]     Nby2       half of the length of the DCT4.
03362    * @param[in]     normalize  normalizing factor.
03363    * @return      arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported transform length.
03364    */
03365   arm_status arm_dct4_init_f32(
03366         arm_dct4_instance_f32 * S,
03367         arm_rfft_instance_f32 * S_RFFT,
03368         arm_cfft_radix4_instance_f32 * S_CFFT,
03369         uint16_t N,
03370         uint16_t Nby2,
03371         float32_t normalize);
03372 
03373 
03374   /**
03375    * @brief Processing function for the floating-point DCT4/IDCT4.
03376    * @param[in]     S              points to an instance of the floating-point DCT4/IDCT4 structure.
03377    * @param[in]     pState         points to state buffer.
03378    * @param[in,out] pInlineBuffer  points to the in-place input and output buffer.
03379    */
03380   void arm_dct4_f32(
03381   const arm_dct4_instance_f32 * S,
03382         float32_t * pState,
03383         float32_t * pInlineBuffer);
03384 
03385 
03386   /**
03387    * @brief Instance structure for the Q31 DCT4/IDCT4 function.
03388    */
03389   typedef struct
03390   {
03391           uint16_t N;                          /**< length of the DCT4. */
03392           uint16_t Nby2;                       /**< half of the length of the DCT4. */
03393           q31_t normalize;                     /**< normalizing factor. */
03394     const q31_t *pTwiddle;                     /**< points to the twiddle factor table. */
03395     const q31_t *pCosFactor;                   /**< points to the cosFactor table. */
03396           arm_rfft_instance_q31 *pRfft;        /**< points to the real FFT instance. */
03397           arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
03398   } arm_dct4_instance_q31;
03399 
03400 
03401   /**
03402    * @brief  Initialization function for the Q31 DCT4/IDCT4.
03403    * @param[in,out] S          points to an instance of Q31 DCT4/IDCT4 structure.
03404    * @param[in]     S_RFFT     points to an instance of Q31 RFFT/RIFFT structure
03405    * @param[in]     S_CFFT     points to an instance of Q31 CFFT/CIFFT structure
03406    * @param[in]     N          length of the DCT4.
03407    * @param[in]     Nby2       half of the length of the DCT4.
03408    * @param[in]     normalize  normalizing factor.
03409    * @return      arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.
03410    */
03411   arm_status arm_dct4_init_q31(
03412         arm_dct4_instance_q31 * S,
03413         arm_rfft_instance_q31 * S_RFFT,
03414         arm_cfft_radix4_instance_q31 * S_CFFT,
03415         uint16_t N,
03416         uint16_t Nby2,
03417         q31_t normalize);
03418 
03419 
03420   /**
03421    * @brief Processing function for the Q31 DCT4/IDCT4.
03422    * @param[in]     S              points to an instance of the Q31 DCT4 structure.
03423    * @param[in]     pState         points to state buffer.
03424    * @param[in,out] pInlineBuffer  points to the in-place input and output buffer.
03425    */
03426   void arm_dct4_q31(
03427   const arm_dct4_instance_q31 * S,
03428         q31_t * pState,
03429         q31_t * pInlineBuffer);
03430 
03431 
03432   /**
03433    * @brief Instance structure for the Q15 DCT4/IDCT4 function.
03434    */
03435   typedef struct
03436   {
03437           uint16_t N;                          /**< length of the DCT4. */
03438           uint16_t Nby2;                       /**< half of the length of the DCT4. */
03439           q15_t normalize;                     /**< normalizing factor. */
03440     const q15_t *pTwiddle;                     /**< points to the twiddle factor table. */
03441     const q15_t *pCosFactor;                   /**< points to the cosFactor table. */
03442           arm_rfft_instance_q15 *pRfft;        /**< points to the real FFT instance. */
03443           arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
03444   } arm_dct4_instance_q15;
03445 
03446 
03447   /**
03448    * @brief  Initialization function for the Q15 DCT4/IDCT4.
03449    * @param[in,out] S          points to an instance of Q15 DCT4/IDCT4 structure.
03450    * @param[in]     S_RFFT     points to an instance of Q15 RFFT/RIFFT structure.
03451    * @param[in]     S_CFFT     points to an instance of Q15 CFFT/CIFFT structure.
03452    * @param[in]     N          length of the DCT4.
03453    * @param[in]     Nby2       half of the length of the DCT4.
03454    * @param[in]     normalize  normalizing factor.
03455    * @return      arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.
03456    */
03457   arm_status arm_dct4_init_q15(
03458         arm_dct4_instance_q15 * S,
03459         arm_rfft_instance_q15 * S_RFFT,
03460         arm_cfft_radix4_instance_q15 * S_CFFT,
03461         uint16_t N,
03462         uint16_t Nby2,
03463         q15_t normalize);
03464 
03465 
03466   /**
03467    * @brief Processing function for the Q15 DCT4/IDCT4.
03468    * @param[in]     S              points to an instance of the Q15 DCT4 structure.
03469    * @param[in]     pState         points to state buffer.
03470    * @param[in,out] pInlineBuffer  points to the in-place input and output buffer.
03471    */
03472   void arm_dct4_q15(
03473   const arm_dct4_instance_q15 * S,
03474         q15_t * pState,
03475         q15_t * pInlineBuffer);
03476 
03477 
03478   /**
03479    * @brief Floating-point vector addition.
03480    * @param[in]  pSrcA      points to the first input vector
03481    * @param[in]  pSrcB      points to the second input vector
03482    * @param[out] pDst       points to the output vector
03483    * @param[in]  blockSize  number of samples in each vector
03484    */
03485   void arm_add_f32(
03486   const float32_t * pSrcA,
03487   const float32_t * pSrcB,
03488         float32_t * pDst,
03489         uint32_t blockSize);
03490 
03491 
03492   /**
03493    * @brief Q7 vector addition.
03494    * @param[in]  pSrcA      points to the first input vector
03495    * @param[in]  pSrcB      points to the second input vector
03496    * @param[out] pDst       points to the output vector
03497    * @param[in]  blockSize  number of samples in each vector
03498    */
03499   void arm_add_q7(
03500   const q7_t * pSrcA,
03501   const q7_t * pSrcB,
03502         q7_t * pDst,
03503         uint32_t blockSize);
03504 
03505 
03506   /**
03507    * @brief Q15 vector addition.
03508    * @param[in]  pSrcA      points to the first input vector
03509    * @param[in]  pSrcB      points to the second input vector
03510    * @param[out] pDst       points to the output vector
03511    * @param[in]  blockSize  number of samples in each vector
03512    */
03513   void arm_add_q15(
03514   const q15_t * pSrcA,
03515   const q15_t * pSrcB,
03516         q15_t * pDst,
03517         uint32_t blockSize);
03518 
03519 
03520   /**
03521    * @brief Q31 vector addition.
03522    * @param[in]  pSrcA      points to the first input vector
03523    * @param[in]  pSrcB      points to the second input vector
03524    * @param[out] pDst       points to the output vector
03525    * @param[in]  blockSize  number of samples in each vector
03526    */
03527   void arm_add_q31(
03528   const q31_t * pSrcA,
03529   const q31_t * pSrcB,
03530         q31_t * pDst,
03531         uint32_t blockSize);
03532 
03533 
03534   /**
03535    * @brief Floating-point vector subtraction.
03536    * @param[in]  pSrcA      points to the first input vector
03537    * @param[in]  pSrcB      points to the second input vector
03538    * @param[out] pDst       points to the output vector
03539    * @param[in]  blockSize  number of samples in each vector
03540    */
03541   void arm_sub_f32(
03542   const float32_t * pSrcA,
03543   const float32_t * pSrcB,
03544         float32_t * pDst,
03545         uint32_t blockSize);
03546 
03547 
03548   /**
03549    * @brief Q7 vector subtraction.
03550    * @param[in]  pSrcA      points to the first input vector
03551    * @param[in]  pSrcB      points to the second input vector
03552    * @param[out] pDst       points to the output vector
03553    * @param[in]  blockSize  number of samples in each vector
03554    */
03555   void arm_sub_q7(
03556   const q7_t * pSrcA,
03557   const q7_t * pSrcB,
03558         q7_t * pDst,
03559         uint32_t blockSize);
03560 
03561 
03562   /**
03563    * @brief Q15 vector subtraction.
03564    * @param[in]  pSrcA      points to the first input vector
03565    * @param[in]  pSrcB      points to the second input vector
03566    * @param[out] pDst       points to the output vector
03567    * @param[in]  blockSize  number of samples in each vector
03568    */
03569   void arm_sub_q15(
03570   const q15_t * pSrcA,
03571   const q15_t * pSrcB,
03572         q15_t * pDst,
03573         uint32_t blockSize);
03574 
03575 
03576   /**
03577    * @brief Q31 vector subtraction.
03578    * @param[in]  pSrcA      points to the first input vector
03579    * @param[in]  pSrcB      points to the second input vector
03580    * @param[out] pDst       points to the output vector
03581    * @param[in]  blockSize  number of samples in each vector
03582    */
03583   void arm_sub_q31(
03584   const q31_t * pSrcA,
03585   const q31_t * pSrcB,
03586         q31_t * pDst,
03587         uint32_t blockSize);
03588 
03589 
03590   /**
03591    * @brief Multiplies a floating-point vector by a scalar.
03592    * @param[in]  pSrc       points to the input vector
03593    * @param[in]  scale      scale factor to be applied
03594    * @param[out] pDst       points to the output vector
03595    * @param[in]  blockSize  number of samples in the vector
03596    */
03597   void arm_scale_f32(
03598   const float32_t * pSrc,
03599         float32_t scale,
03600         float32_t * pDst,
03601         uint32_t blockSize);
03602 
03603 
03604   /**
03605    * @brief Multiplies a Q7 vector by a scalar.
03606    * @param[in]  pSrc        points to the input vector
03607    * @param[in]  scaleFract  fractional portion of the scale value
03608    * @param[in]  shift       number of bits to shift the result by
03609    * @param[out] pDst        points to the output vector
03610    * @param[in]  blockSize   number of samples in the vector
03611    */
03612   void arm_scale_q7(
03613   const q7_t * pSrc,
03614         q7_t scaleFract,
03615         int8_t shift,
03616         q7_t * pDst,
03617         uint32_t blockSize);
03618 
03619 
03620   /**
03621    * @brief Multiplies a Q15 vector by a scalar.
03622    * @param[in]  pSrc        points to the input vector
03623    * @param[in]  scaleFract  fractional portion of the scale value
03624    * @param[in]  shift       number of bits to shift the result by
03625    * @param[out] pDst        points to the output vector
03626    * @param[in]  blockSize   number of samples in the vector
03627    */
03628   void arm_scale_q15(
03629   const q15_t * pSrc,
03630         q15_t scaleFract,
03631         int8_t shift,
03632         q15_t * pDst,
03633         uint32_t blockSize);
03634 
03635 
03636   /**
03637    * @brief Multiplies a Q31 vector by a scalar.
03638    * @param[in]  pSrc        points to the input vector
03639    * @param[in]  scaleFract  fractional portion of the scale value
03640    * @param[in]  shift       number of bits to shift the result by
03641    * @param[out] pDst        points to the output vector
03642    * @param[in]  blockSize   number of samples in the vector
03643    */
03644   void arm_scale_q31(
03645   const q31_t * pSrc,
03646         q31_t scaleFract,
03647         int8_t shift,
03648         q31_t * pDst,
03649         uint32_t blockSize);
03650 
03651 
03652   /**
03653    * @brief Q7 vector absolute value.
03654    * @param[in]  pSrc       points to the input buffer
03655    * @param[out] pDst       points to the output buffer
03656    * @param[in]  blockSize  number of samples in each vector
03657    */
03658   void arm_abs_q7(
03659   const q7_t * pSrc,
03660         q7_t * pDst,
03661         uint32_t blockSize);
03662 
03663 
03664   /**
03665    * @brief Floating-point vector absolute value.
03666    * @param[in]  pSrc       points to the input buffer
03667    * @param[out] pDst       points to the output buffer
03668    * @param[in]  blockSize  number of samples in each vector
03669    */
03670   void arm_abs_f32(
03671   const float32_t * pSrc,
03672         float32_t * pDst,
03673         uint32_t blockSize);
03674 
03675 
03676   /**
03677    * @brief Q15 vector absolute value.
03678    * @param[in]  pSrc       points to the input buffer
03679    * @param[out] pDst       points to the output buffer
03680    * @param[in]  blockSize  number of samples in each vector
03681    */
03682   void arm_abs_q15(
03683   const q15_t * pSrc,
03684         q15_t * pDst,
03685         uint32_t blockSize);
03686 
03687 
03688   /**
03689    * @brief Q31 vector absolute value.
03690    * @param[in]  pSrc       points to the input buffer
03691    * @param[out] pDst       points to the output buffer
03692    * @param[in]  blockSize  number of samples in each vector
03693    */
03694   void arm_abs_q31(
03695   const q31_t * pSrc,
03696         q31_t * pDst,
03697         uint32_t blockSize);
03698 
03699 
03700   /**
03701    * @brief Dot product of floating-point vectors.
03702    * @param[in]  pSrcA      points to the first input vector
03703    * @param[in]  pSrcB      points to the second input vector
03704    * @param[in]  blockSize  number of samples in each vector
03705    * @param[out] result     output result returned here
03706    */
03707   void arm_dot_prod_f32(
03708   const float32_t * pSrcA,
03709   const float32_t * pSrcB,
03710         uint32_t blockSize,
03711         float32_t * result);
03712 
03713 
03714   /**
03715    * @brief Dot product of Q7 vectors.
03716    * @param[in]  pSrcA      points to the first input vector
03717    * @param[in]  pSrcB      points to the second input vector
03718    * @param[in]  blockSize  number of samples in each vector
03719    * @param[out] result     output result returned here
03720    */
03721   void arm_dot_prod_q7(
03722   const q7_t * pSrcA,
03723   const q7_t * pSrcB,
03724         uint32_t blockSize,
03725         q31_t * result);
03726 
03727 
03728   /**
03729    * @brief Dot product of Q15 vectors.
03730    * @param[in]  pSrcA      points to the first input vector
03731    * @param[in]  pSrcB      points to the second input vector
03732    * @param[in]  blockSize  number of samples in each vector
03733    * @param[out] result     output result returned here
03734    */
03735   void arm_dot_prod_q15(
03736   const q15_t * pSrcA,
03737   const q15_t * pSrcB,
03738         uint32_t blockSize,
03739         q63_t * result);
03740 
03741 
03742   /**
03743    * @brief Dot product of Q31 vectors.
03744    * @param[in]  pSrcA      points to the first input vector
03745    * @param[in]  pSrcB      points to the second input vector
03746    * @param[in]  blockSize  number of samples in each vector
03747    * @param[out] result     output result returned here
03748    */
03749   void arm_dot_prod_q31(
03750   const q31_t * pSrcA,
03751   const q31_t * pSrcB,
03752         uint32_t blockSize,
03753         q63_t * result);
03754 
03755 
03756   /**
03757    * @brief  Shifts the elements of a Q7 vector a specified number of bits.
03758    * @param[in]  pSrc       points to the input vector
03759    * @param[in]  shiftBits  number of bits to shift.  A positive value shifts left; a negative value shifts right.
03760    * @param[out] pDst       points to the output vector
03761    * @param[in]  blockSize  number of samples in the vector
03762    */
03763   void arm_shift_q7(
03764   const q7_t * pSrc,
03765         int8_t shiftBits,
03766         q7_t * pDst,
03767         uint32_t blockSize);
03768 
03769 
03770   /**
03771    * @brief  Shifts the elements of a Q15 vector a specified number of bits.
03772    * @param[in]  pSrc       points to the input vector
03773    * @param[in]  shiftBits  number of bits to shift.  A positive value shifts left; a negative value shifts right.
03774    * @param[out] pDst       points to the output vector
03775    * @param[in]  blockSize  number of samples in the vector
03776    */
03777   void arm_shift_q15(
03778   const q15_t * pSrc,
03779         int8_t shiftBits,
03780         q15_t * pDst,
03781         uint32_t blockSize);
03782 
03783 
03784   /**
03785    * @brief  Shifts the elements of a Q31 vector a specified number of bits.
03786    * @param[in]  pSrc       points to the input vector
03787    * @param[in]  shiftBits  number of bits to shift.  A positive value shifts left; a negative value shifts right.
03788    * @param[out] pDst       points to the output vector
03789    * @param[in]  blockSize  number of samples in the vector
03790    */
03791   void arm_shift_q31(
03792   const q31_t * pSrc,
03793         int8_t shiftBits,
03794         q31_t * pDst,
03795         uint32_t blockSize);
03796 
03797 
03798   /**
03799    * @brief  Adds a constant offset to a floating-point vector.
03800    * @param[in]  pSrc       points to the input vector
03801    * @param[in]  offset     is the offset to be added
03802    * @param[out] pDst       points to the output vector
03803    * @param[in]  blockSize  number of samples in the vector
03804    */
03805   void arm_offset_f32(
03806   const float32_t * pSrc,
03807         float32_t offset,
03808         float32_t * pDst,
03809         uint32_t blockSize);
03810 
03811 
03812   /**
03813    * @brief  Adds a constant offset to a Q7 vector.
03814    * @param[in]  pSrc       points to the input vector
03815    * @param[in]  offset     is the offset to be added
03816    * @param[out] pDst       points to the output vector
03817    * @param[in]  blockSize  number of samples in the vector
03818    */
03819   void arm_offset_q7(
03820   const q7_t * pSrc,
03821         q7_t offset,
03822         q7_t * pDst,
03823         uint32_t blockSize);
03824 
03825 
03826   /**
03827    * @brief  Adds a constant offset to a Q15 vector.
03828    * @param[in]  pSrc       points to the input vector
03829    * @param[in]  offset     is the offset to be added
03830    * @param[out] pDst       points to the output vector
03831    * @param[in]  blockSize  number of samples in the vector
03832    */
03833   void arm_offset_q15(
03834   const q15_t * pSrc,
03835         q15_t offset,
03836         q15_t * pDst,
03837         uint32_t blockSize);
03838 
03839 
03840   /**
03841    * @brief  Adds a constant offset to a Q31 vector.
03842    * @param[in]  pSrc       points to the input vector
03843    * @param[in]  offset     is the offset to be added
03844    * @param[out] pDst       points to the output vector
03845    * @param[in]  blockSize  number of samples in the vector
03846    */
03847   void arm_offset_q31(
03848   const q31_t * pSrc,
03849         q31_t offset,
03850         q31_t * pDst,
03851         uint32_t blockSize);
03852 
03853 
03854   /**
03855    * @brief  Negates the elements of a floating-point vector.
03856    * @param[in]  pSrc       points to the input vector
03857    * @param[out] pDst       points to the output vector
03858    * @param[in]  blockSize  number of samples in the vector
03859    */
03860   void arm_negate_f32(
03861   const float32_t * pSrc,
03862         float32_t * pDst,
03863         uint32_t blockSize);
03864 
03865 
03866   /**
03867    * @brief  Negates the elements of a Q7 vector.
03868    * @param[in]  pSrc       points to the input vector
03869    * @param[out] pDst       points to the output vector
03870    * @param[in]  blockSize  number of samples in the vector
03871    */
03872   void arm_negate_q7(
03873   const q7_t * pSrc,
03874         q7_t * pDst,
03875         uint32_t blockSize);
03876 
03877 
03878   /**
03879    * @brief  Negates the elements of a Q15 vector.
03880    * @param[in]  pSrc       points to the input vector
03881    * @param[out] pDst       points to the output vector
03882    * @param[in]  blockSize  number of samples in the vector
03883    */
03884   void arm_negate_q15(
03885   const q15_t * pSrc,
03886         q15_t * pDst,
03887         uint32_t blockSize);
03888 
03889 
03890   /**
03891    * @brief  Negates the elements of a Q31 vector.
03892    * @param[in]  pSrc       points to the input vector
03893    * @param[out] pDst       points to the output vector
03894    * @param[in]  blockSize  number of samples in the vector
03895    */
03896   void arm_negate_q31(
03897   const q31_t * pSrc,
03898         q31_t * pDst,
03899         uint32_t blockSize);
03900 
03901 
03902   /**
03903    * @brief  Copies the elements of a floating-point vector.
03904    * @param[in]  pSrc       input pointer
03905    * @param[out] pDst       output pointer
03906    * @param[in]  blockSize  number of samples to process
03907    */
03908   void arm_copy_f32(
03909   const float32_t * pSrc,
03910         float32_t * pDst,
03911         uint32_t blockSize);
03912 
03913 
03914   /**
03915    * @brief  Copies the elements of a Q7 vector.
03916    * @param[in]  pSrc       input pointer
03917    * @param[out] pDst       output pointer
03918    * @param[in]  blockSize  number of samples to process
03919    */
03920   void arm_copy_q7(
03921   const q7_t * pSrc,
03922         q7_t * pDst,
03923         uint32_t blockSize);
03924 
03925 
03926   /**
03927    * @brief  Copies the elements of a Q15 vector.
03928    * @param[in]  pSrc       input pointer
03929    * @param[out] pDst       output pointer
03930    * @param[in]  blockSize  number of samples to process
03931    */
03932   void arm_copy_q15(
03933   const q15_t * pSrc,
03934         q15_t * pDst,
03935         uint32_t blockSize);
03936 
03937 
03938   /**
03939    * @brief  Copies the elements of a Q31 vector.
03940    * @param[in]  pSrc       input pointer
03941    * @param[out] pDst       output pointer
03942    * @param[in]  blockSize  number of samples to process
03943    */
03944   void arm_copy_q31(
03945   const q31_t * pSrc,
03946         q31_t * pDst,
03947         uint32_t blockSize);
03948 
03949 
03950   /**
03951    * @brief  Fills a constant value into a floating-point vector.
03952    * @param[in]  value      input value to be filled
03953    * @param[out] pDst       output pointer
03954    * @param[in]  blockSize  number of samples to process
03955    */
03956   void arm_fill_f32(
03957         float32_t value,
03958         float32_t * pDst,
03959         uint32_t blockSize);
03960 
03961 
03962   /**
03963    * @brief  Fills a constant value into a Q7 vector.
03964    * @param[in]  value      input value to be filled
03965    * @param[out] pDst       output pointer
03966    * @param[in]  blockSize  number of samples to process
03967    */
03968   void arm_fill_q7(
03969         q7_t value,
03970         q7_t * pDst,
03971         uint32_t blockSize);
03972 
03973 
03974   /**
03975    * @brief  Fills a constant value into a Q15 vector.
03976    * @param[in]  value      input value to be filled
03977    * @param[out] pDst       output pointer
03978    * @param[in]  blockSize  number of samples to process
03979    */
03980   void arm_fill_q15(
03981         q15_t value,
03982         q15_t * pDst,
03983         uint32_t blockSize);
03984 
03985 
03986   /**
03987    * @brief  Fills a constant value into a Q31 vector.
03988    * @param[in]  value      input value to be filled
03989    * @param[out] pDst       output pointer
03990    * @param[in]  blockSize  number of samples to process
03991    */
03992   void arm_fill_q31(
03993         q31_t value,
03994         q31_t * pDst,
03995         uint32_t blockSize);
03996 
03997 
03998 /**
03999  * @brief Convolution of floating-point sequences.
04000  * @param[in]  pSrcA    points to the first input sequence.
04001  * @param[in]  srcALen  length of the first input sequence.
04002  * @param[in]  pSrcB    points to the second input sequence.
04003  * @param[in]  srcBLen  length of the second input sequence.
04004  * @param[out] pDst     points to the location where the output result is written.  Length srcALen+srcBLen-1.
04005  */
04006   void arm_conv_f32(
04007   const float32_t * pSrcA,
04008         uint32_t srcALen,
04009   const float32_t * pSrcB,
04010         uint32_t srcBLen,
04011         float32_t * pDst);
04012 
04013 
04014   /**
04015    * @brief Convolution of Q15 sequences.
04016    * @param[in]  pSrcA      points to the first input sequence.
04017    * @param[in]  srcALen    length of the first input sequence.
04018    * @param[in]  pSrcB      points to the second input sequence.
04019    * @param[in]  srcBLen    length of the second input sequence.
04020    * @param[out] pDst       points to the block of output data  Length srcALen+srcBLen-1.
04021    * @param[in]  pScratch1  points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
04022    * @param[in]  pScratch2  points to scratch buffer of size min(srcALen, srcBLen).
04023    */
04024   void arm_conv_opt_q15(
04025   const q15_t * pSrcA,
04026         uint32_t srcALen,
04027   const q15_t * pSrcB,
04028         uint32_t srcBLen,
04029         q15_t * pDst,
04030         q15_t * pScratch1,
04031         q15_t * pScratch2);
04032 
04033 
04034 /**
04035  * @brief Convolution of Q15 sequences.
04036  * @param[in]  pSrcA    points to the first input sequence.
04037  * @param[in]  srcALen  length of the first input sequence.
04038  * @param[in]  pSrcB    points to the second input sequence.
04039  * @param[in]  srcBLen  length of the second input sequence.
04040  * @param[out] pDst     points to the location where the output result is written.  Length srcALen+srcBLen-1.
04041  */
04042   void arm_conv_q15(
04043   const q15_t * pSrcA,
04044         uint32_t srcALen,
04045   const q15_t * pSrcB,
04046         uint32_t srcBLen,
04047         q15_t * pDst);
04048 
04049 
04050   /**
04051    * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
04052    * @param[in]  pSrcA    points to the first input sequence.
04053    * @param[in]  srcALen  length of the first input sequence.
04054    * @param[in]  pSrcB    points to the second input sequence.
04055    * @param[in]  srcBLen  length of the second input sequence.
04056    * @param[out] pDst     points to the block of output data  Length srcALen+srcBLen-1.
04057    */
04058   void arm_conv_fast_q15(
04059   const q15_t * pSrcA,
04060         uint32_t srcALen,
04061   const q15_t * pSrcB,
04062         uint32_t srcBLen,
04063         q15_t * pDst);
04064 
04065 
04066   /**
04067    * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
04068    * @param[in]  pSrcA      points to the first input sequence.
04069    * @param[in]  srcALen    length of the first input sequence.
04070    * @param[in]  pSrcB      points to the second input sequence.
04071    * @param[in]  srcBLen    length of the second input sequence.
04072    * @param[out] pDst       points to the block of output data  Length srcALen+srcBLen-1.
04073    * @param[in]  pScratch1  points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
04074    * @param[in]  pScratch2  points to scratch buffer of size min(srcALen, srcBLen).
04075    */
04076   void arm_conv_fast_opt_q15(
04077   const q15_t * pSrcA,
04078         uint32_t srcALen,
04079   const q15_t * pSrcB,
04080         uint32_t srcBLen,
04081         q15_t * pDst,
04082         q15_t * pScratch1,
04083         q15_t * pScratch2);
04084 
04085 
04086   /**
04087    * @brief Convolution of Q31 sequences.
04088    * @param[in]  pSrcA    points to the first input sequence.
04089    * @param[in]  srcALen  length of the first input sequence.
04090    * @param[in]  pSrcB    points to the second input sequence.
04091    * @param[in]  srcBLen  length of the second input sequence.
04092    * @param[out] pDst     points to the block of output data  Length srcALen+srcBLen-1.
04093    */
04094   void arm_conv_q31(
04095   const q31_t * pSrcA,
04096         uint32_t srcALen,
04097   const q31_t * pSrcB,
04098         uint32_t srcBLen,
04099         q31_t * pDst);
04100 
04101 
04102   /**
04103    * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
04104    * @param[in]  pSrcA    points to the first input sequence.
04105    * @param[in]  srcALen  length of the first input sequence.
04106    * @param[in]  pSrcB    points to the second input sequence.
04107    * @param[in]  srcBLen  length of the second input sequence.
04108    * @param[out] pDst     points to the block of output data  Length srcALen+srcBLen-1.
04109    */
04110   void arm_conv_fast_q31(
04111   const q31_t * pSrcA,
04112         uint32_t srcALen,
04113   const q31_t * pSrcB,
04114         uint32_t srcBLen,
04115         q31_t * pDst);
04116 
04117 
04118     /**
04119    * @brief Convolution of Q7 sequences.
04120    * @param[in]  pSrcA      points to the first input sequence.
04121    * @param[in]  srcALen    length of the first input sequence.
04122    * @param[in]  pSrcB      points to the second input sequence.
04123    * @param[in]  srcBLen    length of the second input sequence.
04124    * @param[out] pDst       points to the block of output data  Length srcALen+srcBLen-1.
04125    * @param[in]  pScratch1  points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
04126    * @param[in]  pScratch2  points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
04127    */
04128   void arm_conv_opt_q7(
04129   const q7_t * pSrcA,
04130         uint32_t srcALen,
04131   const q7_t * pSrcB,
04132         uint32_t srcBLen,
04133         q7_t * pDst,
04134         q15_t * pScratch1,
04135         q15_t * pScratch2);
04136 
04137 
04138   /**
04139    * @brief Convolution of Q7 sequences.
04140    * @param[in]  pSrcA    points to the first input sequence.
04141    * @param[in]  srcALen  length of the first input sequence.
04142    * @param[in]  pSrcB    points to the second input sequence.
04143    * @param[in]  srcBLen  length of the second input sequence.
04144    * @param[out] pDst     points to the block of output data  Length srcALen+srcBLen-1.
04145    */
04146   void arm_conv_q7(
04147   const q7_t * pSrcA,
04148         uint32_t srcALen,
04149   const q7_t * pSrcB,
04150         uint32_t srcBLen,
04151         q7_t * pDst);
04152 
04153 
04154   /**
04155    * @brief Partial convolution of floating-point sequences.
04156    * @param[in]  pSrcA       points to the first input sequence.
04157    * @param[in]  srcALen     length of the first input sequence.
04158    * @param[in]  pSrcB       points to the second input sequence.
04159    * @param[in]  srcBLen     length of the second input sequence.
04160    * @param[out] pDst        points to the block of output data
04161    * @param[in]  firstIndex  is the first output sample to start with.
04162    * @param[in]  numPoints   is the number of output points to be computed.
04163    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
04164    */
04165   arm_status arm_conv_partial_f32(
04166   const float32_t * pSrcA,
04167         uint32_t srcALen,
04168   const float32_t * pSrcB,
04169         uint32_t srcBLen,
04170         float32_t * pDst,
04171         uint32_t firstIndex,
04172         uint32_t numPoints);
04173 
04174 
04175   /**
04176    * @brief Partial convolution of Q15 sequences.
04177    * @param[in]  pSrcA       points to the first input sequence.
04178    * @param[in]  srcALen     length of the first input sequence.
04179    * @param[in]  pSrcB       points to the second input sequence.
04180    * @param[in]  srcBLen     length of the second input sequence.
04181    * @param[out] pDst        points to the block of output data
04182    * @param[in]  firstIndex  is the first output sample to start with.
04183    * @param[in]  numPoints   is the number of output points to be computed.
04184    * @param[in]  pScratch1   points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
04185    * @param[in]  pScratch2   points to scratch buffer of size min(srcALen, srcBLen).
04186    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
04187    */
04188   arm_status arm_conv_partial_opt_q15(
04189   const q15_t * pSrcA,
04190         uint32_t srcALen,
04191   const q15_t * pSrcB,
04192         uint32_t srcBLen,
04193         q15_t * pDst,
04194         uint32_t firstIndex,
04195         uint32_t numPoints,
04196         q15_t * pScratch1,
04197         q15_t * pScratch2);
04198 
04199 
04200   /**
04201    * @brief Partial convolution of Q15 sequences.
04202    * @param[in]  pSrcA       points to the first input sequence.
04203    * @param[in]  srcALen     length of the first input sequence.
04204    * @param[in]  pSrcB       points to the second input sequence.
04205    * @param[in]  srcBLen     length of the second input sequence.
04206    * @param[out] pDst        points to the block of output data
04207    * @param[in]  firstIndex  is the first output sample to start with.
04208    * @param[in]  numPoints   is the number of output points to be computed.
04209    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
04210    */
04211   arm_status arm_conv_partial_q15(
04212   const q15_t * pSrcA,
04213         uint32_t srcALen,
04214   const q15_t * pSrcB,
04215         uint32_t srcBLen,
04216         q15_t * pDst,
04217         uint32_t firstIndex,
04218         uint32_t numPoints);
04219 
04220 
04221   /**
04222    * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
04223    * @param[in]  pSrcA       points to the first input sequence.
04224    * @param[in]  srcALen     length of the first input sequence.
04225    * @param[in]  pSrcB       points to the second input sequence.
04226    * @param[in]  srcBLen     length of the second input sequence.
04227    * @param[out] pDst        points to the block of output data
04228    * @param[in]  firstIndex  is the first output sample to start with.
04229    * @param[in]  numPoints   is the number of output points to be computed.
04230    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
04231    */
04232   arm_status arm_conv_partial_fast_q15(
04233   const q15_t * pSrcA,
04234         uint32_t srcALen,
04235   const q15_t * pSrcB,
04236         uint32_t srcBLen,
04237         q15_t * pDst,
04238         uint32_t firstIndex,
04239         uint32_t numPoints);
04240 
04241 
04242   /**
04243    * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
04244    * @param[in]  pSrcA       points to the first input sequence.
04245    * @param[in]  srcALen     length of the first input sequence.
04246    * @param[in]  pSrcB       points to the second input sequence.
04247    * @param[in]  srcBLen     length of the second input sequence.
04248    * @param[out] pDst        points to the block of output data
04249    * @param[in]  firstIndex  is the first output sample to start with.
04250    * @param[in]  numPoints   is the number of output points to be computed.
04251    * @param[in]  pScratch1   points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
04252    * @param[in]  pScratch2   points to scratch buffer of size min(srcALen, srcBLen).
04253    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
04254    */
04255   arm_status arm_conv_partial_fast_opt_q15(
04256   const q15_t * pSrcA,
04257         uint32_t srcALen,
04258   const q15_t * pSrcB,
04259         uint32_t srcBLen,
04260         q15_t * pDst,
04261         uint32_t firstIndex,
04262         uint32_t numPoints,
04263         q15_t * pScratch1,
04264         q15_t * pScratch2);
04265 
04266 
04267   /**
04268    * @brief Partial convolution of Q31 sequences.
04269    * @param[in]  pSrcA       points to the first input sequence.
04270    * @param[in]  srcALen     length of the first input sequence.
04271    * @param[in]  pSrcB       points to the second input sequence.
04272    * @param[in]  srcBLen     length of the second input sequence.
04273    * @param[out] pDst        points to the block of output data
04274    * @param[in]  firstIndex  is the first output sample to start with.
04275    * @param[in]  numPoints   is the number of output points to be computed.
04276    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
04277    */
04278   arm_status arm_conv_partial_q31(
04279   const q31_t * pSrcA,
04280         uint32_t srcALen,
04281   const q31_t * pSrcB,
04282         uint32_t srcBLen,
04283         q31_t * pDst,
04284         uint32_t firstIndex,
04285         uint32_t numPoints);
04286 
04287 
04288   /**
04289    * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
04290    * @param[in]  pSrcA       points to the first input sequence.
04291    * @param[in]  srcALen     length of the first input sequence.
04292    * @param[in]  pSrcB       points to the second input sequence.
04293    * @param[in]  srcBLen     length of the second input sequence.
04294    * @param[out] pDst        points to the block of output data
04295    * @param[in]  firstIndex  is the first output sample to start with.
04296    * @param[in]  numPoints   is the number of output points to be computed.
04297    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
04298    */
04299   arm_status arm_conv_partial_fast_q31(
04300   const q31_t * pSrcA,
04301         uint32_t srcALen,
04302   const q31_t * pSrcB,
04303         uint32_t srcBLen,
04304         q31_t * pDst,
04305         uint32_t firstIndex,
04306         uint32_t numPoints);
04307 
04308 
04309   /**
04310    * @brief Partial convolution of Q7 sequences
04311    * @param[in]  pSrcA       points to the first input sequence.
04312    * @param[in]  srcALen     length of the first input sequence.
04313    * @param[in]  pSrcB       points to the second input sequence.
04314    * @param[in]  srcBLen     length of the second input sequence.
04315    * @param[out] pDst        points to the block of output data
04316    * @param[in]  firstIndex  is the first output sample to start with.
04317    * @param[in]  numPoints   is the number of output points to be computed.
04318    * @param[in]  pScratch1   points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
04319    * @param[in]  pScratch2   points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
04320    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
04321    */
04322   arm_status arm_conv_partial_opt_q7(
04323   const q7_t * pSrcA,
04324         uint32_t srcALen,
04325   const q7_t * pSrcB,
04326         uint32_t srcBLen,
04327         q7_t * pDst,
04328         uint32_t firstIndex,
04329         uint32_t numPoints,
04330         q15_t * pScratch1,
04331         q15_t * pScratch2);
04332 
04333 
04334 /**
04335    * @brief Partial convolution of Q7 sequences.
04336    * @param[in]  pSrcA       points to the first input sequence.
04337    * @param[in]  srcALen     length of the first input sequence.
04338    * @param[in]  pSrcB       points to the second input sequence.
04339    * @param[in]  srcBLen     length of the second input sequence.
04340    * @param[out] pDst        points to the block of output data
04341    * @param[in]  firstIndex  is the first output sample to start with.
04342    * @param[in]  numPoints   is the number of output points to be computed.
04343    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
04344    */
04345   arm_status arm_conv_partial_q7(
04346   const q7_t * pSrcA,
04347         uint32_t srcALen,
04348   const q7_t * pSrcB,
04349         uint32_t srcBLen,
04350         q7_t * pDst,
04351         uint32_t firstIndex,
04352         uint32_t numPoints);
04353 
04354 
04355   /**
04356    * @brief Instance structure for the Q15 FIR decimator.
04357    */
04358   typedef struct
04359   {
04360           uint8_t M;                  /**< decimation factor. */
04361           uint16_t numTaps;           /**< number of coefficients in the filter. */
04362     const q15_t *pCoeffs;             /**< points to the coefficient array. The array is of length numTaps.*/
04363           q15_t *pState;              /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
04364   } arm_fir_decimate_instance_q15;
04365 
04366   /**
04367    * @brief Instance structure for the Q31 FIR decimator.
04368    */
04369   typedef struct
04370   {
04371           uint8_t M;                  /**< decimation factor. */
04372           uint16_t numTaps;           /**< number of coefficients in the filter. */
04373     const q31_t *pCoeffs;             /**< points to the coefficient array. The array is of length numTaps.*/
04374           q31_t *pState;              /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
04375   } arm_fir_decimate_instance_q31;
04376 
04377 /**
04378   @brief Instance structure for floating-point FIR decimator.
04379  */
04380 typedef struct
04381   {
04382           uint8_t M;                  /**< decimation factor. */
04383           uint16_t numTaps;           /**< number of coefficients in the filter. */
04384     const float32_t *pCoeffs;         /**< points to the coefficient array. The array is of length numTaps.*/
04385           float32_t *pState;          /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
04386   } arm_fir_decimate_instance_f32;
04387 
04388 
04389 /**
04390   @brief         Processing function for floating-point FIR decimator.
04391   @param[in]     S         points to an instance of the floating-point FIR decimator structure
04392   @param[in]     pSrc      points to the block of input data
04393   @param[out]    pDst      points to the block of output data
04394   @param[in]     blockSize number of samples to process
04395  */
04396 void arm_fir_decimate_f32(
04397   const arm_fir_decimate_instance_f32 * S,
04398   const float32_t * pSrc,
04399         float32_t * pDst,
04400         uint32_t blockSize);
04401 
04402 
04403 /**
04404   @brief         Initialization function for the floating-point FIR decimator.
04405   @param[in,out] S          points to an instance of the floating-point FIR decimator structure
04406   @param[in]     numTaps    number of coefficients in the filter
04407   @param[in]     M          decimation factor
04408   @param[in]     pCoeffs    points to the filter coefficients
04409   @param[in]     pState     points to the state buffer
04410   @param[in]     blockSize  number of input samples to process per call
04411   @return        execution status
04412                    - \ref ARM_MATH_SUCCESS      : Operation successful
04413                    - \ref ARM_MATH_LENGTH_ERROR : <code>blockSize</code> is not a multiple of <code>M</code>
04414  */
04415 arm_status arm_fir_decimate_init_f32(
04416         arm_fir_decimate_instance_f32 * S,
04417         uint16_t numTaps,
04418         uint8_t M,
04419   const float32_t * pCoeffs,
04420         float32_t * pState,
04421         uint32_t blockSize);
04422 
04423 
04424   /**
04425    * @brief Processing function for the Q15 FIR decimator.
04426    * @param[in]  S          points to an instance of the Q15 FIR decimator structure.
04427    * @param[in]  pSrc       points to the block of input data.
04428    * @param[out] pDst       points to the block of output data
04429    * @param[in]  blockSize  number of input samples to process per call.
04430    */
04431   void arm_fir_decimate_q15(
04432   const arm_fir_decimate_instance_q15 * S,
04433   const q15_t * pSrc,
04434         q15_t * pDst,
04435         uint32_t blockSize);
04436 
04437 
04438   /**
04439    * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
04440    * @param[in]  S          points to an instance of the Q15 FIR decimator structure.
04441    * @param[in]  pSrc       points to the block of input data.
04442    * @param[out] pDst       points to the block of output data
04443    * @param[in]  blockSize  number of input samples to process per call.
04444    */
04445   void arm_fir_decimate_fast_q15(
04446   const arm_fir_decimate_instance_q15 * S,
04447   const q15_t * pSrc,
04448         q15_t * pDst,
04449         uint32_t blockSize);
04450 
04451 
04452   /**
04453    * @brief  Initialization function for the Q15 FIR decimator.
04454    * @param[in,out] S          points to an instance of the Q15 FIR decimator structure.
04455    * @param[in]     numTaps    number of coefficients in the filter.
04456    * @param[in]     M          decimation factor.
04457    * @param[in]     pCoeffs    points to the filter coefficients.
04458    * @param[in]     pState     points to the state buffer.
04459    * @param[in]     blockSize  number of input samples to process per call.
04460    * @return    The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
04461    * <code>blockSize</code> is not a multiple of <code>M</code>.
04462    */
04463   arm_status arm_fir_decimate_init_q15(
04464         arm_fir_decimate_instance_q15 * S,
04465         uint16_t numTaps,
04466         uint8_t M,
04467   const q15_t * pCoeffs,
04468         q15_t * pState,
04469         uint32_t blockSize);
04470 
04471 
04472   /**
04473    * @brief Processing function for the Q31 FIR decimator.
04474    * @param[in]  S     points to an instance of the Q31 FIR decimator structure.
04475    * @param[in]  pSrc  points to the block of input data.
04476    * @param[out] pDst  points to the block of output data
04477    * @param[in] blockSize number of input samples to process per call.
04478    */
04479   void arm_fir_decimate_q31(
04480   const arm_fir_decimate_instance_q31 * S,
04481   const q31_t * pSrc,
04482         q31_t * pDst,
04483         uint32_t blockSize);
04484 
04485   /**
04486    * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
04487    * @param[in]  S          points to an instance of the Q31 FIR decimator structure.
04488    * @param[in]  pSrc       points to the block of input data.
04489    * @param[out] pDst       points to the block of output data
04490    * @param[in]  blockSize  number of input samples to process per call.
04491    */
04492   void arm_fir_decimate_fast_q31(
04493   const arm_fir_decimate_instance_q31 * S,
04494   const q31_t * pSrc,
04495         q31_t * pDst,
04496         uint32_t blockSize);
04497 
04498 
04499   /**
04500    * @brief  Initialization function for the Q31 FIR decimator.
04501    * @param[in,out] S          points to an instance of the Q31 FIR decimator structure.
04502    * @param[in]     numTaps    number of coefficients in the filter.
04503    * @param[in]     M          decimation factor.
04504    * @param[in]     pCoeffs    points to the filter coefficients.
04505    * @param[in]     pState     points to the state buffer.
04506    * @param[in]     blockSize  number of input samples to process per call.
04507    * @return    The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
04508    * <code>blockSize</code> is not a multiple of <code>M</code>.
04509    */
04510   arm_status arm_fir_decimate_init_q31(
04511         arm_fir_decimate_instance_q31 * S,
04512         uint16_t numTaps,
04513         uint8_t M,
04514   const q31_t * pCoeffs,
04515         q31_t * pState,
04516         uint32_t blockSize);
04517 
04518 
04519   /**
04520    * @brief Instance structure for the Q15 FIR interpolator.
04521    */
04522   typedef struct
04523   {
04524         uint8_t L;                      /**< upsample factor. */
04525         uint16_t phaseLength;           /**< length of each polyphase filter component. */
04526   const q15_t *pCoeffs;                 /**< points to the coefficient array. The array is of length L*phaseLength. */
04527         q15_t *pState;                  /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
04528   } arm_fir_interpolate_instance_q15;
04529 
04530   /**
04531    * @brief Instance structure for the Q31 FIR interpolator.
04532    */
04533   typedef struct
04534   {
04535         uint8_t L;                      /**< upsample factor. */
04536         uint16_t phaseLength;           /**< length of each polyphase filter component. */
04537   const q31_t *pCoeffs;                 /**< points to the coefficient array. The array is of length L*phaseLength. */
04538         q31_t *pState;                  /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
04539   } arm_fir_interpolate_instance_q31;
04540 
04541   /**
04542    * @brief Instance structure for the floating-point FIR interpolator.
04543    */
04544   typedef struct
04545   {
04546         uint8_t L;                     /**< upsample factor. */
04547         uint16_t phaseLength;          /**< length of each polyphase filter component. */
04548   const float32_t *pCoeffs;            /**< points to the coefficient array. The array is of length L*phaseLength. */
04549         float32_t *pState;             /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
04550   } arm_fir_interpolate_instance_f32;
04551 
04552 
04553   /**
04554    * @brief Processing function for the Q15 FIR interpolator.
04555    * @param[in]  S          points to an instance of the Q15 FIR interpolator structure.
04556    * @param[in]  pSrc       points to the block of input data.
04557    * @param[out] pDst       points to the block of output data.
04558    * @param[in]  blockSize  number of input samples to process per call.
04559    */
04560   void arm_fir_interpolate_q15(
04561   const arm_fir_interpolate_instance_q15 * S,
04562   const q15_t * pSrc,
04563         q15_t * pDst,
04564         uint32_t blockSize);
04565 
04566 
04567   /**
04568    * @brief  Initialization function for the Q15 FIR interpolator.
04569    * @param[in,out] S          points to an instance of the Q15 FIR interpolator structure.
04570    * @param[in]     L          upsample factor.
04571    * @param[in]     numTaps    number of filter coefficients in the filter.
04572    * @param[in]     pCoeffs    points to the filter coefficient buffer.
04573    * @param[in]     pState     points to the state buffer.
04574    * @param[in]     blockSize  number of input samples to process per call.
04575    * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
04576    * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
04577    */
04578   arm_status arm_fir_interpolate_init_q15(
04579         arm_fir_interpolate_instance_q15 * S,
04580         uint8_t L,
04581         uint16_t numTaps,
04582   const q15_t * pCoeffs,
04583         q15_t * pState,
04584         uint32_t blockSize);
04585 
04586 
04587   /**
04588    * @brief Processing function for the Q31 FIR interpolator.
04589    * @param[in]  S          points to an instance of the Q15 FIR interpolator structure.
04590    * @param[in]  pSrc       points to the block of input data.
04591    * @param[out] pDst       points to the block of output data.
04592    * @param[in]  blockSize  number of input samples to process per call.
04593    */
04594   void arm_fir_interpolate_q31(
04595   const arm_fir_interpolate_instance_q31 * S,
04596   const q31_t * pSrc,
04597         q31_t * pDst,
04598         uint32_t blockSize);
04599 
04600 
04601   /**
04602    * @brief  Initialization function for the Q31 FIR interpolator.
04603    * @param[in,out] S          points to an instance of the Q31 FIR interpolator structure.
04604    * @param[in]     L          upsample factor.
04605    * @param[in]     numTaps    number of filter coefficients in the filter.
04606    * @param[in]     pCoeffs    points to the filter coefficient buffer.
04607    * @param[in]     pState     points to the state buffer.
04608    * @param[in]     blockSize  number of input samples to process per call.
04609    * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
04610    * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
04611    */
04612   arm_status arm_fir_interpolate_init_q31(
04613         arm_fir_interpolate_instance_q31 * S,
04614         uint8_t L,
04615         uint16_t numTaps,
04616   const q31_t * pCoeffs,
04617         q31_t * pState,
04618         uint32_t blockSize);
04619 
04620 
04621   /**
04622    * @brief Processing function for the floating-point FIR interpolator.
04623    * @param[in]  S          points to an instance of the floating-point FIR interpolator structure.
04624    * @param[in]  pSrc       points to the block of input data.
04625    * @param[out] pDst       points to the block of output data.
04626    * @param[in]  blockSize  number of input samples to process per call.
04627    */
04628   void arm_fir_interpolate_f32(
04629   const arm_fir_interpolate_instance_f32 * S,
04630   const float32_t * pSrc,
04631         float32_t * pDst,
04632         uint32_t blockSize);
04633 
04634 
04635   /**
04636    * @brief  Initialization function for the floating-point FIR interpolator.
04637    * @param[in,out] S          points to an instance of the floating-point FIR interpolator structure.
04638    * @param[in]     L          upsample factor.
04639    * @param[in]     numTaps    number of filter coefficients in the filter.
04640    * @param[in]     pCoeffs    points to the filter coefficient buffer.
04641    * @param[in]     pState     points to the state buffer.
04642    * @param[in]     blockSize  number of input samples to process per call.
04643    * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
04644    * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
04645    */
04646   arm_status arm_fir_interpolate_init_f32(
04647         arm_fir_interpolate_instance_f32 * S,
04648         uint8_t L,
04649         uint16_t numTaps,
04650   const float32_t * pCoeffs,
04651         float32_t * pState,
04652         uint32_t blockSize);
04653 
04654 
04655   /**
04656    * @brief Instance structure for the high precision Q31 Biquad cascade filter.
04657    */
04658   typedef struct
04659   {
04660           uint8_t numStages;       /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
04661           q63_t *pState;           /**< points to the array of state coefficients.  The array is of length 4*numStages. */
04662     const q31_t *pCoeffs;          /**< points to the array of coefficients.  The array is of length 5*numStages. */
04663           uint8_t postShift;       /**< additional shift, in bits, applied to each output sample. */
04664   } arm_biquad_cas_df1_32x64_ins_q31;
04665 
04666 
04667   /**
04668    * @param[in]  S          points to an instance of the high precision Q31 Biquad cascade filter structure.
04669    * @param[in]  pSrc       points to the block of input data.
04670    * @param[out] pDst       points to the block of output data
04671    * @param[in]  blockSize  number of samples to process.
04672    */
04673   void arm_biquad_cas_df1_32x64_q31(
04674   const arm_biquad_cas_df1_32x64_ins_q31 * S,
04675   const q31_t * pSrc,
04676         q31_t * pDst,
04677         uint32_t blockSize);
04678 
04679 
04680   /**
04681    * @param[in,out] S          points to an instance of the high precision Q31 Biquad cascade filter structure.
04682    * @param[in]     numStages  number of 2nd order stages in the filter.
04683    * @param[in]     pCoeffs    points to the filter coefficients.
04684    * @param[in]     pState     points to the state buffer.
04685    * @param[in]     postShift  shift to be applied to the output. Varies according to the coefficients format
04686    */
04687   void arm_biquad_cas_df1_32x64_init_q31(
04688         arm_biquad_cas_df1_32x64_ins_q31 * S,
04689         uint8_t numStages,
04690   const q31_t * pCoeffs,
04691         q63_t * pState,
04692         uint8_t postShift);
04693 
04694 
04695   /**
04696    * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
04697    */
04698   typedef struct
04699   {
04700           uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
04701           float32_t *pState;         /**< points to the array of state coefficients.  The array is of length 2*numStages. */
04702     const float32_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */
04703   } arm_biquad_cascade_df2T_instance_f32;
04704 
04705   /**
04706    * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
04707    */
04708   typedef struct
04709   {
04710           uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
04711           float32_t *pState;         /**< points to the array of state coefficients.  The array is of length 4*numStages. */
04712     const float32_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */
04713   } arm_biquad_cascade_stereo_df2T_instance_f32;
04714 
04715   /**
04716    * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
04717    */
04718   typedef struct
04719   {
04720           uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
04721           float64_t *pState;         /**< points to the array of state coefficients.  The array is of length 2*numStages. */
04722     const float64_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */
04723   } arm_biquad_cascade_df2T_instance_f64;
04724 
04725 
04726   /**
04727    * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
04728    * @param[in]  S          points to an instance of the filter data structure.
04729    * @param[in]  pSrc       points to the block of input data.
04730    * @param[out] pDst       points to the block of output data
04731    * @param[in]  blockSize  number of samples to process.
04732    */
04733   void arm_biquad_cascade_df2T_f32(
04734   const arm_biquad_cascade_df2T_instance_f32 * S,
04735   const float32_t * pSrc,
04736         float32_t * pDst,
04737         uint32_t blockSize);
04738 
04739 
04740   /**
04741    * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
04742    * @param[in]  S          points to an instance of the filter data structure.
04743    * @param[in]  pSrc       points to the block of input data.
04744    * @param[out] pDst       points to the block of output data
04745    * @param[in]  blockSize  number of samples to process.
04746    */
04747   void arm_biquad_cascade_stereo_df2T_f32(
04748   const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
04749   const float32_t * pSrc,
04750         float32_t * pDst,
04751         uint32_t blockSize);
04752 
04753 
04754   /**
04755    * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
04756    * @param[in]  S          points to an instance of the filter data structure.
04757    * @param[in]  pSrc       points to the block of input data.
04758    * @param[out] pDst       points to the block of output data
04759    * @param[in]  blockSize  number of samples to process.
04760    */
04761   void arm_biquad_cascade_df2T_f64(
04762   const arm_biquad_cascade_df2T_instance_f64 * S,
04763   const float64_t * pSrc,
04764         float64_t * pDst,
04765         uint32_t blockSize);
04766 
04767 
04768 #if defined(ARM_MATH_NEON) 
04769 void arm_biquad_cascade_df2T_compute_coefs_f32(
04770   arm_biquad_cascade_df2T_instance_f32 * S,
04771   uint8_t numStages,
04772   float32_t * pCoeffs);
04773 #endif
04774   /**
04775    * @brief  Initialization function for the floating-point transposed direct form II Biquad cascade filter.
04776    * @param[in,out] S          points to an instance of the filter data structure.
04777    * @param[in]     numStages  number of 2nd order stages in the filter.
04778    * @param[in]     pCoeffs    points to the filter coefficients.
04779    * @param[in]     pState     points to the state buffer.
04780    */
04781   void arm_biquad_cascade_df2T_init_f32(
04782         arm_biquad_cascade_df2T_instance_f32 * S,
04783         uint8_t numStages,
04784   const float32_t * pCoeffs,
04785         float32_t * pState);
04786 
04787 
04788   /**
04789    * @brief  Initialization function for the floating-point transposed direct form II Biquad cascade filter.
04790    * @param[in,out] S          points to an instance of the filter data structure.
04791    * @param[in]     numStages  number of 2nd order stages in the filter.
04792    * @param[in]     pCoeffs    points to the filter coefficients.
04793    * @param[in]     pState     points to the state buffer.
04794    */
04795   void arm_biquad_cascade_stereo_df2T_init_f32(
04796         arm_biquad_cascade_stereo_df2T_instance_f32 * S,
04797         uint8_t numStages,
04798   const float32_t * pCoeffs,
04799         float32_t * pState);
04800 
04801 
04802   /**
04803    * @brief  Initialization function for the floating-point transposed direct form II Biquad cascade filter.
04804    * @param[in,out] S          points to an instance of the filter data structure.
04805    * @param[in]     numStages  number of 2nd order stages in the filter.
04806    * @param[in]     pCoeffs    points to the filter coefficients.
04807    * @param[in]     pState     points to the state buffer.
04808    */
04809   void arm_biquad_cascade_df2T_init_f64(
04810         arm_biquad_cascade_df2T_instance_f64 * S,
04811         uint8_t numStages,
04812         const float64_t * pCoeffs,
04813         float64_t * pState);
04814 
04815 
04816   /**
04817    * @brief Instance structure for the Q15 FIR lattice filter.
04818    */
04819   typedef struct
04820   {
04821           uint16_t numStages;                  /**< number of filter stages. */
04822           q15_t *pState;                       /**< points to the state variable array. The array is of length numStages. */
04823     const q15_t *pCoeffs;                      /**< points to the coefficient array. The array is of length numStages. */
04824   } arm_fir_lattice_instance_q15;
04825 
04826   /**
04827    * @brief Instance structure for the Q31 FIR lattice filter.
04828    */
04829   typedef struct
04830   {
04831           uint16_t numStages;                  /**< number of filter stages. */
04832           q31_t *pState;                       /**< points to the state variable array. The array is of length numStages. */
04833     const q31_t *pCoeffs;                      /**< points to the coefficient array. The array is of length numStages. */
04834   } arm_fir_lattice_instance_q31;
04835 
04836   /**
04837    * @brief Instance structure for the floating-point FIR lattice filter.
04838    */
04839   typedef struct
04840   {
04841           uint16_t numStages;                  /**< number of filter stages. */
04842           float32_t *pState;                   /**< points to the state variable array. The array is of length numStages. */
04843     const float32_t *pCoeffs;                  /**< points to the coefficient array. The array is of length numStages. */
04844   } arm_fir_lattice_instance_f32;
04845 
04846 
04847   /**
04848    * @brief Initialization function for the Q15 FIR lattice filter.
04849    * @param[in] S          points to an instance of the Q15 FIR lattice structure.
04850    * @param[in] numStages  number of filter stages.
04851    * @param[in] pCoeffs    points to the coefficient buffer.  The array is of length numStages.
04852    * @param[in] pState     points to the state buffer.  The array is of length numStages.
04853    */
04854   void arm_fir_lattice_init_q15(
04855         arm_fir_lattice_instance_q15 * S,
04856         uint16_t numStages,
04857   const q15_t * pCoeffs,
04858         q15_t * pState);
04859 
04860 
04861   /**
04862    * @brief Processing function for the Q15 FIR lattice filter.
04863    * @param[in]  S          points to an instance of the Q15 FIR lattice structure.
04864    * @param[in]  pSrc       points to the block of input data.
04865    * @param[out] pDst       points to the block of output data.
04866    * @param[in]  blockSize  number of samples to process.
04867    */
04868   void arm_fir_lattice_q15(
04869   const arm_fir_lattice_instance_q15 * S,
04870   const q15_t * pSrc,
04871         q15_t * pDst,
04872         uint32_t blockSize);
04873 
04874 
04875   /**
04876    * @brief Initialization function for the Q31 FIR lattice filter.
04877    * @param[in] S          points to an instance of the Q31 FIR lattice structure.
04878    * @param[in] numStages  number of filter stages.
04879    * @param[in] pCoeffs    points to the coefficient buffer.  The array is of length numStages.
04880    * @param[in] pState     points to the state buffer.   The array is of length numStages.
04881    */
04882   void arm_fir_lattice_init_q31(
04883         arm_fir_lattice_instance_q31 * S,
04884         uint16_t numStages,
04885   const q31_t * pCoeffs,
04886         q31_t * pState);
04887 
04888 
04889   /**
04890    * @brief Processing function for the Q31 FIR lattice filter.
04891    * @param[in]  S          points to an instance of the Q31 FIR lattice structure.
04892    * @param[in]  pSrc       points to the block of input data.
04893    * @param[out] pDst       points to the block of output data
04894    * @param[in]  blockSize  number of samples to process.
04895    */
04896   void arm_fir_lattice_q31(
04897   const arm_fir_lattice_instance_q31 * S,
04898   const q31_t * pSrc,
04899         q31_t * pDst,
04900         uint32_t blockSize);
04901 
04902 
04903 /**
04904  * @brief Initialization function for the floating-point FIR lattice filter.
04905  * @param[in] S          points to an instance of the floating-point FIR lattice structure.
04906  * @param[in] numStages  number of filter stages.
04907  * @param[in] pCoeffs    points to the coefficient buffer.  The array is of length numStages.
04908  * @param[in] pState     points to the state buffer.  The array is of length numStages.
04909  */
04910   void arm_fir_lattice_init_f32(
04911         arm_fir_lattice_instance_f32 * S,
04912         uint16_t numStages,
04913   const float32_t * pCoeffs,
04914         float32_t * pState);
04915 
04916 
04917   /**
04918    * @brief Processing function for the floating-point FIR lattice filter.
04919    * @param[in]  S          points to an instance of the floating-point FIR lattice structure.
04920    * @param[in]  pSrc       points to the block of input data.
04921    * @param[out] pDst       points to the block of output data
04922    * @param[in]  blockSize  number of samples to process.
04923    */
04924   void arm_fir_lattice_f32(
04925   const arm_fir_lattice_instance_f32 * S,
04926   const float32_t * pSrc,
04927         float32_t * pDst,
04928         uint32_t blockSize);
04929 
04930 
04931   /**
04932    * @brief Instance structure for the Q15 IIR lattice filter.
04933    */
04934   typedef struct
04935   {
04936           uint16_t numStages;                  /**< number of stages in the filter. */
04937           q15_t *pState;                       /**< points to the state variable array. The array is of length numStages+blockSize. */
04938           q15_t *pkCoeffs;                     /**< points to the reflection coefficient array. The array is of length numStages. */
04939           q15_t *pvCoeffs;                     /**< points to the ladder coefficient array. The array is of length numStages+1. */
04940   } arm_iir_lattice_instance_q15;
04941 
04942   /**
04943    * @brief Instance structure for the Q31 IIR lattice filter.
04944    */
04945   typedef struct
04946   {
04947           uint16_t numStages;                  /**< number of stages in the filter. */
04948           q31_t *pState;                       /**< points to the state variable array. The array is of length numStages+blockSize. */
04949           q31_t *pkCoeffs;                     /**< points to the reflection coefficient array. The array is of length numStages. */
04950           q31_t *pvCoeffs;                     /**< points to the ladder coefficient array. The array is of length numStages+1. */
04951   } arm_iir_lattice_instance_q31;
04952 
04953   /**
04954    * @brief Instance structure for the floating-point IIR lattice filter.
04955    */
04956   typedef struct
04957   {
04958           uint16_t numStages;                  /**< number of stages in the filter. */
04959           float32_t *pState;                   /**< points to the state variable array. The array is of length numStages+blockSize. */
04960           float32_t *pkCoeffs;                 /**< points to the reflection coefficient array. The array is of length numStages. */
04961           float32_t *pvCoeffs;                 /**< points to the ladder coefficient array. The array is of length numStages+1. */
04962   } arm_iir_lattice_instance_f32;
04963 
04964 
04965   /**
04966    * @brief Processing function for the floating-point IIR lattice filter.
04967    * @param[in]  S          points to an instance of the floating-point IIR lattice structure.
04968    * @param[in]  pSrc       points to the block of input data.
04969    * @param[out] pDst       points to the block of output data.
04970    * @param[in]  blockSize  number of samples to process.
04971    */
04972   void arm_iir_lattice_f32(
04973   const arm_iir_lattice_instance_f32 * S,
04974   const float32_t * pSrc,
04975         float32_t * pDst,
04976         uint32_t blockSize);
04977 
04978 
04979   /**
04980    * @brief Initialization function for the floating-point IIR lattice filter.
04981    * @param[in] S          points to an instance of the floating-point IIR lattice structure.
04982    * @param[in] numStages  number of stages in the filter.
04983    * @param[in] pkCoeffs   points to the reflection coefficient buffer.  The array is of length numStages.
04984    * @param[in] pvCoeffs   points to the ladder coefficient buffer.  The array is of length numStages+1.
04985    * @param[in] pState     points to the state buffer.  The array is of length numStages+blockSize-1.
04986    * @param[in] blockSize  number of samples to process.
04987    */
04988   void arm_iir_lattice_init_f32(
04989         arm_iir_lattice_instance_f32 * S,
04990         uint16_t numStages,
04991         float32_t * pkCoeffs,
04992         float32_t * pvCoeffs,
04993         float32_t * pState,
04994         uint32_t blockSize);
04995 
04996 
04997   /**
04998    * @brief Processing function for the Q31 IIR lattice filter.
04999    * @param[in]  S          points to an instance of the Q31 IIR lattice structure.
05000    * @param[in]  pSrc       points to the block of input data.
05001    * @param[out] pDst       points to the block of output data.
05002    * @param[in]  blockSize  number of samples to process.
05003    */
05004   void arm_iir_lattice_q31(
05005   const arm_iir_lattice_instance_q31 * S,
05006   const q31_t * pSrc,
05007         q31_t * pDst,
05008         uint32_t blockSize);
05009 
05010 
05011   /**
05012    * @brief Initialization function for the Q31 IIR lattice filter.
05013    * @param[in] S          points to an instance of the Q31 IIR lattice structure.
05014    * @param[in] numStages  number of stages in the filter.
05015    * @param[in] pkCoeffs   points to the reflection coefficient buffer.  The array is of length numStages.
05016    * @param[in] pvCoeffs   points to the ladder coefficient buffer.  The array is of length numStages+1.
05017    * @param[in] pState     points to the state buffer.  The array is of length numStages+blockSize.
05018    * @param[in] blockSize  number of samples to process.
05019    */
05020   void arm_iir_lattice_init_q31(
05021         arm_iir_lattice_instance_q31 * S,
05022         uint16_t numStages,
05023         q31_t * pkCoeffs,
05024         q31_t * pvCoeffs,
05025         q31_t * pState,
05026         uint32_t blockSize);
05027 
05028 
05029   /**
05030    * @brief Processing function for the Q15 IIR lattice filter.
05031    * @param[in]  S          points to an instance of the Q15 IIR lattice structure.
05032    * @param[in]  pSrc       points to the block of input data.
05033    * @param[out] pDst       points to the block of output data.
05034    * @param[in]  blockSize  number of samples to process.
05035    */
05036   void arm_iir_lattice_q15(
05037   const arm_iir_lattice_instance_q15 * S,
05038   const q15_t * pSrc,
05039         q15_t * pDst,
05040         uint32_t blockSize);
05041 
05042 
05043 /**
05044  * @brief Initialization function for the Q15 IIR lattice filter.
05045  * @param[in] S          points to an instance of the fixed-point Q15 IIR lattice structure.
05046  * @param[in] numStages  number of stages in the filter.
05047  * @param[in] pkCoeffs   points to reflection coefficient buffer.  The array is of length numStages.
05048  * @param[in] pvCoeffs   points to ladder coefficient buffer.  The array is of length numStages+1.
05049  * @param[in] pState     points to state buffer.  The array is of length numStages+blockSize.
05050  * @param[in] blockSize  number of samples to process per call.
05051  */
05052   void arm_iir_lattice_init_q15(
05053         arm_iir_lattice_instance_q15 * S,
05054         uint16_t numStages,
05055         q15_t * pkCoeffs,
05056         q15_t * pvCoeffs,
05057         q15_t * pState,
05058         uint32_t blockSize);
05059 
05060 
05061   /**
05062    * @brief Instance structure for the floating-point LMS filter.
05063    */
05064   typedef struct
05065   {
05066           uint16_t numTaps;    /**< number of coefficients in the filter. */
05067           float32_t *pState;   /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
05068           float32_t *pCoeffs;  /**< points to the coefficient array. The array is of length numTaps. */
05069           float32_t mu;        /**< step size that controls filter coefficient updates. */
05070   } arm_lms_instance_f32;
05071 
05072 
05073   /**
05074    * @brief Processing function for floating-point LMS filter.
05075    * @param[in]  S          points to an instance of the floating-point LMS filter structure.
05076    * @param[in]  pSrc       points to the block of input data.
05077    * @param[in]  pRef       points to the block of reference data.
05078    * @param[out] pOut       points to the block of output data.
05079    * @param[out] pErr       points to the block of error data.
05080    * @param[in]  blockSize  number of samples to process.
05081    */
05082   void arm_lms_f32(
05083   const arm_lms_instance_f32 * S,
05084   const float32_t * pSrc,
05085         float32_t * pRef,
05086         float32_t * pOut,
05087         float32_t * pErr,
05088         uint32_t blockSize);
05089 
05090 
05091   /**
05092    * @brief Initialization function for floating-point LMS filter.
05093    * @param[in] S          points to an instance of the floating-point LMS filter structure.
05094    * @param[in] numTaps    number of filter coefficients.
05095    * @param[in] pCoeffs    points to the coefficient buffer.
05096    * @param[in] pState     points to state buffer.
05097    * @param[in] mu         step size that controls filter coefficient updates.
05098    * @param[in] blockSize  number of samples to process.
05099    */
05100   void arm_lms_init_f32(
05101         arm_lms_instance_f32 * S,
05102         uint16_t numTaps,
05103         float32_t * pCoeffs,
05104         float32_t * pState,
05105         float32_t mu,
05106         uint32_t blockSize);
05107 
05108 
05109   /**
05110    * @brief Instance structure for the Q15 LMS filter.
05111    */
05112   typedef struct
05113   {
05114           uint16_t numTaps;    /**< number of coefficients in the filter. */
05115           q15_t *pState;       /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
05116           q15_t *pCoeffs;      /**< points to the coefficient array. The array is of length numTaps. */
05117           q15_t mu;            /**< step size that controls filter coefficient updates. */
05118           uint32_t postShift;  /**< bit shift applied to coefficients. */
05119   } arm_lms_instance_q15;
05120 
05121 
05122   /**
05123    * @brief Initialization function for the Q15 LMS filter.
05124    * @param[in] S          points to an instance of the Q15 LMS filter structure.
05125    * @param[in] numTaps    number of filter coefficients.
05126    * @param[in] pCoeffs    points to the coefficient buffer.
05127    * @param[in] pState     points to the state buffer.
05128    * @param[in] mu         step size that controls filter coefficient updates.
05129    * @param[in] blockSize  number of samples to process.
05130    * @param[in] postShift  bit shift applied to coefficients.
05131    */
05132   void arm_lms_init_q15(
05133         arm_lms_instance_q15 * S,
05134         uint16_t numTaps,
05135         q15_t * pCoeffs,
05136         q15_t * pState,
05137         q15_t mu,
05138         uint32_t blockSize,
05139         uint32_t postShift);
05140 
05141 
05142   /**
05143    * @brief Processing function for Q15 LMS filter.
05144    * @param[in]  S          points to an instance of the Q15 LMS filter structure.
05145    * @param[in]  pSrc       points to the block of input data.
05146    * @param[in]  pRef       points to the block of reference data.
05147    * @param[out] pOut       points to the block of output data.
05148    * @param[out] pErr       points to the block of error data.
05149    * @param[in]  blockSize  number of samples to process.
05150    */
05151   void arm_lms_q15(
05152   const arm_lms_instance_q15 * S,
05153   const q15_t * pSrc,
05154         q15_t * pRef,
05155         q15_t * pOut,
05156         q15_t * pErr,
05157         uint32_t blockSize);
05158 
05159 
05160   /**
05161    * @brief Instance structure for the Q31 LMS filter.
05162    */
05163   typedef struct
05164   {
05165           uint16_t numTaps;    /**< number of coefficients in the filter. */
05166           q31_t *pState;       /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
05167           q31_t *pCoeffs;      /**< points to the coefficient array. The array is of length numTaps. */
05168           q31_t mu;            /**< step size that controls filter coefficient updates. */
05169           uint32_t postShift;  /**< bit shift applied to coefficients. */
05170   } arm_lms_instance_q31;
05171 
05172 
05173   /**
05174    * @brief Processing function for Q31 LMS filter.
05175    * @param[in]  S          points to an instance of the Q15 LMS filter structure.
05176    * @param[in]  pSrc       points to the block of input data.
05177    * @param[in]  pRef       points to the block of reference data.
05178    * @param[out] pOut       points to the block of output data.
05179    * @param[out] pErr       points to the block of error data.
05180    * @param[in]  blockSize  number of samples to process.
05181    */
05182   void arm_lms_q31(
05183   const arm_lms_instance_q31 * S,
05184   const q31_t * pSrc,
05185         q31_t * pRef,
05186         q31_t * pOut,
05187         q31_t * pErr,
05188         uint32_t blockSize);
05189 
05190 
05191   /**
05192    * @brief Initialization function for Q31 LMS filter.
05193    * @param[in] S          points to an instance of the Q31 LMS filter structure.
05194    * @param[in] numTaps    number of filter coefficients.
05195    * @param[in] pCoeffs    points to coefficient buffer.
05196    * @param[in] pState     points to state buffer.
05197    * @param[in] mu         step size that controls filter coefficient updates.
05198    * @param[in] blockSize  number of samples to process.
05199    * @param[in] postShift  bit shift applied to coefficients.
05200    */
05201   void arm_lms_init_q31(
05202         arm_lms_instance_q31 * S,
05203         uint16_t numTaps,
05204         q31_t * pCoeffs,
05205         q31_t * pState,
05206         q31_t mu,
05207         uint32_t blockSize,
05208         uint32_t postShift);
05209 
05210 
05211   /**
05212    * @brief Instance structure for the floating-point normalized LMS filter.
05213    */
05214   typedef struct
05215   {
05216           uint16_t numTaps;     /**< number of coefficients in the filter. */
05217           float32_t *pState;    /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
05218           float32_t *pCoeffs;   /**< points to the coefficient array. The array is of length numTaps. */
05219           float32_t mu;         /**< step size that control filter coefficient updates. */
05220           float32_t energy;     /**< saves previous frame energy. */
05221           float32_t x0;         /**< saves previous input sample. */
05222   } arm_lms_norm_instance_f32;
05223 
05224 
05225   /**
05226    * @brief Processing function for floating-point normalized LMS filter.
05227    * @param[in]  S          points to an instance of the floating-point normalized LMS filter structure.
05228    * @param[in]  pSrc       points to the block of input data.
05229    * @param[in]  pRef       points to the block of reference data.
05230    * @param[out] pOut       points to the block of output data.
05231    * @param[out] pErr       points to the block of error data.
05232    * @param[in]  blockSize  number of samples to process.
05233    */
05234   void arm_lms_norm_f32(
05235         arm_lms_norm_instance_f32 * S,
05236   const float32_t * pSrc,
05237         float32_t * pRef,
05238         float32_t * pOut,
05239         float32_t * pErr,
05240         uint32_t blockSize);
05241 
05242 
05243   /**
05244    * @brief Initialization function for floating-point normalized LMS filter.
05245    * @param[in] S          points to an instance of the floating-point LMS filter structure.
05246    * @param[in] numTaps    number of filter coefficients.
05247    * @param[in] pCoeffs    points to coefficient buffer.
05248    * @param[in] pState     points to state buffer.
05249    * @param[in] mu         step size that controls filter coefficient updates.
05250    * @param[in] blockSize  number of samples to process.
05251    */
05252   void arm_lms_norm_init_f32(
05253         arm_lms_norm_instance_f32 * S,
05254         uint16_t numTaps,
05255         float32_t * pCoeffs,
05256         float32_t * pState,
05257         float32_t mu,
05258         uint32_t blockSize);
05259 
05260 
05261   /**
05262    * @brief Instance structure for the Q31 normalized LMS filter.
05263    */
05264   typedef struct
05265   {
05266           uint16_t numTaps;     /**< number of coefficients in the filter. */
05267           q31_t *pState;        /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
05268           q31_t *pCoeffs;       /**< points to the coefficient array. The array is of length numTaps. */
05269           q31_t mu;             /**< step size that controls filter coefficient updates. */
05270           uint8_t postShift;    /**< bit shift applied to coefficients. */
05271     const q31_t *recipTable;    /**< points to the reciprocal initial value table. */
05272           q31_t energy;         /**< saves previous frame energy. */
05273           q31_t x0;             /**< saves previous input sample. */
05274   } arm_lms_norm_instance_q31;
05275 
05276 
05277   /**
05278    * @brief Processing function for Q31 normalized LMS filter.
05279    * @param[in]  S          points to an instance of the Q31 normalized LMS filter structure.
05280    * @param[in]  pSrc       points to the block of input data.
05281    * @param[in]  pRef       points to the block of reference data.
05282    * @param[out] pOut       points to the block of output data.
05283    * @param[out] pErr       points to the block of error data.
05284    * @param[in]  blockSize  number of samples to process.
05285    */
05286   void arm_lms_norm_q31(
05287         arm_lms_norm_instance_q31 * S,
05288   const q31_t * pSrc,
05289         q31_t * pRef,
05290         q31_t * pOut,
05291         q31_t * pErr,
05292         uint32_t blockSize);
05293 
05294 
05295   /**
05296    * @brief Initialization function for Q31 normalized LMS filter.
05297    * @param[in] S          points to an instance of the Q31 normalized LMS filter structure.
05298    * @param[in] numTaps    number of filter coefficients.
05299    * @param[in] pCoeffs    points to coefficient buffer.
05300    * @param[in] pState     points to state buffer.
05301    * @param[in] mu         step size that controls filter coefficient updates.
05302    * @param[in] blockSize  number of samples to process.
05303    * @param[in] postShift  bit shift applied to coefficients.
05304    */
05305   void arm_lms_norm_init_q31(
05306         arm_lms_norm_instance_q31 * S,
05307         uint16_t numTaps,
05308         q31_t * pCoeffs,
05309         q31_t * pState,
05310         q31_t mu,
05311         uint32_t blockSize,
05312         uint8_t postShift);
05313 
05314 
05315   /**
05316    * @brief Instance structure for the Q15 normalized LMS filter.
05317    */
05318   typedef struct
05319   {
05320           uint16_t numTaps;     /**< Number of coefficients in the filter. */
05321           q15_t *pState;        /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
05322           q15_t *pCoeffs;       /**< points to the coefficient array. The array is of length numTaps. */
05323           q15_t mu;             /**< step size that controls filter coefficient updates. */
05324           uint8_t postShift;    /**< bit shift applied to coefficients. */
05325     const q15_t *recipTable;    /**< Points to the reciprocal initial value table. */
05326           q15_t energy;         /**< saves previous frame energy. */
05327           q15_t x0;             /**< saves previous input sample. */
05328   } arm_lms_norm_instance_q15;
05329 
05330 
05331   /**
05332    * @brief Processing function for Q15 normalized LMS filter.
05333    * @param[in]  S          points to an instance of the Q15 normalized LMS filter structure.
05334    * @param[in]  pSrc       points to the block of input data.
05335    * @param[in]  pRef       points to the block of reference data.
05336    * @param[out] pOut       points to the block of output data.
05337    * @param[out] pErr       points to the block of error data.
05338    * @param[in]  blockSize  number of samples to process.
05339    */
05340   void arm_lms_norm_q15(
05341         arm_lms_norm_instance_q15 * S,
05342   const q15_t * pSrc,
05343         q15_t * pRef,
05344         q15_t * pOut,
05345         q15_t * pErr,
05346         uint32_t blockSize);
05347 
05348 
05349   /**
05350    * @brief Initialization function for Q15 normalized LMS filter.
05351    * @param[in] S          points to an instance of the Q15 normalized LMS filter structure.
05352    * @param[in] numTaps    number of filter coefficients.
05353    * @param[in] pCoeffs    points to coefficient buffer.
05354    * @param[in] pState     points to state buffer.
05355    * @param[in] mu         step size that controls filter coefficient updates.
05356    * @param[in] blockSize  number of samples to process.
05357    * @param[in] postShift  bit shift applied to coefficients.
05358    */
05359   void arm_lms_norm_init_q15(
05360         arm_lms_norm_instance_q15 * S,
05361         uint16_t numTaps,
05362         q15_t * pCoeffs,
05363         q15_t * pState,
05364         q15_t mu,
05365         uint32_t blockSize,
05366         uint8_t postShift);
05367 
05368 
05369   /**
05370    * @brief Correlation of floating-point sequences.
05371    * @param[in]  pSrcA    points to the first input sequence.
05372    * @param[in]  srcALen  length of the first input sequence.
05373    * @param[in]  pSrcB    points to the second input sequence.
05374    * @param[in]  srcBLen  length of the second input sequence.
05375    * @param[out] pDst     points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
05376    */
05377   void arm_correlate_f32(
05378   const float32_t * pSrcA,
05379         uint32_t srcALen,
05380   const float32_t * pSrcB,
05381         uint32_t srcBLen,
05382         float32_t * pDst);
05383 
05384 
05385 /**
05386  @brief Correlation of Q15 sequences
05387  @param[in]  pSrcA     points to the first input sequence
05388  @param[in]  srcALen   length of the first input sequence
05389  @param[in]  pSrcB     points to the second input sequence
05390  @param[in]  srcBLen   length of the second input sequence
05391  @param[out] pDst      points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
05392  @param[in]  pScratch  points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
05393 */
05394 void arm_correlate_opt_q15(
05395   const q15_t * pSrcA,
05396         uint32_t srcALen,
05397   const q15_t * pSrcB,
05398         uint32_t srcBLen,
05399         q15_t * pDst,
05400         q15_t * pScratch);
05401 
05402 
05403 /**
05404   @brief Correlation of Q15 sequences.
05405   @param[in]  pSrcA    points to the first input sequence
05406   @param[in]  srcALen  length of the first input sequence
05407   @param[in]  pSrcB    points to the second input sequence
05408   @param[in]  srcBLen  length of the second input sequence
05409   @param[out] pDst     points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
05410  */
05411   void arm_correlate_q15(
05412   const q15_t * pSrcA,
05413         uint32_t srcALen,
05414   const q15_t * pSrcB,
05415         uint32_t srcBLen,
05416         q15_t * pDst);
05417 
05418 
05419 /**
05420   @brief         Correlation of Q15 sequences (fast version).
05421   @param[in]     pSrcA      points to the first input sequence
05422   @param[in]     srcALen    length of the first input sequence
05423   @param[in]     pSrcB      points to the second input sequence
05424   @param[in]     srcBLen    length of the second input sequence
05425   @param[out]    pDst       points to the location where the output result is written.  Length 2 * max(srcALen, srcBLen) - 1.
05426   @return        none
05427  */
05428 void arm_correlate_fast_q15(
05429   const q15_t * pSrcA,
05430         uint32_t srcALen,
05431   const q15_t * pSrcB,
05432         uint32_t srcBLen,
05433         q15_t * pDst);
05434 
05435 
05436 /**
05437   @brief Correlation of Q15 sequences (fast version).
05438   @param[in]  pSrcA     points to the first input sequence.
05439   @param[in]  srcALen   length of the first input sequence.
05440   @param[in]  pSrcB     points to the second input sequence.
05441   @param[in]  srcBLen   length of the second input sequence.
05442   @param[out] pDst      points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
05443   @param[in]  pScratch  points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
05444  */
05445 void arm_correlate_fast_opt_q15(
05446   const q15_t * pSrcA,
05447         uint32_t srcALen,
05448   const q15_t * pSrcB,
05449         uint32_t srcBLen,
05450         q15_t * pDst,
05451         q15_t * pScratch);
05452 
05453 
05454   /**
05455    * @brief Correlation of Q31 sequences.
05456    * @param[in]  pSrcA    points to the first input sequence.
05457    * @param[in]  srcALen  length of the first input sequence.
05458    * @param[in]  pSrcB    points to the second input sequence.
05459    * @param[in]  srcBLen  length of the second input sequence.
05460    * @param[out] pDst     points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
05461    */
05462   void arm_correlate_q31(
05463   const q31_t * pSrcA,
05464         uint32_t srcALen,
05465   const q31_t * pSrcB,
05466         uint32_t srcBLen,
05467         q31_t * pDst);
05468 
05469 
05470 /**
05471   @brief Correlation of Q31 sequences (fast version).
05472   @param[in]  pSrcA    points to the first input sequence
05473   @param[in]  srcALen  length of the first input sequence
05474   @param[in]  pSrcB    points to the second input sequence
05475   @param[in]  srcBLen  length of the second input sequence
05476   @param[out] pDst     points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
05477  */
05478 void arm_correlate_fast_q31(
05479   const q31_t * pSrcA,
05480         uint32_t srcALen,
05481   const q31_t * pSrcB,
05482         uint32_t srcBLen,
05483         q31_t * pDst);
05484 
05485 
05486  /**
05487    * @brief Correlation of Q7 sequences.
05488    * @param[in]  pSrcA      points to the first input sequence.
05489    * @param[in]  srcALen    length of the first input sequence.
05490    * @param[in]  pSrcB      points to the second input sequence.
05491    * @param[in]  srcBLen    length of the second input sequence.
05492    * @param[out] pDst       points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
05493    * @param[in]  pScratch1  points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
05494    * @param[in]  pScratch2  points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
05495    */
05496   void arm_correlate_opt_q7(
05497   const q7_t * pSrcA,
05498         uint32_t srcALen,
05499   const q7_t * pSrcB,
05500         uint32_t srcBLen,
05501         q7_t * pDst,
05502         q15_t * pScratch1,
05503         q15_t * pScratch2);
05504 
05505 
05506   /**
05507    * @brief Correlation of Q7 sequences.
05508    * @param[in]  pSrcA    points to the first input sequence.
05509    * @param[in]  srcALen  length of the first input sequence.
05510    * @param[in]  pSrcB    points to the second input sequence.
05511    * @param[in]  srcBLen  length of the second input sequence.
05512    * @param[out] pDst     points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
05513    */
05514   void arm_correlate_q7(
05515   const q7_t * pSrcA,
05516         uint32_t srcALen,
05517   const q7_t * pSrcB,
05518         uint32_t srcBLen,
05519         q7_t * pDst);
05520 
05521 
05522   /**
05523    * @brief Instance structure for the floating-point sparse FIR filter.
05524    */
05525   typedef struct
05526   {
05527           uint16_t numTaps;             /**< number of coefficients in the filter. */
05528           uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
05529           float32_t *pState;            /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
05530     const float32_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/
05531           uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
05532           int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
05533   } arm_fir_sparse_instance_f32;
05534 
05535   /**
05536    * @brief Instance structure for the Q31 sparse FIR filter.
05537    */
05538   typedef struct
05539   {
05540           uint16_t numTaps;             /**< number of coefficients in the filter. */
05541           uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
05542           q31_t *pState;                /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
05543     const q31_t *pCoeffs;               /**< points to the coefficient array. The array is of length numTaps.*/
05544           uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
05545           int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
05546   } arm_fir_sparse_instance_q31;
05547 
05548   /**
05549    * @brief Instance structure for the Q15 sparse FIR filter.
05550    */
05551   typedef struct
05552   {
05553           uint16_t numTaps;             /**< number of coefficients in the filter. */
05554           uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
05555           q15_t *pState;                /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
05556     const q15_t *pCoeffs;               /**< points to the coefficient array. The array is of length numTaps.*/
05557           uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
05558           int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
05559   } arm_fir_sparse_instance_q15;
05560 
05561   /**
05562    * @brief Instance structure for the Q7 sparse FIR filter.
05563    */
05564   typedef struct
05565   {
05566           uint16_t numTaps;             /**< number of coefficients in the filter. */
05567           uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
05568           q7_t *pState;                 /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
05569     const q7_t *pCoeffs;                /**< points to the coefficient array. The array is of length numTaps.*/
05570           uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
05571           int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
05572   } arm_fir_sparse_instance_q7;
05573 
05574 
05575   /**
05576    * @brief Processing function for the floating-point sparse FIR filter.
05577    * @param[in]  S           points to an instance of the floating-point sparse FIR structure.
05578    * @param[in]  pSrc        points to the block of input data.
05579    * @param[out] pDst        points to the block of output data
05580    * @param[in]  pScratchIn  points to a temporary buffer of size blockSize.
05581    * @param[in]  blockSize   number of input samples to process per call.
05582    */
05583   void arm_fir_sparse_f32(
05584         arm_fir_sparse_instance_f32 * S,
05585   const float32_t * pSrc,
05586         float32_t * pDst,
05587         float32_t * pScratchIn,
05588         uint32_t blockSize);
05589 
05590 
05591   /**
05592    * @brief  Initialization function for the floating-point sparse FIR filter.
05593    * @param[in,out] S          points to an instance of the floating-point sparse FIR structure.
05594    * @param[in]     numTaps    number of nonzero coefficients in the filter.
05595    * @param[in]     pCoeffs    points to the array of filter coefficients.
05596    * @param[in]     pState     points to the state buffer.
05597    * @param[in]     pTapDelay  points to the array of offset times.
05598    * @param[in]     maxDelay   maximum offset time supported.
05599    * @param[in]     blockSize  number of samples that will be processed per block.
05600    */
05601   void arm_fir_sparse_init_f32(
05602         arm_fir_sparse_instance_f32 * S,
05603         uint16_t numTaps,
05604   const float32_t * pCoeffs,
05605         float32_t * pState,
05606         int32_t * pTapDelay,
05607         uint16_t maxDelay,
05608         uint32_t blockSize);
05609 
05610 
05611   /**
05612    * @brief Processing function for the Q31 sparse FIR filter.
05613    * @param[in]  S           points to an instance of the Q31 sparse FIR structure.
05614    * @param[in]  pSrc        points to the block of input data.
05615    * @param[out] pDst        points to the block of output data
05616    * @param[in]  pScratchIn  points to a temporary buffer of size blockSize.
05617    * @param[in]  blockSize   number of input samples to process per call.
05618    */
05619   void arm_fir_sparse_q31(
05620         arm_fir_sparse_instance_q31 * S,
05621   const q31_t * pSrc,
05622         q31_t * pDst,
05623         q31_t * pScratchIn,
05624         uint32_t blockSize);
05625 
05626 
05627   /**
05628    * @brief  Initialization function for the Q31 sparse FIR filter.
05629    * @param[in,out] S          points to an instance of the Q31 sparse FIR structure.
05630    * @param[in]     numTaps    number of nonzero coefficients in the filter.
05631    * @param[in]     pCoeffs    points to the array of filter coefficients.
05632    * @param[in]     pState     points to the state buffer.
05633    * @param[in]     pTapDelay  points to the array of offset times.
05634    * @param[in]     maxDelay   maximum offset time supported.
05635    * @param[in]     blockSize  number of samples that will be processed per block.
05636    */
05637   void arm_fir_sparse_init_q31(
05638         arm_fir_sparse_instance_q31 * S,
05639         uint16_t numTaps,
05640   const q31_t * pCoeffs,
05641         q31_t * pState,
05642         int32_t * pTapDelay,
05643         uint16_t maxDelay,
05644         uint32_t blockSize);
05645 
05646 
05647   /**
05648    * @brief Processing function for the Q15 sparse FIR filter.
05649    * @param[in]  S            points to an instance of the Q15 sparse FIR structure.
05650    * @param[in]  pSrc         points to the block of input data.
05651    * @param[out] pDst         points to the block of output data
05652    * @param[in]  pScratchIn   points to a temporary buffer of size blockSize.
05653    * @param[in]  pScratchOut  points to a temporary buffer of size blockSize.
05654    * @param[in]  blockSize    number of input samples to process per call.
05655    */
05656   void arm_fir_sparse_q15(
05657         arm_fir_sparse_instance_q15 * S,
05658   const q15_t * pSrc,
05659         q15_t * pDst,
05660         q15_t * pScratchIn,
05661         q31_t * pScratchOut,
05662         uint32_t blockSize);
05663 
05664 
05665   /**
05666    * @brief  Initialization function for the Q15 sparse FIR filter.
05667    * @param[in,out] S          points to an instance of the Q15 sparse FIR structure.
05668    * @param[in]     numTaps    number of nonzero coefficients in the filter.
05669    * @param[in]     pCoeffs    points to the array of filter coefficients.
05670    * @param[in]     pState     points to the state buffer.
05671    * @param[in]     pTapDelay  points to the array of offset times.
05672    * @param[in]     maxDelay   maximum offset time supported.
05673    * @param[in]     blockSize  number of samples that will be processed per block.
05674    */
05675   void arm_fir_sparse_init_q15(
05676         arm_fir_sparse_instance_q15 * S,
05677         uint16_t numTaps,
05678   const q15_t * pCoeffs,
05679         q15_t * pState,
05680         int32_t * pTapDelay,
05681         uint16_t maxDelay,
05682         uint32_t blockSize);
05683 
05684 
05685   /**
05686    * @brief Processing function for the Q7 sparse FIR filter.
05687    * @param[in]  S            points to an instance of the Q7 sparse FIR structure.
05688    * @param[in]  pSrc         points to the block of input data.
05689    * @param[out] pDst         points to the block of output data
05690    * @param[in]  pScratchIn   points to a temporary buffer of size blockSize.
05691    * @param[in]  pScratchOut  points to a temporary buffer of size blockSize.
05692    * @param[in]  blockSize    number of input samples to process per call.
05693    */
05694   void arm_fir_sparse_q7(
05695         arm_fir_sparse_instance_q7 * S,
05696   const q7_t * pSrc,
05697         q7_t * pDst,
05698         q7_t * pScratchIn,
05699         q31_t * pScratchOut,
05700         uint32_t blockSize);
05701 
05702 
05703   /**
05704    * @brief  Initialization function for the Q7 sparse FIR filter.
05705    * @param[in,out] S          points to an instance of the Q7 sparse FIR structure.
05706    * @param[in]     numTaps    number of nonzero coefficients in the filter.
05707    * @param[in]     pCoeffs    points to the array of filter coefficients.
05708    * @param[in]     pState     points to the state buffer.
05709    * @param[in]     pTapDelay  points to the array of offset times.
05710    * @param[in]     maxDelay   maximum offset time supported.
05711    * @param[in]     blockSize  number of samples that will be processed per block.
05712    */
05713   void arm_fir_sparse_init_q7(
05714         arm_fir_sparse_instance_q7 * S,
05715         uint16_t numTaps,
05716   const q7_t * pCoeffs,
05717         q7_t * pState,
05718         int32_t * pTapDelay,
05719         uint16_t maxDelay,
05720         uint32_t blockSize);
05721 
05722 
05723   /**
05724    * @brief  Floating-point sin_cos function.
05725    * @param[in]  theta   input value in degrees
05726    * @param[out] pSinVal  points to the processed sine output.
05727    * @param[out] pCosVal  points to the processed cos output.
05728    */
05729   void arm_sin_cos_f32(
05730         float32_t theta,
05731         float32_t * pSinVal,
05732         float32_t * pCosVal);
05733 
05734 
05735   /**
05736    * @brief  Q31 sin_cos function.
05737    * @param[in]  theta    scaled input value in degrees
05738    * @param[out] pSinVal  points to the processed sine output.
05739    * @param[out] pCosVal  points to the processed cosine output.
05740    */
05741   void arm_sin_cos_q31(
05742         q31_t theta,
05743         q31_t * pSinVal,
05744         q31_t * pCosVal);
05745 
05746 
05747   /**
05748    * @brief  Floating-point complex conjugate.
05749    * @param[in]  pSrc        points to the input vector
05750    * @param[out] pDst        points to the output vector
05751    * @param[in]  numSamples  number of complex samples in each vector
05752    */
05753   void arm_cmplx_conj_f32(
05754   const float32_t * pSrc,
05755         float32_t * pDst,
05756         uint32_t numSamples);
05757 
05758   /**
05759    * @brief  Q31 complex conjugate.
05760    * @param[in]  pSrc        points to the input vector
05761    * @param[out] pDst        points to the output vector
05762    * @param[in]  numSamples  number of complex samples in each vector
05763    */
05764   void arm_cmplx_conj_q31(
05765   const q31_t * pSrc,
05766         q31_t * pDst,
05767         uint32_t numSamples);
05768 
05769 
05770   /**
05771    * @brief  Q15 complex conjugate.
05772    * @param[in]  pSrc        points to the input vector
05773    * @param[out] pDst        points to the output vector
05774    * @param[in]  numSamples  number of complex samples in each vector
05775    */
05776   void arm_cmplx_conj_q15(
05777   const q15_t * pSrc,
05778         q15_t * pDst,
05779         uint32_t numSamples);
05780 
05781 
05782   /**
05783    * @brief  Floating-point complex magnitude squared
05784    * @param[in]  pSrc        points to the complex input vector
05785    * @param[out] pDst        points to the real output vector
05786    * @param[in]  numSamples  number of complex samples in the input vector
05787    */
05788   void arm_cmplx_mag_squared_f32(
05789   const float32_t * pSrc,
05790         float32_t * pDst,
05791         uint32_t numSamples);
05792 
05793 
05794   /**
05795    * @brief  Q31 complex magnitude squared
05796    * @param[in]  pSrc        points to the complex input vector
05797    * @param[out] pDst        points to the real output vector
05798    * @param[in]  numSamples  number of complex samples in the input vector
05799    */
05800   void arm_cmplx_mag_squared_q31(
05801   const q31_t * pSrc,
05802         q31_t * pDst,
05803         uint32_t numSamples);
05804 
05805 
05806   /**
05807    * @brief  Q15 complex magnitude squared
05808    * @param[in]  pSrc        points to the complex input vector
05809    * @param[out] pDst        points to the real output vector
05810    * @param[in]  numSamples  number of complex samples in the input vector
05811    */
05812   void arm_cmplx_mag_squared_q15(
05813   const q15_t * pSrc,
05814         q15_t * pDst,
05815         uint32_t numSamples);
05816 
05817 
05818  /**
05819    * @ingroup groupController
05820    */
05821 
05822   /**
05823    * @defgroup PID PID Motor Control
05824    *
05825    * A Proportional Integral Derivative (PID) controller is a generic feedback control
05826    * loop mechanism widely used in industrial control systems.
05827    * A PID controller is the most commonly used type of feedback controller.
05828    *
05829    * This set of functions implements (PID) controllers
05830    * for Q15, Q31, and floating-point data types.  The functions operate on a single sample
05831    * of data and each call to the function returns a single processed value.
05832    * <code>S</code> points to an instance of the PID control data structure.  <code>in</code>
05833    * is the input sample value. The functions return the output value.
05834    *
05835    * \par Algorithm:
05836    * <pre>
05837    *    y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
05838    *    A0 = Kp + Ki + Kd
05839    *    A1 = (-Kp ) - (2 * Kd )
05840    *    A2 = Kd
05841    * </pre>
05842    *
05843    * \par
05844    * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
05845    *
05846    * \par
05847    * \image html PID.gif "Proportional Integral Derivative Controller"
05848    *
05849    * \par
05850    * The PID controller calculates an "error" value as the difference between
05851    * the measured output and the reference input.
05852    * The controller attempts to minimize the error by adjusting the process control inputs.
05853    * The proportional value determines the reaction to the current error,
05854    * the integral value determines the reaction based on the sum of recent errors,
05855    * and the derivative value determines the reaction based on the rate at which the error has been changing.
05856    *
05857    * \par Instance Structure
05858    * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
05859    * A separate instance structure must be defined for each PID Controller.
05860    * There are separate instance structure declarations for each of the 3 supported data types.
05861    *
05862    * \par Reset Functions
05863    * There is also an associated reset function for each data type which clears the state array.
05864    *
05865    * \par Initialization Functions
05866    * There is also an associated initialization function for each data type.
05867    * The initialization function performs the following operations:
05868    * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
05869    * - Zeros out the values in the state buffer.
05870    *
05871    * \par
05872    * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
05873    *
05874    * \par Fixed-Point Behavior
05875    * Care must be taken when using the fixed-point versions of the PID Controller functions.
05876    * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
05877    * Refer to the function specific documentation below for usage guidelines.
05878    */
05879 
05880   /**
05881    * @addtogroup PID
05882    * @{
05883    */
05884 
05885   /**
05886    * @brief         Process function for the floating-point PID Control.
05887    * @param[in,out] S   is an instance of the floating-point PID Control structure
05888    * @param[in]     in  input sample to process
05889    * @return        processed output sample.
05890    */
05891   __STATIC_FORCEINLINE float32_t arm_pid_f32(
05892   arm_pid_instance_f32 * S,
05893   float32_t in)
05894   {
05895     float32_t out;
05896 
05897     /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]  */
05898     out = (S->A0 * in) +
05899       (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
05900 
05901     /* Update state */
05902     S->state[1] = S->state[0];
05903     S->state[0] = in;
05904     S->state[2] = out;
05905 
05906     /* return to application */
05907     return (out);
05908 
05909   }
05910 
05911 /**
05912   @brief         Process function for the Q31 PID Control.
05913   @param[in,out] S  points to an instance of the Q31 PID Control structure
05914   @param[in]     in  input sample to process
05915   @return        processed output sample.
05916 
05917   \par Scaling and Overflow Behavior
05918          The function is implemented using an internal 64-bit accumulator.
05919          The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
05920          Thus, if the accumulator result overflows it wraps around rather than clip.
05921          In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
05922          After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
05923  */
05924 __STATIC_FORCEINLINE q31_t arm_pid_q31(
05925   arm_pid_instance_q31 * S,
05926   q31_t in)
05927   {
05928     q63_t acc;
05929     q31_t out;
05930 
05931     /* acc = A0 * x[n]  */
05932     acc = (q63_t) S->A0 * in;
05933 
05934     /* acc += A1 * x[n-1] */
05935     acc += (q63_t) S->A1 * S->state[0];
05936 
05937     /* acc += A2 * x[n-2]  */
05938     acc += (q63_t) S->A2 * S->state[1];
05939 
05940     /* convert output to 1.31 format to add y[n-1] */
05941     out = (q31_t) (acc >> 31U);
05942 
05943     /* out += y[n-1] */
05944     out += S->state[2];
05945 
05946     /* Update state */
05947     S->state[1] = S->state[0];
05948     S->state[0] = in;
05949     S->state[2] = out;
05950 
05951     /* return to application */
05952     return (out);
05953   }
05954 
05955 
05956 /**
05957   @brief         Process function for the Q15 PID Control.
05958   @param[in,out] S   points to an instance of the Q15 PID Control structure
05959   @param[in]     in  input sample to process
05960   @return        processed output sample.
05961 
05962   \par Scaling and Overflow Behavior
05963          The function is implemented using a 64-bit internal accumulator.
05964          Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
05965          The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
05966          There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
05967          After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
05968          Lastly, the accumulator is saturated to yield a result in 1.15 format.
05969  */
05970 __STATIC_FORCEINLINE q15_t arm_pid_q15(
05971   arm_pid_instance_q15 * S,
05972   q15_t in)
05973   {
05974     q63_t acc;
05975     q15_t out;
05976 
05977 #if defined (ARM_MATH_DSP)
05978     /* Implementation of PID controller */
05979 
05980     /* acc = A0 * x[n]  */
05981     acc = (q31_t) __SMUAD((uint32_t)S->A0, (uint32_t)in);
05982 
05983     /* acc += A1 * x[n-1] + A2 * x[n-2]  */
05984     acc = (q63_t)__SMLALD((uint32_t)S->A1, (uint32_t)read_q15x2 (S->state), (uint64_t)acc);
05985 #else
05986     /* acc = A0 * x[n]  */
05987     acc = ((q31_t) S->A0) * in;
05988 
05989     /* acc += A1 * x[n-1] + A2 * x[n-2]  */
05990     acc += (q31_t) S->A1 * S->state[0];
05991     acc += (q31_t) S->A2 * S->state[1];
05992 #endif
05993 
05994     /* acc += y[n-1] */
05995     acc += (q31_t) S->state[2] << 15;
05996 
05997     /* saturate the output */
05998     out = (q15_t) (__SSAT((q31_t)(acc >> 15), 16));
05999 
06000     /* Update state */
06001     S->state[1] = S->state[0];
06002     S->state[0] = in;
06003     S->state[2] = out;
06004 
06005     /* return to application */
06006     return (out);
06007   }
06008 
06009   /**
06010    * @} end of PID group
06011    */
06012 
06013 
06014   /**
06015    * @brief Floating-point matrix inverse.
06016    * @param[in]  src   points to the instance of the input floating-point matrix structure.
06017    * @param[out] dst   points to the instance of the output floating-point matrix structure.
06018    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
06019    * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
06020    */
06021   arm_status arm_mat_inverse_f32(
06022   const arm_matrix_instance_f32 * src,
06023   arm_matrix_instance_f32 * dst);
06024 
06025 
06026   /**
06027    * @brief Floating-point matrix inverse.
06028    * @param[in]  src   points to the instance of the input floating-point matrix structure.
06029    * @param[out] dst   points to the instance of the output floating-point matrix structure.
06030    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
06031    * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
06032    */
06033   arm_status arm_mat_inverse_f64(
06034   const arm_matrix_instance_f64 * src,
06035   arm_matrix_instance_f64 * dst);
06036 
06037 
06038 
06039   /**
06040    * @ingroup groupController
06041    */
06042 
06043   /**
06044    * @defgroup clarke Vector Clarke Transform
06045    * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
06046    * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
06047    * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
06048    * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
06049    * \image html clarke.gif Stator current space vector and its components in (a,b).
06050    * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
06051    * can be calculated using only <code>Ia</code> and <code>Ib</code>.
06052    *
06053    * The function operates on a single sample of data and each call to the function returns the processed output.
06054    * The library provides separate functions for Q31 and floating-point data types.
06055    * \par Algorithm
06056    * \image html clarkeFormula.gif
06057    * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
06058    * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
06059    * \par Fixed-Point Behavior
06060    * Care must be taken when using the Q31 version of the Clarke transform.
06061    * In particular, the overflow and saturation behavior of the accumulator used must be considered.
06062    * Refer to the function specific documentation below for usage guidelines.
06063    */
06064 
06065   /**
06066    * @addtogroup clarke
06067    * @{
06068    */
06069 
06070   /**
06071    *
06072    * @brief  Floating-point Clarke transform
06073    * @param[in]  Ia       input three-phase coordinate <code>a</code>
06074    * @param[in]  Ib       input three-phase coordinate <code>b</code>
06075    * @param[out] pIalpha  points to output two-phase orthogonal vector axis alpha
06076    * @param[out] pIbeta   points to output two-phase orthogonal vector axis beta
06077    * @return        none
06078    */
06079   __STATIC_FORCEINLINE void arm_clarke_f32(
06080   float32_t Ia,
06081   float32_t Ib,
06082   float32_t * pIalpha,
06083   float32_t * pIbeta)
06084   {
06085     /* Calculate pIalpha using the equation, pIalpha = Ia */
06086     *pIalpha = Ia;
06087 
06088     /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
06089     *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
06090   }
06091 
06092 
06093 /**
06094   @brief  Clarke transform for Q31 version
06095   @param[in]  Ia       input three-phase coordinate <code>a</code>
06096   @param[in]  Ib       input three-phase coordinate <code>b</code>
06097   @param[out] pIalpha  points to output two-phase orthogonal vector axis alpha
06098   @param[out] pIbeta   points to output two-phase orthogonal vector axis beta
06099   @return     none
06100 
06101   \par Scaling and Overflow Behavior
06102          The function is implemented using an internal 32-bit accumulator.
06103          The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
06104          There is saturation on the addition, hence there is no risk of overflow.
06105  */
06106 __STATIC_FORCEINLINE void arm_clarke_q31(
06107   q31_t Ia,
06108   q31_t Ib,
06109   q31_t * pIalpha,
06110   q31_t * pIbeta)
06111   {
06112     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
06113 
06114     /* Calculating pIalpha from Ia by equation pIalpha = Ia */
06115     *pIalpha = Ia;
06116 
06117     /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
06118     product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
06119 
06120     /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
06121     product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
06122 
06123     /* pIbeta is calculated by adding the intermediate products */
06124     *pIbeta = __QADD(product1, product2);
06125   }
06126 
06127   /**
06128    * @} end of clarke group
06129    */
06130 
06131 
06132   /**
06133    * @ingroup groupController
06134    */
06135 
06136   /**
06137    * @defgroup inv_clarke Vector Inverse Clarke Transform
06138    * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
06139    *
06140    * The function operates on a single sample of data and each call to the function returns the processed output.
06141    * The library provides separate functions for Q31 and floating-point data types.
06142    * \par Algorithm
06143    * \image html clarkeInvFormula.gif
06144    * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
06145    * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
06146    * \par Fixed-Point Behavior
06147    * Care must be taken when using the Q31 version of the Clarke transform.
06148    * In particular, the overflow and saturation behavior of the accumulator used must be considered.
06149    * Refer to the function specific documentation below for usage guidelines.
06150    */
06151 
06152   /**
06153    * @addtogroup inv_clarke
06154    * @{
06155    */
06156 
06157    /**
06158    * @brief  Floating-point Inverse Clarke transform
06159    * @param[in]  Ialpha  input two-phase orthogonal vector axis alpha
06160    * @param[in]  Ibeta   input two-phase orthogonal vector axis beta
06161    * @param[out] pIa     points to output three-phase coordinate <code>a</code>
06162    * @param[out] pIb     points to output three-phase coordinate <code>b</code>
06163    * @return     none
06164    */
06165   __STATIC_FORCEINLINE void arm_inv_clarke_f32(
06166   float32_t Ialpha,
06167   float32_t Ibeta,
06168   float32_t * pIa,
06169   float32_t * pIb)
06170   {
06171     /* Calculating pIa from Ialpha by equation pIa = Ialpha */
06172     *pIa = Ialpha;
06173 
06174     /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
06175     *pIb = -0.5f * Ialpha + 0.8660254039f * Ibeta;
06176   }
06177 
06178 
06179 /**
06180   @brief  Inverse Clarke transform for Q31 version
06181   @param[in]  Ialpha  input two-phase orthogonal vector axis alpha
06182   @param[in]  Ibeta   input two-phase orthogonal vector axis beta
06183   @param[out] pIa     points to output three-phase coordinate <code>a</code>
06184   @param[out] pIb     points to output three-phase coordinate <code>b</code>
06185   @return     none
06186 
06187   \par Scaling and Overflow Behavior
06188          The function is implemented using an internal 32-bit accumulator.
06189          The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
06190          There is saturation on the subtraction, hence there is no risk of overflow.
06191  */
06192 __STATIC_FORCEINLINE void arm_inv_clarke_q31(
06193   q31_t Ialpha,
06194   q31_t Ibeta,
06195   q31_t * pIa,
06196   q31_t * pIb)
06197   {
06198     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
06199 
06200     /* Calculating pIa from Ialpha by equation pIa = Ialpha */
06201     *pIa = Ialpha;
06202 
06203     /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
06204     product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
06205 
06206     /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
06207     product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
06208 
06209     /* pIb is calculated by subtracting the products */
06210     *pIb = __QSUB(product2, product1);
06211   }
06212 
06213   /**
06214    * @} end of inv_clarke group
06215    */
06216 
06217 
06218 
06219   /**
06220    * @ingroup groupController
06221    */
06222 
06223   /**
06224    * @defgroup park Vector Park Transform
06225    *
06226    * Forward Park transform converts the input two-coordinate vector to flux and torque components.
06227    * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
06228    * from the stationary to the moving reference frame and control the spatial relationship between
06229    * the stator vector current and rotor flux vector.
06230    * If we consider the d axis aligned with the rotor flux, the diagram below shows the
06231    * current vector and the relationship from the two reference frames:
06232    * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
06233    *
06234    * The function operates on a single sample of data and each call to the function returns the processed output.
06235    * The library provides separate functions for Q31 and floating-point data types.
06236    * \par Algorithm
06237    * \image html parkFormula.gif
06238    * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
06239    * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
06240    * cosine and sine values of theta (rotor flux position).
06241    * \par Fixed-Point Behavior
06242    * Care must be taken when using the Q31 version of the Park transform.
06243    * In particular, the overflow and saturation behavior of the accumulator used must be considered.
06244    * Refer to the function specific documentation below for usage guidelines.
06245    */
06246 
06247   /**
06248    * @addtogroup park
06249    * @{
06250    */
06251 
06252   /**
06253    * @brief Floating-point Park transform
06254    * @param[in]  Ialpha  input two-phase vector coordinate alpha
06255    * @param[in]  Ibeta   input two-phase vector coordinate beta
06256    * @param[out] pId     points to output   rotor reference frame d
06257    * @param[out] pIq     points to output   rotor reference frame q
06258    * @param[in]  sinVal  sine value of rotation angle theta
06259    * @param[in]  cosVal  cosine value of rotation angle theta
06260    * @return     none
06261    *
06262    * The function implements the forward Park transform.
06263    *
06264    */
06265   __STATIC_FORCEINLINE void arm_park_f32(
06266   float32_t Ialpha,
06267   float32_t Ibeta,
06268   float32_t * pId,
06269   float32_t * pIq,
06270   float32_t sinVal,
06271   float32_t cosVal)
06272   {
06273     /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
06274     *pId = Ialpha * cosVal + Ibeta * sinVal;
06275 
06276     /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
06277     *pIq = -Ialpha * sinVal + Ibeta * cosVal;
06278   }
06279 
06280 
06281 /**
06282   @brief  Park transform for Q31 version
06283   @param[in]  Ialpha  input two-phase vector coordinate alpha
06284   @param[in]  Ibeta   input two-phase vector coordinate beta
06285   @param[out] pId     points to output rotor reference frame d
06286   @param[out] pIq     points to output rotor reference frame q
06287   @param[in]  sinVal  sine value of rotation angle theta
06288   @param[in]  cosVal  cosine value of rotation angle theta
06289   @return     none
06290 
06291   \par Scaling and Overflow Behavior
06292          The function is implemented using an internal 32-bit accumulator.
06293          The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
06294          There is saturation on the addition and subtraction, hence there is no risk of overflow.
06295  */
06296 __STATIC_FORCEINLINE void arm_park_q31(
06297   q31_t Ialpha,
06298   q31_t Ibeta,
06299   q31_t * pId,
06300   q31_t * pIq,
06301   q31_t sinVal,
06302   q31_t cosVal)
06303   {
06304     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
06305     q31_t product3, product4;                    /* Temporary variables used to store intermediate results */
06306 
06307     /* Intermediate product is calculated by (Ialpha * cosVal) */
06308     product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
06309 
06310     /* Intermediate product is calculated by (Ibeta * sinVal) */
06311     product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
06312 
06313 
06314     /* Intermediate product is calculated by (Ialpha * sinVal) */
06315     product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
06316 
06317     /* Intermediate product is calculated by (Ibeta * cosVal) */
06318     product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
06319 
06320     /* Calculate pId by adding the two intermediate products 1 and 2 */
06321     *pId = __QADD(product1, product2);
06322 
06323     /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
06324     *pIq = __QSUB(product4, product3);
06325   }
06326 
06327   /**
06328    * @} end of park group
06329    */
06330 
06331 
06332   /**
06333    * @ingroup groupController
06334    */
06335 
06336   /**
06337    * @defgroup inv_park Vector Inverse Park transform
06338    * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
06339    *
06340    * The function operates on a single sample of data and each call to the function returns the processed output.
06341    * The library provides separate functions for Q31 and floating-point data types.
06342    * \par Algorithm
06343    * \image html parkInvFormula.gif
06344    * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
06345    * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
06346    * cosine and sine values of theta (rotor flux position).
06347    * \par Fixed-Point Behavior
06348    * Care must be taken when using the Q31 version of the Park transform.
06349    * In particular, the overflow and saturation behavior of the accumulator used must be considered.
06350    * Refer to the function specific documentation below for usage guidelines.
06351    */
06352 
06353   /**
06354    * @addtogroup inv_park
06355    * @{
06356    */
06357 
06358    /**
06359    * @brief  Floating-point Inverse Park transform
06360    * @param[in]  Id       input coordinate of rotor reference frame d
06361    * @param[in]  Iq       input coordinate of rotor reference frame q
06362    * @param[out] pIalpha  points to output two-phase orthogonal vector axis alpha
06363    * @param[out] pIbeta   points to output two-phase orthogonal vector axis beta
06364    * @param[in]  sinVal   sine value of rotation angle theta
06365    * @param[in]  cosVal   cosine value of rotation angle theta
06366    * @return     none
06367    */
06368   __STATIC_FORCEINLINE void arm_inv_park_f32(
06369   float32_t Id,
06370   float32_t Iq,
06371   float32_t * pIalpha,
06372   float32_t * pIbeta,
06373   float32_t sinVal,
06374   float32_t cosVal)
06375   {
06376     /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
06377     *pIalpha = Id * cosVal - Iq * sinVal;
06378 
06379     /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
06380     *pIbeta = Id * sinVal + Iq * cosVal;
06381   }
06382 
06383 
06384 /**
06385   @brief  Inverse Park transform for   Q31 version
06386   @param[in]  Id       input coordinate of rotor reference frame d
06387   @param[in]  Iq       input coordinate of rotor reference frame q
06388   @param[out] pIalpha  points to output two-phase orthogonal vector axis alpha
06389   @param[out] pIbeta   points to output two-phase orthogonal vector axis beta
06390   @param[in]  sinVal   sine value of rotation angle theta
06391   @param[in]  cosVal   cosine value of rotation angle theta
06392   @return     none
06393 
06394   @par Scaling and Overflow Behavior
06395          The function is implemented using an internal 32-bit accumulator.
06396          The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
06397          There is saturation on the addition, hence there is no risk of overflow.
06398  */
06399 __STATIC_FORCEINLINE void arm_inv_park_q31(
06400   q31_t Id,
06401   q31_t Iq,
06402   q31_t * pIalpha,
06403   q31_t * pIbeta,
06404   q31_t sinVal,
06405   q31_t cosVal)
06406   {
06407     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
06408     q31_t product3, product4;                    /* Temporary variables used to store intermediate results */
06409 
06410     /* Intermediate product is calculated by (Id * cosVal) */
06411     product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
06412 
06413     /* Intermediate product is calculated by (Iq * sinVal) */
06414     product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
06415 
06416 
06417     /* Intermediate product is calculated by (Id * sinVal) */
06418     product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
06419 
06420     /* Intermediate product is calculated by (Iq * cosVal) */
06421     product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
06422 
06423     /* Calculate pIalpha by using the two intermediate products 1 and 2 */
06424     *pIalpha = __QSUB(product1, product2);
06425 
06426     /* Calculate pIbeta by using the two intermediate products 3 and 4 */
06427     *pIbeta = __QADD(product4, product3);
06428   }
06429 
06430   /**
06431    * @} end of Inverse park group
06432    */
06433 
06434 
06435   /**
06436    * @ingroup groupInterpolation
06437    */
06438 
06439   /**
06440    * @defgroup LinearInterpolate Linear Interpolation
06441    *
06442    * Linear interpolation is a method of curve fitting using linear polynomials.
06443    * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
06444    *
06445    * \par
06446    * \image html LinearInterp.gif "Linear interpolation"
06447    *
06448    * \par
06449    * A  Linear Interpolate function calculates an output value(y), for the input(x)
06450    * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
06451    *
06452    * \par Algorithm:
06453    * <pre>
06454    *       y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
06455    *       where x0, x1 are nearest values of input x
06456    *             y0, y1 are nearest values to output y
06457    * </pre>
06458    *
06459    * \par
06460    * This set of functions implements Linear interpolation process
06461    * for Q7, Q15, Q31, and floating-point data types.  The functions operate on a single
06462    * sample of data and each call to the function returns a single processed value.
06463    * <code>S</code> points to an instance of the Linear Interpolate function data structure.
06464    * <code>x</code> is the input sample value. The functions returns the output value.
06465    *
06466    * \par
06467    * if x is outside of the table boundary, Linear interpolation returns first value of the table
06468    * if x is below input range and returns last value of table if x is above range.
06469    */
06470 
06471   /**
06472    * @addtogroup LinearInterpolate
06473    * @{
06474    */
06475 
06476   /**
06477    * @brief  Process function for the floating-point Linear Interpolation Function.
06478    * @param[in,out] S  is an instance of the floating-point Linear Interpolation structure
06479    * @param[in]     x  input sample to process
06480    * @return y processed output sample.
06481    *
06482    */
06483   __STATIC_FORCEINLINE float32_t arm_linear_interp_f32(
06484   arm_linear_interp_instance_f32 * S,
06485   float32_t x)
06486   {
06487     float32_t y;
06488     float32_t x0, x1;                            /* Nearest input values */
06489     float32_t y0, y1;                            /* Nearest output values */
06490     float32_t xSpacing = S->xSpacing;            /* spacing between input values */
06491     int32_t i;                                   /* Index variable */
06492     float32_t *pYData = S->pYData;               /* pointer to output table */
06493 
06494     /* Calculation of index */
06495     i = (int32_t) ((x - S->x1) / xSpacing);
06496 
06497     if (i < 0)
06498     {
06499       /* Iniatilize output for below specified range as least output value of table */
06500       y = pYData[0];
06501     }
06502     else if ((uint32_t)i >= (S->nValues - 1))
06503     {
06504       /* Iniatilize output for above specified range as last output value of table */
06505       y = pYData[S->nValues - 1];
06506     }
06507     else
06508     {
06509       /* Calculation of nearest input values */
06510       x0 = S->x1 +  i      * xSpacing;
06511       x1 = S->x1 + (i + 1) * xSpacing;
06512 
06513       /* Read of nearest output values */
06514       y0 = pYData[i];
06515       y1 = pYData[i + 1];
06516 
06517       /* Calculation of output */
06518       y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
06519 
06520     }
06521 
06522     /* returns output value */
06523     return (y);
06524   }
06525 
06526 
06527    /**
06528    *
06529    * @brief  Process function for the Q31 Linear Interpolation Function.
06530    * @param[in] pYData   pointer to Q31 Linear Interpolation table
06531    * @param[in] x        input sample to process
06532    * @param[in] nValues  number of table values
06533    * @return y processed output sample.
06534    *
06535    * \par
06536    * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
06537    * This function can support maximum of table size 2^12.
06538    *
06539    */
06540   __STATIC_FORCEINLINE q31_t arm_linear_interp_q31(
06541   q31_t * pYData,
06542   q31_t x,
06543   uint32_t nValues)
06544   {
06545     q31_t y;                                     /* output */
06546     q31_t y0, y1;                                /* Nearest output values */
06547     q31_t fract;                                 /* fractional part */
06548     int32_t index;                               /* Index to read nearest output values */
06549 
06550     /* Input is in 12.20 format */
06551     /* 12 bits for the table index */
06552     /* Index value calculation */
06553     index = ((x & (q31_t)0xFFF00000) >> 20);
06554 
06555     if (index >= (int32_t)(nValues - 1))
06556     {
06557       return (pYData[nValues - 1]);
06558     }
06559     else if (index < 0)
06560     {
06561       return (pYData[0]);
06562     }
06563     else
06564     {
06565       /* 20 bits for the fractional part */
06566       /* shift left by 11 to keep fract in 1.31 format */
06567       fract = (x & 0x000FFFFF) << 11;
06568 
06569       /* Read two nearest output values from the index in 1.31(q31) format */
06570       y0 = pYData[index];
06571       y1 = pYData[index + 1];
06572 
06573       /* Calculation of y0 * (1-fract) and y is in 2.30 format */
06574       y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
06575 
06576       /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
06577       y += ((q31_t) (((q63_t) y1 * fract) >> 32));
06578 
06579       /* Convert y to 1.31 format */
06580       return (y << 1U);
06581     }
06582   }
06583 
06584 
06585   /**
06586    *
06587    * @brief  Process function for the Q15 Linear Interpolation Function.
06588    * @param[in] pYData   pointer to Q15 Linear Interpolation table
06589    * @param[in] x        input sample to process
06590    * @param[in] nValues  number of table values
06591    * @return y processed output sample.
06592    *
06593    * \par
06594    * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
06595    * This function can support maximum of table size 2^12.
06596    *
06597    */
06598   __STATIC_FORCEINLINE q15_t arm_linear_interp_q15(
06599   q15_t * pYData,
06600   q31_t x,
06601   uint32_t nValues)
06602   {
06603     q63_t y;                                     /* output */
06604     q15_t y0, y1;                                /* Nearest output values */
06605     q31_t fract;                                 /* fractional part */
06606     int32_t index;                               /* Index to read nearest output values */
06607 
06608     /* Input is in 12.20 format */
06609     /* 12 bits for the table index */
06610     /* Index value calculation */
06611     index = ((x & (int32_t)0xFFF00000) >> 20);
06612 
06613     if (index >= (int32_t)(nValues - 1))
06614     {
06615       return (pYData[nValues - 1]);
06616     }
06617     else if (index < 0)
06618     {
06619       return (pYData[0]);
06620     }
06621     else
06622     {
06623       /* 20 bits for the fractional part */
06624       /* fract is in 12.20 format */
06625       fract = (x & 0x000FFFFF);
06626 
06627       /* Read two nearest output values from the index */
06628       y0 = pYData[index];
06629       y1 = pYData[index + 1];
06630 
06631       /* Calculation of y0 * (1-fract) and y is in 13.35 format */
06632       y = ((q63_t) y0 * (0xFFFFF - fract));
06633 
06634       /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
06635       y += ((q63_t) y1 * (fract));
06636 
06637       /* convert y to 1.15 format */
06638       return (q15_t) (y >> 20);
06639     }
06640   }
06641 
06642 
06643   /**
06644    *
06645    * @brief  Process function for the Q7 Linear Interpolation Function.
06646    * @param[in] pYData   pointer to Q7 Linear Interpolation table
06647    * @param[in] x        input sample to process
06648    * @param[in] nValues  number of table values
06649    * @return y processed output sample.
06650    *
06651    * \par
06652    * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
06653    * This function can support maximum of table size 2^12.
06654    */
06655   __STATIC_FORCEINLINE q7_t arm_linear_interp_q7(
06656   q7_t * pYData,
06657   q31_t x,
06658   uint32_t nValues)
06659   {
06660     q31_t y;                                     /* output */
06661     q7_t y0, y1;                                 /* Nearest output values */
06662     q31_t fract;                                 /* fractional part */
06663     uint32_t index;                              /* Index to read nearest output values */
06664 
06665     /* Input is in 12.20 format */
06666     /* 12 bits for the table index */
06667     /* Index value calculation */
06668     if (x < 0)
06669     {
06670       return (pYData[0]);
06671     }
06672     index = (x >> 20) & 0xfff;
06673 
06674     if (index >= (nValues - 1))
06675     {
06676       return (pYData[nValues - 1]);
06677     }
06678     else
06679     {
06680       /* 20 bits for the fractional part */
06681       /* fract is in 12.20 format */
06682       fract = (x & 0x000FFFFF);
06683 
06684       /* Read two nearest output values from the index and are in 1.7(q7) format */
06685       y0 = pYData[index];
06686       y1 = pYData[index + 1];
06687 
06688       /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
06689       y = ((y0 * (0xFFFFF - fract)));
06690 
06691       /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
06692       y += (y1 * fract);
06693 
06694       /* convert y to 1.7(q7) format */
06695       return (q7_t) (y >> 20);
06696      }
06697   }
06698 
06699   /**
06700    * @} end of LinearInterpolate group
06701    */
06702 
06703   /**
06704    * @brief  Fast approximation to the trigonometric sine function for floating-point data.
06705    * @param[in] x  input value in radians.
06706    * @return  sin(x).
06707    */
06708   float32_t arm_sin_f32(
06709   float32_t x);
06710 
06711 
06712   /**
06713    * @brief  Fast approximation to the trigonometric sine function for Q31 data.
06714    * @param[in] x  Scaled input value in radians.
06715    * @return  sin(x).
06716    */
06717   q31_t arm_sin_q31(
06718   q31_t x);
06719 
06720 
06721   /**
06722    * @brief  Fast approximation to the trigonometric sine function for Q15 data.
06723    * @param[in] x  Scaled input value in radians.
06724    * @return  sin(x).
06725    */
06726   q15_t arm_sin_q15(
06727   q15_t x);
06728 
06729 
06730   /**
06731    * @brief  Fast approximation to the trigonometric cosine function for floating-point data.
06732    * @param[in] x  input value in radians.
06733    * @return  cos(x).
06734    */
06735   float32_t arm_cos_f32(
06736   float32_t x);
06737 
06738 
06739   /**
06740    * @brief Fast approximation to the trigonometric cosine function for Q31 data.
06741    * @param[in] x  Scaled input value in radians.
06742    * @return  cos(x).
06743    */
06744   q31_t arm_cos_q31(
06745   q31_t x);
06746 
06747 
06748   /**
06749    * @brief  Fast approximation to the trigonometric cosine function for Q15 data.
06750    * @param[in] x  Scaled input value in radians.
06751    * @return  cos(x).
06752    */
06753   q15_t arm_cos_q15(
06754   q15_t x);
06755 
06756 
06757 /**
06758   @brief         Floating-point vector of log values.
06759   @param[in]     pSrc       points to the input vector
06760   @param[out]    pDst       points to the output vector
06761   @param[in]     blockSize  number of samples in each vector
06762   @return        none
06763  */
06764   void arm_vlog_f32(
06765   const float32_t * pSrc,
06766         float32_t * pDst,
06767         uint32_t blockSize);
06768 
06769 /**
06770   @brief         Floating-point vector of exp values.
06771   @param[in]     pSrc       points to the input vector
06772   @param[out]    pDst       points to the output vector
06773   @param[in]     blockSize  number of samples in each vector
06774   @return        none
06775  */
06776   void arm_vexp_f32(
06777   const float32_t * pSrc,
06778         float32_t * pDst,
06779         uint32_t blockSize);
06780 
06781   /**
06782    * @ingroup groupFastMath
06783    */
06784 
06785 
06786   /**
06787    * @defgroup SQRT Square Root
06788    *
06789    * Computes the square root of a number.
06790    * There are separate functions for Q15, Q31, and floating-point data types.
06791    * The square root function is computed using the Newton-Raphson algorithm.
06792    * This is an iterative algorithm of the form:
06793    * <pre>
06794    *      x1 = x0 - f(x0)/f'(x0)
06795    * </pre>
06796    * where <code>x1</code> is the current estimate,
06797    * <code>x0</code> is the previous estimate, and
06798    * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
06799    * For the square root function, the algorithm reduces to:
06800    * <pre>
06801    *     x0 = in/2                         [initial guess]
06802    *     x1 = 1/2 * ( x0 + in / x0)        [each iteration]
06803    * </pre>
06804    */
06805 
06806 
06807   /**
06808    * @addtogroup SQRT
06809    * @{
06810    */
06811 
06812 /**
06813   @brief         Floating-point square root function.
06814   @param[in]     in    input value
06815   @param[out]    pOut  square root of input value
06816   @return        execution status
06817                    - \ref ARM_MATH_SUCCESS        : input value is positive
06818                    - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0
06819  */
06820 __STATIC_FORCEINLINE arm_status arm_sqrt_f32(
06821   float32_t in,
06822   float32_t * pOut)
06823   {
06824     if (in >= 0.0f)
06825     {
06826 #if defined ( __CC_ARM )
06827   #if defined __TARGET_FPU_VFP
06828       *pOut = __sqrtf(in);
06829   #else
06830       *pOut = sqrtf(in);
06831   #endif
06832 
06833 #elif defined ( __ICCARM__ )
06834   #if defined __ARMVFP__
06835       __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut) : "t"(in));
06836   #else
06837       *pOut = sqrtf(in);
06838   #endif
06839 
06840 #else
06841       *pOut = sqrtf(in);
06842 #endif
06843 
06844       return (ARM_MATH_SUCCESS);
06845     }
06846     else
06847     {
06848       *pOut = 0.0f;
06849       return (ARM_MATH_ARGUMENT_ERROR);
06850     }
06851   }
06852 
06853 
06854 /**
06855   @brief         Q31 square root function.
06856   @param[in]     in    input value.  The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF
06857   @param[out]    pOut  points to square root of input value
06858   @return        execution status
06859                    - \ref ARM_MATH_SUCCESS        : input value is positive
06860                    - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0
06861  */
06862 arm_status arm_sqrt_q31(
06863   q31_t in,
06864   q31_t * pOut);
06865 
06866 
06867 /**
06868   @brief         Q15 square root function.
06869   @param[in]     in    input value.  The range of the input value is [0 +1) or 0x0000 to 0x7FFF
06870   @param[out]    pOut  points to square root of input value
06871   @return        execution status
06872                    - \ref ARM_MATH_SUCCESS        : input value is positive
06873                    - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0
06874  */
06875 arm_status arm_sqrt_q15(
06876   q15_t in,
06877   q15_t * pOut);
06878 
06879   /**
06880    * @brief  Vector Floating-point square root function.
06881    * @param[in]  pIn   input vector.
06882    * @param[out] pOut  vector of square roots of input elements.
06883    * @param[in]  len   length of input vector.
06884    * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
06885    * <code>in</code> is negative value and returns zero output for negative values.
06886    */
06887   void arm_vsqrt_f32(
06888   float32_t * pIn,
06889   float32_t * pOut,
06890   uint16_t len);
06891 
06892   void arm_vsqrt_q31(
06893   q31_t * pIn,
06894   q31_t * pOut,
06895   uint16_t len);
06896 
06897   void arm_vsqrt_q15(
06898   q15_t * pIn,
06899   q15_t * pOut,
06900   uint16_t len);
06901 
06902   /**
06903    * @} end of SQRT group
06904    */
06905 
06906 
06907   /**
06908    * @brief floating-point Circular write function.
06909    */
06910   __STATIC_FORCEINLINE void arm_circularWrite_f32(
06911   int32_t * circBuffer,
06912   int32_t L,
06913   uint16_t * writeOffset,
06914   int32_t bufferInc,
06915   const int32_t * src,
06916   int32_t srcInc,
06917   uint32_t blockSize)
06918   {
06919     uint32_t i = 0U;
06920     int32_t wOffset;
06921 
06922     /* Copy the value of Index pointer that points
06923      * to the current location where the input samples to be copied */
06924     wOffset = *writeOffset;
06925 
06926     /* Loop over the blockSize */
06927     i = blockSize;
06928 
06929     while (i > 0U)
06930     {
06931       /* copy the input sample to the circular buffer */
06932       circBuffer[wOffset] = *src;
06933 
06934       /* Update the input pointer */
06935       src += srcInc;
06936 
06937       /* Circularly update wOffset.  Watch out for positive and negative value */
06938       wOffset += bufferInc;
06939       if (wOffset >= L)
06940         wOffset -= L;
06941 
06942       /* Decrement the loop counter */
06943       i--;
06944     }
06945 
06946     /* Update the index pointer */
06947     *writeOffset = (uint16_t)wOffset;
06948   }
06949 
06950 
06951 
06952   /**
06953    * @brief floating-point Circular Read function.
06954    */
06955   __STATIC_FORCEINLINE void arm_circularRead_f32(
06956   int32_t * circBuffer,
06957   int32_t L,
06958   int32_t * readOffset,
06959   int32_t bufferInc,
06960   int32_t * dst,
06961   int32_t * dst_base,
06962   int32_t dst_length,
06963   int32_t dstInc,
06964   uint32_t blockSize)
06965   {
06966     uint32_t i = 0U;
06967     int32_t rOffset;
06968     int32_t* dst_end;
06969 
06970     /* Copy the value of Index pointer that points
06971      * to the current location from where the input samples to be read */
06972     rOffset = *readOffset;
06973     dst_end = dst_base + dst_length;
06974 
06975     /* Loop over the blockSize */
06976     i = blockSize;
06977 
06978     while (i > 0U)
06979     {
06980       /* copy the sample from the circular buffer to the destination buffer */
06981       *dst = circBuffer[rOffset];
06982 
06983       /* Update the input pointer */
06984       dst += dstInc;
06985 
06986       if (dst == dst_end)
06987       {
06988         dst = dst_base;
06989       }
06990 
06991       /* Circularly update rOffset.  Watch out for positive and negative value  */
06992       rOffset += bufferInc;
06993 
06994       if (rOffset >= L)
06995       {
06996         rOffset -= L;
06997       }
06998 
06999       /* Decrement the loop counter */
07000       i--;
07001     }
07002 
07003     /* Update the index pointer */
07004     *readOffset = rOffset;
07005   }
07006 
07007 
07008   /**
07009    * @brief Q15 Circular write function.
07010    */
07011   __STATIC_FORCEINLINE void arm_circularWrite_q15(
07012   q15_t * circBuffer,
07013   int32_t L,
07014   uint16_t * writeOffset,
07015   int32_t bufferInc,
07016   const q15_t * src,
07017   int32_t srcInc,
07018   uint32_t blockSize)
07019   {
07020     uint32_t i = 0U;
07021     int32_t wOffset;
07022 
07023     /* Copy the value of Index pointer that points
07024      * to the current location where the input samples to be copied */
07025     wOffset = *writeOffset;
07026 
07027     /* Loop over the blockSize */
07028     i = blockSize;
07029 
07030     while (i > 0U)
07031     {
07032       /* copy the input sample to the circular buffer */
07033       circBuffer[wOffset] = *src;
07034 
07035       /* Update the input pointer */
07036       src += srcInc;
07037 
07038       /* Circularly update wOffset.  Watch out for positive and negative value */
07039       wOffset += bufferInc;
07040       if (wOffset >= L)
07041         wOffset -= L;
07042 
07043       /* Decrement the loop counter */
07044       i--;
07045     }
07046 
07047     /* Update the index pointer */
07048     *writeOffset = (uint16_t)wOffset;
07049   }
07050 
07051 
07052   /**
07053    * @brief Q15 Circular Read function.
07054    */
07055   __STATIC_FORCEINLINE void arm_circularRead_q15(
07056   q15_t * circBuffer,
07057   int32_t L,
07058   int32_t * readOffset,
07059   int32_t bufferInc,
07060   q15_t * dst,
07061   q15_t * dst_base,
07062   int32_t dst_length,
07063   int32_t dstInc,
07064   uint32_t blockSize)
07065   {
07066     uint32_t i = 0;
07067     int32_t rOffset;
07068     q15_t* dst_end;
07069 
07070     /* Copy the value of Index pointer that points
07071      * to the current location from where the input samples to be read */
07072     rOffset = *readOffset;
07073 
07074     dst_end = dst_base + dst_length;
07075 
07076     /* Loop over the blockSize */
07077     i = blockSize;
07078 
07079     while (i > 0U)
07080     {
07081       /* copy the sample from the circular buffer to the destination buffer */
07082       *dst = circBuffer[rOffset];
07083 
07084       /* Update the input pointer */
07085       dst += dstInc;
07086 
07087       if (dst == dst_end)
07088       {
07089         dst = dst_base;
07090       }
07091 
07092       /* Circularly update wOffset.  Watch out for positive and negative value */
07093       rOffset += bufferInc;
07094 
07095       if (rOffset >= L)
07096       {
07097         rOffset -= L;
07098       }
07099 
07100       /* Decrement the loop counter */
07101       i--;
07102     }
07103 
07104     /* Update the index pointer */
07105     *readOffset = rOffset;
07106   }
07107 
07108 
07109   /**
07110    * @brief Q7 Circular write function.
07111    */
07112   __STATIC_FORCEINLINE void arm_circularWrite_q7(
07113   q7_t * circBuffer,
07114   int32_t L,
07115   uint16_t * writeOffset,
07116   int32_t bufferInc,
07117   const q7_t * src,
07118   int32_t srcInc,
07119   uint32_t blockSize)
07120   {
07121     uint32_t i = 0U;
07122     int32_t wOffset;
07123 
07124     /* Copy the value of Index pointer that points
07125      * to the current location where the input samples to be copied */
07126     wOffset = *writeOffset;
07127 
07128     /* Loop over the blockSize */
07129     i = blockSize;
07130 
07131     while (i > 0U)
07132     {
07133       /* copy the input sample to the circular buffer */
07134       circBuffer[wOffset] = *src;
07135 
07136       /* Update the input pointer */
07137       src += srcInc;
07138 
07139       /* Circularly update wOffset.  Watch out for positive and negative value */
07140       wOffset += bufferInc;
07141       if (wOffset >= L)
07142         wOffset -= L;
07143 
07144       /* Decrement the loop counter */
07145       i--;
07146     }
07147 
07148     /* Update the index pointer */
07149     *writeOffset = (uint16_t)wOffset;
07150   }
07151 
07152 
07153   /**
07154    * @brief Q7 Circular Read function.
07155    */
07156   __STATIC_FORCEINLINE void arm_circularRead_q7(
07157   q7_t * circBuffer,
07158   int32_t L,
07159   int32_t * readOffset,
07160   int32_t bufferInc,
07161   q7_t * dst,
07162   q7_t * dst_base,
07163   int32_t dst_length,
07164   int32_t dstInc,
07165   uint32_t blockSize)
07166   {
07167     uint32_t i = 0;
07168     int32_t rOffset;
07169     q7_t* dst_end;
07170 
07171     /* Copy the value of Index pointer that points
07172      * to the current location from where the input samples to be read */
07173     rOffset = *readOffset;
07174 
07175     dst_end = dst_base + dst_length;
07176 
07177     /* Loop over the blockSize */
07178     i = blockSize;
07179 
07180     while (i > 0U)
07181     {
07182       /* copy the sample from the circular buffer to the destination buffer */
07183       *dst = circBuffer[rOffset];
07184 
07185       /* Update the input pointer */
07186       dst += dstInc;
07187 
07188       if (dst == dst_end)
07189       {
07190         dst = dst_base;
07191       }
07192 
07193       /* Circularly update rOffset.  Watch out for positive and negative value */
07194       rOffset += bufferInc;
07195 
07196       if (rOffset >= L)
07197       {
07198         rOffset -= L;
07199       }
07200 
07201       /* Decrement the loop counter */
07202       i--;
07203     }
07204 
07205     /* Update the index pointer */
07206     *readOffset = rOffset;
07207   }
07208 
07209 
07210   /**
07211    * @brief  Sum of the squares of the elements of a Q31 vector.
07212    * @param[in]  pSrc       is input pointer
07213    * @param[in]  blockSize  is the number of samples to process
07214    * @param[out] pResult    is output value.
07215    */
07216   void arm_power_q31(
07217   const q31_t * pSrc,
07218         uint32_t blockSize,
07219         q63_t * pResult);
07220 
07221 
07222   /**
07223    * @brief  Sum of the squares of the elements of a floating-point vector.
07224    * @param[in]  pSrc       is input pointer
07225    * @param[in]  blockSize  is the number of samples to process
07226    * @param[out] pResult    is output value.
07227    */
07228   void arm_power_f32(
07229   const float32_t * pSrc,
07230         uint32_t blockSize,
07231         float32_t * pResult);
07232 
07233 
07234   /**
07235    * @brief  Sum of the squares of the elements of a Q15 vector.
07236    * @param[in]  pSrc       is input pointer
07237    * @param[in]  blockSize  is the number of samples to process
07238    * @param[out] pResult    is output value.
07239    */
07240   void arm_power_q15(
07241   const q15_t * pSrc,
07242         uint32_t blockSize,
07243         q63_t * pResult);
07244 
07245 
07246   /**
07247    * @brief  Sum of the squares of the elements of a Q7 vector.
07248    * @param[in]  pSrc       is input pointer
07249    * @param[in]  blockSize  is the number of samples to process
07250    * @param[out] pResult    is output value.
07251    */
07252   void arm_power_q7(
07253   const q7_t * pSrc,
07254         uint32_t blockSize,
07255         q31_t * pResult);
07256 
07257 
07258   /**
07259    * @brief  Mean value of a Q7 vector.
07260    * @param[in]  pSrc       is input pointer
07261    * @param[in]  blockSize  is the number of samples to process
07262    * @param[out] pResult    is output value.
07263    */
07264   void arm_mean_q7(
07265   const q7_t * pSrc,
07266         uint32_t blockSize,
07267         q7_t * pResult);
07268 
07269 
07270   /**
07271    * @brief  Mean value of a Q15 vector.
07272    * @param[in]  pSrc       is input pointer
07273    * @param[in]  blockSize  is the number of samples to process
07274    * @param[out] pResult    is output value.
07275    */
07276   void arm_mean_q15(
07277   const q15_t * pSrc,
07278         uint32_t blockSize,
07279         q15_t * pResult);
07280 
07281 
07282   /**
07283    * @brief  Mean value of a Q31 vector.
07284    * @param[in]  pSrc       is input pointer
07285    * @param[in]  blockSize  is the number of samples to process
07286    * @param[out] pResult    is output value.
07287    */
07288   void arm_mean_q31(
07289   const q31_t * pSrc,
07290         uint32_t blockSize,
07291         q31_t * pResult);
07292 
07293 
07294   /**
07295    * @brief  Mean value of a floating-point vector.
07296    * @param[in]  pSrc       is input pointer
07297    * @param[in]  blockSize  is the number of samples to process
07298    * @param[out] pResult    is output value.
07299    */
07300   void arm_mean_f32(
07301   const float32_t * pSrc,
07302         uint32_t blockSize,
07303         float32_t * pResult);
07304 
07305 
07306   /**
07307    * @brief  Variance of the elements of a floating-point vector.
07308    * @param[in]  pSrc       is input pointer
07309    * @param[in]  blockSize  is the number of samples to process
07310    * @param[out] pResult    is output value.
07311    */
07312   void arm_var_f32(
07313   const float32_t * pSrc,
07314         uint32_t blockSize,
07315         float32_t * pResult);
07316 
07317 
07318   /**
07319    * @brief  Variance of the elements of a Q31 vector.
07320    * @param[in]  pSrc       is input pointer
07321    * @param[in]  blockSize  is the number of samples to process
07322    * @param[out] pResult    is output value.
07323    */
07324   void arm_var_q31(
07325   const q31_t * pSrc,
07326         uint32_t blockSize,
07327         q31_t * pResult);
07328 
07329 
07330   /**
07331    * @brief  Variance of the elements of a Q15 vector.
07332    * @param[in]  pSrc       is input pointer
07333    * @param[in]  blockSize  is the number of samples to process
07334    * @param[out] pResult    is output value.
07335    */
07336   void arm_var_q15(
07337   const q15_t * pSrc,
07338         uint32_t blockSize,
07339         q15_t * pResult);
07340 
07341 
07342   /**
07343    * @brief  Root Mean Square of the elements of a floating-point vector.
07344    * @param[in]  pSrc       is input pointer
07345    * @param[in]  blockSize  is the number of samples to process
07346    * @param[out] pResult    is output value.
07347    */
07348   void arm_rms_f32(
07349   const float32_t * pSrc,
07350         uint32_t blockSize,
07351         float32_t * pResult);
07352 
07353 
07354   /**
07355    * @brief  Root Mean Square of the elements of a Q31 vector.
07356    * @param[in]  pSrc       is input pointer
07357    * @param[in]  blockSize  is the number of samples to process
07358    * @param[out] pResult    is output value.
07359    */
07360   void arm_rms_q31(
07361   const q31_t * pSrc,
07362         uint32_t blockSize,
07363         q31_t * pResult);
07364 
07365 
07366   /**
07367    * @brief  Root Mean Square of the elements of a Q15 vector.
07368    * @param[in]  pSrc       is input pointer
07369    * @param[in]  blockSize  is the number of samples to process
07370    * @param[out] pResult    is output value.
07371    */
07372   void arm_rms_q15(
07373   const q15_t * pSrc,
07374         uint32_t blockSize,
07375         q15_t * pResult);
07376 
07377 
07378   /**
07379    * @brief  Standard deviation of the elements of a floating-point vector.
07380    * @param[in]  pSrc       is input pointer
07381    * @param[in]  blockSize  is the number of samples to process
07382    * @param[out] pResult    is output value.
07383    */
07384   void arm_std_f32(
07385   const float32_t * pSrc,
07386         uint32_t blockSize,
07387         float32_t * pResult);
07388 
07389 
07390   /**
07391    * @brief  Standard deviation of the elements of a Q31 vector.
07392    * @param[in]  pSrc       is input pointer
07393    * @param[in]  blockSize  is the number of samples to process
07394    * @param[out] pResult    is output value.
07395    */
07396   void arm_std_q31(
07397   const q31_t * pSrc,
07398         uint32_t blockSize,
07399         q31_t * pResult);
07400 
07401 
07402   /**
07403    * @brief  Standard deviation of the elements of a Q15 vector.
07404    * @param[in]  pSrc       is input pointer
07405    * @param[in]  blockSize  is the number of samples to process
07406    * @param[out] pResult    is output value.
07407    */
07408   void arm_std_q15(
07409   const q15_t * pSrc,
07410         uint32_t blockSize,
07411         q15_t * pResult);
07412 
07413 
07414   /**
07415    * @brief  Floating-point complex magnitude
07416    * @param[in]  pSrc        points to the complex input vector
07417    * @param[out] pDst        points to the real output vector
07418    * @param[in]  numSamples  number of complex samples in the input vector
07419    */
07420   void arm_cmplx_mag_f32(
07421   const float32_t * pSrc,
07422         float32_t * pDst,
07423         uint32_t numSamples);
07424 
07425 
07426   /**
07427    * @brief  Q31 complex magnitude
07428    * @param[in]  pSrc        points to the complex input vector
07429    * @param[out] pDst        points to the real output vector
07430    * @param[in]  numSamples  number of complex samples in the input vector
07431    */
07432   void arm_cmplx_mag_q31(
07433   const q31_t * pSrc,
07434         q31_t * pDst,
07435         uint32_t numSamples);
07436 
07437 
07438   /**
07439    * @brief  Q15 complex magnitude
07440    * @param[in]  pSrc        points to the complex input vector
07441    * @param[out] pDst        points to the real output vector
07442    * @param[in]  numSamples  number of complex samples in the input vector
07443    */
07444   void arm_cmplx_mag_q15(
07445   const q15_t * pSrc,
07446         q15_t * pDst,
07447         uint32_t numSamples);
07448 
07449 
07450   /**
07451    * @brief  Q15 complex dot product
07452    * @param[in]  pSrcA       points to the first input vector
07453    * @param[in]  pSrcB       points to the second input vector
07454    * @param[in]  numSamples  number of complex samples in each vector
07455    * @param[out] realResult  real part of the result returned here
07456    * @param[out] imagResult  imaginary part of the result returned here
07457    */
07458   void arm_cmplx_dot_prod_q15(
07459   const q15_t * pSrcA,
07460   const q15_t * pSrcB,
07461         uint32_t numSamples,
07462         q31_t * realResult,
07463         q31_t * imagResult);
07464 
07465 
07466   /**
07467    * @brief  Q31 complex dot product
07468    * @param[in]  pSrcA       points to the first input vector
07469    * @param[in]  pSrcB       points to the second input vector
07470    * @param[in]  numSamples  number of complex samples in each vector
07471    * @param[out] realResult  real part of the result returned here
07472    * @param[out] imagResult  imaginary part of the result returned here
07473    */
07474   void arm_cmplx_dot_prod_q31(
07475   const q31_t * pSrcA,
07476   const q31_t * pSrcB,
07477         uint32_t numSamples,
07478         q63_t * realResult,
07479         q63_t * imagResult);
07480 
07481 
07482   /**
07483    * @brief  Floating-point complex dot product
07484    * @param[in]  pSrcA       points to the first input vector
07485    * @param[in]  pSrcB       points to the second input vector
07486    * @param[in]  numSamples  number of complex samples in each vector
07487    * @param[out] realResult  real part of the result returned here
07488    * @param[out] imagResult  imaginary part of the result returned here
07489    */
07490   void arm_cmplx_dot_prod_f32(
07491   const float32_t * pSrcA,
07492   const float32_t * pSrcB,
07493         uint32_t numSamples,
07494         float32_t * realResult,
07495         float32_t * imagResult);
07496 
07497 
07498   /**
07499    * @brief  Q15 complex-by-real multiplication
07500    * @param[in]  pSrcCmplx   points to the complex input vector
07501    * @param[in]  pSrcReal    points to the real input vector
07502    * @param[out] pCmplxDst   points to the complex output vector
07503    * @param[in]  numSamples  number of samples in each vector
07504    */
07505   void arm_cmplx_mult_real_q15(
07506   const q15_t * pSrcCmplx,
07507   const q15_t * pSrcReal,
07508         q15_t * pCmplxDst,
07509         uint32_t numSamples);
07510 
07511 
07512   /**
07513    * @brief  Q31 complex-by-real multiplication
07514    * @param[in]  pSrcCmplx   points to the complex input vector
07515    * @param[in]  pSrcReal    points to the real input vector
07516    * @param[out] pCmplxDst   points to the complex output vector
07517    * @param[in]  numSamples  number of samples in each vector
07518    */
07519   void arm_cmplx_mult_real_q31(
07520   const q31_t * pSrcCmplx,
07521   const q31_t * pSrcReal,
07522         q31_t * pCmplxDst,
07523         uint32_t numSamples);
07524 
07525 
07526   /**
07527    * @brief  Floating-point complex-by-real multiplication
07528    * @param[in]  pSrcCmplx   points to the complex input vector
07529    * @param[in]  pSrcReal    points to the real input vector
07530    * @param[out] pCmplxDst   points to the complex output vector
07531    * @param[in]  numSamples  number of samples in each vector
07532    */
07533   void arm_cmplx_mult_real_f32(
07534   const float32_t * pSrcCmplx,
07535   const float32_t * pSrcReal,
07536         float32_t * pCmplxDst,
07537         uint32_t numSamples);
07538 
07539 
07540   /**
07541    * @brief  Minimum value of a Q7 vector.
07542    * @param[in]  pSrc       is input pointer
07543    * @param[in]  blockSize  is the number of samples to process
07544    * @param[out] result     is output pointer
07545    * @param[in]  index      is the array index of the minimum value in the input buffer.
07546    */
07547   void arm_min_q7(
07548   const q7_t * pSrc,
07549         uint32_t blockSize,
07550         q7_t * result,
07551         uint32_t * index);
07552 
07553 
07554   /**
07555    * @brief  Minimum value of a Q15 vector.
07556    * @param[in]  pSrc       is input pointer
07557    * @param[in]  blockSize  is the number of samples to process
07558    * @param[out] pResult    is output pointer
07559    * @param[in]  pIndex     is the array index of the minimum value in the input buffer.
07560    */
07561   void arm_min_q15(
07562   const q15_t * pSrc,
07563         uint32_t blockSize,
07564         q15_t * pResult,
07565         uint32_t * pIndex);
07566 
07567 
07568   /**
07569    * @brief  Minimum value of a Q31 vector.
07570    * @param[in]  pSrc       is input pointer
07571    * @param[in]  blockSize  is the number of samples to process
07572    * @param[out] pResult    is output pointer
07573    * @param[out] pIndex     is the array index of the minimum value in the input buffer.
07574    */
07575   void arm_min_q31(
07576   const q31_t * pSrc,
07577         uint32_t blockSize,
07578         q31_t * pResult,
07579         uint32_t * pIndex);
07580 
07581 
07582   /**
07583    * @brief  Minimum value of a floating-point vector.
07584    * @param[in]  pSrc       is input pointer
07585    * @param[in]  blockSize  is the number of samples to process
07586    * @param[out] pResult    is output pointer
07587    * @param[out] pIndex     is the array index of the minimum value in the input buffer.
07588    */
07589   void arm_min_f32(
07590   const float32_t * pSrc,
07591         uint32_t blockSize,
07592         float32_t * pResult,
07593         uint32_t * pIndex);
07594 
07595 
07596 /**
07597  * @brief Maximum value of a Q7 vector.
07598  * @param[in]  pSrc       points to the input buffer
07599  * @param[in]  blockSize  length of the input vector
07600  * @param[out] pResult    maximum value returned here
07601  * @param[out] pIndex     index of maximum value returned here
07602  */
07603   void arm_max_q7(
07604   const q7_t * pSrc,
07605         uint32_t blockSize,
07606         q7_t * pResult,
07607         uint32_t * pIndex);
07608 
07609 
07610 /**
07611  * @brief Maximum value of a Q15 vector.
07612  * @param[in]  pSrc       points to the input buffer
07613  * @param[in]  blockSize  length of the input vector
07614  * @param[out] pResult    maximum value returned here
07615  * @param[out] pIndex     index of maximum value returned here
07616  */
07617   void arm_max_q15(
07618   const q15_t * pSrc,
07619         uint32_t blockSize,
07620         q15_t * pResult,
07621         uint32_t * pIndex);
07622 
07623 
07624 /**
07625  * @brief Maximum value of a Q31 vector.
07626  * @param[in]  pSrc       points to the input buffer
07627  * @param[in]  blockSize  length of the input vector
07628  * @param[out] pResult    maximum value returned here
07629  * @param[out] pIndex     index of maximum value returned here
07630  */
07631   void arm_max_q31(
07632   const q31_t * pSrc,
07633         uint32_t blockSize,
07634         q31_t * pResult,
07635         uint32_t * pIndex);
07636 
07637 
07638 /**
07639  * @brief Maximum value of a floating-point vector.
07640  * @param[in]  pSrc       points to the input buffer
07641  * @param[in]  blockSize  length of the input vector
07642  * @param[out] pResult    maximum value returned here
07643  * @param[out] pIndex     index of maximum value returned here
07644  */
07645   void arm_max_f32(
07646   const float32_t * pSrc,
07647         uint32_t blockSize,
07648         float32_t * pResult,
07649         uint32_t * pIndex);
07650 
07651   /**
07652     @brief         Maximum value of a floating-point vector.
07653     @param[in]     pSrc       points to the input vector
07654     @param[in]     blockSize  number of samples in input vector
07655     @param[out]    pResult    maximum value returned here
07656     @return        none
07657    */
07658   void arm_max_no_idx_f32(
07659       const float32_t *pSrc,
07660       uint32_t   blockSize,
07661       float32_t *pResult);
07662 
07663   /**
07664    * @brief  Q15 complex-by-complex multiplication
07665    * @param[in]  pSrcA       points to the first input vector
07666    * @param[in]  pSrcB       points to the second input vector
07667    * @param[out] pDst        points to the output vector
07668    * @param[in]  numSamples  number of complex samples in each vector
07669    */
07670   void arm_cmplx_mult_cmplx_q15(
07671   const q15_t * pSrcA,
07672   const q15_t * pSrcB,
07673         q15_t * pDst,
07674         uint32_t numSamples);
07675 
07676 
07677   /**
07678    * @brief  Q31 complex-by-complex multiplication
07679    * @param[in]  pSrcA       points to the first input vector
07680    * @param[in]  pSrcB       points to the second input vector
07681    * @param[out] pDst        points to the output vector
07682    * @param[in]  numSamples  number of complex samples in each vector
07683    */
07684   void arm_cmplx_mult_cmplx_q31(
07685   const q31_t * pSrcA,
07686   const q31_t * pSrcB,
07687         q31_t * pDst,
07688         uint32_t numSamples);
07689 
07690 
07691   /**
07692    * @brief  Floating-point complex-by-complex multiplication
07693    * @param[in]  pSrcA       points to the first input vector
07694    * @param[in]  pSrcB       points to the second input vector
07695    * @param[out] pDst        points to the output vector
07696    * @param[in]  numSamples  number of complex samples in each vector
07697    */
07698   void arm_cmplx_mult_cmplx_f32(
07699   const float32_t * pSrcA,
07700   const float32_t * pSrcB,
07701         float32_t * pDst,
07702         uint32_t numSamples);
07703 
07704 
07705   /**
07706    * @brief Converts the elements of the floating-point vector to Q31 vector.
07707    * @param[in]  pSrc       points to the floating-point input vector
07708    * @param[out] pDst       points to the Q31 output vector
07709    * @param[in]  blockSize  length of the input vector
07710    */
07711   void arm_float_to_q31(
07712   const float32_t * pSrc,
07713         q31_t * pDst,
07714         uint32_t blockSize);
07715 
07716 
07717   /**
07718    * @brief Converts the elements of the floating-point vector to Q15 vector.
07719    * @param[in]  pSrc       points to the floating-point input vector
07720    * @param[out] pDst       points to the Q15 output vector
07721    * @param[in]  blockSize  length of the input vector
07722    */
07723   void arm_float_to_q15(
07724   const float32_t * pSrc,
07725         q15_t * pDst,
07726         uint32_t blockSize);
07727 
07728 
07729   /**
07730    * @brief Converts the elements of the floating-point vector to Q7 vector.
07731    * @param[in]  pSrc       points to the floating-point input vector
07732    * @param[out] pDst       points to the Q7 output vector
07733    * @param[in]  blockSize  length of the input vector
07734    */
07735   void arm_float_to_q7(
07736   const float32_t * pSrc,
07737         q7_t * pDst,
07738         uint32_t blockSize);
07739 
07740 
07741   /**
07742    * @brief  Converts the elements of the Q31 vector to floating-point vector.
07743    * @param[in]  pSrc       is input pointer
07744    * @param[out] pDst       is output pointer
07745    * @param[in]  blockSize  is the number of samples to process
07746    */
07747   void arm_q31_to_float(
07748   const q31_t * pSrc,
07749         float32_t * pDst,
07750         uint32_t blockSize);
07751 
07752 
07753   /**
07754    * @brief  Converts the elements of the Q31 vector to Q15 vector.
07755    * @param[in]  pSrc       is input pointer
07756    * @param[out] pDst       is output pointer
07757    * @param[in]  blockSize  is the number of samples to process
07758    */
07759   void arm_q31_to_q15(
07760   const q31_t * pSrc,
07761         q15_t * pDst,
07762         uint32_t blockSize);
07763 
07764 
07765   /**
07766    * @brief  Converts the elements of the Q31 vector to Q7 vector.
07767    * @param[in]  pSrc       is input pointer
07768    * @param[out] pDst       is output pointer
07769    * @param[in]  blockSize  is the number of samples to process
07770    */
07771   void arm_q31_to_q7(
07772   const q31_t * pSrc,
07773         q7_t * pDst,
07774         uint32_t blockSize);
07775 
07776 
07777   /**
07778    * @brief  Converts the elements of the Q15 vector to floating-point vector.
07779    * @param[in]  pSrc       is input pointer
07780    * @param[out] pDst       is output pointer
07781    * @param[in]  blockSize  is the number of samples to process
07782    */
07783   void arm_q15_to_float(
07784   const q15_t * pSrc,
07785         float32_t * pDst,
07786         uint32_t blockSize);
07787 
07788 
07789   /**
07790    * @brief  Converts the elements of the Q15 vector to Q31 vector.
07791    * @param[in]  pSrc       is input pointer
07792    * @param[out] pDst       is output pointer
07793    * @param[in]  blockSize  is the number of samples to process
07794    */
07795   void arm_q15_to_q31(
07796   const q15_t * pSrc,
07797         q31_t * pDst,
07798         uint32_t blockSize);
07799 
07800 
07801   /**
07802    * @brief  Converts the elements of the Q15 vector to Q7 vector.
07803    * @param[in]  pSrc       is input pointer
07804    * @param[out] pDst       is output pointer
07805    * @param[in]  blockSize  is the number of samples to process
07806    */
07807   void arm_q15_to_q7(
07808   const q15_t * pSrc,
07809         q7_t * pDst,
07810         uint32_t blockSize);
07811 
07812 
07813   /**
07814    * @brief  Converts the elements of the Q7 vector to floating-point vector.
07815    * @param[in]  pSrc       is input pointer
07816    * @param[out] pDst       is output pointer
07817    * @param[in]  blockSize  is the number of samples to process
07818    */
07819   void arm_q7_to_float(
07820   const q7_t * pSrc,
07821         float32_t * pDst,
07822         uint32_t blockSize);
07823 
07824 
07825   /**
07826    * @brief  Converts the elements of the Q7 vector to Q31 vector.
07827    * @param[in]  pSrc       input pointer
07828    * @param[out] pDst       output pointer
07829    * @param[in]  blockSize  number of samples to process
07830    */
07831   void arm_q7_to_q31(
07832   const q7_t * pSrc,
07833         q31_t * pDst,
07834         uint32_t blockSize);
07835 
07836 
07837   /**
07838    * @brief  Converts the elements of the Q7 vector to Q15 vector.
07839    * @param[in]  pSrc       input pointer
07840    * @param[out] pDst       output pointer
07841    * @param[in]  blockSize  number of samples to process
07842    */
07843   void arm_q7_to_q15(
07844   const q7_t * pSrc,
07845         q15_t * pDst,
07846         uint32_t blockSize);
07847 
07848 /**
07849  * @brief Struct for specifying SVM Kernel
07850  */
07851 typedef enum
07852 {
07853     ARM_ML_KERNEL_LINEAR = 0,
07854              /**< Linear kernel */
07855     ARM_ML_KERNEL_POLYNOMIAL = 1,
07856              /**< Polynomial kernel */
07857     ARM_ML_KERNEL_RBF = 2,
07858              /**< Radial Basis Function kernel */
07859     ARM_ML_KERNEL_SIGMOID = 3
07860              /**< Sigmoid kernel */
07861 } arm_ml_kernel_type;
07862 
07863 
07864 /**
07865  * @brief Instance structure for linear SVM prediction function.
07866  */
07867 typedef struct
07868 {
07869   uint32_t        nbOfSupportVectors;     /**< Number of support vectors */
07870   uint32_t        vectorDimension;        /**< Dimension of vector space */
07871   float32_t       intercept;              /**< Intercept */
07872   const float32_t *dualCoefficients;      /**< Dual coefficients */
07873   const float32_t *supportVectors;        /**< Support vectors */
07874   const int32_t   *classes;               /**< The two SVM classes */
07875 } arm_svm_linear_instance_f32;
07876 
07877 
07878 /**
07879  * @brief Instance structure for polynomial SVM prediction function.
07880  */
07881 typedef struct
07882 {
07883   uint32_t        nbOfSupportVectors;     /**< Number of support vectors */
07884   uint32_t        vectorDimension;        /**< Dimension of vector space */
07885   float32_t       intercept;              /**< Intercept */
07886   const float32_t *dualCoefficients;      /**< Dual coefficients */
07887   const float32_t *supportVectors;        /**< Support vectors */
07888   const int32_t   *classes;               /**< The two SVM classes */
07889   int32_t         degree;                 /**< Polynomial degree */
07890   float32_t       coef0;                  /**< Polynomial constant */
07891   float32_t       gamma;                  /**< Gamma factor */
07892 } arm_svm_polynomial_instance_f32;
07893 
07894 /**
07895  * @brief Instance structure for rbf SVM prediction function.
07896  */
07897 typedef struct
07898 {
07899   uint32_t        nbOfSupportVectors;     /**< Number of support vectors */
07900   uint32_t        vectorDimension;        /**< Dimension of vector space */
07901   float32_t       intercept;              /**< Intercept */
07902   const float32_t *dualCoefficients;      /**< Dual coefficients */
07903   const float32_t *supportVectors;        /**< Support vectors */
07904   const int32_t   *classes;               /**< The two SVM classes */
07905   float32_t       gamma;                  /**< Gamma factor */
07906 } arm_svm_rbf_instance_f32;
07907 
07908 /**
07909  * @brief Instance structure for sigmoid SVM prediction function.
07910  */
07911 typedef struct
07912 {
07913   uint32_t        nbOfSupportVectors;     /**< Number of support vectors */
07914   uint32_t        vectorDimension;        /**< Dimension of vector space */
07915   float32_t       intercept;              /**< Intercept */
07916   const float32_t *dualCoefficients;      /**< Dual coefficients */
07917   const float32_t *supportVectors;        /**< Support vectors */
07918   const int32_t   *classes;               /**< The two SVM classes */
07919   float32_t       coef0;                  /**< Independant constant */
07920   float32_t       gamma;                  /**< Gamma factor */
07921 } arm_svm_sigmoid_instance_f32;
07922 
07923 /**
07924  * @brief        SVM linear instance init function
07925  * @param[in]    S                      Parameters for SVM functions
07926  * @param[in]    nbOfSupportVectors     Number of support vectors
07927  * @param[in]    vectorDimension        Dimension of vector space
07928  * @param[in]    intercept              Intercept
07929  * @param[in]    dualCoefficients       Array of dual coefficients
07930  * @param[in]    supportVectors         Array of support vectors
07931  * @param[in]    classes                Array of 2 classes ID
07932  * @return none.
07933  *
07934  */
07935 
07936 
07937 void arm_svm_linear_init_f32(arm_svm_linear_instance_f32 *S, 
07938   uint32_t nbOfSupportVectors,
07939   uint32_t vectorDimension,
07940   float32_t intercept,
07941   const float32_t *dualCoefficients,
07942   const float32_t *supportVectors,
07943   const int32_t  *classes);
07944 
07945 /**
07946  * @brief SVM linear prediction
07947  * @param[in]    S          Pointer to an instance of the linear SVM structure.
07948  * @param[in]    in         Pointer to input vector
07949  * @param[out]   pResult    Decision value
07950  * @return none.
07951  *
07952  */
07953   
07954 void arm_svm_linear_predict_f32(const arm_svm_linear_instance_f32 *S, 
07955    const float32_t * in, 
07956    int32_t * pResult);
07957 
07958 
07959 /**
07960  * @brief        SVM polynomial instance init function
07961  * @param[in]    S                      points to an instance of the polynomial SVM structure.
07962  * @param[in]    nbOfSupportVectors     Number of support vectors
07963  * @param[in]    vectorDimension        Dimension of vector space
07964  * @param[in]    intercept              Intercept
07965  * @param[in]    dualCoefficients       Array of dual coefficients
07966  * @param[in]    supportVectors         Array of support vectors
07967  * @param[in]    classes                Array of 2 classes ID
07968  * @param[in]    degree                 Polynomial degree
07969  * @param[in]    coef0                  coeff0 (scikit-learn terminology)
07970  * @param[in]    gamma                  gamma (scikit-learn terminology)
07971  * @return none.
07972  *
07973  */
07974 
07975 
07976 void arm_svm_polynomial_init_f32(arm_svm_polynomial_instance_f32 *S, 
07977   uint32_t nbOfSupportVectors,
07978   uint32_t vectorDimension,
07979   float32_t intercept,
07980   const float32_t *dualCoefficients,
07981   const float32_t *supportVectors,
07982   const int32_t   *classes,
07983   int32_t      degree,
07984   float32_t coef0,
07985   float32_t gamma
07986   );
07987 
07988 /**
07989  * @brief SVM polynomial prediction
07990  * @param[in]    S          Pointer to an instance of the polynomial SVM structure.
07991  * @param[in]    in         Pointer to input vector
07992  * @param[out]   pResult    Decision value
07993  * @return none.
07994  *
07995  */
07996 void arm_svm_polynomial_predict_f32(const arm_svm_polynomial_instance_f32 *S, 
07997    const float32_t * in, 
07998    int32_t * pResult);
07999 
08000 
08001 /**
08002  * @brief        SVM radial basis function instance init function
08003  * @param[in]    S                      points to an instance of the polynomial SVM structure.
08004  * @param[in]    nbOfSupportVectors     Number of support vectors
08005  * @param[in]    vectorDimension        Dimension of vector space
08006  * @param[in]    intercept              Intercept
08007  * @param[in]    dualCoefficients       Array of dual coefficients
08008  * @param[in]    supportVectors         Array of support vectors
08009  * @param[in]    classes                Array of 2 classes ID
08010  * @param[in]    gamma                  gamma (scikit-learn terminology)
08011  * @return none.
08012  *
08013  */
08014 
08015 void arm_svm_rbf_init_f32(arm_svm_rbf_instance_f32 *S, 
08016   uint32_t nbOfSupportVectors,
08017   uint32_t vectorDimension,
08018   float32_t intercept,
08019   const float32_t *dualCoefficients,
08020   const float32_t *supportVectors,
08021   const int32_t   *classes,
08022   float32_t gamma
08023   );
08024 
08025 /**
08026  * @brief SVM rbf prediction
08027  * @param[in]    S         Pointer to an instance of the rbf SVM structure.
08028  * @param[in]    in        Pointer to input vector
08029  * @param[out]   pResult   decision value
08030  * @return none.
08031  *
08032  */
08033 void arm_svm_rbf_predict_f32(const arm_svm_rbf_instance_f32 *S, 
08034    const float32_t * in, 
08035    int32_t * pResult);
08036 
08037 /**
08038  * @brief        SVM sigmoid instance init function
08039  * @param[in]    S                      points to an instance of the rbf SVM structure.
08040  * @param[in]    nbOfSupportVectors     Number of support vectors
08041  * @param[in]    vectorDimension        Dimension of vector space
08042  * @param[in]    intercept              Intercept
08043  * @param[in]    dualCoefficients       Array of dual coefficients
08044  * @param[in]    supportVectors         Array of support vectors
08045  * @param[in]    classes                Array of 2 classes ID
08046  * @param[in]    coef0                  coeff0 (scikit-learn terminology)
08047  * @param[in]    gamma                  gamma (scikit-learn terminology)
08048  * @return none.
08049  *
08050  */
08051 
08052 void arm_svm_sigmoid_init_f32(arm_svm_sigmoid_instance_f32 *S, 
08053   uint32_t nbOfSupportVectors,
08054   uint32_t vectorDimension,
08055   float32_t intercept,
08056   const float32_t *dualCoefficients,
08057   const float32_t *supportVectors,
08058   const int32_t   *classes,
08059   float32_t coef0,
08060   float32_t gamma
08061   );
08062 
08063 /**
08064  * @brief SVM sigmoid prediction
08065  * @param[in]    S        Pointer to an instance of the rbf SVM structure.
08066  * @param[in]    in       Pointer to input vector
08067  * @param[out]   pResult  Decision value
08068  * @return none.
08069  *
08070  */
08071 void arm_svm_sigmoid_predict_f32(const arm_svm_sigmoid_instance_f32 *S, 
08072    const float32_t * in, 
08073    int32_t * pResult);
08074 
08075 
08076 
08077 /**
08078  * @brief Instance structure for Naive Gaussian Bayesian estimator.
08079  */
08080 typedef struct
08081 {
08082   uint32_t vectorDimension;  /**< Dimension of vector space */
08083   uint32_t numberOfClasses;  /**< Number of different classes  */
08084   const float32_t *theta;          /**< Mean values for the Gaussians */
08085   const float32_t *sigma;          /**< Variances for the Gaussians */
08086   const float32_t *classPriors;    /**< Class prior probabilities */
08087   float32_t epsilon;         /**< Additive value to variances */
08088 } arm_gaussian_naive_bayes_instance_f32;
08089 
08090 /**
08091  * @brief Naive Gaussian Bayesian Estimator
08092  *
08093  * @param[in]  S         points to a naive bayes instance structure
08094  * @param[in]  in        points to the elements of the input vector.
08095  * @param[in]  pBuffer   points to a buffer of length numberOfClasses
08096  * @return The predicted class
08097  *
08098  */
08099 
08100 
08101 uint32_t arm_gaussian_naive_bayes_predict_f32(const arm_gaussian_naive_bayes_instance_f32 *S, 
08102    const float32_t * in, 
08103    float32_t *pBuffer);
08104 
08105 /**
08106  * @brief Computation of the LogSumExp
08107  *
08108  * In probabilistic computations, the dynamic of the probability values can be very
08109  * wide because they come from gaussian functions.
08110  * To avoid underflow and overflow issues, the values are represented by their log.
08111  * In this representation, multiplying the original exp values is easy : their logs are added.
08112  * But adding the original exp values is requiring some special handling and it is the
08113  * goal of the LogSumExp function.
08114  *
08115  * If the values are x1...xn, the function is computing:
08116  *
08117  * ln(exp(x1) + ... + exp(xn)) and the computation is done in such a way that
08118  * rounding issues are minimised.
08119  *
08120  * The max xm of the values is extracted and the function is computing:
08121  * xm + ln(exp(x1 - xm) + ... + exp(xn - xm))
08122  *
08123  * @param[in]  *in         Pointer to an array of input values.
08124  * @param[in]  blockSize   Number of samples in the input array.
08125  * @return LogSumExp
08126  *
08127  */
08128 
08129 
08130 float32_t arm_logsumexp_f32(const float32_t *in, uint32_t blockSize);
08131 
08132 /**
08133  * @brief Dot product with log arithmetic
08134  *
08135  * Vectors are containing the log of the samples
08136  *
08137  * @param[in]       pSrcA points to the first input vector
08138  * @param[in]       pSrcB points to the second input vector
08139  * @param[in]       blockSize number of samples in each vector
08140  * @param[in]       pTmpBuffer temporary buffer of length blockSize
08141  * @return The log of the dot product .
08142  *
08143  */
08144 
08145 
08146 float32_t arm_logsumexp_dot_prod_f32(const float32_t * pSrcA,
08147   const float32_t * pSrcB,
08148   uint32_t blockSize,
08149   float32_t *pTmpBuffer);
08150 
08151 /**
08152  * @brief Entropy
08153  *
08154  * @param[in]  pSrcA        Array of input values.
08155  * @param[in]  blockSize    Number of samples in the input array.
08156  * @return     Entropy      -Sum(p ln p)
08157  *
08158  */
08159 
08160 
08161 float32_t arm_entropy_f32(const float32_t * pSrcA,uint32_t blockSize);
08162 
08163 
08164 /**
08165  * @brief Entropy
08166  *
08167  * @param[in]  pSrcA        Array of input values.
08168  * @param[in]  blockSize    Number of samples in the input array.
08169  * @return     Entropy      -Sum(p ln p)
08170  *
08171  */
08172 
08173 
08174 float64_t arm_entropy_f64(const float64_t * pSrcA, uint32_t blockSize);
08175 
08176 
08177 /**
08178  * @brief Kullback-Leibler
08179  *
08180  * @param[in]  pSrcA         Pointer to an array of input values for probability distribution A.
08181  * @param[in]  pSrcB         Pointer to an array of input values for probability distribution B.
08182  * @param[in]  blockSize     Number of samples in the input array.
08183  * @return Kullback-Leibler  Divergence D(A || B)
08184  *
08185  */
08186 float32_t arm_kullback_leibler_f32(const float32_t * pSrcA
08187   ,const float32_t * pSrcB
08188   ,uint32_t blockSize);
08189 
08190 
08191 /**
08192  * @brief Kullback-Leibler
08193  *
08194  * @param[in]  pSrcA         Pointer to an array of input values for probability distribution A.
08195  * @param[in]  pSrcB         Pointer to an array of input values for probability distribution B.
08196  * @param[in]  blockSize     Number of samples in the input array.
08197  * @return Kullback-Leibler  Divergence D(A || B)
08198  *
08199  */
08200 float64_t arm_kullback_leibler_f64(const float64_t * pSrcA, 
08201                 const float64_t * pSrcB, 
08202                 uint32_t blockSize);
08203 
08204 
08205 /**
08206  * @brief Weighted sum
08207  *
08208  *
08209  * @param[in]    *in           Array of input values.
08210  * @param[in]    *weigths      Weights
08211  * @param[in]    blockSize     Number of samples in the input array.
08212  * @return Weighted sum
08213  *
08214  */
08215 float32_t arm_weighted_sum_f32(const float32_t *in
08216   , const float32_t *weigths
08217   , uint32_t blockSize);
08218 
08219 
08220 /**
08221  * @brief Barycenter
08222  *
08223  *
08224  * @param[in]    in         List of vectors
08225  * @param[in]    weights    Weights of the vectors
08226  * @param[out]   out        Barycenter
08227  * @param[in]    nbVectors  Number of vectors
08228  * @param[in]    vecDim     Dimension of space (vector dimension)
08229  * @return       None
08230  *
08231  */
08232 void arm_barycenter_f32(const float32_t *in
08233   , const float32_t *weights
08234   , float32_t *out
08235   , uint32_t nbVectors
08236   , uint32_t vecDim);
08237 
08238 /**
08239  * @brief        Euclidean distance between two vectors
08240  * @param[in]    pA         First vector
08241  * @param[in]    pB         Second vector
08242  * @param[in]    blockSize  vector length
08243  * @return distance
08244  *
08245  */
08246 
08247 float32_t arm_euclidean_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize);
08248 
08249 /**
08250  * @brief        Bray-Curtis distance between two vectors
08251  * @param[in]    pA         First vector
08252  * @param[in]    pB         Second vector
08253  * @param[in]    blockSize  vector length
08254  * @return distance
08255  *
08256  */
08257 float32_t arm_braycurtis_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize);
08258 
08259 /**
08260  * @brief        Canberra distance between two vectors
08261  *
08262  * This function may divide by zero when samples pA[i] and pB[i] are both zero.
08263  * The result of the computation will be correct. So the division per zero may be
08264  * ignored.
08265  *
08266  * @param[in]    pA         First vector
08267  * @param[in]    pB         Second vector
08268  * @param[in]    blockSize  vector length
08269  * @return distance
08270  *
08271  */
08272 float32_t arm_canberra_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize);
08273 
08274 
08275 /**
08276  * @brief        Chebyshev distance between two vectors
08277  * @param[in]    pA         First vector
08278  * @param[in]    pB         Second vector
08279  * @param[in]    blockSize  vector length
08280  * @return distance
08281  *
08282  */
08283 float32_t arm_chebyshev_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize);
08284 
08285 
08286 /**
08287  * @brief        Cityblock (Manhattan) distance between two vectors
08288  * @param[in]    pA         First vector
08289  * @param[in]    pB         Second vector
08290  * @param[in]    blockSize  vector length
08291  * @return distance
08292  *
08293  */
08294 float32_t arm_cityblock_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize);
08295 
08296 /**
08297  * @brief        Correlation distance between two vectors
08298  *
08299  * The input vectors are modified in place !
08300  *
08301  * @param[in]    pA         First vector
08302  * @param[in]    pB         Second vector
08303  * @param[in]    blockSize  vector length
08304  * @return distance
08305  *
08306  */
08307 float32_t arm_correlation_distance_f32(float32_t *pA,float32_t *pB, uint32_t blockSize);
08308 
08309 /**
08310  * @brief        Cosine distance between two vectors
08311  *
08312  * @param[in]    pA         First vector
08313  * @param[in]    pB         Second vector
08314  * @param[in]    blockSize  vector length
08315  * @return distance
08316  *
08317  */
08318 
08319 float32_t arm_cosine_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize);
08320 
08321 /**
08322  * @brief        Jensen-Shannon distance between two vectors
08323  *
08324  * This function is assuming that elements of second vector are > 0
08325  * and 0 only when the corresponding element of first vector is 0.
08326  * Otherwise the result of the computation does not make sense
08327  * and for speed reasons, the cases returning NaN or Infinity are not
08328  * managed.
08329  *
08330  * When the function is computing x log (x / y) with x 0 and y 0,
08331  * it will compute the right value (0) but a division per zero will occur
08332  * and shoudl be ignored in client code.
08333  *
08334  * @param[in]    pA         First vector
08335  * @param[in]    pB         Second vector
08336  * @param[in]    blockSize  vector length
08337  * @return distance
08338  *
08339  */
08340 
08341 float32_t arm_jensenshannon_distance_f32(const float32_t *pA,const float32_t *pB,uint32_t blockSize);
08342 
08343 /**
08344  * @brief        Minkowski distance between two vectors
08345  *
08346  * @param[in]    pA         First vector
08347  * @param[in]    pB         Second vector
08348  * @param[in]    n          Norm order (>= 2)
08349  * @param[in]    blockSize  vector length
08350  * @return distance
08351  *
08352  */
08353 
08354 
08355 
08356 float32_t arm_minkowski_distance_f32(const float32_t *pA,const float32_t *pB, int32_t order, uint32_t blockSize);
08357 
08358 /**
08359  * @brief        Dice distance between two vectors
08360  *
08361  * @param[in]    pA              First vector of packed booleans
08362  * @param[in]    pB              Second vector of packed booleans
08363  * @param[in]    order           Distance order
08364  * @param[in]    blockSize       Number of samples
08365  * @return distance
08366  *
08367  */
08368 
08369 
08370 float32_t arm_dice_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools);
08371 
08372 /**
08373  * @brief        Hamming distance between two vectors
08374  *
08375  * @param[in]    pA              First vector of packed booleans
08376  * @param[in]    pB              Second vector of packed booleans
08377  * @param[in]    numberOfBools   Number of booleans
08378  * @return distance
08379  *
08380  */
08381 
08382 float32_t arm_hamming_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools);
08383 
08384 /**
08385  * @brief        Jaccard distance between two vectors
08386  *
08387  * @param[in]    pA              First vector of packed booleans
08388  * @param[in]    pB              Second vector of packed booleans
08389  * @param[in]    numberOfBools   Number of booleans
08390  * @return distance
08391  *
08392  */
08393 
08394 float32_t arm_jaccard_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools);
08395 
08396 /**
08397  * @brief        Kulsinski distance between two vectors
08398  *
08399  * @param[in]    pA              First vector of packed booleans
08400  * @param[in]    pB              Second vector of packed booleans
08401  * @param[in]    numberOfBools   Number of booleans
08402  * @return distance
08403  *
08404  */
08405 
08406 float32_t arm_kulsinski_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools);
08407 
08408 /**
08409  * @brief        Roger Stanimoto distance between two vectors
08410  *
08411  * @param[in]    pA              First vector of packed booleans
08412  * @param[in]    pB              Second vector of packed booleans
08413  * @param[in]    numberOfBools   Number of booleans
08414  * @return distance
08415  *
08416  */
08417 
08418 float32_t arm_rogerstanimoto_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools);
08419 
08420 /**
08421  * @brief        Russell-Rao distance between two vectors
08422  *
08423  * @param[in]    pA              First vector of packed booleans
08424  * @param[in]    pB              Second vector of packed booleans
08425  * @param[in]    numberOfBools   Number of booleans
08426  * @return distance
08427  *
08428  */
08429 
08430 float32_t arm_russellrao_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools);
08431 
08432 /**
08433  * @brief        Sokal-Michener distance between two vectors
08434  *
08435  * @param[in]    pA              First vector of packed booleans
08436  * @param[in]    pB              Second vector of packed booleans
08437  * @param[in]    numberOfBools   Number of booleans
08438  * @return distance
08439  *
08440  */
08441 
08442 float32_t arm_sokalmichener_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools);
08443 
08444 /**
08445  * @brief        Sokal-Sneath distance between two vectors
08446  *
08447  * @param[in]    pA              First vector of packed booleans
08448  * @param[in]    pB              Second vector of packed booleans
08449  * @param[in]    numberOfBools   Number of booleans
08450  * @return distance
08451  *
08452  */
08453 
08454 float32_t arm_sokalsneath_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools);
08455 
08456 /**
08457  * @brief        Yule distance between two vectors
08458  *
08459  * @param[in]    pA              First vector of packed booleans
08460  * @param[in]    pB              Second vector of packed booleans
08461  * @param[in]    numberOfBools   Number of booleans
08462  * @return distance
08463  *
08464  */
08465 
08466 float32_t arm_yule_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools);
08467 
08468 
08469   /**
08470    * @ingroup groupInterpolation
08471    */
08472 
08473   /**
08474    * @defgroup BilinearInterpolate Bilinear Interpolation
08475    *
08476    * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
08477    * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
08478    * determines values between the grid points.
08479    * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
08480    * Bilinear interpolation is often used in image processing to rescale images.
08481    * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
08482    *
08483    * <b>Algorithm</b>
08484    * \par
08485    * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
08486    * For floating-point, the instance structure is defined as:
08487    * <pre>
08488    *   typedef struct
08489    *   {
08490    *     uint16_t numRows;
08491    *     uint16_t numCols;
08492    *     float32_t *pData;
08493    * } arm_bilinear_interp_instance_f32;
08494    * </pre>
08495    *
08496    * \par
08497    * where <code>numRows</code> specifies the number of rows in the table;
08498    * <code>numCols</code> specifies the number of columns in the table;
08499    * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
08500    * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
08501    * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
08502    *
08503    * \par
08504    * Let <code>(x, y)</code> specify the desired interpolation point.  Then define:
08505    * <pre>
08506    *     XF = floor(x)
08507    *     YF = floor(y)
08508    * </pre>
08509    * \par
08510    * The interpolated output point is computed as:
08511    * <pre>
08512    *  f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
08513    *           + f(XF+1, YF) * (x-XF)*(1-(y-YF))
08514    *           + f(XF, YF+1) * (1-(x-XF))*(y-YF)
08515    *           + f(XF+1, YF+1) * (x-XF)*(y-YF)
08516    * </pre>
08517    * Note that the coordinates (x, y) contain integer and fractional components.
08518    * The integer components specify which portion of the table to use while the
08519    * fractional components control the interpolation processor.
08520    *
08521    * \par
08522    * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
08523    */
08524 
08525 
08526   /**
08527    * @addtogroup BilinearInterpolate
08528    * @{
08529    */
08530 
08531   /**
08532   * @brief  Floating-point bilinear interpolation.
08533   * @param[in,out] S  points to an instance of the interpolation structure.
08534   * @param[in]     X  interpolation coordinate.
08535   * @param[in]     Y  interpolation coordinate.
08536   * @return out interpolated value.
08537   */
08538   __STATIC_FORCEINLINE float32_t arm_bilinear_interp_f32(
08539   const arm_bilinear_interp_instance_f32 * S,
08540   float32_t X,
08541   float32_t Y)
08542   {
08543     float32_t out;
08544     float32_t f00, f01, f10, f11;
08545     float32_t *pData = S->pData;
08546     int32_t xIndex, yIndex, index;
08547     float32_t xdiff, ydiff;
08548     float32_t b1, b2, b3, b4;
08549 
08550     xIndex = (int32_t) X;
08551     yIndex = (int32_t) Y;
08552 
08553     /* Care taken for table outside boundary */
08554     /* Returns zero output when values are outside table boundary */
08555     if (xIndex < 0 || xIndex > (S->numCols - 2) || yIndex < 0 || yIndex > (S->numRows - 2))
08556     {
08557       return (0);
08558     }
08559 
08560     /* Calculation of index for two nearest points in X-direction */
08561     index = (xIndex ) + (yIndex ) * S->numCols;
08562 
08563 
08564     /* Read two nearest points in X-direction */
08565     f00 = pData[index];
08566     f01 = pData[index + 1];
08567 
08568     /* Calculation of index for two nearest points in Y-direction */
08569     index = (xIndex ) + (yIndex+1) * S->numCols;
08570 
08571 
08572     /* Read two nearest points in Y-direction */
08573     f10 = pData[index];
08574     f11 = pData[index + 1];
08575 
08576     /* Calculation of intermediate values */
08577     b1 = f00;
08578     b2 = f01 - f00;
08579     b3 = f10 - f00;
08580     b4 = f00 - f01 - f10 + f11;
08581 
08582     /* Calculation of fractional part in X */
08583     xdiff = X - xIndex;
08584 
08585     /* Calculation of fractional part in Y */
08586     ydiff = Y - yIndex;
08587 
08588     /* Calculation of bi-linear interpolated output */
08589     out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
08590 
08591     /* return to application */
08592     return (out);
08593   }
08594 
08595 
08596   /**
08597   * @brief  Q31 bilinear interpolation.
08598   * @param[in,out] S  points to an instance of the interpolation structure.
08599   * @param[in]     X  interpolation coordinate in 12.20 format.
08600   * @param[in]     Y  interpolation coordinate in 12.20 format.
08601   * @return out interpolated value.
08602   */
08603   __STATIC_FORCEINLINE q31_t arm_bilinear_interp_q31(
08604   arm_bilinear_interp_instance_q31 * S,
08605   q31_t X,
08606   q31_t Y)
08607   {
08608     q31_t out;                                   /* Temporary output */
08609     q31_t acc = 0;                               /* output */
08610     q31_t xfract, yfract;                        /* X, Y fractional parts */
08611     q31_t x1, x2, y1, y2;                        /* Nearest output values */
08612     int32_t rI, cI;                              /* Row and column indices */
08613     q31_t *pYData = S->pData;                    /* pointer to output table values */
08614     uint32_t nCols = S->numCols;                 /* num of rows */
08615 
08616     /* Input is in 12.20 format */
08617     /* 12 bits for the table index */
08618     /* Index value calculation */
08619     rI = ((X & (q31_t)0xFFF00000) >> 20);
08620 
08621     /* Input is in 12.20 format */
08622     /* 12 bits for the table index */
08623     /* Index value calculation */
08624     cI = ((Y & (q31_t)0xFFF00000) >> 20);
08625 
08626     /* Care taken for table outside boundary */
08627     /* Returns zero output when values are outside table boundary */
08628     if (rI < 0 || rI > (S->numCols - 2) || cI < 0 || cI > (S->numRows - 2))
08629     {
08630       return (0);
08631     }
08632 
08633     /* 20 bits for the fractional part */
08634     /* shift left xfract by 11 to keep 1.31 format */
08635     xfract = (X & 0x000FFFFF) << 11U;
08636 
08637     /* Read two nearest output values from the index */
08638     x1 = pYData[(rI) + (int32_t)nCols * (cI)    ];
08639     x2 = pYData[(rI) + (int32_t)nCols * (cI) + 1];
08640 
08641     /* 20 bits for the fractional part */
08642     /* shift left yfract by 11 to keep 1.31 format */
08643     yfract = (Y & 0x000FFFFF) << 11U;
08644 
08645     /* Read two nearest output values from the index */
08646     y1 = pYData[(rI) + (int32_t)nCols * (cI + 1)    ];
08647     y2 = pYData[(rI) + (int32_t)nCols * (cI + 1) + 1];
08648 
08649     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
08650     out = ((q31_t) (((q63_t) x1  * (0x7FFFFFFF - xfract)) >> 32));
08651     acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
08652 
08653     /* x2 * (xfract) * (1-yfract)  in 3.29(q29) and adding to acc */
08654     out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
08655     acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
08656 
08657     /* y1 * (1 - xfract) * (yfract)  in 3.29(q29) and adding to acc */
08658     out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
08659     acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
08660 
08661     /* y2 * (xfract) * (yfract)  in 3.29(q29) and adding to acc */
08662     out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
08663     acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
08664 
08665     /* Convert acc to 1.31(q31) format */
08666     return ((q31_t)(acc << 2));
08667   }
08668 
08669 
08670   /**
08671   * @brief  Q15 bilinear interpolation.
08672   * @param[in,out] S  points to an instance of the interpolation structure.
08673   * @param[in]     X  interpolation coordinate in 12.20 format.
08674   * @param[in]     Y  interpolation coordinate in 12.20 format.
08675   * @return out interpolated value.
08676   */
08677   __STATIC_FORCEINLINE q15_t arm_bilinear_interp_q15(
08678   arm_bilinear_interp_instance_q15 * S,
08679   q31_t X,
08680   q31_t Y)
08681   {
08682     q63_t acc = 0;                               /* output */
08683     q31_t out;                                   /* Temporary output */
08684     q15_t x1, x2, y1, y2;                        /* Nearest output values */
08685     q31_t xfract, yfract;                        /* X, Y fractional parts */
08686     int32_t rI, cI;                              /* Row and column indices */
08687     q15_t *pYData = S->pData;                    /* pointer to output table values */
08688     uint32_t nCols = S->numCols;                 /* num of rows */
08689 
08690     /* Input is in 12.20 format */
08691     /* 12 bits for the table index */
08692     /* Index value calculation */
08693     rI = ((X & (q31_t)0xFFF00000) >> 20);
08694 
08695     /* Input is in 12.20 format */
08696     /* 12 bits for the table index */
08697     /* Index value calculation */
08698     cI = ((Y & (q31_t)0xFFF00000) >> 20);
08699 
08700     /* Care taken for table outside boundary */
08701     /* Returns zero output when values are outside table boundary */
08702     if (rI < 0 || rI > (S->numCols - 2) || cI < 0 || cI > (S->numRows - 2))
08703     {
08704       return (0);
08705     }
08706 
08707     /* 20 bits for the fractional part */
08708     /* xfract should be in 12.20 format */
08709     xfract = (X & 0x000FFFFF);
08710 
08711     /* Read two nearest output values from the index */
08712     x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI)    ];
08713     x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
08714 
08715     /* 20 bits for the fractional part */
08716     /* yfract should be in 12.20 format */
08717     yfract = (Y & 0x000FFFFF);
08718 
08719     /* Read two nearest output values from the index */
08720     y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1)    ];
08721     y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
08722 
08723     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
08724 
08725     /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
08726     /* convert 13.35 to 13.31 by right shifting  and out is in 1.31 */
08727     out = (q31_t) (((q63_t) x1 * (0x0FFFFF - xfract)) >> 4U);
08728     acc = ((q63_t) out * (0x0FFFFF - yfract));
08729 
08730     /* x2 * (xfract) * (1-yfract)  in 1.51 and adding to acc */
08731     out = (q31_t) (((q63_t) x2 * (0x0FFFFF - yfract)) >> 4U);
08732     acc += ((q63_t) out * (xfract));
08733 
08734     /* y1 * (1 - xfract) * (yfract)  in 1.51 and adding to acc */
08735     out = (q31_t) (((q63_t) y1 * (0x0FFFFF - xfract)) >> 4U);
08736     acc += ((q63_t) out * (yfract));
08737 
08738     /* y2 * (xfract) * (yfract)  in 1.51 and adding to acc */
08739     out = (q31_t) (((q63_t) y2 * (xfract)) >> 4U);
08740     acc += ((q63_t) out * (yfract));
08741 
08742     /* acc is in 13.51 format and down shift acc by 36 times */
08743     /* Convert out to 1.15 format */
08744     return ((q15_t)(acc >> 36));
08745   }
08746 
08747 
08748   /**
08749   * @brief  Q7 bilinear interpolation.
08750   * @param[in,out] S  points to an instance of the interpolation structure.
08751   * @param[in]     X  interpolation coordinate in 12.20 format.
08752   * @param[in]     Y  interpolation coordinate in 12.20 format.
08753   * @return out interpolated value.
08754   */
08755   __STATIC_FORCEINLINE q7_t arm_bilinear_interp_q7(
08756   arm_bilinear_interp_instance_q7 * S,
08757   q31_t X,
08758   q31_t Y)
08759   {
08760     q63_t acc = 0;                               /* output */
08761     q31_t out;                                   /* Temporary output */
08762     q31_t xfract, yfract;                        /* X, Y fractional parts */
08763     q7_t x1, x2, y1, y2;                         /* Nearest output values */
08764     int32_t rI, cI;                              /* Row and column indices */
08765     q7_t *pYData = S->pData;                     /* pointer to output table values */
08766     uint32_t nCols = S->numCols;                 /* num of rows */
08767 
08768     /* Input is in 12.20 format */
08769     /* 12 bits for the table index */
08770     /* Index value calculation */
08771     rI = ((X & (q31_t)0xFFF00000) >> 20);
08772 
08773     /* Input is in 12.20 format */
08774     /* 12 bits for the table index */
08775     /* Index value calculation */
08776     cI = ((Y & (q31_t)0xFFF00000) >> 20);
08777 
08778     /* Care taken for table outside boundary */
08779     /* Returns zero output when values are outside table boundary */
08780     if (rI < 0 || rI > (S->numCols - 2) || cI < 0 || cI > (S->numRows - 2))
08781     {
08782       return (0);
08783     }
08784 
08785     /* 20 bits for the fractional part */
08786     /* xfract should be in 12.20 format */
08787     xfract = (X & (q31_t)0x000FFFFF);
08788 
08789     /* Read two nearest output values from the index */
08790     x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI)    ];
08791     x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1];
08792 
08793     /* 20 bits for the fractional part */
08794     /* yfract should be in 12.20 format */
08795     yfract = (Y & (q31_t)0x000FFFFF);
08796 
08797     /* Read two nearest output values from the index */
08798     y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1)    ];
08799     y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1];
08800 
08801     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
08802     out = ((x1 * (0xFFFFF - xfract)));
08803     acc = (((q63_t) out * (0xFFFFF - yfract)));
08804 
08805     /* x2 * (xfract) * (1-yfract)  in 2.22 and adding to acc */
08806     out = ((x2 * (0xFFFFF - yfract)));
08807     acc += (((q63_t) out * (xfract)));
08808 
08809     /* y1 * (1 - xfract) * (yfract)  in 2.22 and adding to acc */
08810     out = ((y1 * (0xFFFFF - xfract)));
08811     acc += (((q63_t) out * (yfract)));
08812 
08813     /* y2 * (xfract) * (yfract)  in 2.22 and adding to acc */
08814     out = ((y2 * (yfract)));
08815     acc += (((q63_t) out * (xfract)));
08816 
08817     /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
08818     return ((q7_t)(acc >> 40));
08819   }
08820 
08821   /**
08822    * @} end of BilinearInterpolate group
08823    */
08824 
08825 
08826 /* SMMLAR */
08827 #define multAcc_32x32_keep32_R(a, x, y) \
08828     a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
08829 
08830 /* SMMLSR */
08831 #define multSub_32x32_keep32_R(a, x, y) \
08832     a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
08833 
08834 /* SMMULR */
08835 #define mult_32x32_keep32_R(a, x, y) \
08836     a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
08837 
08838 /* SMMLA */
08839 #define multAcc_32x32_keep32(a, x, y) \
08840     a += (q31_t) (((q63_t) x * y) >> 32)
08841 
08842 /* SMMLS */
08843 #define multSub_32x32_keep32(a, x, y) \
08844     a -= (q31_t) (((q63_t) x * y) >> 32)
08845 
08846 /* SMMUL */
08847 #define mult_32x32_keep32(a, x, y) \
08848     a = (q31_t) (((q63_t) x * y ) >> 32)
08849 
08850 
08851 #if   defined ( __CC_ARM )
08852   /* Enter low optimization region - place directly above function definition */
08853   #if defined( __ARM_ARCH_7EM__ )
08854     #define LOW_OPTIMIZATION_ENTER \
08855        _Pragma ("push")         \
08856        _Pragma ("O1")
08857   #else
08858     #define LOW_OPTIMIZATION_ENTER
08859   #endif
08860 
08861   /* Exit low optimization region - place directly after end of function definition */
08862   #if defined ( __ARM_ARCH_7EM__ )
08863     #define LOW_OPTIMIZATION_EXIT \
08864        _Pragma ("pop")
08865   #else
08866     #define LOW_OPTIMIZATION_EXIT
08867   #endif
08868 
08869   /* Enter low optimization region - place directly above function definition */
08870   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
08871 
08872   /* Exit low optimization region - place directly after end of function definition */
08873   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
08874 
08875 #elif defined (__ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
08876   #define LOW_OPTIMIZATION_ENTER
08877   #define LOW_OPTIMIZATION_EXIT
08878   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
08879   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
08880 
08881 #elif defined ( __GNUC__ )
08882   #define LOW_OPTIMIZATION_ENTER \
08883        __attribute__(( optimize("-O1") ))
08884   #define LOW_OPTIMIZATION_EXIT
08885   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
08886   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
08887 
08888 #elif defined ( __ICCARM__ )
08889   /* Enter low optimization region - place directly above function definition */
08890   #if defined ( __ARM_ARCH_7EM__ )
08891     #define LOW_OPTIMIZATION_ENTER \
08892        _Pragma ("optimize=low")
08893   #else
08894     #define LOW_OPTIMIZATION_ENTER
08895   #endif
08896 
08897   /* Exit low optimization region - place directly after end of function definition */
08898   #define LOW_OPTIMIZATION_EXIT
08899 
08900   /* Enter low optimization region - place directly above function definition */
08901   #if defined ( __ARM_ARCH_7EM__ )
08902     #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
08903        _Pragma ("optimize=low")
08904   #else
08905     #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
08906   #endif
08907 
08908   /* Exit low optimization region - place directly after end of function definition */
08909   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
08910 
08911 #elif defined ( __TI_ARM__ )
08912   #define LOW_OPTIMIZATION_ENTER
08913   #define LOW_OPTIMIZATION_EXIT
08914   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
08915   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
08916 
08917 #elif defined ( __CSMC__ )
08918   #define LOW_OPTIMIZATION_ENTER
08919   #define LOW_OPTIMIZATION_EXIT
08920   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
08921   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
08922 
08923 #elif defined ( __TASKING__ )
08924   #define LOW_OPTIMIZATION_ENTER
08925   #define LOW_OPTIMIZATION_EXIT
08926   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
08927   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
08928        
08929 #elif defined ( _MSC_VER ) || defined(__GNUC_PYTHON__)
08930       #define LOW_OPTIMIZATION_ENTER
08931       #define LOW_OPTIMIZATION_EXIT
08932       #define IAR_ONLY_LOW_OPTIMIZATION_ENTER 
08933       #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
08934 #endif
08935 
08936 
08937 
08938 /* Compiler specific diagnostic adjustment */
08939 #if   defined ( __CC_ARM )
08940 
08941 #elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 )
08942 
08943 #elif defined ( __GNUC__ )
08944 #pragma GCC diagnostic pop
08945 
08946 #elif defined ( __ICCARM__ )
08947 
08948 #elif defined ( __TI_ARM__ )
08949 
08950 #elif defined ( __CSMC__ )
08951 
08952 #elif defined ( __TASKING__ )
08953 
08954 #elif defined ( _MSC_VER )
08955 
08956 #else
08957   #error Unknown compiler
08958 #endif
08959 
08960 #ifdef   __cplusplus
08961 }
08962 #endif
08963 
08964 
08965 #endif /* _ARM_MATH_H */
08966 
08967 /**
08968  *
08969  * End of file.
08970  */