00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00297 #ifndef _ARM_MATH_H
00298 #define _ARM_MATH_H
00299
00300 #include "core_r4_simd.h"
00301 #include "string.h"
00302 #include "type_defs.h"
00303
00304 #if !defined(FPU_PRESENT) || defined(__GNUC__)
00305 #include<math.h>
00306 #endif
00307
00308 #ifdef __cplusplus
00309 extern "C"
00310 {
00311 #endif
00312
00313
00318 #define DELTA_Q31 (0x100)
00319 #define DELTA_Q15 0x5
00320 #define INDEX_MASK 0x0000003F
00321 #define PI 3.14159265358979f
00322
00327 #define TABLE_SIZE 256
00328 #define TABLE_SPACING_Q31 0x800000
00329 #define TABLE_SPACING_Q15 0x80
00330
00334
00335
00336 #define INPUT_SPACING 0xB60B61
00337
00338
00343 typedef enum
00344 {
00345 ARM_MATH_SUCCESS = 0,
00346 ARM_MATH_ARGUMENT_ERROR = -1,
00347 ARM_MATH_LENGTH_ERROR = -2,
00348 ARM_MATH_SIZE_MISMATCH = -3,
00349 ARM_MATH_NANINF = -4,
00350 ARM_MATH_SINGULAR = -5,
00351 ARM_MATH_TEST_FAILURE = -6
00352 } arm_status;
00353
00354
00355
00356
00357
00361 #define __SIMD32(addr) (*(__packed int32_t **) & (addr))
00362
00363 #define __SIMD64(addr) (*(int64_t **) & (addr))
00364
00365 #define _SIMD32_OFFSET(addr) (*(__packed int32_t *) (addr))
00366
00367 #define _SIMD64_OFFSET(addr) (*(int64_t *) (addr))
00368
00372 #ifndef ARM_MATH_BIG_ENDIAN
00373
00374 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
00375 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
00376 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
00377 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
00378 #else
00379
00380 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
00381 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
00382 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
00383 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
00384
00385 #endif
00386
00387
00391 static INLINE q31_t clip_q63_to_q31(
00392 q63_t x)
00393 {
00394 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
00395 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
00396 }
00397
00401 static INLINE q15_t clip_q63_to_q15(
00402 q63_t x)
00403 {
00404 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
00405 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
00406 }
00407
00411 static INLINE q7_t clip_q31_to_q7(
00412 q31_t x)
00413 {
00414 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
00415 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
00416 }
00417
00421 static INLINE q15_t clip_q31_to_q15(
00422 q31_t x)
00423 {
00424 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
00425 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
00426 }
00427
00432 static INLINE q63_t mult32x64(
00433 q63_t x,
00434 q31_t y)
00435 {
00436 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
00437 (((q63_t) (x >> 32) * y)));
00438 }
00439
00440
00441 #ifdef CCS
00442
00443
00444
00445
00446
00447 static INLINE q31_t __SHASX(
00448 q31_t x,
00449 q31_t y)
00450 {
00451
00452 q31_t sum;
00453 q31_t r, s;
00454
00455 r = (short) x;
00456 s = (short) y;
00457
00458 r = ((r >> 1) - (y >> 17));
00459 s = (((x >> 17) + (s >> 1)) << 16);
00460
00461 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
00462
00463 return sum;
00464 }
00465
00466
00467
00468
00469
00470
00471 static INLINE q31_t __SHSAX(
00472 q31_t x,
00473 q31_t y)
00474 {
00475
00476 q31_t sum;
00477 q31_t r, s;
00478
00479 r = (short) x;
00480 s = (short) y;
00481
00482 r = ((r >> 1) + (y >> 17));
00483 s = (((x >> 17) - (s >> 1)) << 16);
00484
00485 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
00486
00487 return sum;
00488 }
00489
00490 #endif
00491
00492
00497 static INLINE uint32_t arm_recip_q31(
00498 q31_t in,
00499 q31_t * dst,
00500 q31_t * pRecipTable)
00501 {
00502
00503 uint32_t out, tempVal;
00504 uint32_t index, i;
00505 uint32_t signBits;
00506
00507 if(in > 0)
00508 {
00509 signBits = __CLZ(in) - 1;
00510 }
00511 else
00512 {
00513 signBits = __CLZ(-in) - 1;
00514 }
00515
00516
00517 in = in << signBits;
00518
00519
00520 index = (uint32_t) (in >> 24u);
00521 index = (index & INDEX_MASK);
00522
00523
00524 out = pRecipTable[index];
00525
00526
00527
00528 for (i = 0u; i < 2u; i++)
00529 {
00530 tempVal = (q31_t) (((q63_t) in * out) >> 31u);
00531 tempVal = 0x7FFFFFFF - tempVal;
00532
00533 out = (q31_t) (((q63_t) out * tempVal) >> 30u);
00534 }
00535
00536
00537 *dst = out;
00538
00539
00540 return (signBits + 1u);
00541
00542 }
00543
00547 static INLINE uint32_t arm_recip_q15(
00548 q15_t in,
00549 q15_t * dst,
00550 q15_t * pRecipTable)
00551 {
00552
00553 uint32_t out = 0, tempVal = 0;
00554 uint32_t index = 0, i = 0;
00555 uint32_t signBits = 0;
00556
00557 if(in > 0)
00558 {
00559 signBits = __CLZ(in) - 17;
00560 }
00561 else
00562 {
00563 signBits = __CLZ(-in) - 17;
00564 }
00565
00566
00567 in = in << signBits;
00568
00569
00570 index = in >> 8;
00571 index = (index & INDEX_MASK);
00572
00573
00574 out = pRecipTable[index];
00575
00576
00577
00578 for (i = 0; i < 2; i++)
00579 {
00580 tempVal = (q15_t) (((q31_t) in * out) >> 15);
00581 tempVal = 0x7FFF - tempVal;
00582
00583 out = (q15_t) (((q31_t) out * tempVal) >> 14);
00584 }
00585
00586
00587 *dst = out;
00588
00589
00590 return (signBits + 1);
00591
00592 }
00593
00594
00595
00596
00597
00598
00602 typedef struct
00603 {
00604 uint16_t numTaps;
00605 q7_t *pState;
00606 q7_t *pCoeffs;
00607 } arm_fir_instance_q7;
00608
00612 typedef struct
00613 {
00614 uint16_t numTaps;
00615 q15_t *pState;
00616 q15_t *pCoeffs;
00617 } arm_fir_instance_q15;
00618
00622 typedef struct
00623 {
00624 uint16_t numTaps;
00625 q31_t *pState;
00626 q31_t *pCoeffs;
00627 } arm_fir_instance_q31;
00628
00632 typedef struct
00633 {
00634 uint16_t numTaps;
00635 float32_t *pState;
00636 float32_t *pCoeffs;
00637 } arm_fir_instance_f32;
00638
00639
00648 void arm_fir_q7(
00649 const arm_fir_instance_q7 * S,
00650 q7_t * pSrc,
00651 q7_t * pDst,
00652 uint32_t blockSize);
00653
00654
00664 void arm_fir_init_q7(
00665 arm_fir_instance_q7 * S,
00666 uint16_t numTaps,
00667 q7_t * pCoeffs,
00668 q7_t * pState,
00669 uint32_t blockSize);
00670
00671
00680 void arm_fir_q15(
00681 const arm_fir_instance_q15 * S,
00682 q15_t * pSrc,
00683 q15_t * pDst,
00684 uint32_t blockSize);
00685
00694 void arm_fir_fast_q15(
00695 const arm_fir_instance_q15 * S,
00696 q15_t * pSrc,
00697 q15_t * pDst,
00698 uint32_t blockSize);
00699
00710 arm_status arm_fir_init_q15(
00711 arm_fir_instance_q15 * S,
00712 uint16_t numTaps,
00713 q15_t * pCoeffs,
00714 q15_t * pState,
00715 uint32_t blockSize);
00716
00717
00726 void arm_fir_q31(
00727 const arm_fir_instance_q31 * S,
00728 q31_t * pSrc,
00729 q31_t * pDst,
00730 uint32_t blockSize);
00731
00740 void arm_fir_fast_q31(
00741 const arm_fir_instance_q31 * S,
00742 q31_t * pSrc,
00743 q31_t * pDst,
00744 uint32_t blockSize);
00745
00755 void arm_fir_init_q31(
00756 arm_fir_instance_q31 * S,
00757 uint16_t numTaps,
00758 q31_t * pCoeffs,
00759 q31_t * pState,
00760 uint32_t blockSize);
00761
00770 void arm_fir_f32(
00771 const arm_fir_instance_f32 * S,
00772 float32_t * pSrc,
00773 float32_t * pDst,
00774 uint32_t blockSize);
00775
00785 void arm_fir_init_f32(
00786 arm_fir_instance_f32 * S,
00787 uint16_t numTaps,
00788 float32_t * pCoeffs,
00789 float32_t * pState,
00790 uint32_t blockSize);
00791
00792
00796 typedef struct
00797 {
00798 int8_t numStages;
00799 q15_t *pState;
00800 q15_t *pCoeffs;
00801 int8_t postShift;
00803 } arm_biquad_casd_df1_inst_q15;
00804
00805
00809 typedef struct
00810 {
00811 uint32_t numStages;
00812 q31_t *pState;
00813 q31_t *pCoeffs;
00814 uint8_t postShift;
00816 } arm_biquad_casd_df1_inst_q31;
00817
00821 typedef struct
00822 {
00823 uint32_t numStages;
00824 float32_t *pState;
00825 float32_t *pCoeffs;
00828 } arm_biquad_casd_df1_inst_f32;
00829
00830
00831
00841 void arm_biquad_cascade_df1_q15(
00842 const arm_biquad_casd_df1_inst_q15 * S,
00843 q15_t * pSrc,
00844 q15_t * pDst,
00845 uint32_t blockSize);
00846
00857 void arm_biquad_cascade_df1_init_q15(
00858 arm_biquad_casd_df1_inst_q15 * S,
00859 uint8_t numStages,
00860 q15_t * pCoeffs,
00861 q15_t * pState,
00862 int8_t postShift);
00863
00864
00874 void arm_biquad_cascade_df1_fast_q15(
00875 const arm_biquad_casd_df1_inst_q15 * S,
00876 q15_t * pSrc,
00877 q15_t * pDst,
00878 uint32_t blockSize);
00879
00880
00890 void arm_biquad_cascade_df1_q31(
00891 const arm_biquad_casd_df1_inst_q31 * S,
00892 q31_t * pSrc,
00893 q31_t * pDst,
00894 uint32_t blockSize);
00895
00905 void arm_biquad_cascade_df1_fast_q31(
00906 const arm_biquad_casd_df1_inst_q31 * S,
00907 q31_t * pSrc,
00908 q31_t * pDst,
00909 uint32_t blockSize);
00910
00921 void arm_biquad_cascade_df1_init_q31(
00922 arm_biquad_casd_df1_inst_q31 * S,
00923 uint8_t numStages,
00924 q31_t * pCoeffs,
00925 q31_t * pState,
00926 int8_t postShift);
00927
00937 void arm_biquad_cascade_df1_f32(
00938 const arm_biquad_casd_df1_inst_f32 * S,
00939 float32_t * pSrc,
00940 float32_t * pDst,
00941 uint32_t blockSize);
00942
00952 void arm_biquad_cascade_df1_init_f32(
00953 arm_biquad_casd_df1_inst_f32 * S,
00954 uint8_t numStages,
00955 float32_t * pCoeffs,
00956 float32_t * pState);
00957
00958
00963 typedef struct
00964 {
00965 uint16_t numRows;
00966 uint16_t numCols;
00967 float32_t *pData;
00968 } arm_matrix_instance_f32;
00969
00974 typedef struct
00975 {
00976 uint16_t numRows;
00977 uint16_t numCols;
00978 q15_t *pData;
00980 } arm_matrix_instance_q15;
00981
00986 typedef struct
00987 {
00988 uint16_t numRows;
00989 uint16_t numCols;
00990 q31_t *pData;
00992 } arm_matrix_instance_q31;
00993
00994
00995
01005 arm_status arm_mat_add_f32(
01006 const arm_matrix_instance_f32 * pSrcA,
01007 const arm_matrix_instance_f32 * pSrcB,
01008 arm_matrix_instance_f32 * pDst);
01009
01019 arm_status arm_mat_add_q15(
01020 const arm_matrix_instance_q15 * pSrcA,
01021 const arm_matrix_instance_q15 * pSrcB,
01022 arm_matrix_instance_q15 * pDst);
01023
01033 arm_status arm_mat_add_q31(
01034 const arm_matrix_instance_q31 * pSrcA,
01035 const arm_matrix_instance_q31 * pSrcB,
01036 arm_matrix_instance_q31 * pDst);
01037
01038
01047 arm_status arm_mat_trans_f32(
01048 const arm_matrix_instance_f32 * pSrc,
01049 arm_matrix_instance_f32 * pDst);
01050
01051
01060 arm_status arm_mat_trans_q15(
01061 const arm_matrix_instance_q15 * pSrc,
01062 arm_matrix_instance_q15 * pDst);
01063
01072 arm_status arm_mat_trans_q31(
01073 const arm_matrix_instance_q31 * pSrc,
01074 arm_matrix_instance_q31 * pDst);
01075
01076
01086 arm_status arm_mat_mult_f32(
01087 const arm_matrix_instance_f32 * pSrcA,
01088 const arm_matrix_instance_f32 * pSrcB,
01089 arm_matrix_instance_f32 * pDst);
01090
01100 arm_status arm_mat_cmplx_mult_f32(
01101 const arm_matrix_instance_f32 * pSrcA,
01102 const arm_matrix_instance_f32 * pSrcB,
01103 arm_matrix_instance_f32 * pDst);
01104
01114 arm_status arm_mat_cmplx_mult_q31(
01115 const arm_matrix_instance_q31 * pSrcA,
01116 const arm_matrix_instance_q31 * pSrcB,
01117 arm_matrix_instance_q31 * pDst);
01118
01129 arm_status arm_mat_mult_q15(
01130 const arm_matrix_instance_q15 * pSrcA,
01131 const arm_matrix_instance_q15 * pSrcB,
01132 arm_matrix_instance_q15 * pDst,
01133 q15_t * pScratch);
01134
01145 arm_status arm_mat_cmplx_mult_q15(
01146 const arm_matrix_instance_q15 * pSrcA,
01147 const arm_matrix_instance_q15 * pSrcB,
01148 arm_matrix_instance_q15 * pDst,
01149 q15_t * pScratch);
01150
01160 arm_status arm_mat_mult_fast_q15(
01161 const arm_matrix_instance_q15 * pSrcA,
01162 const arm_matrix_instance_q15 * pSrcB,
01163 arm_matrix_instance_q15 * pDst,
01164 q15_t * pScratch);
01165
01175 arm_status arm_mat_mult_q31(
01176 const arm_matrix_instance_q31 * pSrcA,
01177 const arm_matrix_instance_q31 * pSrcB,
01178 arm_matrix_instance_q31 * pDst);
01179
01189 arm_status arm_mat_mult_fast_q31(
01190 const arm_matrix_instance_q31 * pSrcA,
01191 const arm_matrix_instance_q31 * pSrcB,
01192 arm_matrix_instance_q31 * pDst);
01193
01194
01204 arm_status arm_mat_sub_f32(
01205 const arm_matrix_instance_f32 * pSrcA,
01206 const arm_matrix_instance_f32 * pSrcB,
01207 arm_matrix_instance_f32 * pDst);
01208
01218 arm_status arm_mat_sub_q15(
01219 const arm_matrix_instance_q15 * pSrcA,
01220 const arm_matrix_instance_q15 * pSrcB,
01221 arm_matrix_instance_q15 * pDst);
01222
01232 arm_status arm_mat_sub_q31(
01233 const arm_matrix_instance_q31 * pSrcA,
01234 const arm_matrix_instance_q31 * pSrcB,
01235 arm_matrix_instance_q31 * pDst);
01236
01246 arm_status arm_mat_scale_f32(
01247 const arm_matrix_instance_f32 * pSrc,
01248 float32_t scale,
01249 arm_matrix_instance_f32 * pDst);
01250
01261 arm_status arm_mat_scale_q15(
01262 const arm_matrix_instance_q15 * pSrc,
01263 q15_t scaleFract,
01264 int32_t shift,
01265 arm_matrix_instance_q15 * pDst);
01266
01277 arm_status arm_mat_scale_q31(
01278 const arm_matrix_instance_q31 * pSrc,
01279 q31_t scaleFract,
01280 int32_t shift,
01281 arm_matrix_instance_q31 * pDst);
01282
01283
01293 void arm_mat_init_q31(
01294 arm_matrix_instance_q31 * S,
01295 uint16_t nRows,
01296 uint16_t nColumns,
01297 q31_t *pData);
01298
01308 void arm_mat_init_q15(
01309 arm_matrix_instance_q15 * S,
01310 uint16_t nRows,
01311 uint16_t nColumns,
01312 q15_t *pData);
01313
01323 void arm_mat_init_f32(
01324 arm_matrix_instance_f32 * S,
01325 uint16_t nRows,
01326 uint16_t nColumns,
01327 float32_t *pData);
01328
01329
01330
01334 typedef struct
01335 {
01336 q15_t A0;
01337 q31_t A1;
01338 q15_t state[3];
01339 q15_t Kp;
01340 q15_t Ki;
01341 q15_t Kd;
01342 } arm_pid_instance_q15;
01343
01347 typedef struct
01348 {
01349 q31_t A0;
01350 q31_t A1;
01351 q31_t A2;
01352 q31_t state[3];
01353 q31_t Kp;
01354 q31_t Ki;
01355 q31_t Kd;
01357 } arm_pid_instance_q31;
01358
01362 typedef struct
01363 {
01364 float32_t A0;
01365 float32_t A1;
01366 float32_t A2;
01367 float32_t state[3];
01368 float32_t Kp;
01369 float32_t Ki;
01370 float32_t Kd;
01371 } arm_pid_instance_f32;
01372
01373
01374
01381 void arm_pid_init_f32(
01382 arm_pid_instance_f32 * S,
01383 int32_t resetStateFlag);
01384
01390 void arm_pid_reset_f32(
01391 arm_pid_instance_f32 * S);
01392
01393
01400 void arm_pid_init_q31(
01401 arm_pid_instance_q31 * S,
01402 int32_t resetStateFlag);
01403
01404
01411 void arm_pid_reset_q31(
01412 arm_pid_instance_q31 * S);
01413
01420 void arm_pid_init_q15(
01421 arm_pid_instance_q15 * S,
01422 int32_t resetStateFlag);
01423
01429 void arm_pid_reset_q15(
01430 arm_pid_instance_q15 * S);
01431
01432
01436 typedef struct
01437 {
01438 uint32_t nValues;
01439 float32_t x1;
01440 float32_t xSpacing;
01441 float32_t *pYData;
01442 } arm_linear_interp_instance_f32;
01443
01448 typedef struct
01449 {
01450 uint16_t numRows;
01451 uint16_t numCols;
01452 float32_t *pData;
01453 } arm_bilinear_interp_instance_f32;
01454
01459 typedef struct
01460 {
01461 uint16_t numRows;
01462 uint16_t numCols;
01463 q31_t *pData;
01464 } arm_bilinear_interp_instance_q31;
01465
01470 typedef struct
01471 {
01472 uint16_t numRows;
01473 uint16_t numCols;
01474 q15_t *pData;
01475 } arm_bilinear_interp_instance_q15;
01476
01481 typedef struct
01482 {
01483 uint16_t numRows;
01484 uint16_t numCols;
01485 q7_t *pData;
01486 } arm_bilinear_interp_instance_q7;
01487
01488
01498 void arm_mult_q7(
01499 q7_t * pSrcA,
01500 q7_t * pSrcB,
01501 q7_t * pDst,
01502 uint32_t blockSize);
01503
01513 void arm_mult_q15(
01514 q15_t * pSrcA,
01515 q15_t * pSrcB,
01516 q15_t * pDst,
01517 uint32_t blockSize);
01518
01528 void arm_mult_q31(
01529 q31_t * pSrcA,
01530 q31_t * pSrcB,
01531 q31_t * pDst,
01532 uint32_t blockSize);
01533
01543 void arm_mult_f32(
01544 float32_t * pSrcA,
01545 float32_t * pSrcB,
01546 float32_t * pDst,
01547 uint32_t blockSize);
01548
01549
01554 typedef struct
01555 {
01556 uint16_t fftLen;
01557 uint8_t ifftFlag;
01558 uint8_t bitReverseFlag;
01559 q15_t *pTwiddle;
01560 uint16_t *pBitRevTable;
01561 uint16_t twidCoefModifier;
01562 uint16_t bitRevFactor;
01563 } arm_cfft_radix4_instance_q15;
01564
01569 typedef struct
01570 {
01571 uint16_t fftLen;
01572 uint8_t ifftFlag;
01573 uint8_t bitReverseFlag;
01574 q31_t *pTwiddle;
01575 uint16_t *pBitRevTable;
01576 uint16_t twidCoefModifier;
01577 uint16_t bitRevFactor;
01578 } arm_cfft_radix4_instance_q31;
01579
01584 typedef struct
01585 {
01586 uint16_t fftLen;
01587 uint8_t ifftFlag;
01588 uint8_t bitReverseFlag;
01589 float32_t *pTwiddle;
01590 uint16_t *pBitRevTable;
01591 uint16_t twidCoefModifier;
01592 uint16_t bitRevFactor;
01593 float32_t onebyfftLen;
01594 } arm_cfft_radix4_instance_f32;
01595
01603 void arm_cfft_radix4_q15(
01604 const arm_cfft_radix4_instance_q15 * S,
01605 q15_t * pSrc);
01606
01616 arm_status arm_cfft_radix4_init_q15(
01617 arm_cfft_radix4_instance_q15 * S,
01618 uint16_t fftLen,
01619 uint8_t ifftFlag,
01620 uint8_t bitReverseFlag);
01621
01629 void arm_cfft_mag_q15(
01630 const arm_cfft_radix4_instance_q15 * S,
01631 q15_t * pSrc);
01632
01633
01641 void arm_cfft_radix4_q31(
01642 const arm_cfft_radix4_instance_q31 * S,
01643 q31_t * pSrc);
01644
01654 arm_status arm_cfft_radix4_init_q31(
01655 arm_cfft_radix4_instance_q31 * S,
01656 uint16_t fftLen,
01657 uint8_t ifftFlag,
01658 uint8_t bitReverseFlag);
01659
01667 void arm_cfft_mag_q31(
01668 const arm_cfft_radix4_instance_q31 * S,
01669 q31_t * pSrc);
01670
01678 void arm_cfft_radix4_f32(
01679 const arm_cfft_radix4_instance_f32 * S,
01680 float32_t * pSrc);
01681
01689 void arm_cfft_mag_f32(
01690 const arm_cfft_radix4_instance_f32 * S,
01691 float32_t * pSrc);
01692
01693
01703 arm_status arm_cfft_radix4_init_f32(
01704 arm_cfft_radix4_instance_f32 * S,
01705 uint16_t fftLen,
01706 uint8_t ifftFlag,
01707 uint8_t bitReverseFlag);
01708
01709
01710
01711
01712
01713
01714
01724 void arm_radix4_butterfly_f32(
01725 float32_t * pSrc,
01726 uint16_t fftLen,
01727 float32_t * pCoef,
01728 uint16_t twidCoefModifier);
01729
01739 void arm_cfft_mag_butterfly_f32(
01740 float32_t * pSrc,
01741 uint16_t fftLen,
01742 float32_t * pCoef,
01743 uint16_t twidCoefModifier);
01744
01745
01756 void arm_radix4_butterfly_inverse_f32(
01757 float32_t * pSrc,
01758 uint16_t fftLen,
01759 float32_t * pCoef,
01760 uint16_t twidCoefModifier,
01761 float32_t onebyfftLen);
01762
01772 void arm_bitreversal_f32(
01773 float32_t *pSrc,
01774 uint16_t fftSize,
01775 uint16_t bitRevFactor,
01776 uint16_t *pBitRevTab);
01777
01787 void arm_cfft_mag_bitreversal_f32(
01788 float32_t *pSrc,
01789 uint16_t fftSize,
01790 uint16_t bitRevFactor,
01791 uint16_t *pBitRevTab);
01792
01802 void arm_radix4_butterfly_q31(
01803 q31_t *pSrc,
01804 uint32_t fftLen,
01805 q31_t *pCoef,
01806 uint32_t twidCoefModifier);
01807
01817 void arm_cfft_mag_butterfly_q31(
01818 q31_t *pSrc,
01819 uint32_t fftLen,
01820 q31_t *pCoef,
01821 uint32_t twidCoefModifier);
01822
01832 void arm_radix4_butterfly_inverse_q31(
01833 q31_t * pSrc,
01834 uint32_t fftLen,
01835 q31_t * pCoef,
01836 uint32_t twidCoefModifier);
01837
01847 void arm_bitreversal_q31(
01848 q31_t * pSrc,
01849 uint32_t fftLen,
01850 uint16_t bitRevFactor,
01851 uint16_t *pBitRevTab);
01852
01862 void arm_cfft_mag_bitreversal_q31(
01863 q31_t * pSrc,
01864 uint32_t fftLen,
01865 uint16_t bitRevFactor,
01866 uint16_t *pBitRevTab);
01867
01877 void arm_radix4_butterfly_q15(
01878 q15_t *pSrc16,
01879 uint32_t fftLen,
01880 q15_t *pCoef16,
01881 uint32_t twidCoefModifier);
01882
01892 void arm_cfft_mag_butterfly_q15(
01893 q15_t *pSrc16,
01894 uint32_t fftLen,
01895 q15_t *pCoef16,
01896 uint32_t twidCoefModifier);
01897
01907 void arm_radix4_butterfly_inverse_q15(
01908 q15_t *pSrc16,
01909 uint32_t fftLen,
01910 q15_t *pCoef16,
01911 uint32_t twidCoefModifier);
01912
01922 void arm_bitreversal_q15(
01923 q15_t * pSrc,
01924 uint32_t fftLen,
01925 uint16_t bitRevFactor,
01926 uint16_t *pBitRevTab);
01927
01937 void arm_cfft_mag_bitreversal_q15(
01938 q15_t * pSrc,
01939 uint32_t fftLen,
01940 uint16_t bitRevFactor,
01941 uint16_t *pBitRevTab);
01942
01947 typedef struct
01948 {
01949 uint32_t fftLenReal;
01950 uint32_t fftLenBy2;
01951 uint8_t ifftFlagR;
01952 uint8_t bitReverseFlagR;
01953 uint32_t twidCoefRModifier;
01954 q15_t *pTwiddleAReal;
01955 q15_t *pTwiddleBReal;
01956 arm_cfft_radix4_instance_q15 *pCfft;
01957 } arm_rfft_instance_q15;
01958
01963 typedef struct
01964 {
01965 uint32_t fftLenReal;
01966 uint32_t fftLenBy2;
01967 uint8_t ifftFlagR;
01968 uint8_t bitReverseFlagR;
01969 uint32_t twidCoefRModifier;
01970 q31_t *pTwiddleAReal;
01971 q31_t *pTwiddleBReal;
01972 arm_cfft_radix4_instance_q31 *pCfft;
01973 } arm_rfft_instance_q31;
01974
01979 typedef struct
01980 {
01981 uint32_t fftLenReal;
01982 uint16_t fftLenBy2;
01983 uint8_t ifftFlagR;
01984 uint8_t bitReverseFlagR;
01985 uint32_t twidCoefRModifier;
01986 float32_t *pTwiddleAReal;
01987 float32_t *pTwiddleBReal;
01988 arm_cfft_radix4_instance_f32 *pCfft;
01989 } arm_rfft_instance_f32;
01990
01999 void arm_rfft_q15(
02000 const arm_rfft_instance_q15 * S,
02001 q15_t * pSrc,
02002 q15_t * pDst);
02003
02014 arm_status arm_rfft_init_q15(
02015 arm_rfft_instance_q15 * S,
02016 arm_cfft_radix4_instance_q15 * S_CFFT,
02017 uint32_t fftLenReal,
02018 uint32_t ifftFlagR,
02019 uint32_t bitReverseFlag);
02020
02029 void arm_rfft_q31(
02030 const arm_rfft_instance_q31 * S,
02031 q31_t * pSrc,
02032 q31_t * pDst);
02033
02044 arm_status arm_rfft_init_q31(
02045 arm_rfft_instance_q31 * S,
02046 arm_cfft_radix4_instance_q31 * S_CFFT,
02047 uint32_t fftLenReal,
02048 uint32_t ifftFlagR,
02049 uint32_t bitReverseFlag);
02050
02061 arm_status arm_rfft_init_f32(
02062 arm_rfft_instance_f32 * S,
02063 arm_cfft_radix4_instance_f32 * S_CFFT,
02064 uint32_t fftLenReal,
02065 uint32_t ifftFlagR,
02066 uint32_t bitReverseFlag);
02067
02076 void arm_rfft_f32(
02077 const arm_rfft_instance_f32 * S,
02078 float32_t * pSrc,
02079 float32_t * pDst);
02080
02085 typedef struct
02086 {
02087 uint16_t N;
02088 uint16_t Nby2;
02089 float32_t normalize;
02090 float32_t *pTwiddle;
02091 float32_t *pCosFactor;
02092 arm_rfft_instance_f32 *pRfft;
02093 arm_cfft_radix4_instance_f32 *pCfft;
02094 } arm_dct4_instance_f32;
02095
02107 arm_status arm_dct4_init_f32(
02108 arm_dct4_instance_f32 * S,
02109 arm_rfft_instance_f32 * S_RFFT,
02110 arm_cfft_radix4_instance_f32 * S_CFFT,
02111 uint16_t N,
02112 uint16_t Nby2,
02113 float32_t normalize);
02114
02123 void arm_dct4_f32(
02124 const arm_dct4_instance_f32 * S,
02125 float32_t * pState,
02126 float32_t * pInlineBuffer);
02127
02132 typedef struct
02133 {
02134 uint16_t N;
02135 uint16_t Nby2;
02136 q31_t normalize;
02137 q31_t *pTwiddle;
02138 q31_t *pCosFactor;
02139 arm_rfft_instance_q31 *pRfft;
02140 arm_cfft_radix4_instance_q31 *pCfft;
02141 } arm_dct4_instance_q31;
02142
02154 arm_status arm_dct4_init_q31(
02155 arm_dct4_instance_q31 * S,
02156 arm_rfft_instance_q31 * S_RFFT,
02157 arm_cfft_radix4_instance_q31 * S_CFFT,
02158 uint16_t N,
02159 uint16_t Nby2,
02160 q31_t normalize);
02161
02170 void arm_dct4_q31(
02171 const arm_dct4_instance_q31 * S,
02172 q31_t * pState,
02173 q31_t * pInlineBuffer);
02174
02179 typedef struct
02180 {
02181 uint16_t N;
02182 uint16_t Nby2;
02183 q15_t normalize;
02184 q15_t *pTwiddle;
02185 q15_t *pCosFactor;
02186 arm_rfft_instance_q15 *pRfft;
02187 arm_cfft_radix4_instance_q15 *pCfft;
02188 } arm_dct4_instance_q15;
02189
02201 arm_status arm_dct4_init_q15(
02202 arm_dct4_instance_q15 * S,
02203 arm_rfft_instance_q15 * S_RFFT,
02204 arm_cfft_radix4_instance_q15 * S_CFFT,
02205 uint16_t N,
02206 uint16_t Nby2,
02207 q15_t normalize);
02208
02217 void arm_dct4_q15(
02218 const arm_dct4_instance_q15 * S,
02219 q15_t * pState,
02220 q15_t * pInlineBuffer);
02221
02231 void arm_add_f32(
02232 float32_t * pSrcA,
02233 float32_t * pSrcB,
02234 float32_t * pDst,
02235 uint32_t blockSize);
02236
02246 void arm_add_q7(
02247 q7_t * pSrcA,
02248 q7_t * pSrcB,
02249 q7_t * pDst,
02250 uint32_t blockSize);
02251
02261 void arm_add_q15(
02262 q15_t * pSrcA,
02263 q15_t * pSrcB,
02264 q15_t * pDst,
02265 uint32_t blockSize);
02266
02276 void arm_add_q31(
02277 q31_t * pSrcA,
02278 q31_t * pSrcB,
02279 q31_t * pDst,
02280 uint32_t blockSize);
02281
02291 void arm_sub_f32(
02292 float32_t * pSrcA,
02293 float32_t * pSrcB,
02294 float32_t * pDst,
02295 uint32_t blockSize);
02296
02306 void arm_sub_q7(
02307 q7_t * pSrcA,
02308 q7_t * pSrcB,
02309 q7_t * pDst,
02310 uint32_t blockSize);
02311
02321 void arm_sub_q15(
02322 q15_t * pSrcA,
02323 q15_t * pSrcB,
02324 q15_t * pDst,
02325 uint32_t blockSize);
02326
02336 void arm_sub_q31(
02337 q31_t * pSrcA,
02338 q31_t * pSrcB,
02339 q31_t * pDst,
02340 uint32_t blockSize);
02341
02351 void arm_scale_f32(
02352 float32_t * pSrc,
02353 float32_t scale,
02354 float32_t * pDst,
02355 uint32_t blockSize);
02356
02367 void arm_scale_q7(
02368 q7_t * pSrc,
02369 q7_t scaleFract,
02370 int8_t shift,
02371 q7_t * pDst,
02372 uint32_t blockSize);
02373
02384 void arm_scale_q15(
02385 q15_t * pSrc,
02386 q15_t scaleFract,
02387 int8_t shift,
02388 q15_t * pDst,
02389 uint32_t blockSize);
02390
02401 void arm_scale_q31(
02402 q31_t * pSrc,
02403 q31_t scaleFract,
02404 int8_t shift,
02405 q31_t * pDst,
02406 uint32_t blockSize);
02407
02416 void arm_abs_q7(
02417 q7_t * pSrc,
02418 q7_t * pDst,
02419 uint32_t blockSize);
02420
02429 void arm_abs_f32(
02430 float32_t * pSrc,
02431 float32_t * pDst,
02432 uint32_t blockSize);
02433
02442 void arm_abs_q15(
02443 q15_t * pSrc,
02444 q15_t * pDst,
02445 uint32_t blockSize);
02446
02455 void arm_abs_q31(
02456 q31_t * pSrc,
02457 q31_t * pDst,
02458 uint32_t blockSize);
02459
02469 void arm_dot_prod_f32(
02470 float32_t * pSrcA,
02471 float32_t * pSrcB,
02472 uint32_t blockSize,
02473 float32_t * result);
02474
02484 void arm_dot_prod_q7(
02485 q7_t * pSrcA,
02486 q7_t * pSrcB,
02487 uint32_t blockSize,
02488 q31_t * result);
02489
02499 void arm_dot_prod_q15(
02500 q15_t * pSrcA,
02501 q15_t * pSrcB,
02502 uint32_t blockSize,
02503 q63_t * result);
02504
02514 void arm_dot_prod_q31(
02515 q31_t * pSrcA,
02516 q31_t * pSrcB,
02517 uint32_t blockSize,
02518 q63_t * result);
02519
02529 void arm_shift_q7(
02530 q7_t * pSrc,
02531 int8_t shiftBits,
02532 q7_t * pDst,
02533 uint32_t blockSize);
02534
02544 void arm_shift_q15(
02545 q15_t * pSrc,
02546 int8_t shiftBits,
02547 q15_t * pDst,
02548 uint32_t blockSize);
02549
02559 void arm_shift_q31(
02560 q31_t * pSrc,
02561 int8_t shiftBits,
02562 q31_t * pDst,
02563 uint32_t blockSize);
02564
02574 void arm_offset_f32(
02575 float32_t * pSrc,
02576 float32_t offset,
02577 float32_t * pDst,
02578 uint32_t blockSize);
02579
02589 void arm_offset_q7(
02590 q7_t * pSrc,
02591 q7_t offset,
02592 q7_t * pDst,
02593 uint32_t blockSize);
02594
02604 void arm_offset_q15(
02605 q15_t * pSrc,
02606 q15_t offset,
02607 q15_t * pDst,
02608 uint32_t blockSize);
02609
02619 void arm_offset_q31(
02620 q31_t * pSrc,
02621 q31_t offset,
02622 q31_t * pDst,
02623 uint32_t blockSize);
02624
02633 void arm_negate_f32(
02634 float32_t * pSrc,
02635 float32_t * pDst,
02636 uint32_t blockSize);
02637
02646 void arm_negate_q7(
02647 q7_t * pSrc,
02648 q7_t * pDst,
02649 uint32_t blockSize);
02650
02659 void arm_negate_q15(
02660 q15_t * pSrc,
02661 q15_t * pDst,
02662 uint32_t blockSize);
02663
02672 void arm_negate_q31(
02673 q31_t * pSrc,
02674 q31_t * pDst,
02675 uint32_t blockSize);
02683 void arm_copy_f32(
02684 float32_t * pSrc,
02685 float32_t * pDst,
02686 uint32_t blockSize);
02687
02695 void arm_copy_q7(
02696 q7_t * pSrc,
02697 q7_t * pDst,
02698 uint32_t blockSize);
02699
02707 void arm_copy_q15(
02708 q15_t * pSrc,
02709 q15_t * pDst,
02710 uint32_t blockSize);
02711
02719 void arm_copy_q31(
02720 q31_t * pSrc,
02721 q31_t * pDst,
02722 uint32_t blockSize);
02730 void arm_fill_f32(
02731 float32_t value,
02732 float32_t * pDst,
02733 uint32_t blockSize);
02734
02742 void arm_fill_q7(
02743 q7_t value,
02744 q7_t * pDst,
02745 uint32_t blockSize);
02746
02754 void arm_fill_q15(
02755 q15_t value,
02756 q15_t * pDst,
02757 uint32_t blockSize);
02758
02766 void arm_fill_q31(
02767 q31_t value,
02768 q31_t * pDst,
02769 uint32_t blockSize);
02770
02781 void arm_conv_f32(
02782 float32_t * pSrcA,
02783 uint32_t srcALen,
02784 float32_t * pSrcB,
02785 uint32_t srcBLen,
02786 float32_t * pDst);
02787
02801 void arm_conv_q15(
02802 q15_t * pSrcA,
02803 uint32_t srcALen,
02804 q15_t * pSrcB,
02805 uint32_t srcBLen,
02806 q15_t * pDst,
02807 q15_t * pScratch1,
02808 q15_t *pScratch2
02809 );
02810
02823 void arm_conv_fast_q15(
02824 q15_t * pSrcA,
02825 uint32_t srcALen,
02826 q15_t * pSrcB,
02827 uint32_t srcBLen,
02828 q15_t * pDst,
02829 q15_t * pScratch1,
02830 q15_t *pScratch2 );
02831
02842 void arm_conv_q31(
02843 q31_t * pSrcA,
02844 uint32_t srcALen,
02845 q31_t * pSrcB,
02846 uint32_t srcBLen,
02847 q31_t * pDst);
02848
02859 void arm_conv_fast_q31(
02860 q31_t * pSrcA,
02861 uint32_t srcALen,
02862 q31_t * pSrcB,
02863 uint32_t srcBLen,
02864 q31_t * pDst);
02865
02878 void arm_conv_q7(
02879 q7_t * pSrcA,
02880 uint32_t srcALen,
02881 q7_t * pSrcB,
02882 uint32_t srcBLen,
02883 q7_t * pDst,
02884 q15_t * pScratch1,
02885 q15_t *pScratch2 );
02886
02899 arm_status arm_conv_partial_f32(
02900 float32_t * pSrcA,
02901 uint32_t srcALen,
02902 float32_t * pSrcB,
02903 uint32_t srcBLen,
02904 float32_t * pDst,
02905 uint32_t firstIndex,
02906 uint32_t numPoints);
02907
02922 arm_status arm_conv_partial_q15(
02923 q15_t * pSrcA,
02924 uint32_t srcALen,
02925 q15_t * pSrcB,
02926 uint32_t srcBLen,
02927 q15_t * pDst,
02928 uint32_t firstIndex,
02929 uint32_t numPoints,
02930 q15_t * pScratch1,
02931 q15_t *pScratch2);
02932
02947 arm_status arm_conv_partial_fast_q15(
02948 q15_t * pSrcA,
02949 uint32_t srcALen,
02950 q15_t * pSrcB,
02951 uint32_t srcBLen,
02952 q15_t * pDst,
02953 uint32_t firstIndex,
02954 uint32_t numPoints,
02955 q15_t * pScratch1,
02956 q15_t *pScratch2);
02957
02970 arm_status arm_conv_partial_q31(
02971 q31_t * pSrcA,
02972 uint32_t srcALen,
02973 q31_t * pSrcB,
02974 uint32_t srcBLen,
02975 q31_t * pDst,
02976 uint32_t firstIndex,
02977 uint32_t numPoints);
02978
02979
02992 arm_status arm_conv_partial_fast_q31(
02993 q31_t * pSrcA,
02994 uint32_t srcALen,
02995 q31_t * pSrcB,
02996 uint32_t srcBLen,
02997 q31_t * pDst,
02998 uint32_t firstIndex,
02999 uint32_t numPoints);
03000
03015 arm_status arm_conv_partial_q7(
03016 q7_t * pSrcA,
03017 uint32_t srcALen,
03018 q7_t * pSrcB,
03019 uint32_t srcBLen,
03020 q7_t * pDst,
03021 uint32_t firstIndex,
03022 uint32_t numPoints,
03023 q15_t * pScratch1,
03024 q15_t *pScratch2);
03025
03026
03031 typedef struct
03032 {
03033 uint8_t M;
03034 uint16_t numTaps;
03035 q15_t *pCoeffs;
03036 q15_t *pState;
03037 } arm_fir_decimate_instance_q15;
03038
03043 typedef struct
03044 {
03045 uint8_t M;
03046 uint16_t numTaps;
03047 q31_t *pCoeffs;
03048 q31_t *pState;
03050 } arm_fir_decimate_instance_q31;
03051
03056 typedef struct
03057 {
03058 uint8_t M;
03059 uint16_t numTaps;
03060 float32_t *pCoeffs;
03061 float32_t *pState;
03063 } arm_fir_decimate_instance_f32;
03064
03065
03066
03076 void arm_fir_decimate_f32(
03077 const arm_fir_decimate_instance_f32 * S,
03078 float32_t * pSrc,
03079 float32_t * pDst,
03080 uint32_t blockSize);
03081
03082
03095 arm_status arm_fir_decimate_init_f32(
03096 arm_fir_decimate_instance_f32 * S,
03097 uint16_t numTaps,
03098 uint8_t M,
03099 float32_t * pCoeffs,
03100 float32_t * pState,
03101 uint32_t blockSize);
03102
03112 void arm_fir_decimate_q15(
03113 const arm_fir_decimate_instance_q15 * S,
03114 q15_t * pSrc,
03115 q15_t * pDst,
03116 uint32_t blockSize);
03117
03127 void arm_fir_decimate_fast_q15(
03128 const arm_fir_decimate_instance_q15 * S,
03129 q15_t * pSrc,
03130 q15_t * pDst,
03131 uint32_t blockSize);
03132
03133
03134
03147 arm_status arm_fir_decimate_init_q15(
03148 arm_fir_decimate_instance_q15 * S,
03149 uint16_t numTaps,
03150 uint8_t M,
03151 q15_t * pCoeffs,
03152 q15_t * pState,
03153 uint32_t blockSize);
03154
03164 void arm_fir_decimate_q31(
03165 const arm_fir_decimate_instance_q31 * S,
03166 q31_t * pSrc,
03167 q31_t * pDst,
03168 uint32_t blockSize);
03169
03179 void arm_fir_decimate_fast_q31(
03180 arm_fir_decimate_instance_q31 * S,
03181 q31_t * pSrc,
03182 q31_t * pDst,
03183 uint32_t blockSize);
03184
03185
03198 arm_status arm_fir_decimate_init_q31(
03199 arm_fir_decimate_instance_q31 * S,
03200 uint16_t numTaps,
03201 uint8_t M,
03202 q31_t * pCoeffs,
03203 q31_t * pState,
03204 uint32_t blockSize);
03205
03206
03207
03212 typedef struct
03213 {
03214 uint8_t L;
03215 uint16_t phaseLength;
03216 q15_t *pCoeffs;
03217 q15_t *pState;
03218 } arm_fir_interpolate_instance_q15;
03219
03224 typedef struct
03225 {
03226 uint8_t L;
03227 uint16_t phaseLength;
03228 q31_t *pCoeffs;
03229 q31_t *pState;
03230 } arm_fir_interpolate_instance_q31;
03231
03236 typedef struct
03237 {
03238 uint8_t L;
03239 uint16_t phaseLength;
03240 float32_t *pCoeffs;
03241 float32_t *pState;
03242 } arm_fir_interpolate_instance_f32;
03243
03244
03254 void arm_fir_interpolate_q15(
03255 const arm_fir_interpolate_instance_q15 * S,
03256 q15_t * pSrc,
03257 q15_t * pDst,
03258 uint32_t blockSize);
03259
03260
03273 arm_status arm_fir_interpolate_init_q15(
03274 arm_fir_interpolate_instance_q15 * S,
03275 uint8_t L,
03276 uint16_t numTaps,
03277 q15_t * pCoeffs,
03278 q15_t * pState,
03279 uint32_t blockSize);
03280
03290 void arm_fir_interpolate_q31(
03291 const arm_fir_interpolate_instance_q31 * S,
03292 q31_t * pSrc,
03293 q31_t * pDst,
03294 uint32_t blockSize);
03295
03308 arm_status arm_fir_interpolate_init_q31(
03309 arm_fir_interpolate_instance_q31 * S,
03310 uint8_t L,
03311 uint16_t numTaps,
03312 q31_t * pCoeffs,
03313 q31_t * pState,
03314 uint32_t blockSize);
03315
03316
03326 void arm_fir_interpolate_f32(
03327 const arm_fir_interpolate_instance_f32 * S,
03328 float32_t * pSrc,
03329 float32_t * pDst,
03330 uint32_t blockSize);
03331
03344 arm_status arm_fir_interpolate_init_f32(
03345 arm_fir_interpolate_instance_f32 * S,
03346 uint8_t L,
03347 uint16_t numTaps,
03348 float32_t * pCoeffs,
03349 float32_t * pState,
03350 uint32_t blockSize);
03351
03356 typedef struct
03357 {
03358 uint8_t numStages;
03359 q63_t *pState;
03360 q31_t *pCoeffs;
03361 uint8_t postShift;
03363 } arm_biquad_cas_df1_32x64_ins_q31;
03364
03365
03374 void arm_biquad_cas_df1_32x64_q31(
03375 const arm_biquad_cas_df1_32x64_ins_q31 * S,
03376 q31_t * pSrc,
03377 q31_t * pDst,
03378 uint32_t blockSize);
03379
03380
03390 void arm_biquad_cas_df1_32x64_init_q31(
03391 arm_biquad_cas_df1_32x64_ins_q31 * S,
03392 uint8_t numStages,
03393 q31_t * pCoeffs,
03394 q63_t * pState,
03395 uint8_t postShift);
03396
03397
03398
03403 typedef struct
03404 {
03405 uint8_t numStages;
03406 float32_t *pState;
03407 float32_t *pCoeffs;
03408 } arm_biquad_cascade_df2T_instance_f32;
03409
03410
03420 void arm_biquad_cascade_df2T_f32(
03421 const arm_biquad_cascade_df2T_instance_f32 * S,
03422 float32_t * pSrc,
03423 float32_t * pDst,
03424 uint32_t blockSize);
03425
03426
03436 void arm_biquad_cascade_df2T_init_f32(
03437 arm_biquad_cascade_df2T_instance_f32 * S,
03438 uint8_t numStages,
03439 float32_t * pCoeffs,
03440 float32_t * pState);
03441
03442
03443
03448 typedef struct
03449 {
03450 uint16_t numStages;
03451 q15_t *pState;
03452 q15_t *pCoeffs;
03453 } arm_fir_lattice_instance_q15;
03454
03459 typedef struct
03460 {
03461 uint16_t numStages;
03462 q31_t *pState;
03463 q31_t *pCoeffs;
03464 } arm_fir_lattice_instance_q31;
03465
03470 typedef struct
03471 {
03472 uint16_t numStages;
03473 float32_t *pState;
03474 float32_t *pCoeffs;
03475 } arm_fir_lattice_instance_f32;
03476
03486 void arm_fir_lattice_init_q15(
03487 arm_fir_lattice_instance_q15 * S,
03488 uint16_t numStages,
03489 q15_t * pCoeffs,
03490 q15_t * pState);
03491
03492
03501 void arm_fir_lattice_q15(
03502 const arm_fir_lattice_instance_q15 * S,
03503 q15_t * pSrc,
03504 q15_t * pDst,
03505 uint32_t blockSize);
03506
03516 void arm_fir_lattice_init_q31(
03517 arm_fir_lattice_instance_q31 * S,
03518 uint16_t numStages,
03519 q31_t * pCoeffs,
03520 q31_t * pState);
03521
03522
03532 void arm_fir_lattice_q31(
03533 const arm_fir_lattice_instance_q31 * S,
03534 q31_t * pSrc,
03535 q31_t * pDst,
03536 uint32_t blockSize);
03537
03547 void arm_fir_lattice_init_f32(
03548 arm_fir_lattice_instance_f32 * S,
03549 uint16_t numStages,
03550 float32_t * pCoeffs,
03551 float32_t * pState);
03552
03562 void arm_fir_lattice_f32(
03563 const arm_fir_lattice_instance_f32 * S,
03564 float32_t * pSrc,
03565 float32_t * pDst,
03566 uint32_t blockSize);
03567
03571 typedef struct
03572 {
03573 uint16_t numStages;
03574 q15_t *pState;
03575 q15_t *pkCoeffs;
03576 q15_t *pvCoeffs;
03577 } arm_iir_lattice_instance_q15;
03578
03582 typedef struct
03583 {
03584 uint16_t numStages;
03585 q31_t *pState;
03586 q31_t *pkCoeffs;
03587 q31_t *pvCoeffs;
03588 } arm_iir_lattice_instance_q31;
03589
03593 typedef struct
03594 {
03595 uint16_t numStages;
03596 float32_t *pState;
03597 float32_t *pkCoeffs;
03598 float32_t *pvCoeffs;
03599 } arm_iir_lattice_instance_f32;
03600
03610 void arm_iir_lattice_f32(
03611 const arm_iir_lattice_instance_f32 * S,
03612 float32_t * pSrc,
03613 float32_t * pDst,
03614 uint32_t blockSize);
03615
03627 void arm_iir_lattice_init_f32(
03628 arm_iir_lattice_instance_f32 * S,
03629 uint16_t numStages,
03630 float32_t *pkCoeffs,
03631 float32_t *pvCoeffs,
03632 float32_t *pState,
03633 uint32_t blockSize);
03634
03635
03645 void arm_iir_lattice_q31(
03646 const arm_iir_lattice_instance_q31 * S,
03647 q31_t * pSrc,
03648 q31_t * pDst,
03649 uint32_t blockSize);
03650
03651
03663 void arm_iir_lattice_init_q31(
03664 arm_iir_lattice_instance_q31 * S,
03665 uint16_t numStages,
03666 q31_t *pkCoeffs,
03667 q31_t *pvCoeffs,
03668 q31_t *pState,
03669 uint32_t blockSize);
03670
03671
03681 void arm_iir_lattice_q15(
03682 const arm_iir_lattice_instance_q15 * S,
03683 q15_t * pSrc,
03684 q15_t * pDst,
03685 uint32_t blockSize);
03686
03687
03699 void arm_iir_lattice_init_q15(
03700 arm_iir_lattice_instance_q15 * S,
03701 uint16_t numStages,
03702 q15_t *pkCoeffs,
03703 q15_t *pvCoeffs,
03704 q15_t *pState,
03705 uint32_t blockSize);
03706
03711 typedef struct
03712 {
03713 uint16_t numTaps;
03714 float32_t *pState;
03715 float32_t *pCoeffs;
03716 float32_t mu;
03717 } arm_lms_instance_f32;
03718
03730 void arm_lms_f32(
03731 const arm_lms_instance_f32 * S,
03732 float32_t * pSrc,
03733 float32_t * pRef,
03734 float32_t * pOut,
03735 float32_t * pErr,
03736 uint32_t blockSize);
03737
03749 void arm_lms_init_f32(
03750 arm_lms_instance_f32 * S,
03751 uint16_t numTaps,
03752 float32_t * pCoeffs,
03753 float32_t * pState,
03754 float32_t mu,
03755 uint32_t blockSize);
03756
03761 typedef struct
03762 {
03763 uint16_t numTaps;
03764 q15_t *pState;
03765 q15_t *pCoeffs;
03766 q15_t mu;
03767 uint32_t postShift;
03768 } arm_lms_instance_q15;
03769
03770
03783 void arm_lms_init_q15(
03784 arm_lms_instance_q15 * S,
03785 uint16_t numTaps,
03786 q15_t * pCoeffs,
03787 q15_t * pState,
03788 q15_t mu,
03789 uint32_t blockSize,
03790 uint32_t postShift);
03791
03803 void arm_lms_q15(
03804 const arm_lms_instance_q15 * S,
03805 q15_t * pSrc,
03806 q15_t * pRef,
03807 q15_t * pOut,
03808 q15_t * pErr,
03809 uint32_t blockSize);
03810
03811
03816 typedef struct
03817 {
03818 uint16_t numTaps;
03819 q31_t *pState;
03820 q31_t *pCoeffs;
03821 q31_t mu;
03822 uint32_t postShift;
03824 } arm_lms_instance_q31;
03825
03837 void arm_lms_q31(
03838 const arm_lms_instance_q31 * S,
03839 q31_t * pSrc,
03840 q31_t * pRef,
03841 q31_t * pOut,
03842 q31_t * pErr,
03843 uint32_t blockSize);
03844
03857 void arm_lms_init_q31(
03858 arm_lms_instance_q31 * S,
03859 uint16_t numTaps,
03860 q31_t *pCoeffs,
03861 q31_t *pState,
03862 q31_t mu,
03863 uint32_t blockSize,
03864 uint32_t postShift);
03865
03870 typedef struct
03871 {
03872 uint16_t numTaps;
03873 float32_t *pState;
03874 float32_t *pCoeffs;
03875 float32_t mu;
03876 float32_t energy;
03877 float32_t x0;
03878 } arm_lms_norm_instance_f32;
03879
03891 void arm_lms_norm_f32(
03892 arm_lms_norm_instance_f32 * S,
03893 float32_t * pSrc,
03894 float32_t * pRef,
03895 float32_t * pOut,
03896 float32_t * pErr,
03897 uint32_t blockSize);
03898
03910 void arm_lms_norm_init_f32(
03911 arm_lms_norm_instance_f32 * S,
03912 uint16_t numTaps,
03913 float32_t * pCoeffs,
03914 float32_t * pState,
03915 float32_t mu,
03916 uint32_t blockSize);
03917
03918
03922 typedef struct
03923 {
03924 uint16_t numTaps;
03925 q31_t *pState;
03926 q31_t *pCoeffs;
03927 q31_t mu;
03928 uint8_t postShift;
03929 q31_t *recipTable;
03930 q31_t energy;
03931 q31_t x0;
03932 } arm_lms_norm_instance_q31;
03933
03945 void arm_lms_norm_q31(
03946 arm_lms_norm_instance_q31 * S,
03947 q31_t * pSrc,
03948 q31_t * pRef,
03949 q31_t * pOut,
03950 q31_t * pErr,
03951 uint32_t blockSize);
03952
03965 void arm_lms_norm_init_q31(
03966 arm_lms_norm_instance_q31 * S,
03967 uint16_t numTaps,
03968 q31_t * pCoeffs,
03969 q31_t * pState,
03970 q31_t mu,
03971 uint32_t blockSize,
03972 uint8_t postShift);
03973
03978 typedef struct
03979 {
03980 uint16_t numTaps;
03981 q15_t *pState;
03982 q15_t *pCoeffs;
03983 q15_t mu;
03984 uint8_t postShift;
03985 q15_t *recipTable;
03986 q15_t energy;
03987 q15_t x0;
03988 } arm_lms_norm_instance_q15;
03989
04001 void arm_lms_norm_q15(
04002 arm_lms_norm_instance_q15 * S,
04003 q15_t * pSrc,
04004 q15_t * pRef,
04005 q15_t * pOut,
04006 q15_t * pErr,
04007 uint32_t blockSize);
04008
04009
04022 void arm_lms_norm_init_q15(
04023 arm_lms_norm_instance_q15 * S,
04024 uint16_t numTaps,
04025 q15_t * pCoeffs,
04026 q15_t * pState,
04027 q15_t mu,
04028 uint32_t blockSize,
04029 uint8_t postShift);
04030
04041 void arm_correlate_f32(
04042 float32_t * pSrcA,
04043 uint32_t srcALen,
04044 float32_t * pSrcB,
04045 uint32_t srcBLen,
04046 float32_t * pDst);
04047
04058 void arm_correlate_q15(
04059 q15_t * pSrcA,
04060 uint32_t srcALen,
04061 q15_t * pSrcB,
04062 uint32_t srcBLen,
04063 q15_t * pDst,
04064 q15_t * pScratch);
04065
04077 void arm_correlate_fast_q15(
04078 q15_t * pSrcA,
04079 uint32_t srcALen,
04080 q15_t * pSrcB,
04081 uint32_t srcBLen,
04082 q15_t * pDst,
04083 q15_t * pScratch);
04084
04095 void arm_correlate_q31(
04096 q31_t * pSrcA,
04097 uint32_t srcALen,
04098 q31_t * pSrcB,
04099 uint32_t srcBLen,
04100 q31_t * pDst);
04101
04112 void arm_correlate_fast_q31(
04113 q31_t * pSrcA,
04114 uint32_t srcALen,
04115 q31_t * pSrcB,
04116 uint32_t srcBLen,
04117 q31_t * pDst);
04118
04131 void arm_correlate_q7(
04132 q7_t * pSrcA,
04133 uint32_t srcALen,
04134 q7_t * pSrcB,
04135 uint32_t srcBLen,
04136 q7_t * pDst,
04137 q15_t * pScratch1,
04138 q15_t * pScratch2);
04139
04143 typedef struct
04144 {
04145 uint16_t numTaps;
04146 uint16_t stateIndex;
04147 float32_t *pState;
04148 float32_t *pCoeffs;
04149 uint16_t maxDelay;
04150 int32_t *pTapDelay;
04151 } arm_fir_sparse_instance_f32;
04152
04157 typedef struct
04158 {
04159 uint16_t numTaps;
04160 uint16_t stateIndex;
04161 q31_t *pState;
04162 q31_t *pCoeffs;
04163 uint16_t maxDelay;
04164 int32_t *pTapDelay;
04165 } arm_fir_sparse_instance_q31;
04166
04171 typedef struct
04172 {
04173 uint16_t numTaps;
04174 uint16_t stateIndex;
04175 q15_t *pState;
04176 q15_t *pCoeffs;
04177 uint16_t maxDelay;
04178 int32_t *pTapDelay;
04179 } arm_fir_sparse_instance_q15;
04180
04185 typedef struct
04186 {
04187 uint16_t numTaps;
04188 uint16_t stateIndex;
04189 q7_t *pState;
04190 q7_t *pCoeffs;
04191 uint16_t maxDelay;
04192 int32_t *pTapDelay;
04193 } arm_fir_sparse_instance_q7;
04194
04205 void arm_fir_sparse_f32(
04206 arm_fir_sparse_instance_f32 * S,
04207 float32_t * pSrc,
04208 float32_t * pDst,
04209 float32_t * pScratchIn,
04210 uint32_t blockSize);
04211
04224 void arm_fir_sparse_init_f32(
04225 arm_fir_sparse_instance_f32 * S,
04226 uint16_t numTaps,
04227 float32_t * pCoeffs,
04228 float32_t * pState,
04229 int32_t * pTapDelay,
04230 uint16_t maxDelay,
04231 uint32_t blockSize);
04232
04243 void arm_fir_sparse_q31(
04244 arm_fir_sparse_instance_q31 * S,
04245 q31_t * pSrc,
04246 q31_t * pDst,
04247 q31_t * pScratchIn,
04248 uint32_t blockSize);
04249
04262 void arm_fir_sparse_init_q31(
04263 arm_fir_sparse_instance_q31 * S,
04264 uint16_t numTaps,
04265 q31_t * pCoeffs,
04266 q31_t * pState,
04267 int32_t * pTapDelay,
04268 uint16_t maxDelay,
04269 uint32_t blockSize);
04270
04282 void arm_fir_sparse_q15(
04283 arm_fir_sparse_instance_q15 * S,
04284 q15_t * pSrc,
04285 q15_t * pDst,
04286 q15_t * pScratchIn,
04287 q31_t * pScratchOut,
04288 uint32_t blockSize);
04289
04290
04303 void arm_fir_sparse_init_q15(
04304 arm_fir_sparse_instance_q15 * S,
04305 uint16_t numTaps,
04306 q15_t * pCoeffs,
04307 q15_t * pState,
04308 int32_t * pTapDelay,
04309 uint16_t maxDelay,
04310 uint32_t blockSize);
04311
04323 void arm_fir_sparse_q7(
04324 arm_fir_sparse_instance_q7 * S,
04325 q7_t * pSrc,
04326 q7_t * pDst,
04327 q7_t * pScratchIn,
04328 q31_t * pScratchOut,
04329 uint32_t blockSize);
04330
04343 void arm_fir_sparse_init_q7(
04344 arm_fir_sparse_instance_q7 * S,
04345 uint16_t numTaps,
04346 q7_t * pCoeffs,
04347 q7_t * pState,
04348 int32_t *pTapDelay,
04349 uint16_t maxDelay,
04350 uint32_t blockSize);
04351
04352
04353
04354
04355
04356
04357
04358
04359
04360
04361 void arm_sin_cos_f32(
04362 float32_t theta,
04363 float32_t *pSinVal,
04364 float32_t *pCcosVal);
04365
04366
04367
04368
04369
04370
04371
04372
04373
04374 void arm_sin_cos_q31(
04375 q31_t theta,
04376 q31_t *pSinVal,
04377 q31_t *pCosVal);
04378
04379
04388 void arm_cmplx_conj_f32(
04389 float32_t * pSrc,
04390 float32_t * pDst,
04391 uint32_t numSamples);
04392
04401 void arm_cmplx_conj_q31(
04402 q31_t * pSrc,
04403 q31_t * pDst,
04404 uint32_t numSamples);
04405
04414 void arm_cmplx_conj_q15(
04415 q15_t * pSrc,
04416 q15_t * pDst,
04417 uint32_t numSamples);
04418
04419
04420
04429 void arm_cmplx_mag_squared_f32(
04430 float32_t * pSrc,
04431 float32_t * pDst,
04432 uint32_t numSamples);
04433
04442 void arm_cmplx_mag_squared_q31(
04443 q31_t * pSrc,
04444 q31_t * pDst,
04445 uint32_t numSamples);
04446
04455 void arm_cmplx_mag_squared_q15(
04456 q15_t * pSrc,
04457 q15_t * pDst,
04458 uint32_t numSamples);
04459
04460
04535 static INLINE float32_t arm_pid_f32(
04536 arm_pid_instance_f32 * S,
04537 float32_t in)
04538 {
04539 float32_t out;
04540
04541
04542 out = (S->A0 * in) +
04543 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
04544
04545
04546 S->state[1] = S->state[0];
04547 S->state[0] = in;
04548 S->state[2] = out;
04549
04550
04551 return (out);
04552
04553 }
04554
04570 static INLINE q31_t arm_pid_q31(
04571 arm_pid_instance_q31 * S,
04572 q31_t in)
04573 {
04574 q63_t acc;
04575 q31_t out;
04576
04577
04578 acc = (q63_t) S->A2 * S->state[1];
04579
04580 S->state[1] = S->state[0];
04581
04582
04583 acc += (q63_t) S->A1 * S->state[0];
04584
04585 S->state[0] = in;
04586
04587
04588 acc += (q63_t) S->A0 * in;
04589
04590
04591 out = (q31_t) (acc >> 31u);
04592
04593
04594 out += S->state[2];
04595
04596
04597 S->state[2] = out;
04598
04599
04600 return (out);
04601
04602 }
04603
04620 static INLINE q15_t arm_pid_q15(
04621 arm_pid_instance_q15 * S,
04622 q15_t in)
04623 {
04624 q63_t acc;
04625 q15_t out;
04626
04627
04628
04629
04630 acc = (q31_t) __SMUAD(S->A0, in);
04631
04632
04633 acc = __SMLALD(S->A1, (q31_t)__SIMD32(S->state), acc);
04634
04635
04636 acc += (q31_t) S->state[2] << 15;
04637
04638 #ifdef CCS
04639 out = (q15_t) __SSATA(acc, 15, 16);
04640 #else
04641
04642 out = (q15_t) (__SSAT((acc >> 15), 16));
04643 #endif
04644
04645
04646 S->state[1] = S->state[0];
04647 S->state[0] = in;
04648 S->state[2] = out;
04649
04650
04651 return (out);
04652
04653 }
04654
04668 arm_status arm_mat_inverse_f32(
04669 const arm_matrix_instance_f32 * src,
04670 arm_matrix_instance_f32 * dst);
04671
04672
04673
04716 static INLINE void arm_clarke_f32(
04717 float32_t Ia,
04718 float32_t Ib,
04719 float32_t * pIalpha,
04720 float32_t * pIbeta)
04721 {
04722
04723 *pIalpha = Ia;
04724
04725
04726 *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
04727
04728 }
04729
04745 static INLINE void arm_clarke_q31(
04746 q31_t Ia,
04747 q31_t Ib,
04748 q31_t * pIalpha,
04749 q31_t * pIbeta)
04750 {
04751 q31_t add, product;
04752
04753
04754 *pIalpha = Ia;
04755
04756
04757
04758 #if defined (CCS)
04759
04760 add = __SDADD(Ia, Ib);
04761
04762 #elif defined (__GNUC__)
04763
04764 add = __QDADD(Ia, Ib);
04765
04766 #else
04767
04768 add = __QADD(Ia, __QDBL(Ib));
04769
04770 #endif
04771
04772
04773 product = (q31_t)(((q63_t) add * 0x24F34E8B) >> 30);
04774
04775
04776 *pIbeta = product;
04777 }
04778
04790 void arm_q7_to_q31(
04791 q7_t * pSrc,
04792 q31_t * pDst,
04793 uint32_t blockSize);
04794
04795
04796
04797
04833 static INLINE void arm_inv_clarke_f32(
04834 float32_t Ialpha,
04835 float32_t Ibeta,
04836 float32_t * pIa,
04837 float32_t * pIb)
04838 {
04839
04840 *pIa = Ialpha;
04841
04842
04843 *pIb = -0.5f * Ialpha + (float32_t) 0.8660254039 *Ibeta;
04844 }
04845
04861 static INLINE void arm_inv_clarke_q31(
04862 q31_t Ialpha,
04863 q31_t Ibeta,
04864 q31_t * pIa,
04865 q31_t * pIb)
04866 {
04867 q31_t product1, product2;
04868
04869
04870 *pIa = Ialpha;
04871
04872
04873 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
04874
04875
04876 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
04877
04878
04879 *pIb = __QSUB(product2, product1);
04880
04881 }
04882
04894 void arm_q7_to_q15(
04895 q7_t * pSrc,
04896 q15_t * pDst,
04897 uint32_t blockSize);
04898
04899
04900
04948 static INLINE void arm_park_f32(
04949 float32_t Ialpha,
04950 float32_t Ibeta,
04951 float32_t * pId,
04952 float32_t * pIq,
04953 float32_t sinVal,
04954 float32_t cosVal)
04955 {
04956
04957 *pId = Ialpha * cosVal + Ibeta * sinVal;
04958
04959
04960 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
04961
04962 }
04963
04982 static INLINE void arm_park_q31(
04983 q31_t Ialpha,
04984 q31_t Ibeta,
04985 q31_t * pId,
04986 q31_t * pIq,
04987 q31_t sinVal,
04988 q31_t cosVal)
04989 {
04990 q31_t product1, product2;
04991 q31_t product3, product4;
04992
04993
04994 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
04995
04996
04997 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
04998
04999
05000
05001 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
05002
05003
05004 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
05005
05006
05007 *pId = __QADD(product1, product2);
05008
05009
05010 *pIq = __QSUB(product4, product3);
05011
05012 }
05013
05025 void arm_q7_to_float(
05026 q7_t * pSrc,
05027 float32_t * pDst,
05028 uint32_t blockSize);
05029
05030
05068 static INLINE void arm_inv_park_f32(
05069 float32_t Id,
05070 float32_t Iq,
05071 float32_t * pIalpha,
05072 float32_t * pIbeta,
05073 float32_t sinVal,
05074 float32_t cosVal)
05075 {
05076
05077 *pIalpha = Id * cosVal - Iq * sinVal;
05078
05079
05080 *pIbeta = Id * sinVal + Iq * cosVal;
05081
05082 }
05083
05084
05103 static INLINE void arm_inv_park_q31(
05104 q31_t Id,
05105 q31_t Iq,
05106 q31_t * pIalpha,
05107 q31_t * pIbeta,
05108 q31_t sinVal,
05109 q31_t cosVal)
05110 {
05111 q31_t product1, product2;
05112 q31_t product3, product4;
05113
05114
05115 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
05116
05117
05118 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
05119
05120
05121
05122 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
05123
05124
05125 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
05126
05127
05128 *pIalpha = __QSUB(product1, product2);
05129
05130
05131 *pIbeta = __QADD(product4, product3);
05132
05133 }
05134
05147 void arm_q31_to_float(
05148 q31_t * pSrc,
05149 float32_t * pDst,
05150 uint32_t blockSize);
05151
05199 static INLINE void arm_linear_interp_f32(
05200 arm_linear_interp_instance_f32 * S,
05201 float32_t *pIn,
05202 float32_t *pOut,
05203 uint32_t blockSize)
05204 {
05205
05206 float32_t y;
05207 float32_t x0, x1;
05208 float32_t y0, y1;
05209 float32_t xSpacing = S->xSpacing;
05210 int32_t i;
05211 float32_t *pYData = S->pYData;
05212 float32_t x;
05213 uint32_t blkCnt = blockSize;
05214
05215
05216 blkCnt = blockSize;
05217
05218 while(blkCnt > 0)
05219 {
05220
05221 x = *pIn++;
05222
05223
05224 i = (x - S->x1) / xSpacing;
05225
05226 if(i < 0)
05227 {
05228
05229 y = pYData[0];
05230 }
05231 else if(i >= S->nValues)
05232 {
05233
05234 y = pYData[S->nValues-1];
05235 }
05236 else
05237 {
05238
05239 x0 = S->x1 + i * xSpacing;
05240 x1 = S->x1 + (i + 1) * xSpacing;
05241
05242
05243 y0 = pYData[i];
05244 y1 = pYData[i + 1];
05245
05246
05247 y = y0 + (x - x0) * ((y1 - y0)/(x1-x0));
05248 }
05249
05250
05251 *pOut++ = y;
05252
05253
05254 blkCnt--;
05255 }
05256 }
05257
05258
05285 static INLINE void arm_linear_interp_q31(q31_t *pYData,
05286 q31_t *pIn, q31_t *pOut, uint32_t nValues, uint32_t blockSize)
05287 {
05288 q31_t y;
05289 q31_t y0, y1;
05290 q31_t fract;
05291 int32_t index;
05292 uint32_t blkCnt = blockSize;
05293 q31_t x;
05294
05295 while(blkCnt > 0)
05296 {
05297
05298 x = *pIn++;
05299
05300 index = ((x & 0xFFF00000) >> 20);
05301
05302 if(index >= (nValues - 1))
05303 {
05304 y = (pYData[nValues - 1]);
05305 }
05306 else if(index < 0)
05307 {
05308 y = (pYData[0]);
05309 }
05310 else
05311 {
05312
05313
05314
05315 fract = (x & 0x000FFFFF) << 11;
05316
05317
05318 y0 = pYData[index];
05319 y1 = pYData[index + 1u];
05320
05321
05322 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
05323
05324
05325 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
05326
05327
05328 y = (y << 1u);
05329
05330 }
05331
05332
05333 *pOut++ = y;
05334
05335
05336 blkCnt--;
05337 }
05338
05339 }
05340
05367 static INLINE void arm_linear_interp_q15(q15_t *pYData, q31_t *pIn, q15_t *pOut, uint32_t nValues, uint32_t blockSize)
05368 {
05369 q63_t y;
05370 q15_t y0, y1;
05371 q31_t fract;
05372 int32_t index;
05373 uint32_t blkCnt = blockSize;
05374 q31_t x;
05375
05376
05377 while(blkCnt > 0)
05378 {
05379 x = *pIn++;
05380
05381
05382
05383
05384 index = ((x & 0xFFF00000) >> 20u);
05385
05386 if(index >= (nValues - 1))
05387 {
05388
05389 y = (pYData[nValues - 1]);
05390 }
05391 else if(index < 0)
05392 {
05393
05394 y = (pYData[0]);
05395 }
05396 else
05397 {
05398
05399
05400 fract = (x & 0x000FFFFF);
05401
05402
05403 y0 = pYData[index];
05404 y1 = pYData[index + 1u];
05405
05406
05407 y = ((q63_t) y0 * (0xFFFFF - fract));
05408
05409
05410 y += ((q63_t) y1 * (fract));
05411
05412
05413 y = (y >> 20);
05414 }
05415
05416
05417 *pOut++ = (q15_t)y;
05418
05419
05420 blkCnt--;
05421 }
05422 }
05423
05424
05450 static INLINE void arm_linear_interp_q7(q7_t *pYData, q31_t *pIn, q7_t *pOut, uint32_t nValues, uint32_t blockSize)
05451 {
05452 q31_t y;
05453 q7_t y0, y1;
05454 q31_t fract;
05455 int32_t index;
05456 uint32_t blkCnt = blockSize;
05457 q31_t x;
05458
05459 blkCnt = blockSize;
05460
05461 while(blkCnt > 0)
05462 {
05463
05464 x = *pIn++;
05465
05466
05467
05468
05469 index = ((x & 0xFFF00000) >> 20u);
05470
05471
05472 if(index >= (nValues - 1))
05473 {
05474
05475 y = (pYData[nValues - 1]);
05476 }
05477 else if(index < 0)
05478 {
05479
05480 y = (pYData[0]);
05481 }
05482 else
05483 {
05484
05485
05486 fract = (x & 0x000FFFFF);
05487
05488
05489 y0 = pYData[index];
05490 y1 = pYData[index + 1u];
05491
05492
05493 y = ((y0 * (0xFFFFF - fract)));
05494
05495
05496 y += (y1 * fract);
05497
05498
05499 y = (y >> 20u);
05500
05501 }
05502
05503
05504 *pOut++ = (q7_t)y;
05505
05506
05507 blkCnt--;
05508 }
05509
05510 }
05521 float32_t arm_sin_f32(
05522 float32_t x);
05523
05530 q31_t arm_sin_q31(
05531 q31_t x);
05532
05539 q15_t arm_sin_q15(
05540 q15_t x);
05541
05548 float32_t arm_cos_f32(
05549 float32_t x);
05550
05557 q31_t arm_cos_q31(
05558 q31_t x);
05559
05566 q15_t arm_cos_q15(
05567 q15_t x);
05568
05569
05609 static INLINE arm_status arm_sqrt_f32(
05610 float32_t in, float32_t *pOut)
05611 {
05612 if(in > 0)
05613 {
05614 #if defined(FPU_PRESENT) && !defined(__GNUC__)
05615 *pOut = __sqrtf(in);
05616 #else
05617 *pOut = sqrtf(in);
05618 #endif
05619 return (ARM_MATH_SUCCESS);
05620 }
05621 else
05622 {
05623 *pOut = 0.0f;
05624 return (ARM_MATH_ARGUMENT_ERROR);
05625 }
05626 }
05627
05628
05636 arm_status arm_sqrt_q31(
05637 q31_t in, q31_t *pOut);
05638
05646 arm_status arm_sqrt_q15(
05647 q15_t in, q15_t *pOut);
05648
05662 static INLINE void arm_circularWrite_f32(
05663 int32_t * circBuffer,
05664 int32_t L,
05665 uint16_t * writeOffset,
05666 int32_t bufferInc,
05667 const int32_t * src,
05668 int32_t srcInc,
05669 uint32_t blockSize)
05670 {
05671 uint32_t i = 0u;
05672 int32_t wOffset;
05673
05674
05675
05676 wOffset = *writeOffset;
05677
05678
05679 i = blockSize;
05680
05681 while(i > 0u)
05682 {
05683
05684 circBuffer[wOffset] = *src;
05685
05686
05687 src += srcInc;
05688
05689
05690 wOffset += bufferInc;
05691 if(wOffset >= L)
05692 wOffset -= L;
05693
05694
05695 i--;
05696 }
05697
05698
05699 *writeOffset = wOffset;
05700 }
05701
05702
05703
05707 static INLINE void arm_circularRead_f32(
05708 int32_t * circBuffer,
05709 int32_t L,
05710 int32_t * readOffset,
05711 int32_t bufferInc,
05712 int32_t * dst,
05713 int32_t * dst_base,
05714 int32_t dst_length,
05715 int32_t dstInc,
05716 uint32_t blockSize)
05717 {
05718 uint32_t i = 0u;
05719 int32_t rOffset, dst_end;
05720
05721
05722
05723 rOffset = *readOffset;
05724 dst_end = (int32_t) (dst_base + dst_length);
05725
05726
05727 i = blockSize;
05728
05729 while(i > 0u)
05730 {
05731
05732 *dst = circBuffer[rOffset];
05733
05734
05735 dst += dstInc;
05736
05737 if(dst == (int32_t *) dst_end)
05738 {
05739 dst = dst_base;
05740 }
05741
05742
05743 rOffset += bufferInc;
05744
05745 if(rOffset >= L)
05746 {
05747 rOffset -= L;
05748 }
05749
05750
05751 i--;
05752 }
05753
05754
05755 *readOffset = rOffset;
05756 }
05757
05762 static INLINE void arm_circularWrite_q15(
05763 q15_t * circBuffer,
05764 int32_t L,
05765 uint16_t * writeOffset,
05766 int32_t bufferInc,
05767 const q15_t * src,
05768 int32_t srcInc,
05769 uint32_t blockSize)
05770 {
05771 uint32_t i = 0u;
05772 int32_t wOffset;
05773
05774
05775
05776 wOffset = *writeOffset;
05777
05778
05779 i = blockSize;
05780
05781 while(i > 0u)
05782 {
05783
05784 circBuffer[wOffset] = *src;
05785
05786
05787 src += srcInc;
05788
05789
05790 wOffset += bufferInc;
05791 if(wOffset >= L)
05792 wOffset -= L;
05793
05794
05795 i--;
05796 }
05797
05798
05799 *writeOffset = wOffset;
05800 }
05801
05802
05803
05807 static INLINE void arm_circularRead_q15(
05808 q15_t * circBuffer,
05809 int32_t L,
05810 int32_t * readOffset,
05811 int32_t bufferInc,
05812 q15_t * dst,
05813 q15_t * dst_base,
05814 int32_t dst_length,
05815 int32_t dstInc,
05816 uint32_t blockSize)
05817 {
05818 uint32_t i = 0;
05819 int32_t rOffset, dst_end;
05820
05821
05822
05823 rOffset = *readOffset;
05824
05825 dst_end = (int32_t) (dst_base + dst_length);
05826
05827
05828 i = blockSize;
05829
05830 while(i > 0u)
05831 {
05832
05833 *dst = circBuffer[rOffset];
05834
05835
05836 dst += dstInc;
05837
05838 if(dst == (q15_t *) dst_end)
05839 {
05840 dst = dst_base;
05841 }
05842
05843
05844 rOffset += bufferInc;
05845
05846 if(rOffset >= L)
05847 {
05848 rOffset -= L;
05849 }
05850
05851
05852 i--;
05853 }
05854
05855
05856 *readOffset = rOffset;
05857 }
05858
05859
05864 static INLINE void arm_circularWrite_q7(
05865 q7_t * circBuffer,
05866 int32_t L,
05867 uint16_t * writeOffset,
05868 int32_t bufferInc,
05869 const q7_t * src,
05870 int32_t srcInc,
05871 uint32_t blockSize)
05872 {
05873 uint32_t i = 0u;
05874 int32_t wOffset;
05875
05876
05877
05878 wOffset = *writeOffset;
05879
05880
05881 i = blockSize;
05882
05883 while(i > 0u)
05884 {
05885
05886 circBuffer[wOffset] = *src;
05887
05888
05889 src += srcInc;
05890
05891
05892 wOffset += bufferInc;
05893 if(wOffset >= L)
05894 wOffset -= L;
05895
05896
05897 i--;
05898 }
05899
05900
05901 *writeOffset = wOffset;
05902 }
05903
05904
05905
05909 static INLINE void arm_circularRead_q7(
05910 q7_t * circBuffer,
05911 int32_t L,
05912 int32_t * readOffset,
05913 int32_t bufferInc,
05914 q7_t * dst,
05915 q7_t * dst_base,
05916 int32_t dst_length,
05917 int32_t dstInc,
05918 uint32_t blockSize)
05919 {
05920 uint32_t i = 0;
05921 int32_t rOffset, dst_end;
05922
05923
05924
05925 rOffset = *readOffset;
05926
05927 dst_end = (int32_t) (dst_base + dst_length);
05928
05929
05930 i = blockSize;
05931
05932 while(i > 0u)
05933 {
05934
05935 *dst = circBuffer[rOffset];
05936
05937
05938 dst += dstInc;
05939
05940 if(dst == (q7_t *) dst_end)
05941 {
05942 dst = dst_base;
05943 }
05944
05945
05946 rOffset += bufferInc;
05947
05948 if(rOffset >= L)
05949 {
05950 rOffset -= L;
05951 }
05952
05953
05954 i--;
05955 }
05956
05957
05958 *readOffset = rOffset;
05959 }
05960
05961
05970 void arm_power_q31(
05971 q31_t * pSrc,
05972 uint32_t blockSize,
05973 q63_t * pResult);
05974
05983 void arm_power_f32(
05984 float32_t * pSrc,
05985 uint32_t blockSize,
05986 float32_t * pResult);
05987
05996 void arm_power_q15(
05997 q15_t * pSrc,
05998 uint32_t blockSize,
05999 q63_t * pResult);
06000
06009 void arm_power_q7(
06010 q7_t * pSrc,
06011 uint32_t blockSize,
06012 q31_t * pResult);
06013
06022 void arm_mean_q7(
06023 q7_t * pSrc,
06024 uint32_t blockSize,
06025 q7_t * pResult);
06026
06034 void arm_mean_q15(
06035 q15_t * pSrc,
06036 uint32_t blockSize,
06037 q15_t * pResult);
06038
06046 void arm_mean_q31(
06047 q31_t * pSrc,
06048 uint32_t blockSize,
06049 q31_t * pResult);
06050
06058 void arm_mean_f32(
06059 float32_t * pSrc,
06060 uint32_t blockSize,
06061 float32_t * pResult);
06062
06071 void arm_var_f32(
06072 float32_t * pSrc,
06073 uint32_t blockSize,
06074 float32_t * pResult);
06075
06084 void arm_var_q31(
06085 q31_t * pSrc,
06086 uint32_t blockSize,
06087 q63_t * pResult);
06088
06097 void arm_var_q15(
06098 q15_t * pSrc,
06099 uint32_t blockSize,
06100 q31_t * pResult);
06101
06110 void arm_rms_f32(
06111 float32_t * pSrc,
06112 uint32_t blockSize,
06113 float32_t * pResult);
06114
06123 void arm_rms_q31(
06124 q31_t * pSrc,
06125 uint32_t blockSize,
06126 q31_t * pResult);
06127
06136 void arm_rms_q15(
06137 q15_t * pSrc,
06138 uint32_t blockSize,
06139 q15_t * pResult);
06140
06149 void arm_std_f32(
06150 float32_t * pSrc,
06151 uint32_t blockSize,
06152 float32_t * pResult);
06153
06162 void arm_std_q31(
06163 q31_t * pSrc,
06164 uint32_t blockSize,
06165 q31_t * pResult);
06166
06175 void arm_std_q15(
06176 q15_t * pSrc,
06177 uint32_t blockSize,
06178 q15_t * pResult);
06179
06188 void arm_cmplx_mag_f32(
06189 float32_t * pSrc,
06190 float32_t * pDst,
06191 uint32_t numSamples);
06192
06201 void arm_cmplx_mag_q31(
06202 q31_t * pSrc,
06203 q31_t * pDst,
06204 uint32_t numSamples);
06205
06214 void arm_cmplx_mag_q15(
06215 q15_t * pSrc,
06216 q15_t * pDst,
06217 uint32_t numSamples);
06218
06229 void arm_cmplx_dot_prod_q15(
06230 q15_t * pSrcA,
06231 q15_t * pSrcB,
06232 uint32_t numSamples,
06233 q31_t * realResult,
06234 q31_t * imagResult);
06235
06246 void arm_cmplx_dot_prod_q31(
06247 q31_t * pSrcA,
06248 q31_t * pSrcB,
06249 uint32_t numSamples,
06250 q63_t * realResult,
06251 q63_t * imagResult);
06252
06263 void arm_cmplx_dot_prod_f32(
06264 float32_t * pSrcA,
06265 float32_t * pSrcB,
06266 uint32_t numSamples,
06267 float32_t * realResult,
06268 float32_t * imagResult);
06269
06279 void arm_cmplx_mult_real_q15(
06280 q15_t * pSrcCmplx,
06281 q15_t * pSrcReal,
06282 q15_t * pCmplxDst,
06283 uint32_t numSamples);
06284
06294 void arm_cmplx_mult_real_q31(
06295 q31_t * pSrcCmplx,
06296 q31_t * pSrcReal,
06297 q31_t * pCmplxDst,
06298 uint32_t numSamples);
06299
06309 void arm_cmplx_mult_real_f32(
06310 float32_t * pSrcCmplx,
06311 float32_t * pSrcReal,
06312 float32_t * pCmplxDst,
06313 uint32_t numSamples);
06314
06324 void arm_min_q7(
06325 q7_t * pSrc,
06326 uint32_t blockSize,
06327 q7_t * result,
06328 uint32_t * index);
06329
06339 void arm_min_q15(
06340 q15_t * pSrc,
06341 uint32_t blockSize,
06342 q15_t * pResult,
06343 uint32_t * pIndex);
06344
06353 void arm_min_q31(
06354 q31_t * pSrc,
06355 uint32_t blockSize,
06356 q31_t * pResult,
06357 uint32_t * pIndex);
06358
06368 void arm_min_f32(
06369 float32_t * pSrc,
06370 uint32_t blockSize,
06371 float32_t * pResult,
06372 uint32_t * pIndex);
06373
06383 void arm_max_q7(
06384 q7_t * pSrc,
06385 uint32_t blockSize,
06386 q7_t * pResult,
06387 uint32_t * pIndex);
06388
06398 void arm_max_q15(
06399 q15_t * pSrc,
06400 uint32_t blockSize,
06401 q15_t * pResult,
06402 uint32_t * pIndex);
06403
06413 void arm_max_q31(
06414 q31_t * pSrc,
06415 uint32_t blockSize,
06416 q31_t * pResult,
06417 uint32_t * pIndex);
06418
06428 void arm_max_f32(
06429 float32_t * pSrc,
06430 uint32_t blockSize,
06431 float32_t * pResult,
06432 uint32_t * pIndex);
06433
06443 void arm_cmplx_mult_cmplx_q15(
06444 q15_t * pSrcA,
06445 q15_t * pSrcB,
06446 q15_t * pDst,
06447 uint32_t numSamples);
06448
06458 void arm_cmplx_mult_cmplx_q31(
06459 q31_t * pSrcA,
06460 q31_t * pSrcB,
06461 q31_t * pDst,
06462 uint32_t numSamples);
06463
06473 void arm_cmplx_mult_cmplx_f32(
06474 float32_t * pSrcA,
06475 float32_t * pSrcB,
06476 float32_t * pDst,
06477 uint32_t numSamples);
06478
06486 void arm_float_to_q31(
06487 float32_t * pSrc,
06488 q31_t * pDst,
06489 uint32_t blockSize);
06490
06498 void arm_float_to_q15(
06499 float32_t * pSrc,
06500 q15_t * pDst,
06501 uint32_t blockSize);
06502
06510 void arm_float_to_q7(
06511 float32_t * pSrc,
06512 q7_t * pDst,
06513 uint32_t blockSize);
06514
06515
06523 void arm_q31_to_q15(
06524 q31_t * pSrc,
06525 q15_t * pDst,
06526 uint32_t blockSize);
06527
06535 void arm_q31_to_q7(
06536 q31_t * pSrc,
06537 q7_t * pDst,
06538 uint32_t blockSize);
06539
06547 void arm_q15_to_float(
06548 q15_t * pSrc,
06549 float32_t * pDst,
06550 uint32_t blockSize);
06551
06552
06560 void arm_q15_to_q31(
06561 q15_t * pSrc,
06562 q31_t * pDst,
06563 uint32_t blockSize);
06564
06565
06573 void arm_q15_to_q7(
06574 q15_t * pSrc,
06575 q7_t * pDst,
06576 uint32_t blockSize);
06577
06578
06653 static INLINE void arm_bilinear_interp_f32(
06654 const arm_bilinear_interp_instance_f32 * S,
06655 float32_t *X,
06656 float32_t *Y,
06657 float32_t *pOut,
06658 uint32_t blockSize)
06659 {
06660 float32_t out;
06661 float32_t f00, f01, f10, f11;
06662 float32_t *pData = S->pData;
06663 int32_t xIndex, yIndex, index;
06664 float32_t xdiff, ydiff;
06665 float32_t b1, b2, b3, b4;
06666 uint32_t blkCnt = blockSize;
06667 float32_t inX, inY;
06668
06669 while(blkCnt > 0)
06670 {
06671
06672 inX = *X++;
06673
06674 inY = *Y++;
06675
06676 xIndex = (int32_t) inX;
06677 yIndex = (int32_t) inY;
06678
06679
06680
06681 if(xIndex < 0 || xIndex > (S->numRows-1) || yIndex < 0 || yIndex > ( S->numCols-1))
06682 {
06683 *pOut++ = 0;
06684 }
06685 else
06686 {
06687
06688 index = (xIndex - 1) + (yIndex - 1) * S->numRows;
06689
06690
06691 f00 = pData[index];
06692 f01 = pData[index + 1];
06693
06694
06695 index = (xIndex - 1) + (yIndex) * S->numRows;
06696
06697
06698 xdiff = inX - xIndex;
06699
06700
06701 ydiff = inY - yIndex;
06702
06703
06704 f10 = pData[index];
06705 f11 = pData[index + 1];
06706
06707 out = xdiff * ydiff;
06708
06709
06710 b1 = f00;
06711 b4 = f00 - f01 - f10 + f11;
06712 b2 = f01 - f00;
06713 b3 = f10 - f00;
06714
06715
06716 out = b1 + b2 * xdiff + b3 * ydiff + b4 * out;
06717
06718
06719 *pOut++ = (out);
06720 }
06721
06722
06723 blkCnt--;
06724 }
06725
06726 }
06737 static INLINE void arm_bilinear_interp_q31(
06738 arm_bilinear_interp_instance_q31 * S,
06739 q31_t *X,
06740 q31_t *Y,
06741 q31_t *pOut,
06742 uint32_t blockSize)
06743 {
06744 q31_t out1, out2;
06745 q63_t acc1 = 0, acc2 = 0;
06746 q31_t xfract, yfract;
06747 q31_t x1, x2, y1, y2;
06748 int32_t rI, cI;
06749 q31_t *pYData = S->pData;
06750 uint32_t nRows = S->numRows;
06751 uint32_t blkCnt = blockSize;
06752 q31_t inX, inY;
06753
06754
06755 while(blkCnt > 0)
06756 {
06757
06758 inX = *X++;
06759
06760 inY = *Y++;
06761
06762
06763
06764
06765 rI = ((inX & 0xFFF00000) >> 20u);
06766
06767
06768
06769
06770 cI = ((inY & 0xFFF00000) >> 20u);
06771
06772
06773
06774 if(rI < 0 || rI > (S->numRows-1) || cI < 0 || cI > ( S->numCols-1))
06775 {
06776 *pOut++ = 0;
06777 }
06778 else
06779 {
06780
06781
06782 xfract = (inX & 0x000FFFFF) << 11u;
06783
06784
06785 x1 = pYData[(rI) + nRows * (cI)];
06786 x2 = pYData[(rI) + nRows * (cI) + 1u];
06787
06788
06789
06790 yfract = (inY & 0x000FFFFF) << 11u;
06791
06792
06793 y1 = pYData[(rI) + nRows * (cI + 1)];
06794 y2 = pYData[(rI) + nRows * (cI + 1) + 1u];
06795
06796
06797 out1 = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
06798
06799
06800 out2 = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
06801
06802
06803 acc1 = (q31_t) (((q63_t) out1 * (0x7FFFFFFF - yfract)) >> 32);
06804
06805 acc2 = (q31_t) (((q63_t) out2 * (xfract)) >> 32);
06806
06807
06808 out1 = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
06809
06810
06811 out2 = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
06812
06813
06814 acc1 = (q31_t) ((((q63_t) out1 * (yfract)) + (acc1 << 32)) >> 32);
06815
06816 acc2 = (q31_t) ((((q63_t) out2 * (yfract)) + (acc2 << 32)) >> 32);
06817
06818
06819 out1 = (q31_t)acc1 + (q31_t)acc2;
06820
06821
06822 out1 = (out1 << 2u);
06823
06824
06825 *pOut++ = out1;
06826 }
06827
06828
06829 blkCnt--;
06830 }
06831
06832 }
06833
06844 static INLINE void arm_bilinear_interp_q15(
06845 arm_bilinear_interp_instance_q15 * S,
06846 q31_t *X,
06847 q31_t *Y,
06848 q15_t *pOut,
06849 uint32_t blockSize)
06850 {
06851 q63_t acc = 0, acc1 = 0;
06852 q31_t out1, out2;
06853 q15_t x1, x2, y1, y2;
06854 q31_t xfract, yfract;
06855 int32_t rI, cI;
06856 q15_t *pYData = S->pData;
06857 uint32_t nRows = S->numRows;
06858 q31_t inX, inY;
06859 uint32_t blkCnt = blockSize;
06860
06861 while(blkCnt > 0)
06862 {
06863
06864 inX = *X++;
06865
06866 inY = *Y++;
06867
06868
06869
06870
06871 rI = ((inX & 0xFFF00000) >> 20);
06872
06873
06874
06875
06876 cI = ((inY & 0xFFF00000) >> 20);
06877
06878
06879
06880 if(rI < 0 || rI > (S->numRows-1) || cI < 0 || cI > ( S->numCols-1))
06881 {
06882
06883 *pOut++ = 0;
06884 }
06885 else
06886 {
06887
06888
06889
06890 xfract = (inX & 0x000FFFFF);
06891
06892
06893 x1 = pYData[(rI) + nRows * (cI)];
06894 x2 = pYData[(rI) + nRows * (cI) + 1u];
06895
06896
06897
06898 yfract = (inY & 0x000FFFFF);
06899
06900
06901 y1 = pYData[(rI) + nRows * (cI + 1)];
06902 y2 = pYData[(rI) + nRows * (cI + 1) + 1u];
06903
06904
06905
06906
06907 out1 = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
06908
06909 acc = ((q63_t) out1 * (0xFFFFF - yfract));
06910
06911
06912 out2 = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
06913
06914
06915 acc1 = ((q63_t) out2 * (xfract));
06916
06917
06918 out1 = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
06919
06920 acc += ((q63_t) out1 * (yfract));
06921
06922
06923 out2 = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
06924
06925
06926 acc1 += ((q63_t) out2 * (yfract));
06927
06928
06929 acc = acc + acc1;
06930
06931
06932
06933 x1 = (acc >> 36);
06934
06935
06936 *pOut++ = x1;
06937 }
06938
06939
06940 blkCnt--;
06941 }
06942
06943 }
06944
06955 static INLINE void arm_bilinear_interp_q7(
06956 arm_bilinear_interp_instance_q7 * S,
06957 q31_t *X,
06958 q31_t *Y,
06959 q7_t *pOut,
06960 uint32_t blockSize)
06961 {
06962 q63_t acc1 = 0, acc2 = 0;
06963 q31_t out1, out2;
06964 q31_t xfract, yfract;
06965 q7_t x1, x2, y1, y2;
06966 int32_t rI, cI;
06967 q7_t *pYData = S->pData;
06968 uint32_t nRows = S->numRows;
06969 uint32_t blkCnt = blockSize;
06970 q31_t inX, inY;
06971
06972 while(blkCnt > 0)
06973 {
06974
06975 inX = *X++;
06976
06977 inY = *Y++;
06978
06979
06980
06981
06982 rI = ((inX & 0xFFF00000) >> 20);
06983
06984
06985
06986
06987 cI = ((inY & 0xFFF00000) >> 20);
06988
06989
06990
06991 if(rI < 0 || rI > (S->numRows-1) || cI < 0 || cI > ( S->numCols-1))
06992 {
06993
06994 *pOut++ = 0;
06995 }
06996 else
06997 {
06998
06999
07000 xfract = (inX & 0x000FFFFF);
07001
07002
07003 x1 = pYData[(rI) + nRows * (cI)];
07004 x2 = pYData[(rI) + nRows * (cI) + 1u];
07005
07006
07007
07008 yfract = (inY & 0x000FFFFF);
07009
07010
07011 y1 = pYData[(rI) + nRows * (cI + 1)];
07012 y2 = pYData[(rI) + nRows * (cI + 1) + 1u];
07013
07014
07015 out1 = ((x1 * (0xFFFFF - xfract)));
07016
07017
07018 out2 = ((x2 * (0xFFFFF - yfract)));
07019
07020
07021 acc1 = (((q63_t) out1 * (0xFFFFF - yfract)));
07022
07023 acc2 = (((q63_t) out2 * (xfract)));
07024
07025
07026 out1 = ((y1 * (0xFFFFF - xfract)));
07027
07028
07029 out2 = ((y2 * (yfract)));
07030
07031
07032 acc1 += (((q63_t) out1 * (yfract)));
07033
07034 acc2 += (((q63_t) out2 * (xfract)));
07035
07036
07037 acc1 = acc1 + acc2;
07038
07039
07040 x1 = (acc1 >> 40);
07041
07042
07043 *pOut++ = x1;
07044 }
07045
07046
07047 blkCnt--;
07048 }
07049
07050 }
07051
07061 #ifdef __cplusplus
07062 }
07063 #endif
07064
07065
07066 #endif
07067
07068