basic_math_functions.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  1. /******************************************************************************
  2. * @file basic_math_functions.h
  3. * @brief Public header file for NMSIS DSP Library
  4. * @version V1.10.0
  5. * @date 08 July 2021
  6. * Target Processor: RISC-V Cores
  7. ******************************************************************************/
  8. /*
  9. * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved.
  10. * Copyright (c) 2019 Nuclei Limited. All rights reserved.
  11. *
  12. * SPDX-License-Identifier: Apache-2.0
  13. *
  14. * Licensed under the Apache License, Version 2.0 (the License); you may
  15. * not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at
  17. *
  18. * www.apache.org/licenses/LICENSE-2.0
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  22. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. */
  26. #ifndef BASIC_MATH_FUNCTIONS_H_
  27. #define BASIC_MATH_FUNCTIONS_H_
  28. #include "riscv_math_types.h"
  29. #include "riscv_math_memory.h"
  30. #include "dsp/none.h"
  31. #include "dsp/utils.h"
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif
  36. /**
  37. * @defgroup groupMath Basic Math Functions
  38. */
  39. /**
  40. * @brief Q7 vector multiplication.
  41. * @param[in] pSrcA points to the first input vector
  42. * @param[in] pSrcB points to the second input vector
  43. * @param[out] pDst points to the output vector
  44. * @param[in] blockSize number of samples in each vector
  45. */
  46. void riscv_mult_q7(
  47. const q7_t * pSrcA,
  48. const q7_t * pSrcB,
  49. q7_t * pDst,
  50. uint32_t blockSize);
  51. /**
  52. * @brief Q15 vector multiplication.
  53. * @param[in] pSrcA points to the first input vector
  54. * @param[in] pSrcB points to the second input vector
  55. * @param[out] pDst points to the output vector
  56. * @param[in] blockSize number of samples in each vector
  57. */
  58. void riscv_mult_q15(
  59. const q15_t * pSrcA,
  60. const q15_t * pSrcB,
  61. q15_t * pDst,
  62. uint32_t blockSize);
  63. /**
  64. * @brief Q31 vector multiplication.
  65. * @param[in] pSrcA points to the first input vector
  66. * @param[in] pSrcB points to the second input vector
  67. * @param[out] pDst points to the output vector
  68. * @param[in] blockSize number of samples in each vector
  69. */
  70. void riscv_mult_q31(
  71. const q31_t * pSrcA,
  72. const q31_t * pSrcB,
  73. q31_t * pDst,
  74. uint32_t blockSize);
  75. /**
  76. * @brief Floating-point vector multiplication.
  77. * @param[in] pSrcA points to the first input vector
  78. * @param[in] pSrcB points to the second input vector
  79. * @param[out] pDst points to the output vector
  80. * @param[in] blockSize number of samples in each vector
  81. */
  82. void riscv_mult_f32(
  83. const float32_t * pSrcA,
  84. const float32_t * pSrcB,
  85. float32_t * pDst,
  86. uint32_t blockSize);
  87. /**
  88. * @brief Floating-point vector multiplication.
  89. * @param[in] pSrcA points to the first input vector
  90. * @param[in] pSrcB points to the second input vector
  91. * @param[out] pDst points to the output vector
  92. * @param[in] blockSize number of samples in each vector
  93. */
  94. void riscv_mult_f64(
  95. const float64_t * pSrcA,
  96. const float64_t * pSrcB,
  97. float64_t * pDst,
  98. uint32_t blockSize);
  99. /**
  100. * @brief Floating-point vector addition.
  101. * @param[in] pSrcA points to the first input vector
  102. * @param[in] pSrcB points to the second input vector
  103. * @param[out] pDst points to the output vector
  104. * @param[in] blockSize number of samples in each vector
  105. */
  106. void riscv_add_f32(
  107. const float32_t * pSrcA,
  108. const float32_t * pSrcB,
  109. float32_t * pDst,
  110. uint32_t blockSize);
  111. /**
  112. * @brief Floating-point vector addition.
  113. * @param[in] pSrcA points to the first input vector
  114. * @param[in] pSrcB points to the second input vector
  115. * @param[out] pDst points to the output vector
  116. * @param[in] blockSize number of samples in each vector
  117. */
  118. void riscv_add_f64(
  119. const float64_t * pSrcA,
  120. const float64_t * pSrcB,
  121. float64_t * pDst,
  122. uint32_t blockSize);
  123. /**
  124. * @brief Q7 vector addition.
  125. * @param[in] pSrcA points to the first input vector
  126. * @param[in] pSrcB points to the second input vector
  127. * @param[out] pDst points to the output vector
  128. * @param[in] blockSize number of samples in each vector
  129. */
  130. void riscv_add_q7(
  131. const q7_t * pSrcA,
  132. const q7_t * pSrcB,
  133. q7_t * pDst,
  134. uint32_t blockSize);
  135. /**
  136. * @brief Q15 vector addition.
  137. * @param[in] pSrcA points to the first input vector
  138. * @param[in] pSrcB points to the second input vector
  139. * @param[out] pDst points to the output vector
  140. * @param[in] blockSize number of samples in each vector
  141. */
  142. void riscv_add_q15(
  143. const q15_t * pSrcA,
  144. const q15_t * pSrcB,
  145. q15_t * pDst,
  146. uint32_t blockSize);
  147. /**
  148. * @brief Q31 vector addition.
  149. * @param[in] pSrcA points to the first input vector
  150. * @param[in] pSrcB points to the second input vector
  151. * @param[out] pDst points to the output vector
  152. * @param[in] blockSize number of samples in each vector
  153. */
  154. void riscv_add_q31(
  155. const q31_t * pSrcA,
  156. const q31_t * pSrcB,
  157. q31_t * pDst,
  158. uint32_t blockSize);
  159. /**
  160. * @brief Floating-point vector subtraction.
  161. * @param[in] pSrcA points to the first input vector
  162. * @param[in] pSrcB points to the second input vector
  163. * @param[out] pDst points to the output vector
  164. * @param[in] blockSize number of samples in each vector
  165. */
  166. void riscv_sub_f32(
  167. const float32_t * pSrcA,
  168. const float32_t * pSrcB,
  169. float32_t * pDst,
  170. uint32_t blockSize);
  171. /**
  172. * @brief Floating-point vector subtraction.
  173. * @param[in] pSrcA points to the first input vector
  174. * @param[in] pSrcB points to the second input vector
  175. * @param[out] pDst points to the output vector
  176. * @param[in] blockSize number of samples in each vector
  177. */
  178. void riscv_sub_f64(
  179. const float64_t * pSrcA,
  180. const float64_t * pSrcB,
  181. float64_t * pDst,
  182. uint32_t blockSize);
  183. /**
  184. * @brief Q7 vector subtraction.
  185. * @param[in] pSrcA points to the first input vector
  186. * @param[in] pSrcB points to the second input vector
  187. * @param[out] pDst points to the output vector
  188. * @param[in] blockSize number of samples in each vector
  189. */
  190. void riscv_sub_q7(
  191. const q7_t * pSrcA,
  192. const q7_t * pSrcB,
  193. q7_t * pDst,
  194. uint32_t blockSize);
  195. /**
  196. * @brief Q15 vector subtraction.
  197. * @param[in] pSrcA points to the first input vector
  198. * @param[in] pSrcB points to the second input vector
  199. * @param[out] pDst points to the output vector
  200. * @param[in] blockSize number of samples in each vector
  201. */
  202. void riscv_sub_q15(
  203. const q15_t * pSrcA,
  204. const q15_t * pSrcB,
  205. q15_t * pDst,
  206. uint32_t blockSize);
  207. /**
  208. * @brief Q31 vector subtraction.
  209. * @param[in] pSrcA points to the first input vector
  210. * @param[in] pSrcB points to the second input vector
  211. * @param[out] pDst points to the output vector
  212. * @param[in] blockSize number of samples in each vector
  213. */
  214. void riscv_sub_q31(
  215. const q31_t * pSrcA,
  216. const q31_t * pSrcB,
  217. q31_t * pDst,
  218. uint32_t blockSize);
  219. /**
  220. * @brief Multiplies a floating-point vector by a scalar.
  221. * @param[in] pSrc points to the input vector
  222. * @param[in] scale scale factor to be applied
  223. * @param[out] pDst points to the output vector
  224. * @param[in] blockSize number of samples in the vector
  225. */
  226. void riscv_scale_f32(
  227. const float32_t * pSrc,
  228. float32_t scale,
  229. float32_t * pDst,
  230. uint32_t blockSize);
  231. /**
  232. * @brief Multiplies a floating-point vector by a scalar.
  233. * @param[in] pSrc points to the input vector
  234. * @param[in] scale scale factor to be applied
  235. * @param[out] pDst points to the output vector
  236. * @param[in] blockSize number of samples in the vector
  237. */
  238. void riscv_scale_f64(
  239. const float64_t * pSrc,
  240. float64_t scale,
  241. float64_t * pDst,
  242. uint32_t blockSize);
  243. /**
  244. * @brief Multiplies a Q7 vector by a scalar.
  245. * @param[in] pSrc points to the input vector
  246. * @param[in] scaleFract fractional portion of the scale value
  247. * @param[in] shift number of bits to shift the result by
  248. * @param[out] pDst points to the output vector
  249. * @param[in] blockSize number of samples in the vector
  250. */
  251. void riscv_scale_q7(
  252. const q7_t * pSrc,
  253. q7_t scaleFract,
  254. int8_t shift,
  255. q7_t * pDst,
  256. uint32_t blockSize);
  257. /**
  258. * @brief Multiplies a Q15 vector by a scalar.
  259. * @param[in] pSrc points to the input vector
  260. * @param[in] scaleFract fractional portion of the scale value
  261. * @param[in] shift number of bits to shift the result by
  262. * @param[out] pDst points to the output vector
  263. * @param[in] blockSize number of samples in the vector
  264. */
  265. void riscv_scale_q15(
  266. const q15_t * pSrc,
  267. q15_t scaleFract,
  268. int8_t shift,
  269. q15_t * pDst,
  270. uint32_t blockSize);
  271. /**
  272. * @brief Multiplies a Q31 vector by a scalar.
  273. * @param[in] pSrc points to the input vector
  274. * @param[in] scaleFract fractional portion of the scale value
  275. * @param[in] shift number of bits to shift the result by
  276. * @param[out] pDst points to the output vector
  277. * @param[in] blockSize number of samples in the vector
  278. */
  279. void riscv_scale_q31(
  280. const q31_t * pSrc,
  281. q31_t scaleFract,
  282. int8_t shift,
  283. q31_t * pDst,
  284. uint32_t blockSize);
  285. /**
  286. * @brief Q7 vector absolute value.
  287. * @param[in] pSrc points to the input buffer
  288. * @param[out] pDst points to the output buffer
  289. * @param[in] blockSize number of samples in each vector
  290. */
  291. void riscv_abs_q7(
  292. const q7_t * pSrc,
  293. q7_t * pDst,
  294. uint32_t blockSize);
  295. /**
  296. * @brief Floating-point vector absolute value.
  297. * @param[in] pSrc points to the input buffer
  298. * @param[out] pDst points to the output buffer
  299. * @param[in] blockSize number of samples in each vector
  300. */
  301. void riscv_abs_f32(
  302. const float32_t * pSrc,
  303. float32_t * pDst,
  304. uint32_t blockSize);
  305. /**
  306. * @brief Floating-point vector absolute value.
  307. * @param[in] pSrc points to the input buffer
  308. * @param[out] pDst points to the output buffer
  309. * @param[in] blockSize number of samples in each vector
  310. */
  311. void riscv_abs_f64(
  312. const float64_t * pSrc,
  313. float64_t * pDst,
  314. uint32_t blockSize);
  315. /**
  316. * @brief Q15 vector absolute value.
  317. * @param[in] pSrc points to the input buffer
  318. * @param[out] pDst points to the output buffer
  319. * @param[in] blockSize number of samples in each vector
  320. */
  321. void riscv_abs_q15(
  322. const q15_t * pSrc,
  323. q15_t * pDst,
  324. uint32_t blockSize);
  325. /**
  326. * @brief Q31 vector absolute value.
  327. * @param[in] pSrc points to the input buffer
  328. * @param[out] pDst points to the output buffer
  329. * @param[in] blockSize number of samples in each vector
  330. */
  331. void riscv_abs_q31(
  332. const q31_t * pSrc,
  333. q31_t * pDst,
  334. uint32_t blockSize);
  335. /**
  336. * @brief Dot product of floating-point vectors.
  337. * @param[in] pSrcA points to the first input vector
  338. * @param[in] pSrcB points to the second input vector
  339. * @param[in] blockSize number of samples in each vector
  340. * @param[out] result output result returned here
  341. */
  342. void riscv_dot_prod_f32(
  343. const float32_t * pSrcA,
  344. const float32_t * pSrcB,
  345. uint32_t blockSize,
  346. float32_t * result);
  347. /**
  348. * @brief Dot product of floating-point vectors.
  349. * @param[in] pSrcA points to the first input vector
  350. * @param[in] pSrcB points to the second input vector
  351. * @param[in] blockSize number of samples in each vector
  352. * @param[out] result output result returned here
  353. */
  354. void riscv_dot_prod_f64(
  355. const float64_t * pSrcA,
  356. const float64_t * pSrcB,
  357. uint32_t blockSize,
  358. float64_t * result);
  359. /**
  360. * @brief Dot product of Q7 vectors.
  361. * @param[in] pSrcA points to the first input vector
  362. * @param[in] pSrcB points to the second input vector
  363. * @param[in] blockSize number of samples in each vector
  364. * @param[out] result output result returned here
  365. */
  366. void riscv_dot_prod_q7(
  367. const q7_t * pSrcA,
  368. const q7_t * pSrcB,
  369. uint32_t blockSize,
  370. q31_t * result);
  371. /**
  372. * @brief Dot product of Q15 vectors.
  373. * @param[in] pSrcA points to the first input vector
  374. * @param[in] pSrcB points to the second input vector
  375. * @param[in] blockSize number of samples in each vector
  376. * @param[out] result output result returned here
  377. */
  378. void riscv_dot_prod_q15(
  379. const q15_t * pSrcA,
  380. const q15_t * pSrcB,
  381. uint32_t blockSize,
  382. q63_t * result);
  383. /**
  384. * @brief Dot product of Q31 vectors.
  385. * @param[in] pSrcA points to the first input vector
  386. * @param[in] pSrcB points to the second input vector
  387. * @param[in] blockSize number of samples in each vector
  388. * @param[out] result output result returned here
  389. */
  390. void riscv_dot_prod_q31(
  391. const q31_t * pSrcA,
  392. const q31_t * pSrcB,
  393. uint32_t blockSize,
  394. q63_t * result);
  395. /**
  396. * @brief Shifts the elements of a Q7 vector a specified number of bits.
  397. * @param[in] pSrc points to the input vector
  398. * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
  399. * @param[out] pDst points to the output vector
  400. * @param[in] blockSize number of samples in the vector
  401. */
  402. void riscv_shift_q7(
  403. const q7_t * pSrc,
  404. int8_t shiftBits,
  405. q7_t * pDst,
  406. uint32_t blockSize);
  407. /**
  408. * @brief Shifts the elements of a Q15 vector a specified number of bits.
  409. * @param[in] pSrc points to the input vector
  410. * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
  411. * @param[out] pDst points to the output vector
  412. * @param[in] blockSize number of samples in the vector
  413. */
  414. void riscv_shift_q15(
  415. const q15_t * pSrc,
  416. int8_t shiftBits,
  417. q15_t * pDst,
  418. uint32_t blockSize);
  419. /**
  420. * @brief Shifts the elements of a Q31 vector a specified number of bits.
  421. * @param[in] pSrc points to the input vector
  422. * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
  423. * @param[out] pDst points to the output vector
  424. * @param[in] blockSize number of samples in the vector
  425. */
  426. void riscv_shift_q31(
  427. const q31_t * pSrc,
  428. int8_t shiftBits,
  429. q31_t * pDst,
  430. uint32_t blockSize);
  431. /**
  432. * @brief Adds a constant offset to a floating-point vector.
  433. * @param[in] pSrc points to the input vector
  434. * @param[in] offset is the offset to be added
  435. * @param[out] pDst points to the output vector
  436. * @param[in] blockSize number of samples in the vector
  437. */
  438. void riscv_offset_f64(
  439. const float64_t * pSrc,
  440. float64_t offset,
  441. float64_t * pDst,
  442. uint32_t blockSize);
  443. /**
  444. * @brief Adds a constant offset to a floating-point vector.
  445. * @param[in] pSrc points to the input vector
  446. * @param[in] offset is the offset to be added
  447. * @param[out] pDst points to the output vector
  448. * @param[in] blockSize number of samples in the vector
  449. */
  450. void riscv_offset_f32(
  451. const float32_t * pSrc,
  452. float32_t offset,
  453. float32_t * pDst,
  454. uint32_t blockSize);
  455. /**
  456. * @brief Adds a constant offset to a Q7 vector.
  457. * @param[in] pSrc points to the input vector
  458. * @param[in] offset is the offset to be added
  459. * @param[out] pDst points to the output vector
  460. * @param[in] blockSize number of samples in the vector
  461. */
  462. void riscv_offset_q7(
  463. const q7_t * pSrc,
  464. q7_t offset,
  465. q7_t * pDst,
  466. uint32_t blockSize);
  467. /**
  468. * @brief Adds a constant offset to a Q15 vector.
  469. * @param[in] pSrc points to the input vector
  470. * @param[in] offset is the offset to be added
  471. * @param[out] pDst points to the output vector
  472. * @param[in] blockSize number of samples in the vector
  473. */
  474. void riscv_offset_q15(
  475. const q15_t * pSrc,
  476. q15_t offset,
  477. q15_t * pDst,
  478. uint32_t blockSize);
  479. /**
  480. * @brief Adds a constant offset to a Q31 vector.
  481. * @param[in] pSrc points to the input vector
  482. * @param[in] offset is the offset to be added
  483. * @param[out] pDst points to the output vector
  484. * @param[in] blockSize number of samples in the vector
  485. */
  486. void riscv_offset_q31(
  487. const q31_t * pSrc,
  488. q31_t offset,
  489. q31_t * pDst,
  490. uint32_t blockSize);
  491. /**
  492. * @brief Negates the elements of a floating-point vector.
  493. * @param[in] pSrc points to the input vector
  494. * @param[out] pDst points to the output vector
  495. * @param[in] blockSize number of samples in the vector
  496. */
  497. void riscv_negate_f32(
  498. const float32_t * pSrc,
  499. float32_t * pDst,
  500. uint32_t blockSize);
  501. /**
  502. * @brief Negates the elements of a floating-point vector.
  503. * @param[in] pSrc points to the input vector
  504. * @param[out] pDst points to the output vector
  505. * @param[in] blockSize number of samples in the vector
  506. */
  507. void riscv_negate_f64(
  508. const float64_t * pSrc,
  509. float64_t * pDst,
  510. uint32_t blockSize);
  511. /**
  512. * @brief Negates the elements of a Q7 vector.
  513. * @param[in] pSrc points to the input vector
  514. * @param[out] pDst points to the output vector
  515. * @param[in] blockSize number of samples in the vector
  516. */
  517. void riscv_negate_q7(
  518. const q7_t * pSrc,
  519. q7_t * pDst,
  520. uint32_t blockSize);
  521. /**
  522. * @brief Negates the elements of a Q15 vector.
  523. * @param[in] pSrc points to the input vector
  524. * @param[out] pDst points to the output vector
  525. * @param[in] blockSize number of samples in the vector
  526. */
  527. void riscv_negate_q15(
  528. const q15_t * pSrc,
  529. q15_t * pDst,
  530. uint32_t blockSize);
  531. /**
  532. * @brief Negates the elements of a Q31 vector.
  533. * @param[in] pSrc points to the input vector
  534. * @param[out] pDst points to the output vector
  535. * @param[in] blockSize number of samples in the vector
  536. */
  537. void riscv_negate_q31(
  538. const q31_t * pSrc,
  539. q31_t * pDst,
  540. uint32_t blockSize);
  541. /**
  542. * @brief Compute the logical bitwise AND of two fixed-point vectors.
  543. * @param[in] pSrcA points to input vector A
  544. * @param[in] pSrcB points to input vector B
  545. * @param[out] pDst points to output vector
  546. * @param[in] blockSize number of samples in each vector
  547. */
  548. void riscv_and_u16(
  549. const uint16_t * pSrcA,
  550. const uint16_t * pSrcB,
  551. uint16_t * pDst,
  552. uint32_t blockSize);
  553. /**
  554. * @brief Compute the logical bitwise AND of two fixed-point vectors.
  555. * @param[in] pSrcA points to input vector A
  556. * @param[in] pSrcB points to input vector B
  557. * @param[out] pDst points to output vector
  558. * @param[in] blockSize number of samples in each vector
  559. */
  560. void riscv_and_u32(
  561. const uint32_t * pSrcA,
  562. const uint32_t * pSrcB,
  563. uint32_t * pDst,
  564. uint32_t blockSize);
  565. /**
  566. * @brief Compute the logical bitwise AND of two fixed-point vectors.
  567. * @param[in] pSrcA points to input vector A
  568. * @param[in] pSrcB points to input vector B
  569. * @param[out] pDst points to output vector
  570. * @param[in] blockSize number of samples in each vector
  571. */
  572. void riscv_and_u8(
  573. const uint8_t * pSrcA,
  574. const uint8_t * pSrcB,
  575. uint8_t * pDst,
  576. uint32_t blockSize);
  577. /**
  578. * @brief Compute the logical bitwise OR of two fixed-point vectors.
  579. * @param[in] pSrcA points to input vector A
  580. * @param[in] pSrcB points to input vector B
  581. * @param[out] pDst points to output vector
  582. * @param[in] blockSize number of samples in each vector
  583. */
  584. void riscv_or_u16(
  585. const uint16_t * pSrcA,
  586. const uint16_t * pSrcB,
  587. uint16_t * pDst,
  588. uint32_t blockSize);
  589. /**
  590. * @brief Compute the logical bitwise OR of two fixed-point vectors.
  591. * @param[in] pSrcA points to input vector A
  592. * @param[in] pSrcB points to input vector B
  593. * @param[out] pDst points to output vector
  594. * @param[in] blockSize number of samples in each vector
  595. */
  596. void riscv_or_u32(
  597. const uint32_t * pSrcA,
  598. const uint32_t * pSrcB,
  599. uint32_t * pDst,
  600. uint32_t blockSize);
  601. /**
  602. * @brief Compute the logical bitwise OR of two fixed-point vectors.
  603. * @param[in] pSrcA points to input vector A
  604. * @param[in] pSrcB points to input vector B
  605. * @param[out] pDst points to output vector
  606. * @param[in] blockSize number of samples in each vector
  607. */
  608. void riscv_or_u8(
  609. const uint8_t * pSrcA,
  610. const uint8_t * pSrcB,
  611. uint8_t * pDst,
  612. uint32_t blockSize);
  613. /**
  614. * @brief Compute the logical bitwise NOT of a fixed-point vector.
  615. * @param[in] pSrc points to input vector
  616. * @param[out] pDst points to output vector
  617. * @param[in] blockSize number of samples in each vector
  618. */
  619. void riscv_not_u16(
  620. const uint16_t * pSrc,
  621. uint16_t * pDst,
  622. uint32_t blockSize);
  623. /**
  624. * @brief Compute the logical bitwise NOT of a fixed-point vector.
  625. * @param[in] pSrc points to input vector
  626. * @param[out] pDst points to output vector
  627. * @param[in] blockSize number of samples in each vector
  628. */
  629. void riscv_not_u32(
  630. const uint32_t * pSrc,
  631. uint32_t * pDst,
  632. uint32_t blockSize);
  633. /**
  634. * @brief Compute the logical bitwise NOT of a fixed-point vector.
  635. * @param[in] pSrc points to input vector
  636. * @param[out] pDst points to output vector
  637. * @param[in] blockSize number of samples in each vector
  638. */
  639. void riscv_not_u8(
  640. const uint8_t * pSrc,
  641. uint8_t * pDst,
  642. uint32_t blockSize);
  643. /**
  644. * @brief Compute the logical bitwise XOR of two fixed-point vectors.
  645. * @param[in] pSrcA points to input vector A
  646. * @param[in] pSrcB points to input vector B
  647. * @param[out] pDst points to output vector
  648. * @param[in] blockSize number of samples in each vector
  649. */
  650. void riscv_xor_u16(
  651. const uint16_t * pSrcA,
  652. const uint16_t * pSrcB,
  653. uint16_t * pDst,
  654. uint32_t blockSize);
  655. /**
  656. * @brief Compute the logical bitwise XOR of two fixed-point vectors.
  657. * @param[in] pSrcA points to input vector A
  658. * @param[in] pSrcB points to input vector B
  659. * @param[out] pDst points to output vector
  660. * @param[in] blockSize number of samples in each vector
  661. */
  662. void riscv_xor_u32(
  663. const uint32_t * pSrcA,
  664. const uint32_t * pSrcB,
  665. uint32_t * pDst,
  666. uint32_t blockSize);
  667. /**
  668. * @brief Compute the logical bitwise XOR of two fixed-point vectors.
  669. * @param[in] pSrcA points to input vector A
  670. * @param[in] pSrcB points to input vector B
  671. * @param[out] pDst points to output vector
  672. * @param[in] blockSize number of samples in each vector
  673. */
  674. void riscv_xor_u8(
  675. const uint8_t * pSrcA,
  676. const uint8_t * pSrcB,
  677. uint8_t * pDst,
  678. uint32_t blockSize);
  679. /**
  680. @brief Elementwise floating-point clipping
  681. @param[in] pSrc points to input values
  682. @param[out] pDst points to output clipped values
  683. @param[in] low lower bound
  684. @param[in] high higher bound
  685. @param[in] numSamples number of samples to clip
  686. */
  687. void riscv_clip_f32(const float32_t * pSrc,
  688. float32_t * pDst,
  689. float32_t low,
  690. float32_t high,
  691. uint32_t numSamples);
  692. /**
  693. @brief Elementwise fixed-point clipping
  694. @param[in] pSrc points to input values
  695. @param[out] pDst points to output clipped values
  696. @param[in] low lower bound
  697. @param[in] high higher bound
  698. @param[in] numSamples number of samples to clip
  699. */
  700. void riscv_clip_q31(const q31_t * pSrc,
  701. q31_t * pDst,
  702. q31_t low,
  703. q31_t high,
  704. uint32_t numSamples);
  705. /**
  706. @brief Elementwise fixed-point clipping
  707. @param[in] pSrc points to input values
  708. @param[out] pDst points to output clipped values
  709. @param[in] low lower bound
  710. @param[in] high higher bound
  711. @param[in] numSamples number of samples to clip
  712. */
  713. void riscv_clip_q15(const q15_t * pSrc,
  714. q15_t * pDst,
  715. q15_t low,
  716. q15_t high,
  717. uint32_t numSamples);
  718. /**
  719. @brief Elementwise fixed-point clipping
  720. @param[in] pSrc points to input values
  721. @param[out] pDst points to output clipped values
  722. @param[in] low lower bound
  723. @param[in] high higher bound
  724. @param[in] numSamples number of samples to clip
  725. */
  726. void riscv_clip_q7(const q7_t * pSrc,
  727. q7_t * pDst,
  728. q7_t low,
  729. q7_t high,
  730. uint32_t numSamples);
  731. #ifdef __cplusplus
  732. }
  733. #endif
  734. #endif /* ifndef _BASIC_MATH_FUNCTIONS_H_ */