CMSIS DSP Software Library: arm_math.h Source File

- Main Page
- Modules
- Data Structures
- Files
- Examples

- File List
- Globals

# arm_math.h

Go to the documentation of this file.

    00001 /* ----------------------------------------------------------------------
    00002  * Copyright (C) 2010 ARM Limited. All rights reserved.
    00003  *
    00004  * $Date:        15. July 2011
    00005  * $Revision:   V1.0.10
    00006  *
    00007  * Project:         CMSIS DSP Library
    00008  * Title:        arm_math.h
    00009  *
    00010  * Description:  Public header file for CMSIS DSP Library
    00011  *
    00012  * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
    00013  *
    00014  * Version 1.0.10 2011/7/15
    00015  *    Big Endian support added and Merged M0 and M3/M4 Source code.
    00016  *
    00017  * Version 1.0.3 2010/11/29
    00018  *    Re-organized the CMSIS folders and updated documentation.
    00019  *
    00020  * Version 1.0.2 2010/11/11
    00021  *    Documentation updated.
    00022  *
    00023  * Version 1.0.1 2010/10/05
    00024  *    Production release and review comments incorporated.
    00025  *
    00026  * Version 1.0.0 2010/09/20
    00027  *    Production release and review comments incorporated.
    00028  * -------------------------------------------------------------------- */
    00029
    00251 #ifndef _ARM_MATH_H
    00252 #define _ARM_MATH_H
    00253
    00254 #define __CMSIS_GENERIC              /* disable NVIC and Systick functions */
    00255
    00256 #if defined (ARM_MATH_CM4)
    00257   #include "core_cm4.h"
    00258 #elif defined (ARM_MATH_CM3)
    00259   #include "core_cm3.h"
    00260 #elif defined (ARM_MATH_CM0)
    00261   #include "core_cm0.h"
    00262 #else
    00263 #include "ARMCM4.h"
    00264 #warning "Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4....."
    00265 #endif
    00266
    00267 #undef  __CMSIS_GENERIC              /* enable NVIC and Systick functions */
    00268 #include "string.h"
    00269     #include "math.h"
    00270 #ifdef  __cplusplus
    00271 extern "C"
    00272 {
    00273 #endif
    00274
    00275
    00280 #define DELTA_Q31           (0x100)
    00281 #define DELTA_Q15           0x5
    00282 #define INDEX_MASK          0x0000003F
    00283 #define PI                  3.14159265358979f
    00284
    00289 #define TABLE_SIZE          256
    00290 #define TABLE_SPACING_Q31   0x800000
    00291 #define TABLE_SPACING_Q15   0x80
    00292
    00296   /* 1.31(q31) Fixed value of 2/360 */
    00297   /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
    00298 #define INPUT_SPACING           0xB60B61
    00299
    00300
    00305   typedef enum
    00306     {
    00307       ARM_MATH_SUCCESS = 0,
    00308       ARM_MATH_ARGUMENT_ERROR = -1,
    00309       ARM_MATH_LENGTH_ERROR = -2,
    00310       ARM_MATH_SIZE_MISMATCH = -3,
    00311       ARM_MATH_NANINF = -4,
    00312       ARM_MATH_SINGULAR = -5,
    00313       ARM_MATH_TEST_FAILURE = -6
    00314     } arm_status;
    00315
    00319   typedef int8_t q7_t;
    00320
    00324   typedef int16_t q15_t;
    00325
    00329   typedef int32_t q31_t;
    00330
    00334   typedef int64_t q63_t;
    00335
    00339   typedef float float32_t;
    00340
    00344   typedef double float64_t;
    00345
    00349 #define __SIMD32(addr)  (*(int32_t **) & (addr))
    00350
    00351 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0)
    00352
    00355 #define __PKHBT(ARG1, ARG2, ARG3)      ( (((int32_t)(ARG1) <<  0) & (int32_t)0x0000FFFF) | \
    00356                                          (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000)  )
    00357
    00358 #endif
    00359
    00360
    00364 #ifndef ARM_MATH_BIG_ENDIAN
    00365
    00366 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) <<  0) & (int32_t)0x000000FF) | \
    00367                                 (((int32_t)(v1) <<  8) & (int32_t)0x0000FF00) | \
    00368                                 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
    00369                                 (((int32_t)(v3) << 24) & (int32_t)0xFF000000)  )
    00370 #else
    00371
    00372 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) <<  0) & (int32_t)0x000000FF) | \
    00373                                 (((int32_t)(v2) <<  8) & (int32_t)0x0000FF00) | \
    00374                                 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
    00375                                 (((int32_t)(v0) << 24) & (int32_t)0xFF000000)  )
    00376
    00377 #endif
    00378
    00379
    00383   static __INLINE q31_t clip_q63_to_q31(
    00384                     q63_t x)
    00385   {
    00386     return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
    00387       ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
    00388   }
    00389
    00393   static __INLINE q15_t clip_q63_to_q15(
    00394                     q63_t x)
    00395   {
    00396     return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
    00397       ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
    00398   }
    00399
    00403   static __INLINE q7_t clip_q31_to_q7(
    00404                       q31_t x)
    00405   {
    00406     return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
    00407       ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
    00408   }
    00409
    00413   static __INLINE q15_t clip_q31_to_q15(
    00414                     q31_t x)
    00415   {
    00416     return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
    00417       ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
    00418   }
    00419
    00424   static __INLINE q63_t mult32x64(
    00425                   q63_t x,
    00426                   q31_t y)
    00427   {
    00428     return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
    00429             (((q63_t) (x >> 32) * y)));
    00430   }
    00431
    00432
    00433 #if defined (ARM_MATH_CM0) && defined ( __CC_ARM   )
    00434 #define __CLZ __clz
    00435 #endif
    00436
    00437 #if defined (ARM_MATH_CM0) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) || defined (__TASKING__) )
    00438
    00439     uint32_t __CLZ(q31_t data);
    00440
    00441
    00442   static __INLINE uint32_t __CLZ(q31_t data)
    00443   {
    00444       uint32_t count = 0;
    00445       uint32_t mask = 0x80000000;
    00446
    00447       while((data & mask) ==  0)
    00448       {
    00449           count += 1u;
    00450           mask = mask >> 1u;
    00451       }
    00452
    00453       return(count);
    00454
    00455   }
    00456
    00457 #endif
    00458
    00463   static __INLINE uint32_t arm_recip_q31(
    00464                      q31_t in,
    00465                      q31_t * dst,
    00466                      q31_t * pRecipTable)
    00467   {
    00468
    00469     uint32_t out, tempVal;
    00470     uint32_t index, i;
    00471     uint32_t signBits;
    00472
    00473     if(in > 0)
    00474       {
    00475     signBits = __CLZ(in) - 1;
    00476       }
    00477     else
    00478       {
    00479     signBits = __CLZ(-in) - 1;
    00480       }
    00481
    00482     /* Convert input sample to 1.31 format */
    00483     in = in << signBits;
    00484
    00485     /* calculation of index for initial approximated Val */
    00486     index = (uint32_t) (in >> 24u);
    00487     index = (index & INDEX_MASK);
    00488
    00489     /* 1.31 with exp 1 */
    00490     out = pRecipTable[index];
    00491
    00492     /* calculation of reciprocal value */
    00493     /* running approximation for two iterations */
    00494     for (i = 0u; i < 2u; i++)
    00495       {
    00496     tempVal = (q31_t) (((q63_t) in * out) >> 31u);
    00497     tempVal = 0x7FFFFFFF - tempVal;
    00498     /*      1.31 with exp 1 */
    00499     //out = (q31_t) (((q63_t) out * tempVal) >> 30u);
    00500     out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);
    00501       }
    00502
    00503     /* write output */
    00504     *dst = out;
    00505
    00506     /* return num of signbits of out = 1/in value */
    00507     return (signBits + 1u);
    00508
    00509   }
    00510
    00514   static __INLINE uint32_t arm_recip_q15(
    00515                      q15_t in,
    00516                      q15_t * dst,
    00517                      q15_t * pRecipTable)
    00518   {
    00519
    00520     uint32_t out = 0, tempVal = 0;
    00521     uint32_t index = 0, i = 0;
    00522     uint32_t signBits = 0;
    00523
    00524     if(in > 0)
    00525       {
    00526     signBits = __CLZ(in) - 17;
    00527       }
    00528     else
    00529       {
    00530     signBits = __CLZ(-in) - 17;
    00531       }
    00532
    00533     /* Convert input sample to 1.15 format */
    00534     in = in << signBits;
    00535
    00536     /* calculation of index for initial approximated Val */
    00537     index = in >> 8;
    00538     index = (index & INDEX_MASK);
    00539
    00540     /*      1.15 with exp 1  */
    00541     out = pRecipTable[index];
    00542
    00543     /* calculation of reciprocal value */
    00544     /* running approximation for two iterations */
    00545     for (i = 0; i < 2; i++)
    00546       {
    00547     tempVal = (q15_t) (((q31_t) in * out) >> 15);
    00548     tempVal = 0x7FFF - tempVal;
    00549     /*      1.15 with exp 1 */
    00550     out = (q15_t) (((q31_t) out * tempVal) >> 14);
    00551       }
    00552
    00553     /* write output */
    00554     *dst = out;
    00555
    00556     /* return num of signbits of out = 1/in value */
    00557     return (signBits + 1);
    00558
    00559   }
    00560
    00561
    00562   /*
    00563    * @brief C custom defined intrinisic function for only M0 processors
    00564    */
    00565 #if defined(ARM_MATH_CM0)
    00566
    00567   static __INLINE q31_t __SSAT(
    00568                    q31_t x,
    00569                    uint32_t y)
    00570   {
    00571     int32_t posMax, negMin;
    00572     uint32_t i;
    00573
    00574     posMax = 1;
    00575     for (i = 0; i < (y - 1); i++)
    00576       {
    00577     posMax = posMax * 2;
    00578       }
    00579
    00580     if(x > 0)
    00581       {
    00582     posMax = (posMax - 1);
    00583
    00584     if(x > posMax)
    00585       {
    00586         x = posMax;
    00587       }
    00588       }
    00589     else
    00590       {
    00591     negMin = -posMax;
    00592
    00593     if(x < negMin)
    00594       {
    00595         x = negMin;
    00596       }
    00597       }
    00598     return (x);
    00599
    00600
    00601   }
    00602
    00603 #endif /* end of ARM_MATH_CM0 */
    00604
    00605
    00606
    00607   /*
    00608    * @brief C custom defined intrinsic function for M3 and M0 processors
    00609    */
    00610 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0)
    00611
    00612   /*
    00613    * @brief C custom defined QADD8 for M3 and M0 processors
    00614    */
    00615   static __INLINE q31_t __QADD8(
    00616                 q31_t x,
    00617                 q31_t y)
    00618   {
    00619
    00620     q31_t sum;
    00621     q7_t r, s, t, u;
    00622
    00623     r = (char) x;
    00624     s = (char) y;
    00625
    00626     r = __SSAT((q31_t) (r + s), 8);
    00627     s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
    00628     t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
    00629     u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
    00630
    00631     sum = (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
    00632       (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
    00633
    00634     return sum;
    00635
    00636   }
    00637
    00638   /*
    00639    * @brief C custom defined QSUB8 for M3 and M0 processors
    00640    */
    00641   static __INLINE q31_t __QSUB8(
    00642                 q31_t x,
    00643                 q31_t y)
    00644   {
    00645
    00646     q31_t sum;
    00647     q31_t r, s, t, u;
    00648
    00649     r = (char) x;
    00650     s = (char) y;
    00651
    00652     r = __SSAT((r - s), 8);
    00653     s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
    00654     t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
    00655     u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
    00656
    00657     sum =
    00658       (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r & 0x000000FF);
    00659
    00660     return sum;
    00661   }
    00662
    00663   /*
    00664    * @brief C custom defined QADD16 for M3 and M0 processors
    00665    */
    00666
    00667   /*
    00668    * @brief C custom defined QADD16 for M3 and M0 processors
    00669    */
    00670   static __INLINE q31_t __QADD16(
    00671                  q31_t x,
    00672                  q31_t y)
    00673   {
    00674
    00675     q31_t sum;
    00676     q31_t r, s;
    00677
    00678     r = (short) x;
    00679     s = (short) y;
    00680
    00681     r = __SSAT(r + s, 16);
    00682     s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
    00683
    00684     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
    00685
    00686     return sum;
    00687
    00688   }
    00689
    00690   /*
    00691    * @brief C custom defined SHADD16 for M3 and M0 processors
    00692    */
    00693   static __INLINE q31_t __SHADD16(
    00694                   q31_t x,
    00695                   q31_t y)
    00696   {
    00697
    00698     q31_t sum;
    00699     q31_t r, s;
    00700
    00701     r = (short) x;
    00702     s = (short) y;
    00703
    00704     r = ((r >> 1) + (s >> 1));
    00705     s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
    00706
    00707     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
    00708
    00709     return sum;
    00710
    00711   }
    00712
    00713   /*
    00714    * @brief C custom defined QSUB16 for M3 and M0 processors
    00715    */
    00716   static __INLINE q31_t __QSUB16(
    00717                  q31_t x,
    00718                  q31_t y)
    00719   {
    00720
    00721     q31_t sum;
    00722     q31_t r, s;
    00723
    00724     r = (short) x;
    00725     s = (short) y;
    00726
    00727     r = __SSAT(r - s, 16);
    00728     s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
    00729
    00730     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
    00731
    00732     return sum;
    00733   }
    00734
    00735   /*
    00736    * @brief C custom defined SHSUB16 for M3 and M0 processors
    00737    */
    00738   static __INLINE q31_t __SHSUB16(
    00739                   q31_t x,
    00740                   q31_t y)
    00741   {
    00742
    00743     q31_t diff;
    00744     q31_t r, s;
    00745
    00746     r = (short) x;
    00747     s = (short) y;
    00748
    00749     r = ((r >> 1) - (s >> 1));
    00750     s = (((x >> 17) - (y >> 17)) << 16);
    00751
    00752     diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
    00753
    00754     return diff;
    00755   }
    00756
    00757   /*
    00758    * @brief C custom defined QASX for M3 and M0 processors
    00759    */
    00760   static __INLINE q31_t __QASX(
    00761                    q31_t x,
    00762                    q31_t y)
    00763   {
    00764
    00765     q31_t sum = 0;
    00766
    00767     sum = ((sum + clip_q31_to_q15((q31_t) ((short) (x >> 16) + (short) y))) << 16) +
    00768       clip_q31_to_q15((q31_t) ((short) x - (short) (y >> 16)));
    00769
    00770     return sum;
    00771   }
    00772
    00773   /*
    00774    * @brief C custom defined SHASX for M3 and M0 processors
    00775    */
    00776   static __INLINE q31_t __SHASX(
    00777                 q31_t x,
    00778                 q31_t y)
    00779   {
    00780
    00781     q31_t sum;
    00782     q31_t r, s;
    00783
    00784     r = (short) x;
    00785     s = (short) y;
    00786
    00787     r = ((r >> 1) - (y >> 17));
    00788     s = (((x >> 17) + (s >> 1)) << 16);
    00789
    00790     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
    00791
    00792     return sum;
    00793   }
    00794
    00795
    00796   /*
    00797    * @brief C custom defined QSAX for M3 and M0 processors
    00798    */
    00799   static __INLINE q31_t __QSAX(
    00800                    q31_t x,
    00801                    q31_t y)
    00802   {
    00803
    00804     q31_t sum = 0;
    00805
    00806     sum = ((sum + clip_q31_to_q15((q31_t) ((short) (x >> 16) - (short) y))) << 16) +
    00807       clip_q31_to_q15((q31_t) ((short) x + (short) (y >> 16)));
    00808
    00809     return sum;
    00810   }
    00811
    00812   /*
    00813    * @brief C custom defined SHSAX for M3 and M0 processors
    00814    */
    00815   static __INLINE q31_t __SHSAX(
    00816                 q31_t x,
    00817                 q31_t y)
    00818   {
    00819
    00820     q31_t sum;
    00821     q31_t r, s;
    00822
    00823     r = (short) x;
    00824     s = (short) y;
    00825
    00826     r = ((r >> 1) + (y >> 17));
    00827     s = (((x >> 17) - (s >> 1)) << 16);
    00828
    00829     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
    00830
    00831     return sum;
    00832   }
    00833
    00834   /*
    00835    * @brief C custom defined SMUSDX for M3 and M0 processors
    00836    */
    00837   static __INLINE q31_t __SMUSDX(
    00838                  q31_t x,
    00839                  q31_t y)
    00840   {
    00841
    00842     return ((q31_t)(((short) x * (short) (y >> 16)) -
    00843             ((short) (x >> 16) * (short) y)));
    00844   }
    00845
    00846   /*
    00847    * @brief C custom defined SMUADX for M3 and M0 processors
    00848    */
    00849   static __INLINE q31_t __SMUADX(
    00850                  q31_t x,
    00851                  q31_t y)
    00852   {
    00853
    00854     return ((q31_t)(((short) x * (short) (y >> 16)) +
    00855             ((short) (x >> 16) * (short) y)));
    00856   }
    00857
    00858   /*
    00859    * @brief C custom defined QADD for M3 and M0 processors
    00860    */
    00861   static __INLINE q31_t __QADD(
    00862                    q31_t x,
    00863                    q31_t y)
    00864   {
    00865     return clip_q63_to_q31((q63_t) x + y);
    00866   }
    00867
    00868   /*
    00869    * @brief C custom defined QSUB for M3 and M0 processors
    00870    */
    00871   static __INLINE q31_t __QSUB(
    00872                    q31_t x,
    00873                    q31_t y)
    00874   {
    00875     return clip_q63_to_q31((q63_t) x - y);
    00876   }
    00877
    00878   /*
    00879    * @brief C custom defined SMLAD for M3 and M0 processors
    00880    */
    00881   static __INLINE q31_t __SMLAD(
    00882                 q31_t x,
    00883                 q31_t y,
    00884                 q31_t sum)
    00885   {
    00886
    00887     return (sum + ((short) (x >> 16) * (short) (y >> 16)) +
    00888             ((short) x * (short) y));
    00889   }
    00890
    00891   /*
    00892    * @brief C custom defined SMLADX for M3 and M0 processors
    00893    */
    00894   static __INLINE q31_t __SMLADX(
    00895                  q31_t x,
    00896                  q31_t y,
    00897                  q31_t sum)
    00898   {
    00899
    00900     return (sum + ((short) (x >> 16) * (short) (y)) +
    00901             ((short) x * (short) (y >> 16)));
    00902   }
    00903
    00904   /*
    00905    * @brief C custom defined SMLSDX for M3 and M0 processors
    00906    */
    00907   static __INLINE q31_t __SMLSDX(
    00908                  q31_t x,
    00909                  q31_t y,
    00910                  q31_t sum)
    00911   {
    00912
    00913     return (sum - ((short) (x >> 16) * (short) (y)) +
    00914             ((short) x * (short) (y >> 16)));
    00915   }
    00916
    00917   /*
    00918    * @brief C custom defined SMLALD for M3 and M0 processors
    00919    */
    00920   static __INLINE q63_t __SMLALD(
    00921                  q31_t x,
    00922                  q31_t y,
    00923                  q63_t sum)
    00924   {
    00925
    00926     return (sum + ((short) (x >> 16) * (short) (y >> 16)) +
    00927             ((short) x * (short) y));
    00928   }
    00929
    00930   /*
    00931    * @brief C custom defined SMLALDX for M3 and M0 processors
    00932    */
    00933   static __INLINE q63_t __SMLALDX(
    00934                   q31_t x,
    00935                   q31_t y,
    00936                   q63_t sum)
    00937   {
    00938
    00939     return (sum + ((short) (x >> 16) * (short) y)) +
    00940       ((short) x * (short) (y >> 16));
    00941   }
    00942
    00943   /*
    00944    * @brief C custom defined SMUAD for M3 and M0 processors
    00945    */
    00946   static __INLINE q31_t __SMUAD(
    00947                 q31_t x,
    00948                 q31_t y)
    00949   {
    00950
    00951     return (((x >> 16) * (y >> 16)) +
    00952             (((x << 16) >> 16) * ((y << 16) >> 16)));
    00953   }
    00954
    00955   /*
    00956    * @brief C custom defined SMUSD for M3 and M0 processors
    00957    */
    00958   static __INLINE q31_t __SMUSD(
    00959                 q31_t x,
    00960                 q31_t y)
    00961   {
    00962
    00963     return (-((x >> 16) * (y >> 16)) +
    00964             (((x << 16) >> 16) * ((y << 16) >> 16)));
    00965   }
    00966
    00967
    00968
    00969
    00970 #endif /* (ARM_MATH_CM3) || defined (ARM_MATH_CM0) */
    00971
    00972
    00976   typedef struct
    00977   {
    00978     uint16_t numTaps;
    00979     q7_t *pState;
    00980     q7_t *pCoeffs;
    00981   } arm_fir_instance_q7;
    00982
    00986   typedef struct
    00987   {
    00988     uint16_t numTaps;
    00989     q15_t *pState;
    00990     q15_t *pCoeffs;
    00991   } arm_fir_instance_q15;
    00992
    00996   typedef struct
    00997   {
    00998     uint16_t numTaps;
    00999     q31_t *pState;
    01000     q31_t *pCoeffs;
    01001   } arm_fir_instance_q31;
    01002
    01006   typedef struct
    01007   {
    01008     uint16_t numTaps;
    01009     float32_t *pState;
    01010     float32_t *pCoeffs;
    01011   } arm_fir_instance_f32;
    01012
    01013
    01022   void arm_fir_q7(
    01023           const arm_fir_instance_q7 * S,
    01024            q7_t * pSrc,
    01025           q7_t * pDst,
    01026           uint32_t blockSize);
    01027
    01028
    01038   void arm_fir_init_q7(
    01039                arm_fir_instance_q7 * S,
    01040                uint16_t numTaps,
    01041                q7_t * pCoeffs,
    01042                q7_t * pState,
    01043                uint32_t blockSize);
    01044
    01045
    01054   void arm_fir_q15(
    01055            const arm_fir_instance_q15 * S,
    01056             q15_t * pSrc,
    01057            q15_t * pDst,
    01058            uint32_t blockSize);
    01059
    01068   void arm_fir_fast_q15(
    01069             const arm_fir_instance_q15 * S,
    01070              q15_t * pSrc,
    01071             q15_t * pDst,
    01072             uint32_t blockSize);
    01073
    01085        arm_status arm_fir_init_q15(
    01086                   arm_fir_instance_q15 * S,
    01087                   uint16_t numTaps,
    01088                   q15_t * pCoeffs,
    01089                   q15_t * pState,
    01090                   uint32_t blockSize);
    01091
    01100   void arm_fir_q31(
    01101            const arm_fir_instance_q31 * S,
    01102             q31_t * pSrc,
    01103            q31_t * pDst,
    01104            uint32_t blockSize);
    01105
    01114   void arm_fir_fast_q31(
    01115             const arm_fir_instance_q31 * S,
    01116              q31_t * pSrc,
    01117             q31_t * pDst,
    01118             uint32_t blockSize);
    01119
    01129   void arm_fir_init_q31(
    01130             arm_fir_instance_q31 * S,
    01131             uint16_t numTaps,
    01132             q31_t * pCoeffs,
    01133             q31_t * pState,
    01134             uint32_t blockSize);
    01135
    01144   void arm_fir_f32(
    01145            const arm_fir_instance_f32 * S,
    01146             float32_t * pSrc,
    01147            float32_t * pDst,
    01148            uint32_t blockSize);
    01149
    01159   void arm_fir_init_f32(
    01160             arm_fir_instance_f32 * S,
    01161             uint16_t numTaps,
    01162             float32_t * pCoeffs,
    01163             float32_t * pState,
    01164             uint32_t blockSize);
    01165
    01166
    01170   typedef struct
    01171   {
    01172     int8_t numStages;
    01173     q15_t *pState;
    01174     q15_t *pCoeffs;
    01175     int8_t postShift;
    01177   } arm_biquad_casd_df1_inst_q15;
    01178
    01179
    01183   typedef struct
    01184   {
    01185     uint32_t numStages;
    01186     q31_t *pState;
    01187     q31_t *pCoeffs;
    01188     uint8_t postShift;
    01190   } arm_biquad_casd_df1_inst_q31;
    01191
    01195   typedef struct
    01196   {
    01197     uint32_t numStages;
    01198     float32_t *pState;
    01199     float32_t *pCoeffs;
    01202   } arm_biquad_casd_df1_inst_f32;
    01203
    01204
    01205
    01215   void arm_biquad_cascade_df1_q15(
    01216                   const arm_biquad_casd_df1_inst_q15 * S,
    01217                    q15_t * pSrc,
    01218                   q15_t * pDst,
    01219                   uint32_t blockSize);
    01220
    01231   void arm_biquad_cascade_df1_init_q15(
    01232                        arm_biquad_casd_df1_inst_q15 * S,
    01233                        uint8_t numStages,
    01234                        q15_t * pCoeffs,
    01235                        q15_t * pState,
    01236                        int8_t postShift);
    01237
    01238
    01248   void arm_biquad_cascade_df1_fast_q15(
    01249                        const arm_biquad_casd_df1_inst_q15 * S,
    01250                         q15_t * pSrc,
    01251                        q15_t * pDst,
    01252                        uint32_t blockSize);
    01253
    01254
    01264   void arm_biquad_cascade_df1_q31(
    01265                   const arm_biquad_casd_df1_inst_q31 * S,
    01266                    q31_t * pSrc,
    01267                   q31_t * pDst,
    01268                   uint32_t blockSize);
    01269
    01279   void arm_biquad_cascade_df1_fast_q31(
    01280                        const arm_biquad_casd_df1_inst_q31 * S,
    01281                         q31_t * pSrc,
    01282                        q31_t * pDst,
    01283                        uint32_t blockSize);
    01284
    01295   void arm_biquad_cascade_df1_init_q31(
    01296                        arm_biquad_casd_df1_inst_q31 * S,
    01297                        uint8_t numStages,
    01298                        q31_t * pCoeffs,
    01299                        q31_t * pState,
    01300                        int8_t postShift);
    01301
    01311   void arm_biquad_cascade_df1_f32(
    01312                   const arm_biquad_casd_df1_inst_f32 * S,
    01313                    float32_t * pSrc,
    01314                   float32_t * pDst,
    01315                   uint32_t blockSize);
    01316
    01326   void arm_biquad_cascade_df1_init_f32(
    01327                        arm_biquad_casd_df1_inst_f32 * S,
    01328                        uint8_t numStages,
    01329                        float32_t * pCoeffs,
    01330                        float32_t * pState);
    01331
    01332
    01337   typedef struct
    01338   {
    01339     uint16_t numRows;
    01340     uint16_t numCols;
    01341     float32_t *pData;
    01342   } arm_matrix_instance_f32;
    01343
    01348   typedef struct
    01349   {
    01350     uint16_t numRows;
    01351     uint16_t numCols;
    01352     q15_t *pData;
    01354   } arm_matrix_instance_q15;
    01355
    01360   typedef struct
    01361   {
    01362     uint16_t numRows;
    01363     uint16_t numCols;
    01364     q31_t *pData;
    01366   } arm_matrix_instance_q31;
    01367
    01368
    01369
    01379   arm_status arm_mat_add_f32(
    01380                  const arm_matrix_instance_f32 * pSrcA,
    01381                  const arm_matrix_instance_f32 * pSrcB,
    01382                  arm_matrix_instance_f32 * pDst);
    01383
    01393   arm_status arm_mat_add_q15(
    01394                  const arm_matrix_instance_q15 * pSrcA,
    01395                  const arm_matrix_instance_q15 * pSrcB,
    01396                  arm_matrix_instance_q15 * pDst);
    01397
    01407   arm_status arm_mat_add_q31(
    01408                  const arm_matrix_instance_q31 * pSrcA,
    01409                  const arm_matrix_instance_q31 * pSrcB,
    01410                  arm_matrix_instance_q31 * pDst);
    01411
    01412
    01421   arm_status arm_mat_trans_f32(
    01422                    const arm_matrix_instance_f32 * pSrc,
    01423                    arm_matrix_instance_f32 * pDst);
    01424
    01425
    01434   arm_status arm_mat_trans_q15(
    01435                    const arm_matrix_instance_q15 * pSrc,
    01436                    arm_matrix_instance_q15 * pDst);
    01437
    01446   arm_status arm_mat_trans_q31(
    01447                    const arm_matrix_instance_q31 * pSrc,
    01448                    arm_matrix_instance_q31 * pDst);
    01449
    01450
    01460   arm_status arm_mat_mult_f32(
    01461                   const arm_matrix_instance_f32 * pSrcA,
    01462                   const arm_matrix_instance_f32 * pSrcB,
    01463                   arm_matrix_instance_f32 * pDst);
    01464
    01474   arm_status arm_mat_mult_q15(
    01475                   const arm_matrix_instance_q15 * pSrcA,
    01476                   const arm_matrix_instance_q15 * pSrcB,
    01477                   arm_matrix_instance_q15 * pDst,
    01478                   q15_t * pState);
    01479
    01490   arm_status arm_mat_mult_fast_q15(
    01491                    const arm_matrix_instance_q15 * pSrcA,
    01492                    const arm_matrix_instance_q15 * pSrcB,
    01493                    arm_matrix_instance_q15 * pDst,
    01494                    q15_t * pState);
    01495
    01505   arm_status arm_mat_mult_q31(
    01506                   const arm_matrix_instance_q31 * pSrcA,
    01507                   const arm_matrix_instance_q31 * pSrcB,
    01508                   arm_matrix_instance_q31 * pDst);
    01509
    01519   arm_status arm_mat_mult_fast_q31(
    01520                    const arm_matrix_instance_q31 * pSrcA,
    01521                    const arm_matrix_instance_q31 * pSrcB,
    01522                    arm_matrix_instance_q31 * pDst);
    01523
    01524
    01534   arm_status arm_mat_sub_f32(
    01535                  const arm_matrix_instance_f32 * pSrcA,
    01536                  const arm_matrix_instance_f32 * pSrcB,
    01537                  arm_matrix_instance_f32 * pDst);
    01538
    01548   arm_status arm_mat_sub_q15(
    01549                  const arm_matrix_instance_q15 * pSrcA,
    01550                  const arm_matrix_instance_q15 * pSrcB,
    01551                  arm_matrix_instance_q15 * pDst);
    01552
    01562   arm_status arm_mat_sub_q31(
    01563                  const arm_matrix_instance_q31 * pSrcA,
    01564                  const arm_matrix_instance_q31 * pSrcB,
    01565                  arm_matrix_instance_q31 * pDst);
    01566
    01576   arm_status arm_mat_scale_f32(
    01577                    const arm_matrix_instance_f32 * pSrc,
    01578                    float32_t scale,
    01579                    arm_matrix_instance_f32 * pDst);
    01580
    01591   arm_status arm_mat_scale_q15(
    01592                    const arm_matrix_instance_q15 * pSrc,
    01593                    q15_t scaleFract,
    01594                    int32_t shift,
    01595                    arm_matrix_instance_q15 * pDst);
    01596
    01607   arm_status arm_mat_scale_q31(
    01608                    const arm_matrix_instance_q31 * pSrc,
    01609                    q31_t scaleFract,
    01610                    int32_t shift,
    01611                    arm_matrix_instance_q31 * pDst);
    01612
    01613
    01623   void arm_mat_init_q31(
    01624             arm_matrix_instance_q31 * S,
    01625             uint16_t nRows,
    01626             uint16_t nColumns,
    01627             q31_t   *pData);
    01628
    01638   void arm_mat_init_q15(
    01639             arm_matrix_instance_q15 * S,
    01640             uint16_t nRows,
    01641             uint16_t nColumns,
    01642             q15_t    *pData);
    01643
    01653   void arm_mat_init_f32(
    01654             arm_matrix_instance_f32 * S,
    01655             uint16_t nRows,
    01656             uint16_t nColumns,
    01657             float32_t   *pData);
    01658
    01659
    01660
    01664   typedef struct
    01665   {
    01666     q15_t A0;
    01667     #ifdef ARM_MATH_CM0
    01668     q15_t A1;
    01669     q15_t A2;
    01670     #else
    01671     q31_t A1;
    01672     #endif
    01673     q15_t state[3];
    01674     q15_t Kp;
    01675     q15_t Ki;
    01676     q15_t Kd;
    01677   } arm_pid_instance_q15;
    01678
    01682   typedef struct
    01683   {
    01684     q31_t A0;
    01685     q31_t A1;
    01686     q31_t A2;
    01687     q31_t state[3];
    01688     q31_t Kp;
    01689     q31_t Ki;
    01690     q31_t Kd;
    01692   } arm_pid_instance_q31;
    01693
    01697   typedef struct
    01698   {
    01699     float32_t A0;
    01700     float32_t A1;
    01701     float32_t A2;
    01702     float32_t state[3];
    01703     float32_t Kp;
    01704     float32_t Ki;
    01705     float32_t Kd;
    01706   } arm_pid_instance_f32;
    01707
    01708
    01709
    01716   void arm_pid_init_f32(
    01717             arm_pid_instance_f32 * S,
    01718             int32_t resetStateFlag);
    01719
    01725   void arm_pid_reset_f32(
    01726              arm_pid_instance_f32 * S);
    01727
    01728
    01735   void arm_pid_init_q31(
    01736             arm_pid_instance_q31 * S,
    01737             int32_t resetStateFlag);
    01738
    01739
    01746   void arm_pid_reset_q31(
    01747              arm_pid_instance_q31 * S);
    01748
    01755   void arm_pid_init_q15(
    01756             arm_pid_instance_q15 * S,
    01757             int32_t resetStateFlag);
    01758
    01764   void arm_pid_reset_q15(
    01765              arm_pid_instance_q15 * S);
    01766
    01767
    01771   typedef struct
    01772   {
    01773     uint32_t nValues;
    01774     float32_t x1;
    01775     float32_t xSpacing;
    01776     float32_t *pYData;
    01777   } arm_linear_interp_instance_f32;
    01778
    01783   typedef struct
    01784   {
    01785     uint16_t numRows;
    01786     uint16_t numCols;
    01787     float32_t *pData;
    01788   } arm_bilinear_interp_instance_f32;
    01789
    01794   typedef struct
    01795   {
    01796     uint16_t numRows;
    01797     uint16_t numCols;
    01798     q31_t *pData;
    01799   } arm_bilinear_interp_instance_q31;
    01800
    01805   typedef struct
    01806   {
    01807     uint16_t numRows;
    01808     uint16_t numCols;
    01809     q15_t *pData;
    01810   } arm_bilinear_interp_instance_q15;
    01811
    01816   typedef struct
    01817   {
    01818     uint16_t numRows;
    01819     uint16_t numCols;
    01820     q7_t *pData;
    01821   } arm_bilinear_interp_instance_q7;
    01822
    01823
    01833   void arm_mult_q7(
    01834             q7_t * pSrcA,
    01835             q7_t * pSrcB,
    01836            q7_t * pDst,
    01837            uint32_t blockSize);
    01838
    01848   void arm_mult_q15(
    01849              q15_t * pSrcA,
    01850              q15_t * pSrcB,
    01851             q15_t * pDst,
    01852             uint32_t blockSize);
    01853
    01863   void arm_mult_q31(
    01864              q31_t * pSrcA,
    01865              q31_t * pSrcB,
    01866             q31_t * pDst,
    01867             uint32_t blockSize);
    01868
    01878   void arm_mult_f32(
    01879              float32_t * pSrcA,
    01880              float32_t * pSrcB,
    01881             float32_t * pDst,
    01882             uint32_t blockSize);
    01883
    01884
    01889   typedef struct
    01890   {
    01891     uint16_t  fftLen;
    01892     uint8_t   ifftFlag;
    01893     uint8_t   bitReverseFlag;
    01894     q15_t     *pTwiddle;
    01895     uint16_t  *pBitRevTable;
    01896     uint16_t  twidCoefModifier;
    01897     uint16_t  bitRevFactor;
    01898   } arm_cfft_radix4_instance_q15;
    01899
    01904   typedef struct
    01905   {
    01906     uint16_t    fftLen;
    01907     uint8_t     ifftFlag;
    01908     uint8_t     bitReverseFlag;
    01909     q31_t       *pTwiddle;
    01910     uint16_t    *pBitRevTable;
    01911     uint16_t    twidCoefModifier;
    01912     uint16_t    bitRevFactor;
    01913   } arm_cfft_radix4_instance_q31;
    01914
    01919   typedef struct
    01920   {
    01921     uint16_t     fftLen;
    01922     uint8_t      ifftFlag;
    01923     uint8_t      bitReverseFlag;
    01924     float32_t    *pTwiddle;
    01925     uint16_t     *pBitRevTable;
    01926     uint16_t     twidCoefModifier;
    01927     uint16_t     bitRevFactor;
    01928     float32_t    onebyfftLen;
    01929   } arm_cfft_radix4_instance_f32;
    01930
    01938   void arm_cfft_radix4_q15(
    01939                const arm_cfft_radix4_instance_q15 * S,
    01940                q15_t * pSrc);
    01941
    01951   arm_status arm_cfft_radix4_init_q15(
    01952                       arm_cfft_radix4_instance_q15 * S,
    01953                       uint16_t fftLen,
    01954                       uint8_t ifftFlag,
    01955                       uint8_t bitReverseFlag);
    01956
    01964   void arm_cfft_radix4_q31(
    01965                const arm_cfft_radix4_instance_q31 * S,
    01966                q31_t * pSrc);
    01967
    01977   arm_status arm_cfft_radix4_init_q31(
    01978                       arm_cfft_radix4_instance_q31 * S,
    01979                       uint16_t fftLen,
    01980                       uint8_t ifftFlag,
    01981                       uint8_t bitReverseFlag);
    01982
    01990   void arm_cfft_radix4_f32(
    01991                const arm_cfft_radix4_instance_f32 * S,
    01992                float32_t * pSrc);
    01993
    02003   arm_status arm_cfft_radix4_init_f32(
    02004                       arm_cfft_radix4_instance_f32 * S,
    02005                       uint16_t fftLen,
    02006                       uint8_t ifftFlag,
    02007                       uint8_t bitReverseFlag);
    02008
    02009
    02010
    02011   /*----------------------------------------------------------------------
    02012    *        Internal functions prototypes FFT function
    02013    ----------------------------------------------------------------------*/
    02014
    02024   void arm_radix4_butterfly_f32(
    02025                 float32_t * pSrc,
    02026                 uint16_t fftLen,
    02027                 float32_t * pCoef,
    02028                 uint16_t twidCoefModifier);
    02029
    02040   void arm_radix4_butterfly_inverse_f32(
    02041                     float32_t * pSrc,
    02042                     uint16_t fftLen,
    02043                     float32_t * pCoef,
    02044                     uint16_t twidCoefModifier,
    02045                     float32_t onebyfftLen);
    02046
    02056   void arm_bitreversal_f32(
    02057                float32_t *pSrc,
    02058                uint16_t fftSize,
    02059                uint16_t bitRevFactor,
    02060                uint16_t *pBitRevTab);
    02061
    02071   void arm_radix4_butterfly_q31(
    02072                 q31_t *pSrc,
    02073                 uint32_t fftLen,
    02074                 q31_t *pCoef,
    02075                 uint32_t twidCoefModifier);
    02076
    02086   void arm_radix4_butterfly_inverse_q31(
    02087                     q31_t * pSrc,
    02088                     uint32_t fftLen,
    02089                     q31_t * pCoef,
    02090                     uint32_t twidCoefModifier);
    02091
    02101   void arm_bitreversal_q31(
    02102                q31_t * pSrc,
    02103                uint32_t fftLen,
    02104                uint16_t bitRevFactor,
    02105                uint16_t *pBitRevTab);
    02106
    02116   void arm_radix4_butterfly_q15(
    02117                 q15_t *pSrc16,
    02118                 uint32_t fftLen,
    02119                 q15_t *pCoef16,
    02120                 uint32_t twidCoefModifier);
    02121
    02131   void arm_radix4_butterfly_inverse_q15(
    02132                     q15_t *pSrc16,
    02133                     uint32_t fftLen,
    02134                     q15_t *pCoef16,
    02135                     uint32_t twidCoefModifier);
    02136
    02146   void arm_bitreversal_q15(
    02147                q15_t * pSrc,
    02148                uint32_t fftLen,
    02149                uint16_t bitRevFactor,
    02150                uint16_t *pBitRevTab);
    02151
    02156   typedef struct
    02157   {
    02158     uint32_t fftLenReal;
    02159     uint32_t fftLenBy2;
    02160     uint8_t  ifftFlagR;
    02161     uint8_t  bitReverseFlagR;
    02162     uint32_t twidCoefRModifier;
    02163     q15_t    *pTwiddleAReal;
    02164     q15_t    *pTwiddleBReal;
    02165     arm_cfft_radix4_instance_q15 *pCfft;
    02166   } arm_rfft_instance_q15;
    02167
    02172   typedef struct
    02173   {
    02174     uint32_t fftLenReal;
    02175     uint32_t fftLenBy2;
    02176     uint8_t  ifftFlagR;
    02177     uint8_t  bitReverseFlagR;
    02178     uint32_t twidCoefRModifier;
    02179     q31_t    *pTwiddleAReal;
    02180     q31_t    *pTwiddleBReal;
    02181     arm_cfft_radix4_instance_q31 *pCfft;
    02182   } arm_rfft_instance_q31;
    02183
    02188   typedef struct
    02189   {
    02190     uint32_t  fftLenReal;
    02191     uint16_t  fftLenBy2;
    02192     uint8_t   ifftFlagR;
    02193     uint8_t   bitReverseFlagR;
    02194     uint32_t  twidCoefRModifier;
    02195     float32_t *pTwiddleAReal;
    02196     float32_t *pTwiddleBReal;
    02197     arm_cfft_radix4_instance_f32 *pCfft;
    02198   } arm_rfft_instance_f32;
    02199
    02208   void arm_rfft_q15(
    02209             const arm_rfft_instance_q15 * S,
    02210             q15_t * pSrc,
    02211             q15_t * pDst);
    02212
    02223   arm_status arm_rfft_init_q15(
    02224                    arm_rfft_instance_q15 * S,
    02225                    arm_cfft_radix4_instance_q15 * S_CFFT,
    02226                    uint32_t fftLenReal,
    02227                    uint32_t ifftFlagR,
    02228                    uint32_t bitReverseFlag);
    02229
    02238   void arm_rfft_q31(
    02239             const arm_rfft_instance_q31 * S,
    02240             q31_t * pSrc,
    02241             q31_t * pDst);
    02242
    02253   arm_status arm_rfft_init_q31(
    02254                    arm_rfft_instance_q31 * S,
    02255                    arm_cfft_radix4_instance_q31 * S_CFFT,
    02256                    uint32_t fftLenReal,
    02257                    uint32_t ifftFlagR,
    02258                    uint32_t bitReverseFlag);
    02259
    02270   arm_status arm_rfft_init_f32(
    02271                    arm_rfft_instance_f32 * S,
    02272                    arm_cfft_radix4_instance_f32 * S_CFFT,
    02273                    uint32_t fftLenReal,
    02274                    uint32_t ifftFlagR,
    02275                    uint32_t bitReverseFlag);
    02276
    02285   void arm_rfft_f32(
    02286             const arm_rfft_instance_f32 * S,
    02287             float32_t * pSrc,
    02288             float32_t * pDst);
    02289
    02294   typedef struct
    02295   {
    02296     uint16_t N;
    02297     uint16_t Nby2;
    02298     float32_t normalize;
    02299     float32_t *pTwiddle;
    02300     float32_t *pCosFactor;
    02301     arm_rfft_instance_f32 *pRfft;
    02302     arm_cfft_radix4_instance_f32 *pCfft;
    02303   } arm_dct4_instance_f32;
    02304
    02316   arm_status arm_dct4_init_f32(
    02317                    arm_dct4_instance_f32 * S,
    02318                    arm_rfft_instance_f32 * S_RFFT,
    02319                    arm_cfft_radix4_instance_f32 * S_CFFT,
    02320                    uint16_t N,
    02321                    uint16_t Nby2,
    02322                    float32_t normalize);
    02323
    02332   void arm_dct4_f32(
    02333             const arm_dct4_instance_f32 * S,
    02334             float32_t * pState,
    02335             float32_t * pInlineBuffer);
    02336
    02341   typedef struct
    02342   {
    02343     uint16_t N;
    02344     uint16_t Nby2;
    02345     q31_t normalize;
    02346     q31_t *pTwiddle;
    02347     q31_t *pCosFactor;
    02348     arm_rfft_instance_q31 *pRfft;
    02349     arm_cfft_radix4_instance_q31 *pCfft;
    02350   } arm_dct4_instance_q31;
    02351
    02363   arm_status arm_dct4_init_q31(
    02364                    arm_dct4_instance_q31 * S,
    02365                    arm_rfft_instance_q31 * S_RFFT,
    02366                    arm_cfft_radix4_instance_q31 * S_CFFT,
    02367                    uint16_t N,
    02368                    uint16_t Nby2,
    02369                    q31_t normalize);
    02370
    02379   void arm_dct4_q31(
    02380             const arm_dct4_instance_q31 * S,
    02381             q31_t * pState,
    02382             q31_t * pInlineBuffer);
    02383
    02388   typedef struct
    02389   {
    02390     uint16_t N;
    02391     uint16_t Nby2;
    02392     q15_t normalize;
    02393     q15_t *pTwiddle;
    02394     q15_t *pCosFactor;
    02395     arm_rfft_instance_q15 *pRfft;
    02396     arm_cfft_radix4_instance_q15 *pCfft;
    02397   } arm_dct4_instance_q15;
    02398
    02410   arm_status arm_dct4_init_q15(
    02411                    arm_dct4_instance_q15 * S,
    02412                    arm_rfft_instance_q15 * S_RFFT,
    02413                    arm_cfft_radix4_instance_q15 * S_CFFT,
    02414                    uint16_t N,
    02415                    uint16_t Nby2,
    02416                    q15_t normalize);
    02417
    02426   void arm_dct4_q15(
    02427             const arm_dct4_instance_q15 * S,
    02428             q15_t * pState,
    02429             q15_t * pInlineBuffer);
    02430
    02440   void arm_add_f32(
    02441            float32_t * pSrcA,
    02442            float32_t * pSrcB,
    02443            float32_t * pDst,
    02444            uint32_t blockSize);
    02445
    02455   void arm_add_q7(
    02456           q7_t * pSrcA,
    02457           q7_t * pSrcB,
    02458           q7_t * pDst,
    02459           uint32_t blockSize);
    02460
    02470   void arm_add_q15(
    02471             q15_t * pSrcA,
    02472             q15_t * pSrcB,
    02473            q15_t * pDst,
    02474            uint32_t blockSize);
    02475
    02485   void arm_add_q31(
    02486             q31_t * pSrcA,
    02487             q31_t * pSrcB,
    02488            q31_t * pDst,
    02489            uint32_t blockSize);
    02490
    02500   void arm_sub_f32(
    02501             float32_t * pSrcA,
    02502             float32_t * pSrcB,
    02503            float32_t * pDst,
    02504            uint32_t blockSize);
    02505
    02515   void arm_sub_q7(
    02516            q7_t * pSrcA,
    02517            q7_t * pSrcB,
    02518           q7_t * pDst,
    02519           uint32_t blockSize);
    02520
    02530   void arm_sub_q15(
    02531             q15_t * pSrcA,
    02532             q15_t * pSrcB,
    02533            q15_t * pDst,
    02534            uint32_t blockSize);
    02535
    02545   void arm_sub_q31(
    02546             q31_t * pSrcA,
    02547             q31_t * pSrcB,
    02548            q31_t * pDst,
    02549            uint32_t blockSize);
    02550
    02560   void arm_scale_f32(
    02561               float32_t * pSrc,
    02562              float32_t scale,
    02563              float32_t * pDst,
    02564              uint32_t blockSize);
    02565
    02576   void arm_scale_q7(
    02577              q7_t * pSrc,
    02578             q7_t scaleFract,
    02579             int8_t shift,
    02580             q7_t * pDst,
    02581             uint32_t blockSize);
    02582
    02593   void arm_scale_q15(
    02594               q15_t * pSrc,
    02595              q15_t scaleFract,
    02596              int8_t shift,
    02597              q15_t * pDst,
    02598              uint32_t blockSize);
    02599
    02610   void arm_scale_q31(
    02611               q31_t * pSrc,
    02612              q31_t scaleFract,
    02613              int8_t shift,
    02614              q31_t * pDst,
    02615              uint32_t blockSize);
    02616
    02625   void arm_abs_q7(
    02626            q7_t * pSrc,
    02627           q7_t * pDst,
    02628           uint32_t blockSize);
    02629
    02638   void arm_abs_f32(
    02639             float32_t * pSrc,
    02640            float32_t * pDst,
    02641            uint32_t blockSize);
    02642
    02651   void arm_abs_q15(
    02652             q15_t * pSrc,
    02653            q15_t * pDst,
    02654            uint32_t blockSize);
    02655
    02664   void arm_abs_q31(
    02665             q31_t * pSrc,
    02666            q31_t * pDst,
    02667            uint32_t blockSize);
    02668
    02678   void arm_dot_prod_f32(
    02679              float32_t * pSrcA,
    02680              float32_t * pSrcB,
    02681             uint32_t blockSize,
    02682             float32_t * result);
    02683
    02693   void arm_dot_prod_q7(
    02694                 q7_t * pSrcA,
    02695                 q7_t * pSrcB,
    02696                uint32_t blockSize,
    02697                q31_t * result);
    02698
    02708   void arm_dot_prod_q15(
    02709              q15_t * pSrcA,
    02710              q15_t * pSrcB,
    02711             uint32_t blockSize,
    02712             q63_t * result);
    02713
    02723   void arm_dot_prod_q31(
    02724              q31_t * pSrcA,
    02725              q31_t * pSrcB,
    02726             uint32_t blockSize,
    02727             q63_t * result);
    02728
    02738   void arm_shift_q7(
    02739              q7_t * pSrc,
    02740             int8_t shiftBits,
    02741             q7_t * pDst,
    02742             uint32_t blockSize);
    02743
    02753   void arm_shift_q15(
    02754               q15_t * pSrc,
    02755              int8_t shiftBits,
    02756              q15_t * pDst,
    02757              uint32_t blockSize);
    02758
    02768   void arm_shift_q31(
    02769               q31_t * pSrc,
    02770              int8_t shiftBits,
    02771              q31_t * pDst,
    02772              uint32_t blockSize);
    02773
    02783   void arm_offset_f32(
    02784                float32_t * pSrc,
    02785               float32_t offset,
    02786               float32_t * pDst,
    02787               uint32_t blockSize);
    02788
    02798   void arm_offset_q7(
    02799               q7_t * pSrc,
    02800              q7_t offset,
    02801              q7_t * pDst,
    02802              uint32_t blockSize);
    02803
    02813   void arm_offset_q15(
    02814                q15_t * pSrc,
    02815               q15_t offset,
    02816               q15_t * pDst,
    02817               uint32_t blockSize);
    02818
    02828   void arm_offset_q31(
    02829                q31_t * pSrc,
    02830               q31_t offset,
    02831               q31_t * pDst,
    02832               uint32_t blockSize);
    02833
    02842   void arm_negate_f32(
    02843                float32_t * pSrc,
    02844               float32_t * pDst,
    02845               uint32_t blockSize);
    02846
    02855   void arm_negate_q7(
    02856               q7_t * pSrc,
    02857              q7_t * pDst,
    02858              uint32_t blockSize);
    02859
    02868   void arm_negate_q15(
    02869                q15_t * pSrc,
    02870               q15_t * pDst,
    02871               uint32_t blockSize);
    02872
    02881   void arm_negate_q31(
    02882                q31_t * pSrc,
    02883               q31_t * pDst,
    02884               uint32_t blockSize);
    02892   void arm_copy_f32(
    02893              float32_t * pSrc,
    02894             float32_t * pDst,
    02895             uint32_t blockSize);
    02896
    02904   void arm_copy_q7(
    02905             q7_t * pSrc,
    02906            q7_t * pDst,
    02907            uint32_t blockSize);
    02908
    02916   void arm_copy_q15(
    02917              q15_t * pSrc,
    02918             q15_t * pDst,
    02919             uint32_t blockSize);
    02920
    02928   void arm_copy_q31(
    02929              q31_t * pSrc,
    02930             q31_t * pDst,
    02931             uint32_t blockSize);
    02939   void arm_fill_f32(
    02940              float32_t value,
    02941             float32_t * pDst,
    02942             uint32_t blockSize);
    02943
    02951   void arm_fill_q7(
    02952             q7_t value,
    02953            q7_t * pDst,
    02954            uint32_t blockSize);
    02955
    02963   void arm_fill_q15(
    02964              q15_t value,
    02965             q15_t * pDst,
    02966             uint32_t blockSize);
    02967
    02975   void arm_fill_q31(
    02976              q31_t value,
    02977             q31_t * pDst,
    02978             uint32_t blockSize);
    02979
    02990   void arm_conv_f32(
    02991              float32_t * pSrcA,
    02992             uint32_t srcALen,
    02993              float32_t * pSrcB,
    02994             uint32_t srcBLen,
    02995             float32_t * pDst);
    02996
    03007   void arm_conv_q15(
    03008              q15_t * pSrcA,
    03009             uint32_t srcALen,
    03010              q15_t * pSrcB,
    03011             uint32_t srcBLen,
    03012             q15_t * pDst);
    03013
    03024   void arm_conv_fast_q15(
    03025               q15_t * pSrcA,
    03026              uint32_t srcALen,
    03027               q15_t * pSrcB,
    03028              uint32_t srcBLen,
    03029              q15_t * pDst);
    03030
    03041   void arm_conv_q31(
    03042              q31_t * pSrcA,
    03043             uint32_t srcALen,
    03044              q31_t * pSrcB,
    03045             uint32_t srcBLen,
    03046             q31_t * pDst);
    03047
    03058   void arm_conv_fast_q31(
    03059               q31_t * pSrcA,
    03060              uint32_t srcALen,
    03061               q31_t * pSrcB,
    03062              uint32_t srcBLen,
    03063              q31_t * pDst);
    03064
    03075   void arm_conv_q7(
    03076             q7_t * pSrcA,
    03077            uint32_t srcALen,
    03078             q7_t * pSrcB,
    03079            uint32_t srcBLen,
    03080            q7_t * pDst);
    03081
    03094   arm_status arm_conv_partial_f32(
    03095                    float32_t * pSrcA,
    03096                   uint32_t srcALen,
    03097                    float32_t * pSrcB,
    03098                   uint32_t srcBLen,
    03099                   float32_t * pDst,
    03100                   uint32_t firstIndex,
    03101                   uint32_t numPoints);
    03102
    03115   arm_status arm_conv_partial_q15(
    03116                    q15_t * pSrcA,
    03117                   uint32_t srcALen,
    03118                    q15_t * pSrcB,
    03119                   uint32_t srcBLen,
    03120                   q15_t * pDst,
    03121                   uint32_t firstIndex,
    03122                   uint32_t numPoints);
    03123
    03136   arm_status arm_conv_partial_fast_q15(
    03137                         q15_t * pSrcA,
    03138                        uint32_t srcALen,
    03139                         q15_t * pSrcB,
    03140                        uint32_t srcBLen,
    03141                        q15_t * pDst,
    03142                        uint32_t firstIndex,
    03143                        uint32_t numPoints);
    03144
    03157   arm_status arm_conv_partial_q31(
    03158                    q31_t * pSrcA,
    03159                   uint32_t srcALen,
    03160                    q31_t * pSrcB,
    03161                   uint32_t srcBLen,
    03162                   q31_t * pDst,
    03163                   uint32_t firstIndex,
    03164                   uint32_t numPoints);
    03165
    03166
    03179   arm_status arm_conv_partial_fast_q31(
    03180                         q31_t * pSrcA,
    03181                        uint32_t srcALen,
    03182                         q31_t * pSrcB,
    03183                        uint32_t srcBLen,
    03184                        q31_t * pDst,
    03185                        uint32_t firstIndex,
    03186                        uint32_t numPoints);
    03187
    03200   arm_status arm_conv_partial_q7(
    03201                   q7_t * pSrcA,
    03202                  uint32_t srcALen,
    03203                   q7_t * pSrcB,
    03204                  uint32_t srcBLen,
    03205                  q7_t * pDst,
    03206                  uint32_t firstIndex,
    03207                  uint32_t numPoints);
    03208
    03209
    03214   typedef struct
    03215   {
    03216     uint8_t M;
    03217     uint16_t numTaps;
    03218     q15_t *pCoeffs;
    03219     q15_t *pState;
    03220   } arm_fir_decimate_instance_q15;
    03221
    03226   typedef struct
    03227   {
    03228     uint8_t M;
    03229     uint16_t numTaps;
    03230     q31_t *pCoeffs;
    03231     q31_t *pState;
    03233   } arm_fir_decimate_instance_q31;
    03234
    03239   typedef struct
    03240   {
    03241     uint8_t M;
    03242     uint16_t numTaps;
    03243     float32_t *pCoeffs;
    03244     float32_t *pState;
    03246   } arm_fir_decimate_instance_f32;
    03247
    03248
    03249
    03259   void arm_fir_decimate_f32(
    03260                 const arm_fir_decimate_instance_f32 * S,
    03261                  float32_t * pSrc,
    03262                 float32_t * pDst,
    03263                 uint32_t blockSize);
    03264
    03265
    03278   arm_status arm_fir_decimate_init_f32(
    03279                        arm_fir_decimate_instance_f32 * S,
    03280                        uint16_t numTaps,
    03281                        uint8_t M,
    03282                        float32_t * pCoeffs,
    03283                        float32_t * pState,
    03284                        uint32_t blockSize);
    03285
    03295   void arm_fir_decimate_q15(
    03296                 const arm_fir_decimate_instance_q15 * S,
    03297                  q15_t * pSrc,
    03298                 q15_t * pDst,
    03299                 uint32_t blockSize);
    03300
    03310   void arm_fir_decimate_fast_q15(
    03311                  const arm_fir_decimate_instance_q15 * S,
    03312                   q15_t * pSrc,
    03313                  q15_t * pDst,
    03314                  uint32_t blockSize);
    03315
    03316
    03317
    03330   arm_status arm_fir_decimate_init_q15(
    03331                        arm_fir_decimate_instance_q15 * S,
    03332                        uint16_t numTaps,
    03333                        uint8_t M,
    03334                        q15_t * pCoeffs,
    03335                        q15_t * pState,
    03336                        uint32_t blockSize);
    03337
    03347   void arm_fir_decimate_q31(
    03348                 const arm_fir_decimate_instance_q31 * S,
    03349                  q31_t * pSrc,
    03350                 q31_t * pDst,
    03351                 uint32_t blockSize);
    03352
    03362   void arm_fir_decimate_fast_q31(
    03363                  arm_fir_decimate_instance_q31 * S,
    03364                   q31_t * pSrc,
    03365                  q31_t * pDst,
    03366                  uint32_t blockSize);
    03367
    03368
    03381   arm_status arm_fir_decimate_init_q31(
    03382                        arm_fir_decimate_instance_q31 * S,
    03383                        uint16_t numTaps,
    03384                        uint8_t M,
    03385                        q31_t * pCoeffs,
    03386                        q31_t * pState,
    03387                        uint32_t blockSize);
    03388
    03389
    03390
    03395   typedef struct
    03396   {
    03397     uint8_t L;
    03398     uint16_t phaseLength;
    03399     q15_t *pCoeffs;
    03400     q15_t *pState;
    03401   } arm_fir_interpolate_instance_q15;
    03402
    03407   typedef struct
    03408   {
    03409     uint8_t L;
    03410     uint16_t phaseLength;
    03411     q31_t *pCoeffs;
    03412     q31_t *pState;
    03413   } arm_fir_interpolate_instance_q31;
    03414
    03419   typedef struct
    03420   {
    03421     uint8_t L;
    03422     uint16_t phaseLength;
    03423     float32_t *pCoeffs;
    03424     float32_t *pState;
    03425   } arm_fir_interpolate_instance_f32;
    03426
    03427
    03437   void arm_fir_interpolate_q15(
    03438                    const arm_fir_interpolate_instance_q15 * S,
    03439                     q15_t * pSrc,
    03440                    q15_t * pDst,
    03441                    uint32_t blockSize);
    03442
    03443
    03456   arm_status arm_fir_interpolate_init_q15(
    03457                       arm_fir_interpolate_instance_q15 * S,
    03458                       uint8_t L,
    03459                       uint16_t numTaps,
    03460                       q15_t * pCoeffs,
    03461                       q15_t * pState,
    03462                       uint32_t blockSize);
    03463
    03473   void arm_fir_interpolate_q31(
    03474                    const arm_fir_interpolate_instance_q31 * S,
    03475                     q31_t * pSrc,
    03476                    q31_t * pDst,
    03477                    uint32_t blockSize);
    03478
    03491   arm_status arm_fir_interpolate_init_q31(
    03492                       arm_fir_interpolate_instance_q31 * S,
    03493                       uint8_t L,
    03494                       uint16_t numTaps,
    03495                       q31_t * pCoeffs,
    03496                       q31_t * pState,
    03497                       uint32_t blockSize);
    03498
    03499
    03509   void arm_fir_interpolate_f32(
    03510                    const arm_fir_interpolate_instance_f32 * S,
    03511                     float32_t * pSrc,
    03512                    float32_t * pDst,
    03513                    uint32_t blockSize);
    03514
    03527   arm_status arm_fir_interpolate_init_f32(
    03528                       arm_fir_interpolate_instance_f32 * S,
    03529                       uint8_t L,
    03530                       uint16_t numTaps,
    03531                       float32_t * pCoeffs,
    03532                       float32_t * pState,
    03533                       uint32_t blockSize);
    03534
    03539   typedef struct
    03540   {
    03541     uint8_t numStages;
    03542     q63_t *pState;
    03543     q31_t *pCoeffs;
    03544     uint8_t postShift;
    03546   } arm_biquad_cas_df1_32x64_ins_q31;
    03547
    03548
    03557   void arm_biquad_cas_df1_32x64_q31(
    03558                     const arm_biquad_cas_df1_32x64_ins_q31 * S,
    03559                      q31_t * pSrc,
    03560                     q31_t * pDst,
    03561                     uint32_t blockSize);
    03562
    03563
    03573   void arm_biquad_cas_df1_32x64_init_q31(
    03574                      arm_biquad_cas_df1_32x64_ins_q31 * S,
    03575                      uint8_t numStages,
    03576                      q31_t * pCoeffs,
    03577                      q63_t * pState,
    03578                      uint8_t postShift);
    03579
    03580
    03581
    03586   typedef struct
    03587   {
    03588     uint8_t   numStages;
    03589     float32_t *pState;
    03590     float32_t *pCoeffs;
    03591   } arm_biquad_cascade_df2T_instance_f32;
    03592
    03593
    03603   void arm_biquad_cascade_df2T_f32(
    03604                    const arm_biquad_cascade_df2T_instance_f32 * S,
    03605                     float32_t * pSrc,
    03606                    float32_t * pDst,
    03607                    uint32_t blockSize);
    03608
    03609
    03619   void arm_biquad_cascade_df2T_init_f32(
    03620                     arm_biquad_cascade_df2T_instance_f32 * S,
    03621                     uint8_t numStages,
    03622                     float32_t * pCoeffs,
    03623                     float32_t * pState);
    03624
    03625
    03626
    03631   typedef struct
    03632   {
    03633     uint16_t numStages;
    03634     q15_t *pState;
    03635     q15_t *pCoeffs;
    03636   } arm_fir_lattice_instance_q15;
    03637
    03642   typedef struct
    03643   {
    03644     uint16_t numStages;
    03645     q31_t *pState;
    03646     q31_t *pCoeffs;
    03647   } arm_fir_lattice_instance_q31;
    03648
    03653   typedef struct
    03654   {
    03655     uint16_t numStages;
    03656     float32_t *pState;
    03657     float32_t *pCoeffs;
    03658   } arm_fir_lattice_instance_f32;
    03659
    03669   void arm_fir_lattice_init_q15(
    03670                 arm_fir_lattice_instance_q15 * S,
    03671                 uint16_t numStages,
    03672                 q15_t * pCoeffs,
    03673                 q15_t * pState);
    03674
    03675
    03684   void arm_fir_lattice_q15(
    03685                const arm_fir_lattice_instance_q15 * S,
    03686                 q15_t * pSrc,
    03687                q15_t * pDst,
    03688                uint32_t blockSize);
    03689
    03699   void arm_fir_lattice_init_q31(
    03700                 arm_fir_lattice_instance_q31 * S,
    03701                 uint16_t numStages,
    03702                 q31_t * pCoeffs,
    03703                 q31_t * pState);
    03704
    03705
    03715   void arm_fir_lattice_q31(
    03716                const arm_fir_lattice_instance_q31 * S,
    03717                 q31_t * pSrc,
    03718                q31_t * pDst,
    03719                uint32_t blockSize);
    03720
    03730   void arm_fir_lattice_init_f32(
    03731                 arm_fir_lattice_instance_f32 * S,
    03732                 uint16_t numStages,
    03733                 float32_t * pCoeffs,
    03734                 float32_t * pState);
    03735
    03745   void arm_fir_lattice_f32(
    03746                const arm_fir_lattice_instance_f32 * S,
    03747                 float32_t * pSrc,
    03748                float32_t * pDst,
    03749                uint32_t blockSize);
    03750
    03754   typedef struct
    03755   {
    03756     uint16_t numStages;
    03757     q15_t *pState;
    03758     q15_t *pkCoeffs;
    03759     q15_t *pvCoeffs;
    03760   } arm_iir_lattice_instance_q15;
    03761
    03765   typedef struct
    03766   {
    03767     uint16_t numStages;
    03768     q31_t *pState;
    03769     q31_t *pkCoeffs;
    03770     q31_t *pvCoeffs;
    03771   } arm_iir_lattice_instance_q31;
    03772
    03776   typedef struct
    03777   {
    03778     uint16_t numStages;
    03779     float32_t *pState;
    03780     float32_t *pkCoeffs;
    03781     float32_t *pvCoeffs;
    03782   } arm_iir_lattice_instance_f32;
    03783
    03793   void arm_iir_lattice_f32(
    03794                const arm_iir_lattice_instance_f32 * S,
    03795                 float32_t * pSrc,
    03796                float32_t * pDst,
    03797                uint32_t blockSize);
    03798
    03810   void arm_iir_lattice_init_f32(
    03811                 arm_iir_lattice_instance_f32 * S,
    03812                 uint16_t numStages,
    03813                 float32_t *pkCoeffs,
    03814                 float32_t *pvCoeffs,
    03815                 float32_t *pState,
    03816                 uint32_t blockSize);
    03817
    03818
    03828   void arm_iir_lattice_q31(
    03829                const arm_iir_lattice_instance_q31 * S,
    03830                 q31_t * pSrc,
    03831                q31_t * pDst,
    03832                uint32_t blockSize);
    03833
    03834
    03846   void arm_iir_lattice_init_q31(
    03847                 arm_iir_lattice_instance_q31 * S,
    03848                 uint16_t numStages,
    03849                 q31_t *pkCoeffs,
    03850                 q31_t *pvCoeffs,
    03851                 q31_t *pState,
    03852                 uint32_t blockSize);
    03853
    03854
    03864   void arm_iir_lattice_q15(
    03865                const arm_iir_lattice_instance_q15 * S,
    03866                 q15_t * pSrc,
    03867                q15_t * pDst,
    03868                uint32_t blockSize);
    03869
    03870
    03882   void arm_iir_lattice_init_q15(
    03883                 arm_iir_lattice_instance_q15 * S,
    03884                 uint16_t numStages,
    03885                 q15_t *pkCoeffs,
    03886                 q15_t *pvCoeffs,
    03887                 q15_t *pState,
    03888                 uint32_t blockSize);
    03889
    03894   typedef struct
    03895   {
    03896     uint16_t numTaps;
    03897     float32_t *pState;
    03898     float32_t *pCoeffs;
    03899     float32_t mu;
    03900   } arm_lms_instance_f32;
    03901
    03913   void arm_lms_f32(
    03914            const arm_lms_instance_f32 * S,
    03915             float32_t * pSrc,
    03916             float32_t * pRef,
    03917            float32_t * pOut,
    03918            float32_t * pErr,
    03919            uint32_t blockSize);
    03920
    03932   void arm_lms_init_f32(
    03933             arm_lms_instance_f32 * S,
    03934             uint16_t numTaps,
    03935             float32_t * pCoeffs,
    03936             float32_t * pState,
    03937             float32_t mu,
    03938             uint32_t blockSize);
    03939
    03944   typedef struct
    03945   {
    03946     uint16_t numTaps;
    03947     q15_t *pState;
    03948     q15_t *pCoeffs;
    03949     q15_t mu;
    03950     uint32_t postShift;
    03951   } arm_lms_instance_q15;
    03952
    03953
    03966   void arm_lms_init_q15(
    03967             arm_lms_instance_q15 * S,
    03968             uint16_t numTaps,
    03969             q15_t * pCoeffs,
    03970             q15_t * pState,
    03971             q15_t mu,
    03972             uint32_t blockSize,
    03973             uint32_t postShift);
    03974
    03986   void arm_lms_q15(
    03987            const arm_lms_instance_q15 * S,
    03988             q15_t * pSrc,
    03989             q15_t * pRef,
    03990            q15_t * pOut,
    03991            q15_t * pErr,
    03992            uint32_t blockSize);
    03993
    03994
    03999   typedef struct
    04000   {
    04001     uint16_t numTaps;
    04002     q31_t *pState;
    04003     q31_t *pCoeffs;
    04004     q31_t mu;
    04005     uint32_t postShift;
    04007   } arm_lms_instance_q31;
    04008
    04020   void arm_lms_q31(
    04021            const arm_lms_instance_q31 * S,
    04022             q31_t * pSrc,
    04023             q31_t * pRef,
    04024            q31_t * pOut,
    04025            q31_t * pErr,
    04026            uint32_t blockSize);
    04027
    04040   void arm_lms_init_q31(
    04041             arm_lms_instance_q31 * S,
    04042             uint16_t numTaps,
    04043             q31_t *pCoeffs,
    04044             q31_t *pState,
    04045             q31_t mu,
    04046             uint32_t blockSize,
    04047             uint32_t postShift);
    04048
    04053   typedef struct
    04054   {
    04055     uint16_t  numTaps;
    04056     float32_t *pState;
    04057     float32_t *pCoeffs;
    04058     float32_t mu;
    04059     float32_t energy;
    04060     float32_t x0;
    04061   } arm_lms_norm_instance_f32;
    04062
    04074   void arm_lms_norm_f32(
    04075             arm_lms_norm_instance_f32 * S,
    04076              float32_t * pSrc,
    04077              float32_t * pRef,
    04078             float32_t * pOut,
    04079             float32_t * pErr,
    04080             uint32_t blockSize);
    04081
    04093   void arm_lms_norm_init_f32(
    04094                  arm_lms_norm_instance_f32 * S,
    04095                  uint16_t numTaps,
    04096                  float32_t * pCoeffs,
    04097                  float32_t * pState,
    04098                  float32_t mu,
    04099                  uint32_t blockSize);
    04100
    04101
    04105   typedef struct
    04106   {
    04107     uint16_t numTaps;
    04108     q31_t *pState;
    04109     q31_t *pCoeffs;
    04110     q31_t mu;
    04111     uint8_t postShift;
    04112     q31_t *recipTable;
    04113     q31_t energy;
    04114     q31_t x0;
    04115   } arm_lms_norm_instance_q31;
    04116
    04128   void arm_lms_norm_q31(
    04129             arm_lms_norm_instance_q31 * S,
    04130              q31_t * pSrc,
    04131              q31_t * pRef,
    04132             q31_t * pOut,
    04133             q31_t * pErr,
    04134             uint32_t blockSize);
    04135
    04148   void arm_lms_norm_init_q31(
    04149                  arm_lms_norm_instance_q31 * S,
    04150                  uint16_t numTaps,
    04151                  q31_t * pCoeffs,
    04152                  q31_t * pState,
    04153                  q31_t mu,
    04154                  uint32_t blockSize,
    04155                  uint8_t postShift);
    04156
    04161   typedef struct
    04162   {
    04163     uint16_t numTaps;
    04164     q15_t *pState;
    04165     q15_t *pCoeffs;
    04166     q15_t mu;
    04167     uint8_t postShift;
    04168     q15_t *recipTable;
    04169     q15_t energy;
    04170     q15_t x0;
    04171   } arm_lms_norm_instance_q15;
    04172
    04184   void arm_lms_norm_q15(
    04185             arm_lms_norm_instance_q15 * S,
    04186              q15_t * pSrc,
    04187              q15_t * pRef,
    04188             q15_t * pOut,
    04189             q15_t * pErr,
    04190             uint32_t blockSize);
    04191
    04192
    04205   void arm_lms_norm_init_q15(
    04206                  arm_lms_norm_instance_q15 * S,
    04207                  uint16_t numTaps,
    04208                  q15_t * pCoeffs,
    04209                  q15_t * pState,
    04210                  q15_t mu,
    04211                  uint32_t blockSize,
    04212                  uint8_t postShift);
    04213
    04224   void arm_correlate_f32(
    04225               float32_t * pSrcA,
    04226              uint32_t srcALen,
    04227               float32_t * pSrcB,
    04228              uint32_t srcBLen,
    04229              float32_t * pDst);
    04230
    04241   void arm_correlate_q15(
    04242               q15_t * pSrcA,
    04243              uint32_t srcALen,
    04244               q15_t * pSrcB,
    04245              uint32_t srcBLen,
    04246              q15_t * pDst);
    04247
    04258   void arm_correlate_fast_q15(
    04259                    q15_t * pSrcA,
    04260                   uint32_t srcALen,
    04261                    q15_t * pSrcB,
    04262                   uint32_t srcBLen,
    04263                   q15_t * pDst);
    04264
    04275   void arm_correlate_q31(
    04276               q31_t * pSrcA,
    04277              uint32_t srcALen,
    04278               q31_t * pSrcB,
    04279              uint32_t srcBLen,
    04280              q31_t * pDst);
    04281
    04292   void arm_correlate_fast_q31(
    04293                    q31_t * pSrcA,
    04294                   uint32_t srcALen,
    04295                    q31_t * pSrcB,
    04296                   uint32_t srcBLen,
    04297                   q31_t * pDst);
    04298
    04309   void arm_correlate_q7(
    04310              q7_t * pSrcA,
    04311             uint32_t srcALen,
    04312              q7_t * pSrcB,
    04313             uint32_t srcBLen,
    04314             q7_t * pDst);
    04315
    04319   typedef struct
    04320   {
    04321     uint16_t numTaps;
    04322     uint16_t stateIndex;
    04323     float32_t *pState;
    04324     float32_t *pCoeffs;
    04325     uint16_t maxDelay;
    04326     int32_t *pTapDelay;
    04327   } arm_fir_sparse_instance_f32;
    04328
    04333   typedef struct
    04334   {
    04335     uint16_t numTaps;
    04336     uint16_t stateIndex;
    04337     q31_t *pState;
    04338     q31_t *pCoeffs;
    04339     uint16_t maxDelay;
    04340     int32_t *pTapDelay;
    04341   } arm_fir_sparse_instance_q31;
    04342
    04347   typedef struct
    04348   {
    04349     uint16_t numTaps;
    04350     uint16_t stateIndex;
    04351     q15_t *pState;
    04352     q15_t *pCoeffs;
    04353     uint16_t maxDelay;
    04354     int32_t *pTapDelay;
    04355   } arm_fir_sparse_instance_q15;
    04356
    04361   typedef struct
    04362   {
    04363     uint16_t numTaps;
    04364     uint16_t stateIndex;
    04365     q7_t *pState;
    04366     q7_t *pCoeffs;
    04367     uint16_t maxDelay;
    04368     int32_t *pTapDelay;
    04369   } arm_fir_sparse_instance_q7;
    04370
    04381   void arm_fir_sparse_f32(
    04382               arm_fir_sparse_instance_f32 * S,
    04383                float32_t * pSrc,
    04384               float32_t * pDst,
    04385               float32_t * pScratchIn,
    04386               uint32_t blockSize);
    04387
    04400   void arm_fir_sparse_init_f32(
    04401                    arm_fir_sparse_instance_f32 * S,
    04402                    uint16_t numTaps,
    04403                    float32_t * pCoeffs,
    04404                    float32_t * pState,
    04405                    int32_t * pTapDelay,
    04406                    uint16_t maxDelay,
    04407                    uint32_t blockSize);
    04408
    04419   void arm_fir_sparse_q31(
    04420               arm_fir_sparse_instance_q31 * S,
    04421                q31_t * pSrc,
    04422               q31_t * pDst,
    04423               q31_t * pScratchIn,
    04424               uint32_t blockSize);
    04425
    04438   void arm_fir_sparse_init_q31(
    04439                    arm_fir_sparse_instance_q31 * S,
    04440                    uint16_t numTaps,
    04441                    q31_t * pCoeffs,
    04442                    q31_t * pState,
    04443                    int32_t * pTapDelay,
    04444                    uint16_t maxDelay,
    04445                    uint32_t blockSize);
    04446
    04458   void arm_fir_sparse_q15(
    04459               arm_fir_sparse_instance_q15 * S,
    04460                q15_t * pSrc,
    04461               q15_t * pDst,
    04462               q15_t * pScratchIn,
    04463               q31_t * pScratchOut,
    04464               uint32_t blockSize);
    04465
    04466
    04479   void arm_fir_sparse_init_q15(
    04480                    arm_fir_sparse_instance_q15 * S,
    04481                    uint16_t numTaps,
    04482                    q15_t * pCoeffs,
    04483                    q15_t * pState,
    04484                    int32_t * pTapDelay,
    04485                    uint16_t maxDelay,
    04486                    uint32_t blockSize);
    04487
    04499   void arm_fir_sparse_q7(
    04500              arm_fir_sparse_instance_q7 * S,
    04501               q7_t * pSrc,
    04502              q7_t * pDst,
    04503              q7_t * pScratchIn,
    04504              q31_t * pScratchOut,
    04505              uint32_t blockSize);
    04506
    04519   void arm_fir_sparse_init_q7(
    04520                   arm_fir_sparse_instance_q7 * S,
    04521                   uint16_t numTaps,
    04522                   q7_t * pCoeffs,
    04523                   q7_t * pState,
    04524                   int32_t *pTapDelay,
    04525                   uint16_t maxDelay,
    04526                   uint32_t blockSize);
    04527
    04528
    04529   /*
    04530    * @brief  Floating-point sin_cos function.
    04531    * @param[in]  theta    input value in degrees
    04532    * @param[out] *pSinVal points to the processed sine output.
    04533    * @param[out] *pCosVal points to the processed cos output.
    04534    * @return none.
    04535    */
    04536
    04537   void arm_sin_cos_f32(
    04538                float32_t theta,
    04539                float32_t *pSinVal,
    04540                float32_t *pCcosVal);
    04541
    04542   /*
    04543    * @brief  Q31 sin_cos function.
    04544    * @param[in]  theta    scaled input value in degrees
    04545    * @param[out] *pSinVal points to the processed sine output.
    04546    * @param[out] *pCosVal points to the processed cosine output.
    04547    * @return none.
    04548    */
    04549
    04550   void arm_sin_cos_q31(
    04551                q31_t theta,
    04552                q31_t *pSinVal,
    04553                q31_t *pCosVal);
    04554
    04555
    04564   void arm_cmplx_conj_f32(
    04565                float32_t * pSrc,
    04566               float32_t * pDst,
    04567               uint32_t numSamples);
    04568
    04577   void arm_cmplx_conj_q31(
    04578                q31_t * pSrc,
    04579               q31_t * pDst,
    04580               uint32_t numSamples);
    04581
    04590   void arm_cmplx_conj_q15(
    04591                q15_t * pSrc,
    04592               q15_t * pDst,
    04593               uint32_t numSamples);
    04594
    04595
    04596
    04605   void arm_cmplx_mag_squared_f32(
    04606                   float32_t * pSrc,
    04607                  float32_t * pDst,
    04608                  uint32_t numSamples);
    04609
    04618   void arm_cmplx_mag_squared_q31(
    04619                   q31_t * pSrc,
    04620                  q31_t * pDst,
    04621                  uint32_t numSamples);
    04622
    04631   void arm_cmplx_mag_squared_q15(
    04632                   q15_t * pSrc,
    04633                  q15_t * pDst,
    04634                  uint32_t numSamples);
    04635
    04636
    04711   static __INLINE float32_t arm_pid_f32(
    04712                     arm_pid_instance_f32 * S,
    04713                     float32_t in)
    04714   {
    04715     float32_t out;
    04716
    04717     /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]  */
    04718     out = (S->A0 * in) +
    04719       (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
    04720
    04721     /* Update state */
    04722     S->state[1] = S->state[0];
    04723     S->state[0] = in;
    04724     S->state[2] = out;
    04725
    04726     /* return to application */
    04727     return (out);
    04728
    04729   }
    04730
    04746   static __INLINE q31_t arm_pid_q31(
    04747                     arm_pid_instance_q31 * S,
    04748                     q31_t in)
    04749   {
    04750     q63_t acc;
    04751     q31_t out;
    04752
    04753     /* acc = A0 * x[n]  */
    04754     acc = (q63_t) S->A0 * in;
    04755
    04756     /* acc += A1 * x[n-1] */
    04757     acc += (q63_t) S->A1 * S->state[0];
    04758
    04759     /* acc += A2 * x[n-2]  */
    04760     acc += (q63_t) S->A2 * S->state[1];
    04761
    04762     /* convert output to 1.31 format to add y[n-1] */
    04763     out = (q31_t) (acc >> 31u);
    04764
    04765     /* out += y[n-1] */
    04766     out += S->state[2];
    04767
    04768     /* Update state */
    04769     S->state[1] = S->state[0];
    04770     S->state[0] = in;
    04771     S->state[2] = out;
    04772
    04773     /* return to application */
    04774     return (out);
    04775
    04776   }
    04777
    04794   static __INLINE q15_t arm_pid_q15(
    04795                     arm_pid_instance_q15 * S,
    04796                     q15_t in)
    04797   {
    04798     q63_t acc;
    04799     q15_t out;
    04800
    04801     /* Implementation of PID controller */
    04802
    04803     #ifdef ARM_MATH_CM0
    04804
    04805     /* acc = A0 * x[n]  */
    04806     acc = ((q31_t) S->A0 )* in ;
    04807
    04808     #else
    04809
    04810     /* acc = A0 * x[n]  */
    04811     acc = (q31_t) __SMUAD(S->A0, in);
    04812
    04813     #endif
    04814
    04815     #ifdef ARM_MATH_CM0
    04816
    04817     /* acc += A1 * x[n-1] + A2 * x[n-2]  */
    04818     acc += (q31_t) S->A1  *  S->state[0] ;
    04819     acc += (q31_t) S->A2  *  S->state[1] ;
    04820
    04821     #else
    04822
    04823     /* acc += A1 * x[n-1] + A2 * x[n-2]  */
    04824     acc = __SMLALD(S->A1, (q31_t)__SIMD32(S->state), acc);
    04825
    04826     #endif
    04827
    04828     /* acc += y[n-1] */
    04829     acc += (q31_t) S->state[2] << 15;
    04830
    04831     /* saturate the output */
    04832     out = (q15_t) (__SSAT((acc >> 15), 16));
    04833
    04834     /* Update state */
    04835     S->state[1] = S->state[0];
    04836     S->state[0] = in;
    04837     S->state[2] = out;
    04838
    04839     /* return to application */
    04840     return (out);
    04841
    04842   }
    04843
    04857   arm_status arm_mat_inverse_f32(
    04858                  const arm_matrix_instance_f32 * src,
    04859                  arm_matrix_instance_f32 * dst);
    04860
    04861
    04862
    04905   static __INLINE void arm_clarke_f32(
    04906                       float32_t Ia,
    04907                       float32_t Ib,
    04908                       float32_t * pIalpha,
    04909                       float32_t * pIbeta)
    04910   {
    04911     /* Calculate pIalpha using the equation, pIalpha = Ia */
    04912     *pIalpha = Ia;
    04913
    04914     /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
    04915     *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
    04916
    04917   }
    04918
    04934   static __INLINE void arm_clarke_q31(
    04935                       q31_t Ia,
    04936                       q31_t Ib,
    04937                       q31_t * pIalpha,
    04938                       q31_t * pIbeta)
    04939   {
    04940     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
    04941
    04942     /* Calculating pIalpha from Ia by equation pIalpha = Ia */
    04943     *pIalpha = Ia;
    04944
    04945     /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
    04946     product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
    04947
    04948     /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
    04949     product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
    04950
    04951     /* pIbeta is calculated by adding the intermediate products */
    04952     *pIbeta = __QADD(product1, product2);
    04953   }
    04954
    04966   void arm_q7_to_q31(
    04967              q7_t * pSrc,
    04968              q31_t * pDst,
    04969              uint32_t blockSize);
    04970
    04971
    04972
    04973
    05009   static __INLINE void arm_inv_clarke_f32(
    05010                       float32_t Ialpha,
    05011                       float32_t Ibeta,
    05012                       float32_t * pIa,
    05013                       float32_t * pIb)
    05014   {
    05015     /* Calculating pIa from Ialpha by equation pIa = Ialpha */
    05016     *pIa = Ialpha;
    05017
    05018     /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
    05019     *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
    05020
    05021   }
    05022
    05038   static __INLINE void arm_inv_clarke_q31(
    05039                       q31_t Ialpha,
    05040                       q31_t Ibeta,
    05041                       q31_t * pIa,
    05042                       q31_t * pIb)
    05043   {
    05044     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
    05045
    05046     /* Calculating pIa from Ialpha by equation pIa = Ialpha */
    05047     *pIa = Ialpha;
    05048
    05049     /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
    05050     product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
    05051
    05052     /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
    05053     product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
    05054
    05055     /* pIb is calculated by subtracting the products */
    05056     *pIb = __QSUB(product2, product1);
    05057
    05058   }
    05059
    05071   void arm_q7_to_q15(
    05072               q7_t * pSrc,
    05073              q15_t * pDst,
    05074              uint32_t blockSize);
    05075
    05076
    05077
    05125   static __INLINE void arm_park_f32(
    05126                     float32_t Ialpha,
    05127                     float32_t Ibeta,
    05128                     float32_t * pId,
    05129                     float32_t * pIq,
    05130                     float32_t sinVal,
    05131                     float32_t cosVal)
    05132   {
    05133     /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
    05134     *pId = Ialpha * cosVal + Ibeta * sinVal;
    05135
    05136     /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
    05137     *pIq = -Ialpha * sinVal + Ibeta * cosVal;
    05138
    05139   }
    05140
    05159   static __INLINE void arm_park_q31(
    05160                     q31_t Ialpha,
    05161                     q31_t Ibeta,
    05162                     q31_t * pId,
    05163                     q31_t * pIq,
    05164                     q31_t sinVal,
    05165                     q31_t cosVal)
    05166   {
    05167     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
    05168     q31_t product3, product4;                    /* Temporary variables used to store intermediate results */
    05169
    05170     /* Intermediate product is calculated by (Ialpha * cosVal) */
    05171     product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
    05172
    05173     /* Intermediate product is calculated by (Ibeta * sinVal) */
    05174     product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
    05175
    05176
    05177     /* Intermediate product is calculated by (Ialpha * sinVal) */
    05178     product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
    05179
    05180     /* Intermediate product is calculated by (Ibeta * cosVal) */
    05181     product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
    05182
    05183     /* Calculate pId by adding the two intermediate products 1 and 2 */
    05184     *pId = __QADD(product1, product2);
    05185
    05186     /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
    05187     *pIq = __QSUB(product4, product3);
    05188   }
    05189
    05201   void arm_q7_to_float(
    05202                 q7_t * pSrc,
    05203                float32_t * pDst,
    05204                uint32_t blockSize);
    05205
    05206
    05244   static __INLINE void arm_inv_park_f32(
    05245                     float32_t Id,
    05246                     float32_t Iq,
    05247                     float32_t * pIalpha,
    05248                     float32_t * pIbeta,
    05249                     float32_t sinVal,
    05250                     float32_t cosVal)
    05251   {
    05252     /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
    05253     *pIalpha = Id * cosVal - Iq * sinVal;
    05254
    05255     /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
    05256     *pIbeta = Id * sinVal + Iq * cosVal;
    05257
    05258   }
    05259
    05260
    05279   static __INLINE void arm_inv_park_q31(
    05280                     q31_t Id,
    05281                     q31_t Iq,
    05282                     q31_t * pIalpha,
    05283                     q31_t * pIbeta,
    05284                     q31_t sinVal,
    05285                     q31_t cosVal)
    05286   {
    05287     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
    05288     q31_t product3, product4;                    /* Temporary variables used to store intermediate results */
    05289
    05290     /* Intermediate product is calculated by (Id * cosVal) */
    05291     product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
    05292
    05293     /* Intermediate product is calculated by (Iq * sinVal) */
    05294     product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
    05295
    05296
    05297     /* Intermediate product is calculated by (Id * sinVal) */
    05298     product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
    05299
    05300     /* Intermediate product is calculated by (Iq * cosVal) */
    05301     product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
    05302
    05303     /* Calculate pIalpha by using the two intermediate products 1 and 2 */
    05304     *pIalpha = __QSUB(product1, product2);
    05305
    05306     /* Calculate pIbeta by using the two intermediate products 3 and 4 */
    05307     *pIbeta = __QADD(product4, product3);
    05308
    05309   }
    05310
    05323   void arm_q31_to_float(
    05324              q31_t * pSrc,
    05325             float32_t * pDst,
    05326             uint32_t blockSize);
    05327
    05377   static __INLINE float32_t arm_linear_interp_f32(
    05378                           arm_linear_interp_instance_f32 * S,
    05379                           float32_t x)
    05380   {
    05381
    05382       float32_t y;
    05383       float32_t x0, x1;                     /* Nearest input values */
    05384       float32_t y0, y1;                     /* Nearest output values */
    05385       float32_t xSpacing = S->xSpacing;     /* spacing between input values */
    05386       int32_t i;                            /* Index variable */
    05387       float32_t *pYData = S->pYData;        /* pointer to output table */
    05388
    05389       /* Calculation of index */
    05390       i =   (x - S->x1) / xSpacing;
    05391
    05392       if(i < 0)
    05393       {
    05394          /* Iniatilize output for below specified range as least output value of table */
    05395          y = pYData[0];
    05396       }
    05397       else if(i >= S->nValues)
    05398       {
    05399           /* Iniatilize output for above specified range as last output value of table */
    05400           y = pYData[S->nValues-1];
    05401       }
    05402       else
    05403       {
    05404           /* Calculation of nearest input values */
    05405           x0 = S->x1 + i * xSpacing;
    05406           x1 = S->x1 + (i +1) * xSpacing;
    05407
    05408          /* Read of nearest output values */
    05409           y0 = pYData[i];
    05410           y1 = pYData[i + 1];
    05411
    05412           /* Calculation of output */
    05413           y = y0 + (x - x0) * ((y1 - y0)/(x1-x0));
    05414
    05415       }
    05416
    05417       /* returns output value */
    05418       return (y);
    05419   }
    05420
    05436   static __INLINE q31_t arm_linear_interp_q31(q31_t *pYData,
    05437                           q31_t x, uint32_t nValues)
    05438   {
    05439     q31_t y;                                   /* output */
    05440     q31_t y0, y1;                                /* Nearest output values */
    05441     q31_t fract;                                 /* fractional part */
    05442     int32_t index;                              /* Index to read nearest output values */
    05443
    05444     /* Input is in 12.20 format */
    05445     /* 12 bits for the table index */
    05446     /* Index value calculation */
    05447     index = ((x & 0xFFF00000) >> 20);
    05448
    05449     if(index >= (nValues - 1))
    05450     {
    05451         return(pYData[nValues - 1]);
    05452     }
    05453     else if(index < 0)
    05454     {
    05455         return(pYData[0]);
    05456     }
    05457     else
    05458     {
    05459
    05460         /* 20 bits for the fractional part */
    05461         /* shift left by 11 to keep fract in 1.31 format */
    05462         fract = (x & 0x000FFFFF) << 11;
    05463
    05464         /* Read two nearest output values from the index in 1.31(q31) format */
    05465         y0 = pYData[index];
    05466         y1 = pYData[index + 1u];
    05467
    05468         /* Calculation of y0 * (1-fract) and y is in 2.30 format */
    05469         y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
    05470
    05471         /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
    05472         y += ((q31_t) (((q63_t) y1 * fract) >> 32));
    05473
    05474         /* Convert y to 1.31 format */
    05475         return (y << 1u);
    05476
    05477     }
    05478
    05479   }
    05480
    05496   static __INLINE q15_t arm_linear_interp_q15(q15_t *pYData, q31_t x, uint32_t nValues)
    05497   {
    05498     q63_t y;                                   /* output */
    05499     q15_t y0, y1;                              /* Nearest output values */
    05500     q31_t fract;                               /* fractional part */
    05501     int32_t index;                            /* Index to read nearest output values */
    05502
    05503     /* Input is in 12.20 format */
    05504     /* 12 bits for the table index */
    05505     /* Index value calculation */
    05506     index = ((x & 0xFFF00000) >> 20u);
    05507
    05508     if(index >= (nValues - 1))
    05509     {
    05510         return(pYData[nValues - 1]);
    05511     }
    05512     else if(index < 0)
    05513     {
    05514         return(pYData[0]);
    05515     }
    05516     else
    05517     {
    05518         /* 20 bits for the fractional part */
    05519         /* fract is in 12.20 format */
    05520         fract = (x & 0x000FFFFF);
    05521
    05522         /* Read two nearest output values from the index */
    05523         y0 = pYData[index];
    05524         y1 = pYData[index + 1u];
    05525
    05526         /* Calculation of y0 * (1-fract) and y is in 13.35 format */
    05527         y = ((q63_t) y0 * (0xFFFFF - fract));
    05528
    05529         /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
    05530         y += ((q63_t) y1 * (fract));
    05531
    05532         /* convert y to 1.15 format */
    05533         return (y >> 20);
    05534     }
    05535
    05536
    05537   }
    05538
    05553   static __INLINE q7_t arm_linear_interp_q7(q7_t *pYData, q31_t x,  uint32_t nValues)
    05554   {
    05555     q31_t y;                                   /* output */
    05556     q7_t y0, y1;                                 /* Nearest output values */
    05557     q31_t fract;                                 /* fractional part */
    05558     int32_t index;                              /* Index to read nearest output values */
    05559
    05560     /* Input is in 12.20 format */
    05561     /* 12 bits for the table index */
    05562     /* Index value calculation */
    05563     index = ((x & 0xFFF00000) >> 20u);
    05564
    05565
    05566     if(index >= (nValues - 1))
    05567     {
    05568         return(pYData[nValues - 1]);
    05569     }
    05570     else if(index < 0)
    05571     {
    05572         return(pYData[0]);
    05573     }
    05574     else
    05575     {
    05576
    05577         /* 20 bits for the fractional part */
    05578         /* fract is in 12.20 format */
    05579         fract = (x & 0x000FFFFF);
    05580
    05581         /* Read two nearest output values from the index and are in 1.7(q7) format */
    05582         y0 = pYData[index];
    05583         y1 = pYData[index + 1u];
    05584
    05585         /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
    05586         y = ((y0 * (0xFFFFF - fract)));
    05587
    05588         /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
    05589         y += (y1 * fract);
    05590
    05591         /* convert y to 1.7(q7) format */
    05592         return (y >> 20u);
    05593
    05594     }
    05595
    05596   }
    05607   float32_t arm_sin_f32(
    05608              float32_t x);
    05609
    05616   q31_t arm_sin_q31(
    05617              q31_t x);
    05618
    05625   q15_t arm_sin_q15(
    05626              q15_t x);
    05627
    05634   float32_t arm_cos_f32(
    05635              float32_t x);
    05636
    05643   q31_t arm_cos_q31(
    05644              q31_t x);
    05645
    05652   q15_t arm_cos_q15(
    05653              q15_t x);
    05654
    05655
    05695   static __INLINE arm_status  arm_sqrt_f32(
    05696                       float32_t in, float32_t *pOut)
    05697   {
    05698     if(in > 0)
    05699     {
    05700
    05701     #if __FPU_USED
    05702         *pOut = __sqrtf(in);
    05703     #else
    05704         *pOut = sqrtf(in);
    05705     #endif
    05706
    05707         return (ARM_MATH_SUCCESS);
    05708     }
    05709     else
    05710     {
    05711         *pOut = 0.0f;
    05712         return (ARM_MATH_ARGUMENT_ERROR);
    05713     }
    05714
    05715   }
    05716
    05717
    05725   arm_status arm_sqrt_q31(
    05726               q31_t in, q31_t *pOut);
    05727
    05735   arm_status arm_sqrt_q15(
    05736               q15_t in, q15_t *pOut);
    05737
    05751   static __INLINE void arm_circularWrite_f32(
    05752                          int32_t * circBuffer,
    05753                          int32_t L,
    05754                          uint16_t * writeOffset,
    05755                          int32_t bufferInc,
    05756                          const int32_t * src,
    05757                          int32_t srcInc,
    05758                          uint32_t blockSize)
    05759   {
    05760     uint32_t i = 0u;
    05761     int32_t wOffset;
    05762
    05763     /* Copy the value of Index pointer that points
    05764      * to the current location where the input samples to be copied */
    05765     wOffset = *writeOffset;
    05766
    05767     /* Loop over the blockSize */
    05768     i = blockSize;
    05769
    05770     while(i > 0u)
    05771       {
    05772     /* copy the input sample to the circular buffer */
    05773     circBuffer[wOffset] = *src;
    05774
    05775     /* Update the input pointer */
    05776     src += srcInc;
    05777
    05778     /* Circularly update wOffset.  Watch out for positive and negative value */
    05779     wOffset += bufferInc;
    05780     if(wOffset >= L)
    05781       wOffset -= L;
    05782
    05783     /* Decrement the loop counter */
    05784     i--;
    05785       }
    05786
    05787     /* Update the index pointer */
    05788     *writeOffset = wOffset;
    05789   }
    05790
    05791
    05792
    05796   static __INLINE void arm_circularRead_f32(
    05797                         int32_t * circBuffer,
    05798                         int32_t L,
    05799                         int32_t * readOffset,
    05800                         int32_t bufferInc,
    05801                         int32_t * dst,
    05802                         int32_t * dst_base,
    05803                         int32_t dst_length,
    05804                         int32_t dstInc,
    05805                         uint32_t blockSize)
    05806   {
    05807     uint32_t i = 0u;
    05808     int32_t rOffset, dst_end;
    05809
    05810     /* Copy the value of Index pointer that points
    05811      * to the current location from where the input samples to be read */
    05812     rOffset = *readOffset;
    05813     dst_end = (int32_t) (dst_base + dst_length);
    05814
    05815     /* Loop over the blockSize */
    05816     i = blockSize;
    05817
    05818     while(i > 0u)
    05819       {
    05820     /* copy the sample from the circular buffer to the destination buffer */
    05821     *dst = circBuffer[rOffset];
    05822
    05823     /* Update the input pointer */
    05824     dst += dstInc;
    05825
    05826     if(dst == (int32_t *) dst_end)
    05827       {
    05828         dst = dst_base;
    05829       }
    05830
    05831     /* Circularly update rOffset.  Watch out for positive and negative value  */
    05832     rOffset += bufferInc;
    05833
    05834     if(rOffset >= L)
    05835       {
    05836         rOffset -= L;
    05837       }
    05838
    05839     /* Decrement the loop counter */
    05840     i--;
    05841       }
    05842
    05843     /* Update the index pointer */
    05844     *readOffset = rOffset;
    05845   }
    05846
    05851   static __INLINE void arm_circularWrite_q15(
    05852                          q15_t * circBuffer,
    05853                          int32_t L,
    05854                          uint16_t * writeOffset,
    05855                          int32_t bufferInc,
    05856                          const q15_t * src,
    05857                          int32_t srcInc,
    05858                          uint32_t blockSize)
    05859   {
    05860     uint32_t i = 0u;
    05861     int32_t wOffset;
    05862
    05863     /* Copy the value of Index pointer that points
    05864      * to the current location where the input samples to be copied */
    05865     wOffset = *writeOffset;
    05866
    05867     /* Loop over the blockSize */
    05868     i = blockSize;
    05869
    05870     while(i > 0u)
    05871       {
    05872     /* copy the input sample to the circular buffer */
    05873     circBuffer[wOffset] = *src;
    05874
    05875     /* Update the input pointer */
    05876     src += srcInc;
    05877
    05878     /* Circularly update wOffset.  Watch out for positive and negative value */
    05879     wOffset += bufferInc;
    05880     if(wOffset >= L)
    05881       wOffset -= L;
    05882
    05883     /* Decrement the loop counter */
    05884     i--;
    05885       }
    05886
    05887     /* Update the index pointer */
    05888     *writeOffset = wOffset;
    05889   }
    05890
    05891
    05892
    05896   static __INLINE void arm_circularRead_q15(
    05897                         q15_t * circBuffer,
    05898                         int32_t L,
    05899                         int32_t * readOffset,
    05900                         int32_t bufferInc,
    05901                         q15_t * dst,
    05902                         q15_t * dst_base,
    05903                         int32_t dst_length,
    05904                         int32_t dstInc,
    05905                         uint32_t blockSize)
    05906   {
    05907     uint32_t i = 0;
    05908     int32_t rOffset, dst_end;
    05909
    05910     /* Copy the value of Index pointer that points
    05911      * to the current location from where the input samples to be read */
    05912     rOffset = *readOffset;
    05913
    05914     dst_end = (int32_t) (dst_base + dst_length);
    05915
    05916     /* Loop over the blockSize */
    05917     i = blockSize;
    05918
    05919     while(i > 0u)
    05920       {
    05921     /* copy the sample from the circular buffer to the destination buffer */
    05922     *dst = circBuffer[rOffset];
    05923
    05924     /* Update the input pointer */
    05925     dst += dstInc;
    05926
    05927     if(dst == (q15_t *) dst_end)
    05928       {
    05929         dst = dst_base;
    05930       }
    05931
    05932     /* Circularly update wOffset.  Watch out for positive and negative value */
    05933     rOffset += bufferInc;
    05934
    05935     if(rOffset >= L)
    05936       {
    05937         rOffset -= L;
    05938       }
    05939
    05940     /* Decrement the loop counter */
    05941     i--;
    05942       }
    05943
    05944     /* Update the index pointer */
    05945     *readOffset = rOffset;
    05946   }
    05947
    05948
    05953   static __INLINE void arm_circularWrite_q7(
    05954                         q7_t * circBuffer,
    05955                         int32_t L,
    05956                         uint16_t * writeOffset,
    05957                         int32_t bufferInc,
    05958                         const q7_t * src,
    05959                         int32_t srcInc,
    05960                         uint32_t blockSize)
    05961   {
    05962     uint32_t i = 0u;
    05963     int32_t wOffset;
    05964
    05965     /* Copy the value of Index pointer that points
    05966      * to the current location where the input samples to be copied */
    05967     wOffset = *writeOffset;
    05968
    05969     /* Loop over the blockSize */
    05970     i = blockSize;
    05971
    05972     while(i > 0u)
    05973       {
    05974     /* copy the input sample to the circular buffer */
    05975     circBuffer[wOffset] = *src;
    05976
    05977     /* Update the input pointer */
    05978     src += srcInc;
    05979
    05980     /* Circularly update wOffset.  Watch out for positive and negative value */
    05981     wOffset += bufferInc;
    05982     if(wOffset >= L)
    05983       wOffset -= L;
    05984
    05985     /* Decrement the loop counter */
    05986     i--;
    05987       }
    05988
    05989     /* Update the index pointer */
    05990     *writeOffset = wOffset;
    05991   }
    05992
    05993
    05994
    05998   static __INLINE void arm_circularRead_q7(
    05999                        q7_t * circBuffer,
    06000                        int32_t L,
    06001                        int32_t * readOffset,
    06002                        int32_t bufferInc,
    06003                        q7_t * dst,
    06004                        q7_t * dst_base,
    06005                        int32_t dst_length,
    06006                        int32_t dstInc,
    06007                        uint32_t blockSize)
    06008   {
    06009     uint32_t i = 0;
    06010     int32_t rOffset, dst_end;
    06011
    06012     /* Copy the value of Index pointer that points
    06013      * to the current location from where the input samples to be read */
    06014     rOffset = *readOffset;
    06015
    06016     dst_end = (int32_t) (dst_base + dst_length);
    06017
    06018     /* Loop over the blockSize */
    06019     i = blockSize;
    06020
    06021     while(i > 0u)
    06022       {
    06023     /* copy the sample from the circular buffer to the destination buffer */
    06024     *dst = circBuffer[rOffset];
    06025
    06026     /* Update the input pointer */
    06027     dst += dstInc;
    06028
    06029     if(dst == (q7_t *) dst_end)
    06030       {
    06031         dst = dst_base;
    06032       }
    06033
    06034     /* Circularly update rOffset.  Watch out for positive and negative value */
    06035     rOffset += bufferInc;
    06036
    06037     if(rOffset >= L)
    06038       {
    06039         rOffset -= L;
    06040       }
    06041
    06042     /* Decrement the loop counter */
    06043     i--;
    06044       }
    06045
    06046     /* Update the index pointer */
    06047     *readOffset = rOffset;
    06048   }
    06049
    06050
    06059   void arm_power_q31(
    06060               q31_t * pSrc,
    06061              uint32_t blockSize,
    06062              q63_t * pResult);
    06063
    06072   void arm_power_f32(
    06073               float32_t * pSrc,
    06074              uint32_t blockSize,
    06075              float32_t * pResult);
    06076
    06085   void arm_power_q15(
    06086               q15_t * pSrc,
    06087              uint32_t blockSize,
    06088              q63_t * pResult);
    06089
    06098   void arm_power_q7(
    06099              q7_t * pSrc,
    06100             uint32_t blockSize,
    06101             q31_t * pResult);
    06102
    06111   void arm_mean_q7(
    06112             q7_t * pSrc,
    06113            uint32_t blockSize,
    06114            q7_t * pResult);
    06115
    06123   void arm_mean_q15(
    06124              q15_t * pSrc,
    06125             uint32_t blockSize,
    06126             q15_t * pResult);
    06127
    06135   void arm_mean_q31(
    06136              q31_t * pSrc,
    06137             uint32_t blockSize,
    06138             q31_t * pResult);
    06139
    06147   void arm_mean_f32(
    06148              float32_t * pSrc,
    06149             uint32_t blockSize,
    06150             float32_t * pResult);
    06151
    06160   void arm_var_f32(
    06161             float32_t * pSrc,
    06162            uint32_t blockSize,
    06163            float32_t * pResult);
    06164
    06173   void arm_var_q31(
    06174             q31_t * pSrc,
    06175            uint32_t blockSize,
    06176            q63_t * pResult);
    06177
    06186   void arm_var_q15(
    06187             q15_t * pSrc,
    06188            uint32_t blockSize,
    06189            q31_t * pResult);
    06190
    06199   void arm_rms_f32(
    06200             float32_t * pSrc,
    06201            uint32_t blockSize,
    06202            float32_t * pResult);
    06203
    06212   void arm_rms_q31(
    06213             q31_t * pSrc,
    06214            uint32_t blockSize,
    06215            q31_t * pResult);
    06216
    06225   void arm_rms_q15(
    06226             q15_t * pSrc,
    06227            uint32_t blockSize,
    06228            q15_t * pResult);
    06229
    06238   void arm_std_f32(
    06239             float32_t * pSrc,
    06240            uint32_t blockSize,
    06241            float32_t * pResult);
    06242
    06251   void arm_std_q31(
    06252             q31_t * pSrc,
    06253            uint32_t blockSize,
    06254            q31_t * pResult);
    06255
    06264   void arm_std_q15(
    06265             q15_t * pSrc,
    06266            uint32_t blockSize,
    06267            q15_t * pResult);
    06268
    06277   void arm_cmplx_mag_f32(
    06278               float32_t * pSrc,
    06279              float32_t * pDst,
    06280              uint32_t numSamples);
    06281
    06290   void arm_cmplx_mag_q31(
    06291               q31_t * pSrc,
    06292              q31_t * pDst,
    06293              uint32_t numSamples);
    06294
    06303   void arm_cmplx_mag_q15(
    06304               q15_t * pSrc,
    06305              q15_t * pDst,
    06306              uint32_t numSamples);
    06307
    06318   void arm_cmplx_dot_prod_q15(
    06319                    q15_t * pSrcA,
    06320                    q15_t * pSrcB,
    06321                   uint32_t numSamples,
    06322                   q31_t * realResult,
    06323                   q31_t * imagResult);
    06324
    06335   void arm_cmplx_dot_prod_q31(
    06336                    q31_t * pSrcA,
    06337                    q31_t * pSrcB,
    06338                   uint32_t numSamples,
    06339                   q63_t * realResult,
    06340                   q63_t * imagResult);
    06341
    06352   void arm_cmplx_dot_prod_f32(
    06353                    float32_t * pSrcA,
    06354                    float32_t * pSrcB,
    06355                   uint32_t numSamples,
    06356                   float32_t * realResult,
    06357                   float32_t * imagResult);
    06358
    06368   void arm_cmplx_mult_real_q15(
    06369                     q15_t * pSrcCmplx,
    06370                     q15_t * pSrcReal,
    06371                    q15_t * pCmplxDst,
    06372                    uint32_t numSamples);
    06373
    06383   void arm_cmplx_mult_real_q31(
    06384                     q31_t * pSrcCmplx,
    06385                     q31_t * pSrcReal,
    06386                    q31_t * pCmplxDst,
    06387                    uint32_t numSamples);
    06388
    06398   void arm_cmplx_mult_real_f32(
    06399                     float32_t * pSrcCmplx,
    06400                     float32_t * pSrcReal,
    06401                    float32_t * pCmplxDst,
    06402                    uint32_t numSamples);
    06403
    06413   void arm_min_q7(
    06414            q7_t * pSrc,
    06415           uint32_t blockSize,
    06416           q7_t * result,
    06417           uint32_t * index);
    06418
    06428   void arm_min_q15(
    06429             q15_t * pSrc,
    06430            uint32_t blockSize,
    06431            q15_t * pResult,
    06432            uint32_t * pIndex);
    06433
    06442   void arm_min_q31(
    06443             q31_t * pSrc,
    06444            uint32_t blockSize,
    06445            q31_t * pResult,
    06446            uint32_t * pIndex);
    06447
    06457   void arm_min_f32(
    06458             float32_t * pSrc,
    06459            uint32_t blockSize,
    06460            float32_t * pResult,
    06461            uint32_t * pIndex);
    06462
    06472   void arm_max_q7(
    06473            q7_t * pSrc,
    06474           uint32_t blockSize,
    06475           q7_t * pResult,
    06476           uint32_t * pIndex);
    06477
    06487   void arm_max_q15(
    06488             q15_t * pSrc,
    06489            uint32_t blockSize,
    06490            q15_t * pResult,
    06491            uint32_t * pIndex);
    06492
    06502   void arm_max_q31(
    06503             q31_t * pSrc,
    06504            uint32_t blockSize,
    06505            q31_t * pResult,
    06506            uint32_t * pIndex);
    06507
    06517   void arm_max_f32(
    06518             float32_t * pSrc,
    06519            uint32_t blockSize,
    06520            float32_t * pResult,
    06521            uint32_t * pIndex);
    06522
    06532   void arm_cmplx_mult_cmplx_q15(
    06533                     q15_t * pSrcA,
    06534                     q15_t * pSrcB,
    06535                    q15_t * pDst,
    06536                    uint32_t numSamples);
    06537
    06547   void arm_cmplx_mult_cmplx_q31(
    06548                     q31_t * pSrcA,
    06549                     q31_t * pSrcB,
    06550                    q31_t * pDst,
    06551                    uint32_t numSamples);
    06552
    06562   void arm_cmplx_mult_cmplx_f32(
    06563                     float32_t * pSrcA,
    06564                     float32_t * pSrcB,
    06565                    float32_t * pDst,
    06566                    uint32_t numSamples);
    06567
    06575   void arm_float_to_q31(
    06576                    float32_t * pSrc,
    06577                   q31_t * pDst,
    06578                   uint32_t blockSize);
    06579
    06587   void arm_float_to_q15(
    06588                    float32_t * pSrc,
    06589                   q15_t * pDst,
    06590                   uint32_t blockSize);
    06591
    06599   void arm_float_to_q7(
    06600                   float32_t * pSrc,
    06601                  q7_t * pDst,
    06602                  uint32_t blockSize);
    06603
    06604
    06612   void arm_q31_to_q15(
    06613                q31_t * pSrc,
    06614               q15_t * pDst,
    06615               uint32_t blockSize);
    06616
    06624   void arm_q31_to_q7(
    06625               q31_t * pSrc,
    06626              q7_t * pDst,
    06627              uint32_t blockSize);
    06628
    06636   void arm_q15_to_float(
    06637              q15_t * pSrc,
    06638             float32_t * pDst,
    06639             uint32_t blockSize);
    06640
    06641
    06649   void arm_q15_to_q31(
    06650                q15_t * pSrc,
    06651               q31_t * pDst,
    06652               uint32_t blockSize);
    06653
    06654
    06662   void arm_q15_to_q7(
    06663               q15_t * pSrc,
    06664              q7_t * pDst,
    06665              uint32_t blockSize);
    06666
    06667
    06739   static __INLINE float32_t arm_bilinear_interp_f32(
    06740                             const arm_bilinear_interp_instance_f32 * S,
    06741                             float32_t X,
    06742                             float32_t Y)
    06743   {
    06744     float32_t out;
    06745     float32_t f00, f01, f10, f11;
    06746     float32_t *pData = S->pData;
    06747     int32_t xIndex, yIndex, index;
    06748     float32_t xdiff, ydiff;
    06749     float32_t b1, b2, b3, b4;
    06750
    06751     xIndex = (int32_t) X;
    06752     yIndex = (int32_t) Y;
    06753
    06754     /* Care taken for table outside boundary */
    06755     /* Returns zero output when values are outside table boundary */
    06756     if(xIndex < 0 || xIndex > (S->numRows-1) || yIndex < 0  || yIndex > ( S->numCols-1))
    06757     {
    06758         return(0);
    06759     }
    06760
    06761     /* Calculation of index for two nearest points in X-direction */
    06762     index = (xIndex - 1) + (yIndex-1) *  S->numCols ;
    06763
    06764
    06765     /* Read two nearest points in X-direction */
    06766     f00 = pData[index];
    06767     f01 = pData[index + 1];
    06768
    06769     /* Calculation of index for two nearest points in Y-direction */
    06770     index = (xIndex-1) + (yIndex) * S->numCols;
    06771
    06772
    06773     /* Read two nearest points in Y-direction */
    06774     f10 = pData[index];
    06775     f11 = pData[index + 1];
    06776
    06777     /* Calculation of intermediate values */
    06778     b1 = f00;
    06779     b2 = f01 - f00;
    06780     b3 = f10 - f00;
    06781     b4 = f00 - f01 - f10 + f11;
    06782
    06783     /* Calculation of fractional part in X */
    06784     xdiff = X - xIndex;
    06785
    06786     /* Calculation of fractional part in Y */
    06787     ydiff = Y - yIndex;
    06788
    06789     /* Calculation of bi-linear interpolated output */
    06790      out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
    06791
    06792    /* return to application */
    06793     return (out);
    06794
    06795   }
    06796
    06806   static __INLINE q31_t arm_bilinear_interp_q31(
    06807                         arm_bilinear_interp_instance_q31 * S,
    06808                         q31_t X,
    06809                         q31_t Y)
    06810   {
    06811     q31_t out;                                   /* Temporary output */
    06812     q31_t acc = 0;                               /* output */
    06813     q31_t xfract, yfract;                        /* X, Y fractional parts */
    06814     q31_t x1, x2, y1, y2;                        /* Nearest output values */
    06815     int32_t rI, cI;                             /* Row and column indices */
    06816     q31_t *pYData = S->pData;                    /* pointer to output table values */
    06817     uint32_t nCols = S->numCols;                 /* num of rows */
    06818
    06819
    06820     /* Input is in 12.20 format */
    06821     /* 12 bits for the table index */
    06822     /* Index value calculation */
    06823     rI = ((X & 0xFFF00000) >> 20u);
    06824
    06825     /* Input is in 12.20 format */
    06826     /* 12 bits for the table index */
    06827     /* Index value calculation */
    06828     cI = ((Y & 0xFFF00000) >> 20u);
    06829
    06830     /* Care taken for table outside boundary */
    06831     /* Returns zero output when values are outside table boundary */
    06832     if(rI < 0 || rI > (S->numRows-1) || cI < 0  || cI > ( S->numCols-1))
    06833     {
    06834         return(0);
    06835     }
    06836
    06837     /* 20 bits for the fractional part */
    06838     /* shift left xfract by 11 to keep 1.31 format */
    06839     xfract = (X & 0x000FFFFF) << 11u;
    06840
    06841     /* Read two nearest output values from the index */
    06842     x1 = pYData[(rI) + nCols * (cI)];
    06843     x2 = pYData[(rI) + nCols * (cI) + 1u];
    06844
    06845     /* 20 bits for the fractional part */
    06846     /* shift left yfract by 11 to keep 1.31 format */
    06847     yfract = (Y & 0x000FFFFF) << 11u;
    06848
    06849     /* Read two nearest output values from the index */
    06850     y1 = pYData[(rI) + nCols * (cI + 1)];
    06851     y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
    06852
    06853     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
    06854     out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
    06855     acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
    06856
    06857     /* x2 * (xfract) * (1-yfract)  in 3.29(q29) and adding to acc */
    06858     out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
    06859     acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
    06860
    06861     /* y1 * (1 - xfract) * (yfract)  in 3.29(q29) and adding to acc */
    06862     out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
    06863     acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
    06864
    06865     /* y2 * (xfract) * (yfract)  in 3.29(q29) and adding to acc */
    06866     out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
    06867     acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
    06868
    06869     /* Convert acc to 1.31(q31) format */
    06870     return (acc << 2u);
    06871
    06872   }
    06873
    06882   static __INLINE q15_t arm_bilinear_interp_q15(
    06883                         arm_bilinear_interp_instance_q15 * S,
    06884                         q31_t X,
    06885                         q31_t Y)
    06886   {
    06887     q63_t acc = 0;                               /* output */
    06888     q31_t out;                                   /* Temporary output */
    06889     q15_t x1, x2, y1, y2;                        /* Nearest output values */
    06890     q31_t xfract, yfract;                        /* X, Y fractional parts */
    06891     int32_t rI, cI;                             /* Row and column indices */
    06892     q15_t *pYData = S->pData;                    /* pointer to output table values */
    06893     uint32_t nCols = S->numCols;                 /* num of rows */
    06894
    06895     /* Input is in 12.20 format */
    06896     /* 12 bits for the table index */
    06897     /* Index value calculation */
    06898     rI = ((X & 0xFFF00000) >> 20);
    06899
    06900     /* Input is in 12.20 format */
    06901     /* 12 bits for the table index */
    06902     /* Index value calculation */
    06903     cI = ((Y & 0xFFF00000) >> 20);
    06904
    06905     /* Care taken for table outside boundary */
    06906     /* Returns zero output when values are outside table boundary */
    06907     if(rI < 0 || rI > (S->numRows-1) || cI < 0  || cI > ( S->numCols-1))
    06908     {
    06909         return(0);
    06910     }
    06911
    06912     /* 20 bits for the fractional part */
    06913     /* xfract should be in 12.20 format */
    06914     xfract = (X & 0x000FFFFF);
    06915
    06916     /* Read two nearest output values from the index */
    06917     x1 = pYData[(rI) + nCols * (cI)];
    06918     x2 = pYData[(rI) + nCols * (cI) + 1u];
    06919
    06920
    06921     /* 20 bits for the fractional part */
    06922     /* yfract should be in 12.20 format */
    06923     yfract = (Y & 0x000FFFFF);
    06924
    06925     /* Read two nearest output values from the index */
    06926     y1 = pYData[(rI) + nCols * (cI + 1)];
    06927     y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
    06928
    06929     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
    06930
    06931     /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
    06932     /* convert 13.35 to 13.31 by right shifting  and out is in 1.31 */
    06933     out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
    06934     acc = ((q63_t) out * (0xFFFFF - yfract));
    06935
    06936     /* x2 * (xfract) * (1-yfract)  in 1.51 and adding to acc */
    06937     out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
    06938     acc += ((q63_t) out * (xfract));
    06939
    06940     /* y1 * (1 - xfract) * (yfract)  in 1.51 and adding to acc */
    06941     out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
    06942     acc += ((q63_t) out * (yfract));
    06943
    06944     /* y2 * (xfract) * (yfract)  in 1.51 and adding to acc */
    06945     out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
    06946     acc += ((q63_t) out * (yfract));
    06947
    06948     /* acc is in 13.51 format and down shift acc by 36 times */
    06949     /* Convert out to 1.15 format */
    06950     return (acc >> 36);
    06951
    06952   }
    06953
    06962   static __INLINE q7_t arm_bilinear_interp_q7(
    06963                           arm_bilinear_interp_instance_q7 * S,
    06964                           q31_t X,
    06965                           q31_t Y)
    06966   {
    06967     q63_t acc = 0;                               /* output */
    06968     q31_t out;                                   /* Temporary output */
    06969     q31_t xfract, yfract;                        /* X, Y fractional parts */
    06970     q7_t x1, x2, y1, y2;                         /* Nearest output values */
    06971     int32_t rI, cI;                             /* Row and column indices */
    06972     q7_t *pYData = S->pData;                     /* pointer to output table values */
    06973     uint32_t nCols = S->numCols;                 /* num of rows */
    06974
    06975     /* Input is in 12.20 format */
    06976     /* 12 bits for the table index */
    06977     /* Index value calculation */
    06978     rI = ((X & 0xFFF00000) >> 20);
    06979
    06980     /* Input is in 12.20 format */
    06981     /* 12 bits for the table index */
    06982     /* Index value calculation */
    06983     cI = ((Y & 0xFFF00000) >> 20);
    06984
    06985     /* Care taken for table outside boundary */
    06986     /* Returns zero output when values are outside table boundary */
    06987     if(rI < 0 || rI > (S->numRows-1) || cI < 0  || cI > ( S->numCols-1))
    06988     {
    06989         return(0);
    06990     }
    06991
    06992     /* 20 bits for the fractional part */
    06993     /* xfract should be in 12.20 format */
    06994     xfract = (X & 0x000FFFFF);
    06995
    06996     /* Read two nearest output values from the index */
    06997     x1 = pYData[(rI) + nCols * (cI)];
    06998     x2 = pYData[(rI) + nCols * (cI) + 1u];
    06999
    07000
    07001     /* 20 bits for the fractional part */
    07002     /* yfract should be in 12.20 format */
    07003     yfract = (Y & 0x000FFFFF);
    07004
    07005     /* Read two nearest output values from the index */
    07006     y1 = pYData[(rI) + nCols * (cI + 1)];
    07007     y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
    07008
    07009     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
    07010     out = ((x1 * (0xFFFFF - xfract)));
    07011     acc = (((q63_t) out * (0xFFFFF - yfract)));
    07012
    07013     /* x2 * (xfract) * (1-yfract)  in 2.22 and adding to acc */
    07014     out = ((x2 * (0xFFFFF - yfract)));
    07015     acc += (((q63_t) out * (xfract)));
    07016
    07017     /* y1 * (1 - xfract) * (yfract)  in 2.22 and adding to acc */
    07018     out = ((y1 * (0xFFFFF - xfract)));
    07019     acc += (((q63_t) out * (yfract)));
    07020
    07021     /* y2 * (xfract) * (yfract)  in 2.22 and adding to acc */
    07022     out = ((y2 * (yfract)));
    07023     acc += (((q63_t) out * (xfract)));
    07024
    07025     /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
    07026     return (acc >> 40);
    07027
    07028   }
    07029
    07039 #ifdef  __cplusplus
    07040 }
    07041 #endif
    07042
    07043
    07044 #endif /* _ARM_MATH_H */
    07045
    07046

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines