filtering_functions.h 98 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570
  1. /******************************************************************************
  2. * @file filtering_functions.h
  3. * @brief Public header file for CMSIS DSP Library
  4. * @version V1.10.0
  5. * @date 08 July 2021
  6. * Target Processor: Cortex-M and Cortex-A cores
  7. ******************************************************************************/
  8. /*
  9. * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved.
  10. *
  11. * SPDX-License-Identifier: Apache-2.0
  12. *
  13. * Licensed under the Apache License, Version 2.0 (the License); you may
  14. * not use this file except in compliance with the License.
  15. * You may obtain a copy of the License at
  16. *
  17. * www.apache.org/licenses/LICENSE-2.0
  18. *
  19. * Unless required by applicable law or agreed to in writing, software
  20. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  21. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the License for the specific language governing permissions and
  23. * limitations under the License.
  24. */
  25. #ifndef _FILTERING_FUNCTIONS_H_
  26. #define _FILTERING_FUNCTIONS_H_
  27. #include "arm_math_types.h"
  28. #include "arm_math_memory.h"
  29. #include "dsp/none.h"
  30. #include "dsp/utils.h"
  31. #include "dsp/support_functions.h"
  32. #include "dsp/fast_math_functions.h"
  33. #ifdef __cplusplus
  34. extern "C"
  35. {
  36. #endif
  37. #define DELTA_Q31 ((q31_t)(0x100))
  38. #define DELTA_Q15 ((q15_t)0x5)
  39. /**
  40. * @defgroup groupFilters Filtering Functions
  41. */
  42. /**
  43. * @brief Instance structure for the Q7 FIR filter.
  44. */
  45. typedef struct
  46. {
  47. uint16_t numTaps; /**< number of filter coefficients in the filter. */
  48. q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  49. const q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  50. } arm_fir_instance_q7;
  51. /**
  52. * @brief Instance structure for the Q15 FIR filter.
  53. */
  54. typedef struct
  55. {
  56. uint16_t numTaps; /**< number of filter coefficients in the filter. */
  57. q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  58. const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  59. } arm_fir_instance_q15;
  60. /**
  61. * @brief Instance structure for the Q31 FIR filter.
  62. */
  63. typedef struct
  64. {
  65. uint16_t numTaps; /**< number of filter coefficients in the filter. */
  66. q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  67. const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  68. } arm_fir_instance_q31;
  69. /**
  70. * @brief Instance structure for the floating-point FIR filter.
  71. */
  72. typedef struct
  73. {
  74. uint16_t numTaps; /**< number of filter coefficients in the filter. */
  75. float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  76. const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  77. } arm_fir_instance_f32;
  78. /**
  79. * @brief Instance structure for the floating-point FIR filter.
  80. */
  81. typedef struct
  82. {
  83. uint16_t numTaps; /**< number of filter coefficients in the filter. */
  84. float64_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  85. const float64_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  86. } arm_fir_instance_f64;
  87. /**
  88. * @brief Processing function for the Q7 FIR filter.
  89. * @param[in] S points to an instance of the Q7 FIR filter structure.
  90. * @param[in] pSrc points to the block of input data.
  91. * @param[out] pDst points to the block of output data.
  92. * @param[in] blockSize number of samples to process.
  93. */
  94. void arm_fir_q7(
  95. const arm_fir_instance_q7 * S,
  96. const q7_t * pSrc,
  97. q7_t * pDst,
  98. uint32_t blockSize);
  99. /**
  100. * @brief Initialization function for the Q7 FIR filter.
  101. * @param[in,out] S points to an instance of the Q7 FIR structure.
  102. * @param[in] numTaps Number of filter coefficients in the filter.
  103. * @param[in] pCoeffs points to the filter coefficients.
  104. * @param[in] pState points to the state buffer.
  105. * @param[in] blockSize number of samples that are processed.
  106. *
  107. * For the MVE version, the coefficient length must be a multiple of 16.
  108. * You can pad with zeros if you have less coefficients.
  109. */
  110. void arm_fir_init_q7(
  111. arm_fir_instance_q7 * S,
  112. uint16_t numTaps,
  113. const q7_t * pCoeffs,
  114. q7_t * pState,
  115. uint32_t blockSize);
  116. /**
  117. * @brief Processing function for the Q15 FIR filter.
  118. * @param[in] S points to an instance of the Q15 FIR structure.
  119. * @param[in] pSrc points to the block of input data.
  120. * @param[out] pDst points to the block of output data.
  121. * @param[in] blockSize number of samples to process.
  122. */
  123. void arm_fir_q15(
  124. const arm_fir_instance_q15 * S,
  125. const q15_t * pSrc,
  126. q15_t * pDst,
  127. uint32_t blockSize);
  128. /**
  129. * @brief Processing function for the fast Q15 FIR filter (fast version).
  130. * @param[in] S points to an instance of the Q15 FIR filter structure.
  131. * @param[in] pSrc points to the block of input data.
  132. * @param[out] pDst points to the block of output data.
  133. * @param[in] blockSize number of samples to process.
  134. */
  135. void arm_fir_fast_q15(
  136. const arm_fir_instance_q15 * S,
  137. const q15_t * pSrc,
  138. q15_t * pDst,
  139. uint32_t blockSize);
  140. /**
  141. * @brief Initialization function for the Q15 FIR filter.
  142. * @param[in,out] S points to an instance of the Q15 FIR filter structure.
  143. * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
  144. * @param[in] pCoeffs points to the filter coefficients.
  145. * @param[in] pState points to the state buffer.
  146. * @param[in] blockSize number of samples that are processed at a time.
  147. * @return The function returns either
  148. * <code>ARM_MATH_SUCCESS</code> if initialization was successful or
  149. * <code>ARM_MATH_ARGUMENT_ERROR</code> if <code>numTaps</code> is not a supported value.
  150. *
  151. * For the MVE version, the coefficient length must be a multiple of 8.
  152. * You can pad with zeros if you have less coefficients.
  153. *
  154. */
  155. arm_status arm_fir_init_q15(
  156. arm_fir_instance_q15 * S,
  157. uint16_t numTaps,
  158. const q15_t * pCoeffs,
  159. q15_t * pState,
  160. uint32_t blockSize);
  161. /**
  162. * @brief Processing function for the Q31 FIR filter.
  163. * @param[in] S points to an instance of the Q31 FIR filter structure.
  164. * @param[in] pSrc points to the block of input data.
  165. * @param[out] pDst points to the block of output data.
  166. * @param[in] blockSize number of samples to process.
  167. */
  168. void arm_fir_q31(
  169. const arm_fir_instance_q31 * S,
  170. const q31_t * pSrc,
  171. q31_t * pDst,
  172. uint32_t blockSize);
  173. /**
  174. * @brief Processing function for the fast Q31 FIR filter (fast version).
  175. * @param[in] S points to an instance of the Q31 FIR filter structure.
  176. * @param[in] pSrc points to the block of input data.
  177. * @param[out] pDst points to the block of output data.
  178. * @param[in] blockSize number of samples to process.
  179. */
  180. void arm_fir_fast_q31(
  181. const arm_fir_instance_q31 * S,
  182. const q31_t * pSrc,
  183. q31_t * pDst,
  184. uint32_t blockSize);
  185. /**
  186. * @brief Initialization function for the Q31 FIR filter.
  187. * @param[in,out] S points to an instance of the Q31 FIR structure.
  188. * @param[in] numTaps Number of filter coefficients in the filter.
  189. * @param[in] pCoeffs points to the filter coefficients.
  190. * @param[in] pState points to the state buffer.
  191. * @param[in] blockSize number of samples that are processed at a time.
  192. *
  193. * For the MVE version, the coefficient length must be a multiple of 4.
  194. * You can pad with zeros if you have less coefficients.
  195. */
  196. void arm_fir_init_q31(
  197. arm_fir_instance_q31 * S,
  198. uint16_t numTaps,
  199. const q31_t * pCoeffs,
  200. q31_t * pState,
  201. uint32_t blockSize);
  202. /**
  203. * @brief Processing function for the floating-point FIR filter.
  204. * @param[in] S points to an instance of the floating-point FIR structure.
  205. * @param[in] pSrc points to the block of input data.
  206. * @param[out] pDst points to the block of output data.
  207. * @param[in] blockSize number of samples to process.
  208. */
  209. void arm_fir_f32(
  210. const arm_fir_instance_f32 * S,
  211. const float32_t * pSrc,
  212. float32_t * pDst,
  213. uint32_t blockSize);
  214. /**
  215. * @brief Processing function for the floating-point FIR filter.
  216. * @param[in] S points to an instance of the floating-point FIR structure.
  217. * @param[in] pSrc points to the block of input data.
  218. * @param[out] pDst points to the block of output data.
  219. * @param[in] blockSize number of samples to process.
  220. */
  221. void arm_fir_f64(
  222. const arm_fir_instance_f64 * S,
  223. const float64_t * pSrc,
  224. float64_t * pDst,
  225. uint32_t blockSize);
  226. /**
  227. * @brief Initialization function for the floating-point FIR filter.
  228. * @param[in,out] S points to an instance of the floating-point FIR filter structure.
  229. * @param[in] numTaps Number of filter coefficients in the filter.
  230. * @param[in] pCoeffs points to the filter coefficients.
  231. * @param[in] pState points to the state buffer.
  232. * @param[in] blockSize number of samples that are processed at a time.
  233. */
  234. void arm_fir_init_f32(
  235. arm_fir_instance_f32 * S,
  236. uint16_t numTaps,
  237. const float32_t * pCoeffs,
  238. float32_t * pState,
  239. uint32_t blockSize);
  240. /**
  241. * @brief Initialization function for the floating-point FIR filter.
  242. * @param[in,out] S points to an instance of the floating-point FIR filter structure.
  243. * @param[in] numTaps Number of filter coefficients in the filter.
  244. * @param[in] pCoeffs points to the filter coefficients.
  245. * @param[in] pState points to the state buffer.
  246. * @param[in] blockSize number of samples that are processed at a time.
  247. */
  248. void arm_fir_init_f64(
  249. arm_fir_instance_f64 * S,
  250. uint16_t numTaps,
  251. const float64_t * pCoeffs,
  252. float64_t * pState,
  253. uint32_t blockSize);
  254. /**
  255. * @brief Instance structure for the Q15 Biquad cascade filter.
  256. */
  257. typedef struct
  258. {
  259. int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
  260. q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
  261. const q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
  262. int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
  263. } arm_biquad_casd_df1_inst_q15;
  264. /**
  265. * @brief Instance structure for the Q31 Biquad cascade filter.
  266. */
  267. typedef struct
  268. {
  269. uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
  270. q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
  271. const q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
  272. uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
  273. } arm_biquad_casd_df1_inst_q31;
  274. /**
  275. * @brief Instance structure for the floating-point Biquad cascade filter.
  276. */
  277. typedef struct
  278. {
  279. uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
  280. float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
  281. const float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
  282. } arm_biquad_casd_df1_inst_f32;
  283. #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
  284. /**
  285. * @brief Instance structure for the modified Biquad coefs required by vectorized code.
  286. */
  287. typedef struct
  288. {
  289. float32_t coeffs[8][4]; /**< Points to the array of modified coefficients. The array is of length 32. There is one per stage */
  290. } arm_biquad_mod_coef_f32;
  291. #endif
  292. /**
  293. * @brief Processing function for the Q15 Biquad cascade filter.
  294. * @param[in] S points to an instance of the Q15 Biquad cascade structure.
  295. * @param[in] pSrc points to the block of input data.
  296. * @param[out] pDst points to the block of output data.
  297. * @param[in] blockSize number of samples to process.
  298. */
  299. void arm_biquad_cascade_df1_q15(
  300. const arm_biquad_casd_df1_inst_q15 * S,
  301. const q15_t * pSrc,
  302. q15_t * pDst,
  303. uint32_t blockSize);
  304. /**
  305. * @brief Initialization function for the Q15 Biquad cascade filter.
  306. * @param[in,out] S points to an instance of the Q15 Biquad cascade structure.
  307. * @param[in] numStages number of 2nd order stages in the filter.
  308. * @param[in] pCoeffs points to the filter coefficients.
  309. * @param[in] pState points to the state buffer.
  310. * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
  311. */
  312. void arm_biquad_cascade_df1_init_q15(
  313. arm_biquad_casd_df1_inst_q15 * S,
  314. uint8_t numStages,
  315. const q15_t * pCoeffs,
  316. q15_t * pState,
  317. int8_t postShift);
  318. /**
  319. * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
  320. * @param[in] S points to an instance of the Q15 Biquad cascade structure.
  321. * @param[in] pSrc points to the block of input data.
  322. * @param[out] pDst points to the block of output data.
  323. * @param[in] blockSize number of samples to process.
  324. */
  325. void arm_biquad_cascade_df1_fast_q15(
  326. const arm_biquad_casd_df1_inst_q15 * S,
  327. const q15_t * pSrc,
  328. q15_t * pDst,
  329. uint32_t blockSize);
  330. /**
  331. * @brief Processing function for the Q31 Biquad cascade filter
  332. * @param[in] S points to an instance of the Q31 Biquad cascade structure.
  333. * @param[in] pSrc points to the block of input data.
  334. * @param[out] pDst points to the block of output data.
  335. * @param[in] blockSize number of samples to process.
  336. */
  337. void arm_biquad_cascade_df1_q31(
  338. const arm_biquad_casd_df1_inst_q31 * S,
  339. const q31_t * pSrc,
  340. q31_t * pDst,
  341. uint32_t blockSize);
  342. /**
  343. * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
  344. * @param[in] S points to an instance of the Q31 Biquad cascade structure.
  345. * @param[in] pSrc points to the block of input data.
  346. * @param[out] pDst points to the block of output data.
  347. * @param[in] blockSize number of samples to process.
  348. */
  349. void arm_biquad_cascade_df1_fast_q31(
  350. const arm_biquad_casd_df1_inst_q31 * S,
  351. const q31_t * pSrc,
  352. q31_t * pDst,
  353. uint32_t blockSize);
  354. /**
  355. * @brief Initialization function for the Q31 Biquad cascade filter.
  356. * @param[in,out] S points to an instance of the Q31 Biquad cascade structure.
  357. * @param[in] numStages number of 2nd order stages in the filter.
  358. * @param[in] pCoeffs points to the filter coefficients.
  359. * @param[in] pState points to the state buffer.
  360. * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
  361. */
  362. void arm_biquad_cascade_df1_init_q31(
  363. arm_biquad_casd_df1_inst_q31 * S,
  364. uint8_t numStages,
  365. const q31_t * pCoeffs,
  366. q31_t * pState,
  367. int8_t postShift);
  368. /**
  369. * @brief Processing function for the floating-point Biquad cascade filter.
  370. * @param[in] S points to an instance of the floating-point Biquad cascade structure.
  371. * @param[in] pSrc points to the block of input data.
  372. * @param[out] pDst points to the block of output data.
  373. * @param[in] blockSize number of samples to process.
  374. */
  375. void arm_biquad_cascade_df1_f32(
  376. const arm_biquad_casd_df1_inst_f32 * S,
  377. const float32_t * pSrc,
  378. float32_t * pDst,
  379. uint32_t blockSize);
  380. /**
  381. * @brief Initialization function for the floating-point Biquad cascade filter.
  382. * @param[in,out] S points to an instance of the floating-point Biquad cascade structure.
  383. * @param[in] numStages number of 2nd order stages in the filter.
  384. * @param[in] pCoeffs points to the filter coefficients.
  385. * @param[in] pCoeffsMod points to the modified filter coefficients (only MVE version).
  386. * @param[in] pState points to the state buffer.
  387. */
  388. #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
  389. void arm_biquad_cascade_df1_mve_init_f32(
  390. arm_biquad_casd_df1_inst_f32 * S,
  391. uint8_t numStages,
  392. const float32_t * pCoeffs,
  393. arm_biquad_mod_coef_f32 * pCoeffsMod,
  394. float32_t * pState);
  395. #endif
  396. void arm_biquad_cascade_df1_init_f32(
  397. arm_biquad_casd_df1_inst_f32 * S,
  398. uint8_t numStages,
  399. const float32_t * pCoeffs,
  400. float32_t * pState);
  401. /**
  402. * @brief Convolution of floating-point sequences.
  403. * @param[in] pSrcA points to the first input sequence.
  404. * @param[in] srcALen length of the first input sequence.
  405. * @param[in] pSrcB points to the second input sequence.
  406. * @param[in] srcBLen length of the second input sequence.
  407. * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
  408. */
  409. void arm_conv_f32(
  410. const float32_t * pSrcA,
  411. uint32_t srcALen,
  412. const float32_t * pSrcB,
  413. uint32_t srcBLen,
  414. float32_t * pDst);
  415. /**
  416. * @brief Convolution of Q15 sequences.
  417. * @param[in] pSrcA points to the first input sequence.
  418. * @param[in] srcALen length of the first input sequence.
  419. * @param[in] pSrcB points to the second input sequence.
  420. * @param[in] srcBLen length of the second input sequence.
  421. * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
  422. * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  423. * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
  424. */
  425. void arm_conv_opt_q15(
  426. const q15_t * pSrcA,
  427. uint32_t srcALen,
  428. const q15_t * pSrcB,
  429. uint32_t srcBLen,
  430. q15_t * pDst,
  431. q15_t * pScratch1,
  432. q15_t * pScratch2);
  433. /**
  434. * @brief Convolution of Q15 sequences.
  435. * @param[in] pSrcA points to the first input sequence.
  436. * @param[in] srcALen length of the first input sequence.
  437. * @param[in] pSrcB points to the second input sequence.
  438. * @param[in] srcBLen length of the second input sequence.
  439. * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
  440. */
  441. void arm_conv_q15(
  442. const q15_t * pSrcA,
  443. uint32_t srcALen,
  444. const q15_t * pSrcB,
  445. uint32_t srcBLen,
  446. q15_t * pDst);
  447. /**
  448. * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
  449. * @param[in] pSrcA points to the first input sequence.
  450. * @param[in] srcALen length of the first input sequence.
  451. * @param[in] pSrcB points to the second input sequence.
  452. * @param[in] srcBLen length of the second input sequence.
  453. * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
  454. */
  455. void arm_conv_fast_q15(
  456. const q15_t * pSrcA,
  457. uint32_t srcALen,
  458. const q15_t * pSrcB,
  459. uint32_t srcBLen,
  460. q15_t * pDst);
  461. /**
  462. * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
  463. * @param[in] pSrcA points to the first input sequence.
  464. * @param[in] srcALen length of the first input sequence.
  465. * @param[in] pSrcB points to the second input sequence.
  466. * @param[in] srcBLen length of the second input sequence.
  467. * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
  468. * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  469. * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
  470. */
  471. void arm_conv_fast_opt_q15(
  472. const q15_t * pSrcA,
  473. uint32_t srcALen,
  474. const q15_t * pSrcB,
  475. uint32_t srcBLen,
  476. q15_t * pDst,
  477. q15_t * pScratch1,
  478. q15_t * pScratch2);
  479. /**
  480. * @brief Convolution of Q31 sequences.
  481. * @param[in] pSrcA points to the first input sequence.
  482. * @param[in] srcALen length of the first input sequence.
  483. * @param[in] pSrcB points to the second input sequence.
  484. * @param[in] srcBLen length of the second input sequence.
  485. * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
  486. */
  487. void arm_conv_q31(
  488. const q31_t * pSrcA,
  489. uint32_t srcALen,
  490. const q31_t * pSrcB,
  491. uint32_t srcBLen,
  492. q31_t * pDst);
  493. /**
  494. * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
  495. * @param[in] pSrcA points to the first input sequence.
  496. * @param[in] srcALen length of the first input sequence.
  497. * @param[in] pSrcB points to the second input sequence.
  498. * @param[in] srcBLen length of the second input sequence.
  499. * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
  500. */
  501. void arm_conv_fast_q31(
  502. const q31_t * pSrcA,
  503. uint32_t srcALen,
  504. const q31_t * pSrcB,
  505. uint32_t srcBLen,
  506. q31_t * pDst);
  507. /**
  508. * @brief Convolution of Q7 sequences.
  509. * @param[in] pSrcA points to the first input sequence.
  510. * @param[in] srcALen length of the first input sequence.
  511. * @param[in] pSrcB points to the second input sequence.
  512. * @param[in] srcBLen length of the second input sequence.
  513. * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
  514. * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  515. * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
  516. */
  517. void arm_conv_opt_q7(
  518. const q7_t * pSrcA,
  519. uint32_t srcALen,
  520. const q7_t * pSrcB,
  521. uint32_t srcBLen,
  522. q7_t * pDst,
  523. q15_t * pScratch1,
  524. q15_t * pScratch2);
  525. /**
  526. * @brief Convolution of Q7 sequences.
  527. * @param[in] pSrcA points to the first input sequence.
  528. * @param[in] srcALen length of the first input sequence.
  529. * @param[in] pSrcB points to the second input sequence.
  530. * @param[in] srcBLen length of the second input sequence.
  531. * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1.
  532. */
  533. void arm_conv_q7(
  534. const q7_t * pSrcA,
  535. uint32_t srcALen,
  536. const q7_t * pSrcB,
  537. uint32_t srcBLen,
  538. q7_t * pDst);
  539. /**
  540. * @brief Partial convolution of floating-point sequences.
  541. * @param[in] pSrcA points to the first input sequence.
  542. * @param[in] srcALen length of the first input sequence.
  543. * @param[in] pSrcB points to the second input sequence.
  544. * @param[in] srcBLen length of the second input sequence.
  545. * @param[out] pDst points to the block of output data
  546. * @param[in] firstIndex is the first output sample to start with.
  547. * @param[in] numPoints is the number of output points to be computed.
  548. * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
  549. */
  550. arm_status arm_conv_partial_f32(
  551. const float32_t * pSrcA,
  552. uint32_t srcALen,
  553. const float32_t * pSrcB,
  554. uint32_t srcBLen,
  555. float32_t * pDst,
  556. uint32_t firstIndex,
  557. uint32_t numPoints);
  558. /**
  559. * @brief Partial convolution of Q15 sequences.
  560. * @param[in] pSrcA points to the first input sequence.
  561. * @param[in] srcALen length of the first input sequence.
  562. * @param[in] pSrcB points to the second input sequence.
  563. * @param[in] srcBLen length of the second input sequence.
  564. * @param[out] pDst points to the block of output data
  565. * @param[in] firstIndex is the first output sample to start with.
  566. * @param[in] numPoints is the number of output points to be computed.
  567. * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  568. * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
  569. * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
  570. */
  571. arm_status arm_conv_partial_opt_q15(
  572. const q15_t * pSrcA,
  573. uint32_t srcALen,
  574. const q15_t * pSrcB,
  575. uint32_t srcBLen,
  576. q15_t * pDst,
  577. uint32_t firstIndex,
  578. uint32_t numPoints,
  579. q15_t * pScratch1,
  580. q15_t * pScratch2);
  581. /**
  582. * @brief Partial convolution of Q15 sequences.
  583. * @param[in] pSrcA points to the first input sequence.
  584. * @param[in] srcALen length of the first input sequence.
  585. * @param[in] pSrcB points to the second input sequence.
  586. * @param[in] srcBLen length of the second input sequence.
  587. * @param[out] pDst points to the block of output data
  588. * @param[in] firstIndex is the first output sample to start with.
  589. * @param[in] numPoints is the number of output points to be computed.
  590. * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
  591. */
  592. arm_status arm_conv_partial_q15(
  593. const q15_t * pSrcA,
  594. uint32_t srcALen,
  595. const q15_t * pSrcB,
  596. uint32_t srcBLen,
  597. q15_t * pDst,
  598. uint32_t firstIndex,
  599. uint32_t numPoints);
  600. /**
  601. * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
  602. * @param[in] pSrcA points to the first input sequence.
  603. * @param[in] srcALen length of the first input sequence.
  604. * @param[in] pSrcB points to the second input sequence.
  605. * @param[in] srcBLen length of the second input sequence.
  606. * @param[out] pDst points to the block of output data
  607. * @param[in] firstIndex is the first output sample to start with.
  608. * @param[in] numPoints is the number of output points to be computed.
  609. * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
  610. */
  611. arm_status arm_conv_partial_fast_q15(
  612. const q15_t * pSrcA,
  613. uint32_t srcALen,
  614. const q15_t * pSrcB,
  615. uint32_t srcBLen,
  616. q15_t * pDst,
  617. uint32_t firstIndex,
  618. uint32_t numPoints);
  619. /**
  620. * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
  621. * @param[in] pSrcA points to the first input sequence.
  622. * @param[in] srcALen length of the first input sequence.
  623. * @param[in] pSrcB points to the second input sequence.
  624. * @param[in] srcBLen length of the second input sequence.
  625. * @param[out] pDst points to the block of output data
  626. * @param[in] firstIndex is the first output sample to start with.
  627. * @param[in] numPoints is the number of output points to be computed.
  628. * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  629. * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
  630. * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
  631. */
  632. arm_status arm_conv_partial_fast_opt_q15(
  633. const q15_t * pSrcA,
  634. uint32_t srcALen,
  635. const q15_t * pSrcB,
  636. uint32_t srcBLen,
  637. q15_t * pDst,
  638. uint32_t firstIndex,
  639. uint32_t numPoints,
  640. q15_t * pScratch1,
  641. q15_t * pScratch2);
  642. /**
  643. * @brief Partial convolution of Q31 sequences.
  644. * @param[in] pSrcA points to the first input sequence.
  645. * @param[in] srcALen length of the first input sequence.
  646. * @param[in] pSrcB points to the second input sequence.
  647. * @param[in] srcBLen length of the second input sequence.
  648. * @param[out] pDst points to the block of output data
  649. * @param[in] firstIndex is the first output sample to start with.
  650. * @param[in] numPoints is the number of output points to be computed.
  651. * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
  652. */
  653. arm_status arm_conv_partial_q31(
  654. const q31_t * pSrcA,
  655. uint32_t srcALen,
  656. const q31_t * pSrcB,
  657. uint32_t srcBLen,
  658. q31_t * pDst,
  659. uint32_t firstIndex,
  660. uint32_t numPoints);
  661. /**
  662. * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
  663. * @param[in] pSrcA points to the first input sequence.
  664. * @param[in] srcALen length of the first input sequence.
  665. * @param[in] pSrcB points to the second input sequence.
  666. * @param[in] srcBLen length of the second input sequence.
  667. * @param[out] pDst points to the block of output data
  668. * @param[in] firstIndex is the first output sample to start with.
  669. * @param[in] numPoints is the number of output points to be computed.
  670. * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
  671. */
  672. arm_status arm_conv_partial_fast_q31(
  673. const q31_t * pSrcA,
  674. uint32_t srcALen,
  675. const q31_t * pSrcB,
  676. uint32_t srcBLen,
  677. q31_t * pDst,
  678. uint32_t firstIndex,
  679. uint32_t numPoints);
  680. /**
  681. * @brief Partial convolution of Q7 sequences
  682. * @param[in] pSrcA points to the first input sequence.
  683. * @param[in] srcALen length of the first input sequence.
  684. * @param[in] pSrcB points to the second input sequence.
  685. * @param[in] srcBLen length of the second input sequence.
  686. * @param[out] pDst points to the block of output data
  687. * @param[in] firstIndex is the first output sample to start with.
  688. * @param[in] numPoints is the number of output points to be computed.
  689. * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  690. * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
  691. * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
  692. */
  693. arm_status arm_conv_partial_opt_q7(
  694. const q7_t * pSrcA,
  695. uint32_t srcALen,
  696. const q7_t * pSrcB,
  697. uint32_t srcBLen,
  698. q7_t * pDst,
  699. uint32_t firstIndex,
  700. uint32_t numPoints,
  701. q15_t * pScratch1,
  702. q15_t * pScratch2);
  703. /**
  704. * @brief Partial convolution of Q7 sequences.
  705. * @param[in] pSrcA points to the first input sequence.
  706. * @param[in] srcALen length of the first input sequence.
  707. * @param[in] pSrcB points to the second input sequence.
  708. * @param[in] srcBLen length of the second input sequence.
  709. * @param[out] pDst points to the block of output data
  710. * @param[in] firstIndex is the first output sample to start with.
  711. * @param[in] numPoints is the number of output points to be computed.
  712. * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
  713. */
  714. arm_status arm_conv_partial_q7(
  715. const q7_t * pSrcA,
  716. uint32_t srcALen,
  717. const q7_t * pSrcB,
  718. uint32_t srcBLen,
  719. q7_t * pDst,
  720. uint32_t firstIndex,
  721. uint32_t numPoints);
  722. /**
  723. * @brief Instance structure for the Q15 FIR decimator.
  724. */
  725. typedef struct
  726. {
  727. uint8_t M; /**< decimation factor. */
  728. uint16_t numTaps; /**< number of coefficients in the filter. */
  729. const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  730. q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  731. } arm_fir_decimate_instance_q15;
  732. /**
  733. * @brief Instance structure for the Q31 FIR decimator.
  734. */
  735. typedef struct
  736. {
  737. uint8_t M; /**< decimation factor. */
  738. uint16_t numTaps; /**< number of coefficients in the filter. */
  739. const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  740. q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  741. } arm_fir_decimate_instance_q31;
  742. /**
  743. @brief Instance structure for single precision floating-point FIR decimator.
  744. */
  745. typedef struct
  746. {
  747. uint8_t M; /**< decimation factor. */
  748. uint16_t numTaps; /**< number of coefficients in the filter. */
  749. const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  750. float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  751. } arm_fir_decimate_instance_f32;
  752. /**
  753. @brief Instance structure for double precision floating-point FIR decimator.
  754. */
  755. typedef struct
  756. {
  757. uint8_t M; /**< decimation factor. */
  758. uint16_t numTaps; /**< number of coefficients in the filter. */
  759. const float64_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  760. float64_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  761. } arm_fir_decimate_instance_f64;
  762. /**
  763. @brief Processing function for floating-point FIR decimator.
  764. @param[in] S points to an instance of the floating-point FIR decimator structure
  765. @param[in] pSrc points to the block of input data
  766. @param[out] pDst points to the block of output data
  767. @param[in] blockSize number of samples to process
  768. */
  769. void arm_fir_decimate_f64(
  770. const arm_fir_decimate_instance_f64 * S,
  771. const float64_t * pSrc,
  772. float64_t * pDst,
  773. uint32_t blockSize);
  774. /**
  775. @brief Initialization function for the floating-point FIR decimator.
  776. @param[in,out] S points to an instance of the floating-point FIR decimator structure
  777. @param[in] numTaps number of coefficients in the filter
  778. @param[in] M decimation factor
  779. @param[in] pCoeffs points to the filter coefficients
  780. @param[in] pState points to the state buffer
  781. @param[in] blockSize number of input samples to process per call
  782. @return execution status
  783. - \ref ARM_MATH_SUCCESS : Operation successful
  784. - \ref ARM_MATH_LENGTH_ERROR : <code>blockSize</code> is not a multiple of <code>M</code>
  785. */
  786. arm_status arm_fir_decimate_init_f64(
  787. arm_fir_decimate_instance_f64 * S,
  788. uint16_t numTaps,
  789. uint8_t M,
  790. const float64_t * pCoeffs,
  791. float64_t * pState,
  792. uint32_t blockSize);
  793. /**
  794. @brief Processing function for floating-point FIR decimator.
  795. @param[in] S points to an instance of the floating-point FIR decimator structure
  796. @param[in] pSrc points to the block of input data
  797. @param[out] pDst points to the block of output data
  798. @param[in] blockSize number of samples to process
  799. */
  800. void arm_fir_decimate_f32(
  801. const arm_fir_decimate_instance_f32 * S,
  802. const float32_t * pSrc,
  803. float32_t * pDst,
  804. uint32_t blockSize);
  805. /**
  806. @brief Initialization function for the floating-point FIR decimator.
  807. @param[in,out] S points to an instance of the floating-point FIR decimator structure
  808. @param[in] numTaps number of coefficients in the filter
  809. @param[in] M decimation factor
  810. @param[in] pCoeffs points to the filter coefficients
  811. @param[in] pState points to the state buffer
  812. @param[in] blockSize number of input samples to process per call
  813. @return execution status
  814. - \ref ARM_MATH_SUCCESS : Operation successful
  815. - \ref ARM_MATH_LENGTH_ERROR : <code>blockSize</code> is not a multiple of <code>M</code>
  816. */
  817. arm_status arm_fir_decimate_init_f32(
  818. arm_fir_decimate_instance_f32 * S,
  819. uint16_t numTaps,
  820. uint8_t M,
  821. const float32_t * pCoeffs,
  822. float32_t * pState,
  823. uint32_t blockSize);
  824. /**
  825. * @brief Processing function for the Q15 FIR decimator.
  826. * @param[in] S points to an instance of the Q15 FIR decimator structure.
  827. * @param[in] pSrc points to the block of input data.
  828. * @param[out] pDst points to the block of output data
  829. * @param[in] blockSize number of input samples to process per call.
  830. */
  831. void arm_fir_decimate_q15(
  832. const arm_fir_decimate_instance_q15 * S,
  833. const q15_t * pSrc,
  834. q15_t * pDst,
  835. uint32_t blockSize);
  836. /**
  837. * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
  838. * @param[in] S points to an instance of the Q15 FIR decimator structure.
  839. * @param[in] pSrc points to the block of input data.
  840. * @param[out] pDst points to the block of output data
  841. * @param[in] blockSize number of input samples to process per call.
  842. */
  843. void arm_fir_decimate_fast_q15(
  844. const arm_fir_decimate_instance_q15 * S,
  845. const q15_t * pSrc,
  846. q15_t * pDst,
  847. uint32_t blockSize);
  848. /**
  849. * @brief Initialization function for the Q15 FIR decimator.
  850. * @param[in,out] S points to an instance of the Q15 FIR decimator structure.
  851. * @param[in] numTaps number of coefficients in the filter.
  852. * @param[in] M decimation factor.
  853. * @param[in] pCoeffs points to the filter coefficients.
  854. * @param[in] pState points to the state buffer.
  855. * @param[in] blockSize number of input samples to process per call.
  856. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
  857. * <code>blockSize</code> is not a multiple of <code>M</code>.
  858. */
  859. arm_status arm_fir_decimate_init_q15(
  860. arm_fir_decimate_instance_q15 * S,
  861. uint16_t numTaps,
  862. uint8_t M,
  863. const q15_t * pCoeffs,
  864. q15_t * pState,
  865. uint32_t blockSize);
  866. /**
  867. * @brief Processing function for the Q31 FIR decimator.
  868. * @param[in] S points to an instance of the Q31 FIR decimator structure.
  869. * @param[in] pSrc points to the block of input data.
  870. * @param[out] pDst points to the block of output data
  871. * @param[in] blockSize number of input samples to process per call.
  872. */
  873. void arm_fir_decimate_q31(
  874. const arm_fir_decimate_instance_q31 * S,
  875. const q31_t * pSrc,
  876. q31_t * pDst,
  877. uint32_t blockSize);
  878. /**
  879. * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
  880. * @param[in] S points to an instance of the Q31 FIR decimator structure.
  881. * @param[in] pSrc points to the block of input data.
  882. * @param[out] pDst points to the block of output data
  883. * @param[in] blockSize number of input samples to process per call.
  884. */
  885. void arm_fir_decimate_fast_q31(
  886. const arm_fir_decimate_instance_q31 * S,
  887. const q31_t * pSrc,
  888. q31_t * pDst,
  889. uint32_t blockSize);
  890. /**
  891. * @brief Initialization function for the Q31 FIR decimator.
  892. * @param[in,out] S points to an instance of the Q31 FIR decimator structure.
  893. * @param[in] numTaps number of coefficients in the filter.
  894. * @param[in] M decimation factor.
  895. * @param[in] pCoeffs points to the filter coefficients.
  896. * @param[in] pState points to the state buffer.
  897. * @param[in] blockSize number of input samples to process per call.
  898. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
  899. * <code>blockSize</code> is not a multiple of <code>M</code>.
  900. */
  901. arm_status arm_fir_decimate_init_q31(
  902. arm_fir_decimate_instance_q31 * S,
  903. uint16_t numTaps,
  904. uint8_t M,
  905. const q31_t * pCoeffs,
  906. q31_t * pState,
  907. uint32_t blockSize);
  908. /**
  909. * @brief Instance structure for the Q15 FIR interpolator.
  910. */
  911. typedef struct
  912. {
  913. uint8_t L; /**< upsample factor. */
  914. uint16_t phaseLength; /**< length of each polyphase filter component. */
  915. const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
  916. q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
  917. } arm_fir_interpolate_instance_q15;
  918. /**
  919. * @brief Instance structure for the Q31 FIR interpolator.
  920. */
  921. typedef struct
  922. {
  923. uint8_t L; /**< upsample factor. */
  924. uint16_t phaseLength; /**< length of each polyphase filter component. */
  925. const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
  926. q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
  927. } arm_fir_interpolate_instance_q31;
  928. /**
  929. * @brief Instance structure for the floating-point FIR interpolator.
  930. */
  931. typedef struct
  932. {
  933. uint8_t L; /**< upsample factor. */
  934. uint16_t phaseLength; /**< length of each polyphase filter component. */
  935. const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
  936. float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
  937. } arm_fir_interpolate_instance_f32;
  938. /**
  939. * @brief Processing function for the Q15 FIR interpolator.
  940. * @param[in] S points to an instance of the Q15 FIR interpolator structure.
  941. * @param[in] pSrc points to the block of input data.
  942. * @param[out] pDst points to the block of output data.
  943. * @param[in] blockSize number of input samples to process per call.
  944. */
  945. void arm_fir_interpolate_q15(
  946. const arm_fir_interpolate_instance_q15 * S,
  947. const q15_t * pSrc,
  948. q15_t * pDst,
  949. uint32_t blockSize);
  950. /**
  951. * @brief Initialization function for the Q15 FIR interpolator.
  952. * @param[in,out] S points to an instance of the Q15 FIR interpolator structure.
  953. * @param[in] L upsample factor.
  954. * @param[in] numTaps number of filter coefficients in the filter.
  955. * @param[in] pCoeffs points to the filter coefficient buffer.
  956. * @param[in] pState points to the state buffer.
  957. * @param[in] blockSize number of input samples to process per call.
  958. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
  959. * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
  960. */
  961. arm_status arm_fir_interpolate_init_q15(
  962. arm_fir_interpolate_instance_q15 * S,
  963. uint8_t L,
  964. uint16_t numTaps,
  965. const q15_t * pCoeffs,
  966. q15_t * pState,
  967. uint32_t blockSize);
  968. /**
  969. * @brief Processing function for the Q31 FIR interpolator.
  970. * @param[in] S points to an instance of the Q15 FIR interpolator structure.
  971. * @param[in] pSrc points to the block of input data.
  972. * @param[out] pDst points to the block of output data.
  973. * @param[in] blockSize number of input samples to process per call.
  974. */
  975. void arm_fir_interpolate_q31(
  976. const arm_fir_interpolate_instance_q31 * S,
  977. const q31_t * pSrc,
  978. q31_t * pDst,
  979. uint32_t blockSize);
  980. /**
  981. * @brief Initialization function for the Q31 FIR interpolator.
  982. * @param[in,out] S points to an instance of the Q31 FIR interpolator structure.
  983. * @param[in] L upsample factor.
  984. * @param[in] numTaps number of filter coefficients in the filter.
  985. * @param[in] pCoeffs points to the filter coefficient buffer.
  986. * @param[in] pState points to the state buffer.
  987. * @param[in] blockSize number of input samples to process per call.
  988. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
  989. * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
  990. */
  991. arm_status arm_fir_interpolate_init_q31(
  992. arm_fir_interpolate_instance_q31 * S,
  993. uint8_t L,
  994. uint16_t numTaps,
  995. const q31_t * pCoeffs,
  996. q31_t * pState,
  997. uint32_t blockSize);
  998. /**
  999. * @brief Processing function for the floating-point FIR interpolator.
  1000. * @param[in] S points to an instance of the floating-point FIR interpolator structure.
  1001. * @param[in] pSrc points to the block of input data.
  1002. * @param[out] pDst points to the block of output data.
  1003. * @param[in] blockSize number of input samples to process per call.
  1004. */
  1005. void arm_fir_interpolate_f32(
  1006. const arm_fir_interpolate_instance_f32 * S,
  1007. const float32_t * pSrc,
  1008. float32_t * pDst,
  1009. uint32_t blockSize);
  1010. /**
  1011. * @brief Initialization function for the floating-point FIR interpolator.
  1012. * @param[in,out] S points to an instance of the floating-point FIR interpolator structure.
  1013. * @param[in] L upsample factor.
  1014. * @param[in] numTaps number of filter coefficients in the filter.
  1015. * @param[in] pCoeffs points to the filter coefficient buffer.
  1016. * @param[in] pState points to the state buffer.
  1017. * @param[in] blockSize number of input samples to process per call.
  1018. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
  1019. * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
  1020. */
  1021. arm_status arm_fir_interpolate_init_f32(
  1022. arm_fir_interpolate_instance_f32 * S,
  1023. uint8_t L,
  1024. uint16_t numTaps,
  1025. const float32_t * pCoeffs,
  1026. float32_t * pState,
  1027. uint32_t blockSize);
  1028. /**
  1029. * @brief Instance structure for the high precision Q31 Biquad cascade filter.
  1030. */
  1031. typedef struct
  1032. {
  1033. uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
  1034. q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
  1035. const q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
  1036. uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
  1037. } arm_biquad_cas_df1_32x64_ins_q31;
  1038. /**
  1039. * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter structure.
  1040. * @param[in] pSrc points to the block of input data.
  1041. * @param[out] pDst points to the block of output data
  1042. * @param[in] blockSize number of samples to process.
  1043. */
  1044. void arm_biquad_cas_df1_32x64_q31(
  1045. const arm_biquad_cas_df1_32x64_ins_q31 * S,
  1046. const q31_t * pSrc,
  1047. q31_t * pDst,
  1048. uint32_t blockSize);
  1049. /**
  1050. * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure.
  1051. * @param[in] numStages number of 2nd order stages in the filter.
  1052. * @param[in] pCoeffs points to the filter coefficients.
  1053. * @param[in] pState points to the state buffer.
  1054. * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
  1055. */
  1056. void arm_biquad_cas_df1_32x64_init_q31(
  1057. arm_biquad_cas_df1_32x64_ins_q31 * S,
  1058. uint8_t numStages,
  1059. const q31_t * pCoeffs,
  1060. q63_t * pState,
  1061. uint8_t postShift);
  1062. /**
  1063. * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
  1064. */
  1065. typedef struct
  1066. {
  1067. uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
  1068. float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
  1069. const float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
  1070. } arm_biquad_cascade_df2T_instance_f32;
  1071. /**
  1072. * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
  1073. */
  1074. typedef struct
  1075. {
  1076. uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
  1077. float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
  1078. const float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
  1079. } arm_biquad_cascade_stereo_df2T_instance_f32;
  1080. /**
  1081. * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
  1082. */
  1083. typedef struct
  1084. {
  1085. uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
  1086. float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
  1087. const float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
  1088. } arm_biquad_cascade_df2T_instance_f64;
  1089. /**
  1090. * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
  1091. * @param[in] S points to an instance of the filter data structure.
  1092. * @param[in] pSrc points to the block of input data.
  1093. * @param[out] pDst points to the block of output data
  1094. * @param[in] blockSize number of samples to process.
  1095. */
  1096. void arm_biquad_cascade_df2T_f32(
  1097. const arm_biquad_cascade_df2T_instance_f32 * S,
  1098. const float32_t * pSrc,
  1099. float32_t * pDst,
  1100. uint32_t blockSize);
  1101. /**
  1102. * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
  1103. * @param[in] S points to an instance of the filter data structure.
  1104. * @param[in] pSrc points to the block of input data.
  1105. * @param[out] pDst points to the block of output data
  1106. * @param[in] blockSize number of samples to process.
  1107. */
  1108. void arm_biquad_cascade_stereo_df2T_f32(
  1109. const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
  1110. const float32_t * pSrc,
  1111. float32_t * pDst,
  1112. uint32_t blockSize);
  1113. /**
  1114. * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
  1115. * @param[in] S points to an instance of the filter data structure.
  1116. * @param[in] pSrc points to the block of input data.
  1117. * @param[out] pDst points to the block of output data
  1118. * @param[in] blockSize number of samples to process.
  1119. */
  1120. void arm_biquad_cascade_df2T_f64(
  1121. const arm_biquad_cascade_df2T_instance_f64 * S,
  1122. const float64_t * pSrc,
  1123. float64_t * pDst,
  1124. uint32_t blockSize);
  1125. #if defined(ARM_MATH_NEON)
  1126. /**
  1127. @brief Compute new coefficient arrays for use in vectorized filter (Neon only).
  1128. @param[in] numStages number of 2nd order stages in the filter.
  1129. @param[in] pCoeffs points to the original filter coefficients.
  1130. @param[in] pComputedCoeffs points to the new computed coefficients for the vectorized version.
  1131. */
  1132. void arm_biquad_cascade_df2T_compute_coefs_f32(
  1133. uint8_t numStages,
  1134. const float32_t * pCoeffs,
  1135. float32_t * pComputedCoeffs);
  1136. #endif
  1137. /**
  1138. * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
  1139. * @param[in,out] S points to an instance of the filter data structure.
  1140. * @param[in] numStages number of 2nd order stages in the filter.
  1141. * @param[in] pCoeffs points to the filter coefficients.
  1142. * @param[in] pState points to the state buffer.
  1143. */
  1144. void arm_biquad_cascade_df2T_init_f32(
  1145. arm_biquad_cascade_df2T_instance_f32 * S,
  1146. uint8_t numStages,
  1147. const float32_t * pCoeffs,
  1148. float32_t * pState);
  1149. /**
  1150. * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
  1151. * @param[in,out] S points to an instance of the filter data structure.
  1152. * @param[in] numStages number of 2nd order stages in the filter.
  1153. * @param[in] pCoeffs points to the filter coefficients.
  1154. * @param[in] pState points to the state buffer.
  1155. */
  1156. void arm_biquad_cascade_stereo_df2T_init_f32(
  1157. arm_biquad_cascade_stereo_df2T_instance_f32 * S,
  1158. uint8_t numStages,
  1159. const float32_t * pCoeffs,
  1160. float32_t * pState);
  1161. /**
  1162. * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
  1163. * @param[in,out] S points to an instance of the filter data structure.
  1164. * @param[in] numStages number of 2nd order stages in the filter.
  1165. * @param[in] pCoeffs points to the filter coefficients.
  1166. * @param[in] pState points to the state buffer.
  1167. */
  1168. void arm_biquad_cascade_df2T_init_f64(
  1169. arm_biquad_cascade_df2T_instance_f64 * S,
  1170. uint8_t numStages,
  1171. const float64_t * pCoeffs,
  1172. float64_t * pState);
  1173. /**
  1174. * @brief Instance structure for the Q15 FIR lattice filter.
  1175. */
  1176. typedef struct
  1177. {
  1178. uint16_t numStages; /**< number of filter stages. */
  1179. q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
  1180. const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
  1181. } arm_fir_lattice_instance_q15;
  1182. /**
  1183. * @brief Instance structure for the Q31 FIR lattice filter.
  1184. */
  1185. typedef struct
  1186. {
  1187. uint16_t numStages; /**< number of filter stages. */
  1188. q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
  1189. const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
  1190. } arm_fir_lattice_instance_q31;
  1191. /**
  1192. * @brief Instance structure for the floating-point FIR lattice filter.
  1193. */
  1194. typedef struct
  1195. {
  1196. uint16_t numStages; /**< number of filter stages. */
  1197. float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
  1198. const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
  1199. } arm_fir_lattice_instance_f32;
  1200. /**
  1201. * @brief Initialization function for the Q15 FIR lattice filter.
  1202. * @param[in] S points to an instance of the Q15 FIR lattice structure.
  1203. * @param[in] numStages number of filter stages.
  1204. * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
  1205. * @param[in] pState points to the state buffer. The array is of length numStages.
  1206. */
  1207. void arm_fir_lattice_init_q15(
  1208. arm_fir_lattice_instance_q15 * S,
  1209. uint16_t numStages,
  1210. const q15_t * pCoeffs,
  1211. q15_t * pState);
  1212. /**
  1213. * @brief Processing function for the Q15 FIR lattice filter.
  1214. * @param[in] S points to an instance of the Q15 FIR lattice structure.
  1215. * @param[in] pSrc points to the block of input data.
  1216. * @param[out] pDst points to the block of output data.
  1217. * @param[in] blockSize number of samples to process.
  1218. */
  1219. void arm_fir_lattice_q15(
  1220. const arm_fir_lattice_instance_q15 * S,
  1221. const q15_t * pSrc,
  1222. q15_t * pDst,
  1223. uint32_t blockSize);
  1224. /**
  1225. * @brief Initialization function for the Q31 FIR lattice filter.
  1226. * @param[in] S points to an instance of the Q31 FIR lattice structure.
  1227. * @param[in] numStages number of filter stages.
  1228. * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
  1229. * @param[in] pState points to the state buffer. The array is of length numStages.
  1230. */
  1231. void arm_fir_lattice_init_q31(
  1232. arm_fir_lattice_instance_q31 * S,
  1233. uint16_t numStages,
  1234. const q31_t * pCoeffs,
  1235. q31_t * pState);
  1236. /**
  1237. * @brief Processing function for the Q31 FIR lattice filter.
  1238. * @param[in] S points to an instance of the Q31 FIR lattice structure.
  1239. * @param[in] pSrc points to the block of input data.
  1240. * @param[out] pDst points to the block of output data
  1241. * @param[in] blockSize number of samples to process.
  1242. */
  1243. void arm_fir_lattice_q31(
  1244. const arm_fir_lattice_instance_q31 * S,
  1245. const q31_t * pSrc,
  1246. q31_t * pDst,
  1247. uint32_t blockSize);
  1248. /**
  1249. * @brief Initialization function for the floating-point FIR lattice filter.
  1250. * @param[in] S points to an instance of the floating-point FIR lattice structure.
  1251. * @param[in] numStages number of filter stages.
  1252. * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages.
  1253. * @param[in] pState points to the state buffer. The array is of length numStages.
  1254. */
  1255. void arm_fir_lattice_init_f32(
  1256. arm_fir_lattice_instance_f32 * S,
  1257. uint16_t numStages,
  1258. const float32_t * pCoeffs,
  1259. float32_t * pState);
  1260. /**
  1261. * @brief Processing function for the floating-point FIR lattice filter.
  1262. * @param[in] S points to an instance of the floating-point FIR lattice structure.
  1263. * @param[in] pSrc points to the block of input data.
  1264. * @param[out] pDst points to the block of output data
  1265. * @param[in] blockSize number of samples to process.
  1266. */
  1267. void arm_fir_lattice_f32(
  1268. const arm_fir_lattice_instance_f32 * S,
  1269. const float32_t * pSrc,
  1270. float32_t * pDst,
  1271. uint32_t blockSize);
  1272. /**
  1273. * @brief Instance structure for the Q15 IIR lattice filter.
  1274. */
  1275. typedef struct
  1276. {
  1277. uint16_t numStages; /**< number of stages in the filter. */
  1278. q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
  1279. q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
  1280. q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
  1281. } arm_iir_lattice_instance_q15;
  1282. /**
  1283. * @brief Instance structure for the Q31 IIR lattice filter.
  1284. */
  1285. typedef struct
  1286. {
  1287. uint16_t numStages; /**< number of stages in the filter. */
  1288. q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
  1289. q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
  1290. q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
  1291. } arm_iir_lattice_instance_q31;
  1292. /**
  1293. * @brief Instance structure for the floating-point IIR lattice filter.
  1294. */
  1295. typedef struct
  1296. {
  1297. uint16_t numStages; /**< number of stages in the filter. */
  1298. float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
  1299. float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
  1300. float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
  1301. } arm_iir_lattice_instance_f32;
  1302. /**
  1303. * @brief Processing function for the floating-point IIR lattice filter.
  1304. * @param[in] S points to an instance of the floating-point IIR lattice structure.
  1305. * @param[in] pSrc points to the block of input data.
  1306. * @param[out] pDst points to the block of output data.
  1307. * @param[in] blockSize number of samples to process.
  1308. */
  1309. void arm_iir_lattice_f32(
  1310. const arm_iir_lattice_instance_f32 * S,
  1311. const float32_t * pSrc,
  1312. float32_t * pDst,
  1313. uint32_t blockSize);
  1314. /**
  1315. * @brief Initialization function for the floating-point IIR lattice filter.
  1316. * @param[in] S points to an instance of the floating-point IIR lattice structure.
  1317. * @param[in] numStages number of stages in the filter.
  1318. * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
  1319. * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
  1320. * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1.
  1321. * @param[in] blockSize number of samples to process.
  1322. */
  1323. void arm_iir_lattice_init_f32(
  1324. arm_iir_lattice_instance_f32 * S,
  1325. uint16_t numStages,
  1326. float32_t * pkCoeffs,
  1327. float32_t * pvCoeffs,
  1328. float32_t * pState,
  1329. uint32_t blockSize);
  1330. /**
  1331. * @brief Processing function for the Q31 IIR lattice filter.
  1332. * @param[in] S points to an instance of the Q31 IIR lattice structure.
  1333. * @param[in] pSrc points to the block of input data.
  1334. * @param[out] pDst points to the block of output data.
  1335. * @param[in] blockSize number of samples to process.
  1336. */
  1337. void arm_iir_lattice_q31(
  1338. const arm_iir_lattice_instance_q31 * S,
  1339. const q31_t * pSrc,
  1340. q31_t * pDst,
  1341. uint32_t blockSize);
  1342. /**
  1343. * @brief Initialization function for the Q31 IIR lattice filter.
  1344. * @param[in] S points to an instance of the Q31 IIR lattice structure.
  1345. * @param[in] numStages number of stages in the filter.
  1346. * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
  1347. * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
  1348. * @param[in] pState points to the state buffer. The array is of length numStages+blockSize.
  1349. * @param[in] blockSize number of samples to process.
  1350. */
  1351. void arm_iir_lattice_init_q31(
  1352. arm_iir_lattice_instance_q31 * S,
  1353. uint16_t numStages,
  1354. q31_t * pkCoeffs,
  1355. q31_t * pvCoeffs,
  1356. q31_t * pState,
  1357. uint32_t blockSize);
  1358. /**
  1359. * @brief Processing function for the Q15 IIR lattice filter.
  1360. * @param[in] S points to an instance of the Q15 IIR lattice structure.
  1361. * @param[in] pSrc points to the block of input data.
  1362. * @param[out] pDst points to the block of output data.
  1363. * @param[in] blockSize number of samples to process.
  1364. */
  1365. void arm_iir_lattice_q15(
  1366. const arm_iir_lattice_instance_q15 * S,
  1367. const q15_t * pSrc,
  1368. q15_t * pDst,
  1369. uint32_t blockSize);
  1370. /**
  1371. * @brief Initialization function for the Q15 IIR lattice filter.
  1372. * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure.
  1373. * @param[in] numStages number of stages in the filter.
  1374. * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
  1375. * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
  1376. * @param[in] pState points to state buffer. The array is of length numStages+blockSize.
  1377. * @param[in] blockSize number of samples to process per call.
  1378. */
  1379. void arm_iir_lattice_init_q15(
  1380. arm_iir_lattice_instance_q15 * S,
  1381. uint16_t numStages,
  1382. q15_t * pkCoeffs,
  1383. q15_t * pvCoeffs,
  1384. q15_t * pState,
  1385. uint32_t blockSize);
  1386. /**
  1387. * @brief Instance structure for the floating-point LMS filter.
  1388. */
  1389. typedef struct
  1390. {
  1391. uint16_t numTaps; /**< number of coefficients in the filter. */
  1392. float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  1393. float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  1394. float32_t mu; /**< step size that controls filter coefficient updates. */
  1395. } arm_lms_instance_f32;
  1396. /**
  1397. * @brief Processing function for floating-point LMS filter.
  1398. * @param[in] S points to an instance of the floating-point LMS filter structure.
  1399. * @param[in] pSrc points to the block of input data.
  1400. * @param[in] pRef points to the block of reference data.
  1401. * @param[out] pOut points to the block of output data.
  1402. * @param[out] pErr points to the block of error data.
  1403. * @param[in] blockSize number of samples to process.
  1404. */
  1405. void arm_lms_f32(
  1406. const arm_lms_instance_f32 * S,
  1407. const float32_t * pSrc,
  1408. float32_t * pRef,
  1409. float32_t * pOut,
  1410. float32_t * pErr,
  1411. uint32_t blockSize);
  1412. /**
  1413. * @brief Initialization function for floating-point LMS filter.
  1414. * @param[in] S points to an instance of the floating-point LMS filter structure.
  1415. * @param[in] numTaps number of filter coefficients.
  1416. * @param[in] pCoeffs points to the coefficient buffer.
  1417. * @param[in] pState points to state buffer.
  1418. * @param[in] mu step size that controls filter coefficient updates.
  1419. * @param[in] blockSize number of samples to process.
  1420. */
  1421. void arm_lms_init_f32(
  1422. arm_lms_instance_f32 * S,
  1423. uint16_t numTaps,
  1424. float32_t * pCoeffs,
  1425. float32_t * pState,
  1426. float32_t mu,
  1427. uint32_t blockSize);
  1428. /**
  1429. * @brief Instance structure for the Q15 LMS filter.
  1430. */
  1431. typedef struct
  1432. {
  1433. uint16_t numTaps; /**< number of coefficients in the filter. */
  1434. q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  1435. q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  1436. q15_t mu; /**< step size that controls filter coefficient updates. */
  1437. uint32_t postShift; /**< bit shift applied to coefficients. */
  1438. } arm_lms_instance_q15;
  1439. /**
  1440. * @brief Initialization function for the Q15 LMS filter.
  1441. * @param[in] S points to an instance of the Q15 LMS filter structure.
  1442. * @param[in] numTaps number of filter coefficients.
  1443. * @param[in] pCoeffs points to the coefficient buffer.
  1444. * @param[in] pState points to the state buffer.
  1445. * @param[in] mu step size that controls filter coefficient updates.
  1446. * @param[in] blockSize number of samples to process.
  1447. * @param[in] postShift bit shift applied to coefficients.
  1448. */
  1449. void arm_lms_init_q15(
  1450. arm_lms_instance_q15 * S,
  1451. uint16_t numTaps,
  1452. q15_t * pCoeffs,
  1453. q15_t * pState,
  1454. q15_t mu,
  1455. uint32_t blockSize,
  1456. uint32_t postShift);
  1457. /**
  1458. * @brief Processing function for Q15 LMS filter.
  1459. * @param[in] S points to an instance of the Q15 LMS filter structure.
  1460. * @param[in] pSrc points to the block of input data.
  1461. * @param[in] pRef points to the block of reference data.
  1462. * @param[out] pOut points to the block of output data.
  1463. * @param[out] pErr points to the block of error data.
  1464. * @param[in] blockSize number of samples to process.
  1465. */
  1466. void arm_lms_q15(
  1467. const arm_lms_instance_q15 * S,
  1468. const q15_t * pSrc,
  1469. q15_t * pRef,
  1470. q15_t * pOut,
  1471. q15_t * pErr,
  1472. uint32_t blockSize);
  1473. /**
  1474. * @brief Instance structure for the Q31 LMS filter.
  1475. */
  1476. typedef struct
  1477. {
  1478. uint16_t numTaps; /**< number of coefficients in the filter. */
  1479. q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  1480. q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  1481. q31_t mu; /**< step size that controls filter coefficient updates. */
  1482. uint32_t postShift; /**< bit shift applied to coefficients. */
  1483. } arm_lms_instance_q31;
  1484. /**
  1485. * @brief Processing function for Q31 LMS filter.
  1486. * @param[in] S points to an instance of the Q15 LMS filter structure.
  1487. * @param[in] pSrc points to the block of input data.
  1488. * @param[in] pRef points to the block of reference data.
  1489. * @param[out] pOut points to the block of output data.
  1490. * @param[out] pErr points to the block of error data.
  1491. * @param[in] blockSize number of samples to process.
  1492. */
  1493. void arm_lms_q31(
  1494. const arm_lms_instance_q31 * S,
  1495. const q31_t * pSrc,
  1496. q31_t * pRef,
  1497. q31_t * pOut,
  1498. q31_t * pErr,
  1499. uint32_t blockSize);
  1500. /**
  1501. * @brief Initialization function for Q31 LMS filter.
  1502. * @param[in] S points to an instance of the Q31 LMS filter structure.
  1503. * @param[in] numTaps number of filter coefficients.
  1504. * @param[in] pCoeffs points to coefficient buffer.
  1505. * @param[in] pState points to state buffer.
  1506. * @param[in] mu step size that controls filter coefficient updates.
  1507. * @param[in] blockSize number of samples to process.
  1508. * @param[in] postShift bit shift applied to coefficients.
  1509. */
  1510. void arm_lms_init_q31(
  1511. arm_lms_instance_q31 * S,
  1512. uint16_t numTaps,
  1513. q31_t * pCoeffs,
  1514. q31_t * pState,
  1515. q31_t mu,
  1516. uint32_t blockSize,
  1517. uint32_t postShift);
  1518. /**
  1519. * @brief Instance structure for the floating-point normalized LMS filter.
  1520. */
  1521. typedef struct
  1522. {
  1523. uint16_t numTaps; /**< number of coefficients in the filter. */
  1524. float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  1525. float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  1526. float32_t mu; /**< step size that control filter coefficient updates. */
  1527. float32_t energy; /**< saves previous frame energy. */
  1528. float32_t x0; /**< saves previous input sample. */
  1529. } arm_lms_norm_instance_f32;
  1530. /**
  1531. * @brief Processing function for floating-point normalized LMS filter.
  1532. * @param[in] S points to an instance of the floating-point normalized LMS filter structure.
  1533. * @param[in] pSrc points to the block of input data.
  1534. * @param[in] pRef points to the block of reference data.
  1535. * @param[out] pOut points to the block of output data.
  1536. * @param[out] pErr points to the block of error data.
  1537. * @param[in] blockSize number of samples to process.
  1538. */
  1539. void arm_lms_norm_f32(
  1540. arm_lms_norm_instance_f32 * S,
  1541. const float32_t * pSrc,
  1542. float32_t * pRef,
  1543. float32_t * pOut,
  1544. float32_t * pErr,
  1545. uint32_t blockSize);
  1546. /**
  1547. * @brief Initialization function for floating-point normalized LMS filter.
  1548. * @param[in] S points to an instance of the floating-point LMS filter structure.
  1549. * @param[in] numTaps number of filter coefficients.
  1550. * @param[in] pCoeffs points to coefficient buffer.
  1551. * @param[in] pState points to state buffer.
  1552. * @param[in] mu step size that controls filter coefficient updates.
  1553. * @param[in] blockSize number of samples to process.
  1554. */
  1555. void arm_lms_norm_init_f32(
  1556. arm_lms_norm_instance_f32 * S,
  1557. uint16_t numTaps,
  1558. float32_t * pCoeffs,
  1559. float32_t * pState,
  1560. float32_t mu,
  1561. uint32_t blockSize);
  1562. /**
  1563. * @brief Instance structure for the Q31 normalized LMS filter.
  1564. */
  1565. typedef struct
  1566. {
  1567. uint16_t numTaps; /**< number of coefficients in the filter. */
  1568. q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  1569. q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  1570. q31_t mu; /**< step size that controls filter coefficient updates. */
  1571. uint8_t postShift; /**< bit shift applied to coefficients. */
  1572. const q31_t *recipTable; /**< points to the reciprocal initial value table. */
  1573. q31_t energy; /**< saves previous frame energy. */
  1574. q31_t x0; /**< saves previous input sample. */
  1575. } arm_lms_norm_instance_q31;
  1576. /**
  1577. * @brief Processing function for Q31 normalized LMS filter.
  1578. * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
  1579. * @param[in] pSrc points to the block of input data.
  1580. * @param[in] pRef points to the block of reference data.
  1581. * @param[out] pOut points to the block of output data.
  1582. * @param[out] pErr points to the block of error data.
  1583. * @param[in] blockSize number of samples to process.
  1584. */
  1585. void arm_lms_norm_q31(
  1586. arm_lms_norm_instance_q31 * S,
  1587. const q31_t * pSrc,
  1588. q31_t * pRef,
  1589. q31_t * pOut,
  1590. q31_t * pErr,
  1591. uint32_t blockSize);
  1592. /**
  1593. * @brief Initialization function for Q31 normalized LMS filter.
  1594. * @param[in] S points to an instance of the Q31 normalized LMS filter structure.
  1595. * @param[in] numTaps number of filter coefficients.
  1596. * @param[in] pCoeffs points to coefficient buffer.
  1597. * @param[in] pState points to state buffer.
  1598. * @param[in] mu step size that controls filter coefficient updates.
  1599. * @param[in] blockSize number of samples to process.
  1600. * @param[in] postShift bit shift applied to coefficients.
  1601. */
  1602. void arm_lms_norm_init_q31(
  1603. arm_lms_norm_instance_q31 * S,
  1604. uint16_t numTaps,
  1605. q31_t * pCoeffs,
  1606. q31_t * pState,
  1607. q31_t mu,
  1608. uint32_t blockSize,
  1609. uint8_t postShift);
  1610. /**
  1611. * @brief Instance structure for the Q15 normalized LMS filter.
  1612. */
  1613. typedef struct
  1614. {
  1615. uint16_t numTaps; /**< Number of coefficients in the filter. */
  1616. q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  1617. q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  1618. q15_t mu; /**< step size that controls filter coefficient updates. */
  1619. uint8_t postShift; /**< bit shift applied to coefficients. */
  1620. const q15_t *recipTable; /**< Points to the reciprocal initial value table. */
  1621. q15_t energy; /**< saves previous frame energy. */
  1622. q15_t x0; /**< saves previous input sample. */
  1623. } arm_lms_norm_instance_q15;
  1624. /**
  1625. * @brief Processing function for Q15 normalized LMS filter.
  1626. * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
  1627. * @param[in] pSrc points to the block of input data.
  1628. * @param[in] pRef points to the block of reference data.
  1629. * @param[out] pOut points to the block of output data.
  1630. * @param[out] pErr points to the block of error data.
  1631. * @param[in] blockSize number of samples to process.
  1632. */
  1633. void arm_lms_norm_q15(
  1634. arm_lms_norm_instance_q15 * S,
  1635. const q15_t * pSrc,
  1636. q15_t * pRef,
  1637. q15_t * pOut,
  1638. q15_t * pErr,
  1639. uint32_t blockSize);
  1640. /**
  1641. * @brief Initialization function for Q15 normalized LMS filter.
  1642. * @param[in] S points to an instance of the Q15 normalized LMS filter structure.
  1643. * @param[in] numTaps number of filter coefficients.
  1644. * @param[in] pCoeffs points to coefficient buffer.
  1645. * @param[in] pState points to state buffer.
  1646. * @param[in] mu step size that controls filter coefficient updates.
  1647. * @param[in] blockSize number of samples to process.
  1648. * @param[in] postShift bit shift applied to coefficients.
  1649. */
  1650. void arm_lms_norm_init_q15(
  1651. arm_lms_norm_instance_q15 * S,
  1652. uint16_t numTaps,
  1653. q15_t * pCoeffs,
  1654. q15_t * pState,
  1655. q15_t mu,
  1656. uint32_t blockSize,
  1657. uint8_t postShift);
  1658. /**
  1659. * @brief Correlation of floating-point sequences.
  1660. * @param[in] pSrcA points to the first input sequence.
  1661. * @param[in] srcALen length of the first input sequence.
  1662. * @param[in] pSrcB points to the second input sequence.
  1663. * @param[in] srcBLen length of the second input sequence.
  1664. * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  1665. */
  1666. void arm_correlate_f32(
  1667. const float32_t * pSrcA,
  1668. uint32_t srcALen,
  1669. const float32_t * pSrcB,
  1670. uint32_t srcBLen,
  1671. float32_t * pDst);
  1672. /**
  1673. * @brief Correlation of floating-point sequences.
  1674. * @param[in] pSrcA points to the first input sequence.
  1675. * @param[in] srcALen length of the first input sequence.
  1676. * @param[in] pSrcB points to the second input sequence.
  1677. * @param[in] srcBLen length of the second input sequence.
  1678. * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  1679. */
  1680. void arm_correlate_f64(
  1681. const float64_t * pSrcA,
  1682. uint32_t srcALen,
  1683. const float64_t * pSrcB,
  1684. uint32_t srcBLen,
  1685. float64_t * pDst);
  1686. /**
  1687. @brief Correlation of Q15 sequences
  1688. @param[in] pSrcA points to the first input sequence
  1689. @param[in] srcALen length of the first input sequence
  1690. @param[in] pSrcB points to the second input sequence
  1691. @param[in] srcBLen length of the second input sequence
  1692. @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  1693. @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  1694. */
  1695. void arm_correlate_opt_q15(
  1696. const q15_t * pSrcA,
  1697. uint32_t srcALen,
  1698. const q15_t * pSrcB,
  1699. uint32_t srcBLen,
  1700. q15_t * pDst,
  1701. q15_t * pScratch);
  1702. /**
  1703. @brief Correlation of Q15 sequences.
  1704. @param[in] pSrcA points to the first input sequence
  1705. @param[in] srcALen length of the first input sequence
  1706. @param[in] pSrcB points to the second input sequence
  1707. @param[in] srcBLen length of the second input sequence
  1708. @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  1709. */
  1710. void arm_correlate_q15(
  1711. const q15_t * pSrcA,
  1712. uint32_t srcALen,
  1713. const q15_t * pSrcB,
  1714. uint32_t srcBLen,
  1715. q15_t * pDst);
  1716. /**
  1717. @brief Correlation of Q15 sequences (fast version).
  1718. @param[in] pSrcA points to the first input sequence
  1719. @param[in] srcALen length of the first input sequence
  1720. @param[in] pSrcB points to the second input sequence
  1721. @param[in] srcBLen length of the second input sequence
  1722. @param[out] pDst points to the location where the output result is written. Length 2 * max(srcALen, srcBLen) - 1.
  1723. */
  1724. void arm_correlate_fast_q15(
  1725. const q15_t * pSrcA,
  1726. uint32_t srcALen,
  1727. const q15_t * pSrcB,
  1728. uint32_t srcBLen,
  1729. q15_t * pDst);
  1730. /**
  1731. @brief Correlation of Q15 sequences (fast version).
  1732. @param[in] pSrcA points to the first input sequence.
  1733. @param[in] srcALen length of the first input sequence.
  1734. @param[in] pSrcB points to the second input sequence.
  1735. @param[in] srcBLen length of the second input sequence.
  1736. @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  1737. @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  1738. */
  1739. void arm_correlate_fast_opt_q15(
  1740. const q15_t * pSrcA,
  1741. uint32_t srcALen,
  1742. const q15_t * pSrcB,
  1743. uint32_t srcBLen,
  1744. q15_t * pDst,
  1745. q15_t * pScratch);
  1746. /**
  1747. * @brief Correlation of Q31 sequences.
  1748. * @param[in] pSrcA points to the first input sequence.
  1749. * @param[in] srcALen length of the first input sequence.
  1750. * @param[in] pSrcB points to the second input sequence.
  1751. * @param[in] srcBLen length of the second input sequence.
  1752. * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  1753. */
  1754. void arm_correlate_q31(
  1755. const q31_t * pSrcA,
  1756. uint32_t srcALen,
  1757. const q31_t * pSrcB,
  1758. uint32_t srcBLen,
  1759. q31_t * pDst);
  1760. /**
  1761. @brief Correlation of Q31 sequences (fast version).
  1762. @param[in] pSrcA points to the first input sequence
  1763. @param[in] srcALen length of the first input sequence
  1764. @param[in] pSrcB points to the second input sequence
  1765. @param[in] srcBLen length of the second input sequence
  1766. @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  1767. */
  1768. void arm_correlate_fast_q31(
  1769. const q31_t * pSrcA,
  1770. uint32_t srcALen,
  1771. const q31_t * pSrcB,
  1772. uint32_t srcBLen,
  1773. q31_t * pDst);
  1774. /**
  1775. * @brief Correlation of Q7 sequences.
  1776. * @param[in] pSrcA points to the first input sequence.
  1777. * @param[in] srcALen length of the first input sequence.
  1778. * @param[in] pSrcB points to the second input sequence.
  1779. * @param[in] srcBLen length of the second input sequence.
  1780. * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  1781. * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  1782. * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
  1783. */
  1784. void arm_correlate_opt_q7(
  1785. const q7_t * pSrcA,
  1786. uint32_t srcALen,
  1787. const q7_t * pSrcB,
  1788. uint32_t srcBLen,
  1789. q7_t * pDst,
  1790. q15_t * pScratch1,
  1791. q15_t * pScratch2);
  1792. /**
  1793. * @brief Correlation of Q7 sequences.
  1794. * @param[in] pSrcA points to the first input sequence.
  1795. * @param[in] srcALen length of the first input sequence.
  1796. * @param[in] pSrcB points to the second input sequence.
  1797. * @param[in] srcBLen length of the second input sequence.
  1798. * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  1799. */
  1800. void arm_correlate_q7(
  1801. const q7_t * pSrcA,
  1802. uint32_t srcALen,
  1803. const q7_t * pSrcB,
  1804. uint32_t srcBLen,
  1805. q7_t * pDst);
  1806. /**
  1807. * @brief Instance structure for the floating-point sparse FIR filter.
  1808. */
  1809. typedef struct
  1810. {
  1811. uint16_t numTaps; /**< number of coefficients in the filter. */
  1812. uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
  1813. float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
  1814. const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  1815. uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
  1816. int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
  1817. } arm_fir_sparse_instance_f32;
  1818. /**
  1819. * @brief Instance structure for the Q31 sparse FIR filter.
  1820. */
  1821. typedef struct
  1822. {
  1823. uint16_t numTaps; /**< number of coefficients in the filter. */
  1824. uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
  1825. q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
  1826. const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  1827. uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
  1828. int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
  1829. } arm_fir_sparse_instance_q31;
  1830. /**
  1831. * @brief Instance structure for the Q15 sparse FIR filter.
  1832. */
  1833. typedef struct
  1834. {
  1835. uint16_t numTaps; /**< number of coefficients in the filter. */
  1836. uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
  1837. q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
  1838. const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  1839. uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
  1840. int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
  1841. } arm_fir_sparse_instance_q15;
  1842. /**
  1843. * @brief Instance structure for the Q7 sparse FIR filter.
  1844. */
  1845. typedef struct
  1846. {
  1847. uint16_t numTaps; /**< number of coefficients in the filter. */
  1848. uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
  1849. q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
  1850. const q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  1851. uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
  1852. int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
  1853. } arm_fir_sparse_instance_q7;
  1854. /**
  1855. * @brief Processing function for the floating-point sparse FIR filter.
  1856. * @param[in] S points to an instance of the floating-point sparse FIR structure.
  1857. * @param[in] pSrc points to the block of input data.
  1858. * @param[out] pDst points to the block of output data
  1859. * @param[in] pScratchIn points to a temporary buffer of size blockSize.
  1860. * @param[in] blockSize number of input samples to process per call.
  1861. */
  1862. void arm_fir_sparse_f32(
  1863. arm_fir_sparse_instance_f32 * S,
  1864. const float32_t * pSrc,
  1865. float32_t * pDst,
  1866. float32_t * pScratchIn,
  1867. uint32_t blockSize);
  1868. /**
  1869. * @brief Initialization function for the floating-point sparse FIR filter.
  1870. * @param[in,out] S points to an instance of the floating-point sparse FIR structure.
  1871. * @param[in] numTaps number of nonzero coefficients in the filter.
  1872. * @param[in] pCoeffs points to the array of filter coefficients.
  1873. * @param[in] pState points to the state buffer.
  1874. * @param[in] pTapDelay points to the array of offset times.
  1875. * @param[in] maxDelay maximum offset time supported.
  1876. * @param[in] blockSize number of samples that will be processed per block.
  1877. */
  1878. void arm_fir_sparse_init_f32(
  1879. arm_fir_sparse_instance_f32 * S,
  1880. uint16_t numTaps,
  1881. const float32_t * pCoeffs,
  1882. float32_t * pState,
  1883. int32_t * pTapDelay,
  1884. uint16_t maxDelay,
  1885. uint32_t blockSize);
  1886. /**
  1887. * @brief Processing function for the Q31 sparse FIR filter.
  1888. * @param[in] S points to an instance of the Q31 sparse FIR structure.
  1889. * @param[in] pSrc points to the block of input data.
  1890. * @param[out] pDst points to the block of output data
  1891. * @param[in] pScratchIn points to a temporary buffer of size blockSize.
  1892. * @param[in] blockSize number of input samples to process per call.
  1893. */
  1894. void arm_fir_sparse_q31(
  1895. arm_fir_sparse_instance_q31 * S,
  1896. const q31_t * pSrc,
  1897. q31_t * pDst,
  1898. q31_t * pScratchIn,
  1899. uint32_t blockSize);
  1900. /**
  1901. * @brief Initialization function for the Q31 sparse FIR filter.
  1902. * @param[in,out] S points to an instance of the Q31 sparse FIR structure.
  1903. * @param[in] numTaps number of nonzero coefficients in the filter.
  1904. * @param[in] pCoeffs points to the array of filter coefficients.
  1905. * @param[in] pState points to the state buffer.
  1906. * @param[in] pTapDelay points to the array of offset times.
  1907. * @param[in] maxDelay maximum offset time supported.
  1908. * @param[in] blockSize number of samples that will be processed per block.
  1909. */
  1910. void arm_fir_sparse_init_q31(
  1911. arm_fir_sparse_instance_q31 * S,
  1912. uint16_t numTaps,
  1913. const q31_t * pCoeffs,
  1914. q31_t * pState,
  1915. int32_t * pTapDelay,
  1916. uint16_t maxDelay,
  1917. uint32_t blockSize);
  1918. /**
  1919. * @brief Processing function for the Q15 sparse FIR filter.
  1920. * @param[in] S points to an instance of the Q15 sparse FIR structure.
  1921. * @param[in] pSrc points to the block of input data.
  1922. * @param[out] pDst points to the block of output data
  1923. * @param[in] pScratchIn points to a temporary buffer of size blockSize.
  1924. * @param[in] pScratchOut points to a temporary buffer of size blockSize.
  1925. * @param[in] blockSize number of input samples to process per call.
  1926. */
  1927. void arm_fir_sparse_q15(
  1928. arm_fir_sparse_instance_q15 * S,
  1929. const q15_t * pSrc,
  1930. q15_t * pDst,
  1931. q15_t * pScratchIn,
  1932. q31_t * pScratchOut,
  1933. uint32_t blockSize);
  1934. /**
  1935. * @brief Initialization function for the Q15 sparse FIR filter.
  1936. * @param[in,out] S points to an instance of the Q15 sparse FIR structure.
  1937. * @param[in] numTaps number of nonzero coefficients in the filter.
  1938. * @param[in] pCoeffs points to the array of filter coefficients.
  1939. * @param[in] pState points to the state buffer.
  1940. * @param[in] pTapDelay points to the array of offset times.
  1941. * @param[in] maxDelay maximum offset time supported.
  1942. * @param[in] blockSize number of samples that will be processed per block.
  1943. */
  1944. void arm_fir_sparse_init_q15(
  1945. arm_fir_sparse_instance_q15 * S,
  1946. uint16_t numTaps,
  1947. const q15_t * pCoeffs,
  1948. q15_t * pState,
  1949. int32_t * pTapDelay,
  1950. uint16_t maxDelay,
  1951. uint32_t blockSize);
  1952. /**
  1953. * @brief Processing function for the Q7 sparse FIR filter.
  1954. * @param[in] S points to an instance of the Q7 sparse FIR structure.
  1955. * @param[in] pSrc points to the block of input data.
  1956. * @param[out] pDst points to the block of output data
  1957. * @param[in] pScratchIn points to a temporary buffer of size blockSize.
  1958. * @param[in] pScratchOut points to a temporary buffer of size blockSize.
  1959. * @param[in] blockSize number of input samples to process per call.
  1960. */
  1961. void arm_fir_sparse_q7(
  1962. arm_fir_sparse_instance_q7 * S,
  1963. const q7_t * pSrc,
  1964. q7_t * pDst,
  1965. q7_t * pScratchIn,
  1966. q31_t * pScratchOut,
  1967. uint32_t blockSize);
  1968. /**
  1969. * @brief Initialization function for the Q7 sparse FIR filter.
  1970. * @param[in,out] S points to an instance of the Q7 sparse FIR structure.
  1971. * @param[in] numTaps number of nonzero coefficients in the filter.
  1972. * @param[in] pCoeffs points to the array of filter coefficients.
  1973. * @param[in] pState points to the state buffer.
  1974. * @param[in] pTapDelay points to the array of offset times.
  1975. * @param[in] maxDelay maximum offset time supported.
  1976. * @param[in] blockSize number of samples that will be processed per block.
  1977. */
  1978. void arm_fir_sparse_init_q7(
  1979. arm_fir_sparse_instance_q7 * S,
  1980. uint16_t numTaps,
  1981. const q7_t * pCoeffs,
  1982. q7_t * pState,
  1983. int32_t * pTapDelay,
  1984. uint16_t maxDelay,
  1985. uint32_t blockSize);
  1986. /**
  1987. * @brief floating-point Circular write function.
  1988. */
  1989. __STATIC_FORCEINLINE void arm_circularWrite_f32(
  1990. int32_t * circBuffer,
  1991. int32_t L,
  1992. uint16_t * writeOffset,
  1993. int32_t bufferInc,
  1994. const int32_t * src,
  1995. int32_t srcInc,
  1996. uint32_t blockSize)
  1997. {
  1998. uint32_t i = 0U;
  1999. int32_t wOffset;
  2000. /* Copy the value of Index pointer that points
  2001. * to the current location where the input samples to be copied */
  2002. wOffset = *writeOffset;
  2003. /* Loop over the blockSize */
  2004. i = blockSize;
  2005. while (i > 0U)
  2006. {
  2007. /* copy the input sample to the circular buffer */
  2008. circBuffer[wOffset] = *src;
  2009. /* Update the input pointer */
  2010. src += srcInc;
  2011. /* Circularly update wOffset. Watch out for positive and negative value */
  2012. wOffset += bufferInc;
  2013. if (wOffset >= L)
  2014. wOffset -= L;
  2015. /* Decrement the loop counter */
  2016. i--;
  2017. }
  2018. /* Update the index pointer */
  2019. *writeOffset = (uint16_t)wOffset;
  2020. }
  2021. /**
  2022. * @brief floating-point Circular Read function.
  2023. */
  2024. __STATIC_FORCEINLINE void arm_circularRead_f32(
  2025. int32_t * circBuffer,
  2026. int32_t L,
  2027. int32_t * readOffset,
  2028. int32_t bufferInc,
  2029. int32_t * dst,
  2030. int32_t * dst_base,
  2031. int32_t dst_length,
  2032. int32_t dstInc,
  2033. uint32_t blockSize)
  2034. {
  2035. uint32_t i = 0U;
  2036. int32_t rOffset;
  2037. int32_t* dst_end;
  2038. /* Copy the value of Index pointer that points
  2039. * to the current location from where the input samples to be read */
  2040. rOffset = *readOffset;
  2041. dst_end = dst_base + dst_length;
  2042. /* Loop over the blockSize */
  2043. i = blockSize;
  2044. while (i > 0U)
  2045. {
  2046. /* copy the sample from the circular buffer to the destination buffer */
  2047. *dst = circBuffer[rOffset];
  2048. /* Update the input pointer */
  2049. dst += dstInc;
  2050. if (dst == dst_end)
  2051. {
  2052. dst = dst_base;
  2053. }
  2054. /* Circularly update rOffset. Watch out for positive and negative value */
  2055. rOffset += bufferInc;
  2056. if (rOffset >= L)
  2057. {
  2058. rOffset -= L;
  2059. }
  2060. /* Decrement the loop counter */
  2061. i--;
  2062. }
  2063. /* Update the index pointer */
  2064. *readOffset = rOffset;
  2065. }
  2066. /**
  2067. * @brief Q15 Circular write function.
  2068. */
  2069. __STATIC_FORCEINLINE void arm_circularWrite_q15(
  2070. q15_t * circBuffer,
  2071. int32_t L,
  2072. uint16_t * writeOffset,
  2073. int32_t bufferInc,
  2074. const q15_t * src,
  2075. int32_t srcInc,
  2076. uint32_t blockSize)
  2077. {
  2078. uint32_t i = 0U;
  2079. int32_t wOffset;
  2080. /* Copy the value of Index pointer that points
  2081. * to the current location where the input samples to be copied */
  2082. wOffset = *writeOffset;
  2083. /* Loop over the blockSize */
  2084. i = blockSize;
  2085. while (i > 0U)
  2086. {
  2087. /* copy the input sample to the circular buffer */
  2088. circBuffer[wOffset] = *src;
  2089. /* Update the input pointer */
  2090. src += srcInc;
  2091. /* Circularly update wOffset. Watch out for positive and negative value */
  2092. wOffset += bufferInc;
  2093. if (wOffset >= L)
  2094. wOffset -= L;
  2095. /* Decrement the loop counter */
  2096. i--;
  2097. }
  2098. /* Update the index pointer */
  2099. *writeOffset = (uint16_t)wOffset;
  2100. }
  2101. /**
  2102. * @brief Q15 Circular Read function.
  2103. */
  2104. __STATIC_FORCEINLINE void arm_circularRead_q15(
  2105. q15_t * circBuffer,
  2106. int32_t L,
  2107. int32_t * readOffset,
  2108. int32_t bufferInc,
  2109. q15_t * dst,
  2110. q15_t * dst_base,
  2111. int32_t dst_length,
  2112. int32_t dstInc,
  2113. uint32_t blockSize)
  2114. {
  2115. uint32_t i = 0;
  2116. int32_t rOffset;
  2117. q15_t* dst_end;
  2118. /* Copy the value of Index pointer that points
  2119. * to the current location from where the input samples to be read */
  2120. rOffset = *readOffset;
  2121. dst_end = dst_base + dst_length;
  2122. /* Loop over the blockSize */
  2123. i = blockSize;
  2124. while (i > 0U)
  2125. {
  2126. /* copy the sample from the circular buffer to the destination buffer */
  2127. *dst = circBuffer[rOffset];
  2128. /* Update the input pointer */
  2129. dst += dstInc;
  2130. if (dst == dst_end)
  2131. {
  2132. dst = dst_base;
  2133. }
  2134. /* Circularly update wOffset. Watch out for positive and negative value */
  2135. rOffset += bufferInc;
  2136. if (rOffset >= L)
  2137. {
  2138. rOffset -= L;
  2139. }
  2140. /* Decrement the loop counter */
  2141. i--;
  2142. }
  2143. /* Update the index pointer */
  2144. *readOffset = rOffset;
  2145. }
  2146. /**
  2147. * @brief Q7 Circular write function.
  2148. */
  2149. __STATIC_FORCEINLINE void arm_circularWrite_q7(
  2150. q7_t * circBuffer,
  2151. int32_t L,
  2152. uint16_t * writeOffset,
  2153. int32_t bufferInc,
  2154. const q7_t * src,
  2155. int32_t srcInc,
  2156. uint32_t blockSize)
  2157. {
  2158. uint32_t i = 0U;
  2159. int32_t wOffset;
  2160. /* Copy the value of Index pointer that points
  2161. * to the current location where the input samples to be copied */
  2162. wOffset = *writeOffset;
  2163. /* Loop over the blockSize */
  2164. i = blockSize;
  2165. while (i > 0U)
  2166. {
  2167. /* copy the input sample to the circular buffer */
  2168. circBuffer[wOffset] = *src;
  2169. /* Update the input pointer */
  2170. src += srcInc;
  2171. /* Circularly update wOffset. Watch out for positive and negative value */
  2172. wOffset += bufferInc;
  2173. if (wOffset >= L)
  2174. wOffset -= L;
  2175. /* Decrement the loop counter */
  2176. i--;
  2177. }
  2178. /* Update the index pointer */
  2179. *writeOffset = (uint16_t)wOffset;
  2180. }
  2181. /**
  2182. * @brief Q7 Circular Read function.
  2183. */
  2184. __STATIC_FORCEINLINE void arm_circularRead_q7(
  2185. q7_t * circBuffer,
  2186. int32_t L,
  2187. int32_t * readOffset,
  2188. int32_t bufferInc,
  2189. q7_t * dst,
  2190. q7_t * dst_base,
  2191. int32_t dst_length,
  2192. int32_t dstInc,
  2193. uint32_t blockSize)
  2194. {
  2195. uint32_t i = 0;
  2196. int32_t rOffset;
  2197. q7_t* dst_end;
  2198. /* Copy the value of Index pointer that points
  2199. * to the current location from where the input samples to be read */
  2200. rOffset = *readOffset;
  2201. dst_end = dst_base + dst_length;
  2202. /* Loop over the blockSize */
  2203. i = blockSize;
  2204. while (i > 0U)
  2205. {
  2206. /* copy the sample from the circular buffer to the destination buffer */
  2207. *dst = circBuffer[rOffset];
  2208. /* Update the input pointer */
  2209. dst += dstInc;
  2210. if (dst == dst_end)
  2211. {
  2212. dst = dst_base;
  2213. }
  2214. /* Circularly update rOffset. Watch out for positive and negative value */
  2215. rOffset += bufferInc;
  2216. if (rOffset >= L)
  2217. {
  2218. rOffset -= L;
  2219. }
  2220. /* Decrement the loop counter */
  2221. i--;
  2222. }
  2223. /* Update the index pointer */
  2224. *readOffset = rOffset;
  2225. }
  2226. /**
  2227. @brief Levinson Durbin
  2228. @param[in] phi autocovariance vector starting with lag 0 (length is nbCoefs + 1)
  2229. @param[out] a autoregressive coefficients
  2230. @param[out] err prediction error (variance)
  2231. @param[in] nbCoefs number of autoregressive coefficients
  2232. */
  2233. void arm_levinson_durbin_f32(const float32_t *phi,
  2234. float32_t *a,
  2235. float32_t *err,
  2236. int nbCoefs);
  2237. /**
  2238. @brief Levinson Durbin
  2239. @param[in] phi autocovariance vector starting with lag 0 (length is nbCoefs + 1)
  2240. @param[out] a autoregressive coefficients
  2241. @param[out] err prediction error (variance)
  2242. @param[in] nbCoefs number of autoregressive coefficients
  2243. */
  2244. void arm_levinson_durbin_q31(const q31_t *phi,
  2245. q31_t *a,
  2246. q31_t *err,
  2247. int nbCoefs);
  2248. #ifdef __cplusplus
  2249. }
  2250. #endif
  2251. #endif /* ifndef _FILTERING_FUNCTIONS_H_ */