- 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:        11. November 2010
    00005  * $Revision:    V1.0.2
    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
    00013  *
    00014  * Version 1.0.3 2010/11/29
    00015  *    Re-organized the CMSIS folders and updated documentation.
    00016  *
    00017  * Version 1.0.2 2010/11/11
    00018  *    Documentation updated.
    00019  *
    00020  * Version 1.0.1 2010/10/05
    00021  *    Production release and review comments incorporated.
    00022  *
    00023  * Version 1.0.0 2010/09/20
    00024  *    Production release and review comments incorporated.
    00025  *-------------------------------------------------------------------*/
    00026
    00223 #ifndef _ARM_MATH_H
    00224 #define _ARM_MATH_H
    00225
    00226 #define __CMSIS_GENERIC              /* disable NVIC and Systick functions */
    00227
    00228 #if defined (ARM_MATH_CM4)
    00229   #include "core_cm4.h"
    00230 #elif defined (ARM_MATH_CM3)
    00231   #include "core_cm3.h"
    00232 #elif defined (ARM_MATH_CM0)
    00233   #include "core_cm0.h"
    00234 #else
    00235 #include "ARMCM4.h"
    00236 #warning "Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4....."
    00237 #endif
    00238
    00239 #undef  __CMSIS_GENERIC              /* enable NVIC and Systick functions */
    00240 #include "string.h"
    00241
    00242 #ifdef  __cplusplus
    00243 extern "C"
    00244 {
    00245 #endif
    00246
    00247
    00252 #define DELTA_Q31           (0x100)
    00253 #define DELTA_Q15           0x5
    00254 #define INDEX_MASK          0x0000003F
    00255 #define PI                  3.14159265358979f
    00256
    00261 #define TABLE_SIZE          256
    00262 #define TABLE_SPACING_Q31   0x800000
    00263 #define TABLE_SPACING_Q15   0x80
    00264
    00268   /* 1.31(q31) Fixed value of 2/360 */
    00269   /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
    00270 #define INPUT_SPACING           0xB60B61
    00271
    00272
    00277   typedef enum
    00278     {
    00279       ARM_MATH_SUCCESS = 0,
    00280       ARM_MATH_ARGUMENT_ERROR = -1,
    00281       ARM_MATH_LENGTH_ERROR = -2,
    00282       ARM_MATH_SIZE_MISMATCH = -3,
    00283       ARM_MATH_NANINF = -4,
    00284       ARM_MATH_SINGULAR = -5,
    00285       ARM_MATH_TEST_FAILURE = -6
    00286     } arm_status;
    00287
    00291   typedef int8_t q7_t;
    00292
    00296   typedef int16_t q15_t;
    00297
    00301   typedef int32_t q31_t;
    00302
    00306   typedef int64_t q63_t;
    00307
    00311   typedef float float32_t;
    00312
    00316   typedef double float64_t;
    00317
    00321 #define __SIMD32(addr)  (*(int32_t **) & (addr))
    00322
    00323 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0)
    00324
    00327 #define __PKHBT(ARG1, ARG2, ARG3)      ( (((int32_t)(ARG1) <<  0) & (int32_t)0x0000FFFF) | \
    00328                                          (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000)  )
    00329
    00330 #endif
    00331
    00335 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) <<  0) & (int32_t)0x000000FF) | \
    00336                                 (((int32_t)(v1) <<  8) & (int32_t)0x0000FF00) | \
    00337                                 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
    00338                                 (((int32_t)(v3) << 24) & (int32_t)0xFF000000)  )
    00339
    00340
    00344   static __INLINE q31_t clip_q63_to_q31(
    00345                     q63_t x)
    00346   {
    00347     return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
    00348       ((0x7FFFFFFF ^ ((q31_t) (x >> 62)))) : (q31_t) x;
    00349   }
    00350
    00354   static __INLINE q15_t clip_q63_to_q15(
    00355                     q63_t x)
    00356   {
    00357     return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
    00358       ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
    00359   }
    00360
    00364   static __INLINE q7_t clip_q31_to_q7(
    00365                       q31_t x)
    00366   {
    00367     return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
    00368       ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
    00369   }
    00370
    00374   static __INLINE q15_t clip_q31_to_q15(
    00375                     q31_t x)
    00376   {
    00377     return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
    00378       ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
    00379   }
    00380
    00385   static __INLINE q63_t mult32x64(
    00386                   q63_t x,
    00387                   q31_t y)
    00388   {
    00389     return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
    00390             (((q63_t) (x >> 32) * y)));
    00391   }
    00392
    00393
    00398   static __INLINE uint32_t arm_recip_q31(
    00399                      q31_t in,
    00400                      q31_t * dst,
    00401                      q31_t * pRecipTable)
    00402   {
    00403
    00404     uint32_t out, tempVal;
    00405     uint32_t index, i;
    00406     uint32_t signBits;
    00407
    00408     if(in > 0)
    00409       {
    00410     signBits = __CLZ(in) - 1;
    00411       }
    00412     else
    00413       {
    00414     signBits = __CLZ(-in) - 1;
    00415       }
    00416
    00417     /* Convert input sample to 1.31 format */
    00418     in = in << signBits;
    00419
    00420     /* calculation of index for initial approximated Val */
    00421     index = (uint32_t) (in >> 24u);
    00422     index = (index & INDEX_MASK);
    00423
    00424     /* 1.31 with exp 1 */
    00425     out = pRecipTable[index];
    00426
    00427     /* calculation of reciprocal value */
    00428     /* running approximation for two iterations */
    00429     for (i = 0u; i < 2u; i++)
    00430       {
    00431     tempVal = (q31_t) (((q63_t) in * out) >> 31u);
    00432     tempVal = 0x7FFFFFFF - tempVal;
    00433     /*      1.31 with exp 1 */
    00434     out = (q31_t) (((q63_t) out * tempVal) >> 30u);
    00435       }
    00436
    00437     /* write output */
    00438     *dst = out;
    00439
    00440     /* return num of signbits of out = 1/in value */
    00441     return (signBits + 1u);
    00442
    00443   }
    00444
    00448   static __INLINE uint32_t arm_recip_q15(
    00449                      q15_t in,
    00450                      q15_t * dst,
    00451                      q15_t * pRecipTable)
    00452   {
    00453
    00454     uint32_t out = 0, tempVal = 0;
    00455     uint32_t index = 0, i = 0;
    00456     uint32_t signBits = 0;
    00457
    00458     if(in > 0)
    00459       {
    00460     signBits = __CLZ(in) - 17;
    00461       }
    00462     else
    00463       {
    00464     signBits = __CLZ(-in) - 17;
    00465       }
    00466
    00467     /* Convert input sample to 1.15 format */
    00468     in = in << signBits;
    00469
    00470     /* calculation of index for initial approximated Val */
    00471     index = in >> 8;
    00472     index = (index & INDEX_MASK);
    00473
    00474     /*      1.15 with exp 1  */
    00475     out = pRecipTable[index];
    00476
    00477     /* calculation of reciprocal value */
    00478     /* running approximation for two iterations */
    00479     for (i = 0; i < 2; i++)
    00480       {
    00481     tempVal = (q15_t) (((q31_t) in * out) >> 15);
    00482     tempVal = 0x7FFF - tempVal;
    00483     /*      1.15 with exp 1 */
    00484     out = (q15_t) (((q31_t) out * tempVal) >> 14);
    00485       }
    00486
    00487     /* write output */
    00488     *dst = out;
    00489
    00490     /* return num of signbits of out = 1/in value */
    00491     return (signBits + 1);
    00492
    00493   }
    00494
    00495
    00496   /*
    00497    * @brief C custom defined intrinisic function for only M0 processors
    00498    */
    00499 #if defined(ARM_MATH_CM0)
    00500
    00501   static __INLINE q31_t __SSAT(
    00502                    q31_t x,
    00503                    uint32_t y)
    00504   {
    00505     int32_t posMax, negMin;
    00506     uint32_t i;
    00507
    00508     posMax = 1;
    00509     for (i = 0; i < (y - 1); i++)
    00510       {
    00511     posMax = posMax * 2;
    00512       }
    00513
    00514     if(x > 0)
    00515       {
    00516     posMax = (posMax - 1);
    00517
    00518     if(x > posMax)
    00519       {
    00520         x = posMax;
    00521       }
    00522       }
    00523     else
    00524       {
    00525     negMin = -posMax;
    00526
    00527     if(x < negMin)
    00528       {
    00529         x = negMin;
    00530       }
    00531       }
    00532     return (x);
    00533
    00534
    00535   }
    00536
    00537 #endif /* end of ARM_MATH_CM0 */
    00538
    00539
    00540
    00541   /*
    00542    * @brief C custom defined intrinsic function for M3 and M0 processors
    00543    */
    00544 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0)
    00545
    00546   /*
    00547    * @brief C custom defined QADD8 for M3 and M0 processors
    00548    */
    00549   static __INLINE q31_t __QADD8(
    00550                 q31_t x,
    00551                 q31_t y)
    00552   {
    00553
    00554     q31_t sum;
    00555     q7_t r, s, t, u;
    00556
    00557     r = (char) x;
    00558     s = (char) y;
    00559
    00560     r = __SSAT((q31_t) (r + s), 8);
    00561     s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
    00562     t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
    00563     u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
    00564
    00565     sum = (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
    00566       (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
    00567
    00568     return sum;
    00569
    00570   }
    00571
    00572   /*
    00573    * @brief C custom defined QSUB8 for M3 and M0 processors
    00574    */
    00575   static __INLINE q31_t __QSUB8(
    00576                 q31_t x,
    00577                 q31_t y)
    00578   {
    00579
    00580     q31_t sum;
    00581     q31_t r, s, t, u;
    00582
    00583     r = (char) x;
    00584     s = (char) y;
    00585
    00586     r = __SSAT((r - s), 8);
    00587     s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
    00588     t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
    00589     u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
    00590
    00591     sum =
    00592       (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r & 0x000000FF);
    00593
    00594     return sum;
    00595   }
    00596
    00597   /*
    00598    * @brief C custom defined QADD16 for M3 and M0 processors
    00599    */
    00600
    00601   /*
    00602    * @brief C custom defined QADD16 for M3 and M0 processors
    00603    */
    00604   static __INLINE q31_t __QADD16(
    00605                  q31_t x,
    00606                  q31_t y)
    00607   {
    00608
    00609     q31_t sum;
    00610     q31_t r, s;
    00611
    00612     r = (short) x;
    00613     s = (short) y;
    00614
    00615     r = __SSAT(r + s, 16);
    00616     s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
    00617
    00618     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
    00619
    00620     return sum;
    00621
    00622   }
    00623
    00624   /*
    00625    * @brief C custom defined SHADD16 for M3 and M0 processors
    00626    */
    00627   static __INLINE q31_t __SHADD16(
    00628                   q31_t x,
    00629                   q31_t y)
    00630   {
    00631
    00632     q31_t sum;
    00633     q31_t r, s;
    00634
    00635     r = (short) x;
    00636     s = (short) y;
    00637
    00638     r = ((r >> 1) + (s >> 1));
    00639     s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
    00640
    00641     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
    00642
    00643     return sum;
    00644
    00645   }
    00646
    00647   /*
    00648    * @brief C custom defined QSUB16 for M3 and M0 processors
    00649    */
    00650   static __INLINE q31_t __QSUB16(
    00651                  q31_t x,
    00652                  q31_t y)
    00653   {
    00654
    00655     q31_t sum;
    00656     q31_t r, s;
    00657
    00658     r = (short) x;
    00659     s = (short) y;
    00660
    00661     r = __SSAT(r - s, 16);
    00662     s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
    00663
    00664     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
    00665
    00666     return sum;
    00667   }
    00668
    00669   /*
    00670    * @brief C custom defined SHSUB16 for M3 and M0 processors
    00671    */
    00672   static __INLINE q31_t __SHSUB16(
    00673                   q31_t x,
    00674                   q31_t y)
    00675   {
    00676
    00677     q31_t diff;
    00678     q31_t r, s;
    00679
    00680     r = (short) x;
    00681     s = (short) y;
    00682
    00683     r = ((r >> 1) - (s >> 1));
    00684     s = (((x >> 17) - (y >> 17)) << 16);
    00685
    00686     diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
    00687
    00688     return diff;
    00689   }
    00690
    00691   /*
    00692    * @brief C custom defined QASX for M3 and M0 processors
    00693    */
    00694   static __INLINE q31_t __QASX(
    00695                    q31_t x,
    00696                    q31_t y)
    00697   {
    00698
    00699     q31_t sum = 0;
    00700
    00701     sum = ((sum + clip_q31_to_q15((q31_t) ((short) (x >> 16) + (short) y))) << 16) +
    00702       clip_q31_to_q15((q31_t) ((short) x - (short) (y >> 16)));
    00703
    00704     return sum;
    00705   }
    00706
    00707   /*
    00708    * @brief C custom defined SHASX for M3 and M0 processors
    00709    */
    00710   static __INLINE q31_t __SHASX(
    00711                 q31_t x,
    00712                 q31_t y)
    00713   {
    00714
    00715     q31_t sum;
    00716     q31_t r, s;
    00717
    00718     r = (short) x;
    00719     s = (short) y;
    00720
    00721     r = ((r >> 1) - (y >> 17));
    00722     s = (((x >> 17) + (s >> 1)) << 16);
    00723
    00724     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
    00725
    00726     return sum;
    00727   }
    00728
    00729
    00730   /*
    00731    * @brief C custom defined QSAX for M3 and M0 processors
    00732    */
    00733   static __INLINE q31_t __QSAX(
    00734                    q31_t x,
    00735                    q31_t y)
    00736   {
    00737
    00738     q31_t sum = 0;
    00739
    00740     sum = ((sum + clip_q31_to_q15((q31_t) ((short) (x >> 16) - (short) y))) << 16) +
    00741       clip_q31_to_q15((q31_t) ((short) x + (short) (y >> 16)));
    00742
    00743     return sum;
    00744   }
    00745
    00746   /*
    00747    * @brief C custom defined SHSAX for M3 and M0 processors
    00748    */
    00749   static __INLINE q31_t __SHSAX(
    00750                 q31_t x,
    00751                 q31_t y)
    00752   {
    00753
    00754     q31_t sum;
    00755     q31_t r, s;
    00756
    00757     r = (short) x;
    00758     s = (short) y;
    00759
    00760     r = ((r >> 1) + (y >> 17));
    00761     s = (((x >> 17) - (s >> 1)) << 16);
    00762
    00763     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
    00764
    00765     return sum;
    00766   }
    00767
    00768   /*
    00769    * @brief C custom defined SMUSDX for M3 and M0 processors
    00770    */
    00771   static __INLINE q31_t __SMUSDX(
    00772                  q31_t x,
    00773                  q31_t y)
    00774   {
    00775
    00776     return ((q31_t)(((short) x * (short) (y >> 16)) -
    00777             ((short) (x >> 16) * (short) y)));
    00778   }
    00779
    00780   /*
    00781    * @brief C custom defined SMUADX for M3 and M0 processors
    00782    */
    00783   static __INLINE q31_t __SMUADX(
    00784                  q31_t x,
    00785                  q31_t y)
    00786   {
    00787
    00788     return ((q31_t)(((short) x * (short) (y >> 16)) +
    00789             ((short) (x >> 16) * (short) y)));
    00790   }
    00791
    00792   /*
    00793    * @brief C custom defined QADD for M3 and M0 processors
    00794    */
    00795   static __INLINE q31_t __QADD(
    00796                    q31_t x,
    00797                    q31_t y)
    00798   {
    00799     return clip_q63_to_q31((q63_t) x + y);
    00800   }
    00801
    00802   /*
    00803    * @brief C custom defined QSUB for M3 and M0 processors
    00804    */
    00805   static __INLINE q31_t __QSUB(
    00806                    q31_t x,
    00807                    q31_t y)
    00808   {
    00809     return clip_q63_to_q31((q63_t) x - y);
    00810   }
    00811
    00812   /*
    00813    * @brief C custom defined SMLAD for M3 and M0 processors
    00814    */
    00815   static __INLINE q31_t __SMLAD(
    00816                 q31_t x,
    00817                 q31_t y,
    00818                 q31_t sum)
    00819   {
    00820
    00821     return (sum + ((short) (x >> 16) * (short) (y >> 16)) +
    00822             ((short) x * (short) y));
    00823   }
    00824
    00825   /*
    00826    * @brief C custom defined SMLADX for M3 and M0 processors
    00827    */
    00828   static __INLINE q31_t __SMLADX(
    00829                  q31_t x,
    00830                  q31_t y,
    00831                  q31_t sum)
    00832   {
    00833
    00834     return (sum + ((short) (x >> 16) * (short) (y)) +
    00835             ((short) x * (short) (y >> 16)));
    00836   }
    00837
    00838   /*
    00839    * @brief C custom defined SMLSDX for M3 and M0 processors
    00840    */
    00841   static __INLINE q31_t __SMLSDX(
    00842                  q31_t x,
    00843                  q31_t y,
    00844                  q31_t sum)
    00845   {
    00846
    00847     return (sum - ((short) (x >> 16) * (short) (y)) +
    00848             ((short) x * (short) (y >> 16)));
    00849   }
    00850
    00851   /*
    00852    * @brief C custom defined SMLALD for M3 and M0 processors
    00853    */
    00854   static __INLINE q63_t __SMLALD(
    00855                  q31_t x,
    00856                  q31_t y,
    00857                  q63_t sum)
    00858   {
    00859
    00860     return (sum + ((short) (x >> 16) * (short) (y >> 16)) +
    00861             ((short) x * (short) y));
    00862   }
    00863
    00864   /*
    00865    * @brief C custom defined SMLALDX for M3 and M0 processors
    00866    */
    00867   static __INLINE q63_t __SMLALDX(
    00868                   q31_t x,
    00869                   q31_t y,
    00870                   q63_t sum)
    00871   {
    00872
    00873     return (sum + ((short) (x >> 16) * (short) y)) +
    00874       ((short) x * (short) (y >> 16));
    00875   }
    00876
    00877   /*
    00878    * @brief C custom defined SMUAD for M3 and M0 processors
    00879    */
    00880   static __INLINE q31_t __SMUAD(
    00881                 q31_t x,
    00882                 q31_t y)
    00883   {
    00884
    00885     return (((x >> 16) * (y >> 16)) +
    00886             (((x << 16) >> 16) * ((y << 16) >> 16)));
    00887   }
    00888
    00889   /*
    00890    * @brief C custom defined SMUSD for M3 and M0 processors
    00891    */
    00892   static __INLINE q31_t __SMUSD(
    00893                 q31_t x,
    00894                 q31_t y)
    00895   {
    00896
    00897     return (-((x >> 16) * (y >> 16)) +
    00898             (((x << 16) >> 16) * ((y << 16) >> 16)));
    00899   }
    00900
    00901
    00902
    00903
    00904 #endif /* (ARM_MATH_CM3) || defined (ARM_MATH_CM0) */
    00905
    00906
    00910   typedef struct
    00911   {
    00912     uint16_t numTaps;
    00913     q7_t *pState;
    00914     q7_t *pCoeffs;
    00915   } arm_fir_instance_q7;
    00916
    00920   typedef struct
    00921   {
    00922     uint16_t numTaps;
    00923     q15_t *pState;
    00924     q15_t *pCoeffs;
    00925   } arm_fir_instance_q15;
    00926
    00930   typedef struct
    00931   {
    00932     uint16_t numTaps;
    00933     q31_t *pState;
    00934     q31_t *pCoeffs;
    00935   } arm_fir_instance_q31;
    00936
    00940   typedef struct
    00941   {
    00942     uint16_t numTaps;
    00943     float32_t *pState;
    00944     float32_t *pCoeffs;
    00945   } arm_fir_instance_f32;
    00946
    00947
    00956   void arm_fir_q7(
    00957           const arm_fir_instance_q7 * S,
    00958            q7_t * pSrc,
    00959           q7_t * pDst,
    00960           uint32_t blockSize);
    00961
    00962
    00972   void arm_fir_init_q7(
    00973                arm_fir_instance_q7 * S,
    00974                uint16_t numTaps,
    00975                q7_t * pCoeffs,
    00976                q7_t * pState,
    00977                uint32_t blockSize);
    00978
    00979
    00988   void arm_fir_q15(
    00989            const arm_fir_instance_q15 * S,
    00990             q15_t * pSrc,
    00991            q15_t * pDst,
    00992            uint32_t blockSize);
    00993
    01002   void arm_fir_fast_q15(
    01003             const arm_fir_instance_q15 * S,
    01004              q15_t * pSrc,
    01005             q15_t * pDst,
    01006             uint32_t blockSize);
    01007
    01018   arm_status arm_fir_init_q15(
    01019                   arm_fir_instance_q15 * S,
    01020                   uint16_t numTaps,
    01021                   q15_t * pCoeffs,
    01022                   q15_t * pState,
    01023                   uint32_t blockSize);
    01024
    01025
    01034   void arm_fir_q31(
    01035            const arm_fir_instance_q31 * S,
    01036             q31_t * pSrc,
    01037            q31_t * pDst,
    01038            uint32_t blockSize);
    01039
    01048   void arm_fir_fast_q31(
    01049             const arm_fir_instance_q31 * S,
    01050              q31_t * pSrc,
    01051             q31_t * pDst,
    01052             uint32_t blockSize);
    01053
    01063   void arm_fir_init_q31(
    01064             arm_fir_instance_q31 * S,
    01065             uint16_t numTaps,
    01066             q31_t * pCoeffs,
    01067             q31_t * pState,
    01068             uint32_t blockSize);
    01069
    01078   void arm_fir_f32(
    01079            const arm_fir_instance_f32 * S,
    01080             float32_t * pSrc,
    01081            float32_t * pDst,
    01082            uint32_t blockSize);
    01083
    01093   void arm_fir_init_f32(
    01094             arm_fir_instance_f32 * S,
    01095             uint16_t numTaps,
    01096             float32_t * pCoeffs,
    01097             float32_t * pState,
    01098             uint32_t blockSize);
    01099
    01100
    01104   typedef struct
    01105   {
    01106     int8_t numStages;
    01107     q15_t *pState;
    01108     q15_t *pCoeffs;
    01109     int8_t postShift;
    01111   } arm_biquad_casd_df1_inst_q15;
    01112
    01113
    01117   typedef struct
    01118   {
    01119     uint32_t numStages;
    01120     q31_t *pState;
    01121     q31_t *pCoeffs;
    01122     uint8_t postShift;
    01124   } arm_biquad_casd_df1_inst_q31;
    01125
    01129   typedef struct
    01130   {
    01131     uint32_t numStages;
    01132     float32_t *pState;
    01133     float32_t *pCoeffs;
    01136   } arm_biquad_casd_df1_inst_f32;
    01137
    01138
    01139
    01149   void arm_biquad_cascade_df1_q15(
    01150                   const arm_biquad_casd_df1_inst_q15 * S,
    01151                    q15_t * pSrc,
    01152                   q15_t * pDst,
    01153                   uint32_t blockSize);
    01154
    01165   void arm_biquad_cascade_df1_init_q15(
    01166                        arm_biquad_casd_df1_inst_q15 * S,
    01167                        uint8_t numStages,
    01168                        q15_t * pCoeffs,
    01169                        q15_t * pState,
    01170                        int8_t postShift);
    01171
    01172
    01182   void arm_biquad_cascade_df1_fast_q15(
    01183                        const arm_biquad_casd_df1_inst_q15 * S,
    01184                         q15_t * pSrc,
    01185                        q15_t * pDst,
    01186                        uint32_t blockSize);
    01187
    01188
    01198   void arm_biquad_cascade_df1_q31(
    01199                   const arm_biquad_casd_df1_inst_q31 * S,
    01200                    q31_t * pSrc,
    01201                   q31_t * pDst,
    01202                   uint32_t blockSize);
    01203
    01213   void arm_biquad_cascade_df1_fast_q31(
    01214                        const arm_biquad_casd_df1_inst_q31 * S,
    01215                         q31_t * pSrc,
    01216                        q31_t * pDst,
    01217                        uint32_t blockSize);
    01218
    01229   void arm_biquad_cascade_df1_init_q31(
    01230                        arm_biquad_casd_df1_inst_q31 * S,
    01231                        uint8_t numStages,
    01232                        q31_t * pCoeffs,
    01233                        q31_t * pState,
    01234                        int8_t postShift);
    01235
    01245   void arm_biquad_cascade_df1_f32(
    01246                   const arm_biquad_casd_df1_inst_f32 * S,
    01247                    float32_t * pSrc,
    01248                   float32_t * pDst,
    01249                   uint32_t blockSize);
    01250
    01260   void arm_biquad_cascade_df1_init_f32(
    01261                        arm_biquad_casd_df1_inst_f32 * S,
    01262                        uint8_t numStages,
    01263                        float32_t * pCoeffs,
    01264                        float32_t * pState);
    01265
    01266
    01271   typedef struct
    01272   {
    01273     uint16_t numRows;
    01274     uint16_t numCols;
    01275     float32_t *pData;
    01276   } arm_matrix_instance_f32;
    01277
    01282   typedef struct
    01283   {
    01284     uint16_t numRows;
    01285     uint16_t numCols;
    01286     q15_t *pData;
    01288   } arm_matrix_instance_q15;
    01289
    01294   typedef struct
    01295   {
    01296     uint16_t numRows;
    01297     uint16_t numCols;
    01298     q31_t *pData;
    01300   } arm_matrix_instance_q31;
    01301
    01302
    01303
    01313   arm_status arm_mat_add_f32(
    01314                  const arm_matrix_instance_f32 * pSrcA,
    01315                  const arm_matrix_instance_f32 * pSrcB,
    01316                  arm_matrix_instance_f32 * pDst);
    01317
    01327   arm_status arm_mat_add_q15(
    01328                  const arm_matrix_instance_q15 * pSrcA,
    01329                  const arm_matrix_instance_q15 * pSrcB,
    01330                  arm_matrix_instance_q15 * pDst);
    01331
    01341   arm_status arm_mat_add_q31(
    01342                  const arm_matrix_instance_q31 * pSrcA,
    01343                  const arm_matrix_instance_q31 * pSrcB,
    01344                  arm_matrix_instance_q31 * pDst);
    01345
    01346
    01355   arm_status arm_mat_trans_f32(
    01356                    const arm_matrix_instance_f32 * pSrc,
    01357                    arm_matrix_instance_f32 * pDst);
    01358
    01359
    01368   arm_status arm_mat_trans_q15(
    01369                    const arm_matrix_instance_q15 * pSrc,
    01370                    arm_matrix_instance_q15 * pDst);
    01371
    01380   arm_status arm_mat_trans_q31(
    01381                    const arm_matrix_instance_q31 * pSrc,
    01382                    arm_matrix_instance_q31 * pDst);
    01383
    01384
    01394   arm_status arm_mat_mult_f32(
    01395                   const arm_matrix_instance_f32 * pSrcA,
    01396                   const arm_matrix_instance_f32 * pSrcB,
    01397                   arm_matrix_instance_f32 * pDst);
    01398
    01408   arm_status arm_mat_mult_q15(
    01409                   const arm_matrix_instance_q15 * pSrcA,
    01410                   const arm_matrix_instance_q15 * pSrcB,
    01411                   arm_matrix_instance_q15 * pDst,
    01412                   q15_t * pState);
    01413
    01423   arm_status arm_mat_mult_fast_q15(
    01424                    const arm_matrix_instance_q15 * pSrcA,
    01425                    const arm_matrix_instance_q15 * pSrcB,
    01426                    arm_matrix_instance_q15 * pDst,
    01427                    q15_t * pState);
    01428
    01438   arm_status arm_mat_mult_q31(
    01439                   const arm_matrix_instance_q31 * pSrcA,
    01440                   const arm_matrix_instance_q31 * pSrcB,
    01441                   arm_matrix_instance_q31 * pDst);
    01442
    01452   arm_status arm_mat_mult_fast_q31(
    01453                    const arm_matrix_instance_q31 * pSrcA,
    01454                    const arm_matrix_instance_q31 * pSrcB,
    01455                    arm_matrix_instance_q31 * pDst);
    01456
    01457
    01467   arm_status arm_mat_sub_f32(
    01468                  const arm_matrix_instance_f32 * pSrcA,
    01469                  const arm_matrix_instance_f32 * pSrcB,
    01470                  arm_matrix_instance_f32 * pDst);
    01471
    01481   arm_status arm_mat_sub_q15(
    01482                  const arm_matrix_instance_q15 * pSrcA,
    01483                  const arm_matrix_instance_q15 * pSrcB,
    01484                  arm_matrix_instance_q15 * pDst);
    01485
    01495   arm_status arm_mat_sub_q31(
    01496                  const arm_matrix_instance_q31 * pSrcA,
    01497                  const arm_matrix_instance_q31 * pSrcB,
    01498                  arm_matrix_instance_q31 * pDst);
    01499
    01509   arm_status arm_mat_scale_f32(
    01510                    const arm_matrix_instance_f32 * pSrc,
    01511                    float32_t scale,
    01512                    arm_matrix_instance_f32 * pDst);
    01513
    01524   arm_status arm_mat_scale_q15(
    01525                    const arm_matrix_instance_q15 * pSrc,
    01526                    q15_t scaleFract,
    01527                    int32_t shift,
    01528                    arm_matrix_instance_q15 * pDst);
    01529
    01540   arm_status arm_mat_scale_q31(
    01541                    const arm_matrix_instance_q31 * pSrc,
    01542                    q31_t scaleFract,
    01543                    int32_t shift,
    01544                    arm_matrix_instance_q31 * pDst);
    01545
    01546
    01556   void arm_mat_init_q31(
    01557             arm_matrix_instance_q31 * S,
    01558             uint16_t nRows,
    01559             uint16_t nColumns,
    01560             q31_t   *pData);
    01561
    01571   void arm_mat_init_q15(
    01572             arm_matrix_instance_q15 * S,
    01573             uint16_t nRows,
    01574             uint16_t nColumns,
    01575             q15_t    *pData);
    01576
    01586   void arm_mat_init_f32(
    01587             arm_matrix_instance_f32 * S,
    01588             uint16_t nRows,
    01589             uint16_t nColumns,
    01590             float32_t   *pData);
    01591
    01592
    01593
    01597   typedef struct
    01598   {
    01599     q15_t A0;
    01600     q31_t A1;
    01601     q15_t state[3];
    01602     q15_t Kp;
    01603     q15_t Ki;
    01604     q15_t Kd;
    01605   } arm_pid_instance_q15;
    01606
    01610   typedef struct
    01611   {
    01612     q31_t A0;
    01613     q31_t A1;
    01614     q31_t A2;
    01615     q31_t state[3];
    01616     q31_t Kp;
    01617     q31_t Ki;
    01618     q31_t Kd;
    01620   } arm_pid_instance_q31;
    01621
    01625   typedef struct
    01626   {
    01627     float32_t A0;
    01628     float32_t A1;
    01629     float32_t A2;
    01630     float32_t state[3];
    01631     float32_t Kp;
    01632     float32_t Ki;
    01633     float32_t Kd;
    01634   } arm_pid_instance_f32;
    01635
    01636
    01637
    01644   void arm_pid_init_f32(
    01645             arm_pid_instance_f32 * S,
    01646             int32_t resetStateFlag);
    01647
    01653   void arm_pid_reset_f32(
    01654              arm_pid_instance_f32 * S);
    01655
    01656
    01663   void arm_pid_init_q31(
    01664             arm_pid_instance_q31 * S,
    01665             int32_t resetStateFlag);
    01666
    01667
    01674   void arm_pid_reset_q31(
    01675              arm_pid_instance_q31 * S);
    01676
    01683   void arm_pid_init_q15(
    01684             arm_pid_instance_q15 * S,
    01685             int32_t resetStateFlag);
    01686
    01692   void arm_pid_reset_q15(
    01693              arm_pid_instance_q15 * S);
    01694
    01695
    01699   typedef struct
    01700   {
    01701     uint32_t nValues;
    01702     float32_t x1;
    01703     float32_t xSpacing;
    01704     float32_t *pYData;
    01705   } arm_linear_interp_instance_f32;
    01706
    01711   typedef struct
    01712   {
    01713     uint16_t numRows;
    01714     uint16_t numCols;
    01715     float32_t *pData;
    01716   } arm_bilinear_interp_instance_f32;
    01717
    01722   typedef struct
    01723   {
    01724     uint16_t numRows;
    01725     uint16_t numCols;
    01726     q31_t *pData;
    01727   } arm_bilinear_interp_instance_q31;
    01728
    01733   typedef struct
    01734   {
    01735     uint16_t numRows;
    01736     uint16_t numCols;
    01737     q15_t *pData;
    01738   } arm_bilinear_interp_instance_q15;
    01739
    01744   typedef struct
    01745   {
    01746     uint16_t numRows;
    01747     uint16_t numCols;
    01748     q7_t *pData;
    01749   } arm_bilinear_interp_instance_q7;
    01750
    01751
    01761   void arm_mult_q7(
    01762             q7_t * pSrcA,
    01763             q7_t * pSrcB,
    01764            q7_t * pDst,
    01765            uint32_t blockSize);
    01766
    01776   void arm_mult_q15(
    01777              q15_t * pSrcA,
    01778              q15_t * pSrcB,
    01779             q15_t * pDst,
    01780             uint32_t blockSize);
    01781
    01791   void arm_mult_q31(
    01792              q31_t * pSrcA,
    01793              q31_t * pSrcB,
    01794             q31_t * pDst,
    01795             uint32_t blockSize);
    01796
    01806   void arm_mult_f32(
    01807              float32_t * pSrcA,
    01808              float32_t * pSrcB,
    01809             float32_t * pDst,
    01810             uint32_t blockSize);
    01811
    01812
    01817   typedef struct
    01818   {
    01819     uint16_t  fftLen;
    01820     uint8_t   ifftFlag;
    01821     uint8_t   bitReverseFlag;
    01822     q15_t     *pTwiddle;
    01823     uint16_t  *pBitRevTable;
    01824     uint16_t  twidCoefModifier;
    01825     uint16_t  bitRevFactor;
    01826   } arm_cfft_radix4_instance_q15;
    01827
    01832   typedef struct
    01833   {
    01834     uint16_t    fftLen;
    01835     uint8_t     ifftFlag;
    01836     uint8_t     bitReverseFlag;
    01837     q31_t       *pTwiddle;
    01838     uint16_t    *pBitRevTable;
    01839     uint16_t    twidCoefModifier;
    01840     uint16_t    bitRevFactor;
    01841   } arm_cfft_radix4_instance_q31;
    01842
    01847   typedef struct
    01848   {
    01849     uint16_t     fftLen;
    01850     uint8_t      ifftFlag;
    01851     uint8_t      bitReverseFlag;
    01852     float32_t    *pTwiddle;
    01853     uint16_t     *pBitRevTable;
    01854     uint16_t     twidCoefModifier;
    01855     uint16_t     bitRevFactor;
    01856     float32_t    onebyfftLen;
    01857   } arm_cfft_radix4_instance_f32;
    01858
    01866   void arm_cfft_radix4_q15(
    01867                const arm_cfft_radix4_instance_q15 * S,
    01868                q15_t * pSrc);
    01869
    01879   arm_status arm_cfft_radix4_init_q15(
    01880                       arm_cfft_radix4_instance_q15 * S,
    01881                       uint16_t fftLen,
    01882                       uint8_t ifftFlag,
    01883                       uint8_t bitReverseFlag);
    01884
    01892   void arm_cfft_radix4_q31(
    01893                const arm_cfft_radix4_instance_q31 * S,
    01894                q31_t * pSrc);
    01895
    01905   arm_status arm_cfft_radix4_init_q31(
    01906                       arm_cfft_radix4_instance_q31 * S,
    01907                       uint16_t fftLen,
    01908                       uint8_t ifftFlag,
    01909                       uint8_t bitReverseFlag);
    01910
    01918   void arm_cfft_radix4_f32(
    01919                const arm_cfft_radix4_instance_f32 * S,
    01920                float32_t * pSrc);
    01921
    01931   arm_status arm_cfft_radix4_init_f32(
    01932                       arm_cfft_radix4_instance_f32 * S,
    01933                       uint16_t fftLen,
    01934                       uint8_t ifftFlag,
    01935                       uint8_t bitReverseFlag);
    01936
    01937
    01938
    01939   /*----------------------------------------------------------------------
    01940    *        Internal functions prototypes FFT function
    01941    ----------------------------------------------------------------------*/
    01942
    01952   void arm_radix4_butterfly_f32(
    01953                 float32_t * pSrc,
    01954                 uint16_t fftLen,
    01955                 float32_t * pCoef,
    01956                 uint16_t twidCoefModifier);
    01957
    01968   void arm_radix4_butterfly_inverse_f32(
    01969                     float32_t * pSrc,
    01970                     uint16_t fftLen,
    01971                     float32_t * pCoef,
    01972                     uint16_t twidCoefModifier,
    01973                     float32_t onebyfftLen);
    01974
    01984   void arm_bitreversal_f32(
    01985                float32_t *pSrc,
    01986                uint16_t fftSize,
    01987                uint16_t bitRevFactor,
    01988                uint16_t *pBitRevTab);
    01989
    01999   void arm_radix4_butterfly_q31(
    02000                 q31_t *pSrc,
    02001                 uint32_t fftLen,
    02002                 q31_t *pCoef,
    02003                 uint32_t twidCoefModifier);
    02004
    02014   void arm_radix4_butterfly_inverse_q31(
    02015                     q31_t * pSrc,
    02016                     uint32_t fftLen,
    02017                     q31_t * pCoef,
    02018                     uint32_t twidCoefModifier);
    02019
    02029   void arm_bitreversal_q31(
    02030                q31_t * pSrc,
    02031                uint32_t fftLen,
    02032                uint16_t bitRevFactor,
    02033                uint16_t *pBitRevTab);
    02034
    02044   void arm_radix4_butterfly_q15(
    02045                 q15_t *pSrc16,
    02046                 uint32_t fftLen,
    02047                 q15_t *pCoef16,
    02048                 uint32_t twidCoefModifier);
    02049
    02059   void arm_radix4_butterfly_inverse_q15(
    02060                     q15_t *pSrc16,
    02061                     uint32_t fftLen,
    02062                     q15_t *pCoef16,
    02063                     uint32_t twidCoefModifier);
    02064
    02074   void arm_bitreversal_q15(
    02075                q15_t * pSrc,
    02076                uint32_t fftLen,
    02077                uint16_t bitRevFactor,
    02078                uint16_t *pBitRevTab);
    02079
    02084   typedef struct
    02085   {
    02086     uint32_t fftLenReal;
    02087     uint32_t fftLenBy2;
    02088     uint8_t  ifftFlagR;
    02089     uint8_t  bitReverseFlagR;
    02090     uint32_t twidCoefRModifier;
    02091     q15_t    *pTwiddleAReal;
    02092     q15_t    *pTwiddleBReal;
    02093     arm_cfft_radix4_instance_q15 *pCfft;
    02094   } arm_rfft_instance_q15;
    02095
    02100   typedef struct
    02101   {
    02102     uint32_t fftLenReal;
    02103     uint32_t fftLenBy2;
    02104     uint8_t  ifftFlagR;
    02105     uint8_t  bitReverseFlagR;
    02106     uint32_t twidCoefRModifier;
    02107     q31_t    *pTwiddleAReal;
    02108     q31_t    *pTwiddleBReal;
    02109     arm_cfft_radix4_instance_q31 *pCfft;
    02110   } arm_rfft_instance_q31;
    02111
    02116   typedef struct
    02117   {
    02118     uint32_t  fftLenReal;
    02119     uint16_t  fftLenBy2;
    02120     uint8_t   ifftFlagR;
    02121     uint8_t   bitReverseFlagR;
    02122     uint32_t  twidCoefRModifier;
    02123     float32_t *pTwiddleAReal;
    02124     float32_t *pTwiddleBReal;
    02125     arm_cfft_radix4_instance_f32 *pCfft;
    02126   } arm_rfft_instance_f32;
    02127
    02136   void arm_rfft_q15(
    02137             const arm_rfft_instance_q15 * S,
    02138             q15_t * pSrc,
    02139             q15_t * pDst);
    02140
    02151   arm_status arm_rfft_init_q15(
    02152                    arm_rfft_instance_q15 * S,
    02153                    arm_cfft_radix4_instance_q15 * S_CFFT,
    02154                    uint32_t fftLenReal,
    02155                    uint32_t ifftFlagR,
    02156                    uint32_t bitReverseFlag);
    02157
    02166   void arm_rfft_q31(
    02167             const arm_rfft_instance_q31 * S,
    02168             q31_t * pSrc,
    02169             q31_t * pDst);
    02170
    02181   arm_status arm_rfft_init_q31(
    02182                    arm_rfft_instance_q31 * S,
    02183                    arm_cfft_radix4_instance_q31 * S_CFFT,
    02184                    uint32_t fftLenReal,
    02185                    uint32_t ifftFlagR,
    02186                    uint32_t bitReverseFlag);
    02187
    02198   arm_status arm_rfft_init_f32(
    02199                    arm_rfft_instance_f32 * S,
    02200                    arm_cfft_radix4_instance_f32 * S_CFFT,
    02201                    uint32_t fftLenReal,
    02202                    uint32_t ifftFlagR,
    02203                    uint32_t bitReverseFlag);
    02204
    02213   void arm_rfft_f32(
    02214             const arm_rfft_instance_f32 * S,
    02215             float32_t * pSrc,
    02216             float32_t * pDst);
    02217
    02222   typedef struct
    02223   {
    02224     uint16_t N;
    02225     uint16_t Nby2;
    02226     float32_t normalize;
    02227     float32_t *pTwiddle;
    02228     float32_t *pCosFactor;
    02229     arm_rfft_instance_f32 *pRfft;
    02230     arm_cfft_radix4_instance_f32 *pCfft;
    02231   } arm_dct4_instance_f32;
    02232
    02244   arm_status arm_dct4_init_f32(
    02245                    arm_dct4_instance_f32 * S,
    02246                    arm_rfft_instance_f32 * S_RFFT,
    02247                    arm_cfft_radix4_instance_f32 * S_CFFT,
    02248                    uint16_t N,
    02249                    uint16_t Nby2,
    02250                    float32_t normalize);
    02251
    02260   void arm_dct4_f32(
    02261             const arm_dct4_instance_f32 * S,
    02262             float32_t * pState,
    02263             float32_t * pInlineBuffer);
    02264
    02269   typedef struct
    02270   {
    02271     uint16_t N;
    02272     uint16_t Nby2;
    02273     q31_t normalize;
    02274     q31_t *pTwiddle;
    02275     q31_t *pCosFactor;
    02276     arm_rfft_instance_q31 *pRfft;
    02277     arm_cfft_radix4_instance_q31 *pCfft;
    02278   } arm_dct4_instance_q31;
    02279
    02291   arm_status arm_dct4_init_q31(
    02292                    arm_dct4_instance_q31 * S,
    02293                    arm_rfft_instance_q31 * S_RFFT,
    02294                    arm_cfft_radix4_instance_q31 * S_CFFT,
    02295                    uint16_t N,
    02296                    uint16_t Nby2,
    02297                    q31_t normalize);
    02298
    02307   void arm_dct4_q31(
    02308             const arm_dct4_instance_q31 * S,
    02309             q31_t * pState,
    02310             q31_t * pInlineBuffer);
    02311
    02316   typedef struct
    02317   {
    02318     uint16_t N;
    02319     uint16_t Nby2;
    02320     q15_t normalize;
    02321     q15_t *pTwiddle;
    02322     q15_t *pCosFactor;
    02323     arm_rfft_instance_q15 *pRfft;
    02324     arm_cfft_radix4_instance_q15 *pCfft;
    02325   } arm_dct4_instance_q15;
    02326
    02338   arm_status arm_dct4_init_q15(
    02339                    arm_dct4_instance_q15 * S,
    02340                    arm_rfft_instance_q15 * S_RFFT,
    02341                    arm_cfft_radix4_instance_q15 * S_CFFT,
    02342                    uint16_t N,
    02343                    uint16_t Nby2,
    02344                    q15_t normalize);
    02345
    02354   void arm_dct4_q15(
    02355             const arm_dct4_instance_q15 * S,
    02356             q15_t * pState,
    02357             q15_t * pInlineBuffer);
    02358
    02368   void arm_add_f32(
    02369            float32_t * pSrcA,
    02370            float32_t * pSrcB,
    02371            float32_t * pDst,
    02372            uint32_t blockSize);
    02373
    02383   void arm_add_q7(
    02384           q7_t * pSrcA,
    02385           q7_t * pSrcB,
    02386           q7_t * pDst,
    02387           uint32_t blockSize);
    02388
    02398   void arm_add_q15(
    02399             q15_t * pSrcA,
    02400             q15_t * pSrcB,
    02401            q15_t * pDst,
    02402            uint32_t blockSize);
    02403
    02413   void arm_add_q31(
    02414             q31_t * pSrcA,
    02415             q31_t * pSrcB,
    02416            q31_t * pDst,
    02417            uint32_t blockSize);
    02418
    02428   void arm_sub_f32(
    02429             float32_t * pSrcA,
    02430             float32_t * pSrcB,
    02431            float32_t * pDst,
    02432            uint32_t blockSize);
    02433
    02443   void arm_sub_q7(
    02444            q7_t * pSrcA,
    02445            q7_t * pSrcB,
    02446           q7_t * pDst,
    02447           uint32_t blockSize);
    02448
    02458   void arm_sub_q15(
    02459             q15_t * pSrcA,
    02460             q15_t * pSrcB,
    02461            q15_t * pDst,
    02462            uint32_t blockSize);
    02463
    02473   void arm_sub_q31(
    02474             q31_t * pSrcA,
    02475             q31_t * pSrcB,
    02476            q31_t * pDst,
    02477            uint32_t blockSize);
    02478
    02488   void arm_scale_f32(
    02489               float32_t * pSrc,
    02490              float32_t scale,
    02491              float32_t * pDst,
    02492              uint32_t blockSize);
    02493
    02504   void arm_scale_q7(
    02505              q7_t * pSrc,
    02506             q7_t scaleFract,
    02507             int8_t shift,
    02508             q7_t * pDst,
    02509             uint32_t blockSize);
    02510
    02521   void arm_scale_q15(
    02522               q15_t * pSrc,
    02523              q15_t scaleFract,
    02524              int8_t shift,
    02525              q15_t * pDst,
    02526              uint32_t blockSize);
    02527
    02538   void arm_scale_q31(
    02539               q31_t * pSrc,
    02540              q31_t scaleFract,
    02541              int8_t shift,
    02542              q31_t * pDst,
    02543              uint32_t blockSize);
    02544
    02553   void arm_abs_q7(
    02554            q7_t * pSrc,
    02555           q7_t * pDst,
    02556           uint32_t blockSize);
    02557
    02566   void arm_abs_f32(
    02567             float32_t * pSrc,
    02568            float32_t * pDst,
    02569            uint32_t blockSize);
    02570
    02579   void arm_abs_q15(
    02580             q15_t * pSrc,
    02581            q15_t * pDst,
    02582            uint32_t blockSize);
    02583
    02592   void arm_abs_q31(
    02593             q31_t * pSrc,
    02594            q31_t * pDst,
    02595            uint32_t blockSize);
    02596
    02606   void arm_dot_prod_f32(
    02607              float32_t * pSrcA,
    02608              float32_t * pSrcB,
    02609             uint32_t blockSize,
    02610             float32_t * result);
    02611
    02621   void arm_dot_prod_q7(
    02622                 q7_t * pSrcA,
    02623                 q7_t * pSrcB,
    02624                uint32_t blockSize,
    02625                q31_t * result);
    02626
    02636   void arm_dot_prod_q15(
    02637              q15_t * pSrcA,
    02638              q15_t * pSrcB,
    02639             uint32_t blockSize,
    02640             q63_t * result);
    02641
    02651   void arm_dot_prod_q31(
    02652              q31_t * pSrcA,
    02653              q31_t * pSrcB,
    02654             uint32_t blockSize,
    02655             q63_t * result);
    02656
    02666   void arm_shift_q7(
    02667              q7_t * pSrc,
    02668             int8_t shiftBits,
    02669             q7_t * pDst,
    02670             uint32_t blockSize);
    02671
    02681   void arm_shift_q15(
    02682               q15_t * pSrc,
    02683              int8_t shiftBits,
    02684              q15_t * pDst,
    02685              uint32_t blockSize);
    02686
    02696   void arm_shift_q31(
    02697               q31_t * pSrc,
    02698              int8_t shiftBits,
    02699              q31_t * pDst,
    02700              uint32_t blockSize);
    02701
    02711   void arm_offset_f32(
    02712                float32_t * pSrc,
    02713               float32_t offset,
    02714               float32_t * pDst,
    02715               uint32_t blockSize);
    02716
    02726   void arm_offset_q7(
    02727               q7_t * pSrc,
    02728              q7_t offset,
    02729              q7_t * pDst,
    02730              uint32_t blockSize);
    02731
    02741   void arm_offset_q15(
    02742                q15_t * pSrc,
    02743               q15_t offset,
    02744               q15_t * pDst,
    02745               uint32_t blockSize);
    02746
    02756   void arm_offset_q31(
    02757                q31_t * pSrc,
    02758               q31_t offset,
    02759               q31_t * pDst,
    02760               uint32_t blockSize);
    02761
    02770   void arm_negate_f32(
    02771                float32_t * pSrc,
    02772               float32_t * pDst,
    02773               uint32_t blockSize);
    02774
    02783   void arm_negate_q7(
    02784               q7_t * pSrc,
    02785              q7_t * pDst,
    02786              uint32_t blockSize);
    02787
    02796   void arm_negate_q15(
    02797                q15_t * pSrc,
    02798               q15_t * pDst,
    02799               uint32_t blockSize);
    02800
    02809   void arm_negate_q31(
    02810                q31_t * pSrc,
    02811               q31_t * pDst,
    02812               uint32_t blockSize);
    02820   void arm_copy_f32(
    02821              float32_t * pSrc,
    02822             float32_t * pDst,
    02823             uint32_t blockSize);
    02824
    02832   void arm_copy_q7(
    02833             q7_t * pSrc,
    02834            q7_t * pDst,
    02835            uint32_t blockSize);
    02836
    02844   void arm_copy_q15(
    02845              q15_t * pSrc,
    02846             q15_t * pDst,
    02847             uint32_t blockSize);
    02848
    02856   void arm_copy_q31(
    02857              q31_t * pSrc,
    02858             q31_t * pDst,
    02859             uint32_t blockSize);
    02867   void arm_fill_f32(
    02868              float32_t value,
    02869             float32_t * pDst,
    02870             uint32_t blockSize);
    02871
    02879   void arm_fill_q7(
    02880             q7_t value,
    02881            q7_t * pDst,
    02882            uint32_t blockSize);
    02883
    02891   void arm_fill_q15(
    02892              q15_t value,
    02893             q15_t * pDst,
    02894             uint32_t blockSize);
    02895
    02903   void arm_fill_q31(
    02904              q31_t value,
    02905             q31_t * pDst,
    02906             uint32_t blockSize);
    02907
    02918   void arm_conv_f32(
    02919              float32_t * pSrcA,
    02920             uint32_t srcALen,
    02921              float32_t * pSrcB,
    02922             uint32_t srcBLen,
    02923             float32_t * pDst);
    02924
    02935   void arm_conv_q15(
    02936              q15_t * pSrcA,
    02937             uint32_t srcALen,
    02938              q15_t * pSrcB,
    02939             uint32_t srcBLen,
    02940             q15_t * pDst);
    02941
    02952   void arm_conv_fast_q15(
    02953               q15_t * pSrcA,
    02954              uint32_t srcALen,
    02955               q15_t * pSrcB,
    02956              uint32_t srcBLen,
    02957              q15_t * pDst);
    02958
    02969   void arm_conv_q31(
    02970              q31_t * pSrcA,
    02971             uint32_t srcALen,
    02972              q31_t * pSrcB,
    02973             uint32_t srcBLen,
    02974             q31_t * pDst);
    02975
    02986   void arm_conv_fast_q31(
    02987               q31_t * pSrcA,
    02988              uint32_t srcALen,
    02989               q31_t * pSrcB,
    02990              uint32_t srcBLen,
    02991              q31_t * pDst);
    02992
    03003   void arm_conv_q7(
    03004             q7_t * pSrcA,
    03005            uint32_t srcALen,
    03006             q7_t * pSrcB,
    03007            uint32_t srcBLen,
    03008            q7_t * pDst);
    03009
    03022   arm_status arm_conv_partial_f32(
    03023                    float32_t * pSrcA,
    03024                   uint32_t srcALen,
    03025                    float32_t * pSrcB,
    03026                   uint32_t srcBLen,
    03027                   float32_t * pDst,
    03028                   uint32_t firstIndex,
    03029                   uint32_t numPoints);
    03030
    03043   arm_status arm_conv_partial_q15(
    03044                    q15_t * pSrcA,
    03045                   uint32_t srcALen,
    03046                    q15_t * pSrcB,
    03047                   uint32_t srcBLen,
    03048                   q15_t * pDst,
    03049                   uint32_t firstIndex,
    03050                   uint32_t numPoints);
    03051
    03064   arm_status arm_conv_partial_fast_q15(
    03065                         q15_t * pSrcA,
    03066                        uint32_t srcALen,
    03067                         q15_t * pSrcB,
    03068                        uint32_t srcBLen,
    03069                        q15_t * pDst,
    03070                        uint32_t firstIndex,
    03071                        uint32_t numPoints);
    03072
    03085   arm_status arm_conv_partial_q31(
    03086                    q31_t * pSrcA,
    03087                   uint32_t srcALen,
    03088                    q31_t * pSrcB,
    03089                   uint32_t srcBLen,
    03090                   q31_t * pDst,
    03091                   uint32_t firstIndex,
    03092                   uint32_t numPoints);
    03093
    03094
    03107   arm_status arm_conv_partial_fast_q31(
    03108                         q31_t * pSrcA,
    03109                        uint32_t srcALen,
    03110                         q31_t * pSrcB,
    03111                        uint32_t srcBLen,
    03112                        q31_t * pDst,
    03113                        uint32_t firstIndex,
    03114                        uint32_t numPoints);
    03115
    03128   arm_status arm_conv_partial_q7(
    03129                   q7_t * pSrcA,
    03130                  uint32_t srcALen,
    03131                   q7_t * pSrcB,
    03132                  uint32_t srcBLen,
    03133                  q7_t * pDst,
    03134                  uint32_t firstIndex,
    03135                  uint32_t numPoints);
    03136
    03137
    03142   typedef struct
    03143   {
    03144     uint8_t M;
    03145     uint16_t numTaps;
    03146     q15_t *pCoeffs;
    03147     q15_t *pState;
    03148   } arm_fir_decimate_instance_q15;
    03149
    03154   typedef struct
    03155   {
    03156     uint8_t M;
    03157     uint16_t numTaps;
    03158     q31_t *pCoeffs;
    03159     q31_t *pState;
    03161   } arm_fir_decimate_instance_q31;
    03162
    03167   typedef struct
    03168   {
    03169     uint8_t M;
    03170     uint16_t numTaps;
    03171     float32_t *pCoeffs;
    03172     float32_t *pState;
    03174   } arm_fir_decimate_instance_f32;
    03175
    03176
    03177
    03187   void arm_fir_decimate_f32(
    03188                 const arm_fir_decimate_instance_f32 * S,
    03189                  float32_t * pSrc,
    03190                 float32_t * pDst,
    03191                 uint32_t blockSize);
    03192
    03193
    03206   arm_status arm_fir_decimate_init_f32(
    03207                        arm_fir_decimate_instance_f32 * S,
    03208                        uint16_t numTaps,
    03209                        uint8_t M,
    03210                        float32_t * pCoeffs,
    03211                        float32_t * pState,
    03212                        uint32_t blockSize);
    03213
    03223   void arm_fir_decimate_q15(
    03224                 const arm_fir_decimate_instance_q15 * S,
    03225                  q15_t * pSrc,
    03226                 q15_t * pDst,
    03227                 uint32_t blockSize);
    03228
    03238   void arm_fir_decimate_fast_q15(
    03239                  const arm_fir_decimate_instance_q15 * S,
    03240                   q15_t * pSrc,
    03241                  q15_t * pDst,
    03242                  uint32_t blockSize);
    03243
    03244
    03245
    03258   arm_status arm_fir_decimate_init_q15(
    03259                        arm_fir_decimate_instance_q15 * S,
    03260                        uint16_t numTaps,
    03261                        uint8_t M,
    03262                        q15_t * pCoeffs,
    03263                        q15_t * pState,
    03264                        uint32_t blockSize);
    03265
    03275   void arm_fir_decimate_q31(
    03276                 const arm_fir_decimate_instance_q31 * S,
    03277                  q31_t * pSrc,
    03278                 q31_t * pDst,
    03279                 uint32_t blockSize);
    03280
    03290   void arm_fir_decimate_fast_q31(
    03291                  arm_fir_decimate_instance_q31 * S,
    03292                   q31_t * pSrc,
    03293                  q31_t * pDst,
    03294                  uint32_t blockSize);
    03295
    03296
    03309   arm_status arm_fir_decimate_init_q31(
    03310                        arm_fir_decimate_instance_q31 * S,
    03311                        uint16_t numTaps,
    03312                        uint8_t M,
    03313                        q31_t * pCoeffs,
    03314                        q31_t * pState,
    03315                        uint32_t blockSize);
    03316
    03317
    03318
    03323   typedef struct
    03324   {
    03325     uint8_t L;
    03326     uint16_t phaseLength;
    03327     q15_t *pCoeffs;
    03328     q15_t *pState;
    03329   } arm_fir_interpolate_instance_q15;
    03330
    03335   typedef struct
    03336   {
    03337     uint8_t L;
    03338     uint16_t phaseLength;
    03339     q31_t *pCoeffs;
    03340     q31_t *pState;
    03341   } arm_fir_interpolate_instance_q31;
    03342
    03347   typedef struct
    03348   {
    03349     uint8_t L;
    03350     uint16_t phaseLength;
    03351     float32_t *pCoeffs;
    03352     float32_t *pState;
    03353   } arm_fir_interpolate_instance_f32;
    03354
    03355
    03365   void arm_fir_interpolate_q15(
    03366                    const arm_fir_interpolate_instance_q15 * S,
    03367                     q15_t * pSrc,
    03368                    q15_t * pDst,
    03369                    uint32_t blockSize);
    03370
    03371
    03384   arm_status arm_fir_interpolate_init_q15(
    03385                       arm_fir_interpolate_instance_q15 * S,
    03386                       uint8_t L,
    03387                       uint16_t numTaps,
    03388                       q15_t * pCoeffs,
    03389                       q15_t * pState,
    03390                       uint32_t blockSize);
    03391
    03401   void arm_fir_interpolate_q31(
    03402                    const arm_fir_interpolate_instance_q31 * S,
    03403                     q31_t * pSrc,
    03404                    q31_t * pDst,
    03405                    uint32_t blockSize);
    03406
    03419   arm_status arm_fir_interpolate_init_q31(
    03420                       arm_fir_interpolate_instance_q31 * S,
    03421                       uint8_t L,
    03422                       uint16_t numTaps,
    03423                       q31_t * pCoeffs,
    03424                       q31_t * pState,
    03425                       uint32_t blockSize);
    03426
    03427
    03437   void arm_fir_interpolate_f32(
    03438                    const arm_fir_interpolate_instance_f32 * S,
    03439                     float32_t * pSrc,
    03440                    float32_t * pDst,
    03441                    uint32_t blockSize);
    03442
    03455   arm_status arm_fir_interpolate_init_f32(
    03456                       arm_fir_interpolate_instance_f32 * S,
    03457                       uint8_t L,
    03458                       uint16_t numTaps,
    03459                       float32_t * pCoeffs,
    03460                       float32_t * pState,
    03461                       uint32_t blockSize);
    03462
    03467   typedef struct
    03468   {
    03469     uint8_t numStages;
    03470     q63_t *pState;
    03471     q31_t *pCoeffs;
    03472     uint8_t postShift;
    03474   } arm_biquad_cas_df1_32x64_ins_q31;
    03475
    03476
    03485   void arm_biquad_cas_df1_32x64_q31(
    03486                     const arm_biquad_cas_df1_32x64_ins_q31 * S,
    03487                      q31_t * pSrc,
    03488                     q31_t * pDst,
    03489                     uint32_t blockSize);
    03490
    03491
    03501   void arm_biquad_cas_df1_32x64_init_q31(
    03502                      arm_biquad_cas_df1_32x64_ins_q31 * S,
    03503                      uint8_t numStages,
    03504                      q31_t * pCoeffs,
    03505                      q63_t * pState,
    03506                      uint8_t postShift);
    03507
    03508
    03509
    03514   typedef struct
    03515   {
    03516     uint8_t   numStages;
    03517     float32_t *pState;
    03518     float32_t *pCoeffs;
    03519   } arm_biquad_cascade_df2T_instance_f32;
    03520
    03521
    03531   void arm_biquad_cascade_df2T_f32(
    03532                    const arm_biquad_cascade_df2T_instance_f32 * S,
    03533                     float32_t * pSrc,
    03534                    float32_t * pDst,
    03535                    uint32_t blockSize);
    03536
    03537
    03547   void arm_biquad_cascade_df2T_init_f32(
    03548                     arm_biquad_cascade_df2T_instance_f32 * S,
    03549                     uint8_t numStages,
    03550                     float32_t * pCoeffs,
    03551                     float32_t * pState);
    03552
    03553
    03554
    03559   typedef struct
    03560   {
    03561     uint16_t numStages;
    03562     q15_t *pState;
    03563     q15_t *pCoeffs;
    03564   } arm_fir_lattice_instance_q15;
    03565
    03570   typedef struct
    03571   {
    03572     uint16_t numStages;
    03573     q31_t *pState;
    03574     q31_t *pCoeffs;
    03575   } arm_fir_lattice_instance_q31;
    03576
    03581   typedef struct
    03582   {
    03583     uint16_t numStages;
    03584     float32_t *pState;
    03585     float32_t *pCoeffs;
    03586   } arm_fir_lattice_instance_f32;
    03587
    03597   void arm_fir_lattice_init_q15(
    03598                 arm_fir_lattice_instance_q15 * S,
    03599                 uint16_t numStages,
    03600                 q15_t * pCoeffs,
    03601                 q15_t * pState);
    03602
    03603
    03612   void arm_fir_lattice_q15(
    03613                const arm_fir_lattice_instance_q15 * S,
    03614                 q15_t * pSrc,
    03615                q15_t * pDst,
    03616                uint32_t blockSize);
    03617
    03627   void arm_fir_lattice_init_q31(
    03628                 arm_fir_lattice_instance_q31 * S,
    03629                 uint16_t numStages,
    03630                 q31_t * pCoeffs,
    03631                 q31_t * pState);
    03632
    03633
    03643   void arm_fir_lattice_q31(
    03644                const arm_fir_lattice_instance_q31 * S,
    03645                 q31_t * pSrc,
    03646                q31_t * pDst,
    03647                uint32_t blockSize);
    03648
    03658   void arm_fir_lattice_init_f32(
    03659                 arm_fir_lattice_instance_f32 * S,
    03660                 uint16_t numStages,
    03661                 float32_t * pCoeffs,
    03662                 float32_t * pState);
    03663
    03673   void arm_fir_lattice_f32(
    03674                const arm_fir_lattice_instance_f32 * S,
    03675                 float32_t * pSrc,
    03676                float32_t * pDst,
    03677                uint32_t blockSize);
    03678
    03682   typedef struct
    03683   {
    03684     uint16_t numStages;
    03685     q15_t *pState;
    03686     q15_t *pkCoeffs;
    03687     q15_t *pvCoeffs;
    03688   } arm_iir_lattice_instance_q15;
    03689
    03693   typedef struct
    03694   {
    03695     uint16_t numStages;
    03696     q31_t *pState;
    03697     q31_t *pkCoeffs;
    03698     q31_t *pvCoeffs;
    03699   } arm_iir_lattice_instance_q31;
    03700
    03704   typedef struct
    03705   {
    03706     uint16_t numStages;
    03707     float32_t *pState;
    03708     float32_t *pkCoeffs;
    03709     float32_t *pvCoeffs;
    03710   } arm_iir_lattice_instance_f32;
    03711
    03721   void arm_iir_lattice_f32(
    03722                const arm_iir_lattice_instance_f32 * S,
    03723                 float32_t * pSrc,
    03724                float32_t * pDst,
    03725                uint32_t blockSize);
    03726
    03738   void arm_iir_lattice_init_f32(
    03739                 arm_iir_lattice_instance_f32 * S,
    03740                 uint16_t numStages,
    03741                 float32_t *pkCoeffs,
    03742                 float32_t *pvCoeffs,
    03743                 float32_t *pState,
    03744                 uint32_t blockSize);
    03745
    03746
    03756   void arm_iir_lattice_q31(
    03757                const arm_iir_lattice_instance_q31 * S,
    03758                 q31_t * pSrc,
    03759                q31_t * pDst,
    03760                uint32_t blockSize);
    03761
    03762
    03774   void arm_iir_lattice_init_q31(
    03775                 arm_iir_lattice_instance_q31 * S,
    03776                 uint16_t numStages,
    03777                 q31_t *pkCoeffs,
    03778                 q31_t *pvCoeffs,
    03779                 q31_t *pState,
    03780                 uint32_t blockSize);
    03781
    03782
    03792   void arm_iir_lattice_q15(
    03793                const arm_iir_lattice_instance_q15 * S,
    03794                 q15_t * pSrc,
    03795                q15_t * pDst,
    03796                uint32_t blockSize);
    03797
    03798
    03810   void arm_iir_lattice_init_q15(
    03811                 arm_iir_lattice_instance_q15 * S,
    03812                 uint16_t numStages,
    03813                 q15_t *pkCoeffs,
    03814                 q15_t *pvCoeffs,
    03815                 q15_t *pState,
    03816                 uint32_t blockSize);
    03817
    03822   typedef struct
    03823   {
    03824     uint16_t numTaps;
    03825     float32_t *pState;
    03826     float32_t *pCoeffs;
    03827     float32_t mu;
    03828   } arm_lms_instance_f32;
    03829
    03841   void arm_lms_f32(
    03842            const arm_lms_instance_f32 * S,
    03843             float32_t * pSrc,
    03844             float32_t * pRef,
    03845            float32_t * pOut,
    03846            float32_t * pErr,
    03847            uint32_t blockSize);
    03848
    03860   void arm_lms_init_f32(
    03861             arm_lms_instance_f32 * S,
    03862             uint16_t numTaps,
    03863             float32_t * pCoeffs,
    03864             float32_t * pState,
    03865             float32_t mu,
    03866             uint32_t blockSize);
    03867
    03872   typedef struct
    03873   {
    03874     uint16_t numTaps;
    03875     q15_t *pState;
    03876     q15_t *pCoeffs;
    03877     q15_t mu;
    03878     uint32_t postShift;
    03879   } arm_lms_instance_q15;
    03880
    03881
    03894   void arm_lms_init_q15(
    03895             arm_lms_instance_q15 * S,
    03896             uint16_t numTaps,
    03897             q15_t * pCoeffs,
    03898             q15_t * pState,
    03899             q15_t mu,
    03900             uint32_t blockSize,
    03901             uint32_t postShift);
    03902
    03914   void arm_lms_q15(
    03915            const arm_lms_instance_q15 * S,
    03916             q15_t * pSrc,
    03917             q15_t * pRef,
    03918            q15_t * pOut,
    03919            q15_t * pErr,
    03920            uint32_t blockSize);
    03921
    03922
    03927   typedef struct
    03928   {
    03929     uint16_t numTaps;
    03930     q31_t *pState;
    03931     q31_t *pCoeffs;
    03932     q31_t mu;
    03933     uint32_t postShift;
    03935   } arm_lms_instance_q31;
    03936
    03948   void arm_lms_q31(
    03949            const arm_lms_instance_q31 * S,
    03950             q31_t * pSrc,
    03951             q31_t * pRef,
    03952            q31_t * pOut,
    03953            q31_t * pErr,
    03954            uint32_t blockSize);
    03955
    03968   void arm_lms_init_q31(
    03969             arm_lms_instance_q31 * S,
    03970             uint16_t numTaps,
    03971             q31_t *pCoeffs,
    03972             q31_t *pState,
    03973             q31_t mu,
    03974             uint32_t blockSize,
    03975             uint32_t postShift);
    03976
    03981   typedef struct
    03982   {
    03983     uint16_t  numTaps;
    03984     float32_t *pState;
    03985     float32_t *pCoeffs;
    03986     float32_t mu;
    03987     float32_t energy;
    03988     float32_t x0;
    03989   } arm_lms_norm_instance_f32;
    03990
    04002   void arm_lms_norm_f32(
    04003             arm_lms_norm_instance_f32 * S,
    04004              float32_t * pSrc,
    04005              float32_t * pRef,
    04006             float32_t * pOut,
    04007             float32_t * pErr,
    04008             uint32_t blockSize);
    04009
    04021   void arm_lms_norm_init_f32(
    04022                  arm_lms_norm_instance_f32 * S,
    04023                  uint16_t numTaps,
    04024                  float32_t * pCoeffs,
    04025                  float32_t * pState,
    04026                  float32_t mu,
    04027                  uint32_t blockSize);
    04028
    04029
    04033   typedef struct
    04034   {
    04035     uint16_t numTaps;
    04036     q31_t *pState;
    04037     q31_t *pCoeffs;
    04038     q31_t mu;
    04039     uint8_t postShift;
    04040     q31_t *recipTable;
    04041     q31_t energy;
    04042     q31_t x0;
    04043   } arm_lms_norm_instance_q31;
    04044
    04056   void arm_lms_norm_q31(
    04057             arm_lms_norm_instance_q31 * S,
    04058              q31_t * pSrc,
    04059              q31_t * pRef,
    04060             q31_t * pOut,
    04061             q31_t * pErr,
    04062             uint32_t blockSize);
    04063
    04076   void arm_lms_norm_init_q31(
    04077                  arm_lms_norm_instance_q31 * S,
    04078                  uint16_t numTaps,
    04079                  q31_t * pCoeffs,
    04080                  q31_t * pState,
    04081                  q31_t mu,
    04082                  uint32_t blockSize,
    04083                  uint8_t postShift);
    04084
    04089   typedef struct
    04090   {
    04091     uint16_t numTaps;
    04092     q15_t *pState;
    04093     q15_t *pCoeffs;
    04094     q15_t mu;
    04095     uint8_t postShift;
    04096     q15_t *recipTable;
    04097     q15_t energy;
    04098     q15_t x0;
    04099   } arm_lms_norm_instance_q15;
    04100
    04112   void arm_lms_norm_q15(
    04113             arm_lms_norm_instance_q15 * S,
    04114              q15_t * pSrc,
    04115              q15_t * pRef,
    04116             q15_t * pOut,
    04117             q15_t * pErr,
    04118             uint32_t blockSize);
    04119
    04120
    04133   void arm_lms_norm_init_q15(
    04134                  arm_lms_norm_instance_q15 * S,
    04135                  uint16_t numTaps,
    04136                  q15_t * pCoeffs,
    04137                  q15_t * pState,
    04138                  q15_t mu,
    04139                  uint32_t blockSize,
    04140                  uint8_t postShift);
    04141
    04152   void arm_correlate_f32(
    04153               float32_t * pSrcA,
    04154              uint32_t srcALen,
    04155               float32_t * pSrcB,
    04156              uint32_t srcBLen,
    04157              float32_t * pDst);
    04158
    04169   void arm_correlate_q15(
    04170               q15_t * pSrcA,
    04171              uint32_t srcALen,
    04172               q15_t * pSrcB,
    04173              uint32_t srcBLen,
    04174              q15_t * pDst);
    04175
    04186   void arm_correlate_fast_q15(
    04187                    q15_t * pSrcA,
    04188                   uint32_t srcALen,
    04189                    q15_t * pSrcB,
    04190                   uint32_t srcBLen,
    04191                   q15_t * pDst);
    04192
    04203   void arm_correlate_q31(
    04204               q31_t * pSrcA,
    04205              uint32_t srcALen,
    04206               q31_t * pSrcB,
    04207              uint32_t srcBLen,
    04208              q31_t * pDst);
    04209
    04220   void arm_correlate_fast_q31(
    04221                    q31_t * pSrcA,
    04222                   uint32_t srcALen,
    04223                    q31_t * pSrcB,
    04224                   uint32_t srcBLen,
    04225                   q31_t * pDst);
    04226
    04237   void arm_correlate_q7(
    04238              q7_t * pSrcA,
    04239             uint32_t srcALen,
    04240              q7_t * pSrcB,
    04241             uint32_t srcBLen,
    04242             q7_t * pDst);
    04243
    04247   typedef struct
    04248   {
    04249     uint16_t numTaps;
    04250     uint16_t stateIndex;
    04251     float32_t *pState;
    04252     float32_t *pCoeffs;
    04253     uint16_t maxDelay;
    04254     int32_t *pTapDelay;
    04255   } arm_fir_sparse_instance_f32;
    04256
    04261   typedef struct
    04262   {
    04263     uint16_t numTaps;
    04264     uint16_t stateIndex;
    04265     q31_t *pState;
    04266     q31_t *pCoeffs;
    04267     uint16_t maxDelay;
    04268     int32_t *pTapDelay;
    04269   } arm_fir_sparse_instance_q31;
    04270
    04275   typedef struct
    04276   {
    04277     uint16_t numTaps;
    04278     uint16_t stateIndex;
    04279     q15_t *pState;
    04280     q15_t *pCoeffs;
    04281     uint16_t maxDelay;
    04282     int32_t *pTapDelay;
    04283   } arm_fir_sparse_instance_q15;
    04284
    04289   typedef struct
    04290   {
    04291     uint16_t numTaps;
    04292     uint16_t stateIndex;
    04293     q7_t *pState;
    04294     q7_t *pCoeffs;
    04295     uint16_t maxDelay;
    04296     int32_t *pTapDelay;
    04297   } arm_fir_sparse_instance_q7;
    04298
    04309   void arm_fir_sparse_f32(
    04310               arm_fir_sparse_instance_f32 * S,
    04311                float32_t * pSrc,
    04312               float32_t * pDst,
    04313               float32_t * pScratchIn,
    04314               uint32_t blockSize);
    04315
    04328   void arm_fir_sparse_init_f32(
    04329                    arm_fir_sparse_instance_f32 * S,
    04330                    uint16_t numTaps,
    04331                    float32_t * pCoeffs,
    04332                    float32_t * pState,
    04333                    int32_t * pTapDelay,
    04334                    uint16_t maxDelay,
    04335                    uint32_t blockSize);
    04336
    04347   void arm_fir_sparse_q31(
    04348               arm_fir_sparse_instance_q31 * S,
    04349                q31_t * pSrc,
    04350               q31_t * pDst,
    04351               q31_t * pScratchIn,
    04352               uint32_t blockSize);
    04353
    04366   void arm_fir_sparse_init_q31(
    04367                    arm_fir_sparse_instance_q31 * S,
    04368                    uint16_t numTaps,
    04369                    q31_t * pCoeffs,
    04370                    q31_t * pState,
    04371                    int32_t * pTapDelay,
    04372                    uint16_t maxDelay,
    04373                    uint32_t blockSize);
    04374
    04386   void arm_fir_sparse_q15(
    04387               arm_fir_sparse_instance_q15 * S,
    04388                q15_t * pSrc,
    04389               q15_t * pDst,
    04390               q15_t * pScratchIn,
    04391               q31_t * pScratchOut,
    04392               uint32_t blockSize);
    04393
    04394
    04407   void arm_fir_sparse_init_q15(
    04408                    arm_fir_sparse_instance_q15 * S,
    04409                    uint16_t numTaps,
    04410                    q15_t * pCoeffs,
    04411                    q15_t * pState,
    04412                    int32_t * pTapDelay,
    04413                    uint16_t maxDelay,
    04414                    uint32_t blockSize);
    04415
    04427   void arm_fir_sparse_q7(
    04428              arm_fir_sparse_instance_q7 * S,
    04429               q7_t * pSrc,
    04430              q7_t * pDst,
    04431              q7_t * pScratchIn,
    04432              q31_t * pScratchOut,
    04433              uint32_t blockSize);
    04434
    04447   void arm_fir_sparse_init_q7(
    04448                   arm_fir_sparse_instance_q7 * S,
    04449                   uint16_t numTaps,
    04450                   q7_t * pCoeffs,
    04451                   q7_t * pState,
    04452                   int32_t *pTapDelay,
    04453                   uint16_t maxDelay,
    04454                   uint32_t blockSize);
    04455
    04456
    04457   /*
    04458    * @brief  Floating-point sin_cos function.
    04459    * @param[in]  theta    input value in degrees
    04460    * @param[out] *pSinVal points to the processed sine output.
    04461    * @param[out] *pCosVal points to the processed cos output.
    04462    * @return none.
    04463    */
    04464
    04465   void arm_sin_cos_f32(
    04466                float32_t theta,
    04467                float32_t *pSinVal,
    04468                float32_t *pCcosVal);
    04469
    04470   /*
    04471    * @brief  Q31 sin_cos function.
    04472    * @param[in]  theta    scaled input value in degrees
    04473    * @param[out] *pSinVal points to the processed sine output.
    04474    * @param[out] *pCosVal points to the processed cosine output.
    04475    * @return none.
    04476    */
    04477
    04478   void arm_sin_cos_q31(
    04479                q31_t theta,
    04480                q31_t *pSinVal,
    04481                q31_t *pCosVal);
    04482
    04483
    04492   void arm_cmplx_conj_f32(
    04493                float32_t * pSrc,
    04494               float32_t * pDst,
    04495               uint32_t numSamples);
    04496
    04505   void arm_cmplx_conj_q31(
    04506                q31_t * pSrc,
    04507               q31_t * pDst,
    04508               uint32_t numSamples);
    04509
    04518   void arm_cmplx_conj_q15(
    04519                q15_t * pSrc,
    04520               q15_t * pDst,
    04521               uint32_t numSamples);
    04522
    04523
    04524
    04533   void arm_cmplx_mag_squared_f32(
    04534                   float32_t * pSrc,
    04535                  float32_t * pDst,
    04536                  uint32_t numSamples);
    04537
    04546   void arm_cmplx_mag_squared_q31(
    04547                   q31_t * pSrc,
    04548                  q31_t * pDst,
    04549                  uint32_t numSamples);
    04550
    04559   void arm_cmplx_mag_squared_q15(
    04560                   q15_t * pSrc,
    04561                  q15_t * pDst,
    04562                  uint32_t numSamples);
    04563
    04564
    04639   static __INLINE float32_t arm_pid_f32(
    04640                     arm_pid_instance_f32 * S,
    04641                     float32_t in)
    04642   {
    04643     float32_t out;
    04644
    04645     /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]  */
    04646     out = (S->A0 * in) +
    04647       (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
    04648
    04649     /* Update state */
    04650     S->state[1] = S->state[0];
    04651     S->state[0] = in;
    04652     S->state[2] = out;
    04653
    04654     /* return to application */
    04655     return (out);
    04656
    04657   }
    04658
    04674   static __INLINE q31_t arm_pid_q31(
    04675                     arm_pid_instance_q31 * S,
    04676                     q31_t in)
    04677   {
    04678     q63_t acc;
    04679     q31_t out;
    04680
    04681     /* acc = A0 * x[n]  */
    04682     acc = (q63_t) S->A0 * in;
    04683
    04684     /* acc += A1 * x[n-1] */
    04685     acc += (q63_t) S->A1 * S->state[0];
    04686
    04687     /* acc += A2 * x[n-2]  */
    04688     acc += (q63_t) S->A2 * S->state[1];
    04689
    04690     /* convert output to 1.31 format to add y[n-1] */
    04691     out = (q31_t) (acc >> 31u);
    04692
    04693     /* out += y[n-1] */
    04694     out += S->state[2];
    04695
    04696     /* Update state */
    04697     S->state[1] = S->state[0];
    04698     S->state[0] = in;
    04699     S->state[2] = out;
    04700
    04701     /* return to application */
    04702     return (out);
    04703
    04704   }
    04705
    04722   static __INLINE q15_t arm_pid_q15(
    04723                     arm_pid_instance_q15 * S,
    04724                     q15_t in)
    04725   {
    04726     q63_t acc;
    04727     q15_t out;
    04728
    04729     /* Implementation of PID controller */
    04730
    04731     /* acc = A0 * x[n]  */
    04732     acc = (q31_t) __SMUAD(S->A0, in);
    04733
    04734     /* acc += A1 * x[n-1] + A2 * x[n-2]  */
    04735     acc = __SMLALD(S->A1, (q31_t)__SIMD32(S->state), acc);
    04736
    04737     /* acc += y[n-1] */
    04738     acc += (q31_t) S->state[2] << 15;
    04739
    04740     /* saturate the output */
    04741     out = (q15_t) (__SSAT((acc >> 15), 16));
    04742
    04743     /* Update state */
    04744     S->state[1] = S->state[0];
    04745     S->state[0] = in;
    04746     S->state[2] = out;
    04747
    04748     /* return to application */
    04749     return (out);
    04750
    04751   }
    04752
    04766   arm_status arm_mat_inverse_f32(
    04767                  const arm_matrix_instance_f32 * src,
    04768                  arm_matrix_instance_f32 * dst);
    04769
    04770
    04771
    04814   static __INLINE void arm_clarke_f32(
    04815                       float32_t Ia,
    04816                       float32_t Ib,
    04817                       float32_t * pIalpha,
    04818                       float32_t * pIbeta)
    04819   {
    04820     /* Calculate pIalpha using the equation, pIalpha = Ia */
    04821     *pIalpha = Ia;
    04822
    04823     /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
    04824     *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
    04825
    04826   }
    04827
    04843   static __INLINE void arm_clarke_q31(
    04844                       q31_t Ia,
    04845                       q31_t Ib,
    04846                       q31_t * pIalpha,
    04847                       q31_t * pIbeta)
    04848   {
    04849     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
    04850
    04851     /* Calculating pIalpha from Ia by equation pIalpha = Ia */
    04852     *pIalpha = Ia;
    04853
    04854     /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
    04855     product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
    04856
    04857     /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
    04858     product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
    04859
    04860     /* pIbeta is calculated by adding the intermediate products */
    04861     *pIbeta = __QADD(product1, product2);
    04862   }
    04863
    04875   void arm_q7_to_q31(
    04876              q7_t * pSrc,
    04877              q31_t * pDst,
    04878              uint32_t blockSize);
    04879
    04880
    04881
    04882
    04918   static __INLINE void arm_inv_clarke_f32(
    04919                       float32_t Ialpha,
    04920                       float32_t Ibeta,
    04921                       float32_t * pIa,
    04922                       float32_t * pIb)
    04923   {
    04924     /* Calculating pIa from Ialpha by equation pIa = Ialpha */
    04925     *pIa = Ialpha;
    04926
    04927     /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
    04928     *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
    04929
    04930   }
    04931
    04947   static __INLINE void arm_inv_clarke_q31(
    04948                       q31_t Ialpha,
    04949                       q31_t Ibeta,
    04950                       q31_t * pIa,
    04951                       q31_t * pIb)
    04952   {
    04953     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
    04954
    04955     /* Calculating pIa from Ialpha by equation pIa = Ialpha */
    04956     *pIa = Ialpha;
    04957
    04958     /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
    04959     product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
    04960
    04961     /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
    04962     product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
    04963
    04964     /* pIb is calculated by subtracting the products */
    04965     *pIb = __QSUB(product2, product1);
    04966
    04967   }
    04968
    04980   void arm_q7_to_q15(
    04981               q7_t * pSrc,
    04982              q15_t * pDst,
    04983              uint32_t blockSize);
    04984
    04985
    04986
    05034   static __INLINE void arm_park_f32(
    05035                     float32_t Ialpha,
    05036                     float32_t Ibeta,
    05037                     float32_t * pId,
    05038                     float32_t * pIq,
    05039                     float32_t sinVal,
    05040                     float32_t cosVal)
    05041   {
    05042     /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
    05043     *pId = Ialpha * cosVal + Ibeta * sinVal;
    05044
    05045     /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
    05046     *pIq = -Ialpha * sinVal + Ibeta * cosVal;
    05047
    05048   }
    05049
    05068   static __INLINE void arm_park_q31(
    05069                     q31_t Ialpha,
    05070                     q31_t Ibeta,
    05071                     q31_t * pId,
    05072                     q31_t * pIq,
    05073                     q31_t sinVal,
    05074                     q31_t cosVal)
    05075   {
    05076     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
    05077     q31_t product3, product4;                    /* Temporary variables used to store intermediate results */
    05078
    05079     /* Intermediate product is calculated by (Ialpha * cosVal) */
    05080     product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
    05081
    05082     /* Intermediate product is calculated by (Ibeta * sinVal) */
    05083     product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
    05084
    05085
    05086     /* Intermediate product is calculated by (Ialpha * sinVal) */
    05087     product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
    05088
    05089     /* Intermediate product is calculated by (Ibeta * cosVal) */
    05090     product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
    05091
    05092     /* Calculate pId by adding the two intermediate products 1 and 2 */
    05093     *pId = __QADD(product1, product2);
    05094
    05095     /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
    05096     *pIq = __QSUB(product4, product3);
    05097   }
    05098
    05110   void arm_q7_to_float(
    05111                 q7_t * pSrc,
    05112                float32_t * pDst,
    05113                uint32_t blockSize);
    05114
    05115
    05153   static __INLINE void arm_inv_park_f32(
    05154                     float32_t Id,
    05155                     float32_t Iq,
    05156                     float32_t * pIalpha,
    05157                     float32_t * pIbeta,
    05158                     float32_t sinVal,
    05159                     float32_t cosVal)
    05160   {
    05161     /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
    05162     *pIalpha = Id * cosVal - Iq * sinVal;
    05163
    05164     /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
    05165     *pIbeta = Id * sinVal + Iq * cosVal;
    05166
    05167   }
    05168
    05169
    05188   static __INLINE void arm_inv_park_q31(
    05189                     q31_t Id,
    05190                     q31_t Iq,
    05191                     q31_t * pIalpha,
    05192                     q31_t * pIbeta,
    05193                     q31_t sinVal,
    05194                     q31_t cosVal)
    05195   {
    05196     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
    05197     q31_t product3, product4;                    /* Temporary variables used to store intermediate results */
    05198
    05199     /* Intermediate product is calculated by (Id * cosVal) */
    05200     product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
    05201
    05202     /* Intermediate product is calculated by (Iq * sinVal) */
    05203     product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
    05204
    05205
    05206     /* Intermediate product is calculated by (Id * sinVal) */
    05207     product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
    05208
    05209     /* Intermediate product is calculated by (Iq * cosVal) */
    05210     product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
    05211
    05212     /* Calculate pIalpha by using the two intermediate products 1 and 2 */
    05213     *pIalpha = __QSUB(product1, product2);
    05214
    05215     /* Calculate pIbeta by using the two intermediate products 3 and 4 */
    05216     *pIbeta = __QADD(product4, product3);
    05217
    05218   }
    05219
    05232   void arm_q31_to_float(
    05233              q31_t * pSrc,
    05234             float32_t * pDst,
    05235             uint32_t blockSize);
    05236
    05286   static __INLINE float32_t arm_linear_interp_f32(
    05287                           arm_linear_interp_instance_f32 * S,
    05288                           float32_t x)
    05289   {
    05290
    05291       float32_t y;
    05292       float32_t x0, x1;                     /* Nearest input values */
    05293       float32_t y0, y1;                     /* Nearest output values */
    05294       float32_t xSpacing = S->xSpacing;     /* spacing between input values */
    05295       int32_t i;                            /* Index variable */
    05296       float32_t *pYData = S->pYData;        /* pointer to output table */
    05297
    05298       /* Calculation of index */
    05299       i =   (x - S->x1) / xSpacing;
    05300
    05301       if(i < 0)
    05302       {
    05303          /* Iniatilize output for below specified range as least output value of table */
    05304          y = pYData[0];
    05305       }
    05306       else if(i >= S->nValues)
    05307       {
    05308           /* Iniatilize output for above specified range as last output value of table */
    05309           y = pYData[S->nValues-1];
    05310       }
    05311       else
    05312       {
    05313           /* Calculation of nearest input values */
    05314           x0 = S->x1 + i * xSpacing;
    05315           x1 = S->x1 + (i +1) * xSpacing;
    05316
    05317          /* Read of nearest output values */
    05318           y0 = pYData[i];
    05319           y1 = pYData[i + 1];
    05320
    05321           /* Calculation of output */
    05322           y = y0 + (x - x0) * ((y1 - y0)/(x1-x0));
    05323
    05324       }
    05325
    05326       /* returns output value */
    05327       return (y);
    05328   }
    05329
    05345   static __INLINE q31_t arm_linear_interp_q31(q31_t *pYData,
    05346                           q31_t x, uint32_t nValues)
    05347   {
    05348     q31_t y;                                   /* output */
    05349     q31_t y0, y1;                                /* Nearest output values */
    05350     q31_t fract;                                 /* fractional part */
    05351     int32_t index;                              /* Index to read nearest output values */
    05352
    05353     /* Input is in 12.20 format */
    05354     /* 12 bits for the table index */
    05355     /* Index value calculation */
    05356     index = ((x & 0xFFF00000) >> 20);
    05357
    05358     if(index >= (nValues - 1))
    05359     {
    05360         return(pYData[nValues - 1]);
    05361     }
    05362     else if(index < 0)
    05363     {
    05364         return(pYData[0]);
    05365     }
    05366     else
    05367     {
    05368
    05369         /* 20 bits for the fractional part */
    05370         /* shift left by 11 to keep fract in 1.31 format */
    05371         fract = (x & 0x000FFFFF) << 11;
    05372
    05373         /* Read two nearest output values from the index in 1.31(q31) format */
    05374         y0 = pYData[index];
    05375         y1 = pYData[index + 1u];
    05376
    05377         /* Calculation of y0 * (1-fract) and y is in 2.30 format */
    05378         y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
    05379
    05380         /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
    05381         y += ((q31_t) (((q63_t) y1 * fract) >> 32));
    05382
    05383         /* Convert y to 1.31 format */
    05384         return (y << 1u);
    05385
    05386     }
    05387
    05388   }
    05389
    05405   static __INLINE q15_t arm_linear_interp_q15(q15_t *pYData, q31_t x, uint32_t nValues)
    05406   {
    05407     q63_t y;                                   /* output */
    05408     q15_t y0, y1;                              /* Nearest output values */
    05409     q31_t fract;                               /* fractional part */
    05410     int32_t index;                            /* Index to read nearest output values */
    05411
    05412     /* Input is in 12.20 format */
    05413     /* 12 bits for the table index */
    05414     /* Index value calculation */
    05415     index = ((x & 0xFFF00000) >> 20u);
    05416
    05417     if(index >= (nValues - 1))
    05418     {
    05419         return(pYData[nValues - 1]);
    05420     }
    05421     else if(index < 0)
    05422     {
    05423         return(pYData[0]);
    05424     }
    05425     else
    05426     {
    05427         /* 20 bits for the fractional part */
    05428         /* fract is in 12.20 format */
    05429         fract = (x & 0x000FFFFF);
    05430
    05431         /* Read two nearest output values from the index */
    05432         y0 = pYData[index];
    05433         y1 = pYData[index + 1u];
    05434
    05435         /* Calculation of y0 * (1-fract) and y is in 13.35 format */
    05436         y = ((q63_t) y0 * (0xFFFFF - fract));
    05437
    05438         /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
    05439         y += ((q63_t) y1 * (fract));
    05440
    05441         /* convert y to 1.15 format */
    05442         return (y >> 20);
    05443     }
    05444
    05445
    05446   }
    05447
    05462   static __INLINE q7_t arm_linear_interp_q7(q7_t *pYData, q31_t x,  uint32_t nValues)
    05463   {
    05464     q31_t y;                                   /* output */
    05465     q7_t y0, y1;                                 /* Nearest output values */
    05466     q31_t fract;                                 /* fractional part */
    05467     int32_t index;                              /* Index to read nearest output values */
    05468
    05469     /* Input is in 12.20 format */
    05470     /* 12 bits for the table index */
    05471     /* Index value calculation */
    05472     index = ((x & 0xFFF00000) >> 20u);
    05473
    05474
    05475     if(index >= (nValues - 1))
    05476     {
    05477         return(pYData[nValues - 1]);
    05478     }
    05479     else if(index < 0)
    05480     {
    05481         return(pYData[0]);
    05482     }
    05483     else
    05484     {
    05485
    05486         /* 20 bits for the fractional part */
    05487         /* fract is in 12.20 format */
    05488         fract = (x & 0x000FFFFF);
    05489
    05490         /* Read two nearest output values from the index and are in 1.7(q7) format */
    05491         y0 = pYData[index];
    05492         y1 = pYData[index + 1u];
    05493
    05494         /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
    05495         y = ((y0 * (0xFFFFF - fract)));
    05496
    05497         /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
    05498         y += (y1 * fract);
    05499
    05500         /* convert y to 1.7(q7) format */
    05501         return (y >> 20u);
    05502
    05503     }
    05504
    05505   }
    05516   float32_t arm_sin_f32(
    05517              float32_t x);
    05518
    05525   q31_t arm_sin_q31(
    05526              q31_t x);
    05527
    05534   q15_t arm_sin_q15(
    05535              q15_t x);
    05536
    05543   float32_t arm_cos_f32(
    05544              float32_t x);
    05545
    05552   q31_t arm_cos_q31(
    05553              q31_t x);
    05554
    05561   q15_t arm_cos_q15(
    05562              q15_t x);
    05563
    05564
    05604   static __INLINE arm_status  arm_sqrt_f32(
    05605                       float32_t in, float32_t *pOut)
    05606   {
    05607     float32_t out;
    05608     float32_t prevOut;
    05609
    05610     if(in > 0)
    05611     {
    05612         /* Take initial guess as half the input */
    05613         prevOut = in / 2;
    05614
    05615         /* run for ten iterations */
    05616         out = 0.5f * (prevOut + (in / prevOut));
    05617         prevOut = 0.5f * (out + (in / out));
    05618
    05619         /* Third iteration */
    05620         out = 0.5f * (prevOut + (in / prevOut));
    05621         prevOut = 0.5f * (out + (in / out));
    05622
    05623         /* Fifth iteration */
    05624         out = 0.5f * (prevOut + (in / prevOut));
    05625         prevOut = 0.5f * (out + (in / out));
    05626
    05627         /* Seventh iteration */
    05628         out = 0.5f * (prevOut + (in / prevOut));
    05629         prevOut = 0.5f * (out + (in / out));
    05630         out = 0.5f * (prevOut + (in / prevOut));
    05631
    05632         /* tenth iteration */
    05633         *pOut = 0.5f * (out + (in / out));
    05634         return (ARM_MATH_SUCCESS);
    05635     }
    05636     else
    05637     {
    05638         *pOut = 0.0f;
    05639         return (ARM_MATH_ARGUMENT_ERROR);
    05640     }
    05641
    05642   }
    05643
    05644
    05652   arm_status arm_sqrt_q31(
    05653               q31_t in, q31_t *pOut);
    05654
    05662   arm_status arm_sqrt_q15(
    05663               q15_t in, q15_t *pOut);
    05664
    05678   static __INLINE void arm_circularWrite_f32(
    05679                          int32_t * circBuffer,
    05680                          int32_t L,
    05681                          uint16_t * writeOffset,
    05682                          int32_t bufferInc,
    05683                          const int32_t * src,
    05684                          int32_t srcInc,
    05685                          uint32_t blockSize)
    05686   {
    05687     uint32_t i = 0u;
    05688     int32_t wOffset;
    05689
    05690     /* Copy the value of Index pointer that points
    05691      * to the current location where the input samples to be copied */
    05692     wOffset = *writeOffset;
    05693
    05694     /* Loop over the blockSize */
    05695     i = blockSize;
    05696
    05697     while(i > 0u)
    05698       {
    05699     /* copy the input sample to the circular buffer */
    05700     circBuffer[wOffset] = *src;
    05701
    05702     /* Update the input pointer */
    05703     src += srcInc;
    05704
    05705     /* Circularly update wOffset.  Watch out for positive and negative value */
    05706     wOffset += bufferInc;
    05707     if(wOffset >= L)
    05708       wOffset -= L;
    05709
    05710     /* Decrement the loop counter */
    05711     i--;
    05712       }
    05713
    05714     /* Update the index pointer */
    05715     *writeOffset = wOffset;
    05716   }
    05717
    05718
    05719
    05723   static __INLINE void arm_circularRead_f32(
    05724                         int32_t * circBuffer,
    05725                         int32_t L,
    05726                         int32_t * readOffset,
    05727                         int32_t bufferInc,
    05728                         int32_t * dst,
    05729                         int32_t * dst_base,
    05730                         int32_t dst_length,
    05731                         int32_t dstInc,
    05732                         uint32_t blockSize)
    05733   {
    05734     uint32_t i = 0u;
    05735     int32_t rOffset, dst_end;
    05736
    05737     /* Copy the value of Index pointer that points
    05738      * to the current location from where the input samples to be read */
    05739     rOffset = *readOffset;
    05740     dst_end = (int32_t) (dst_base + dst_length);
    05741
    05742     /* Loop over the blockSize */
    05743     i = blockSize;
    05744
    05745     while(i > 0u)
    05746       {
    05747     /* copy the sample from the circular buffer to the destination buffer */
    05748     *dst = circBuffer[rOffset];
    05749
    05750     /* Update the input pointer */
    05751     dst += dstInc;
    05752
    05753     if(dst == (int32_t *) dst_end)
    05754       {
    05755         dst = dst_base;
    05756       }
    05757
    05758     /* Circularly update rOffset.  Watch out for positive and negative value  */
    05759     rOffset += bufferInc;
    05760
    05761     if(rOffset >= L)
    05762       {
    05763         rOffset -= L;
    05764       }
    05765
    05766     /* Decrement the loop counter */
    05767     i--;
    05768       }
    05769
    05770     /* Update the index pointer */
    05771     *readOffset = rOffset;
    05772   }
    05773
    05778   static __INLINE void arm_circularWrite_q15(
    05779                          q15_t * circBuffer,
    05780                          int32_t L,
    05781                          uint16_t * writeOffset,
    05782                          int32_t bufferInc,
    05783                          const q15_t * src,
    05784                          int32_t srcInc,
    05785                          uint32_t blockSize)
    05786   {
    05787     uint32_t i = 0u;
    05788     int32_t wOffset;
    05789
    05790     /* Copy the value of Index pointer that points
    05791      * to the current location where the input samples to be copied */
    05792     wOffset = *writeOffset;
    05793
    05794     /* Loop over the blockSize */
    05795     i = blockSize;
    05796
    05797     while(i > 0u)
    05798       {
    05799     /* copy the input sample to the circular buffer */
    05800     circBuffer[wOffset] = *src;
    05801
    05802     /* Update the input pointer */
    05803     src += srcInc;
    05804
    05805     /* Circularly update wOffset.  Watch out for positive and negative value */
    05806     wOffset += bufferInc;
    05807     if(wOffset >= L)
    05808       wOffset -= L;
    05809
    05810     /* Decrement the loop counter */
    05811     i--;
    05812       }
    05813
    05814     /* Update the index pointer */
    05815     *writeOffset = wOffset;
    05816   }
    05817
    05818
    05819
    05823   static __INLINE void arm_circularRead_q15(
    05824                         q15_t * circBuffer,
    05825                         int32_t L,
    05826                         int32_t * readOffset,
    05827                         int32_t bufferInc,
    05828                         q15_t * dst,
    05829                         q15_t * dst_base,
    05830                         int32_t dst_length,
    05831                         int32_t dstInc,
    05832                         uint32_t blockSize)
    05833   {
    05834     uint32_t i = 0;
    05835     int32_t rOffset, dst_end;
    05836
    05837     /* Copy the value of Index pointer that points
    05838      * to the current location from where the input samples to be read */
    05839     rOffset = *readOffset;
    05840
    05841     dst_end = (int32_t) (dst_base + dst_length);
    05842
    05843     /* Loop over the blockSize */
    05844     i = blockSize;
    05845
    05846     while(i > 0u)
    05847       {
    05848     /* copy the sample from the circular buffer to the destination buffer */
    05849     *dst = circBuffer[rOffset];
    05850
    05851     /* Update the input pointer */
    05852     dst += dstInc;
    05853
    05854     if(dst == (q15_t *) dst_end)
    05855       {
    05856         dst = dst_base;
    05857       }
    05858
    05859     /* Circularly update wOffset.  Watch out for positive and negative value */
    05860     rOffset += bufferInc;
    05861
    05862     if(rOffset >= L)
    05863       {
    05864         rOffset -= L;
    05865       }
    05866
    05867     /* Decrement the loop counter */
    05868     i--;
    05869       }
    05870
    05871     /* Update the index pointer */
    05872     *readOffset = rOffset;
    05873   }
    05874
    05875
    05880   static __INLINE void arm_circularWrite_q7(
    05881                         q7_t * circBuffer,
    05882                         int32_t L,
    05883                         uint16_t * writeOffset,
    05884                         int32_t bufferInc,
    05885                         const q7_t * src,
    05886                         int32_t srcInc,
    05887                         uint32_t blockSize)
    05888   {
    05889     uint32_t i = 0u;
    05890     int32_t wOffset;
    05891
    05892     /* Copy the value of Index pointer that points
    05893      * to the current location where the input samples to be copied */
    05894     wOffset = *writeOffset;
    05895
    05896     /* Loop over the blockSize */
    05897     i = blockSize;
    05898
    05899     while(i > 0u)
    05900       {
    05901     /* copy the input sample to the circular buffer */
    05902     circBuffer[wOffset] = *src;
    05903
    05904     /* Update the input pointer */
    05905     src += srcInc;
    05906
    05907     /* Circularly update wOffset.  Watch out for positive and negative value */
    05908     wOffset += bufferInc;
    05909     if(wOffset >= L)
    05910       wOffset -= L;
    05911
    05912     /* Decrement the loop counter */
    05913     i--;
    05914       }
    05915
    05916     /* Update the index pointer */
    05917     *writeOffset = wOffset;
    05918   }
    05919
    05920
    05921
    05925   static __INLINE void arm_circularRead_q7(
    05926                        q7_t * circBuffer,
    05927                        int32_t L,
    05928                        int32_t * readOffset,
    05929                        int32_t bufferInc,
    05930                        q7_t * dst,
    05931                        q7_t * dst_base,
    05932                        int32_t dst_length,
    05933                        int32_t dstInc,
    05934                        uint32_t blockSize)
    05935   {
    05936     uint32_t i = 0;
    05937     int32_t rOffset, dst_end;
    05938
    05939     /* Copy the value of Index pointer that points
    05940      * to the current location from where the input samples to be read */
    05941     rOffset = *readOffset;
    05942
    05943     dst_end = (int32_t) (dst_base + dst_length);
    05944
    05945     /* Loop over the blockSize */
    05946     i = blockSize;
    05947
    05948     while(i > 0u)
    05949       {
    05950     /* copy the sample from the circular buffer to the destination buffer */
    05951     *dst = circBuffer[rOffset];
    05952
    05953     /* Update the input pointer */
    05954     dst += dstInc;
    05955
    05956     if(dst == (q7_t *) dst_end)
    05957       {
    05958         dst = dst_base;
    05959       }
    05960
    05961     /* Circularly update rOffset.  Watch out for positive and negative value */
    05962     rOffset += bufferInc;
    05963
    05964     if(rOffset >= L)
    05965       {
    05966         rOffset -= L;
    05967       }
    05968
    05969     /* Decrement the loop counter */
    05970     i--;
    05971       }
    05972
    05973     /* Update the index pointer */
    05974     *readOffset = rOffset;
    05975   }
    05976
    05977
    05986   void arm_power_q31(
    05987               q31_t * pSrc,
    05988              uint32_t blockSize,
    05989              q63_t * pResult);
    05990
    05999   void arm_power_f32(
    06000               float32_t * pSrc,
    06001              uint32_t blockSize,
    06002              float32_t * pResult);
    06003
    06012   void arm_power_q15(
    06013               q15_t * pSrc,
    06014              uint32_t blockSize,
    06015              q63_t * pResult);
    06016
    06025   void arm_power_q7(
    06026              q7_t * pSrc,
    06027             uint32_t blockSize,
    06028             q31_t * pResult);
    06029
    06038   void arm_mean_q7(
    06039             q7_t * pSrc,
    06040            uint32_t blockSize,
    06041            q7_t * pResult);
    06042
    06050   void arm_mean_q15(
    06051              q15_t * pSrc,
    06052             uint32_t blockSize,
    06053             q15_t * pResult);
    06054
    06062   void arm_mean_q31(
    06063              q31_t * pSrc,
    06064             uint32_t blockSize,
    06065             q31_t * pResult);
    06066
    06074   void arm_mean_f32(
    06075              float32_t * pSrc,
    06076             uint32_t blockSize,
    06077             float32_t * pResult);
    06078
    06087   void arm_var_f32(
    06088             float32_t * pSrc,
    06089            uint32_t blockSize,
    06090            float32_t * pResult);
    06091
    06100   void arm_var_q31(
    06101             q31_t * pSrc,
    06102            uint32_t blockSize,
    06103            q63_t * pResult);
    06104
    06113   void arm_var_q15(
    06114             q15_t * pSrc,
    06115            uint32_t blockSize,
    06116            q31_t * pResult);
    06117
    06126   void arm_rms_f32(
    06127             float32_t * pSrc,
    06128            uint32_t blockSize,
    06129            float32_t * pResult);
    06130
    06139   void arm_rms_q31(
    06140             q31_t * pSrc,
    06141            uint32_t blockSize,
    06142            q31_t * pResult);
    06143
    06152   void arm_rms_q15(
    06153             q15_t * pSrc,
    06154            uint32_t blockSize,
    06155            q15_t * pResult);
    06156
    06165   void arm_std_f32(
    06166             float32_t * pSrc,
    06167            uint32_t blockSize,
    06168            float32_t * pResult);
    06169
    06178   void arm_std_q31(
    06179             q31_t * pSrc,
    06180            uint32_t blockSize,
    06181            q31_t * pResult);
    06182
    06191   void arm_std_q15(
    06192             q15_t * pSrc,
    06193            uint32_t blockSize,
    06194            q15_t * pResult);
    06195
    06204   void arm_cmplx_mag_f32(
    06205               float32_t * pSrc,
    06206              float32_t * pDst,
    06207              uint32_t numSamples);
    06208
    06217   void arm_cmplx_mag_q31(
    06218               q31_t * pSrc,
    06219              q31_t * pDst,
    06220              uint32_t numSamples);
    06221
    06230   void arm_cmplx_mag_q15(
    06231               q15_t * pSrc,
    06232              q15_t * pDst,
    06233              uint32_t numSamples);
    06234
    06245   void arm_cmplx_dot_prod_q15(
    06246                    q15_t * pSrcA,
    06247                    q15_t * pSrcB,
    06248                   uint32_t numSamples,
    06249                   q31_t * realResult,
    06250                   q31_t * imagResult);
    06251
    06262   void arm_cmplx_dot_prod_q31(
    06263                    q31_t * pSrcA,
    06264                    q31_t * pSrcB,
    06265                   uint32_t numSamples,
    06266                   q63_t * realResult,
    06267                   q63_t * imagResult);
    06268
    06279   void arm_cmplx_dot_prod_f32(
    06280                    float32_t * pSrcA,
    06281                    float32_t * pSrcB,
    06282                   uint32_t numSamples,
    06283                   float32_t * realResult,
    06284                   float32_t * imagResult);
    06285
    06295   void arm_cmplx_mult_real_q15(
    06296                     q15_t * pSrcCmplx,
    06297                     q15_t * pSrcReal,
    06298                    q15_t * pCmplxDst,
    06299                    uint32_t numSamples);
    06300
    06310   void arm_cmplx_mult_real_q31(
    06311                     q31_t * pSrcCmplx,
    06312                     q31_t * pSrcReal,
    06313                    q31_t * pCmplxDst,
    06314                    uint32_t numSamples);
    06315
    06325   void arm_cmplx_mult_real_f32(
    06326                     float32_t * pSrcCmplx,
    06327                     float32_t * pSrcReal,
    06328                    float32_t * pCmplxDst,
    06329                    uint32_t numSamples);
    06330
    06340   void arm_min_q7(
    06341            q7_t * pSrc,
    06342           uint32_t blockSize,
    06343           q7_t * result,
    06344           uint32_t * index);
    06345
    06355   void arm_min_q15(
    06356             q15_t * pSrc,
    06357            uint32_t blockSize,
    06358            q15_t * pResult,
    06359            uint32_t * pIndex);
    06360
    06369   void arm_min_q31(
    06370             q31_t * pSrc,
    06371            uint32_t blockSize,
    06372            q31_t * pResult,
    06373            uint32_t * pIndex);
    06374
    06384   void arm_min_f32(
    06385             float32_t * pSrc,
    06386            uint32_t blockSize,
    06387            float32_t * pResult,
    06388            uint32_t * pIndex);
    06389
    06399   void arm_max_q7(
    06400            q7_t * pSrc,
    06401           uint32_t blockSize,
    06402           q7_t * pResult,
    06403           uint32_t * pIndex);
    06404
    06414   void arm_max_q15(
    06415             q15_t * pSrc,
    06416            uint32_t blockSize,
    06417            q15_t * pResult,
    06418            uint32_t * pIndex);
    06419
    06429   void arm_max_q31(
    06430             q31_t * pSrc,
    06431            uint32_t blockSize,
    06432            q31_t * pResult,
    06433            uint32_t * pIndex);
    06434
    06444   void arm_max_f32(
    06445             float32_t * pSrc,
    06446            uint32_t blockSize,
    06447            float32_t * pResult,
    06448            uint32_t * pIndex);
    06449
    06459   void arm_cmplx_mult_cmplx_q15(
    06460                     q15_t * pSrcA,
    06461                     q15_t * pSrcB,
    06462                    q15_t * pDst,
    06463                    uint32_t numSamples);
    06464
    06474   void arm_cmplx_mult_cmplx_q31(
    06475                     q31_t * pSrcA,
    06476                     q31_t * pSrcB,
    06477                    q31_t * pDst,
    06478                    uint32_t numSamples);
    06479
    06489   void arm_cmplx_mult_cmplx_f32(
    06490                     float32_t * pSrcA,
    06491                     float32_t * pSrcB,
    06492                    float32_t * pDst,
    06493                    uint32_t numSamples);
    06494
    06502   void arm_float_to_q31(
    06503                    float32_t * pSrc,
    06504                   q31_t * pDst,
    06505                   uint32_t blockSize);
    06506
    06514   void arm_float_to_q15(
    06515                    float32_t * pSrc,
    06516                   q15_t * pDst,
    06517                   uint32_t blockSize);
    06518
    06526   void arm_float_to_q7(
    06527                   float32_t * pSrc,
    06528                  q7_t * pDst,
    06529                  uint32_t blockSize);
    06530
    06531
    06539   void arm_q31_to_q15(
    06540                q31_t * pSrc,
    06541               q15_t * pDst,
    06542               uint32_t blockSize);
    06543
    06551   void arm_q31_to_q7(
    06552               q31_t * pSrc,
    06553              q7_t * pDst,
    06554              uint32_t blockSize);
    06555
    06563   void arm_q15_to_float(
    06564              q15_t * pSrc,
    06565             float32_t * pDst,
    06566             uint32_t blockSize);
    06567
    06568
    06576   void arm_q15_to_q31(
    06577                q15_t * pSrc,
    06578               q31_t * pDst,
    06579               uint32_t blockSize);
    06580
    06581
    06589   void arm_q15_to_q7(
    06590               q15_t * pSrc,
    06591              q7_t * pDst,
    06592              uint32_t blockSize);
    06593
    06594
    06666   static __INLINE float32_t arm_bilinear_interp_f32(
    06667                             const arm_bilinear_interp_instance_f32 * S,
    06668                             float32_t X,
    06669                             float32_t Y)
    06670   {
    06671     float32_t out;
    06672     float32_t f00, f01, f10, f11;
    06673     float32_t *pData = S->pData;
    06674     int32_t xIndex, yIndex, index;
    06675     float32_t xdiff, ydiff;
    06676     float32_t b1, b2, b3, b4;
    06677
    06678     xIndex = (int32_t) X;
    06679     yIndex = (int32_t) Y;
    06680
    06681     /* Care taken for table outside boundary */
    06682     /* Returns zero output when values are outside table boundary */
    06683     if(xIndex < 0 || xIndex > (S->numRows-1) || yIndex < 0  || yIndex > ( S->numCols-1))
    06684     {
    06685         return(0);
    06686     }
    06687
    06688     /* Calculation of index for two nearest points in X-direction */
    06689     index = (xIndex - 1) + (yIndex - 1) * S->numRows;
    06690
    06691
    06692     /* Read two nearest points in X-direction */
    06693     f00 = pData[index];
    06694     f01 = pData[index + 1];
    06695
    06696     /* Calculation of index for two nearest points in Y-direction */
    06697     index = (xIndex - 1) + (yIndex) * S->numRows;
    06698
    06699
    06700     /* Read two nearest points in Y-direction */
    06701     f10 = pData[index];
    06702     f11 = pData[index + 1];
    06703
    06704     /* Calculation of intermediate values */
    06705     b1 = f00;
    06706     b2 = f01 - f00;
    06707     b3 = f10 - f00;
    06708     b4 = f00 - f01 - f10 + f11;
    06709
    06710     /* Calculation of fractional part in X */
    06711     xdiff = X - xIndex;
    06712
    06713     /* Calculation of fractional part in Y */
    06714     ydiff = Y - yIndex;
    06715
    06716     /* Calculation of bi-linear interpolated output */
    06717     out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
    06718
    06719     /* return to application */
    06720     return (out);
    06721
    06722   }
    06723
    06733   static __INLINE q31_t arm_bilinear_interp_q31(
    06734                         arm_bilinear_interp_instance_q31 * S,
    06735                         q31_t X,
    06736                         q31_t Y)
    06737   {
    06738     q31_t out;                                   /* Temporary output */
    06739     q31_t acc = 0;                               /* output */
    06740     q31_t xfract, yfract;                        /* X, Y fractional parts */
    06741     q31_t x1, x2, y1, y2;                        /* Nearest output values */
    06742     int32_t rI, cI;                             /* Row and column indices */
    06743     q31_t *pYData = S->pData;                    /* pointer to output table values */
    06744     uint32_t nRows = S->numRows;                 /* num of rows */
    06745
    06746
    06747     /* Input is in 12.20 format */
    06748     /* 12 bits for the table index */
    06749     /* Index value calculation */
    06750     rI = ((X & 0xFFF00000) >> 20u);
    06751
    06752     /* Input is in 12.20 format */
    06753     /* 12 bits for the table index */
    06754     /* Index value calculation */
    06755     cI = ((Y & 0xFFF00000) >> 20u);
    06756
    06757     /* Care taken for table outside boundary */
    06758     /* Returns zero output when values are outside table boundary */
    06759     if(rI < 0 || rI > (S->numRows-1) || cI < 0  || cI > ( S->numCols-1))
    06760     {
    06761         return(0);
    06762     }
    06763
    06764     /* 20 bits for the fractional part */
    06765     /* shift left xfract by 11 to keep 1.31 format */
    06766     xfract = (X & 0x000FFFFF) << 11u;
    06767
    06768     /* Read two nearest output values from the index */
    06769     x1 = pYData[(rI) + nRows * (cI)];
    06770     x2 = pYData[(rI) + nRows * (cI) + 1u];
    06771
    06772     /* 20 bits for the fractional part */
    06773     /* shift left yfract by 11 to keep 1.31 format */
    06774     yfract = (Y & 0x000FFFFF) << 11u;
    06775
    06776     /* Read two nearest output values from the index */
    06777     y1 = pYData[(rI) + nRows * (cI + 1)];
    06778     y2 = pYData[(rI) + nRows * (cI + 1) + 1u];
    06779
    06780     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
    06781     out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
    06782     acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
    06783
    06784     /* x2 * (xfract) * (1-yfract)  in 3.29(q29) and adding to acc */
    06785     out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
    06786     acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
    06787
    06788     /* y1 * (1 - xfract) * (yfract)  in 3.29(q29) and adding to acc */
    06789     out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
    06790     acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
    06791
    06792     /* y2 * (xfract) * (yfract)  in 3.29(q29) and adding to acc */
    06793     out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
    06794     acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
    06795
    06796     /* Convert acc to 1.31(q31) format */
    06797     return (acc << 2u);
    06798
    06799   }
    06800
    06809   static __INLINE q15_t arm_bilinear_interp_q15(
    06810                         arm_bilinear_interp_instance_q15 * S,
    06811                         q31_t X,
    06812                         q31_t Y)
    06813   {
    06814     q63_t acc = 0;                               /* output */
    06815     q31_t out;                                   /* Temporary output */
    06816     q15_t x1, x2, y1, y2;                        /* Nearest output values */
    06817     q31_t xfract, yfract;                        /* X, Y fractional parts */
    06818     int32_t rI, cI;                             /* Row and column indices */
    06819     q15_t *pYData = S->pData;                    /* pointer to output table values */
    06820     uint32_t nRows = S->numRows;                 /* num of rows */
    06821
    06822     /* Input is in 12.20 format */
    06823     /* 12 bits for the table index */
    06824     /* Index value calculation */
    06825     rI = ((X & 0xFFF00000) >> 20);
    06826
    06827     /* Input is in 12.20 format */
    06828     /* 12 bits for the table index */
    06829     /* Index value calculation */
    06830     cI = ((Y & 0xFFF00000) >> 20);
    06831
    06832     /* Care taken for table outside boundary */
    06833     /* Returns zero output when values are outside table boundary */
    06834     if(rI < 0 || rI > (S->numRows-1) || cI < 0  || cI > ( S->numCols-1))
    06835     {
    06836         return(0);
    06837     }
    06838
    06839     /* 20 bits for the fractional part */
    06840     /* xfract should be in 12.20 format */
    06841     xfract = (X & 0x000FFFFF);
    06842
    06843     /* Read two nearest output values from the index */
    06844     x1 = pYData[(rI) + nRows * (cI)];
    06845     x2 = pYData[(rI) + nRows * (cI) + 1u];
    06846
    06847
    06848     /* 20 bits for the fractional part */
    06849     /* yfract should be in 12.20 format */
    06850     yfract = (Y & 0x000FFFFF);
    06851
    06852     /* Read two nearest output values from the index */
    06853     y1 = pYData[(rI) + nRows * (cI + 1)];
    06854     y2 = pYData[(rI) + nRows * (cI + 1) + 1u];
    06855
    06856     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
    06857
    06858     /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
    06859     /* convert 13.35 to 13.31 by right shifting  and out is in 1.31 */
    06860     out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
    06861     acc = ((q63_t) out * (0xFFFFF - yfract));
    06862
    06863     /* x2 * (xfract) * (1-yfract)  in 1.51 and adding to acc */
    06864     out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
    06865     acc += ((q63_t) out * (xfract));
    06866
    06867     /* y1 * (1 - xfract) * (yfract)  in 1.51 and adding to acc */
    06868     out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
    06869     acc += ((q63_t) out * (yfract));
    06870
    06871     /* y2 * (xfract) * (yfract)  in 1.51 and adding to acc */
    06872     out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
    06873     acc += ((q63_t) out * (yfract));
    06874
    06875     /* acc is in 13.51 format and down shift acc by 36 times */
    06876     /* Convert out to 1.15 format */
    06877     return (acc >> 36);
    06878
    06879   }
    06880
    06889   static __INLINE q7_t arm_bilinear_interp_q7(
    06890                           arm_bilinear_interp_instance_q7 * S,
    06891                           q31_t X,
    06892                           q31_t Y)
    06893   {
    06894     q63_t acc = 0;                               /* output */
    06895     q31_t out;                                   /* Temporary output */
    06896     q31_t xfract, yfract;                        /* X, Y fractional parts */
    06897     q7_t x1, x2, y1, y2;                         /* Nearest output values */
    06898     int32_t rI, cI;                             /* Row and column indices */
    06899     q7_t *pYData = S->pData;                     /* pointer to output table values */
    06900     uint32_t nRows = S->numRows;                 /* num of rows */
    06901
    06902     /* Input is in 12.20 format */
    06903     /* 12 bits for the table index */
    06904     /* Index value calculation */
    06905     rI = ((X & 0xFFF00000) >> 20);
    06906
    06907     /* Input is in 12.20 format */
    06908     /* 12 bits for the table index */
    06909     /* Index value calculation */
    06910     cI = ((Y & 0xFFF00000) >> 20);
    06911
    06912     /* Care taken for table outside boundary */
    06913     /* Returns zero output when values are outside table boundary */
    06914     if(rI < 0 || rI > (S->numRows-1) || cI < 0  || cI > ( S->numCols-1))
    06915     {
    06916         return(0);
    06917     }
    06918
    06919     /* 20 bits for the fractional part */
    06920     /* xfract should be in 12.20 format */
    06921     xfract = (X & 0x000FFFFF);
    06922
    06923     /* Read two nearest output values from the index */
    06924     x1 = pYData[(rI) + nRows * (cI)];
    06925     x2 = pYData[(rI) + nRows * (cI) + 1u];
    06926
    06927
    06928     /* 20 bits for the fractional part */
    06929     /* yfract should be in 12.20 format */
    06930     yfract = (Y & 0x000FFFFF);
    06931
    06932     /* Read two nearest output values from the index */
    06933     y1 = pYData[(rI) + nRows * (cI + 1)];
    06934     y2 = pYData[(rI) + nRows * (cI + 1) + 1u];
    06935
    06936     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
    06937     out = ((x1 * (0xFFFFF - xfract)));
    06938     acc = (((q63_t) out * (0xFFFFF - yfract)));
    06939
    06940     /* x2 * (xfract) * (1-yfract)  in 2.22 and adding to acc */
    06941     out = ((x2 * (0xFFFFF - yfract)));
    06942     acc += (((q63_t) out * (xfract)));
    06943
    06944     /* y1 * (1 - xfract) * (yfract)  in 2.22 and adding to acc */
    06945     out = ((y1 * (0xFFFFF - xfract)));
    06946     acc += (((q63_t) out * (yfract)));
    06947
    06948     /* y2 * (xfract) * (yfract)  in 2.22 and adding to acc */
    06949     out = ((y2 * (yfract)));
    06950     acc += (((q63_t) out * (xfract)));
    06951
    06952     /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
    06953     return (acc >> 40);
    06954
    06955   }
    06956
    06966 #ifdef  __cplusplus
    06967 }
    06968 #endif
    06969
    06970
    06971 #endif /* _ARM_MATH_H */
    06972
    06973

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines