ref.h 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396
  1. #ifndef _REF_H
  2. #define _REF_H
  3. #include <math.h>
  4. #include <stdint.h>
  5. #include "arm_math.h"
  6. #ifdef __cplusplus
  7. extern "C"
  8. {
  9. #endif
  10. #ifndef PI
  11. #define PI 3.14159265358979f
  12. #endif
  13. /**
  14. * @brief 8-bit fractional data type in 1.7 format.
  15. */
  16. // typedef int8_t q7_t;
  17. /**
  18. * @brief 16-bit fractional data type in 1.15 format.
  19. */
  20. // typedef int16_t q15_t;
  21. /**
  22. * @brief 32-bit fractional data type in 1.31 format.
  23. */
  24. // typedef int32_t q31_t;
  25. /**
  26. * @brief 64-bit fractional data type in 1.63 format.
  27. */
  28. // typedef int64_t q63_t;
  29. /**
  30. * @brief 32-bit floating-point type definition.
  31. */
  32. // typedef float float32_t;
  33. /**
  34. * @brief 64-bit floating-point type definition.
  35. */
  36. // typedef double float64_t;
  37. /**
  38. * @brief Error status returned by some functions in the library.
  39. */
  40. typedef enum
  41. {
  42. REF_Q7 = 0,
  43. REF_Q15,
  44. REF_Q31,
  45. REF_F32,
  46. } dataType;
  47. #define FLT_MAX 3.40282347e+38F
  48. #define DBL_MAX 1.79769313486231571e+308
  49. #define FLT_MIN 1.175494351e-38F
  50. #define DBL_MIN 2.22507385850720138e-308
  51. #define SCHAR_MIN (-128)
  52. /* mimimum value for an object of type signed char */
  53. #define SCHAR_MAX 127
  54. /* maximum value for an object of type signed char */
  55. #define UCHAR_MAX 255
  56. /* maximum value for an object of type unsigned char */
  57. #define SHRT_MIN (-0x8000)
  58. /* minimum value for an object of type short int */
  59. #define SHRT_MAX 0x7fff
  60. /* maximum value for an object of type short int */
  61. #define USHRT_MAX 65535
  62. /* maximum value for an object of type unsigned short int */
  63. #define INT_MIN (~0x7fffffff) /* -2147483648 and 0x80000000 are unsigned */
  64. /* minimum value for an object of type int */
  65. #define INT_MAX 0x7fffffff
  66. /* maximum value for an object of type int */
  67. #define UINT_MAX 0xffffffffU
  68. /* maximum value for an object of type unsigned int */
  69. #define LONG_MIN (~0x7fffffffL)
  70. /* minimum value for an object of type long int */
  71. #define LONG_MAX 0x7fffffffL
  72. /* maximum value for an object of type long int */
  73. #define ULONG_MAX 0xffffffffUL
  74. /* maximum value for an object of type unsigned long int */
  75. /*
  76. * Ref Lib Global Variables
  77. */
  78. extern float32_t scratchArray[];
  79. extern arm_cfft_instance_f32 ref_cfft_sR_f32_len8192;
  80. /*
  81. * Ref Lib Functions
  82. */
  83. /*
  84. * Helper Functions
  85. */
  86. q31_t ref_sat_n(q31_t num, uint32_t bits);
  87. q31_t ref_sat_q31(q63_t num);
  88. q15_t ref_sat_q15(q31_t num);
  89. q7_t ref_sat_q7(q15_t num);
  90. float32_t ref_pow(float32_t a, uint32_t b);
  91. extern float32_t tempMatrixArray[];
  92. float32_t ref_detrm(float32_t *pSrc, float32_t *temp, uint32_t size);
  93. void ref_cofact(float32_t *pSrc, float32_t *pDst, float32_t *temp, uint32_t size);
  94. float64_t ref_detrm64(float64_t *pSrc, float64_t *temp, uint32_t size);
  95. void ref_cofact64(float64_t *pSrc, float64_t *pDst, float64_t *temp, uint32_t size);
  96. /*
  97. * Basic Math Functions
  98. */
  99. void ref_abs_f32(
  100. float32_t * pSrc,
  101. float32_t * pDst,
  102. uint32_t blockSize);
  103. void ref_abs_q31(
  104. q31_t * pSrc,
  105. q31_t * pDst,
  106. uint32_t blockSize);
  107. void ref_abs_q15(
  108. q15_t * pSrc,
  109. q15_t * pDst,
  110. uint32_t blockSize);
  111. void ref_abs_q7(
  112. q7_t * pSrc,
  113. q7_t * pDst,
  114. uint32_t blockSize);
  115. void ref_add_f32(
  116. float32_t * pSrcA,
  117. float32_t * pSrcB,
  118. float32_t * pDst,
  119. uint32_t blockSize);
  120. void ref_add_q31(
  121. q31_t * pSrcA,
  122. q31_t * pSrcB,
  123. q31_t * pDst,
  124. uint32_t blockSize);
  125. void ref_add_q15(
  126. q15_t * pSrcA,
  127. q15_t * pSrcB,
  128. q15_t * pDst,
  129. uint32_t blockSize);
  130. void ref_add_q7(
  131. q7_t * pSrcA,
  132. q7_t * pSrcB,
  133. q7_t * pDst,
  134. uint32_t blockSize);
  135. void ref_dot_prod_f32(
  136. float32_t * pSrcA,
  137. float32_t * pSrcB,
  138. uint32_t blockSize,
  139. float32_t * result);
  140. void ref_dot_prod_q31(
  141. q31_t * pSrcA,
  142. q31_t * pSrcB,
  143. uint32_t blockSize,
  144. q63_t * result);
  145. void ref_dot_prod_q15(
  146. q15_t * pSrcA,
  147. q15_t * pSrcB,
  148. uint32_t blockSize,
  149. q63_t * result);
  150. void ref_dot_prod_q7(
  151. q7_t * pSrcA,
  152. q7_t * pSrcB,
  153. uint32_t blockSize,
  154. q31_t * result);
  155. void ref_mult_f32(
  156. float32_t * pSrcA,
  157. float32_t * pSrcB,
  158. float32_t * pDst,
  159. uint32_t blockSize);
  160. void ref_mult_q31(
  161. q31_t * pSrcA,
  162. q31_t * pSrcB,
  163. q31_t * pDst,
  164. uint32_t blockSize);
  165. void ref_mult_q15(
  166. q15_t * pSrcA,
  167. q15_t * pSrcB,
  168. q15_t * pDst,
  169. uint32_t blockSize);
  170. void ref_mult_q7(
  171. q7_t * pSrcA,
  172. q7_t * pSrcB,
  173. q7_t * pDst,
  174. uint32_t blockSize);
  175. void ref_negate_f32(
  176. float32_t * pSrc,
  177. float32_t * pDst,
  178. uint32_t blockSize);
  179. void ref_negate_q31(
  180. q31_t * pSrc,
  181. q31_t * pDst,
  182. uint32_t blockSize);
  183. void ref_negate_q15(
  184. q15_t * pSrc,
  185. q15_t * pDst,
  186. uint32_t blockSize);
  187. void ref_negate_q7(
  188. q7_t * pSrc,
  189. q7_t * pDst,
  190. uint32_t blockSize);
  191. void ref_offset_f32(
  192. float32_t * pSrc,
  193. float32_t offset,
  194. float32_t * pDst,
  195. uint32_t blockSize);
  196. void ref_offset_q31(
  197. q31_t * pSrc,
  198. q31_t offset,
  199. q31_t * pDst,
  200. uint32_t blockSize);
  201. void ref_offset_q15(
  202. q15_t * pSrc,
  203. q15_t offset,
  204. q15_t * pDst,
  205. uint32_t blockSize);
  206. void ref_offset_q7(
  207. q7_t * pSrc,
  208. q7_t offset,
  209. q7_t * pDst,
  210. uint32_t blockSize);
  211. void ref_scale_f32(
  212. float32_t * pSrc,
  213. float32_t scale,
  214. float32_t * pDst,
  215. uint32_t blockSize);
  216. void ref_scale_q31(
  217. q31_t * pSrc,
  218. q31_t scaleFract,
  219. int8_t shift,
  220. q31_t * pDst,
  221. uint32_t blockSize);
  222. void ref_scale_q15(
  223. q15_t * pSrc,
  224. q15_t scaleFract,
  225. int8_t shift,
  226. q15_t * pDst,
  227. uint32_t blockSize);
  228. void ref_scale_q7(
  229. q7_t * pSrc,
  230. q7_t scaleFract,
  231. int8_t shift,
  232. q7_t * pDst,
  233. uint32_t blockSize);
  234. void ref_shift_q31(
  235. q31_t * pSrc,
  236. int8_t shiftBits,
  237. q31_t * pDst,
  238. uint32_t blockSize);
  239. void ref_shift_q15(
  240. q15_t * pSrc,
  241. int8_t shiftBits,
  242. q15_t * pDst,
  243. uint32_t blockSize);
  244. void ref_shift_q7(
  245. q7_t * pSrc,
  246. int8_t shiftBits,
  247. q7_t * pDst,
  248. uint32_t blockSize);
  249. void ref_sub_f32(
  250. float32_t * pSrcA,
  251. float32_t * pSrcB,
  252. float32_t * pDst,
  253. uint32_t blockSize);
  254. void ref_sub_q31(
  255. q31_t * pSrcA,
  256. q31_t * pSrcB,
  257. q31_t * pDst,
  258. uint32_t blockSize);
  259. void ref_sub_q15(
  260. q15_t * pSrcA,
  261. q15_t * pSrcB,
  262. q15_t * pDst,
  263. uint32_t blockSize);
  264. void ref_sub_q7(
  265. q7_t * pSrcA,
  266. q7_t * pSrcB,
  267. q7_t * pDst,
  268. uint32_t blockSize);
  269. /*
  270. * Complex Math Functions
  271. */
  272. void ref_cmplx_conj_f32(
  273. float32_t * pSrc,
  274. float32_t * pDst,
  275. uint32_t numSamples);
  276. void ref_cmplx_conj_q31(
  277. q31_t * pSrc,
  278. q31_t * pDst,
  279. uint32_t numSamples);
  280. void ref_cmplx_conj_q15(
  281. q15_t * pSrc,
  282. q15_t * pDst,
  283. uint32_t numSamples);
  284. void ref_cmplx_dot_prod_f32(
  285. float32_t * pSrcA,
  286. float32_t * pSrcB,
  287. uint32_t numSamples,
  288. float32_t * realResult,
  289. float32_t * imagResult);
  290. void ref_cmplx_dot_prod_q31(
  291. q31_t * pSrcA,
  292. q31_t * pSrcB,
  293. uint32_t numSamples,
  294. q63_t * realResult,
  295. q63_t * imagResult);
  296. void ref_cmplx_dot_prod_q15(
  297. q15_t * pSrcA,
  298. q15_t * pSrcB,
  299. uint32_t numSamples,
  300. q31_t * realResult,
  301. q31_t * imagResult);
  302. void ref_cmplx_mag_f32(
  303. float32_t * pSrc,
  304. float32_t * pDst,
  305. uint32_t numSamples);
  306. void ref_cmplx_mag_q31(
  307. q31_t * pSrc,
  308. q31_t * pDst,
  309. uint32_t numSamples);
  310. void ref_cmplx_mag_q15(
  311. q15_t * pSrc,
  312. q15_t * pDst,
  313. uint32_t numSamples);
  314. void ref_cmplx_mag_squared_f32(
  315. float32_t * pSrc,
  316. float32_t * pDst,
  317. uint32_t numSamples);
  318. void ref_cmplx_mag_squared_q31(
  319. q31_t * pSrc,
  320. q31_t * pDst,
  321. uint32_t numSamples);
  322. void ref_cmplx_mag_squared_q15(
  323. q15_t * pSrc,
  324. q15_t * pDst,
  325. uint32_t numSamples);
  326. void ref_cmplx_mult_cmplx_f32(
  327. float32_t * pSrcA,
  328. float32_t * pSrcB,
  329. float32_t * pDst,
  330. uint32_t numSamples);
  331. void ref_cmplx_mult_cmplx_q31(
  332. q31_t * pSrcA,
  333. q31_t * pSrcB,
  334. q31_t * pDst,
  335. uint32_t numSamples);
  336. void ref_cmplx_mult_cmplx_q15(
  337. q15_t * pSrcA,
  338. q15_t * pSrcB,
  339. q15_t * pDst,
  340. uint32_t numSamples);
  341. void ref_cmplx_mult_real_f32(
  342. float32_t * pSrcCmplx,
  343. float32_t * pSrcReal,
  344. float32_t * pCmplxDst,
  345. uint32_t numSamples);
  346. void ref_cmplx_mult_real_q31(
  347. q31_t * pSrcCmplx,
  348. q31_t * pSrcReal,
  349. q31_t * pCmplxDst,
  350. uint32_t numSamples);
  351. void ref_cmplx_mult_real_q15(
  352. q15_t * pSrcCmplx,
  353. q15_t * pSrcReal,
  354. q15_t * pCmplxDst,
  355. uint32_t numSamples);
  356. /*
  357. * Controller Functions
  358. */
  359. void ref_sin_cos_f32(
  360. float32_t theta,
  361. float32_t * pSinVal,
  362. float32_t * pCosVal);
  363. void ref_sin_cos_q31(
  364. q31_t theta,
  365. q31_t * pSinVal,
  366. q31_t * pCosVal);
  367. float32_t ref_pid_f32(
  368. arm_pid_instance_f32 * S,
  369. float32_t in);
  370. q31_t ref_pid_q31(
  371. arm_pid_instance_q31 * S,
  372. q31_t in);
  373. q15_t ref_pid_q15(
  374. arm_pid_instance_q15 * S,
  375. q15_t in);
  376. /*
  377. * Fast Math Functions
  378. */
  379. #define ref_sin_f32(a) sinf(a)
  380. q31_t ref_sin_q31(q31_t x);
  381. q15_t ref_sin_q15(q15_t x);
  382. #define ref_cos_f32(a) cosf(a)
  383. q31_t ref_cos_q31(q31_t x);
  384. q15_t ref_cos_q15(q15_t x);
  385. arm_status ref_sqrt_q31(q31_t in, q31_t * pOut);
  386. arm_status ref_sqrt_q15(q15_t in, q15_t * pOut);
  387. /*
  388. * Filtering Functions
  389. */
  390. void ref_biquad_cascade_df2T_f32(
  391. const arm_biquad_cascade_df2T_instance_f32 * S,
  392. float32_t * pSrc,
  393. float32_t * pDst,
  394. uint32_t blockSize);
  395. void ref_biquad_cascade_stereo_df2T_f32(
  396. const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
  397. float32_t * pSrc,
  398. float32_t * pDst,
  399. uint32_t blockSize);
  400. void ref_biquad_cascade_df2T_f64(
  401. const arm_biquad_cascade_df2T_instance_f64 * S,
  402. float64_t * pSrc,
  403. float64_t * pDst,
  404. uint32_t blockSize);
  405. void ref_biquad_cascade_df1_f32(
  406. const arm_biquad_casd_df1_inst_f32 * S,
  407. float32_t * pSrc,
  408. float32_t * pDst,
  409. uint32_t blockSize);
  410. void ref_biquad_cas_df1_32x64_q31(
  411. const arm_biquad_cas_df1_32x64_ins_q31 * S,
  412. q31_t * pSrc,
  413. q31_t * pDst,
  414. uint32_t blockSize);
  415. void ref_biquad_cascade_df1_q31(
  416. const arm_biquad_casd_df1_inst_q31 * S,
  417. q31_t * pSrc,
  418. q31_t * pDst,
  419. uint32_t blockSize);
  420. void ref_biquad_cascade_df1_fast_q31(
  421. const arm_biquad_casd_df1_inst_q31 * S,
  422. q31_t * pSrc,
  423. q31_t * pDst,
  424. uint32_t blockSize);
  425. void ref_biquad_cascade_df1_fast_q15(
  426. const arm_biquad_casd_df1_inst_q15 * S,
  427. q15_t * pSrc,
  428. q15_t * pDst,
  429. uint32_t blockSize);
  430. void ref_biquad_cascade_df1_q15(
  431. const arm_biquad_casd_df1_inst_q15 * S,
  432. q15_t * pSrc,
  433. q15_t * pDst,
  434. uint32_t blockSize);
  435. void ref_conv_f32(
  436. float32_t * pSrcA,
  437. uint32_t srcALen,
  438. float32_t * pSrcB,
  439. uint32_t srcBLen,
  440. float32_t * pDst);
  441. arm_status ref_conv_partial_f32(
  442. float32_t * pSrcA,
  443. uint32_t srcALen,
  444. float32_t * pSrcB,
  445. uint32_t srcBLen,
  446. float32_t * pDst,
  447. uint32_t firstIndex,
  448. uint32_t numPoints);
  449. void ref_conv_q31(
  450. q31_t * pSrcA,
  451. uint32_t srcALen,
  452. q31_t * pSrcB,
  453. uint32_t srcBLen,
  454. q31_t * pDst);
  455. void ref_conv_fast_q31(
  456. q31_t * pSrcA,
  457. uint32_t srcALen,
  458. q31_t * pSrcB,
  459. uint32_t srcBLen,
  460. q31_t * pDst);
  461. arm_status ref_conv_partial_q31(
  462. q31_t * pSrcA,
  463. uint32_t srcALen,
  464. q31_t * pSrcB,
  465. uint32_t srcBLen,
  466. q31_t * pDst,
  467. uint32_t firstIndex,
  468. uint32_t numPoints);
  469. arm_status ref_conv_partial_fast_q31(
  470. q31_t * pSrcA,
  471. uint32_t srcALen,
  472. q31_t * pSrcB,
  473. uint32_t srcBLen,
  474. q31_t * pDst,
  475. uint32_t firstIndex,
  476. uint32_t numPoints);
  477. void ref_conv_q15(
  478. q15_t * pSrcA,
  479. uint32_t srcALen,
  480. q15_t * pSrcB,
  481. uint32_t srcBLen,
  482. q15_t * pDst);
  483. #define ref_conv_opt_q15(pSrcA, srcALen, pSrcB, srcBLen, pDst, \
  484. pScratch1, pScratch2) \
  485. ref_conv_q15(pSrcA, srcALen, pSrcB, srcBLen, pDst)
  486. void ref_conv_fast_q15(
  487. q15_t * pSrcA,
  488. uint32_t srcALen,
  489. q15_t * pSrcB,
  490. uint32_t srcBLen,
  491. q15_t * pDst);
  492. void ref_conv_fast_opt_q15(
  493. q15_t * pSrcA,
  494. uint32_t srcALen,
  495. q15_t * pSrcB,
  496. uint32_t srcBLen,
  497. q15_t * pDst,
  498. q15_t * pScratch1,
  499. q15_t * pScratch2);
  500. arm_status ref_conv_partial_q15(
  501. q15_t * pSrcA,
  502. uint32_t srcALen,
  503. q15_t * pSrcB,
  504. uint32_t srcBLen,
  505. q15_t * pDst,
  506. uint32_t firstIndex,
  507. uint32_t numPoints);
  508. #define ref_conv_partial_opt_q15(pSrcA, srcALen, pSrcB, srcBLen, pDst, \
  509. firstIndex, numPoints, \
  510. pScratch1, pScratch2) \
  511. ref_conv_partial_q15(pSrcA, srcALen, pSrcB, srcBLen, pDst, \
  512. firstIndex, numPoints)
  513. arm_status ref_conv_partial_fast_q15(
  514. q15_t * pSrcA,
  515. uint32_t srcALen,
  516. q15_t * pSrcB,
  517. uint32_t srcBLen,
  518. q15_t * pDst,
  519. uint32_t firstIndex,
  520. uint32_t numPoints);
  521. arm_status ref_conv_partial_fast_opt_q15(
  522. q15_t * pSrcA,
  523. uint32_t srcALen,
  524. q15_t * pSrcB,
  525. uint32_t srcBLen,
  526. q15_t * pDst,
  527. uint32_t firstIndex,
  528. uint32_t numPoints,
  529. q15_t * pScratch1,
  530. q15_t * pScratch2);
  531. void ref_conv_q7(
  532. q7_t * pSrcA,
  533. uint32_t srcALen,
  534. q7_t * pSrcB,
  535. uint32_t srcBLen,
  536. q7_t * pDst);
  537. #define ref_conv_opt_q7(pSrcA, srcALen, pSrcB, srcBLen, pDst, \
  538. pScratch1, pScratch2) \
  539. ref_conv_q7(pSrcA, srcALen, pSrcB, srcBLen, pDst)
  540. arm_status ref_conv_partial_q7(
  541. q7_t * pSrcA,
  542. uint32_t srcALen,
  543. q7_t * pSrcB,
  544. uint32_t srcBLen,
  545. q7_t * pDst,
  546. uint32_t firstIndex,
  547. uint32_t numPoints);
  548. #define ref_conv_partial_opt_q7(pSrcA, srcALen, pSrcB, srcBLen, pDst, \
  549. firstIndex, numPoints, \
  550. pScratch1, pScratch2) \
  551. ref_conv_partial_q7(pSrcA, srcALen, pSrcB, srcBLen, pDst, \
  552. firstIndex, numPoints)
  553. void ref_correlate_f32(
  554. float32_t * pSrcA,
  555. uint32_t srcALen,
  556. float32_t * pSrcB,
  557. uint32_t srcBLen,
  558. float32_t * pDst);
  559. void ref_correlate_q31(
  560. q31_t * pSrcA,
  561. uint32_t srcALen,
  562. q31_t * pSrcB,
  563. uint32_t srcBLen,
  564. q31_t * pDst);
  565. void ref_correlate_fast_q31(
  566. q31_t * pSrcA,
  567. uint32_t srcALen,
  568. q31_t * pSrcB,
  569. uint32_t srcBLen,
  570. q31_t * pDst);
  571. void ref_correlate_q15(
  572. q15_t * pSrcA,
  573. uint32_t srcALen,
  574. q15_t * pSrcB,
  575. uint32_t srcBLen,
  576. q15_t * pDst);
  577. #define ref_correlate_opt_q15(pSrcA, srcALen, pSrcB, srcBLen, pDst, \
  578. pScratch1) \
  579. ref_correlate_q15(pSrcA, srcALen, pSrcB, srcBLen, pDst)
  580. void ref_correlate_fast_q15(
  581. q15_t * pSrcA,
  582. uint32_t srcALen,
  583. q15_t * pSrcB,
  584. uint32_t srcBLen,
  585. q15_t * pDst);
  586. void ref_correlate_fast_opt_q15(
  587. q15_t * pSrcA,
  588. uint32_t srcALen,
  589. q15_t * pSrcB,
  590. uint32_t srcBLen,
  591. q15_t * pDst,
  592. q15_t * pScratch);
  593. void ref_correlate_q7(
  594. q7_t * pSrcA,
  595. uint32_t srcALen,
  596. q7_t * pSrcB,
  597. uint32_t srcBLen,
  598. q7_t * pDst);
  599. #define ref_correlate_opt_q7(pSrcA, srcALen, pSrcB, srcBLen, pDst, \
  600. pScratch1, pScratch2) \
  601. ref_correlate_q7(pSrcA, srcALen, pSrcB, srcBLen, pDst)
  602. void ref_fir_f32(
  603. const arm_fir_instance_f32 * S,
  604. float32_t * pSrc,
  605. float32_t * pDst,
  606. uint32_t blockSize);
  607. void ref_fir_q31(
  608. const arm_fir_instance_q31 * S,
  609. q31_t * pSrc,
  610. q31_t * pDst,
  611. uint32_t blockSize);
  612. void ref_fir_fast_q31(
  613. const arm_fir_instance_q31 * S,
  614. q31_t * pSrc,
  615. q31_t * pDst,
  616. uint32_t blockSize);
  617. void ref_fir_q15(
  618. const arm_fir_instance_q15 * S,
  619. q15_t * pSrc,
  620. q15_t * pDst,
  621. uint32_t blockSize);
  622. void ref_fir_fast_q15(
  623. const arm_fir_instance_q15 * S,
  624. q15_t * pSrc,
  625. q15_t * pDst,
  626. uint32_t blockSize);
  627. void ref_fir_q7(
  628. const arm_fir_instance_q7 * S,
  629. q7_t * pSrc,
  630. q7_t * pDst,
  631. uint32_t blockSize);
  632. void ref_fir_decimate_f32(
  633. const arm_fir_decimate_instance_f32 * S,
  634. float32_t * pSrc,
  635. float32_t * pDst,
  636. uint32_t blockSize);
  637. void ref_fir_decimate_q31(
  638. const arm_fir_decimate_instance_q31 * S,
  639. q31_t * pSrc,
  640. q31_t * pDst,
  641. uint32_t blockSize);
  642. void ref_fir_decimate_fast_q31(
  643. const arm_fir_decimate_instance_q31 * S,
  644. q31_t * pSrc,
  645. q31_t * pDst,
  646. uint32_t blockSize);
  647. void ref_fir_decimate_q15(
  648. const arm_fir_decimate_instance_q15 * S,
  649. q15_t * pSrc,
  650. q15_t * pDst,
  651. uint32_t blockSize);
  652. void ref_fir_decimate_fast_q15(
  653. const arm_fir_decimate_instance_q15 * S,
  654. q15_t * pSrc,
  655. q15_t * pDst,
  656. uint32_t blockSize);
  657. void ref_fir_lattice_f32(
  658. const arm_fir_lattice_instance_f32 * S,
  659. float32_t * pSrc,
  660. float32_t * pDst,
  661. uint32_t blockSize);
  662. void ref_fir_lattice_q31(
  663. const arm_fir_lattice_instance_q31 * S,
  664. q31_t * pSrc,
  665. q31_t * pDst,
  666. uint32_t blockSize);
  667. void ref_fir_lattice_q15(
  668. const arm_fir_lattice_instance_q15 * S,
  669. q15_t * pSrc,
  670. q15_t * pDst,
  671. uint32_t blockSize);
  672. void ref_fir_sparse_f32(
  673. arm_fir_sparse_instance_f32 * S,
  674. float32_t * pSrc,
  675. float32_t * pDst,
  676. float32_t * pScratchIn,
  677. uint32_t blockSize);
  678. void ref_fir_sparse_q31(
  679. arm_fir_sparse_instance_q31 * S,
  680. q31_t * pSrc,
  681. q31_t * pDst,
  682. q31_t * pScratchIn,
  683. uint32_t blockSize);
  684. void ref_fir_sparse_q15(
  685. arm_fir_sparse_instance_q15 * S,
  686. q15_t * pSrc,
  687. q15_t * pDst,
  688. q15_t * pScratchIn,
  689. q31_t * pScratchOut,
  690. uint32_t blockSize);
  691. void ref_fir_sparse_q7(
  692. arm_fir_sparse_instance_q7 * S,
  693. q7_t *pSrc,
  694. q7_t *pDst,
  695. q7_t *pScratchIn,
  696. q31_t * pScratchOut,
  697. uint32_t blockSize);
  698. void ref_iir_lattice_f32(
  699. const arm_iir_lattice_instance_f32 * S,
  700. float32_t * pSrc,
  701. float32_t * pDst,
  702. uint32_t blockSize);
  703. void ref_iir_lattice_q31(
  704. const arm_iir_lattice_instance_q31 * S,
  705. q31_t * pSrc,
  706. q31_t * pDst,
  707. uint32_t blockSize);
  708. void ref_iir_lattice_q15(
  709. const arm_iir_lattice_instance_q15 * S,
  710. q15_t * pSrc,
  711. q15_t * pDst,
  712. uint32_t blockSize);
  713. void ref_lms_f32(
  714. const arm_lms_instance_f32 * S,
  715. float32_t * pSrc,
  716. float32_t * pRef,
  717. float32_t * pOut,
  718. float32_t * pErr,
  719. uint32_t blockSize);
  720. void ref_lms_norm_f32(
  721. arm_lms_norm_instance_f32 * S,
  722. float32_t * pSrc,
  723. float32_t * pRef,
  724. float32_t * pOut,
  725. float32_t * pErr,
  726. uint32_t blockSize);
  727. void ref_lms_q31(
  728. const arm_lms_instance_q31 * S,
  729. q31_t * pSrc,
  730. q31_t * pRef,
  731. q31_t * pOut,
  732. q31_t * pErr,
  733. uint32_t blockSize);
  734. void ref_lms_norm_q31(
  735. arm_lms_norm_instance_q31 * S,
  736. q31_t * pSrc,
  737. q31_t * pRef,
  738. q31_t * pOut,
  739. q31_t * pErr,
  740. uint32_t blockSize);
  741. void ref_lms_q15(
  742. const arm_lms_instance_q15 * S,
  743. q15_t * pSrc,
  744. q15_t * pRef,
  745. q15_t * pOut,
  746. q15_t * pErr,
  747. uint32_t blockSize);
  748. void ref_lms_norm_q15(
  749. arm_lms_norm_instance_q15 * S,
  750. q15_t * pSrc,
  751. q15_t * pRef,
  752. q15_t * pOut,
  753. q15_t * pErr,
  754. uint32_t blockSize);
  755. void ref_fir_interpolate_f32(
  756. const arm_fir_interpolate_instance_f32 * S,
  757. float32_t * pSrc,
  758. float32_t * pDst,
  759. uint32_t blockSize);
  760. void ref_fir_interpolate_q31(
  761. const arm_fir_interpolate_instance_q31 * S,
  762. q31_t * pSrc,
  763. q31_t * pDst,
  764. uint32_t blockSize);
  765. void ref_fir_interpolate_q15(
  766. const arm_fir_interpolate_instance_q15 * S,
  767. q15_t * pSrc,
  768. q15_t * pDst,
  769. uint32_t blockSize);
  770. /*
  771. * Matrix Functions
  772. */
  773. arm_status ref_mat_cmplx_mult_f32(
  774. const arm_matrix_instance_f32 * pSrcA,
  775. const arm_matrix_instance_f32 * pSrcB,
  776. arm_matrix_instance_f32 * pDst);
  777. arm_status ref_mat_cmplx_mult_q31(
  778. const arm_matrix_instance_q31 * pSrcA,
  779. const arm_matrix_instance_q31 * pSrcB,
  780. arm_matrix_instance_q31 * pDst);
  781. arm_status ref_mat_cmplx_mult_q15(
  782. const arm_matrix_instance_q15 * pSrcA,
  783. const arm_matrix_instance_q15 * pSrcB,
  784. arm_matrix_instance_q15 * pDst);
  785. arm_status ref_mat_inverse_f32(
  786. const arm_matrix_instance_f32 * pSrc,
  787. arm_matrix_instance_f32 * pDst);
  788. arm_status ref_mat_inverse_f64(
  789. const arm_matrix_instance_f64 * pSrc,
  790. arm_matrix_instance_f64 * pDst);
  791. arm_status ref_mat_mult_f32(
  792. const arm_matrix_instance_f32 * pSrcA,
  793. const arm_matrix_instance_f32 * pSrcB,
  794. arm_matrix_instance_f32 * pDst);
  795. arm_status ref_mat_mult_q31(
  796. const arm_matrix_instance_q31 * pSrcA,
  797. const arm_matrix_instance_q31 * pSrcB,
  798. arm_matrix_instance_q31 * pDst);
  799. /* Alias for testing purposes*/
  800. #define ref_mat_mult_fast_q31 ref_mat_mult_q31
  801. arm_status ref_mat_mult_q15(
  802. const arm_matrix_instance_q15 * pSrcA,
  803. const arm_matrix_instance_q15 * pSrcB,
  804. arm_matrix_instance_q15 * pDst);
  805. /* Alias for testing purposes*/
  806. #define ref_mat_mult_fast_q15 ref_mat_mult_q15
  807. arm_status ref_mat_scale_f32(
  808. const arm_matrix_instance_f32 * pSrc,
  809. float32_t scale,
  810. arm_matrix_instance_f32 * pDst);
  811. arm_status ref_mat_scale_q31(
  812. const arm_matrix_instance_q31 * pSrc,
  813. q31_t scale,
  814. int32_t shift,
  815. arm_matrix_instance_q31 * pDst);
  816. arm_status ref_mat_scale_q15(
  817. const arm_matrix_instance_q15 * pSrc,
  818. q15_t scale,
  819. int32_t shift,
  820. arm_matrix_instance_q15 * pDst);
  821. arm_status ref_mat_sub_f32(
  822. const arm_matrix_instance_f32 * pSrcA,
  823. const arm_matrix_instance_f32 * pSrcB,
  824. arm_matrix_instance_f32 * pDst);
  825. arm_status ref_mat_sub_q31(
  826. const arm_matrix_instance_q31 * pSrcA,
  827. const arm_matrix_instance_q31 * pSrcB,
  828. arm_matrix_instance_q31 * pDst);
  829. arm_status ref_mat_sub_q15(
  830. const arm_matrix_instance_q15 * pSrcA,
  831. const arm_matrix_instance_q15 * pSrcB,
  832. arm_matrix_instance_q15 * pDst);
  833. arm_status ref_mat_trans_f64(
  834. const arm_matrix_instance_f64 * pSrc,
  835. arm_matrix_instance_f64 * pDst);
  836. arm_status ref_mat_trans_f32(
  837. const arm_matrix_instance_f32 * pSrc,
  838. arm_matrix_instance_f32 * pDst);
  839. arm_status ref_mat_trans_q31(
  840. const arm_matrix_instance_q31 * pSrc,
  841. arm_matrix_instance_q31 * pDst);
  842. arm_status ref_mat_trans_q15(
  843. const arm_matrix_instance_q15 * pSrc,
  844. arm_matrix_instance_q15 * pDst);
  845. arm_status ref_mat_add_f32(
  846. const arm_matrix_instance_f32 * pSrcA,
  847. const arm_matrix_instance_f32 * pSrcB,
  848. arm_matrix_instance_f32 * pDst);
  849. arm_status ref_mat_add_q31(
  850. const arm_matrix_instance_q31 * pSrcA,
  851. const arm_matrix_instance_q31 * pSrcB,
  852. arm_matrix_instance_q31 * pDst);
  853. arm_status ref_mat_add_q15(
  854. const arm_matrix_instance_q15 * pSrcA,
  855. const arm_matrix_instance_q15 * pSrcB,
  856. arm_matrix_instance_q15 * pDst);
  857. /*
  858. * Statistics Functions
  859. */
  860. void ref_max_f32(
  861. float32_t * pSrc,
  862. uint32_t blockSize,
  863. float32_t * pResult,
  864. uint32_t * pIndex);
  865. void ref_max_q31(
  866. q31_t * pSrc,
  867. uint32_t blockSize,
  868. q31_t * pResult,
  869. uint32_t * pIndex);
  870. void ref_max_q15(
  871. q15_t * pSrc,
  872. uint32_t blockSize,
  873. q15_t * pResult,
  874. uint32_t * pIndex);
  875. void ref_max_q7(
  876. q7_t * pSrc,
  877. uint32_t blockSize,
  878. q7_t * pResult,
  879. uint32_t * pIndex);
  880. void ref_mean_f32(
  881. float32_t * pSrc,
  882. uint32_t blockSize,
  883. float32_t * pResult);
  884. void ref_mean_q31(
  885. q31_t * pSrc,
  886. uint32_t blockSize,
  887. q31_t * pResult);
  888. void ref_mean_q15(
  889. q15_t * pSrc,
  890. uint32_t blockSize,
  891. q15_t * pResult);
  892. void ref_mean_q7(
  893. q7_t * pSrc,
  894. uint32_t blockSize,
  895. q7_t * pResult);
  896. void ref_min_f32(
  897. float32_t * pSrc,
  898. uint32_t blockSize,
  899. float32_t * pResult,
  900. uint32_t * pIndex);
  901. void ref_min_q31(
  902. q31_t * pSrc,
  903. uint32_t blockSize,
  904. q31_t * pResult,
  905. uint32_t * pIndex);
  906. void ref_min_q15(
  907. q15_t * pSrc,
  908. uint32_t blockSize,
  909. q15_t * pResult,
  910. uint32_t * pIndex);
  911. void ref_min_q7(
  912. q7_t * pSrc,
  913. uint32_t blockSize,
  914. q7_t * pResult,
  915. uint32_t * pIndex);
  916. void ref_power_f32(
  917. float32_t * pSrc,
  918. uint32_t blockSize,
  919. float32_t * pResult);
  920. void ref_power_q31(
  921. q31_t * pSrc,
  922. uint32_t blockSize,
  923. q63_t * pResult);
  924. void ref_power_q15(
  925. q15_t * pSrc,
  926. uint32_t blockSize,
  927. q63_t * pResult);
  928. void ref_power_q7(
  929. q7_t * pSrc,
  930. uint32_t blockSize,
  931. q31_t * pResult);
  932. void ref_rms_f32(
  933. float32_t * pSrc,
  934. uint32_t blockSize,
  935. float32_t * pResult);
  936. void ref_rms_q31(
  937. q31_t * pSrc,
  938. uint32_t blockSize,
  939. q31_t * pResult);
  940. void ref_rms_q15(
  941. q15_t * pSrc,
  942. uint32_t blockSize,
  943. q15_t * pResult);
  944. void ref_std_f32(
  945. float32_t * pSrc,
  946. uint32_t blockSize,
  947. float32_t * pResult);
  948. void ref_std_q31(
  949. q31_t * pSrc,
  950. uint32_t blockSize,
  951. q31_t * pResult);
  952. void ref_std_q15(
  953. q15_t * pSrc,
  954. uint32_t blockSize,
  955. q15_t * pResult);
  956. void ref_var_f32(
  957. float32_t * pSrc,
  958. uint32_t blockSize,
  959. float32_t * pResult);
  960. void ref_var_q31(
  961. q31_t * pSrc,
  962. uint32_t blockSize,
  963. q31_t * pResult);
  964. void ref_var_q15(
  965. q15_t * pSrc,
  966. uint32_t blockSize,
  967. q15_t * pResult);
  968. /*
  969. * Support Functions
  970. */
  971. void ref_copy_f32(
  972. float32_t * pSrc,
  973. float32_t * pDst,
  974. uint32_t blockSize);
  975. void ref_copy_q31(
  976. q31_t * pSrc,
  977. q31_t * pDst,
  978. uint32_t blockSize);
  979. void ref_copy_q15(
  980. q15_t * pSrc,
  981. q15_t * pDst,
  982. uint32_t blockSize);
  983. void ref_copy_q7(
  984. q7_t * pSrc,
  985. q7_t * pDst,
  986. uint32_t blockSize);
  987. void ref_fill_f32(
  988. float32_t value,
  989. float32_t * pDst,
  990. uint32_t blockSize);
  991. void ref_fill_q31(
  992. q31_t value,
  993. q31_t * pDst,
  994. uint32_t blockSize);
  995. void ref_fill_q15(
  996. q15_t value,
  997. q15_t * pDst,
  998. uint32_t blockSize);
  999. void ref_fill_q7(
  1000. q7_t value,
  1001. q7_t * pDst,
  1002. uint32_t blockSize);
  1003. void ref_q31_to_q15(
  1004. q31_t * pSrc,
  1005. q15_t * pDst,
  1006. uint32_t blockSize);
  1007. void ref_q31_to_q7(
  1008. q31_t * pSrc,
  1009. q7_t * pDst,
  1010. uint32_t blockSize);
  1011. void ref_q15_to_q31(
  1012. q15_t * pSrc,
  1013. q31_t * pDst,
  1014. uint32_t blockSize);
  1015. void ref_q15_to_q7(
  1016. q15_t * pSrc,
  1017. q7_t * pDst,
  1018. uint32_t blockSize);
  1019. void ref_q7_to_q31(
  1020. q7_t * pSrc,
  1021. q31_t * pDst,
  1022. uint32_t blockSize);
  1023. void ref_q7_to_q15(
  1024. q7_t * pSrc,
  1025. q15_t * pDst,
  1026. uint32_t blockSize);
  1027. void ref_q63_to_float(
  1028. q63_t * pSrc,
  1029. float32_t * pDst,
  1030. uint32_t blockSize);
  1031. void ref_q31_to_float(
  1032. q31_t * pSrc,
  1033. float32_t * pDst,
  1034. uint32_t blockSize);
  1035. void ref_q15_to_float(
  1036. q15_t * pSrc,
  1037. float32_t * pDst,
  1038. uint32_t blockSize);
  1039. void ref_q7_to_float(
  1040. q7_t * pSrc,
  1041. float32_t * pDst,
  1042. uint32_t blockSize);
  1043. void ref_float_to_q31(
  1044. float32_t * pSrc,
  1045. q31_t * pDst,
  1046. uint32_t blockSize);
  1047. void ref_float_to_q15(
  1048. float32_t * pSrc,
  1049. q15_t * pDst,
  1050. uint32_t blockSize);
  1051. void ref_float_to_q7(
  1052. float32_t * pSrc,
  1053. q7_t * pDst,
  1054. uint32_t blockSize);
  1055. /*
  1056. * Transform Functions
  1057. */
  1058. void ref_cfft_f32(
  1059. const arm_cfft_instance_f32 * S,
  1060. float32_t * p1,
  1061. uint8_t ifftFlag,
  1062. uint8_t bitReverseFlag);
  1063. void ref_cfft_q31(
  1064. const arm_cfft_instance_q31 * S,
  1065. q31_t * p1,
  1066. uint8_t ifftFlag,
  1067. uint8_t bitReverseFlag);
  1068. void ref_cfft_q15(
  1069. const arm_cfft_instance_q15 * S,
  1070. q15_t * p1,
  1071. uint8_t ifftFlag,
  1072. uint8_t bitReverseFlag);
  1073. void ref_cfft_radix2_f32(
  1074. const arm_cfft_radix2_instance_f32 * S,
  1075. float32_t * pSrc);
  1076. void ref_cfft_radix2_q31(
  1077. const arm_cfft_radix2_instance_q31 * S,
  1078. q31_t * pSrc);
  1079. void ref_cfft_radix2_q15(
  1080. const arm_cfft_radix2_instance_q15 * S,
  1081. q15_t * pSrc);
  1082. void ref_cfft_radix4_f32(
  1083. const arm_cfft_radix4_instance_f32 * S,
  1084. float32_t * pSrc);
  1085. void ref_cfft_radix4_q31(
  1086. const arm_cfft_radix4_instance_q31 * S,
  1087. q31_t * pSrc);
  1088. void ref_cfft_radix4_q15(
  1089. const arm_cfft_radix4_instance_q15 * S,
  1090. q15_t * pSrc);
  1091. void ref_rfft_f32(
  1092. arm_rfft_instance_f32 * S,
  1093. float32_t * pSrc,
  1094. float32_t * pDst);
  1095. void ref_rfft_fast_f32(
  1096. arm_rfft_fast_instance_f32 * S,
  1097. float32_t * p, float32_t * pOut,
  1098. uint8_t ifftFlag);
  1099. void ref_rfft_q31(
  1100. const arm_rfft_instance_q31 * S,
  1101. q31_t * pSrc,
  1102. q31_t * pDst);
  1103. void ref_rfft_q15(
  1104. const arm_rfft_instance_q15 * S,
  1105. q15_t * pSrc,
  1106. q15_t * pDst);
  1107. void ref_dct4_f32(
  1108. const arm_dct4_instance_f32 * S,
  1109. float32_t * pState,
  1110. float32_t * pInlineBuffer);
  1111. void ref_dct4_q31(
  1112. const arm_dct4_instance_q31 * S,
  1113. q31_t * pState,
  1114. q31_t * pInlineBuffer);
  1115. void ref_dct4_q15(
  1116. const arm_dct4_instance_q15 * S,
  1117. q15_t * pState,
  1118. q15_t * pInlineBuffer);
  1119. /*
  1120. * Intrinsics
  1121. */
  1122. q31_t ref__QADD8(q31_t x, q31_t y);
  1123. q31_t ref__QSUB8(q31_t x, q31_t y);
  1124. q31_t ref__QADD16(q31_t x, q31_t y);
  1125. q31_t ref__SHADD16(q31_t x, q31_t y);
  1126. q31_t ref__QSUB16(q31_t x, q31_t y);
  1127. q31_t ref__SHSUB16(q31_t x, q31_t y);
  1128. q31_t ref__QASX(q31_t x, q31_t y);
  1129. q31_t ref__SHASX(q31_t x, q31_t y);
  1130. q31_t ref__QSAX(q31_t x, q31_t y);
  1131. q31_t ref__SHSAX(q31_t x, q31_t y);
  1132. q31_t ref__SMUSDX(q31_t x, q31_t y);
  1133. q31_t ref__SMUADX(q31_t x, q31_t y);
  1134. q31_t ref__QADD(q31_t x, q31_t y);
  1135. q31_t ref__QSUB(q31_t x, q31_t y);
  1136. q31_t ref__SMLAD(q31_t x, q31_t y, q31_t sum);
  1137. q31_t ref__SMLADX(q31_t x, q31_t y, q31_t sum);
  1138. q31_t ref__SMLSDX(q31_t x, q31_t y, q31_t sum);
  1139. q63_t ref__SMLALD(q31_t x, q31_t y, q63_t sum);
  1140. q63_t ref__SMLALDX(q31_t x, q31_t y, q63_t sum);
  1141. q31_t ref__SMUAD(q31_t x, q31_t y);
  1142. q31_t ref__SMUSD(q31_t x, q31_t y);
  1143. q31_t ref__SXTB16(q31_t x);
  1144. #ifdef __cplusplus
  1145. }
  1146. #endif
  1147. #endif