Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

arm_math.h 243KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574
  1. /* ----------------------------------------------------------------------
  2. * Copyright (C) 2010-2011 ARM Limited. All rights reserved.
  3. *
  4. * $Date: 15. February 2012
  5. * $Revision: V1.1.0
  6. *
  7. * Project: CMSIS DSP Library
  8. * Title: arm_math.h
  9. *
  10. * Description: Public header file for CMSIS DSP Library
  11. *
  12. * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
  13. *
  14. * Version 1.1.0 2012/02/15
  15. * Updated with more optimizations, bug fixes and minor API changes.
  16. *
  17. * Version 1.0.10 2011/7/15
  18. * Big Endian support added and Merged M0 and M3/M4 Source code.
  19. *
  20. * Version 1.0.3 2010/11/29
  21. * Re-organized the CMSIS folders and updated documentation.
  22. *
  23. * Version 1.0.2 2010/11/11
  24. * Documentation updated.
  25. *
  26. * Version 1.0.1 2010/10/05
  27. * Production release and review comments incorporated.
  28. *
  29. * Version 1.0.0 2010/09/20
  30. * Production release and review comments incorporated.
  31. * -------------------------------------------------------------------- */
  32. /**
  33. \mainpage CMSIS DSP Software Library
  34. *
  35. * <b>Introduction</b>
  36. *
  37. * This user manual describes the CMSIS DSP software library,
  38. * a suite of common signal processing functions for use on Cortex-M processor based devices.
  39. *
  40. * The library is divided into a number of functions each covering a specific category:
  41. * - Basic math functions
  42. * - Fast math functions
  43. * - Complex math functions
  44. * - Filters
  45. * - Matrix functions
  46. * - Transforms
  47. * - Motor control functions
  48. * - Statistical functions
  49. * - Support functions
  50. * - Interpolation functions
  51. *
  52. * The library has separate functions for operating on 8-bit integers, 16-bit integers,
  53. * 32-bit integer and 32-bit floating-point values.
  54. *
  55. * <b>Pre-processor Macros</b>
  56. *
  57. * Each library project have differant pre-processor macros.
  58. *
  59. * - UNALIGNED_SUPPORT_DISABLE:
  60. *
  61. * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
  62. *
  63. * - ARM_MATH_BIG_ENDIAN:
  64. *
  65. * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
  66. *
  67. * - ARM_MATH_MATRIX_CHECK:
  68. *
  69. * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
  70. *
  71. * - ARM_MATH_ROUNDING:
  72. *
  73. * Define macro ARM_MATH_ROUNDING for rounding on support functions
  74. *
  75. * - ARM_MATH_CMx:
  76. *
  77. * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
  78. * and ARM_MATH_CM0 for building library on cortex-M0 target.
  79. *
  80. * - __FPU_PRESENT:
  81. *
  82. * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries
  83. *
  84. * <b>Toolchain Support</b>
  85. *
  86. * The library has been developed and tested with MDK-ARM version 4.23.
  87. * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
  88. *
  89. * <b>Using the Library</b>
  90. *
  91. * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
  92. * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
  93. * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
  94. * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
  95. * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
  96. * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
  97. * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
  98. * - arm_cortexM0l_math.lib (Little endian on Cortex-M0)
  99. * - arm_cortexM0b_math.lib (Big endian on Cortex-M3)
  100. *
  101. * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
  102. * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
  103. * public header file <code> arm_math.h</code> for Cortex-M4/M3/M0 with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
  104. * Define the appropriate pre processor MACRO ARM_MATH_CM4 or ARM_MATH_CM3 or
  105. * ARM_MATH_CM0 depending on the target processor in the application.
  106. *
  107. * <b>Examples</b>
  108. *
  109. * The library ships with a number of examples which demonstrate how to use the library functions.
  110. *
  111. * <b>Building the Library</b>
  112. *
  113. * The library installer contains project files to re build libraries on MDK Tool chain in the <code>CMSIS\\DSP_Lib\\Source\\ARM</code> folder.
  114. * - arm_cortexM0b_math.uvproj
  115. * - arm_cortexM0l_math.uvproj
  116. * - arm_cortexM3b_math.uvproj
  117. * - arm_cortexM3l_math.uvproj
  118. * - arm_cortexM4b_math.uvproj
  119. * - arm_cortexM4l_math.uvproj
  120. * - arm_cortexM4bf_math.uvproj
  121. * - arm_cortexM4lf_math.uvproj
  122. *
  123. *
  124. * The project can be built by opening the appropriate project in MDK-ARM 4.23 chain and defining the optional pre processor MACROs detailed above.
  125. *
  126. * <b>Copyright Notice</b>
  127. *
  128. * Copyright (C) 2010 ARM Limited. All rights reserved.
  129. */
  130. /**
  131. * @defgroup groupMath Basic Math Functions
  132. */
  133. /**
  134. * @defgroup groupFastMath Fast Math Functions
  135. * This set of functions provides a fast approximation to sine, cosine, and square root.
  136. * As compared to most of the other functions in the CMSIS math library, the fast math functions
  137. * operate on individual values and not arrays.
  138. * There are separate functions for Q15, Q31, and floating-point data.
  139. *
  140. */
  141. /**
  142. * @defgroup groupCmplxMath Complex Math Functions
  143. * This set of functions operates on complex data vectors.
  144. * The data in the complex arrays is stored in an interleaved fashion
  145. * (real, imag, real, imag, ...).
  146. * In the API functions, the number of samples in a complex array refers
  147. * to the number of complex values; the array contains twice this number of
  148. * real values.
  149. */
  150. /**
  151. * @defgroup groupFilters Filtering Functions
  152. */
  153. /**
  154. * @defgroup groupMatrix Matrix Functions
  155. *
  156. * This set of functions provides basic matrix math operations.
  157. * The functions operate on matrix data structures. For example,
  158. * the type
  159. * definition for the floating-point matrix structure is shown
  160. * below:
  161. * <pre>
  162. * typedef struct
  163. * {
  164. * uint16_t numRows; // number of rows of the matrix.
  165. * uint16_t numCols; // number of columns of the matrix.
  166. * float32_t *pData; // points to the data of the matrix.
  167. * } arm_matrix_instance_f32;
  168. * </pre>
  169. * There are similar definitions for Q15 and Q31 data types.
  170. *
  171. * The structure specifies the size of the matrix and then points to
  172. * an array of data. The array is of size <code>numRows X numCols</code>
  173. * and the values are arranged in row order. That is, the
  174. * matrix element (i, j) is stored at:
  175. * <pre>
  176. * pData[i*numCols + j]
  177. * </pre>
  178. *
  179. * \par Init Functions
  180. * There is an associated initialization function for each type of matrix
  181. * data structure.
  182. * The initialization function sets the values of the internal structure fields.
  183. * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
  184. * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
  185. *
  186. * \par
  187. * Use of the initialization function is optional. However, if initialization function is used
  188. * then the instance structure cannot be placed into a const data section.
  189. * To place the instance structure in a const data
  190. * section, manually initialize the data structure. For example:
  191. * <pre>
  192. * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
  193. * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
  194. * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
  195. * </pre>
  196. * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
  197. * specifies the number of columns, and <code>pData</code> points to the
  198. * data array.
  199. *
  200. * \par Size Checking
  201. * By default all of the matrix functions perform size checking on the input and
  202. * output matrices. For example, the matrix addition function verifies that the
  203. * two input matrices and the output matrix all have the same number of rows and
  204. * columns. If the size check fails the functions return:
  205. * <pre>
  206. * ARM_MATH_SIZE_MISMATCH
  207. * </pre>
  208. * Otherwise the functions return
  209. * <pre>
  210. * ARM_MATH_SUCCESS
  211. * </pre>
  212. * There is some overhead associated with this matrix size checking.
  213. * The matrix size checking is enabled via the \#define
  214. * <pre>
  215. * ARM_MATH_MATRIX_CHECK
  216. * </pre>
  217. * within the library project settings. By default this macro is defined
  218. * and size checking is enabled. By changing the project settings and
  219. * undefining this macro size checking is eliminated and the functions
  220. * run a bit faster. With size checking disabled the functions always
  221. * return <code>ARM_MATH_SUCCESS</code>.
  222. */
  223. /**
  224. * @defgroup groupTransforms Transform Functions
  225. */
  226. /**
  227. * @defgroup groupController Controller Functions
  228. */
  229. /**
  230. * @defgroup groupStats Statistics Functions
  231. */
  232. /**
  233. * @defgroup groupSupport Support Functions
  234. */
  235. /**
  236. * @defgroup groupInterpolation Interpolation Functions
  237. * These functions perform 1- and 2-dimensional interpolation of data.
  238. * Linear interpolation is used for 1-dimensional data and
  239. * bilinear interpolation is used for 2-dimensional data.
  240. */
  241. /**
  242. * @defgroup groupExamples Examples
  243. */
  244. #ifndef _ARM_MATH_H
  245. #define _ARM_MATH_H
  246. // Teensy 3.0
  247. #include <stdint.h>
  248. #define __ASM __asm
  249. #define __INLINE inline
  250. #define __STATIC_INLINE static inline
  251. #define __CORTEX_M 4
  252. #define __FPU_USED 0
  253. #define ARM_MATH_CM4
  254. #include "core_cmInstr.h"
  255. #include "core_cm4_simd.h"
  256. #if 0
  257. // generic for any board...
  258. #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
  259. #if defined (ARM_MATH_CM4)
  260. #include "core_cm4.h"
  261. #elif defined (ARM_MATH_CM3)
  262. #include "core_cm3.h"
  263. #elif defined (ARM_MATH_CM0)
  264. #include "core_cm0.h"
  265. #else
  266. #include "ARMCM4.h"
  267. #warning "Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4....."
  268. #endif
  269. #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
  270. #endif
  271. #include "string.h"
  272. #include "math.h"
  273. #ifdef __cplusplus
  274. extern "C"
  275. {
  276. #endif
  277. /**
  278. * @brief Macros required for reciprocal calculation in Normalized LMS
  279. */
  280. #define DELTA_Q31 (0x100)
  281. #define DELTA_Q15 0x5
  282. #define INDEX_MASK 0x0000003F
  283. #ifndef PI
  284. #define PI 3.14159265358979f
  285. #endif
  286. /**
  287. * @brief Macros required for SINE and COSINE Fast math approximations
  288. */
  289. #define TABLE_SIZE 256
  290. #define TABLE_SPACING_Q31 0x800000
  291. #define TABLE_SPACING_Q15 0x80
  292. /**
  293. * @brief Macros required for SINE and COSINE Controller functions
  294. */
  295. /* 1.31(q31) Fixed value of 2/360 */
  296. /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
  297. #define INPUT_SPACING 0xB60B61
  298. /**
  299. * @brief Macro for Unaligned Support
  300. */
  301. #ifndef UNALIGNED_SUPPORT_DISABLE
  302. #define ALIGN4
  303. #else
  304. #if defined (__GNUC__)
  305. #define ALIGN4 __attribute__((aligned(4)))
  306. #else
  307. #define ALIGN4 __align(4)
  308. #endif
  309. #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
  310. /**
  311. * @brief Error status returned by some functions in the library.
  312. */
  313. typedef enum
  314. {
  315. ARM_MATH_SUCCESS = 0, /**< No error */
  316. ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
  317. ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
  318. ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
  319. ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
  320. ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
  321. ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
  322. } arm_status;
  323. /**
  324. * @brief 8-bit fractional data type in 1.7 format.
  325. */
  326. typedef int8_t q7_t;
  327. /**
  328. * @brief 16-bit fractional data type in 1.15 format.
  329. */
  330. typedef int16_t q15_t;
  331. /**
  332. * @brief 32-bit fractional data type in 1.31 format.
  333. */
  334. typedef int32_t q31_t;
  335. /**
  336. * @brief 64-bit fractional data type in 1.63 format.
  337. */
  338. typedef int64_t q63_t;
  339. /**
  340. * @brief 32-bit floating-point type definition.
  341. */
  342. typedef float float32_t;
  343. /**
  344. * @brief 64-bit floating-point type definition.
  345. */
  346. typedef double float64_t;
  347. /**
  348. * @brief definition to read/write two 16 bit values.
  349. */
  350. #if defined (__GNUC__)
  351. #define __SIMD32(addr) (*( int32_t **) & (addr))
  352. #define _SIMD32_OFFSET(addr) (*( int32_t * ) (addr))
  353. #else
  354. #define __SIMD32(addr) (*(__packed int32_t **) & (addr))
  355. #define _SIMD32_OFFSET(addr) (*(__packed int32_t * ) (addr))
  356. #endif
  357. #define __SIMD64(addr) (*(int64_t **) & (addr))
  358. #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0)
  359. /**
  360. * @brief definition to pack two 16 bit values.
  361. */
  362. #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
  363. (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
  364. #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
  365. (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
  366. #endif
  367. /**
  368. * @brief definition to pack four 8 bit values.
  369. */
  370. #ifndef ARM_MATH_BIG_ENDIAN
  371. #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
  372. (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
  373. (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
  374. (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
  375. #else
  376. #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
  377. (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
  378. (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
  379. (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
  380. #endif
  381. /**
  382. * @brief Clips Q63 to Q31 values.
  383. */
  384. __STATIC_INLINE q31_t clip_q63_to_q31(
  385. q63_t x)
  386. {
  387. return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
  388. ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
  389. }
  390. /**
  391. * @brief Clips Q63 to Q15 values.
  392. */
  393. __STATIC_INLINE q15_t clip_q63_to_q15(
  394. q63_t x)
  395. {
  396. return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
  397. ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
  398. }
  399. /**
  400. * @brief Clips Q31 to Q7 values.
  401. */
  402. __STATIC_INLINE q7_t clip_q31_to_q7(
  403. q31_t x)
  404. {
  405. return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
  406. ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
  407. }
  408. /**
  409. * @brief Clips Q31 to Q15 values.
  410. */
  411. __STATIC_INLINE q15_t clip_q31_to_q15(
  412. q31_t x)
  413. {
  414. return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
  415. ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
  416. }
  417. /**
  418. * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
  419. */
  420. __STATIC_INLINE q63_t mult32x64(
  421. q63_t x,
  422. q31_t y)
  423. {
  424. return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
  425. (((q63_t) (x >> 32) * y)));
  426. }
  427. #if defined (ARM_MATH_CM0) && defined ( __CC_ARM )
  428. #define __CLZ __clz
  429. #endif
  430. #if defined (ARM_MATH_CM0) && defined ( __TASKING__ )
  431. /* No need to redefine __CLZ */
  432. #endif
  433. #if defined (ARM_MATH_CM0) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) )
  434. __STATIC_INLINE uint32_t __CLZ(q31_t data);
  435. __STATIC_INLINE uint32_t __CLZ(q31_t data)
  436. {
  437. uint32_t count = 0;
  438. uint32_t mask = 0x80000000;
  439. while((data & mask) == 0)
  440. {
  441. count += 1u;
  442. mask = mask >> 1u;
  443. }
  444. return (count);
  445. }
  446. #endif
  447. /**
  448. * @brief Function to Calculates 1/in(reciprocal) value of Q31 Data type.
  449. */
  450. __STATIC_INLINE uint32_t arm_recip_q31(
  451. q31_t in,
  452. q31_t * dst,
  453. q31_t * pRecipTable)
  454. {
  455. uint32_t out, tempVal;
  456. uint32_t index, i;
  457. uint32_t signBits;
  458. if(in > 0)
  459. {
  460. signBits = __CLZ(in) - 1;
  461. }
  462. else
  463. {
  464. signBits = __CLZ(-in) - 1;
  465. }
  466. /* Convert input sample to 1.31 format */
  467. in = in << signBits;
  468. /* calculation of index for initial approximated Val */
  469. index = (uint32_t) (in >> 24u);
  470. index = (index & INDEX_MASK);
  471. /* 1.31 with exp 1 */
  472. out = pRecipTable[index];
  473. /* calculation of reciprocal value */
  474. /* running approximation for two iterations */
  475. for (i = 0u; i < 2u; i++)
  476. {
  477. tempVal = (q31_t) (((q63_t) in * out) >> 31u);
  478. tempVal = 0x7FFFFFFF - tempVal;
  479. /* 1.31 with exp 1 */
  480. //out = (q31_t) (((q63_t) out * tempVal) >> 30u);
  481. out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);
  482. }
  483. /* write output */
  484. *dst = out;
  485. /* return num of signbits of out = 1/in value */
  486. return (signBits + 1u);
  487. }
  488. /**
  489. * @brief Function to Calculates 1/in(reciprocal) value of Q15 Data type.
  490. */
  491. __STATIC_INLINE uint32_t arm_recip_q15(
  492. q15_t in,
  493. q15_t * dst,
  494. q15_t * pRecipTable)
  495. {
  496. uint32_t out = 0, tempVal = 0;
  497. uint32_t index = 0, i = 0;
  498. uint32_t signBits = 0;
  499. if(in > 0)
  500. {
  501. signBits = __CLZ(in) - 17;
  502. }
  503. else
  504. {
  505. signBits = __CLZ(-in) - 17;
  506. }
  507. /* Convert input sample to 1.15 format */
  508. in = in << signBits;
  509. /* calculation of index for initial approximated Val */
  510. index = in >> 8;
  511. index = (index & INDEX_MASK);
  512. /* 1.15 with exp 1 */
  513. out = pRecipTable[index];
  514. /* calculation of reciprocal value */
  515. /* running approximation for two iterations */
  516. for (i = 0; i < 2; i++)
  517. {
  518. tempVal = (q15_t) (((q31_t) in * out) >> 15);
  519. tempVal = 0x7FFF - tempVal;
  520. /* 1.15 with exp 1 */
  521. out = (q15_t) (((q31_t) out * tempVal) >> 14);
  522. }
  523. /* write output */
  524. *dst = out;
  525. /* return num of signbits of out = 1/in value */
  526. return (signBits + 1);
  527. }
  528. /*
  529. * @brief C custom defined intrinisic function for only M0 processors
  530. */
  531. #if defined(ARM_MATH_CM0)
  532. __STATIC_INLINE q31_t __SSAT(
  533. q31_t x,
  534. uint32_t y)
  535. {
  536. int32_t posMax, negMin;
  537. uint32_t i;
  538. posMax = 1;
  539. for (i = 0; i < (y - 1); i++)
  540. {
  541. posMax = posMax * 2;
  542. }
  543. if(x > 0)
  544. {
  545. posMax = (posMax - 1);
  546. if(x > posMax)
  547. {
  548. x = posMax;
  549. }
  550. }
  551. else
  552. {
  553. negMin = -posMax;
  554. if(x < negMin)
  555. {
  556. x = negMin;
  557. }
  558. }
  559. return (x);
  560. }
  561. #endif /* end of ARM_MATH_CM0 */
  562. /*
  563. * @brief C custom defined intrinsic function for M3 and M0 processors
  564. */
  565. #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0)
  566. /*
  567. * @brief C custom defined QADD8 for M3 and M0 processors
  568. */
  569. __STATIC_INLINE q31_t __QADD8(
  570. q31_t x,
  571. q31_t y)
  572. {
  573. q31_t sum;
  574. q7_t r, s, t, u;
  575. r = (q7_t) x;
  576. s = (q7_t) y;
  577. r = __SSAT((q31_t) (r + s), 8);
  578. s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
  579. t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
  580. u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
  581. sum =
  582. (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
  583. (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
  584. return sum;
  585. }
  586. /*
  587. * @brief C custom defined QSUB8 for M3 and M0 processors
  588. */
  589. __STATIC_INLINE q31_t __QSUB8(
  590. q31_t x,
  591. q31_t y)
  592. {
  593. q31_t sum;
  594. q31_t r, s, t, u;
  595. r = (q7_t) x;
  596. s = (q7_t) y;
  597. r = __SSAT((r - s), 8);
  598. s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
  599. t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
  600. u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
  601. sum =
  602. (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r &
  603. 0x000000FF);
  604. return sum;
  605. }
  606. /*
  607. * @brief C custom defined QADD16 for M3 and M0 processors
  608. */
  609. /*
  610. * @brief C custom defined QADD16 for M3 and M0 processors
  611. */
  612. __STATIC_INLINE q31_t __QADD16(
  613. q31_t x,
  614. q31_t y)
  615. {
  616. q31_t sum;
  617. q31_t r, s;
  618. r = (short) x;
  619. s = (short) y;
  620. r = __SSAT(r + s, 16);
  621. s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
  622. sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
  623. return sum;
  624. }
  625. /*
  626. * @brief C custom defined SHADD16 for M3 and M0 processors
  627. */
  628. __STATIC_INLINE q31_t __SHADD16(
  629. q31_t x,
  630. q31_t y)
  631. {
  632. q31_t sum;
  633. q31_t r, s;
  634. r = (short) x;
  635. s = (short) y;
  636. r = ((r >> 1) + (s >> 1));
  637. s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
  638. sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
  639. return sum;
  640. }
  641. /*
  642. * @brief C custom defined QSUB16 for M3 and M0 processors
  643. */
  644. __STATIC_INLINE q31_t __QSUB16(
  645. q31_t x,
  646. q31_t y)
  647. {
  648. q31_t sum;
  649. q31_t r, s;
  650. r = (short) x;
  651. s = (short) y;
  652. r = __SSAT(r - s, 16);
  653. s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
  654. sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
  655. return sum;
  656. }
  657. /*
  658. * @brief C custom defined SHSUB16 for M3 and M0 processors
  659. */
  660. __STATIC_INLINE q31_t __SHSUB16(
  661. q31_t x,
  662. q31_t y)
  663. {
  664. q31_t diff;
  665. q31_t r, s;
  666. r = (short) x;
  667. s = (short) y;
  668. r = ((r >> 1) - (s >> 1));
  669. s = (((x >> 17) - (y >> 17)) << 16);
  670. diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
  671. return diff;
  672. }
  673. /*
  674. * @brief C custom defined QASX for M3 and M0 processors
  675. */
  676. __STATIC_INLINE q31_t __QASX(
  677. q31_t x,
  678. q31_t y)
  679. {
  680. q31_t sum = 0;
  681. sum =
  682. ((sum +
  683. clip_q31_to_q15((q31_t) ((short) (x >> 16) + (short) y))) << 16) +
  684. clip_q31_to_q15((q31_t) ((short) x - (short) (y >> 16)));
  685. return sum;
  686. }
  687. /*
  688. * @brief C custom defined SHASX for M3 and M0 processors
  689. */
  690. __STATIC_INLINE q31_t __SHASX(
  691. q31_t x,
  692. q31_t y)
  693. {
  694. q31_t sum;
  695. q31_t r, s;
  696. r = (short) x;
  697. s = (short) y;
  698. r = ((r >> 1) - (y >> 17));
  699. s = (((x >> 17) + (s >> 1)) << 16);
  700. sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
  701. return sum;
  702. }
  703. /*
  704. * @brief C custom defined QSAX for M3 and M0 processors
  705. */
  706. __STATIC_INLINE q31_t __QSAX(
  707. q31_t x,
  708. q31_t y)
  709. {
  710. q31_t sum = 0;
  711. sum =
  712. ((sum +
  713. clip_q31_to_q15((q31_t) ((short) (x >> 16) - (short) y))) << 16) +
  714. clip_q31_to_q15((q31_t) ((short) x + (short) (y >> 16)));
  715. return sum;
  716. }
  717. /*
  718. * @brief C custom defined SHSAX for M3 and M0 processors
  719. */
  720. __STATIC_INLINE q31_t __SHSAX(
  721. q31_t x,
  722. q31_t y)
  723. {
  724. q31_t sum;
  725. q31_t r, s;
  726. r = (short) x;
  727. s = (short) y;
  728. r = ((r >> 1) + (y >> 17));
  729. s = (((x >> 17) - (s >> 1)) << 16);
  730. sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
  731. return sum;
  732. }
  733. /*
  734. * @brief C custom defined SMUSDX for M3 and M0 processors
  735. */
  736. __STATIC_INLINE q31_t __SMUSDX(
  737. q31_t x,
  738. q31_t y)
  739. {
  740. return ((q31_t) (((short) x * (short) (y >> 16)) -
  741. ((short) (x >> 16) * (short) y)));
  742. }
  743. /*
  744. * @brief C custom defined SMUADX for M3 and M0 processors
  745. */
  746. __STATIC_INLINE q31_t __SMUADX(
  747. q31_t x,
  748. q31_t y)
  749. {
  750. return ((q31_t) (((short) x * (short) (y >> 16)) +
  751. ((short) (x >> 16) * (short) y)));
  752. }
  753. /*
  754. * @brief C custom defined QADD for M3 and M0 processors
  755. */
  756. __STATIC_INLINE q31_t __QADD(
  757. q31_t x,
  758. q31_t y)
  759. {
  760. return clip_q63_to_q31((q63_t) x + y);
  761. }
  762. /*
  763. * @brief C custom defined QSUB for M3 and M0 processors
  764. */
  765. __STATIC_INLINE q31_t __QSUB(
  766. q31_t x,
  767. q31_t y)
  768. {
  769. return clip_q63_to_q31((q63_t) x - y);
  770. }
  771. /*
  772. * @brief C custom defined SMLAD for M3 and M0 processors
  773. */
  774. __STATIC_INLINE q31_t __SMLAD(
  775. q31_t x,
  776. q31_t y,
  777. q31_t sum)
  778. {
  779. return (sum + ((short) (x >> 16) * (short) (y >> 16)) +
  780. ((short) x * (short) y));
  781. }
  782. /*
  783. * @brief C custom defined SMLADX for M3 and M0 processors
  784. */
  785. __STATIC_INLINE q31_t __SMLADX(
  786. q31_t x,
  787. q31_t y,
  788. q31_t sum)
  789. {
  790. return (sum + ((short) (x >> 16) * (short) (y)) +
  791. ((short) x * (short) (y >> 16)));
  792. }
  793. /*
  794. * @brief C custom defined SMLSDX for M3 and M0 processors
  795. */
  796. __STATIC_INLINE q31_t __SMLSDX(
  797. q31_t x,
  798. q31_t y,
  799. q31_t sum)
  800. {
  801. return (sum - ((short) (x >> 16) * (short) (y)) +
  802. ((short) x * (short) (y >> 16)));
  803. }
  804. /*
  805. * @brief C custom defined SMLALD for M3 and M0 processors
  806. */
  807. __STATIC_INLINE q63_t __SMLALD(
  808. q31_t x,
  809. q31_t y,
  810. q63_t sum)
  811. {
  812. return (sum + ((short) (x >> 16) * (short) (y >> 16)) +
  813. ((short) x * (short) y));
  814. }
  815. /*
  816. * @brief C custom defined SMLALDX for M3 and M0 processors
  817. */
  818. __STATIC_INLINE q63_t __SMLALDX(
  819. q31_t x,
  820. q31_t y,
  821. q63_t sum)
  822. {
  823. return (sum + ((short) (x >> 16) * (short) y)) +
  824. ((short) x * (short) (y >> 16));
  825. }
  826. /*
  827. * @brief C custom defined SMUAD for M3 and M0 processors
  828. */
  829. __STATIC_INLINE q31_t __SMUAD(
  830. q31_t x,
  831. q31_t y)
  832. {
  833. return (((x >> 16) * (y >> 16)) +
  834. (((x << 16) >> 16) * ((y << 16) >> 16)));
  835. }
  836. /*
  837. * @brief C custom defined SMUSD for M3 and M0 processors
  838. */
  839. __STATIC_INLINE q31_t __SMUSD(
  840. q31_t x,
  841. q31_t y)
  842. {
  843. return (-((x >> 16) * (y >> 16)) +
  844. (((x << 16) >> 16) * ((y << 16) >> 16)));
  845. }
  846. /*
  847. * @brief C custom defined SXTB16 for M3 and M0 processors
  848. */
  849. __STATIC_INLINE q31_t __SXTB16(
  850. q31_t x)
  851. {
  852. return ((((x << 24) >> 24) & 0x0000FFFF) |
  853. (((x << 8) >> 8) & 0xFFFF0000));
  854. }
  855. #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0) */
  856. /**
  857. * @brief Instance structure for the Q7 FIR filter.
  858. */
  859. typedef struct
  860. {
  861. uint16_t numTaps; /**< number of filter coefficients in the filter. */
  862. q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  863. q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  864. } arm_fir_instance_q7;
  865. /**
  866. * @brief Instance structure for the Q15 FIR filter.
  867. */
  868. typedef struct
  869. {
  870. uint16_t numTaps; /**< number of filter coefficients in the filter. */
  871. q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  872. q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  873. } arm_fir_instance_q15;
  874. /**
  875. * @brief Instance structure for the Q31 FIR filter.
  876. */
  877. typedef struct
  878. {
  879. uint16_t numTaps; /**< number of filter coefficients in the filter. */
  880. q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  881. q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  882. } arm_fir_instance_q31;
  883. /**
  884. * @brief Instance structure for the floating-point FIR filter.
  885. */
  886. typedef struct
  887. {
  888. uint16_t numTaps; /**< number of filter coefficients in the filter. */
  889. float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  890. float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  891. } arm_fir_instance_f32;
  892. /**
  893. * @brief Processing function for the Q7 FIR filter.
  894. * @param[in] *S points to an instance of the Q7 FIR filter structure.
  895. * @param[in] *pSrc points to the block of input data.
  896. * @param[out] *pDst points to the block of output data.
  897. * @param[in] blockSize number of samples to process.
  898. * @return none.
  899. */
  900. void arm_fir_q7(
  901. const arm_fir_instance_q7 * S,
  902. q7_t * pSrc,
  903. q7_t * pDst,
  904. uint32_t blockSize);
  905. /**
  906. * @brief Initialization function for the Q7 FIR filter.
  907. * @param[in,out] *S points to an instance of the Q7 FIR structure.
  908. * @param[in] numTaps Number of filter coefficients in the filter.
  909. * @param[in] *pCoeffs points to the filter coefficients.
  910. * @param[in] *pState points to the state buffer.
  911. * @param[in] blockSize number of samples that are processed.
  912. * @return none
  913. */
  914. void arm_fir_init_q7(
  915. arm_fir_instance_q7 * S,
  916. uint16_t numTaps,
  917. q7_t * pCoeffs,
  918. q7_t * pState,
  919. uint32_t blockSize);
  920. /**
  921. * @brief Processing function for the Q15 FIR filter.
  922. * @param[in] *S points to an instance of the Q15 FIR structure.
  923. * @param[in] *pSrc points to the block of input data.
  924. * @param[out] *pDst points to the block of output data.
  925. * @param[in] blockSize number of samples to process.
  926. * @return none.
  927. */
  928. void arm_fir_q15(
  929. const arm_fir_instance_q15 * S,
  930. q15_t * pSrc,
  931. q15_t * pDst,
  932. uint32_t blockSize);
  933. /**
  934. * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
  935. * @param[in] *S points to an instance of the Q15 FIR filter structure.
  936. * @param[in] *pSrc points to the block of input data.
  937. * @param[out] *pDst points to the block of output data.
  938. * @param[in] blockSize number of samples to process.
  939. * @return none.
  940. */
  941. void arm_fir_fast_q15(
  942. const arm_fir_instance_q15 * S,
  943. q15_t * pSrc,
  944. q15_t * pDst,
  945. uint32_t blockSize);
  946. /**
  947. * @brief Initialization function for the Q15 FIR filter.
  948. * @param[in,out] *S points to an instance of the Q15 FIR filter structure.
  949. * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
  950. * @param[in] *pCoeffs points to the filter coefficients.
  951. * @param[in] *pState points to the state buffer.
  952. * @param[in] blockSize number of samples that are processed at a time.
  953. * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
  954. * <code>numTaps</code> is not a supported value.
  955. */
  956. arm_status arm_fir_init_q15(
  957. arm_fir_instance_q15 * S,
  958. uint16_t numTaps,
  959. q15_t * pCoeffs,
  960. q15_t * pState,
  961. uint32_t blockSize);
  962. /**
  963. * @brief Processing function for the Q31 FIR filter.
  964. * @param[in] *S points to an instance of the Q31 FIR filter structure.
  965. * @param[in] *pSrc points to the block of input data.
  966. * @param[out] *pDst points to the block of output data.
  967. * @param[in] blockSize number of samples to process.
  968. * @return none.
  969. */
  970. void arm_fir_q31(
  971. const arm_fir_instance_q31 * S,
  972. q31_t * pSrc,
  973. q31_t * pDst,
  974. uint32_t blockSize);
  975. /**
  976. * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
  977. * @param[in] *S points to an instance of the Q31 FIR structure.
  978. * @param[in] *pSrc points to the block of input data.
  979. * @param[out] *pDst points to the block of output data.
  980. * @param[in] blockSize number of samples to process.
  981. * @return none.
  982. */
  983. void arm_fir_fast_q31(
  984. const arm_fir_instance_q31 * S,
  985. q31_t * pSrc,
  986. q31_t * pDst,
  987. uint32_t blockSize);
  988. /**
  989. * @brief Initialization function for the Q31 FIR filter.
  990. * @param[in,out] *S points to an instance of the Q31 FIR structure.
  991. * @param[in] numTaps Number of filter coefficients in the filter.
  992. * @param[in] *pCoeffs points to the filter coefficients.
  993. * @param[in] *pState points to the state buffer.
  994. * @param[in] blockSize number of samples that are processed at a time.
  995. * @return none.
  996. */
  997. void arm_fir_init_q31(
  998. arm_fir_instance_q31 * S,
  999. uint16_t numTaps,
  1000. q31_t * pCoeffs,
  1001. q31_t * pState,
  1002. uint32_t blockSize);
  1003. /**
  1004. * @brief Processing function for the floating-point FIR filter.
  1005. * @param[in] *S points to an instance of the floating-point FIR structure.
  1006. * @param[in] *pSrc points to the block of input data.
  1007. * @param[out] *pDst points to the block of output data.
  1008. * @param[in] blockSize number of samples to process.
  1009. * @return none.
  1010. */
  1011. void arm_fir_f32(
  1012. const arm_fir_instance_f32 * S,
  1013. float32_t * pSrc,
  1014. float32_t * pDst,
  1015. uint32_t blockSize);
  1016. /**
  1017. * @brief Initialization function for the floating-point FIR filter.
  1018. * @param[in,out] *S points to an instance of the floating-point FIR filter structure.
  1019. * @param[in] numTaps Number of filter coefficients in the filter.
  1020. * @param[in] *pCoeffs points to the filter coefficients.
  1021. * @param[in] *pState points to the state buffer.
  1022. * @param[in] blockSize number of samples that are processed at a time.
  1023. * @return none.
  1024. */
  1025. void arm_fir_init_f32(
  1026. arm_fir_instance_f32 * S,
  1027. uint16_t numTaps,
  1028. float32_t * pCoeffs,
  1029. float32_t * pState,
  1030. uint32_t blockSize);
  1031. /**
  1032. * @brief Instance structure for the Q15 Biquad cascade filter.
  1033. */
  1034. typedef struct
  1035. {
  1036. int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
  1037. q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
  1038. q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
  1039. int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
  1040. } arm_biquad_casd_df1_inst_q15;
  1041. /**
  1042. * @brief Instance structure for the Q31 Biquad cascade filter.
  1043. */
  1044. typedef struct
  1045. {
  1046. uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
  1047. q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
  1048. q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
  1049. uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
  1050. } arm_biquad_casd_df1_inst_q31;
  1051. /**
  1052. * @brief Instance structure for the floating-point Biquad cascade filter.
  1053. */
  1054. typedef struct
  1055. {
  1056. uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
  1057. float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
  1058. float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
  1059. } arm_biquad_casd_df1_inst_f32;
  1060. /**
  1061. * @brief Processing function for the Q15 Biquad cascade filter.
  1062. * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
  1063. * @param[in] *pSrc points to the block of input data.
  1064. * @param[out] *pDst points to the block of output data.
  1065. * @param[in] blockSize number of samples to process.
  1066. * @return none.
  1067. */
  1068. void arm_biquad_cascade_df1_q15(
  1069. const arm_biquad_casd_df1_inst_q15 * S,
  1070. q15_t * pSrc,
  1071. q15_t * pDst,
  1072. uint32_t blockSize);
  1073. /**
  1074. * @brief Initialization function for the Q15 Biquad cascade filter.
  1075. * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure.
  1076. * @param[in] numStages number of 2nd order stages in the filter.
  1077. * @param[in] *pCoeffs points to the filter coefficients.
  1078. * @param[in] *pState points to the state buffer.
  1079. * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
  1080. * @return none
  1081. */
  1082. void arm_biquad_cascade_df1_init_q15(
  1083. arm_biquad_casd_df1_inst_q15 * S,
  1084. uint8_t numStages,
  1085. q15_t * pCoeffs,
  1086. q15_t * pState,
  1087. int8_t postShift);
  1088. /**
  1089. * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
  1090. * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
  1091. * @param[in] *pSrc points to the block of input data.
  1092. * @param[out] *pDst points to the block of output data.
  1093. * @param[in] blockSize number of samples to process.
  1094. * @return none.
  1095. */
  1096. void arm_biquad_cascade_df1_fast_q15(
  1097. const arm_biquad_casd_df1_inst_q15 * S,
  1098. q15_t * pSrc,
  1099. q15_t * pDst,
  1100. uint32_t blockSize);
  1101. /**
  1102. * @brief Processing function for the Q31 Biquad cascade filter
  1103. * @param[in] *S points to an instance of the Q31 Biquad cascade 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. * @return none.
  1108. */
  1109. void arm_biquad_cascade_df1_q31(
  1110. const arm_biquad_casd_df1_inst_q31 * S,
  1111. q31_t * pSrc,
  1112. q31_t * pDst,
  1113. uint32_t blockSize);
  1114. /**
  1115. * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
  1116. * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
  1117. * @param[in] *pSrc points to the block of input data.
  1118. * @param[out] *pDst points to the block of output data.
  1119. * @param[in] blockSize number of samples to process.
  1120. * @return none.
  1121. */
  1122. void arm_biquad_cascade_df1_fast_q31(
  1123. const arm_biquad_casd_df1_inst_q31 * S,
  1124. q31_t * pSrc,
  1125. q31_t * pDst,
  1126. uint32_t blockSize);
  1127. /**
  1128. * @brief Initialization function for the Q31 Biquad cascade filter.
  1129. * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure.
  1130. * @param[in] numStages number of 2nd order stages in the filter.
  1131. * @param[in] *pCoeffs points to the filter coefficients.
  1132. * @param[in] *pState points to the state buffer.
  1133. * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
  1134. * @return none
  1135. */
  1136. void arm_biquad_cascade_df1_init_q31(
  1137. arm_biquad_casd_df1_inst_q31 * S,
  1138. uint8_t numStages,
  1139. q31_t * pCoeffs,
  1140. q31_t * pState,
  1141. int8_t postShift);
  1142. /**
  1143. * @brief Processing function for the floating-point Biquad cascade filter.
  1144. * @param[in] *S points to an instance of the floating-point Biquad cascade structure.
  1145. * @param[in] *pSrc points to the block of input data.
  1146. * @param[out] *pDst points to the block of output data.
  1147. * @param[in] blockSize number of samples to process.
  1148. * @return none.
  1149. */
  1150. void arm_biquad_cascade_df1_f32(
  1151. const arm_biquad_casd_df1_inst_f32 * S,
  1152. float32_t * pSrc,
  1153. float32_t * pDst,
  1154. uint32_t blockSize);
  1155. /**
  1156. * @brief Initialization function for the floating-point Biquad cascade filter.
  1157. * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure.
  1158. * @param[in] numStages number of 2nd order stages in the filter.
  1159. * @param[in] *pCoeffs points to the filter coefficients.
  1160. * @param[in] *pState points to the state buffer.
  1161. * @return none
  1162. */
  1163. void arm_biquad_cascade_df1_init_f32(
  1164. arm_biquad_casd_df1_inst_f32 * S,
  1165. uint8_t numStages,
  1166. float32_t * pCoeffs,
  1167. float32_t * pState);
  1168. /**
  1169. * @brief Instance structure for the floating-point matrix structure.
  1170. */
  1171. typedef struct
  1172. {
  1173. uint16_t numRows; /**< number of rows of the matrix. */
  1174. uint16_t numCols; /**< number of columns of the matrix. */
  1175. float32_t *pData; /**< points to the data of the matrix. */
  1176. } arm_matrix_instance_f32;
  1177. /**
  1178. * @brief Instance structure for the Q15 matrix structure.
  1179. */
  1180. typedef struct
  1181. {
  1182. uint16_t numRows; /**< number of rows of the matrix. */
  1183. uint16_t numCols; /**< number of columns of the matrix. */
  1184. q15_t *pData; /**< points to the data of the matrix. */
  1185. } arm_matrix_instance_q15;
  1186. /**
  1187. * @brief Instance structure for the Q31 matrix structure.
  1188. */
  1189. typedef struct
  1190. {
  1191. uint16_t numRows; /**< number of rows of the matrix. */
  1192. uint16_t numCols; /**< number of columns of the matrix. */
  1193. q31_t *pData; /**< points to the data of the matrix. */
  1194. } arm_matrix_instance_q31;
  1195. /**
  1196. * @brief Floating-point matrix addition.
  1197. * @param[in] *pSrcA points to the first input matrix structure
  1198. * @param[in] *pSrcB points to the second input matrix structure
  1199. * @param[out] *pDst points to output matrix structure
  1200. * @return The function returns either
  1201. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1202. */
  1203. arm_status arm_mat_add_f32(
  1204. const arm_matrix_instance_f32 * pSrcA,
  1205. const arm_matrix_instance_f32 * pSrcB,
  1206. arm_matrix_instance_f32 * pDst);
  1207. /**
  1208. * @brief Q15 matrix addition.
  1209. * @param[in] *pSrcA points to the first input matrix structure
  1210. * @param[in] *pSrcB points to the second input matrix structure
  1211. * @param[out] *pDst points to output matrix structure
  1212. * @return The function returns either
  1213. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1214. */
  1215. arm_status arm_mat_add_q15(
  1216. const arm_matrix_instance_q15 * pSrcA,
  1217. const arm_matrix_instance_q15 * pSrcB,
  1218. arm_matrix_instance_q15 * pDst);
  1219. /**
  1220. * @brief Q31 matrix addition.
  1221. * @param[in] *pSrcA points to the first input matrix structure
  1222. * @param[in] *pSrcB points to the second input matrix structure
  1223. * @param[out] *pDst points to output matrix structure
  1224. * @return The function returns either
  1225. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1226. */
  1227. arm_status arm_mat_add_q31(
  1228. const arm_matrix_instance_q31 * pSrcA,
  1229. const arm_matrix_instance_q31 * pSrcB,
  1230. arm_matrix_instance_q31 * pDst);
  1231. /**
  1232. * @brief Floating-point matrix transpose.
  1233. * @param[in] *pSrc points to the input matrix
  1234. * @param[out] *pDst points to the output matrix
  1235. * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
  1236. * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1237. */
  1238. arm_status arm_mat_trans_f32(
  1239. const arm_matrix_instance_f32 * pSrc,
  1240. arm_matrix_instance_f32 * pDst);
  1241. /**
  1242. * @brief Q15 matrix transpose.
  1243. * @param[in] *pSrc points to the input matrix
  1244. * @param[out] *pDst points to the output matrix
  1245. * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
  1246. * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1247. */
  1248. arm_status arm_mat_trans_q15(
  1249. const arm_matrix_instance_q15 * pSrc,
  1250. arm_matrix_instance_q15 * pDst);
  1251. /**
  1252. * @brief Q31 matrix transpose.
  1253. * @param[in] *pSrc points to the input matrix
  1254. * @param[out] *pDst points to the output matrix
  1255. * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
  1256. * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1257. */
  1258. arm_status arm_mat_trans_q31(
  1259. const arm_matrix_instance_q31 * pSrc,
  1260. arm_matrix_instance_q31 * pDst);
  1261. /**
  1262. * @brief Floating-point matrix multiplication
  1263. * @param[in] *pSrcA points to the first input matrix structure
  1264. * @param[in] *pSrcB points to the second input matrix structure
  1265. * @param[out] *pDst points to output matrix structure
  1266. * @return The function returns either
  1267. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1268. */
  1269. arm_status arm_mat_mult_f32(
  1270. const arm_matrix_instance_f32 * pSrcA,
  1271. const arm_matrix_instance_f32 * pSrcB,
  1272. arm_matrix_instance_f32 * pDst);
  1273. /**
  1274. * @brief Q15 matrix multiplication
  1275. * @param[in] *pSrcA points to the first input matrix structure
  1276. * @param[in] *pSrcB points to the second input matrix structure
  1277. * @param[out] *pDst points to output matrix structure
  1278. * @return The function returns either
  1279. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1280. */
  1281. arm_status arm_mat_mult_q15(
  1282. const arm_matrix_instance_q15 * pSrcA,
  1283. const arm_matrix_instance_q15 * pSrcB,
  1284. arm_matrix_instance_q15 * pDst,
  1285. q15_t * pState);
  1286. /**
  1287. * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
  1288. * @param[in] *pSrcA points to the first input matrix structure
  1289. * @param[in] *pSrcB points to the second input matrix structure
  1290. * @param[out] *pDst points to output matrix structure
  1291. * @param[in] *pState points to the array for storing intermediate results
  1292. * @return The function returns either
  1293. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1294. */
  1295. arm_status arm_mat_mult_fast_q15(
  1296. const arm_matrix_instance_q15 * pSrcA,
  1297. const arm_matrix_instance_q15 * pSrcB,
  1298. arm_matrix_instance_q15 * pDst,
  1299. q15_t * pState);
  1300. /**
  1301. * @brief Q31 matrix multiplication
  1302. * @param[in] *pSrcA points to the first input matrix structure
  1303. * @param[in] *pSrcB points to the second input matrix structure
  1304. * @param[out] *pDst points to output matrix structure
  1305. * @return The function returns either
  1306. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1307. */
  1308. arm_status arm_mat_mult_q31(
  1309. const arm_matrix_instance_q31 * pSrcA,
  1310. const arm_matrix_instance_q31 * pSrcB,
  1311. arm_matrix_instance_q31 * pDst);
  1312. /**
  1313. * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
  1314. * @param[in] *pSrcA points to the first input matrix structure
  1315. * @param[in] *pSrcB points to the second input matrix structure
  1316. * @param[out] *pDst points to output matrix structure
  1317. * @return The function returns either
  1318. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1319. */
  1320. arm_status arm_mat_mult_fast_q31(
  1321. const arm_matrix_instance_q31 * pSrcA,
  1322. const arm_matrix_instance_q31 * pSrcB,
  1323. arm_matrix_instance_q31 * pDst);
  1324. /**
  1325. * @brief Floating-point matrix subtraction
  1326. * @param[in] *pSrcA points to the first input matrix structure
  1327. * @param[in] *pSrcB points to the second input matrix structure
  1328. * @param[out] *pDst points to output matrix structure
  1329. * @return The function returns either
  1330. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1331. */
  1332. arm_status arm_mat_sub_f32(
  1333. const arm_matrix_instance_f32 * pSrcA,
  1334. const arm_matrix_instance_f32 * pSrcB,
  1335. arm_matrix_instance_f32 * pDst);
  1336. /**
  1337. * @brief Q15 matrix subtraction
  1338. * @param[in] *pSrcA points to the first input matrix structure
  1339. * @param[in] *pSrcB points to the second input matrix structure
  1340. * @param[out] *pDst points to output matrix structure
  1341. * @return The function returns either
  1342. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1343. */
  1344. arm_status arm_mat_sub_q15(
  1345. const arm_matrix_instance_q15 * pSrcA,
  1346. const arm_matrix_instance_q15 * pSrcB,
  1347. arm_matrix_instance_q15 * pDst);
  1348. /**
  1349. * @brief Q31 matrix subtraction
  1350. * @param[in] *pSrcA points to the first input matrix structure
  1351. * @param[in] *pSrcB points to the second input matrix structure
  1352. * @param[out] *pDst points to output matrix structure
  1353. * @return The function returns either
  1354. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1355. */
  1356. arm_status arm_mat_sub_q31(
  1357. const arm_matrix_instance_q31 * pSrcA,
  1358. const arm_matrix_instance_q31 * pSrcB,
  1359. arm_matrix_instance_q31 * pDst);
  1360. /**
  1361. * @brief Floating-point matrix scaling.
  1362. * @param[in] *pSrc points to the input matrix
  1363. * @param[in] scale scale factor
  1364. * @param[out] *pDst points to the output matrix
  1365. * @return The function returns either
  1366. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1367. */
  1368. arm_status arm_mat_scale_f32(
  1369. const arm_matrix_instance_f32 * pSrc,
  1370. float32_t scale,
  1371. arm_matrix_instance_f32 * pDst);
  1372. /**
  1373. * @brief Q15 matrix scaling.
  1374. * @param[in] *pSrc points to input matrix
  1375. * @param[in] scaleFract fractional portion of the scale factor
  1376. * @param[in] shift number of bits to shift the result by
  1377. * @param[out] *pDst points to output matrix
  1378. * @return The function returns either
  1379. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1380. */
  1381. arm_status arm_mat_scale_q15(
  1382. const arm_matrix_instance_q15 * pSrc,
  1383. q15_t scaleFract,
  1384. int32_t shift,
  1385. arm_matrix_instance_q15 * pDst);
  1386. /**
  1387. * @brief Q31 matrix scaling.
  1388. * @param[in] *pSrc points to input matrix
  1389. * @param[in] scaleFract fractional portion of the scale factor
  1390. * @param[in] shift number of bits to shift the result by
  1391. * @param[out] *pDst points to output matrix structure
  1392. * @return The function returns either
  1393. * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
  1394. */
  1395. arm_status arm_mat_scale_q31(
  1396. const arm_matrix_instance_q31 * pSrc,
  1397. q31_t scaleFract,
  1398. int32_t shift,
  1399. arm_matrix_instance_q31 * pDst);
  1400. /**
  1401. * @brief Q31 matrix initialization.
  1402. * @param[in,out] *S points to an instance of the floating-point matrix structure.
  1403. * @param[in] nRows number of rows in the matrix.
  1404. * @param[in] nColumns number of columns in the matrix.
  1405. * @param[in] *pData points to the matrix data array.
  1406. * @return none
  1407. */
  1408. void arm_mat_init_q31(
  1409. arm_matrix_instance_q31 * S,
  1410. uint16_t nRows,
  1411. uint16_t nColumns,
  1412. q31_t * pData);
  1413. /**
  1414. * @brief Q15 matrix initialization.
  1415. * @param[in,out] *S points to an instance of the floating-point matrix structure.
  1416. * @param[in] nRows number of rows in the matrix.
  1417. * @param[in] nColumns number of columns in the matrix.
  1418. * @param[in] *pData points to the matrix data array.
  1419. * @return none
  1420. */
  1421. void arm_mat_init_q15(
  1422. arm_matrix_instance_q15 * S,
  1423. uint16_t nRows,
  1424. uint16_t nColumns,
  1425. q15_t * pData);
  1426. /**
  1427. * @brief Floating-point matrix initialization.
  1428. * @param[in,out] *S points to an instance of the floating-point matrix structure.
  1429. * @param[in] nRows number of rows in the matrix.
  1430. * @param[in] nColumns number of columns in the matrix.
  1431. * @param[in] *pData points to the matrix data array.
  1432. * @return none
  1433. */
  1434. void arm_mat_init_f32(
  1435. arm_matrix_instance_f32 * S,
  1436. uint16_t nRows,
  1437. uint16_t nColumns,
  1438. float32_t * pData);
  1439. /**
  1440. * @brief Instance structure for the Q15 PID Control.
  1441. */
  1442. typedef struct
  1443. {
  1444. q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
  1445. #ifdef ARM_MATH_CM0
  1446. q15_t A1;
  1447. q15_t A2;
  1448. #else
  1449. q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
  1450. #endif
  1451. q15_t state[3]; /**< The state array of length 3. */
  1452. q15_t Kp; /**< The proportional gain. */
  1453. q15_t Ki; /**< The integral gain. */
  1454. q15_t Kd; /**< The derivative gain. */
  1455. } arm_pid_instance_q15;
  1456. /**
  1457. * @brief Instance structure for the Q31 PID Control.
  1458. */
  1459. typedef struct
  1460. {
  1461. q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
  1462. q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
  1463. q31_t A2; /**< The derived gain, A2 = Kd . */
  1464. q31_t state[3]; /**< The state array of length 3. */
  1465. q31_t Kp; /**< The proportional gain. */
  1466. q31_t Ki; /**< The integral gain. */
  1467. q31_t Kd; /**< The derivative gain. */
  1468. } arm_pid_instance_q31;
  1469. /**
  1470. * @brief Instance structure for the floating-point PID Control.
  1471. */
  1472. typedef struct
  1473. {
  1474. float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
  1475. float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
  1476. float32_t A2; /**< The derived gain, A2 = Kd . */
  1477. float32_t state[3]; /**< The state array of length 3. */
  1478. float32_t Kp; /**< The proportional gain. */
  1479. float32_t Ki; /**< The integral gain. */
  1480. float32_t Kd; /**< The derivative gain. */
  1481. } arm_pid_instance_f32;
  1482. /**
  1483. * @brief Initialization function for the floating-point PID Control.
  1484. * @param[in,out] *S points to an instance of the PID structure.
  1485. * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
  1486. * @return none.
  1487. */
  1488. void arm_pid_init_f32(
  1489. arm_pid_instance_f32 * S,
  1490. int32_t resetStateFlag);
  1491. /**
  1492. * @brief Reset function for the floating-point PID Control.
  1493. * @param[in,out] *S is an instance of the floating-point PID Control structure
  1494. * @return none
  1495. */
  1496. void arm_pid_reset_f32(
  1497. arm_pid_instance_f32 * S);
  1498. /**
  1499. * @brief Initialization function for the Q31 PID Control.
  1500. * @param[in,out] *S points to an instance of the Q15 PID structure.
  1501. * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
  1502. * @return none.
  1503. */
  1504. void arm_pid_init_q31(
  1505. arm_pid_instance_q31 * S,
  1506. int32_t resetStateFlag);
  1507. /**
  1508. * @brief Reset function for the Q31 PID Control.
  1509. * @param[in,out] *S points to an instance of the Q31 PID Control structure
  1510. * @return none
  1511. */
  1512. void arm_pid_reset_q31(
  1513. arm_pid_instance_q31 * S);
  1514. /**
  1515. * @brief Initialization function for the Q15 PID Control.
  1516. * @param[in,out] *S points to an instance of the Q15 PID structure.
  1517. * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
  1518. * @return none.
  1519. */
  1520. void arm_pid_init_q15(
  1521. arm_pid_instance_q15 * S,
  1522. int32_t resetStateFlag);
  1523. /**
  1524. * @brief Reset function for the Q15 PID Control.
  1525. * @param[in,out] *S points to an instance of the q15 PID Control structure
  1526. * @return none
  1527. */
  1528. void arm_pid_reset_q15(
  1529. arm_pid_instance_q15 * S);
  1530. /**
  1531. * @brief Instance structure for the floating-point Linear Interpolate function.
  1532. */
  1533. typedef struct
  1534. {
  1535. uint32_t nValues; /**< nValues */
  1536. float32_t x1; /**< x1 */
  1537. float32_t xSpacing; /**< xSpacing */
  1538. float32_t *pYData; /**< pointer to the table of Y values */
  1539. } arm_linear_interp_instance_f32;
  1540. /**
  1541. * @brief Instance structure for the floating-point bilinear interpolation function.
  1542. */
  1543. typedef struct
  1544. {
  1545. uint16_t numRows; /**< number of rows in the data table. */
  1546. uint16_t numCols; /**< number of columns in the data table. */
  1547. float32_t *pData; /**< points to the data table. */
  1548. } arm_bilinear_interp_instance_f32;
  1549. /**
  1550. * @brief Instance structure for the Q31 bilinear interpolation function.
  1551. */
  1552. typedef struct
  1553. {
  1554. uint16_t numRows; /**< number of rows in the data table. */
  1555. uint16_t numCols; /**< number of columns in the data table. */
  1556. q31_t *pData; /**< points to the data table. */
  1557. } arm_bilinear_interp_instance_q31;
  1558. /**
  1559. * @brief Instance structure for the Q15 bilinear interpolation function.
  1560. */
  1561. typedef struct
  1562. {
  1563. uint16_t numRows; /**< number of rows in the data table. */
  1564. uint16_t numCols; /**< number of columns in the data table. */
  1565. q15_t *pData; /**< points to the data table. */
  1566. } arm_bilinear_interp_instance_q15;
  1567. /**
  1568. * @brief Instance structure for the Q15 bilinear interpolation function.
  1569. */
  1570. typedef struct
  1571. {
  1572. uint16_t numRows; /**< number of rows in the data table. */
  1573. uint16_t numCols; /**< number of columns in the data table. */
  1574. q7_t *pData; /**< points to the data table. */
  1575. } arm_bilinear_interp_instance_q7;
  1576. /**
  1577. * @brief Q7 vector multiplication.
  1578. * @param[in] *pSrcA points to the first input vector
  1579. * @param[in] *pSrcB points to the second input vector
  1580. * @param[out] *pDst points to the output vector
  1581. * @param[in] blockSize number of samples in each vector
  1582. * @return none.
  1583. */
  1584. void arm_mult_q7(
  1585. q7_t * pSrcA,
  1586. q7_t * pSrcB,
  1587. q7_t * pDst,
  1588. uint32_t blockSize);
  1589. /**
  1590. * @brief Q15 vector multiplication.
  1591. * @param[in] *pSrcA points to the first input vector
  1592. * @param[in] *pSrcB points to the second input vector
  1593. * @param[out] *pDst points to the output vector
  1594. * @param[in] blockSize number of samples in each vector
  1595. * @return none.
  1596. */
  1597. void arm_mult_q15(
  1598. q15_t * pSrcA,
  1599. q15_t * pSrcB,
  1600. q15_t * pDst,
  1601. uint32_t blockSize);
  1602. /**
  1603. * @brief Q31 vector multiplication.
  1604. * @param[in] *pSrcA points to the first input vector
  1605. * @param[in] *pSrcB points to the second input vector
  1606. * @param[out] *pDst points to the output vector
  1607. * @param[in] blockSize number of samples in each vector
  1608. * @return none.
  1609. */
  1610. void arm_mult_q31(
  1611. q31_t * pSrcA,
  1612. q31_t * pSrcB,
  1613. q31_t * pDst,
  1614. uint32_t blockSize);
  1615. /**
  1616. * @brief Floating-point vector multiplication.
  1617. * @param[in] *pSrcA points to the first input vector
  1618. * @param[in] *pSrcB points to the second input vector
  1619. * @param[out] *pDst points to the output vector
  1620. * @param[in] blockSize number of samples in each vector
  1621. * @return none.
  1622. */
  1623. void arm_mult_f32(
  1624. float32_t * pSrcA,
  1625. float32_t * pSrcB,
  1626. float32_t * pDst,
  1627. uint32_t blockSize);
  1628. /**
  1629. * @brief Instance structure for the Q15 CFFT/CIFFT function.
  1630. */
  1631. typedef struct
  1632. {
  1633. uint16_t fftLen; /**< length of the FFT. */
  1634. uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
  1635. uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
  1636. q15_t *pTwiddle; /**< points to the twiddle factor table. */
  1637. uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  1638. uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  1639. uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
  1640. } arm_cfft_radix4_instance_q15;
  1641. /**
  1642. * @brief Instance structure for the Q31 CFFT/CIFFT function.
  1643. */
  1644. typedef struct
  1645. {
  1646. uint16_t fftLen; /**< length of the FFT. */
  1647. uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
  1648. uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
  1649. q31_t *pTwiddle; /**< points to the twiddle factor table. */
  1650. uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  1651. uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  1652. uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
  1653. } arm_cfft_radix4_instance_q31;
  1654. /**
  1655. * @brief Instance structure for the floating-point CFFT/CIFFT function.
  1656. */
  1657. typedef struct
  1658. {
  1659. uint16_t fftLen; /**< length of the FFT. */
  1660. uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
  1661. uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
  1662. float32_t *pTwiddle; /**< points to the twiddle factor table. */
  1663. uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  1664. uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  1665. uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
  1666. float32_t onebyfftLen; /**< value of 1/fftLen. */
  1667. } arm_cfft_radix4_instance_f32;
  1668. /**
  1669. * @brief Instance structure for the Q15 CFFT/CIFFT function.
  1670. */
  1671. typedef struct
  1672. {
  1673. uint16_t fftLen; /**< length of the FFT. */
  1674. uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
  1675. uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
  1676. q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
  1677. uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  1678. uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  1679. uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
  1680. } arm_cfft_radix2_instance_q15;
  1681. /**
  1682. * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
  1683. */
  1684. typedef struct
  1685. {
  1686. uint16_t fftLen; /**< length of the FFT. */
  1687. uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
  1688. uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
  1689. q31_t *pTwiddle; /**< points to the Twiddle factor table. */
  1690. uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  1691. uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  1692. uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
  1693. } arm_cfft_radix2_instance_q31;
  1694. /**
  1695. * @brief Instance structure for the floating-point CFFT/CIFFT function.
  1696. */
  1697. typedef struct
  1698. {
  1699. uint16_t fftLen; /**< length of the FFT. */
  1700. uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
  1701. uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
  1702. float32_t *pTwiddle; /**< points to the Twiddle factor table. */
  1703. uint16_t *pBitRevTable; /**< points to the bit reversal table. */
  1704. uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  1705. uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
  1706. float32_t onebyfftLen; /**< value of 1/fftLen. */
  1707. } arm_cfft_radix2_instance_f32;
  1708. /**
  1709. * @brief Processing function for the Q15 CFFT/CIFFT.
  1710. * @param[in] *S points to an instance of the Q15 CFFT/CIFFT structure.
  1711. * @param[in, out] *pSrc points to the complex data buffer. Processing occurs in-place.
  1712. * @return none.
  1713. */
  1714. void arm_cfft_radix4_q15(
  1715. const arm_cfft_radix4_instance_q15 * S,
  1716. q15_t * pSrc);
  1717. /**
  1718. * @brief Processing function for the Q15 CFFT/CIFFT.
  1719. * @param[in] *S points to an instance of the Q15 CFFT/CIFFT structure.
  1720. * @param[in, out] *pSrc points to the complex data buffer. Processing occurs in-place.
  1721. * @return none.
  1722. */
  1723. void arm_cfft_radix2_q15(
  1724. const arm_cfft_radix2_instance_q15 * S,
  1725. q15_t * pSrc);
  1726. /**
  1727. * @brief Initialization function for the Q15 CFFT/CIFFT.
  1728. * @param[in,out] *S points to an instance of the Q15 CFFT/CIFFT structure.
  1729. * @param[in] fftLen length of the FFT.
  1730. * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
  1731. * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
  1732. * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLen</code> is not a supported value.
  1733. */
  1734. arm_status arm_cfft_radix4_init_q15(
  1735. arm_cfft_radix4_instance_q15 * S,
  1736. uint16_t fftLen,
  1737. uint8_t ifftFlag,
  1738. uint8_t bitReverseFlag);
  1739. /**
  1740. * @brief Initialization function for the Q15 CFFT/CIFFT.
  1741. * @param[in,out] *S points to an instance of the Q15 CFFT/CIFFT structure.
  1742. * @param[in] fftLen length of the FFT.
  1743. * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
  1744. * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
  1745. * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLen</code> is not a supported value.
  1746. */
  1747. arm_status arm_cfft_radix2_init_q15(
  1748. arm_cfft_radix2_instance_q15 * S,
  1749. uint16_t fftLen,
  1750. uint8_t ifftFlag,
  1751. uint8_t bitReverseFlag);
  1752. /**
  1753. * @brief Processing function for the Q31 CFFT/CIFFT.
  1754. * @param[in] *S points to an instance of the Q31 CFFT/CIFFT structure.
  1755. * @param[in, out] *pSrc points to the complex data buffer. Processing occurs in-place.
  1756. * @return none.
  1757. */
  1758. void arm_cfft_radix4_q31(
  1759. const arm_cfft_radix4_instance_q31 * S,
  1760. q31_t * pSrc);
  1761. /**
  1762. * @brief Initialization function for the Q31 CFFT/CIFFT.
  1763. * @param[in,out] *S points to an instance of the Q31 CFFT/CIFFT structure.
  1764. * @param[in] fftLen length of the FFT.
  1765. * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
  1766. * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
  1767. * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLen</code> is not a supported value.
  1768. */
  1769. arm_status arm_cfft_radix4_init_q31(
  1770. arm_cfft_radix4_instance_q31 * S,
  1771. uint16_t fftLen,
  1772. uint8_t ifftFlag,
  1773. uint8_t bitReverseFlag);
  1774. /**
  1775. * @brief Processing function for the Radix-2 Q31 CFFT/CIFFT.
  1776. * @param[in] *S points to an instance of the Radix-2 Q31 CFFT/CIFFT structure.
  1777. * @param[in, out] *pSrc points to the complex data buffer. Processing occurs in-place.
  1778. * @return none.
  1779. */
  1780. void arm_cfft_radix2_q31(
  1781. const arm_cfft_radix2_instance_q31 * S,
  1782. q31_t * pSrc);
  1783. /**
  1784. * @brief Initialization function for the Radix-2 Q31 CFFT/CIFFT.
  1785. * @param[in,out] *S points to an instance of the Radix-2 Q31 CFFT/CIFFT structure.
  1786. * @param[in] fftLen length of the FFT.
  1787. * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
  1788. * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
  1789. * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLen</code> is not a supported value.
  1790. */
  1791. arm_status arm_cfft_radix2_init_q31(
  1792. arm_cfft_radix2_instance_q31 * S,
  1793. uint16_t fftLen,
  1794. uint8_t ifftFlag,
  1795. uint8_t bitReverseFlag);
  1796. /**
  1797. * @brief Processing function for the floating-point CFFT/CIFFT.
  1798. * @param[in] *S points to an instance of the floating-point CFFT/CIFFT structure.
  1799. * @param[in, out] *pSrc points to the complex data buffer. Processing occurs in-place.
  1800. * @return none.
  1801. */
  1802. void arm_cfft_radix2_f32(
  1803. const arm_cfft_radix2_instance_f32 * S,
  1804. float32_t * pSrc);
  1805. /**
  1806. * @brief Initialization function for the floating-point CFFT/CIFFT.
  1807. * @param[in,out] *S points to an instance of the floating-point CFFT/CIFFT structure.
  1808. * @param[in] fftLen length of the FFT.
  1809. * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
  1810. * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
  1811. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLen</code> is not a supported value.
  1812. */
  1813. arm_status arm_cfft_radix2_init_f32(
  1814. arm_cfft_radix2_instance_f32 * S,
  1815. uint16_t fftLen,
  1816. uint8_t ifftFlag,
  1817. uint8_t bitReverseFlag);
  1818. /**
  1819. * @brief Processing function for the floating-point CFFT/CIFFT.
  1820. * @param[in] *S points to an instance of the floating-point CFFT/CIFFT structure.
  1821. * @param[in, out] *pSrc points to the complex data buffer. Processing occurs in-place.
  1822. * @return none.
  1823. */
  1824. void arm_cfft_radix4_f32(
  1825. const arm_cfft_radix4_instance_f32 * S,
  1826. float32_t * pSrc);
  1827. /**
  1828. * @brief Initialization function for the floating-point CFFT/CIFFT.
  1829. * @param[in,out] *S points to an instance of the floating-point CFFT/CIFFT structure.
  1830. * @param[in] fftLen length of the FFT.
  1831. * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
  1832. * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
  1833. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLen</code> is not a supported value.
  1834. */
  1835. arm_status arm_cfft_radix4_init_f32(
  1836. arm_cfft_radix4_instance_f32 * S,
  1837. uint16_t fftLen,
  1838. uint8_t ifftFlag,
  1839. uint8_t bitReverseFlag);
  1840. /*----------------------------------------------------------------------
  1841. * Internal functions prototypes FFT function
  1842. ----------------------------------------------------------------------*/
  1843. /**
  1844. * @brief Core function for the floating-point CFFT butterfly process.
  1845. * @param[in, out] *pSrc points to the in-place buffer of floating-point data type.
  1846. * @param[in] fftLen length of the FFT.
  1847. * @param[in] *pCoef points to the twiddle coefficient buffer.
  1848. * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
  1849. * @return none.
  1850. */
  1851. void arm_radix4_butterfly_f32(
  1852. float32_t * pSrc,
  1853. uint16_t fftLen,
  1854. float32_t * pCoef,
  1855. uint16_t twidCoefModifier);
  1856. /**
  1857. * @brief Core function for the floating-point CIFFT butterfly process.
  1858. * @param[in, out] *pSrc points to the in-place buffer of floating-point data type.
  1859. * @param[in] fftLen length of the FFT.
  1860. * @param[in] *pCoef points to twiddle coefficient buffer.
  1861. * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
  1862. * @param[in] onebyfftLen value of 1/fftLen.
  1863. * @return none.
  1864. */
  1865. void arm_radix4_butterfly_inverse_f32(
  1866. float32_t * pSrc,
  1867. uint16_t fftLen,
  1868. float32_t * pCoef,
  1869. uint16_t twidCoefModifier,
  1870. float32_t onebyfftLen);
  1871. /**
  1872. * @brief In-place bit reversal function.
  1873. * @param[in, out] *pSrc points to the in-place buffer of floating-point data type.
  1874. * @param[in] fftSize length of the FFT.
  1875. * @param[in] bitRevFactor bit reversal modifier that supports different size FFTs with the same bit reversal table.
  1876. * @param[in] *pBitRevTab points to the bit reversal table.
  1877. * @return none.
  1878. */
  1879. void arm_bitreversal_f32(
  1880. float32_t * pSrc,
  1881. uint16_t fftSize,
  1882. uint16_t bitRevFactor,
  1883. uint16_t * pBitRevTab);
  1884. /**
  1885. * @brief Core function for the Q31 CFFT butterfly process.
  1886. * @param[in, out] *pSrc points to the in-place buffer of Q31 data type.
  1887. * @param[in] fftLen length of the FFT.
  1888. * @param[in] *pCoef points to Twiddle coefficient buffer.
  1889. * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
  1890. * @return none.
  1891. */
  1892. void arm_radix4_butterfly_q31(
  1893. q31_t * pSrc,
  1894. uint32_t fftLen,
  1895. q31_t * pCoef,
  1896. uint32_t twidCoefModifier);
  1897. /**
  1898. * @brief Core function for the f32 FFT butterfly process.
  1899. * @param[in, out] *pSrc points to the in-place buffer of f32 data type.
  1900. * @param[in] fftLen length of the FFT.
  1901. * @param[in] *pCoef points to Twiddle coefficient buffer.
  1902. * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
  1903. * @return none.
  1904. */
  1905. void arm_radix2_butterfly_f32(
  1906. float32_t * pSrc,
  1907. uint32_t fftLen,
  1908. float32_t * pCoef,
  1909. uint16_t twidCoefModifier);
  1910. /**
  1911. * @brief Core function for the Radix-2 Q31 CFFT butterfly process.
  1912. * @param[in, out] *pSrc points to the in-place buffer of Q31 data type.
  1913. * @param[in] fftLen length of the FFT.
  1914. * @param[in] *pCoef points to Twiddle coefficient buffer.
  1915. * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
  1916. * @return none.
  1917. */
  1918. void arm_radix2_butterfly_q31(
  1919. q31_t * pSrc,
  1920. uint32_t fftLen,
  1921. q31_t * pCoef,
  1922. uint16_t twidCoefModifier);
  1923. /**
  1924. * @brief Core function for the Radix-2 Q15 CFFT butterfly process.
  1925. * @param[in, out] *pSrc points to the in-place buffer of Q15 data type.
  1926. * @param[in] fftLen length of the FFT.
  1927. * @param[in] *pCoef points to Twiddle coefficient buffer.
  1928. * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
  1929. * @return none.
  1930. */
  1931. void arm_radix2_butterfly_q15(
  1932. q15_t * pSrc,
  1933. uint32_t fftLen,
  1934. q15_t * pCoef,
  1935. uint16_t twidCoefModifier);
  1936. /**
  1937. * @brief Core function for the Radix-2 Q15 CFFT Inverse butterfly process.
  1938. * @param[in, out] *pSrc points to the in-place buffer of Q15 data type.
  1939. * @param[in] fftLen length of the FFT.
  1940. * @param[in] *pCoef points to Twiddle coefficient buffer.
  1941. * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
  1942. * @return none.
  1943. */
  1944. void arm_radix2_butterfly_inverse_q15(
  1945. q15_t * pSrc,
  1946. uint32_t fftLen,
  1947. q15_t * pCoef,
  1948. uint16_t twidCoefModifier);
  1949. /**
  1950. * @brief Core function for the Radix-2 Q31 CFFT Inverse butterfly process.
  1951. * @param[in, out] *pSrc points to the in-place buffer of Q31 data type.
  1952. * @param[in] fftLen length of the FFT.
  1953. * @param[in] *pCoef points to Twiddle coefficient buffer.
  1954. * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
  1955. * @return none.
  1956. */
  1957. void arm_radix2_butterfly_inverse_q31(
  1958. q31_t * pSrc,
  1959. uint32_t fftLen,
  1960. q31_t * pCoef,
  1961. uint16_t twidCoefModifier);
  1962. /**
  1963. * @brief Core function for the f32 IFFT butterfly process.
  1964. * @param[in, out] *pSrc points to the in-place buffer of f32 data type.
  1965. * @param[in] fftLen length of the FFT.
  1966. * @param[in] *pCoef points to Twiddle coefficient buffer.
  1967. * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
  1968. * @param[in] onebyfftLen 1/fftLenfth
  1969. * @return none.
  1970. */
  1971. void arm_radix2_butterfly_inverse_f32(
  1972. float32_t * pSrc,
  1973. uint32_t fftLen,
  1974. float32_t * pCoef,
  1975. uint16_t twidCoefModifier,
  1976. float32_t onebyfftLen);
  1977. /**
  1978. * @brief Core function for the Q31 CIFFT butterfly process.
  1979. * @param[in, out] *pSrc points to the in-place buffer of Q31 data type.
  1980. * @param[in] fftLen length of the FFT.
  1981. * @param[in] *pCoef points to twiddle coefficient buffer.
  1982. * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
  1983. * @return none.
  1984. */
  1985. void arm_radix4_butterfly_inverse_q31(
  1986. q31_t * pSrc,
  1987. uint32_t fftLen,
  1988. q31_t * pCoef,
  1989. uint32_t twidCoefModifier);
  1990. /**
  1991. * @brief In-place bit reversal function.
  1992. * @param[in, out] *pSrc points to the in-place buffer of Q31 data type.
  1993. * @param[in] fftLen length of the FFT.
  1994. * @param[in] bitRevFactor bit reversal modifier that supports different size FFTs with the same bit reversal table
  1995. * @param[in] *pBitRevTab points to bit reversal table.
  1996. * @return none.
  1997. */
  1998. void arm_bitreversal_q31(
  1999. q31_t * pSrc,
  2000. uint32_t fftLen,
  2001. uint16_t bitRevFactor,
  2002. uint16_t * pBitRevTab);
  2003. /**
  2004. * @brief Core function for the Q15 CFFT butterfly process.
  2005. * @param[in, out] *pSrc16 points to the in-place buffer of Q15 data type.
  2006. * @param[in] fftLen length of the FFT.
  2007. * @param[in] *pCoef16 points to twiddle coefficient buffer.
  2008. * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
  2009. * @return none.
  2010. */
  2011. void arm_radix4_butterfly_q15(
  2012. q15_t * pSrc16,
  2013. uint32_t fftLen,
  2014. q15_t * pCoef16,
  2015. uint32_t twidCoefModifier);
  2016. /**
  2017. * @brief Core function for the Q15 CIFFT butterfly process.
  2018. * @param[in, out] *pSrc16 points to the in-place buffer of Q15 data type.
  2019. * @param[in] fftLen length of the FFT.
  2020. * @param[in] *pCoef16 points to twiddle coefficient buffer.
  2021. * @param[in] twidCoefModifier twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table.
  2022. * @return none.
  2023. */
  2024. void arm_radix4_butterfly_inverse_q15(
  2025. q15_t * pSrc16,
  2026. uint32_t fftLen,
  2027. q15_t * pCoef16,
  2028. uint32_t twidCoefModifier);
  2029. /**
  2030. * @brief In-place bit reversal function.
  2031. * @param[in, out] *pSrc points to the in-place buffer of Q15 data type.
  2032. * @param[in] fftLen length of the FFT.
  2033. * @param[in] bitRevFactor bit reversal modifier that supports different size FFTs with the same bit reversal table
  2034. * @param[in] *pBitRevTab points to bit reversal table.
  2035. * @return none.
  2036. */
  2037. void arm_bitreversal_q15(
  2038. q15_t * pSrc,
  2039. uint32_t fftLen,
  2040. uint16_t bitRevFactor,
  2041. uint16_t * pBitRevTab);
  2042. /**
  2043. * @brief Instance structure for the Q15 RFFT/RIFFT function.
  2044. */
  2045. typedef struct
  2046. {
  2047. uint32_t fftLenReal; /**< length of the real FFT. */
  2048. uint32_t fftLenBy2; /**< length of the complex FFT. */
  2049. uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
  2050. uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
  2051. uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  2052. q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
  2053. q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
  2054. arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
  2055. } arm_rfft_instance_q15;
  2056. /**
  2057. * @brief Instance structure for the Q31 RFFT/RIFFT function.
  2058. */
  2059. typedef struct
  2060. {
  2061. uint32_t fftLenReal; /**< length of the real FFT. */
  2062. uint32_t fftLenBy2; /**< length of the complex FFT. */
  2063. uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
  2064. uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
  2065. uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  2066. q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
  2067. q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
  2068. arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
  2069. } arm_rfft_instance_q31;
  2070. /**
  2071. * @brief Instance structure for the floating-point RFFT/RIFFT function.
  2072. */
  2073. typedef struct
  2074. {
  2075. uint32_t fftLenReal; /**< length of the real FFT. */
  2076. uint16_t fftLenBy2; /**< length of the complex FFT. */
  2077. uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
  2078. uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
  2079. uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
  2080. float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
  2081. float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
  2082. arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
  2083. } arm_rfft_instance_f32;
  2084. /**
  2085. * @brief Processing function for the Q15 RFFT/RIFFT.
  2086. * @param[in] *S points to an instance of the Q15 RFFT/RIFFT structure.
  2087. * @param[in] *pSrc points to the input buffer.
  2088. * @param[out] *pDst points to the output buffer.
  2089. * @return none.
  2090. */
  2091. void arm_rfft_q15(
  2092. const arm_rfft_instance_q15 * S,
  2093. q15_t * pSrc,
  2094. q15_t * pDst);
  2095. /**
  2096. * @brief Initialization function for the Q15 RFFT/RIFFT.
  2097. * @param[in, out] *S points to an instance of the Q15 RFFT/RIFFT structure.
  2098. * @param[in] *S_CFFT points to an instance of the Q15 CFFT/CIFFT structure.
  2099. * @param[in] fftLenReal length of the FFT.
  2100. * @param[in] ifftFlagR flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform.
  2101. * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
  2102. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported value.
  2103. */
  2104. arm_status arm_rfft_init_q15(
  2105. arm_rfft_instance_q15 * S,
  2106. arm_cfft_radix4_instance_q15 * S_CFFT,
  2107. uint32_t fftLenReal,
  2108. uint32_t ifftFlagR,
  2109. uint32_t bitReverseFlag);
  2110. /**
  2111. * @brief Processing function for the Q31 RFFT/RIFFT.
  2112. * @param[in] *S points to an instance of the Q31 RFFT/RIFFT structure.
  2113. * @param[in] *pSrc points to the input buffer.
  2114. * @param[out] *pDst points to the output buffer.
  2115. * @return none.
  2116. */
  2117. void arm_rfft_q31(
  2118. const arm_rfft_instance_q31 * S,
  2119. q31_t * pSrc,
  2120. q31_t * pDst);
  2121. /**
  2122. * @brief Initialization function for the Q31 RFFT/RIFFT.
  2123. * @param[in, out] *S points to an instance of the Q31 RFFT/RIFFT structure.
  2124. * @param[in, out] *S_CFFT points to an instance of the Q31 CFFT/CIFFT structure.
  2125. * @param[in] fftLenReal length of the FFT.
  2126. * @param[in] ifftFlagR flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform.
  2127. * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
  2128. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported value.
  2129. */
  2130. arm_status arm_rfft_init_q31(
  2131. arm_rfft_instance_q31 * S,
  2132. arm_cfft_radix4_instance_q31 * S_CFFT,
  2133. uint32_t fftLenReal,
  2134. uint32_t ifftFlagR,
  2135. uint32_t bitReverseFlag);
  2136. /**
  2137. * @brief Initialization function for the floating-point RFFT/RIFFT.
  2138. * @param[in,out] *S points to an instance of the floating-point RFFT/RIFFT structure.
  2139. * @param[in,out] *S_CFFT points to an instance of the floating-point CFFT/CIFFT structure.
  2140. * @param[in] fftLenReal length of the FFT.
  2141. * @param[in] ifftFlagR flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform.
  2142. * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
  2143. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported value.
  2144. */
  2145. arm_status arm_rfft_init_f32(
  2146. arm_rfft_instance_f32 * S,
  2147. arm_cfft_radix4_instance_f32 * S_CFFT,
  2148. uint32_t fftLenReal,
  2149. uint32_t ifftFlagR,
  2150. uint32_t bitReverseFlag);
  2151. /**
  2152. * @brief Processing function for the floating-point RFFT/RIFFT.
  2153. * @param[in] *S points to an instance of the floating-point RFFT/RIFFT structure.
  2154. * @param[in] *pSrc points to the input buffer.
  2155. * @param[out] *pDst points to the output buffer.
  2156. * @return none.
  2157. */
  2158. void arm_rfft_f32(
  2159. const arm_rfft_instance_f32 * S,
  2160. float32_t * pSrc,
  2161. float32_t * pDst);
  2162. /**
  2163. * @brief Instance structure for the floating-point DCT4/IDCT4 function.
  2164. */
  2165. typedef struct
  2166. {
  2167. uint16_t N; /**< length of the DCT4. */
  2168. uint16_t Nby2; /**< half of the length of the DCT4. */
  2169. float32_t normalize; /**< normalizing factor. */
  2170. float32_t *pTwiddle; /**< points to the twiddle factor table. */
  2171. float32_t *pCosFactor; /**< points to the cosFactor table. */
  2172. arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
  2173. arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
  2174. } arm_dct4_instance_f32;
  2175. /**
  2176. * @brief Initialization function for the floating-point DCT4/IDCT4.
  2177. * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure.
  2178. * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
  2179. * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
  2180. * @param[in] N length of the DCT4.
  2181. * @param[in] Nby2 half of the length of the DCT4.
  2182. * @param[in] normalize normalizing factor.
  2183. * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported transform length.
  2184. */
  2185. arm_status arm_dct4_init_f32(
  2186. arm_dct4_instance_f32 * S,
  2187. arm_rfft_instance_f32 * S_RFFT,
  2188. arm_cfft_radix4_instance_f32 * S_CFFT,
  2189. uint16_t N,
  2190. uint16_t Nby2,
  2191. float32_t normalize);
  2192. /**
  2193. * @brief Processing function for the floating-point DCT4/IDCT4.
  2194. * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure.
  2195. * @param[in] *pState points to state buffer.
  2196. * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
  2197. * @return none.
  2198. */
  2199. void arm_dct4_f32(
  2200. const arm_dct4_instance_f32 * S,
  2201. float32_t * pState,
  2202. float32_t * pInlineBuffer);
  2203. /**
  2204. * @brief Instance structure for the Q31 DCT4/IDCT4 function.
  2205. */
  2206. typedef struct
  2207. {
  2208. uint16_t N; /**< length of the DCT4. */
  2209. uint16_t Nby2; /**< half of the length of the DCT4. */
  2210. q31_t normalize; /**< normalizing factor. */
  2211. q31_t *pTwiddle; /**< points to the twiddle factor table. */
  2212. q31_t *pCosFactor; /**< points to the cosFactor table. */
  2213. arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
  2214. arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
  2215. } arm_dct4_instance_q31;
  2216. /**
  2217. * @brief Initialization function for the Q31 DCT4/IDCT4.
  2218. * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure.
  2219. * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure
  2220. * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure
  2221. * @param[in] N length of the DCT4.
  2222. * @param[in] Nby2 half of the length of the DCT4.
  2223. * @param[in] normalize normalizing factor.
  2224. * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.
  2225. */
  2226. arm_status arm_dct4_init_q31(
  2227. arm_dct4_instance_q31 * S,
  2228. arm_rfft_instance_q31 * S_RFFT,
  2229. arm_cfft_radix4_instance_q31 * S_CFFT,
  2230. uint16_t N,
  2231. uint16_t Nby2,
  2232. q31_t normalize);
  2233. /**
  2234. * @brief Processing function for the Q31 DCT4/IDCT4.
  2235. * @param[in] *S points to an instance of the Q31 DCT4 structure.
  2236. * @param[in] *pState points to state buffer.
  2237. * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
  2238. * @return none.
  2239. */
  2240. void arm_dct4_q31(
  2241. const arm_dct4_instance_q31 * S,
  2242. q31_t * pState,
  2243. q31_t * pInlineBuffer);
  2244. /**
  2245. * @brief Instance structure for the Q15 DCT4/IDCT4 function.
  2246. */
  2247. typedef struct
  2248. {
  2249. uint16_t N; /**< length of the DCT4. */
  2250. uint16_t Nby2; /**< half of the length of the DCT4. */
  2251. q15_t normalize; /**< normalizing factor. */
  2252. q15_t *pTwiddle; /**< points to the twiddle factor table. */
  2253. q15_t *pCosFactor; /**< points to the cosFactor table. */
  2254. arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
  2255. arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
  2256. } arm_dct4_instance_q15;
  2257. /**
  2258. * @brief Initialization function for the Q15 DCT4/IDCT4.
  2259. * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure.
  2260. * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
  2261. * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
  2262. * @param[in] N length of the DCT4.
  2263. * @param[in] Nby2 half of the length of the DCT4.
  2264. * @param[in] normalize normalizing factor.
  2265. * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.
  2266. */
  2267. arm_status arm_dct4_init_q15(
  2268. arm_dct4_instance_q15 * S,
  2269. arm_rfft_instance_q15 * S_RFFT,
  2270. arm_cfft_radix4_instance_q15 * S_CFFT,
  2271. uint16_t N,
  2272. uint16_t Nby2,
  2273. q15_t normalize);
  2274. /**
  2275. * @brief Processing function for the Q15 DCT4/IDCT4.
  2276. * @param[in] *S points to an instance of the Q15 DCT4 structure.
  2277. * @param[in] *pState points to state buffer.
  2278. * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
  2279. * @return none.
  2280. */
  2281. void arm_dct4_q15(
  2282. const arm_dct4_instance_q15 * S,
  2283. q15_t * pState,
  2284. q15_t * pInlineBuffer);
  2285. /**
  2286. * @brief Floating-point vector addition.
  2287. * @param[in] *pSrcA points to the first input vector
  2288. * @param[in] *pSrcB points to the second input vector
  2289. * @param[out] *pDst points to the output vector
  2290. * @param[in] blockSize number of samples in each vector
  2291. * @return none.
  2292. */
  2293. void arm_add_f32(
  2294. float32_t * pSrcA,
  2295. float32_t * pSrcB,
  2296. float32_t * pDst,
  2297. uint32_t blockSize);
  2298. /**
  2299. * @brief Q7 vector addition.
  2300. * @param[in] *pSrcA points to the first input vector
  2301. * @param[in] *pSrcB points to the second input vector
  2302. * @param[out] *pDst points to the output vector
  2303. * @param[in] blockSize number of samples in each vector
  2304. * @return none.
  2305. */
  2306. void arm_add_q7(
  2307. q7_t * pSrcA,
  2308. q7_t * pSrcB,
  2309. q7_t * pDst,
  2310. uint32_t blockSize);
  2311. /**
  2312. * @brief Q15 vector addition.
  2313. * @param[in] *pSrcA points to the first input vector
  2314. * @param[in] *pSrcB points to the second input vector
  2315. * @param[out] *pDst points to the output vector
  2316. * @param[in] blockSize number of samples in each vector
  2317. * @return none.
  2318. */
  2319. void arm_add_q15(
  2320. q15_t * pSrcA,
  2321. q15_t * pSrcB,
  2322. q15_t * pDst,
  2323. uint32_t blockSize);
  2324. /**
  2325. * @brief Q31 vector addition.
  2326. * @param[in] *pSrcA points to the first input vector
  2327. * @param[in] *pSrcB points to the second input vector
  2328. * @param[out] *pDst points to the output vector
  2329. * @param[in] blockSize number of samples in each vector
  2330. * @return none.
  2331. */
  2332. void arm_add_q31(
  2333. q31_t * pSrcA,
  2334. q31_t * pSrcB,
  2335. q31_t * pDst,
  2336. uint32_t blockSize);
  2337. /**
  2338. * @brief Floating-point vector subtraction.
  2339. * @param[in] *pSrcA points to the first input vector
  2340. * @param[in] *pSrcB points to the second input vector
  2341. * @param[out] *pDst points to the output vector
  2342. * @param[in] blockSize number of samples in each vector
  2343. * @return none.
  2344. */
  2345. void arm_sub_f32(
  2346. float32_t * pSrcA,
  2347. float32_t * pSrcB,
  2348. float32_t * pDst,
  2349. uint32_t blockSize);
  2350. /**
  2351. * @brief Q7 vector subtraction.
  2352. * @param[in] *pSrcA points to the first input vector
  2353. * @param[in] *pSrcB points to the second input vector
  2354. * @param[out] *pDst points to the output vector
  2355. * @param[in] blockSize number of samples in each vector
  2356. * @return none.
  2357. */
  2358. void arm_sub_q7(
  2359. q7_t * pSrcA,
  2360. q7_t * pSrcB,
  2361. q7_t * pDst,
  2362. uint32_t blockSize);
  2363. /**
  2364. * @brief Q15 vector subtraction.
  2365. * @param[in] *pSrcA points to the first input vector
  2366. * @param[in] *pSrcB points to the second input vector
  2367. * @param[out] *pDst points to the output vector
  2368. * @param[in] blockSize number of samples in each vector
  2369. * @return none.
  2370. */
  2371. void arm_sub_q15(
  2372. q15_t * pSrcA,
  2373. q15_t * pSrcB,
  2374. q15_t * pDst,
  2375. uint32_t blockSize);
  2376. /**
  2377. * @brief Q31 vector subtraction.
  2378. * @param[in] *pSrcA points to the first input vector
  2379. * @param[in] *pSrcB points to the second input vector
  2380. * @param[out] *pDst points to the output vector
  2381. * @param[in] blockSize number of samples in each vector
  2382. * @return none.
  2383. */
  2384. void arm_sub_q31(
  2385. q31_t * pSrcA,
  2386. q31_t * pSrcB,
  2387. q31_t * pDst,
  2388. uint32_t blockSize);
  2389. /**
  2390. * @brief Multiplies a floating-point vector by a scalar.
  2391. * @param[in] *pSrc points to the input vector
  2392. * @param[in] scale scale factor to be applied
  2393. * @param[out] *pDst points to the output vector
  2394. * @param[in] blockSize number of samples in the vector
  2395. * @return none.
  2396. */
  2397. void arm_scale_f32(
  2398. float32_t * pSrc,
  2399. float32_t scale,
  2400. float32_t * pDst,
  2401. uint32_t blockSize);
  2402. /**
  2403. * @brief Multiplies a Q7 vector by a scalar.
  2404. * @param[in] *pSrc points to the input vector
  2405. * @param[in] scaleFract fractional portion of the scale value
  2406. * @param[in] shift number of bits to shift the result by
  2407. * @param[out] *pDst points to the output vector
  2408. * @param[in] blockSize number of samples in the vector
  2409. * @return none.
  2410. */
  2411. void arm_scale_q7(
  2412. q7_t * pSrc,
  2413. q7_t scaleFract,
  2414. int8_t shift,
  2415. q7_t * pDst,
  2416. uint32_t blockSize);
  2417. /**
  2418. * @brief Multiplies a Q15 vector by a scalar.
  2419. * @param[in] *pSrc points to the input vector
  2420. * @param[in] scaleFract fractional portion of the scale value
  2421. * @param[in] shift number of bits to shift the result by
  2422. * @param[out] *pDst points to the output vector
  2423. * @param[in] blockSize number of samples in the vector
  2424. * @return none.
  2425. */
  2426. void arm_scale_q15(
  2427. q15_t * pSrc,
  2428. q15_t scaleFract,
  2429. int8_t shift,
  2430. q15_t * pDst,
  2431. uint32_t blockSize);
  2432. /**
  2433. * @brief Multiplies a Q31 vector by a scalar.
  2434. * @param[in] *pSrc points to the input vector
  2435. * @param[in] scaleFract fractional portion of the scale value
  2436. * @param[in] shift number of bits to shift the result by
  2437. * @param[out] *pDst points to the output vector
  2438. * @param[in] blockSize number of samples in the vector
  2439. * @return none.
  2440. */
  2441. void arm_scale_q31(
  2442. q31_t * pSrc,
  2443. q31_t scaleFract,
  2444. int8_t shift,
  2445. q31_t * pDst,
  2446. uint32_t blockSize);
  2447. /**
  2448. * @brief Q7 vector absolute value.
  2449. * @param[in] *pSrc points to the input buffer
  2450. * @param[out] *pDst points to the output buffer
  2451. * @param[in] blockSize number of samples in each vector
  2452. * @return none.
  2453. */
  2454. void arm_abs_q7(
  2455. q7_t * pSrc,
  2456. q7_t * pDst,
  2457. uint32_t blockSize);
  2458. /**
  2459. * @brief Floating-point vector absolute value.
  2460. * @param[in] *pSrc points to the input buffer
  2461. * @param[out] *pDst points to the output buffer
  2462. * @param[in] blockSize number of samples in each vector
  2463. * @return none.
  2464. */
  2465. void arm_abs_f32(
  2466. float32_t * pSrc,
  2467. float32_t * pDst,
  2468. uint32_t blockSize);
  2469. /**
  2470. * @brief Q15 vector absolute value.
  2471. * @param[in] *pSrc points to the input buffer
  2472. * @param[out] *pDst points to the output buffer
  2473. * @param[in] blockSize number of samples in each vector
  2474. * @return none.
  2475. */
  2476. void arm_abs_q15(
  2477. q15_t * pSrc,
  2478. q15_t * pDst,
  2479. uint32_t blockSize);
  2480. /**
  2481. * @brief Q31 vector absolute value.
  2482. * @param[in] *pSrc points to the input buffer
  2483. * @param[out] *pDst points to the output buffer
  2484. * @param[in] blockSize number of samples in each vector
  2485. * @return none.
  2486. */
  2487. void arm_abs_q31(
  2488. q31_t * pSrc,
  2489. q31_t * pDst,
  2490. uint32_t blockSize);
  2491. /**
  2492. * @brief Dot product of floating-point vectors.
  2493. * @param[in] *pSrcA points to the first input vector
  2494. * @param[in] *pSrcB points to the second input vector
  2495. * @param[in] blockSize number of samples in each vector
  2496. * @param[out] *result output result returned here
  2497. * @return none.
  2498. */
  2499. void arm_dot_prod_f32(
  2500. float32_t * pSrcA,
  2501. float32_t * pSrcB,
  2502. uint32_t blockSize,
  2503. float32_t * result);
  2504. /**
  2505. * @brief Dot product of Q7 vectors.
  2506. * @param[in] *pSrcA points to the first input vector
  2507. * @param[in] *pSrcB points to the second input vector
  2508. * @param[in] blockSize number of samples in each vector
  2509. * @param[out] *result output result returned here
  2510. * @return none.
  2511. */
  2512. void arm_dot_prod_q7(
  2513. q7_t * pSrcA,
  2514. q7_t * pSrcB,
  2515. uint32_t blockSize,
  2516. q31_t * result);
  2517. /**
  2518. * @brief Dot product of Q15 vectors.
  2519. * @param[in] *pSrcA points to the first input vector
  2520. * @param[in] *pSrcB points to the second input vector
  2521. * @param[in] blockSize number of samples in each vector
  2522. * @param[out] *result output result returned here
  2523. * @return none.
  2524. */
  2525. void arm_dot_prod_q15(
  2526. q15_t * pSrcA,
  2527. q15_t * pSrcB,
  2528. uint32_t blockSize,
  2529. q63_t * result);
  2530. /**
  2531. * @brief Dot product of Q31 vectors.
  2532. * @param[in] *pSrcA points to the first input vector
  2533. * @param[in] *pSrcB points to the second input vector
  2534. * @param[in] blockSize number of samples in each vector
  2535. * @param[out] *result output result returned here
  2536. * @return none.
  2537. */
  2538. void arm_dot_prod_q31(
  2539. q31_t * pSrcA,
  2540. q31_t * pSrcB,
  2541. uint32_t blockSize,
  2542. q63_t * result);
  2543. /**
  2544. * @brief Shifts the elements of a Q7 vector a specified number of bits.
  2545. * @param[in] *pSrc points to the input vector
  2546. * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
  2547. * @param[out] *pDst points to the output vector
  2548. * @param[in] blockSize number of samples in the vector
  2549. * @return none.
  2550. */
  2551. void arm_shift_q7(
  2552. q7_t * pSrc,
  2553. int8_t shiftBits,
  2554. q7_t * pDst,
  2555. uint32_t blockSize);
  2556. /**
  2557. * @brief Shifts the elements of a Q15 vector a specified number of bits.
  2558. * @param[in] *pSrc points to the input vector
  2559. * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
  2560. * @param[out] *pDst points to the output vector
  2561. * @param[in] blockSize number of samples in the vector
  2562. * @return none.
  2563. */
  2564. void arm_shift_q15(
  2565. q15_t * pSrc,
  2566. int8_t shiftBits,
  2567. q15_t * pDst,
  2568. uint32_t blockSize);
  2569. /**
  2570. * @brief Shifts the elements of a Q31 vector a specified number of bits.
  2571. * @param[in] *pSrc points to the input vector
  2572. * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
  2573. * @param[out] *pDst points to the output vector
  2574. * @param[in] blockSize number of samples in the vector
  2575. * @return none.
  2576. */
  2577. void arm_shift_q31(
  2578. q31_t * pSrc,
  2579. int8_t shiftBits,
  2580. q31_t * pDst,
  2581. uint32_t blockSize);
  2582. /**
  2583. * @brief Adds a constant offset to a floating-point vector.
  2584. * @param[in] *pSrc points to the input vector
  2585. * @param[in] offset is the offset to be added
  2586. * @param[out] *pDst points to the output vector
  2587. * @param[in] blockSize number of samples in the vector
  2588. * @return none.
  2589. */
  2590. void arm_offset_f32(
  2591. float32_t * pSrc,
  2592. float32_t offset,
  2593. float32_t * pDst,
  2594. uint32_t blockSize);
  2595. /**
  2596. * @brief Adds a constant offset to a Q7 vector.
  2597. * @param[in] *pSrc points to the input vector
  2598. * @param[in] offset is the offset to be added
  2599. * @param[out] *pDst points to the output vector
  2600. * @param[in] blockSize number of samples in the vector
  2601. * @return none.
  2602. */
  2603. void arm_offset_q7(
  2604. q7_t * pSrc,
  2605. q7_t offset,
  2606. q7_t * pDst,
  2607. uint32_t blockSize);
  2608. /**
  2609. * @brief Adds a constant offset to a Q15 vector.
  2610. * @param[in] *pSrc points to the input vector
  2611. * @param[in] offset is the offset to be added
  2612. * @param[out] *pDst points to the output vector
  2613. * @param[in] blockSize number of samples in the vector
  2614. * @return none.
  2615. */
  2616. void arm_offset_q15(
  2617. q15_t * pSrc,
  2618. q15_t offset,
  2619. q15_t * pDst,
  2620. uint32_t blockSize);
  2621. /**
  2622. * @brief Adds a constant offset to a Q31 vector.
  2623. * @param[in] *pSrc points to the input vector
  2624. * @param[in] offset is the offset to be added
  2625. * @param[out] *pDst points to the output vector
  2626. * @param[in] blockSize number of samples in the vector
  2627. * @return none.
  2628. */
  2629. void arm_offset_q31(
  2630. q31_t * pSrc,
  2631. q31_t offset,
  2632. q31_t * pDst,
  2633. uint32_t blockSize);
  2634. /**
  2635. * @brief Negates the elements of a floating-point vector.
  2636. * @param[in] *pSrc points to the input vector
  2637. * @param[out] *pDst points to the output vector
  2638. * @param[in] blockSize number of samples in the vector
  2639. * @return none.
  2640. */
  2641. void arm_negate_f32(
  2642. float32_t * pSrc,
  2643. float32_t * pDst,
  2644. uint32_t blockSize);
  2645. /**
  2646. * @brief Negates the elements of a Q7 vector.
  2647. * @param[in] *pSrc points to the input vector
  2648. * @param[out] *pDst points to the output vector
  2649. * @param[in] blockSize number of samples in the vector
  2650. * @return none.
  2651. */
  2652. void arm_negate_q7(
  2653. q7_t * pSrc,
  2654. q7_t * pDst,
  2655. uint32_t blockSize);
  2656. /**
  2657. * @brief Negates the elements of a Q15 vector.
  2658. * @param[in] *pSrc points to the input vector
  2659. * @param[out] *pDst points to the output vector
  2660. * @param[in] blockSize number of samples in the vector
  2661. * @return none.
  2662. */
  2663. void arm_negate_q15(
  2664. q15_t * pSrc,
  2665. q15_t * pDst,
  2666. uint32_t blockSize);
  2667. /**
  2668. * @brief Negates the elements of a Q31 vector.
  2669. * @param[in] *pSrc points to the input vector
  2670. * @param[out] *pDst points to the output vector
  2671. * @param[in] blockSize number of samples in the vector
  2672. * @return none.
  2673. */
  2674. void arm_negate_q31(
  2675. q31_t * pSrc,
  2676. q31_t * pDst,
  2677. uint32_t blockSize);
  2678. /**
  2679. * @brief Copies the elements of a floating-point vector.
  2680. * @param[in] *pSrc input pointer
  2681. * @param[out] *pDst output pointer
  2682. * @param[in] blockSize number of samples to process
  2683. * @return none.
  2684. */
  2685. void arm_copy_f32(
  2686. float32_t * pSrc,
  2687. float32_t * pDst,
  2688. uint32_t blockSize);
  2689. /**
  2690. * @brief Copies the elements of a Q7 vector.
  2691. * @param[in] *pSrc input pointer
  2692. * @param[out] *pDst output pointer
  2693. * @param[in] blockSize number of samples to process
  2694. * @return none.
  2695. */
  2696. void arm_copy_q7(
  2697. q7_t * pSrc,
  2698. q7_t * pDst,
  2699. uint32_t blockSize);
  2700. /**
  2701. * @brief Copies the elements of a Q15 vector.
  2702. * @param[in] *pSrc input pointer
  2703. * @param[out] *pDst output pointer
  2704. * @param[in] blockSize number of samples to process
  2705. * @return none.
  2706. */
  2707. void arm_copy_q15(
  2708. q15_t * pSrc,
  2709. q15_t * pDst,
  2710. uint32_t blockSize);
  2711. /**
  2712. * @brief Copies the elements of a Q31 vector.
  2713. * @param[in] *pSrc input pointer
  2714. * @param[out] *pDst output pointer
  2715. * @param[in] blockSize number of samples to process
  2716. * @return none.
  2717. */
  2718. void arm_copy_q31(
  2719. q31_t * pSrc,
  2720. q31_t * pDst,
  2721. uint32_t blockSize);
  2722. /**
  2723. * @brief Fills a constant value into a floating-point vector.
  2724. * @param[in] value input value to be filled
  2725. * @param[out] *pDst output pointer
  2726. * @param[in] blockSize number of samples to process
  2727. * @return none.
  2728. */
  2729. void arm_fill_f32(
  2730. float32_t value,
  2731. float32_t * pDst,
  2732. uint32_t blockSize);
  2733. /**
  2734. * @brief Fills a constant value into a Q7 vector.
  2735. * @param[in] value input value to be filled
  2736. * @param[out] *pDst output pointer
  2737. * @param[in] blockSize number of samples to process
  2738. * @return none.
  2739. */
  2740. void arm_fill_q7(
  2741. q7_t value,
  2742. q7_t * pDst,
  2743. uint32_t blockSize);
  2744. /**
  2745. * @brief Fills a constant value into a Q15 vector.
  2746. * @param[in] value input value to be filled
  2747. * @param[out] *pDst output pointer
  2748. * @param[in] blockSize number of samples to process
  2749. * @return none.
  2750. */
  2751. void arm_fill_q15(
  2752. q15_t value,
  2753. q15_t * pDst,
  2754. uint32_t blockSize);
  2755. /**
  2756. * @brief Fills a constant value into a Q31 vector.
  2757. * @param[in] value input value to be filled
  2758. * @param[out] *pDst output pointer
  2759. * @param[in] blockSize number of samples to process
  2760. * @return none.
  2761. */
  2762. void arm_fill_q31(
  2763. q31_t value,
  2764. q31_t * pDst,
  2765. uint32_t blockSize);
  2766. /**
  2767. * @brief Convolution of floating-point sequences.
  2768. * @param[in] *pSrcA points to the first input sequence.
  2769. * @param[in] srcALen length of the first input sequence.
  2770. * @param[in] *pSrcB points to the second input sequence.
  2771. * @param[in] srcBLen length of the second input sequence.
  2772. * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
  2773. * @return none.
  2774. */
  2775. void arm_conv_f32(
  2776. float32_t * pSrcA,
  2777. uint32_t srcALen,
  2778. float32_t * pSrcB,
  2779. uint32_t srcBLen,
  2780. float32_t * pDst);
  2781. /**
  2782. * @brief Convolution of Q15 sequences.
  2783. * @param[in] *pSrcA points to the first input sequence.
  2784. * @param[in] srcALen length of the first input sequence.
  2785. * @param[in] *pSrcB points to the second input sequence.
  2786. * @param[in] srcBLen length of the second input sequence.
  2787. * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
  2788. * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  2789. * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
  2790. * @return none.
  2791. */
  2792. void arm_conv_opt_q15(
  2793. q15_t * pSrcA,
  2794. uint32_t srcALen,
  2795. q15_t * pSrcB,
  2796. uint32_t srcBLen,
  2797. q15_t * pDst,
  2798. q15_t * pScratch1,
  2799. q15_t * pScratch2);
  2800. /**
  2801. * @brief Convolution of Q15 sequences.
  2802. * @param[in] *pSrcA points to the first input sequence.
  2803. * @param[in] srcALen length of the first input sequence.
  2804. * @param[in] *pSrcB points to the second input sequence.
  2805. * @param[in] srcBLen length of the second input sequence.
  2806. * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
  2807. * @return none.
  2808. */
  2809. void arm_conv_q15(
  2810. q15_t * pSrcA,
  2811. uint32_t srcALen,
  2812. q15_t * pSrcB,
  2813. uint32_t srcBLen,
  2814. q15_t * pDst);
  2815. /**
  2816. * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
  2817. * @param[in] *pSrcA points to the first input sequence.
  2818. * @param[in] srcALen length of the first input sequence.
  2819. * @param[in] *pSrcB points to the second input sequence.
  2820. * @param[in] srcBLen length of the second input sequence.
  2821. * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
  2822. * @return none.
  2823. */
  2824. void arm_conv_fast_q15(
  2825. q15_t * pSrcA,
  2826. uint32_t srcALen,
  2827. q15_t * pSrcB,
  2828. uint32_t srcBLen,
  2829. q15_t * pDst);
  2830. /**
  2831. * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
  2832. * @param[in] *pSrcA points to the first input sequence.
  2833. * @param[in] srcALen length of the first input sequence.
  2834. * @param[in] *pSrcB points to the second input sequence.
  2835. * @param[in] srcBLen length of the second input sequence.
  2836. * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
  2837. * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  2838. * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
  2839. * @return none.
  2840. */
  2841. void arm_conv_fast_opt_q15(
  2842. q15_t * pSrcA,
  2843. uint32_t srcALen,
  2844. q15_t * pSrcB,
  2845. uint32_t srcBLen,
  2846. q15_t * pDst,
  2847. q15_t * pScratch1,
  2848. q15_t * pScratch2);
  2849. /**
  2850. * @brief Convolution of Q31 sequences.
  2851. * @param[in] *pSrcA points to the first input sequence.
  2852. * @param[in] srcALen length of the first input sequence.
  2853. * @param[in] *pSrcB points to the second input sequence.
  2854. * @param[in] srcBLen length of the second input sequence.
  2855. * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
  2856. * @return none.
  2857. */
  2858. void arm_conv_q31(
  2859. q31_t * pSrcA,
  2860. uint32_t srcALen,
  2861. q31_t * pSrcB,
  2862. uint32_t srcBLen,
  2863. q31_t * pDst);
  2864. /**
  2865. * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
  2866. * @param[in] *pSrcA points to the first input sequence.
  2867. * @param[in] srcALen length of the first input sequence.
  2868. * @param[in] *pSrcB points to the second input sequence.
  2869. * @param[in] srcBLen length of the second input sequence.
  2870. * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
  2871. * @return none.
  2872. */
  2873. void arm_conv_fast_q31(
  2874. q31_t * pSrcA,
  2875. uint32_t srcALen,
  2876. q31_t * pSrcB,
  2877. uint32_t srcBLen,
  2878. q31_t * pDst);
  2879. /**
  2880. * @brief Convolution of Q7 sequences.
  2881. * @param[in] *pSrcA points to the first input sequence.
  2882. * @param[in] srcALen length of the first input sequence.
  2883. * @param[in] *pSrcB points to the second input sequence.
  2884. * @param[in] srcBLen length of the second input sequence.
  2885. * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
  2886. * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  2887. * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
  2888. * @return none.
  2889. */
  2890. void arm_conv_opt_q7(
  2891. q7_t * pSrcA,
  2892. uint32_t srcALen,
  2893. q7_t * pSrcB,
  2894. uint32_t srcBLen,
  2895. q7_t * pDst,
  2896. q15_t * pScratch1,
  2897. q15_t * pScratch2);
  2898. /**
  2899. * @brief Convolution of Q7 sequences.
  2900. * @param[in] *pSrcA points to the first input sequence.
  2901. * @param[in] srcALen length of the first input sequence.
  2902. * @param[in] *pSrcB points to the second input sequence.
  2903. * @param[in] srcBLen length of the second input sequence.
  2904. * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
  2905. * @return none.
  2906. */
  2907. void arm_conv_q7(
  2908. q7_t * pSrcA,
  2909. uint32_t srcALen,
  2910. q7_t * pSrcB,
  2911. uint32_t srcBLen,
  2912. q7_t * pDst);
  2913. /**
  2914. * @brief Partial convolution of floating-point sequences.
  2915. * @param[in] *pSrcA points to the first input sequence.
  2916. * @param[in] srcALen length of the first input sequence.
  2917. * @param[in] *pSrcB points to the second input sequence.
  2918. * @param[in] srcBLen length of the second input sequence.
  2919. * @param[out] *pDst points to the block of output data
  2920. * @param[in] firstIndex is the first output sample to start with.
  2921. * @param[in] numPoints is the number of output points to be computed.
  2922. * @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].
  2923. */
  2924. arm_status arm_conv_partial_f32(
  2925. float32_t * pSrcA,
  2926. uint32_t srcALen,
  2927. float32_t * pSrcB,
  2928. uint32_t srcBLen,
  2929. float32_t * pDst,
  2930. uint32_t firstIndex,
  2931. uint32_t numPoints);
  2932. /**
  2933. * @brief Partial convolution of Q15 sequences.
  2934. * @param[in] *pSrcA points to the first input sequence.
  2935. * @param[in] srcALen length of the first input sequence.
  2936. * @param[in] *pSrcB points to the second input sequence.
  2937. * @param[in] srcBLen length of the second input sequence.
  2938. * @param[out] *pDst points to the block of output data
  2939. * @param[in] firstIndex is the first output sample to start with.
  2940. * @param[in] numPoints is the number of output points to be computed.
  2941. * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  2942. * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
  2943. * @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].
  2944. */
  2945. arm_status arm_conv_partial_opt_q15(
  2946. q15_t * pSrcA,
  2947. uint32_t srcALen,
  2948. q15_t * pSrcB,
  2949. uint32_t srcBLen,
  2950. q15_t * pDst,
  2951. uint32_t firstIndex,
  2952. uint32_t numPoints,
  2953. q15_t * pScratch1,
  2954. q15_t * pScratch2);
  2955. /**
  2956. * @brief Partial convolution of Q15 sequences.
  2957. * @param[in] *pSrcA points to the first input sequence.
  2958. * @param[in] srcALen length of the first input sequence.
  2959. * @param[in] *pSrcB points to the second input sequence.
  2960. * @param[in] srcBLen length of the second input sequence.
  2961. * @param[out] *pDst points to the block of output data
  2962. * @param[in] firstIndex is the first output sample to start with.
  2963. * @param[in] numPoints is the number of output points to be computed.
  2964. * @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].
  2965. */
  2966. arm_status arm_conv_partial_q15(
  2967. q15_t * pSrcA,
  2968. uint32_t srcALen,
  2969. q15_t * pSrcB,
  2970. uint32_t srcBLen,
  2971. q15_t * pDst,
  2972. uint32_t firstIndex,
  2973. uint32_t numPoints);
  2974. /**
  2975. * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
  2976. * @param[in] *pSrcA points to the first input sequence.
  2977. * @param[in] srcALen length of the first input sequence.
  2978. * @param[in] *pSrcB points to the second input sequence.
  2979. * @param[in] srcBLen length of the second input sequence.
  2980. * @param[out] *pDst points to the block of output data
  2981. * @param[in] firstIndex is the first output sample to start with.
  2982. * @param[in] numPoints is the number of output points to be computed.
  2983. * @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].
  2984. */
  2985. arm_status arm_conv_partial_fast_q15(
  2986. q15_t * pSrcA,
  2987. uint32_t srcALen,
  2988. q15_t * pSrcB,
  2989. uint32_t srcBLen,
  2990. q15_t * pDst,
  2991. uint32_t firstIndex,
  2992. uint32_t numPoints);
  2993. /**
  2994. * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
  2995. * @param[in] *pSrcA points to the first input sequence.
  2996. * @param[in] srcALen length of the first input sequence.
  2997. * @param[in] *pSrcB points to the second input sequence.
  2998. * @param[in] srcBLen length of the second input sequence.
  2999. * @param[out] *pDst points to the block of output data
  3000. * @param[in] firstIndex is the first output sample to start with.
  3001. * @param[in] numPoints is the number of output points to be computed.
  3002. * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  3003. * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
  3004. * @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].
  3005. */
  3006. arm_status arm_conv_partial_fast_opt_q15(
  3007. q15_t * pSrcA,
  3008. uint32_t srcALen,
  3009. q15_t * pSrcB,
  3010. uint32_t srcBLen,
  3011. q15_t * pDst,
  3012. uint32_t firstIndex,
  3013. uint32_t numPoints,
  3014. q15_t * pScratch1,
  3015. q15_t * pScratch2);
  3016. /**
  3017. * @brief Partial convolution of Q31 sequences.
  3018. * @param[in] *pSrcA points to the first input sequence.
  3019. * @param[in] srcALen length of the first input sequence.
  3020. * @param[in] *pSrcB points to the second input sequence.
  3021. * @param[in] srcBLen length of the second input sequence.
  3022. * @param[out] *pDst points to the block of output data
  3023. * @param[in] firstIndex is the first output sample to start with.
  3024. * @param[in] numPoints is the number of output points to be computed.
  3025. * @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].
  3026. */
  3027. arm_status arm_conv_partial_q31(
  3028. q31_t * pSrcA,
  3029. uint32_t srcALen,
  3030. q31_t * pSrcB,
  3031. uint32_t srcBLen,
  3032. q31_t * pDst,
  3033. uint32_t firstIndex,
  3034. uint32_t numPoints);
  3035. /**
  3036. * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
  3037. * @param[in] *pSrcA points to the first input sequence.
  3038. * @param[in] srcALen length of the first input sequence.
  3039. * @param[in] *pSrcB points to the second input sequence.
  3040. * @param[in] srcBLen length of the second input sequence.
  3041. * @param[out] *pDst points to the block of output data
  3042. * @param[in] firstIndex is the first output sample to start with.
  3043. * @param[in] numPoints is the number of output points to be computed.
  3044. * @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].
  3045. */
  3046. arm_status arm_conv_partial_fast_q31(
  3047. q31_t * pSrcA,
  3048. uint32_t srcALen,
  3049. q31_t * pSrcB,
  3050. uint32_t srcBLen,
  3051. q31_t * pDst,
  3052. uint32_t firstIndex,
  3053. uint32_t numPoints);
  3054. /**
  3055. * @brief Partial convolution of Q7 sequences
  3056. * @param[in] *pSrcA points to the first input sequence.
  3057. * @param[in] srcALen length of the first input sequence.
  3058. * @param[in] *pSrcB points to the second input sequence.
  3059. * @param[in] srcBLen length of the second input sequence.
  3060. * @param[out] *pDst points to the block of output data
  3061. * @param[in] firstIndex is the first output sample to start with.
  3062. * @param[in] numPoints is the number of output points to be computed.
  3063. * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  3064. * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
  3065. * @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].
  3066. */
  3067. arm_status arm_conv_partial_opt_q7(
  3068. q7_t * pSrcA,
  3069. uint32_t srcALen,
  3070. q7_t * pSrcB,
  3071. uint32_t srcBLen,
  3072. q7_t * pDst,
  3073. uint32_t firstIndex,
  3074. uint32_t numPoints,
  3075. q15_t * pScratch1,
  3076. q15_t * pScratch2);
  3077. /**
  3078. * @brief Partial convolution of Q7 sequences.
  3079. * @param[in] *pSrcA points to the first input sequence.
  3080. * @param[in] srcALen length of the first input sequence.
  3081. * @param[in] *pSrcB points to the second input sequence.
  3082. * @param[in] srcBLen length of the second input sequence.
  3083. * @param[out] *pDst points to the block of output data
  3084. * @param[in] firstIndex is the first output sample to start with.
  3085. * @param[in] numPoints is the number of output points to be computed.
  3086. * @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].
  3087. */
  3088. arm_status arm_conv_partial_q7(
  3089. q7_t * pSrcA,
  3090. uint32_t srcALen,
  3091. q7_t * pSrcB,
  3092. uint32_t srcBLen,
  3093. q7_t * pDst,
  3094. uint32_t firstIndex,
  3095. uint32_t numPoints);
  3096. /**
  3097. * @brief Instance structure for the Q15 FIR decimator.
  3098. */
  3099. typedef struct
  3100. {
  3101. uint8_t M; /**< decimation factor. */
  3102. uint16_t numTaps; /**< number of coefficients in the filter. */
  3103. q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  3104. q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  3105. } arm_fir_decimate_instance_q15;
  3106. /**
  3107. * @brief Instance structure for the Q31 FIR decimator.
  3108. */
  3109. typedef struct
  3110. {
  3111. uint8_t M; /**< decimation factor. */
  3112. uint16_t numTaps; /**< number of coefficients in the filter. */
  3113. q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  3114. q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  3115. } arm_fir_decimate_instance_q31;
  3116. /**
  3117. * @brief Instance structure for the floating-point FIR decimator.
  3118. */
  3119. typedef struct
  3120. {
  3121. uint8_t M; /**< decimation factor. */
  3122. uint16_t numTaps; /**< number of coefficients in the filter. */
  3123. float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  3124. float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  3125. } arm_fir_decimate_instance_f32;
  3126. /**
  3127. * @brief Processing function for the floating-point FIR decimator.
  3128. * @param[in] *S points to an instance of the floating-point FIR decimator structure.
  3129. * @param[in] *pSrc points to the block of input data.
  3130. * @param[out] *pDst points to the block of output data
  3131. * @param[in] blockSize number of input samples to process per call.
  3132. * @return none
  3133. */
  3134. void arm_fir_decimate_f32(
  3135. const arm_fir_decimate_instance_f32 * S,
  3136. float32_t * pSrc,
  3137. float32_t * pDst,
  3138. uint32_t blockSize);
  3139. /**
  3140. * @brief Initialization function for the floating-point FIR decimator.
  3141. * @param[in,out] *S points to an instance of the floating-point FIR decimator structure.
  3142. * @param[in] numTaps number of coefficients in the filter.
  3143. * @param[in] M decimation factor.
  3144. * @param[in] *pCoeffs points to the filter coefficients.
  3145. * @param[in] *pState points to the state buffer.
  3146. * @param[in] blockSize number of input samples to process per call.
  3147. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
  3148. * <code>blockSize</code> is not a multiple of <code>M</code>.
  3149. */
  3150. arm_status arm_fir_decimate_init_f32(
  3151. arm_fir_decimate_instance_f32 * S,
  3152. uint16_t numTaps,
  3153. uint8_t M,
  3154. float32_t * pCoeffs,
  3155. float32_t * pState,
  3156. uint32_t blockSize);
  3157. /**
  3158. * @brief Processing function for the Q15 FIR decimator.
  3159. * @param[in] *S points to an instance of the Q15 FIR decimator structure.
  3160. * @param[in] *pSrc points to the block of input data.
  3161. * @param[out] *pDst points to the block of output data
  3162. * @param[in] blockSize number of input samples to process per call.
  3163. * @return none
  3164. */
  3165. void arm_fir_decimate_q15(
  3166. const arm_fir_decimate_instance_q15 * S,
  3167. q15_t * pSrc,
  3168. q15_t * pDst,
  3169. uint32_t blockSize);
  3170. /**
  3171. * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
  3172. * @param[in] *S points to an instance of the Q15 FIR decimator structure.
  3173. * @param[in] *pSrc points to the block of input data.
  3174. * @param[out] *pDst points to the block of output data
  3175. * @param[in] blockSize number of input samples to process per call.
  3176. * @return none
  3177. */
  3178. void arm_fir_decimate_fast_q15(
  3179. const arm_fir_decimate_instance_q15 * S,
  3180. q15_t * pSrc,
  3181. q15_t * pDst,
  3182. uint32_t blockSize);
  3183. /**
  3184. * @brief Initialization function for the Q15 FIR decimator.
  3185. * @param[in,out] *S points to an instance of the Q15 FIR decimator structure.
  3186. * @param[in] numTaps number of coefficients in the filter.
  3187. * @param[in] M decimation factor.
  3188. * @param[in] *pCoeffs points to the filter coefficients.
  3189. * @param[in] *pState points to the state buffer.
  3190. * @param[in] blockSize number of input samples to process per call.
  3191. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
  3192. * <code>blockSize</code> is not a multiple of <code>M</code>.
  3193. */
  3194. arm_status arm_fir_decimate_init_q15(
  3195. arm_fir_decimate_instance_q15 * S,
  3196. uint16_t numTaps,
  3197. uint8_t M,
  3198. q15_t * pCoeffs,
  3199. q15_t * pState,
  3200. uint32_t blockSize);
  3201. /**
  3202. * @brief Processing function for the Q31 FIR decimator.
  3203. * @param[in] *S points to an instance of the Q31 FIR decimator structure.
  3204. * @param[in] *pSrc points to the block of input data.
  3205. * @param[out] *pDst points to the block of output data
  3206. * @param[in] blockSize number of input samples to process per call.
  3207. * @return none
  3208. */
  3209. void arm_fir_decimate_q31(
  3210. const arm_fir_decimate_instance_q31 * S,
  3211. q31_t * pSrc,
  3212. q31_t * pDst,
  3213. uint32_t blockSize);
  3214. /**
  3215. * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
  3216. * @param[in] *S points to an instance of the Q31 FIR decimator structure.
  3217. * @param[in] *pSrc points to the block of input data.
  3218. * @param[out] *pDst points to the block of output data
  3219. * @param[in] blockSize number of input samples to process per call.
  3220. * @return none
  3221. */
  3222. void arm_fir_decimate_fast_q31(
  3223. arm_fir_decimate_instance_q31 * S,
  3224. q31_t * pSrc,
  3225. q31_t * pDst,
  3226. uint32_t blockSize);
  3227. /**
  3228. * @brief Initialization function for the Q31 FIR decimator.
  3229. * @param[in,out] *S points to an instance of the Q31 FIR decimator structure.
  3230. * @param[in] numTaps number of coefficients in the filter.
  3231. * @param[in] M decimation factor.
  3232. * @param[in] *pCoeffs points to the filter coefficients.
  3233. * @param[in] *pState points to the state buffer.
  3234. * @param[in] blockSize number of input samples to process per call.
  3235. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
  3236. * <code>blockSize</code> is not a multiple of <code>M</code>.
  3237. */
  3238. arm_status arm_fir_decimate_init_q31(
  3239. arm_fir_decimate_instance_q31 * S,
  3240. uint16_t numTaps,
  3241. uint8_t M,
  3242. q31_t * pCoeffs,
  3243. q31_t * pState,
  3244. uint32_t blockSize);
  3245. /**
  3246. * @brief Instance structure for the Q15 FIR interpolator.
  3247. */
  3248. typedef struct
  3249. {
  3250. uint8_t L; /**< upsample factor. */
  3251. uint16_t phaseLength; /**< length of each polyphase filter component. */
  3252. q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
  3253. q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
  3254. } arm_fir_interpolate_instance_q15;
  3255. /**
  3256. * @brief Instance structure for the Q31 FIR interpolator.
  3257. */
  3258. typedef struct
  3259. {
  3260. uint8_t L; /**< upsample factor. */
  3261. uint16_t phaseLength; /**< length of each polyphase filter component. */
  3262. q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
  3263. q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
  3264. } arm_fir_interpolate_instance_q31;
  3265. /**
  3266. * @brief Instance structure for the floating-point FIR interpolator.
  3267. */
  3268. typedef struct
  3269. {
  3270. uint8_t L; /**< upsample factor. */
  3271. uint16_t phaseLength; /**< length of each polyphase filter component. */
  3272. float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
  3273. float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
  3274. } arm_fir_interpolate_instance_f32;
  3275. /**
  3276. * @brief Processing function for the Q15 FIR interpolator.
  3277. * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
  3278. * @param[in] *pSrc points to the block of input data.
  3279. * @param[out] *pDst points to the block of output data.
  3280. * @param[in] blockSize number of input samples to process per call.
  3281. * @return none.
  3282. */
  3283. void arm_fir_interpolate_q15(
  3284. const arm_fir_interpolate_instance_q15 * S,
  3285. q15_t * pSrc,
  3286. q15_t * pDst,
  3287. uint32_t blockSize);
  3288. /**
  3289. * @brief Initialization function for the Q15 FIR interpolator.
  3290. * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure.
  3291. * @param[in] L upsample factor.
  3292. * @param[in] numTaps number of filter coefficients in the filter.
  3293. * @param[in] *pCoeffs points to the filter coefficient buffer.
  3294. * @param[in] *pState points to the state buffer.
  3295. * @param[in] blockSize number of input samples to process per call.
  3296. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
  3297. * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
  3298. */
  3299. arm_status arm_fir_interpolate_init_q15(
  3300. arm_fir_interpolate_instance_q15 * S,
  3301. uint8_t L,
  3302. uint16_t numTaps,
  3303. q15_t * pCoeffs,
  3304. q15_t * pState,
  3305. uint32_t blockSize);
  3306. /**
  3307. * @brief Processing function for the Q31 FIR interpolator.
  3308. * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
  3309. * @param[in] *pSrc points to the block of input data.
  3310. * @param[out] *pDst points to the block of output data.
  3311. * @param[in] blockSize number of input samples to process per call.
  3312. * @return none.
  3313. */
  3314. void arm_fir_interpolate_q31(
  3315. const arm_fir_interpolate_instance_q31 * S,
  3316. q31_t * pSrc,
  3317. q31_t * pDst,
  3318. uint32_t blockSize);
  3319. /**
  3320. * @brief Initialization function for the Q31 FIR interpolator.
  3321. * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure.
  3322. * @param[in] L upsample factor.
  3323. * @param[in] numTaps number of filter coefficients in the filter.
  3324. * @param[in] *pCoeffs points to the filter coefficient buffer.
  3325. * @param[in] *pState points to the state buffer.
  3326. * @param[in] blockSize number of input samples to process per call.
  3327. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
  3328. * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
  3329. */
  3330. arm_status arm_fir_interpolate_init_q31(
  3331. arm_fir_interpolate_instance_q31 * S,
  3332. uint8_t L,
  3333. uint16_t numTaps,
  3334. q31_t * pCoeffs,
  3335. q31_t * pState,
  3336. uint32_t blockSize);
  3337. /**
  3338. * @brief Processing function for the floating-point FIR interpolator.
  3339. * @param[in] *S points to an instance of the floating-point FIR interpolator structure.
  3340. * @param[in] *pSrc points to the block of input data.
  3341. * @param[out] *pDst points to the block of output data.
  3342. * @param[in] blockSize number of input samples to process per call.
  3343. * @return none.
  3344. */
  3345. void arm_fir_interpolate_f32(
  3346. const arm_fir_interpolate_instance_f32 * S,
  3347. float32_t * pSrc,
  3348. float32_t * pDst,
  3349. uint32_t blockSize);
  3350. /**
  3351. * @brief Initialization function for the floating-point FIR interpolator.
  3352. * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure.
  3353. * @param[in] L upsample factor.
  3354. * @param[in] numTaps number of filter coefficients in the filter.
  3355. * @param[in] *pCoeffs points to the filter coefficient buffer.
  3356. * @param[in] *pState points to the state buffer.
  3357. * @param[in] blockSize number of input samples to process per call.
  3358. * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
  3359. * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
  3360. */
  3361. arm_status arm_fir_interpolate_init_f32(
  3362. arm_fir_interpolate_instance_f32 * S,
  3363. uint8_t L,
  3364. uint16_t numTaps,
  3365. float32_t * pCoeffs,
  3366. float32_t * pState,
  3367. uint32_t blockSize);
  3368. /**
  3369. * @brief Instance structure for the high precision Q31 Biquad cascade filter.
  3370. */
  3371. typedef struct
  3372. {
  3373. uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
  3374. q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
  3375. q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
  3376. uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
  3377. } arm_biquad_cas_df1_32x64_ins_q31;
  3378. /**
  3379. * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
  3380. * @param[in] *pSrc points to the block of input data.
  3381. * @param[out] *pDst points to the block of output data
  3382. * @param[in] blockSize number of samples to process.
  3383. * @return none.
  3384. */
  3385. void arm_biquad_cas_df1_32x64_q31(
  3386. const arm_biquad_cas_df1_32x64_ins_q31 * S,
  3387. q31_t * pSrc,
  3388. q31_t * pDst,
  3389. uint32_t blockSize);
  3390. /**
  3391. * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
  3392. * @param[in] numStages number of 2nd order stages in the filter.
  3393. * @param[in] *pCoeffs points to the filter coefficients.
  3394. * @param[in] *pState points to the state buffer.
  3395. * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
  3396. * @return none
  3397. */
  3398. void arm_biquad_cas_df1_32x64_init_q31(
  3399. arm_biquad_cas_df1_32x64_ins_q31 * S,
  3400. uint8_t numStages,
  3401. q31_t * pCoeffs,
  3402. q63_t * pState,
  3403. uint8_t postShift);
  3404. /**
  3405. * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
  3406. */
  3407. typedef struct
  3408. {
  3409. uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
  3410. float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
  3411. float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
  3412. } arm_biquad_cascade_df2T_instance_f32;
  3413. /**
  3414. * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
  3415. * @param[in] *S points to an instance of the filter data structure.
  3416. * @param[in] *pSrc points to the block of input data.
  3417. * @param[out] *pDst points to the block of output data
  3418. * @param[in] blockSize number of samples to process.
  3419. * @return none.
  3420. */
  3421. void arm_biquad_cascade_df2T_f32(
  3422. const arm_biquad_cascade_df2T_instance_f32 * S,
  3423. float32_t * pSrc,
  3424. float32_t * pDst,
  3425. uint32_t blockSize);
  3426. /**
  3427. * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
  3428. * @param[in,out] *S points to an instance of the filter data structure.
  3429. * @param[in] numStages number of 2nd order stages in the filter.
  3430. * @param[in] *pCoeffs points to the filter coefficients.
  3431. * @param[in] *pState points to the state buffer.
  3432. * @return none
  3433. */
  3434. void arm_biquad_cascade_df2T_init_f32(
  3435. arm_biquad_cascade_df2T_instance_f32 * S,
  3436. uint8_t numStages,
  3437. float32_t * pCoeffs,
  3438. float32_t * pState);
  3439. /**
  3440. * @brief Instance structure for the Q15 FIR lattice filter.
  3441. */
  3442. typedef struct
  3443. {
  3444. uint16_t numStages; /**< number of filter stages. */
  3445. q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
  3446. q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
  3447. } arm_fir_lattice_instance_q15;
  3448. /**
  3449. * @brief Instance structure for the Q31 FIR lattice filter.
  3450. */
  3451. typedef struct
  3452. {
  3453. uint16_t numStages; /**< number of filter stages. */
  3454. q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
  3455. q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
  3456. } arm_fir_lattice_instance_q31;
  3457. /**
  3458. * @brief Instance structure for the floating-point FIR lattice filter.
  3459. */
  3460. typedef struct
  3461. {
  3462. uint16_t numStages; /**< number of filter stages. */
  3463. float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
  3464. float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
  3465. } arm_fir_lattice_instance_f32;
  3466. /**
  3467. * @brief Initialization function for the Q15 FIR lattice filter.
  3468. * @param[in] *S points to an instance of the Q15 FIR lattice structure.
  3469. * @param[in] numStages number of filter stages.
  3470. * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
  3471. * @param[in] *pState points to the state buffer. The array is of length numStages.
  3472. * @return none.
  3473. */
  3474. void arm_fir_lattice_init_q15(
  3475. arm_fir_lattice_instance_q15 * S,
  3476. uint16_t numStages,
  3477. q15_t * pCoeffs,
  3478. q15_t * pState);
  3479. /**
  3480. * @brief Processing function for the Q15 FIR lattice filter.
  3481. * @param[in] *S points to an instance of the Q15 FIR lattice structure.
  3482. * @param[in] *pSrc points to the block of input data.
  3483. * @param[out] *pDst points to the block of output data.
  3484. * @param[in] blockSize number of samples to process.
  3485. * @return none.
  3486. */
  3487. void arm_fir_lattice_q15(
  3488. const arm_fir_lattice_instance_q15 * S,
  3489. q15_t * pSrc,
  3490. q15_t * pDst,
  3491. uint32_t blockSize);
  3492. /**
  3493. * @brief Initialization function for the Q31 FIR lattice filter.
  3494. * @param[in] *S points to an instance of the Q31 FIR lattice structure.
  3495. * @param[in] numStages number of filter stages.
  3496. * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
  3497. * @param[in] *pState points to the state buffer. The array is of length numStages.
  3498. * @return none.
  3499. */
  3500. void arm_fir_lattice_init_q31(
  3501. arm_fir_lattice_instance_q31 * S,
  3502. uint16_t numStages,
  3503. q31_t * pCoeffs,
  3504. q31_t * pState);
  3505. /**
  3506. * @brief Processing function for the Q31 FIR lattice filter.
  3507. * @param[in] *S points to an instance of the Q31 FIR lattice structure.
  3508. * @param[in] *pSrc points to the block of input data.
  3509. * @param[out] *pDst points to the block of output data
  3510. * @param[in] blockSize number of samples to process.
  3511. * @return none.
  3512. */
  3513. void arm_fir_lattice_q31(
  3514. const arm_fir_lattice_instance_q31 * S,
  3515. q31_t * pSrc,
  3516. q31_t * pDst,
  3517. uint32_t blockSize);
  3518. /**
  3519. * @brief Initialization function for the floating-point FIR lattice filter.
  3520. * @param[in] *S points to an instance of the floating-point FIR lattice structure.
  3521. * @param[in] numStages number of filter stages.
  3522. * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
  3523. * @param[in] *pState points to the state buffer. The array is of length numStages.
  3524. * @return none.
  3525. */
  3526. void arm_fir_lattice_init_f32(
  3527. arm_fir_lattice_instance_f32 * S,
  3528. uint16_t numStages,
  3529. float32_t * pCoeffs,
  3530. float32_t * pState);
  3531. /**
  3532. * @brief Processing function for the floating-point FIR lattice filter.
  3533. * @param[in] *S points to an instance of the floating-point FIR lattice structure.
  3534. * @param[in] *pSrc points to the block of input data.
  3535. * @param[out] *pDst points to the block of output data
  3536. * @param[in] blockSize number of samples to process.
  3537. * @return none.
  3538. */
  3539. void arm_fir_lattice_f32(
  3540. const arm_fir_lattice_instance_f32 * S,
  3541. float32_t * pSrc,
  3542. float32_t * pDst,
  3543. uint32_t blockSize);
  3544. /**
  3545. * @brief Instance structure for the Q15 IIR lattice filter.
  3546. */
  3547. typedef struct
  3548. {
  3549. uint16_t numStages; /**< number of stages in the filter. */
  3550. q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
  3551. q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
  3552. q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
  3553. } arm_iir_lattice_instance_q15;
  3554. /**
  3555. * @brief Instance structure for the Q31 IIR lattice filter.
  3556. */
  3557. typedef struct
  3558. {
  3559. uint16_t numStages; /**< number of stages in the filter. */
  3560. q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
  3561. q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
  3562. q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
  3563. } arm_iir_lattice_instance_q31;
  3564. /**
  3565. * @brief Instance structure for the floating-point IIR lattice filter.
  3566. */
  3567. typedef struct
  3568. {
  3569. uint16_t numStages; /**< number of stages in the filter. */
  3570. float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
  3571. float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
  3572. float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
  3573. } arm_iir_lattice_instance_f32;
  3574. /**
  3575. * @brief Processing function for the floating-point IIR lattice filter.
  3576. * @param[in] *S points to an instance of the floating-point IIR lattice structure.
  3577. * @param[in] *pSrc points to the block of input data.
  3578. * @param[out] *pDst points to the block of output data.
  3579. * @param[in] blockSize number of samples to process.
  3580. * @return none.
  3581. */
  3582. void arm_iir_lattice_f32(
  3583. const arm_iir_lattice_instance_f32 * S,
  3584. float32_t * pSrc,
  3585. float32_t * pDst,
  3586. uint32_t blockSize);
  3587. /**
  3588. * @brief Initialization function for the floating-point IIR lattice filter.
  3589. * @param[in] *S points to an instance of the floating-point IIR lattice structure.
  3590. * @param[in] numStages number of stages in the filter.
  3591. * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
  3592. * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
  3593. * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1.
  3594. * @param[in] blockSize number of samples to process.
  3595. * @return none.
  3596. */
  3597. void arm_iir_lattice_init_f32(
  3598. arm_iir_lattice_instance_f32 * S,
  3599. uint16_t numStages,
  3600. float32_t * pkCoeffs,
  3601. float32_t * pvCoeffs,
  3602. float32_t * pState,
  3603. uint32_t blockSize);
  3604. /**
  3605. * @brief Processing function for the Q31 IIR lattice filter.
  3606. * @param[in] *S points to an instance of the Q31 IIR lattice structure.
  3607. * @param[in] *pSrc points to the block of input data.
  3608. * @param[out] *pDst points to the block of output data.
  3609. * @param[in] blockSize number of samples to process.
  3610. * @return none.
  3611. */
  3612. void arm_iir_lattice_q31(
  3613. const arm_iir_lattice_instance_q31 * S,
  3614. q31_t * pSrc,
  3615. q31_t * pDst,
  3616. uint32_t blockSize);
  3617. /**
  3618. * @brief Initialization function for the Q31 IIR lattice filter.
  3619. * @param[in] *S points to an instance of the Q31 IIR lattice structure.
  3620. * @param[in] numStages number of stages in the filter.
  3621. * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
  3622. * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
  3623. * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize.
  3624. * @param[in] blockSize number of samples to process.
  3625. * @return none.
  3626. */
  3627. void arm_iir_lattice_init_q31(
  3628. arm_iir_lattice_instance_q31 * S,
  3629. uint16_t numStages,
  3630. q31_t * pkCoeffs,
  3631. q31_t * pvCoeffs,
  3632. q31_t * pState,
  3633. uint32_t blockSize);
  3634. /**
  3635. * @brief Processing function for the Q15 IIR lattice filter.
  3636. * @param[in] *S points to an instance of the Q15 IIR lattice structure.
  3637. * @param[in] *pSrc points to the block of input data.
  3638. * @param[out] *pDst points to the block of output data.
  3639. * @param[in] blockSize number of samples to process.
  3640. * @return none.
  3641. */
  3642. void arm_iir_lattice_q15(
  3643. const arm_iir_lattice_instance_q15 * S,
  3644. q15_t * pSrc,
  3645. q15_t * pDst,
  3646. uint32_t blockSize);
  3647. /**
  3648. * @brief Initialization function for the Q15 IIR lattice filter.
  3649. * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure.
  3650. * @param[in] numStages number of stages in the filter.
  3651. * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
  3652. * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
  3653. * @param[in] *pState points to state buffer. The array is of length numStages+blockSize.
  3654. * @param[in] blockSize number of samples to process per call.
  3655. * @return none.
  3656. */
  3657. void arm_iir_lattice_init_q15(
  3658. arm_iir_lattice_instance_q15 * S,
  3659. uint16_t numStages,
  3660. q15_t * pkCoeffs,
  3661. q15_t * pvCoeffs,
  3662. q15_t * pState,
  3663. uint32_t blockSize);
  3664. /**
  3665. * @brief Instance structure for the floating-point LMS filter.
  3666. */
  3667. typedef struct
  3668. {
  3669. uint16_t numTaps; /**< number of coefficients in the filter. */
  3670. float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  3671. float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  3672. float32_t mu; /**< step size that controls filter coefficient updates. */
  3673. } arm_lms_instance_f32;
  3674. /**
  3675. * @brief Processing function for floating-point LMS filter.
  3676. * @param[in] *S points to an instance of the floating-point LMS filter structure.
  3677. * @param[in] *pSrc points to the block of input data.
  3678. * @param[in] *pRef points to the block of reference data.
  3679. * @param[out] *pOut points to the block of output data.
  3680. * @param[out] *pErr points to the block of error data.
  3681. * @param[in] blockSize number of samples to process.
  3682. * @return none.
  3683. */
  3684. void arm_lms_f32(
  3685. const arm_lms_instance_f32 * S,
  3686. float32_t * pSrc,
  3687. float32_t * pRef,
  3688. float32_t * pOut,
  3689. float32_t * pErr,
  3690. uint32_t blockSize);
  3691. /**
  3692. * @brief Initialization function for floating-point LMS filter.
  3693. * @param[in] *S points to an instance of the floating-point LMS filter structure.
  3694. * @param[in] numTaps number of filter coefficients.
  3695. * @param[in] *pCoeffs points to the coefficient buffer.
  3696. * @param[in] *pState points to state buffer.
  3697. * @param[in] mu step size that controls filter coefficient updates.
  3698. * @param[in] blockSize number of samples to process.
  3699. * @return none.
  3700. */
  3701. void arm_lms_init_f32(
  3702. arm_lms_instance_f32 * S,
  3703. uint16_t numTaps,
  3704. float32_t * pCoeffs,
  3705. float32_t * pState,
  3706. float32_t mu,
  3707. uint32_t blockSize);
  3708. /**
  3709. * @brief Instance structure for the Q15 LMS filter.
  3710. */
  3711. typedef struct
  3712. {
  3713. uint16_t numTaps; /**< number of coefficients in the filter. */
  3714. q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  3715. q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  3716. q15_t mu; /**< step size that controls filter coefficient updates. */
  3717. uint32_t postShift; /**< bit shift applied to coefficients. */
  3718. } arm_lms_instance_q15;
  3719. /**
  3720. * @brief Initialization function for the Q15 LMS filter.
  3721. * @param[in] *S points to an instance of the Q15 LMS filter structure.
  3722. * @param[in] numTaps number of filter coefficients.
  3723. * @param[in] *pCoeffs points to the coefficient buffer.
  3724. * @param[in] *pState points to the state buffer.
  3725. * @param[in] mu step size that controls filter coefficient updates.
  3726. * @param[in] blockSize number of samples to process.
  3727. * @param[in] postShift bit shift applied to coefficients.
  3728. * @return none.
  3729. */
  3730. void arm_lms_init_q15(
  3731. arm_lms_instance_q15 * S,
  3732. uint16_t numTaps,
  3733. q15_t * pCoeffs,
  3734. q15_t * pState,
  3735. q15_t mu,
  3736. uint32_t blockSize,
  3737. uint32_t postShift);
  3738. /**
  3739. * @brief Processing function for Q15 LMS filter.
  3740. * @param[in] *S points to an instance of the Q15 LMS filter structure.
  3741. * @param[in] *pSrc points to the block of input data.
  3742. * @param[in] *pRef points to the block of reference data.
  3743. * @param[out] *pOut points to the block of output data.
  3744. * @param[out] *pErr points to the block of error data.
  3745. * @param[in] blockSize number of samples to process.
  3746. * @return none.
  3747. */
  3748. void arm_lms_q15(
  3749. const arm_lms_instance_q15 * S,
  3750. q15_t * pSrc,
  3751. q15_t * pRef,
  3752. q15_t * pOut,
  3753. q15_t * pErr,
  3754. uint32_t blockSize);
  3755. /**
  3756. * @brief Instance structure for the Q31 LMS filter.
  3757. */
  3758. typedef struct
  3759. {
  3760. uint16_t numTaps; /**< number of coefficients in the filter. */
  3761. q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  3762. q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  3763. q31_t mu; /**< step size that controls filter coefficient updates. */
  3764. uint32_t postShift; /**< bit shift applied to coefficients. */
  3765. } arm_lms_instance_q31;
  3766. /**
  3767. * @brief Processing function for Q31 LMS filter.
  3768. * @param[in] *S points to an instance of the Q15 LMS filter structure.
  3769. * @param[in] *pSrc points to the block of input data.
  3770. * @param[in] *pRef points to the block of reference data.
  3771. * @param[out] *pOut points to the block of output data.
  3772. * @param[out] *pErr points to the block of error data.
  3773. * @param[in] blockSize number of samples to process.
  3774. * @return none.
  3775. */
  3776. void arm_lms_q31(
  3777. const arm_lms_instance_q31 * S,
  3778. q31_t * pSrc,
  3779. q31_t * pRef,
  3780. q31_t * pOut,
  3781. q31_t * pErr,
  3782. uint32_t blockSize);
  3783. /**
  3784. * @brief Initialization function for Q31 LMS filter.
  3785. * @param[in] *S points to an instance of the Q31 LMS filter structure.
  3786. * @param[in] numTaps number of filter coefficients.
  3787. * @param[in] *pCoeffs points to coefficient buffer.
  3788. * @param[in] *pState points to state buffer.
  3789. * @param[in] mu step size that controls filter coefficient updates.
  3790. * @param[in] blockSize number of samples to process.
  3791. * @param[in] postShift bit shift applied to coefficients.
  3792. * @return none.
  3793. */
  3794. void arm_lms_init_q31(
  3795. arm_lms_instance_q31 * S,
  3796. uint16_t numTaps,
  3797. q31_t * pCoeffs,
  3798. q31_t * pState,
  3799. q31_t mu,
  3800. uint32_t blockSize,
  3801. uint32_t postShift);
  3802. /**
  3803. * @brief Instance structure for the floating-point normalized LMS filter.
  3804. */
  3805. typedef struct
  3806. {
  3807. uint16_t numTaps; /**< number of coefficients in the filter. */
  3808. float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  3809. float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  3810. float32_t mu; /**< step size that control filter coefficient updates. */
  3811. float32_t energy; /**< saves previous frame energy. */
  3812. float32_t x0; /**< saves previous input sample. */
  3813. } arm_lms_norm_instance_f32;
  3814. /**
  3815. * @brief Processing function for floating-point normalized LMS filter.
  3816. * @param[in] *S points to an instance of the floating-point normalized LMS filter structure.
  3817. * @param[in] *pSrc points to the block of input data.
  3818. * @param[in] *pRef points to the block of reference data.
  3819. * @param[out] *pOut points to the block of output data.
  3820. * @param[out] *pErr points to the block of error data.
  3821. * @param[in] blockSize number of samples to process.
  3822. * @return none.
  3823. */
  3824. void arm_lms_norm_f32(
  3825. arm_lms_norm_instance_f32 * S,
  3826. float32_t * pSrc,
  3827. float32_t * pRef,
  3828. float32_t * pOut,
  3829. float32_t * pErr,
  3830. uint32_t blockSize);
  3831. /**
  3832. * @brief Initialization function for floating-point normalized LMS filter.
  3833. * @param[in] *S points to an instance of the floating-point LMS filter structure.
  3834. * @param[in] numTaps number of filter coefficients.
  3835. * @param[in] *pCoeffs points to coefficient buffer.
  3836. * @param[in] *pState points to state buffer.
  3837. * @param[in] mu step size that controls filter coefficient updates.
  3838. * @param[in] blockSize number of samples to process.
  3839. * @return none.
  3840. */
  3841. void arm_lms_norm_init_f32(
  3842. arm_lms_norm_instance_f32 * S,
  3843. uint16_t numTaps,
  3844. float32_t * pCoeffs,
  3845. float32_t * pState,
  3846. float32_t mu,
  3847. uint32_t blockSize);
  3848. /**
  3849. * @brief Instance structure for the Q31 normalized LMS filter.
  3850. */
  3851. typedef struct
  3852. {
  3853. uint16_t numTaps; /**< number of coefficients in the filter. */
  3854. q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  3855. q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  3856. q31_t mu; /**< step size that controls filter coefficient updates. */
  3857. uint8_t postShift; /**< bit shift applied to coefficients. */
  3858. q31_t *recipTable; /**< points to the reciprocal initial value table. */
  3859. q31_t energy; /**< saves previous frame energy. */
  3860. q31_t x0; /**< saves previous input sample. */
  3861. } arm_lms_norm_instance_q31;
  3862. /**
  3863. * @brief Processing function for Q31 normalized LMS filter.
  3864. * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
  3865. * @param[in] *pSrc points to the block of input data.
  3866. * @param[in] *pRef points to the block of reference data.
  3867. * @param[out] *pOut points to the block of output data.
  3868. * @param[out] *pErr points to the block of error data.
  3869. * @param[in] blockSize number of samples to process.
  3870. * @return none.
  3871. */
  3872. void arm_lms_norm_q31(
  3873. arm_lms_norm_instance_q31 * S,
  3874. q31_t * pSrc,
  3875. q31_t * pRef,
  3876. q31_t * pOut,
  3877. q31_t * pErr,
  3878. uint32_t blockSize);
  3879. /**
  3880. * @brief Initialization function for Q31 normalized LMS filter.
  3881. * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
  3882. * @param[in] numTaps number of filter coefficients.
  3883. * @param[in] *pCoeffs points to coefficient buffer.
  3884. * @param[in] *pState points to state buffer.
  3885. * @param[in] mu step size that controls filter coefficient updates.
  3886. * @param[in] blockSize number of samples to process.
  3887. * @param[in] postShift bit shift applied to coefficients.
  3888. * @return none.
  3889. */
  3890. void arm_lms_norm_init_q31(
  3891. arm_lms_norm_instance_q31 * S,
  3892. uint16_t numTaps,
  3893. q31_t * pCoeffs,
  3894. q31_t * pState,
  3895. q31_t mu,
  3896. uint32_t blockSize,
  3897. uint8_t postShift);
  3898. /**
  3899. * @brief Instance structure for the Q15 normalized LMS filter.
  3900. */
  3901. typedef struct
  3902. {
  3903. uint16_t numTaps; /**< Number of coefficients in the filter. */
  3904. q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
  3905. q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
  3906. q15_t mu; /**< step size that controls filter coefficient updates. */
  3907. uint8_t postShift; /**< bit shift applied to coefficients. */
  3908. q15_t *recipTable; /**< Points to the reciprocal initial value table. */
  3909. q15_t energy; /**< saves previous frame energy. */
  3910. q15_t x0; /**< saves previous input sample. */
  3911. } arm_lms_norm_instance_q15;
  3912. /**
  3913. * @brief Processing function for Q15 normalized LMS filter.
  3914. * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
  3915. * @param[in] *pSrc points to the block of input data.
  3916. * @param[in] *pRef points to the block of reference data.
  3917. * @param[out] *pOut points to the block of output data.
  3918. * @param[out] *pErr points to the block of error data.
  3919. * @param[in] blockSize number of samples to process.
  3920. * @return none.
  3921. */
  3922. void arm_lms_norm_q15(
  3923. arm_lms_norm_instance_q15 * S,
  3924. q15_t * pSrc,
  3925. q15_t * pRef,
  3926. q15_t * pOut,
  3927. q15_t * pErr,
  3928. uint32_t blockSize);
  3929. /**
  3930. * @brief Initialization function for Q15 normalized LMS filter.
  3931. * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
  3932. * @param[in] numTaps number of filter coefficients.
  3933. * @param[in] *pCoeffs points to coefficient buffer.
  3934. * @param[in] *pState points to state buffer.
  3935. * @param[in] mu step size that controls filter coefficient updates.
  3936. * @param[in] blockSize number of samples to process.
  3937. * @param[in] postShift bit shift applied to coefficients.
  3938. * @return none.
  3939. */
  3940. void arm_lms_norm_init_q15(
  3941. arm_lms_norm_instance_q15 * S,
  3942. uint16_t numTaps,
  3943. q15_t * pCoeffs,
  3944. q15_t * pState,
  3945. q15_t mu,
  3946. uint32_t blockSize,
  3947. uint8_t postShift);
  3948. /**
  3949. * @brief Correlation of floating-point sequences.
  3950. * @param[in] *pSrcA points to the first input sequence.
  3951. * @param[in] srcALen length of the first input sequence.
  3952. * @param[in] *pSrcB points to the second input sequence.
  3953. * @param[in] srcBLen length of the second input sequence.
  3954. * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  3955. * @return none.
  3956. */
  3957. void arm_correlate_f32(
  3958. float32_t * pSrcA,
  3959. uint32_t srcALen,
  3960. float32_t * pSrcB,
  3961. uint32_t srcBLen,
  3962. float32_t * pDst);
  3963. /**
  3964. * @brief Correlation of Q15 sequences
  3965. * @param[in] *pSrcA points to the first input sequence.
  3966. * @param[in] srcALen length of the first input sequence.
  3967. * @param[in] *pSrcB points to the second input sequence.
  3968. * @param[in] srcBLen length of the second input sequence.
  3969. * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  3970. * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  3971. * @return none.
  3972. */
  3973. void arm_correlate_opt_q15(
  3974. q15_t * pSrcA,
  3975. uint32_t srcALen,
  3976. q15_t * pSrcB,
  3977. uint32_t srcBLen,
  3978. q15_t * pDst,
  3979. q15_t * pScratch);
  3980. /**
  3981. * @brief Correlation of Q15 sequences.
  3982. * @param[in] *pSrcA points to the first input sequence.
  3983. * @param[in] srcALen length of the first input sequence.
  3984. * @param[in] *pSrcB points to the second input sequence.
  3985. * @param[in] srcBLen length of the second input sequence.
  3986. * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  3987. * @return none.
  3988. */
  3989. void arm_correlate_q15(
  3990. q15_t * pSrcA,
  3991. uint32_t srcALen,
  3992. q15_t * pSrcB,
  3993. uint32_t srcBLen,
  3994. q15_t * pDst);
  3995. /**
  3996. * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
  3997. * @param[in] *pSrcA points to the first input sequence.
  3998. * @param[in] srcALen length of the first input sequence.
  3999. * @param[in] *pSrcB points to the second input sequence.
  4000. * @param[in] srcBLen length of the second input sequence.
  4001. * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  4002. * @return none.
  4003. */
  4004. void arm_correlate_fast_q15(
  4005. q15_t * pSrcA,
  4006. uint32_t srcALen,
  4007. q15_t * pSrcB,
  4008. uint32_t srcBLen,
  4009. q15_t * pDst);
  4010. /**
  4011. * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
  4012. * @param[in] *pSrcA points to the first input sequence.
  4013. * @param[in] srcALen length of the first input sequence.
  4014. * @param[in] *pSrcB points to the second input sequence.
  4015. * @param[in] srcBLen length of the second input sequence.
  4016. * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  4017. * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  4018. * @return none.
  4019. */
  4020. void arm_correlate_fast_opt_q15(
  4021. q15_t * pSrcA,
  4022. uint32_t srcALen,
  4023. q15_t * pSrcB,
  4024. uint32_t srcBLen,
  4025. q15_t * pDst,
  4026. q15_t * pScratch);
  4027. /**
  4028. * @brief Correlation of Q31 sequences.
  4029. * @param[in] *pSrcA points to the first input sequence.
  4030. * @param[in] srcALen length of the first input sequence.
  4031. * @param[in] *pSrcB points to the second input sequence.
  4032. * @param[in] srcBLen length of the second input sequence.
  4033. * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  4034. * @return none.
  4035. */
  4036. void arm_correlate_q31(
  4037. q31_t * pSrcA,
  4038. uint32_t srcALen,
  4039. q31_t * pSrcB,
  4040. uint32_t srcBLen,
  4041. q31_t * pDst);
  4042. /**
  4043. * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
  4044. * @param[in] *pSrcA points to the first input sequence.
  4045. * @param[in] srcALen length of the first input sequence.
  4046. * @param[in] *pSrcB points to the second input sequence.
  4047. * @param[in] srcBLen length of the second input sequence.
  4048. * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  4049. * @return none.
  4050. */
  4051. void arm_correlate_fast_q31(
  4052. q31_t * pSrcA,
  4053. uint32_t srcALen,
  4054. q31_t * pSrcB,
  4055. uint32_t srcBLen,
  4056. q31_t * pDst);
  4057. /**
  4058. * @brief Correlation of Q7 sequences.
  4059. * @param[in] *pSrcA points to the first input sequence.
  4060. * @param[in] srcALen length of the first input sequence.
  4061. * @param[in] *pSrcB points to the second input sequence.
  4062. * @param[in] srcBLen length of the second input sequence.
  4063. * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  4064. * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
  4065. * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
  4066. * @return none.
  4067. */
  4068. void arm_correlate_opt_q7(
  4069. q7_t * pSrcA,
  4070. uint32_t srcALen,
  4071. q7_t * pSrcB,
  4072. uint32_t srcBLen,
  4073. q7_t * pDst,
  4074. q15_t * pScratch1,
  4075. q15_t * pScratch2);
  4076. /**
  4077. * @brief Correlation of Q7 sequences.
  4078. * @param[in] *pSrcA points to the first input sequence.
  4079. * @param[in] srcALen length of the first input sequence.
  4080. * @param[in] *pSrcB points to the second input sequence.
  4081. * @param[in] srcBLen length of the second input sequence.
  4082. * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
  4083. * @return none.
  4084. */
  4085. void arm_correlate_q7(
  4086. q7_t * pSrcA,
  4087. uint32_t srcALen,
  4088. q7_t * pSrcB,
  4089. uint32_t srcBLen,
  4090. q7_t * pDst);
  4091. /**
  4092. * @brief Instance structure for the floating-point sparse FIR filter.
  4093. */
  4094. typedef struct
  4095. {
  4096. uint16_t numTaps; /**< number of coefficients in the filter. */
  4097. uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
  4098. float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
  4099. float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  4100. uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
  4101. int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
  4102. } arm_fir_sparse_instance_f32;
  4103. /**
  4104. * @brief Instance structure for the Q31 sparse FIR filter.
  4105. */
  4106. typedef struct
  4107. {
  4108. uint16_t numTaps; /**< number of coefficients in the filter. */
  4109. uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
  4110. q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
  4111. q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  4112. uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
  4113. int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
  4114. } arm_fir_sparse_instance_q31;
  4115. /**
  4116. * @brief Instance structure for the Q15 sparse FIR filter.
  4117. */
  4118. typedef struct
  4119. {
  4120. uint16_t numTaps; /**< number of coefficients in the filter. */
  4121. uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
  4122. q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
  4123. q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  4124. uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
  4125. int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
  4126. } arm_fir_sparse_instance_q15;
  4127. /**
  4128. * @brief Instance structure for the Q7 sparse FIR filter.
  4129. */
  4130. typedef struct
  4131. {
  4132. uint16_t numTaps; /**< number of coefficients in the filter. */
  4133. uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
  4134. q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
  4135. q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
  4136. uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
  4137. int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
  4138. } arm_fir_sparse_instance_q7;
  4139. /**
  4140. * @brief Processing function for the floating-point sparse FIR filter.
  4141. * @param[in] *S points to an instance of the floating-point sparse FIR structure.
  4142. * @param[in] *pSrc points to the block of input data.
  4143. * @param[out] *pDst points to the block of output data
  4144. * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
  4145. * @param[in] blockSize number of input samples to process per call.
  4146. * @return none.
  4147. */
  4148. void arm_fir_sparse_f32(
  4149. arm_fir_sparse_instance_f32 * S,
  4150. float32_t * pSrc,
  4151. float32_t * pDst,
  4152. float32_t * pScratchIn,
  4153. uint32_t blockSize);
  4154. /**
  4155. * @brief Initialization function for the floating-point sparse FIR filter.
  4156. * @param[in,out] *S points to an instance of the floating-point sparse FIR structure.
  4157. * @param[in] numTaps number of nonzero coefficients in the filter.
  4158. * @param[in] *pCoeffs points to the array of filter coefficients.
  4159. * @param[in] *pState points to the state buffer.
  4160. * @param[in] *pTapDelay points to the array of offset times.
  4161. * @param[in] maxDelay maximum offset time supported.
  4162. * @param[in] blockSize number of samples that will be processed per block.
  4163. * @return none
  4164. */
  4165. void arm_fir_sparse_init_f32(
  4166. arm_fir_sparse_instance_f32 * S,
  4167. uint16_t numTaps,
  4168. float32_t * pCoeffs,
  4169. float32_t * pState,
  4170. int32_t * pTapDelay,
  4171. uint16_t maxDelay,
  4172. uint32_t blockSize);
  4173. /**
  4174. * @brief Processing function for the Q31 sparse FIR filter.
  4175. * @param[in] *S points to an instance of the Q31 sparse FIR structure.
  4176. * @param[in] *pSrc points to the block of input data.
  4177. * @param[out] *pDst points to the block of output data
  4178. * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
  4179. * @param[in] blockSize number of input samples to process per call.
  4180. * @return none.
  4181. */
  4182. void arm_fir_sparse_q31(
  4183. arm_fir_sparse_instance_q31 * S,
  4184. q31_t * pSrc,
  4185. q31_t * pDst,
  4186. q31_t * pScratchIn,
  4187. uint32_t blockSize);
  4188. /**
  4189. * @brief Initialization function for the Q31 sparse FIR filter.
  4190. * @param[in,out] *S points to an instance of the Q31 sparse FIR structure.
  4191. * @param[in] numTaps number of nonzero coefficients in the filter.
  4192. * @param[in] *pCoeffs points to the array of filter coefficients.
  4193. * @param[in] *pState points to the state buffer.
  4194. * @param[in] *pTapDelay points to the array of offset times.
  4195. * @param[in] maxDelay maximum offset time supported.
  4196. * @param[in] blockSize number of samples that will be processed per block.
  4197. * @return none
  4198. */
  4199. void arm_fir_sparse_init_q31(
  4200. arm_fir_sparse_instance_q31 * S,
  4201. uint16_t numTaps,
  4202. q31_t * pCoeffs,
  4203. q31_t * pState,
  4204. int32_t * pTapDelay,
  4205. uint16_t maxDelay,
  4206. uint32_t blockSize);
  4207. /**
  4208. * @brief Processing function for the Q15 sparse FIR filter.
  4209. * @param[in] *S points to an instance of the Q15 sparse FIR structure.
  4210. * @param[in] *pSrc points to the block of input data.
  4211. * @param[out] *pDst points to the block of output data
  4212. * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
  4213. * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
  4214. * @param[in] blockSize number of input samples to process per call.
  4215. * @return none.
  4216. */
  4217. void arm_fir_sparse_q15(
  4218. arm_fir_sparse_instance_q15 * S,
  4219. q15_t * pSrc,
  4220. q15_t * pDst,
  4221. q15_t * pScratchIn,
  4222. q31_t * pScratchOut,
  4223. uint32_t blockSize);
  4224. /**
  4225. * @brief Initialization function for the Q15 sparse FIR filter.
  4226. * @param[in,out] *S points to an instance of the Q15 sparse FIR structure.
  4227. * @param[in] numTaps number of nonzero coefficients in the filter.
  4228. * @param[in] *pCoeffs points to the array of filter coefficients.
  4229. * @param[in] *pState points to the state buffer.
  4230. * @param[in] *pTapDelay points to the array of offset times.
  4231. * @param[in] maxDelay maximum offset time supported.
  4232. * @param[in] blockSize number of samples that will be processed per block.
  4233. * @return none
  4234. */
  4235. void arm_fir_sparse_init_q15(
  4236. arm_fir_sparse_instance_q15 * S,
  4237. uint16_t numTaps,
  4238. q15_t * pCoeffs,
  4239. q15_t * pState,
  4240. int32_t * pTapDelay,
  4241. uint16_t maxDelay,
  4242. uint32_t blockSize);
  4243. /**
  4244. * @brief Processing function for the Q7 sparse FIR filter.
  4245. * @param[in] *S points to an instance of the Q7 sparse FIR structure.
  4246. * @param[in] *pSrc points to the block of input data.
  4247. * @param[out] *pDst points to the block of output data
  4248. * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
  4249. * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
  4250. * @param[in] blockSize number of input samples to process per call.
  4251. * @return none.
  4252. */
  4253. void arm_fir_sparse_q7(
  4254. arm_fir_sparse_instance_q7 * S,
  4255. q7_t * pSrc,
  4256. q7_t * pDst,
  4257. q7_t * pScratchIn,
  4258. q31_t * pScratchOut,
  4259. uint32_t blockSize);
  4260. /**
  4261. * @brief Initialization function for the Q7 sparse FIR filter.
  4262. * @param[in,out] *S points to an instance of the Q7 sparse FIR structure.
  4263. * @param[in] numTaps number of nonzero coefficients in the filter.
  4264. * @param[in] *pCoeffs points to the array of filter coefficients.
  4265. * @param[in] *pState points to the state buffer.
  4266. * @param[in] *pTapDelay points to the array of offset times.
  4267. * @param[in] maxDelay maximum offset time supported.
  4268. * @param[in] blockSize number of samples that will be processed per block.
  4269. * @return none
  4270. */
  4271. void arm_fir_sparse_init_q7(
  4272. arm_fir_sparse_instance_q7 * S,
  4273. uint16_t numTaps,
  4274. q7_t * pCoeffs,
  4275. q7_t * pState,
  4276. int32_t * pTapDelay,
  4277. uint16_t maxDelay,
  4278. uint32_t blockSize);
  4279. /*
  4280. * @brief Floating-point sin_cos function.
  4281. * @param[in] theta input value in degrees
  4282. * @param[out] *pSinVal points to the processed sine output.
  4283. * @param[out] *pCosVal points to the processed cos output.
  4284. * @return none.
  4285. */
  4286. void arm_sin_cos_f32(
  4287. float32_t theta,
  4288. float32_t * pSinVal,
  4289. float32_t * pCcosVal);
  4290. /*
  4291. * @brief Q31 sin_cos function.
  4292. * @param[in] theta scaled input value in degrees
  4293. * @param[out] *pSinVal points to the processed sine output.
  4294. * @param[out] *pCosVal points to the processed cosine output.
  4295. * @return none.
  4296. */
  4297. void arm_sin_cos_q31(
  4298. q31_t theta,
  4299. q31_t * pSinVal,
  4300. q31_t * pCosVal);
  4301. /**
  4302. * @brief Floating-point complex conjugate.
  4303. * @param[in] *pSrc points to the input vector
  4304. * @param[out] *pDst points to the output vector
  4305. * @param[in] numSamples number of complex samples in each vector
  4306. * @return none.
  4307. */
  4308. void arm_cmplx_conj_f32(
  4309. float32_t * pSrc,
  4310. float32_t * pDst,
  4311. uint32_t numSamples);
  4312. /**
  4313. * @brief Q31 complex conjugate.
  4314. * @param[in] *pSrc points to the input vector
  4315. * @param[out] *pDst points to the output vector
  4316. * @param[in] numSamples number of complex samples in each vector
  4317. * @return none.
  4318. */
  4319. void arm_cmplx_conj_q31(
  4320. q31_t * pSrc,
  4321. q31_t * pDst,
  4322. uint32_t numSamples);
  4323. /**
  4324. * @brief Q15 complex conjugate.
  4325. * @param[in] *pSrc points to the input vector
  4326. * @param[out] *pDst points to the output vector
  4327. * @param[in] numSamples number of complex samples in each vector
  4328. * @return none.
  4329. */
  4330. void arm_cmplx_conj_q15(
  4331. q15_t * pSrc,
  4332. q15_t * pDst,
  4333. uint32_t numSamples);
  4334. /**
  4335. * @brief Floating-point complex magnitude squared
  4336. * @param[in] *pSrc points to the complex input vector
  4337. * @param[out] *pDst points to the real output vector
  4338. * @param[in] numSamples number of complex samples in the input vector
  4339. * @return none.
  4340. */
  4341. void arm_cmplx_mag_squared_f32(
  4342. float32_t * pSrc,
  4343. float32_t * pDst,
  4344. uint32_t numSamples);
  4345. /**
  4346. * @brief Q31 complex magnitude squared
  4347. * @param[in] *pSrc points to the complex input vector
  4348. * @param[out] *pDst points to the real output vector
  4349. * @param[in] numSamples number of complex samples in the input vector
  4350. * @return none.
  4351. */
  4352. void arm_cmplx_mag_squared_q31(
  4353. q31_t * pSrc,
  4354. q31_t * pDst,
  4355. uint32_t numSamples);
  4356. /**
  4357. * @brief Q15 complex magnitude squared
  4358. * @param[in] *pSrc points to the complex input vector
  4359. * @param[out] *pDst points to the real output vector
  4360. * @param[in] numSamples number of complex samples in the input vector
  4361. * @return none.
  4362. */
  4363. void arm_cmplx_mag_squared_q15(
  4364. q15_t * pSrc,
  4365. q15_t * pDst,
  4366. uint32_t numSamples);
  4367. /**
  4368. * @ingroup groupController
  4369. */
  4370. /**
  4371. * @defgroup PID PID Motor Control
  4372. *
  4373. * A Proportional Integral Derivative (PID) controller is a generic feedback control
  4374. * loop mechanism widely used in industrial control systems.
  4375. * A PID controller is the most commonly used type of feedback controller.
  4376. *
  4377. * This set of functions implements (PID) controllers
  4378. * for Q15, Q31, and floating-point data types. The functions operate on a single sample
  4379. * of data and each call to the function returns a single processed value.
  4380. * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
  4381. * is the input sample value. The functions return the output value.
  4382. *
  4383. * \par Algorithm:
  4384. * <pre>
  4385. * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
  4386. * A0 = Kp + Ki + Kd
  4387. * A1 = (-Kp ) - (2 * Kd )
  4388. * A2 = Kd </pre>
  4389. *
  4390. * \par
  4391. * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
  4392. *
  4393. * \par
  4394. * \image html PID.gif "Proportional Integral Derivative Controller"
  4395. *
  4396. * \par
  4397. * The PID controller calculates an "error" value as the difference between
  4398. * the measured output and the reference input.
  4399. * The controller attempts to minimize the error by adjusting the process control inputs.
  4400. * The proportional value determines the reaction to the current error,
  4401. * the integral value determines the reaction based on the sum of recent errors,
  4402. * and the derivative value determines the reaction based on the rate at which the error has been changing.
  4403. *
  4404. * \par Instance Structure
  4405. * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
  4406. * A separate instance structure must be defined for each PID Controller.
  4407. * There are separate instance structure declarations for each of the 3 supported data types.
  4408. *
  4409. * \par Reset Functions
  4410. * There is also an associated reset function for each data type which clears the state array.
  4411. *
  4412. * \par Initialization Functions
  4413. * There is also an associated initialization function for each data type.
  4414. * The initialization function performs the following operations:
  4415. * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
  4416. * - Zeros out the values in the state buffer.
  4417. *
  4418. * \par
  4419. * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
  4420. *
  4421. * \par Fixed-Point Behavior
  4422. * Care must be taken when using the fixed-point versions of the PID Controller functions.
  4423. * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
  4424. * Refer to the function specific documentation below for usage guidelines.
  4425. */
  4426. /**
  4427. * @addtogroup PID
  4428. * @{
  4429. */
  4430. /**
  4431. * @brief Process function for the floating-point PID Control.
  4432. * @param[in,out] *S is an instance of the floating-point PID Control structure
  4433. * @param[in] in input sample to process
  4434. * @return out processed output sample.
  4435. */
  4436. __STATIC_INLINE float32_t arm_pid_f32(
  4437. arm_pid_instance_f32 * S,
  4438. float32_t in)
  4439. {
  4440. float32_t out;
  4441. /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
  4442. out = (S->A0 * in) +
  4443. (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
  4444. /* Update state */
  4445. S->state[1] = S->state[0];
  4446. S->state[0] = in;
  4447. S->state[2] = out;
  4448. /* return to application */
  4449. return (out);
  4450. }
  4451. /**
  4452. * @brief Process function for the Q31 PID Control.
  4453. * @param[in,out] *S points to an instance of the Q31 PID Control structure
  4454. * @param[in] in input sample to process
  4455. * @return out processed output sample.
  4456. *
  4457. * <b>Scaling and Overflow Behavior:</b>
  4458. * \par
  4459. * The function is implemented using an internal 64-bit accumulator.
  4460. * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
  4461. * Thus, if the accumulator result overflows it wraps around rather than clip.
  4462. * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
  4463. * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
  4464. */
  4465. __STATIC_INLINE q31_t arm_pid_q31(
  4466. arm_pid_instance_q31 * S,
  4467. q31_t in)
  4468. {
  4469. q63_t acc;
  4470. q31_t out;
  4471. /* acc = A0 * x[n] */
  4472. acc = (q63_t) S->A0 * in;
  4473. /* acc += A1 * x[n-1] */
  4474. acc += (q63_t) S->A1 * S->state[0];
  4475. /* acc += A2 * x[n-2] */
  4476. acc += (q63_t) S->A2 * S->state[1];
  4477. /* convert output to 1.31 format to add y[n-1] */
  4478. out = (q31_t) (acc >> 31u);
  4479. /* out += y[n-1] */
  4480. out += S->state[2];
  4481. /* Update state */
  4482. S->state[1] = S->state[0];
  4483. S->state[0] = in;
  4484. S->state[2] = out;
  4485. /* return to application */
  4486. return (out);
  4487. }
  4488. /**
  4489. * @brief Process function for the Q15 PID Control.
  4490. * @param[in,out] *S points to an instance of the Q15 PID Control structure
  4491. * @param[in] in input sample to process
  4492. * @return out processed output sample.
  4493. *
  4494. * <b>Scaling and Overflow Behavior:</b>
  4495. * \par
  4496. * The function is implemented using a 64-bit internal accumulator.
  4497. * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
  4498. * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
  4499. * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
  4500. * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
  4501. * Lastly, the accumulator is saturated to yield a result in 1.15 format.
  4502. */
  4503. __STATIC_INLINE q15_t arm_pid_q15(
  4504. arm_pid_instance_q15 * S,
  4505. q15_t in)
  4506. {
  4507. q63_t acc;
  4508. q15_t out;
  4509. /* Implementation of PID controller */
  4510. #ifdef ARM_MATH_CM0
  4511. /* acc = A0 * x[n] */
  4512. acc = ((q31_t) S->A0) * in;
  4513. #else
  4514. /* acc = A0 * x[n] */
  4515. acc = (q31_t) __SMUAD(S->A0, in);
  4516. #endif
  4517. #ifdef ARM_MATH_CM0
  4518. /* acc += A1 * x[n-1] + A2 * x[n-2] */
  4519. acc += (q31_t) S->A1 * S->state[0];
  4520. acc += (q31_t) S->A2 * S->state[1];
  4521. #else
  4522. /* acc += A1 * x[n-1] + A2 * x[n-2] */
  4523. // TODO: this single-instruction version causes a gcc strict-aliasing warning
  4524. //acc = __SMLALD(S->A1, (q31_t) __SIMD32(S->state), acc);
  4525. uint32_t state = (uint32_t)S->state[0] | ((uint32_t)S->state[1] << 16);
  4526. acc = __SMLALD(S->A1, state, acc);
  4527. #endif
  4528. /* acc += y[n-1] */
  4529. acc += (q31_t) S->state[2] << 15;
  4530. /* saturate the output */
  4531. out = (q15_t) (__SSAT((acc >> 15), 16));
  4532. /* Update state */
  4533. S->state[1] = S->state[0];
  4534. S->state[0] = in;
  4535. S->state[2] = out;
  4536. /* return to application */
  4537. return (out);
  4538. }
  4539. /**
  4540. * @} end of PID group
  4541. */
  4542. /**
  4543. * @brief Floating-point matrix inverse.
  4544. * @param[in] *src points to the instance of the input floating-point matrix structure.
  4545. * @param[out] *dst points to the instance of the output floating-point matrix structure.
  4546. * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
  4547. * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
  4548. */
  4549. arm_status arm_mat_inverse_f32(
  4550. const arm_matrix_instance_f32 * src,
  4551. arm_matrix_instance_f32 * dst);
  4552. /**
  4553. * @ingroup groupController
  4554. */
  4555. /**
  4556. * @defgroup clarke Vector Clarke Transform
  4557. * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
  4558. * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
  4559. * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
  4560. * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
  4561. * \image html clarke.gif Stator current space vector and its components in (a,b).
  4562. * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
  4563. * can be calculated using only <code>Ia</code> and <code>Ib</code>.
  4564. *
  4565. * The function operates on a single sample of data and each call to the function returns the processed output.
  4566. * The library provides separate functions for Q31 and floating-point data types.
  4567. * \par Algorithm
  4568. * \image html clarkeFormula.gif
  4569. * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
  4570. * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
  4571. * \par Fixed-Point Behavior
  4572. * Care must be taken when using the Q31 version of the Clarke transform.
  4573. * In particular, the overflow and saturation behavior of the accumulator used must be considered.
  4574. * Refer to the function specific documentation below for usage guidelines.
  4575. */
  4576. /**
  4577. * @addtogroup clarke
  4578. * @{
  4579. */
  4580. /**
  4581. *
  4582. * @brief Floating-point Clarke transform
  4583. * @param[in] Ia input three-phase coordinate <code>a</code>
  4584. * @param[in] Ib input three-phase coordinate <code>b</code>
  4585. * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
  4586. * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
  4587. * @return none.
  4588. */
  4589. __STATIC_INLINE void arm_clarke_f32(
  4590. float32_t Ia,
  4591. float32_t Ib,
  4592. float32_t * pIalpha,
  4593. float32_t * pIbeta)
  4594. {
  4595. /* Calculate pIalpha using the equation, pIalpha = Ia */
  4596. *pIalpha = Ia;
  4597. /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
  4598. *pIbeta =
  4599. ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
  4600. }
  4601. /**
  4602. * @brief Clarke transform for Q31 version
  4603. * @param[in] Ia input three-phase coordinate <code>a</code>
  4604. * @param[in] Ib input three-phase coordinate <code>b</code>
  4605. * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
  4606. * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
  4607. * @return none.
  4608. *
  4609. * <b>Scaling and Overflow Behavior:</b>
  4610. * \par
  4611. * The function is implemented using an internal 32-bit accumulator.
  4612. * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
  4613. * There is saturation on the addition, hence there is no risk of overflow.
  4614. */
  4615. __STATIC_INLINE void arm_clarke_q31(
  4616. q31_t Ia,
  4617. q31_t Ib,
  4618. q31_t * pIalpha,
  4619. q31_t * pIbeta)
  4620. {
  4621. q31_t product1, product2; /* Temporary variables used to store intermediate results */
  4622. /* Calculating pIalpha from Ia by equation pIalpha = Ia */
  4623. *pIalpha = Ia;
  4624. /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
  4625. product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
  4626. /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
  4627. product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
  4628. /* pIbeta is calculated by adding the intermediate products */
  4629. *pIbeta = __QADD(product1, product2);
  4630. }
  4631. /**
  4632. * @} end of clarke group
  4633. */
  4634. /**
  4635. * @brief Converts the elements of the Q7 vector to Q31 vector.
  4636. * @param[in] *pSrc input pointer
  4637. * @param[out] *pDst output pointer
  4638. * @param[in] blockSize number of samples to process
  4639. * @return none.
  4640. */
  4641. void arm_q7_to_q31(
  4642. q7_t * pSrc,
  4643. q31_t * pDst,
  4644. uint32_t blockSize);
  4645. /**
  4646. * @ingroup groupController
  4647. */
  4648. /**
  4649. * @defgroup inv_clarke Vector Inverse Clarke Transform
  4650. * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
  4651. *
  4652. * The function operates on a single sample of data and each call to the function returns the processed output.
  4653. * The library provides separate functions for Q31 and floating-point data types.
  4654. * \par Algorithm
  4655. * \image html clarkeInvFormula.gif
  4656. * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
  4657. * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
  4658. * \par Fixed-Point Behavior
  4659. * Care must be taken when using the Q31 version of the Clarke transform.
  4660. * In particular, the overflow and saturation behavior of the accumulator used must be considered.
  4661. * Refer to the function specific documentation below for usage guidelines.
  4662. */
  4663. /**
  4664. * @addtogroup inv_clarke
  4665. * @{
  4666. */
  4667. /**
  4668. * @brief Floating-point Inverse Clarke transform
  4669. * @param[in] Ialpha input two-phase orthogonal vector axis alpha
  4670. * @param[in] Ibeta input two-phase orthogonal vector axis beta
  4671. * @param[out] *pIa points to output three-phase coordinate <code>a</code>
  4672. * @param[out] *pIb points to output three-phase coordinate <code>b</code>
  4673. * @return none.
  4674. */
  4675. __STATIC_INLINE void arm_inv_clarke_f32(
  4676. float32_t Ialpha,
  4677. float32_t Ibeta,
  4678. float32_t * pIa,
  4679. float32_t * pIb)
  4680. {
  4681. /* Calculating pIa from Ialpha by equation pIa = Ialpha */
  4682. *pIa = Ialpha;
  4683. /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
  4684. *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
  4685. }
  4686. /**
  4687. * @brief Inverse Clarke transform for Q31 version
  4688. * @param[in] Ialpha input two-phase orthogonal vector axis alpha
  4689. * @param[in] Ibeta input two-phase orthogonal vector axis beta
  4690. * @param[out] *pIa points to output three-phase coordinate <code>a</code>
  4691. * @param[out] *pIb points to output three-phase coordinate <code>b</code>
  4692. * @return none.
  4693. *
  4694. * <b>Scaling and Overflow Behavior:</b>
  4695. * \par
  4696. * The function is implemented using an internal 32-bit accumulator.
  4697. * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
  4698. * There is saturation on the subtraction, hence there is no risk of overflow.
  4699. */
  4700. __STATIC_INLINE void arm_inv_clarke_q31(
  4701. q31_t Ialpha,
  4702. q31_t Ibeta,
  4703. q31_t * pIa,
  4704. q31_t * pIb)
  4705. {
  4706. q31_t product1, product2; /* Temporary variables used to store intermediate results */
  4707. /* Calculating pIa from Ialpha by equation pIa = Ialpha */
  4708. *pIa = Ialpha;
  4709. /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
  4710. product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
  4711. /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
  4712. product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
  4713. /* pIb is calculated by subtracting the products */
  4714. *pIb = __QSUB(product2, product1);
  4715. }
  4716. /**
  4717. * @} end of inv_clarke group
  4718. */
  4719. /**
  4720. * @brief Converts the elements of the Q7 vector to Q15 vector.
  4721. * @param[in] *pSrc input pointer
  4722. * @param[out] *pDst output pointer
  4723. * @param[in] blockSize number of samples to process
  4724. * @return none.
  4725. */
  4726. void arm_q7_to_q15(
  4727. q7_t * pSrc,
  4728. q15_t * pDst,
  4729. uint32_t blockSize);
  4730. /**
  4731. * @ingroup groupController
  4732. */
  4733. /**
  4734. * @defgroup park Vector Park Transform
  4735. *
  4736. * Forward Park transform converts the input two-coordinate vector to flux and torque components.
  4737. * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
  4738. * from the stationary to the moving reference frame and control the spatial relationship between
  4739. * the stator vector current and rotor flux vector.
  4740. * If we consider the d axis aligned with the rotor flux, the diagram below shows the
  4741. * current vector and the relationship from the two reference frames:
  4742. * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
  4743. *
  4744. * The function operates on a single sample of data and each call to the function returns the processed output.
  4745. * The library provides separate functions for Q31 and floating-point data types.
  4746. * \par Algorithm
  4747. * \image html parkFormula.gif
  4748. * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
  4749. * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
  4750. * cosine and sine values of theta (rotor flux position).
  4751. * \par Fixed-Point Behavior
  4752. * Care must be taken when using the Q31 version of the Park transform.
  4753. * In particular, the overflow and saturation behavior of the accumulator used must be considered.
  4754. * Refer to the function specific documentation below for usage guidelines.
  4755. */
  4756. /**
  4757. * @addtogroup park
  4758. * @{
  4759. */
  4760. /**
  4761. * @brief Floating-point Park transform
  4762. * @param[in] Ialpha input two-phase vector coordinate alpha
  4763. * @param[in] Ibeta input two-phase vector coordinate beta
  4764. * @param[out] *pId points to output rotor reference frame d
  4765. * @param[out] *pIq points to output rotor reference frame q
  4766. * @param[in] sinVal sine value of rotation angle theta
  4767. * @param[in] cosVal cosine value of rotation angle theta
  4768. * @return none.
  4769. *
  4770. * The function implements the forward Park transform.
  4771. *
  4772. */
  4773. __STATIC_INLINE void arm_park_f32(
  4774. float32_t Ialpha,
  4775. float32_t Ibeta,
  4776. float32_t * pId,
  4777. float32_t * pIq,
  4778. float32_t sinVal,
  4779. float32_t cosVal)
  4780. {
  4781. /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
  4782. *pId = Ialpha * cosVal + Ibeta * sinVal;
  4783. /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
  4784. *pIq = -Ialpha * sinVal + Ibeta * cosVal;
  4785. }
  4786. /**
  4787. * @brief Park transform for Q31 version
  4788. * @param[in] Ialpha input two-phase vector coordinate alpha
  4789. * @param[in] Ibeta input two-phase vector coordinate beta
  4790. * @param[out] *pId points to output rotor reference frame d
  4791. * @param[out] *pIq points to output rotor reference frame q
  4792. * @param[in] sinVal sine value of rotation angle theta
  4793. * @param[in] cosVal cosine value of rotation angle theta
  4794. * @return none.
  4795. *
  4796. * <b>Scaling and Overflow Behavior:</b>
  4797. * \par
  4798. * The function is implemented using an internal 32-bit accumulator.
  4799. * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
  4800. * There is saturation on the addition and subtraction, hence there is no risk of overflow.
  4801. */
  4802. __STATIC_INLINE void arm_park_q31(
  4803. q31_t Ialpha,
  4804. q31_t Ibeta,
  4805. q31_t * pId,
  4806. q31_t * pIq,
  4807. q31_t sinVal,
  4808. q31_t cosVal)
  4809. {
  4810. q31_t product1, product2; /* Temporary variables used to store intermediate results */
  4811. q31_t product3, product4; /* Temporary variables used to store intermediate results */
  4812. /* Intermediate product is calculated by (Ialpha * cosVal) */
  4813. product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
  4814. /* Intermediate product is calculated by (Ibeta * sinVal) */
  4815. product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
  4816. /* Intermediate product is calculated by (Ialpha * sinVal) */
  4817. product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
  4818. /* Intermediate product is calculated by (Ibeta * cosVal) */
  4819. product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
  4820. /* Calculate pId by adding the two intermediate products 1 and 2 */
  4821. *pId = __QADD(product1, product2);
  4822. /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
  4823. *pIq = __QSUB(product4, product3);
  4824. }
  4825. /**
  4826. * @} end of park group
  4827. */
  4828. /**
  4829. * @brief Converts the elements of the Q7 vector to floating-point vector.
  4830. * @param[in] *pSrc is input pointer
  4831. * @param[out] *pDst is output pointer
  4832. * @param[in] blockSize is the number of samples to process
  4833. * @return none.
  4834. */
  4835. void arm_q7_to_float(
  4836. q7_t * pSrc,
  4837. float32_t * pDst,
  4838. uint32_t blockSize);
  4839. /**
  4840. * @ingroup groupController
  4841. */
  4842. /**
  4843. * @defgroup inv_park Vector Inverse Park transform
  4844. * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
  4845. *
  4846. * The function operates on a single sample of data and each call to the function returns the processed output.
  4847. * The library provides separate functions for Q31 and floating-point data types.
  4848. * \par Algorithm
  4849. * \image html parkInvFormula.gif
  4850. * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
  4851. * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
  4852. * cosine and sine values of theta (rotor flux position).
  4853. * \par Fixed-Point Behavior
  4854. * Care must be taken when using the Q31 version of the Park transform.
  4855. * In particular, the overflow and saturation behavior of the accumulator used must be considered.
  4856. * Refer to the function specific documentation below for usage guidelines.
  4857. */
  4858. /**
  4859. * @addtogroup inv_park
  4860. * @{
  4861. */
  4862. /**
  4863. * @brief Floating-point Inverse Park transform
  4864. * @param[in] Id input coordinate of rotor reference frame d
  4865. * @param[in] Iq input coordinate of rotor reference frame q
  4866. * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
  4867. * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
  4868. * @param[in] sinVal sine value of rotation angle theta
  4869. * @param[in] cosVal cosine value of rotation angle theta
  4870. * @return none.
  4871. */
  4872. __STATIC_INLINE void arm_inv_park_f32(
  4873. float32_t Id,
  4874. float32_t Iq,
  4875. float32_t * pIalpha,
  4876. float32_t * pIbeta,
  4877. float32_t sinVal,
  4878. float32_t cosVal)
  4879. {
  4880. /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
  4881. *pIalpha = Id * cosVal - Iq * sinVal;
  4882. /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
  4883. *pIbeta = Id * sinVal + Iq * cosVal;
  4884. }
  4885. /**
  4886. * @brief Inverse Park transform for Q31 version
  4887. * @param[in] Id input coordinate of rotor reference frame d
  4888. * @param[in] Iq input coordinate of rotor reference frame q
  4889. * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
  4890. * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
  4891. * @param[in] sinVal sine value of rotation angle theta
  4892. * @param[in] cosVal cosine value of rotation angle theta
  4893. * @return none.
  4894. *
  4895. * <b>Scaling and Overflow Behavior:</b>
  4896. * \par
  4897. * The function is implemented using an internal 32-bit accumulator.
  4898. * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
  4899. * There is saturation on the addition, hence there is no risk of overflow.
  4900. */
  4901. __STATIC_INLINE void arm_inv_park_q31(
  4902. q31_t Id,
  4903. q31_t Iq,
  4904. q31_t * pIalpha,
  4905. q31_t * pIbeta,
  4906. q31_t sinVal,
  4907. q31_t cosVal)
  4908. {
  4909. q31_t product1, product2; /* Temporary variables used to store intermediate results */
  4910. q31_t product3, product4; /* Temporary variables used to store intermediate results */
  4911. /* Intermediate product is calculated by (Id * cosVal) */
  4912. product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
  4913. /* Intermediate product is calculated by (Iq * sinVal) */
  4914. product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
  4915. /* Intermediate product is calculated by (Id * sinVal) */
  4916. product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
  4917. /* Intermediate product is calculated by (Iq * cosVal) */
  4918. product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
  4919. /* Calculate pIalpha by using the two intermediate products 1 and 2 */
  4920. *pIalpha = __QSUB(product1, product2);
  4921. /* Calculate pIbeta by using the two intermediate products 3 and 4 */
  4922. *pIbeta = __QADD(product4, product3);
  4923. }
  4924. /**
  4925. * @} end of Inverse park group
  4926. */
  4927. /**
  4928. * @brief Converts the elements of the Q31 vector to floating-point vector.
  4929. * @param[in] *pSrc is input pointer
  4930. * @param[out] *pDst is output pointer
  4931. * @param[in] blockSize is the number of samples to process
  4932. * @return none.
  4933. */
  4934. void arm_q31_to_float(
  4935. q31_t * pSrc,
  4936. float32_t * pDst,
  4937. uint32_t blockSize);
  4938. /**
  4939. * @ingroup groupInterpolation
  4940. */
  4941. /**
  4942. * @defgroup LinearInterpolate Linear Interpolation
  4943. *
  4944. * Linear interpolation is a method of curve fitting using linear polynomials.
  4945. * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
  4946. *
  4947. * \par
  4948. * \image html LinearInterp.gif "Linear interpolation"
  4949. *
  4950. * \par
  4951. * A Linear Interpolate function calculates an output value(y), for the input(x)
  4952. * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
  4953. *
  4954. * \par Algorithm:
  4955. * <pre>
  4956. * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
  4957. * where x0, x1 are nearest values of input x
  4958. * y0, y1 are nearest values to output y
  4959. * </pre>
  4960. *
  4961. * \par
  4962. * This set of functions implements Linear interpolation process
  4963. * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
  4964. * sample of data and each call to the function returns a single processed value.
  4965. * <code>S</code> points to an instance of the Linear Interpolate function data structure.
  4966. * <code>x</code> is the input sample value. The functions returns the output value.
  4967. *
  4968. * \par
  4969. * if x is outside of the table boundary, Linear interpolation returns first value of the table
  4970. * if x is below input range and returns last value of table if x is above range.
  4971. */
  4972. /**
  4973. * @addtogroup LinearInterpolate
  4974. * @{
  4975. */
  4976. /**
  4977. * @brief Process function for the floating-point Linear Interpolation Function.
  4978. * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure
  4979. * @param[in] x input sample to process
  4980. * @return y processed output sample.
  4981. *
  4982. */
  4983. __STATIC_INLINE float32_t arm_linear_interp_f32(
  4984. arm_linear_interp_instance_f32 * S,
  4985. float32_t x)
  4986. {
  4987. float32_t y;
  4988. float32_t x0, x1; /* Nearest input values */
  4989. float32_t y0, y1; /* Nearest output values */
  4990. float32_t xSpacing = S->xSpacing; /* spacing between input values */
  4991. int32_t i; /* Index variable */
  4992. float32_t *pYData = S->pYData; /* pointer to output table */
  4993. /* Calculation of index */
  4994. i = (x - S->x1) / xSpacing;
  4995. if(i < 0)
  4996. {
  4997. /* Iniatilize output for below specified range as least output value of table */
  4998. y = pYData[0];
  4999. }
  5000. else if((uint32_t)i >= S->nValues)
  5001. {
  5002. /* Iniatilize output for above specified range as last output value of table */
  5003. y = pYData[S->nValues - 1];
  5004. }
  5005. else
  5006. {
  5007. /* Calculation of nearest input values */
  5008. x0 = S->x1 + i * xSpacing;
  5009. x1 = S->x1 + (i + 1) * xSpacing;
  5010. /* Read of nearest output values */
  5011. y0 = pYData[i];
  5012. y1 = pYData[i + 1];
  5013. /* Calculation of output */
  5014. y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
  5015. }
  5016. /* returns output value */
  5017. return (y);
  5018. }
  5019. /**
  5020. *
  5021. * @brief Process function for the Q31 Linear Interpolation Function.
  5022. * @param[in] *pYData pointer to Q31 Linear Interpolation table
  5023. * @param[in] x input sample to process
  5024. * @param[in] nValues number of table values
  5025. * @return y processed output sample.
  5026. *
  5027. * \par
  5028. * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
  5029. * This function can support maximum of table size 2^12.
  5030. *
  5031. */
  5032. __STATIC_INLINE q31_t arm_linear_interp_q31(
  5033. q31_t * pYData,
  5034. q31_t x,
  5035. uint32_t nValues)
  5036. {
  5037. q31_t y; /* output */
  5038. q31_t y0, y1; /* Nearest output values */
  5039. q31_t fract; /* fractional part */
  5040. int32_t index; /* Index to read nearest output values */
  5041. /* Input is in 12.20 format */
  5042. /* 12 bits for the table index */
  5043. /* Index value calculation */
  5044. index = ((x & 0xFFF00000) >> 20);
  5045. if(index < 0)
  5046. {
  5047. return (pYData[0]);
  5048. }
  5049. else if((uint32_t)index >= (nValues - 1))
  5050. {
  5051. return (pYData[nValues - 1]);
  5052. }
  5053. else
  5054. {
  5055. /* 20 bits for the fractional part */
  5056. /* shift left by 11 to keep fract in 1.31 format */
  5057. fract = (x & 0x000FFFFF) << 11;
  5058. /* Read two nearest output values from the index in 1.31(q31) format */
  5059. y0 = pYData[index];
  5060. y1 = pYData[index + 1u];
  5061. /* Calculation of y0 * (1-fract) and y is in 2.30 format */
  5062. y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
  5063. /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
  5064. y += ((q31_t) (((q63_t) y1 * fract) >> 32));
  5065. /* Convert y to 1.31 format */
  5066. return (y << 1u);
  5067. }
  5068. }
  5069. /**
  5070. *
  5071. * @brief Process function for the Q15 Linear Interpolation Function.
  5072. * @param[in] *pYData pointer to Q15 Linear Interpolation table
  5073. * @param[in] x input sample to process
  5074. * @param[in] nValues number of table values
  5075. * @return y processed output sample.
  5076. *
  5077. * \par
  5078. * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
  5079. * This function can support maximum of table size 2^12.
  5080. *
  5081. */
  5082. __STATIC_INLINE q15_t arm_linear_interp_q15(
  5083. q15_t * pYData,
  5084. q31_t x,
  5085. uint32_t nValues)
  5086. {
  5087. q63_t y; /* output */
  5088. q15_t y0, y1; /* Nearest output values */
  5089. q31_t fract; /* fractional part */
  5090. int32_t index; /* Index to read nearest output values */
  5091. /* Input is in 12.20 format */
  5092. /* 12 bits for the table index */
  5093. /* Index value calculation */
  5094. index = ((x & 0xFFF00000) >> 20u);
  5095. if(index < 0)
  5096. {
  5097. return (pYData[0]);
  5098. }
  5099. else if((uint32_t)index >= (nValues - 1))
  5100. {
  5101. return (pYData[nValues - 1]);
  5102. }
  5103. else
  5104. {
  5105. /* 20 bits for the fractional part */
  5106. /* fract is in 12.20 format */
  5107. fract = (x & 0x000FFFFF);
  5108. /* Read two nearest output values from the index */
  5109. y0 = pYData[index];
  5110. y1 = pYData[index + 1u];
  5111. /* Calculation of y0 * (1-fract) and y is in 13.35 format */
  5112. y = ((q63_t) y0 * (0xFFFFF - fract));
  5113. /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
  5114. y += ((q63_t) y1 * (fract));
  5115. /* convert y to 1.15 format */
  5116. return (y >> 20);
  5117. }
  5118. }
  5119. /**
  5120. *
  5121. * @brief Process function for the Q7 Linear Interpolation Function.
  5122. * @param[in] *pYData pointer to Q7 Linear Interpolation table
  5123. * @param[in] x input sample to process
  5124. * @param[in] nValues number of table values
  5125. * @return y processed output sample.
  5126. *
  5127. * \par
  5128. * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
  5129. * This function can support maximum of table size 2^12.
  5130. */
  5131. __STATIC_INLINE q7_t arm_linear_interp_q7(
  5132. q7_t * pYData,
  5133. q31_t x,
  5134. uint32_t nValues)
  5135. {
  5136. q31_t y; /* output */
  5137. q7_t y0, y1; /* Nearest output values */
  5138. q31_t fract; /* fractional part */
  5139. int32_t index; /* Index to read nearest output values */
  5140. /* Input is in 12.20 format */
  5141. /* 12 bits for the table index */
  5142. /* Index value calculation */
  5143. index = ((x & 0xFFF00000) >> 20u);
  5144. if(index < 0)
  5145. {
  5146. return (pYData[0]);
  5147. }
  5148. else if((uint32_t)index >= (nValues - 1))
  5149. {
  5150. return (pYData[nValues - 1]);
  5151. }
  5152. else
  5153. {
  5154. /* 20 bits for the fractional part */
  5155. /* fract is in 12.20 format */
  5156. fract = (x & 0x000FFFFF);
  5157. /* Read two nearest output values from the index and are in 1.7(q7) format */
  5158. y0 = pYData[index];
  5159. y1 = pYData[index + 1u];
  5160. /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
  5161. y = ((y0 * (0xFFFFF - fract)));
  5162. /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
  5163. y += (y1 * fract);
  5164. /* convert y to 1.7(q7) format */
  5165. return (y >> 20u);
  5166. }
  5167. }
  5168. /**
  5169. * @} end of LinearInterpolate group
  5170. */
  5171. /**
  5172. * @brief Fast approximation to the trigonometric sine function for floating-point data.
  5173. * @param[in] x input value in radians.
  5174. * @return sin(x).
  5175. */
  5176. float32_t arm_sin_f32(
  5177. float32_t x);
  5178. /**
  5179. * @brief Fast approximation to the trigonometric sine function for Q31 data.
  5180. * @param[in] x Scaled input value in radians.
  5181. * @return sin(x).
  5182. */
  5183. q31_t arm_sin_q31(
  5184. q31_t x);
  5185. /**
  5186. * @brief Fast approximation to the trigonometric sine function for Q15 data.
  5187. * @param[in] x Scaled input value in radians.
  5188. * @return sin(x).
  5189. */
  5190. q15_t arm_sin_q15(
  5191. q15_t x);
  5192. /**
  5193. * @brief Fast approximation to the trigonometric cosine function for floating-point data.
  5194. * @param[in] x input value in radians.
  5195. * @return cos(x).
  5196. */
  5197. float32_t arm_cos_f32(
  5198. float32_t x);
  5199. /**
  5200. * @brief Fast approximation to the trigonometric cosine function for Q31 data.
  5201. * @param[in] x Scaled input value in radians.
  5202. * @return cos(x).
  5203. */
  5204. q31_t arm_cos_q31(
  5205. q31_t x);
  5206. /**
  5207. * @brief Fast approximation to the trigonometric cosine function for Q15 data.
  5208. * @param[in] x Scaled input value in radians.
  5209. * @return cos(x).
  5210. */
  5211. q15_t arm_cos_q15(
  5212. q15_t x);
  5213. /**
  5214. * @ingroup groupFastMath
  5215. */
  5216. /**
  5217. * @defgroup SQRT Square Root
  5218. *
  5219. * Computes the square root of a number.
  5220. * There are separate functions for Q15, Q31, and floating-point data types.
  5221. * The square root function is computed using the Newton-Raphson algorithm.
  5222. * This is an iterative algorithm of the form:
  5223. * <pre>
  5224. * x1 = x0 - f(x0)/f'(x0)
  5225. * </pre>
  5226. * where <code>x1</code> is the current estimate,
  5227. * <code>x0</code> is the previous estimate and
  5228. * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
  5229. * For the square root function, the algorithm reduces to:
  5230. * <pre>
  5231. * x0 = in/2 [initial guess]
  5232. * x1 = 1/2 * ( x0 + in / x0) [each iteration]
  5233. * </pre>
  5234. */
  5235. /**
  5236. * @addtogroup SQRT
  5237. * @{
  5238. */
  5239. /**
  5240. * @brief Floating-point square root function.
  5241. * @param[in] in input value.
  5242. * @param[out] *pOut square root of input value.
  5243. * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
  5244. * <code>in</code> is negative value and returns zero output for negative values.
  5245. */
  5246. __STATIC_INLINE arm_status arm_sqrt_f32(
  5247. float32_t in,
  5248. float32_t * pOut)
  5249. {
  5250. if(in > 0)
  5251. {
  5252. // #if __FPU_USED
  5253. #if (__FPU_USED == 1) && defined ( __CC_ARM )
  5254. *pOut = __sqrtf(in);
  5255. #elif (__FPU_USED == 1) && defined ( __TMS_740 )
  5256. *pOut = __builtin_sqrtf(in);
  5257. #else
  5258. *pOut = sqrtf(in);
  5259. #endif
  5260. return (ARM_MATH_SUCCESS);
  5261. }
  5262. else
  5263. {
  5264. *pOut = 0.0f;
  5265. return (ARM_MATH_ARGUMENT_ERROR);
  5266. }
  5267. }
  5268. /**
  5269. * @brief Q31 square root function.
  5270. * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
  5271. * @param[out] *pOut square root of input value.
  5272. * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
  5273. * <code>in</code> is negative value and returns zero output for negative values.
  5274. */
  5275. arm_status arm_sqrt_q31(
  5276. q31_t in,
  5277. q31_t * pOut);
  5278. /**
  5279. * @brief Q15 square root function.
  5280. * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
  5281. * @param[out] *pOut square root of input value.
  5282. * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
  5283. * <code>in</code> is negative value and returns zero output for negative values.
  5284. */
  5285. arm_status arm_sqrt_q15(
  5286. q15_t in,
  5287. q15_t * pOut);
  5288. /**
  5289. * @} end of SQRT group
  5290. */
  5291. /**
  5292. * @brief floating-point Circular write function.
  5293. */
  5294. __STATIC_INLINE void arm_circularWrite_f32(
  5295. int32_t * circBuffer,
  5296. int32_t L,
  5297. uint16_t * writeOffset,
  5298. int32_t bufferInc,
  5299. const int32_t * src,
  5300. int32_t srcInc,
  5301. uint32_t blockSize)
  5302. {
  5303. uint32_t i = 0u;
  5304. int32_t wOffset;
  5305. /* Copy the value of Index pointer that points
  5306. * to the current location where the input samples to be copied */
  5307. wOffset = *writeOffset;
  5308. /* Loop over the blockSize */
  5309. i = blockSize;
  5310. while(i > 0u)
  5311. {
  5312. /* copy the input sample to the circular buffer */
  5313. circBuffer[wOffset] = *src;
  5314. /* Update the input pointer */
  5315. src += srcInc;
  5316. /* Circularly update wOffset. Watch out for positive and negative value */
  5317. wOffset += bufferInc;
  5318. if(wOffset >= L)
  5319. wOffset -= L;
  5320. /* Decrement the loop counter */
  5321. i--;
  5322. }
  5323. /* Update the index pointer */
  5324. *writeOffset = wOffset;
  5325. }
  5326. /**
  5327. * @brief floating-point Circular Read function.
  5328. */
  5329. __STATIC_INLINE void arm_circularRead_f32(
  5330. int32_t * circBuffer,
  5331. int32_t L,
  5332. int32_t * readOffset,
  5333. int32_t bufferInc,
  5334. int32_t * dst,
  5335. int32_t * dst_base,
  5336. int32_t dst_length,
  5337. int32_t dstInc,
  5338. uint32_t blockSize)
  5339. {
  5340. uint32_t i = 0u;
  5341. int32_t rOffset, dst_end;
  5342. /* Copy the value of Index pointer that points
  5343. * to the current location from where the input samples to be read */
  5344. rOffset = *readOffset;
  5345. dst_end = (int32_t) (dst_base + dst_length);
  5346. /* Loop over the blockSize */
  5347. i = blockSize;
  5348. while(i > 0u)
  5349. {
  5350. /* copy the sample from the circular buffer to the destination buffer */
  5351. *dst = circBuffer[rOffset];
  5352. /* Update the input pointer */
  5353. dst += dstInc;
  5354. if(dst == (int32_t *) dst_end)
  5355. {
  5356. dst = dst_base;
  5357. }
  5358. /* Circularly update rOffset. Watch out for positive and negative value */
  5359. rOffset += bufferInc;
  5360. if(rOffset >= L)
  5361. {
  5362. rOffset -= L;
  5363. }
  5364. /* Decrement the loop counter */
  5365. i--;
  5366. }
  5367. /* Update the index pointer */
  5368. *readOffset = rOffset;
  5369. }
  5370. /**
  5371. * @brief Q15 Circular write function.
  5372. */
  5373. __STATIC_INLINE void arm_circularWrite_q15(
  5374. q15_t * circBuffer,
  5375. int32_t L,
  5376. uint16_t * writeOffset,
  5377. int32_t bufferInc,
  5378. const q15_t * src,
  5379. int32_t srcInc,
  5380. uint32_t blockSize)
  5381. {
  5382. uint32_t i = 0u;
  5383. int32_t wOffset;
  5384. /* Copy the value of Index pointer that points
  5385. * to the current location where the input samples to be copied */
  5386. wOffset = *writeOffset;
  5387. /* Loop over the blockSize */
  5388. i = blockSize;
  5389. while(i > 0u)
  5390. {
  5391. /* copy the input sample to the circular buffer */
  5392. circBuffer[wOffset] = *src;
  5393. /* Update the input pointer */
  5394. src += srcInc;
  5395. /* Circularly update wOffset. Watch out for positive and negative value */
  5396. wOffset += bufferInc;
  5397. if(wOffset >= L)
  5398. wOffset -= L;
  5399. /* Decrement the loop counter */
  5400. i--;
  5401. }
  5402. /* Update the index pointer */
  5403. *writeOffset = wOffset;
  5404. }
  5405. /**
  5406. * @brief Q15 Circular Read function.
  5407. */
  5408. __STATIC_INLINE void arm_circularRead_q15(
  5409. q15_t * circBuffer,
  5410. int32_t L,
  5411. int32_t * readOffset,
  5412. int32_t bufferInc,
  5413. q15_t * dst,
  5414. q15_t * dst_base,
  5415. int32_t dst_length,
  5416. int32_t dstInc,
  5417. uint32_t blockSize)
  5418. {
  5419. uint32_t i = 0;
  5420. int32_t rOffset, dst_end;
  5421. /* Copy the value of Index pointer that points
  5422. * to the current location from where the input samples to be read */
  5423. rOffset = *readOffset;
  5424. dst_end = (int32_t) (dst_base + dst_length);
  5425. /* Loop over the blockSize */
  5426. i = blockSize;
  5427. while(i > 0u)
  5428. {
  5429. /* copy the sample from the circular buffer to the destination buffer */
  5430. *dst = circBuffer[rOffset];
  5431. /* Update the input pointer */
  5432. dst += dstInc;
  5433. if(dst == (q15_t *) dst_end)
  5434. {
  5435. dst = dst_base;
  5436. }
  5437. /* Circularly update wOffset. Watch out for positive and negative value */
  5438. rOffset += bufferInc;
  5439. if(rOffset >= L)
  5440. {
  5441. rOffset -= L;
  5442. }
  5443. /* Decrement the loop counter */
  5444. i--;
  5445. }
  5446. /* Update the index pointer */
  5447. *readOffset = rOffset;
  5448. }
  5449. /**
  5450. * @brief Q7 Circular write function.
  5451. */
  5452. __STATIC_INLINE void arm_circularWrite_q7(
  5453. q7_t * circBuffer,
  5454. int32_t L,
  5455. uint16_t * writeOffset,
  5456. int32_t bufferInc,
  5457. const q7_t * src,
  5458. int32_t srcInc,
  5459. uint32_t blockSize)
  5460. {
  5461. uint32_t i = 0u;
  5462. int32_t wOffset;
  5463. /* Copy the value of Index pointer that points
  5464. * to the current location where the input samples to be copied */
  5465. wOffset = *writeOffset;
  5466. /* Loop over the blockSize */
  5467. i = blockSize;
  5468. while(i > 0u)
  5469. {
  5470. /* copy the input sample to the circular buffer */
  5471. circBuffer[wOffset] = *src;
  5472. /* Update the input pointer */
  5473. src += srcInc;
  5474. /* Circularly update wOffset. Watch out for positive and negative value */
  5475. wOffset += bufferInc;
  5476. if(wOffset >= L)
  5477. wOffset -= L;
  5478. /* Decrement the loop counter */
  5479. i--;
  5480. }
  5481. /* Update the index pointer */
  5482. *writeOffset = wOffset;
  5483. }
  5484. /**
  5485. * @brief Q7 Circular Read function.
  5486. */
  5487. __STATIC_INLINE void arm_circularRead_q7(
  5488. q7_t * circBuffer,
  5489. int32_t L,
  5490. int32_t * readOffset,
  5491. int32_t bufferInc,
  5492. q7_t * dst,
  5493. q7_t * dst_base,
  5494. int32_t dst_length,
  5495. int32_t dstInc,
  5496. uint32_t blockSize)
  5497. {
  5498. uint32_t i = 0;
  5499. int32_t rOffset, dst_end;
  5500. /* Copy the value of Index pointer that points
  5501. * to the current location from where the input samples to be read */
  5502. rOffset = *readOffset;
  5503. dst_end = (int32_t) (dst_base + dst_length);
  5504. /* Loop over the blockSize */
  5505. i = blockSize;
  5506. while(i > 0u)
  5507. {
  5508. /* copy the sample from the circular buffer to the destination buffer */
  5509. *dst = circBuffer[rOffset];
  5510. /* Update the input pointer */
  5511. dst += dstInc;
  5512. if(dst == (q7_t *) dst_end)
  5513. {
  5514. dst = dst_base;
  5515. }
  5516. /* Circularly update rOffset. Watch out for positive and negative value */
  5517. rOffset += bufferInc;
  5518. if(rOffset >= L)
  5519. {
  5520. rOffset -= L;
  5521. }
  5522. /* Decrement the loop counter */
  5523. i--;
  5524. }
  5525. /* Update the index pointer */
  5526. *readOffset = rOffset;
  5527. }
  5528. /**
  5529. * @brief Sum of the squares of the elements of a Q31 vector.
  5530. * @param[in] *pSrc is input pointer
  5531. * @param[in] blockSize is the number of samples to process
  5532. * @param[out] *pResult is output value.
  5533. * @return none.
  5534. */
  5535. void arm_power_q31(
  5536. q31_t * pSrc,
  5537. uint32_t blockSize,
  5538. q63_t * pResult);
  5539. /**
  5540. * @brief Sum of the squares of the elements of a floating-point vector.
  5541. * @param[in] *pSrc is input pointer
  5542. * @param[in] blockSize is the number of samples to process
  5543. * @param[out] *pResult is output value.
  5544. * @return none.
  5545. */
  5546. void arm_power_f32(
  5547. float32_t * pSrc,
  5548. uint32_t blockSize,
  5549. float32_t * pResult);
  5550. /**
  5551. * @brief Sum of the squares of the elements of a Q15 vector.
  5552. * @param[in] *pSrc is input pointer
  5553. * @param[in] blockSize is the number of samples to process
  5554. * @param[out] *pResult is output value.
  5555. * @return none.
  5556. */
  5557. void arm_power_q15(
  5558. q15_t * pSrc,
  5559. uint32_t blockSize,
  5560. q63_t * pResult);
  5561. /**
  5562. * @brief Sum of the squares of the elements of a Q7 vector.
  5563. * @param[in] *pSrc is input pointer
  5564. * @param[in] blockSize is the number of samples to process
  5565. * @param[out] *pResult is output value.
  5566. * @return none.
  5567. */
  5568. void arm_power_q7(
  5569. q7_t * pSrc,
  5570. uint32_t blockSize,
  5571. q31_t * pResult);
  5572. /**
  5573. * @brief Mean value of a Q7 vector.
  5574. * @param[in] *pSrc is input pointer
  5575. * @param[in] blockSize is the number of samples to process
  5576. * @param[out] *pResult is output value.
  5577. * @return none.
  5578. */
  5579. void arm_mean_q7(
  5580. q7_t * pSrc,
  5581. uint32_t blockSize,
  5582. q7_t * pResult);
  5583. /**
  5584. * @brief Mean value of a Q15 vector.
  5585. * @param[in] *pSrc is input pointer
  5586. * @param[in] blockSize is the number of samples to process
  5587. * @param[out] *pResult is output value.
  5588. * @return none.
  5589. */
  5590. void arm_mean_q15(
  5591. q15_t * pSrc,
  5592. uint32_t blockSize,
  5593. q15_t * pResult);
  5594. /**
  5595. * @brief Mean value of a Q31 vector.
  5596. * @param[in] *pSrc is input pointer
  5597. * @param[in] blockSize is the number of samples to process
  5598. * @param[out] *pResult is output value.
  5599. * @return none.
  5600. */
  5601. void arm_mean_q31(
  5602. q31_t * pSrc,
  5603. uint32_t blockSize,
  5604. q31_t * pResult);
  5605. /**
  5606. * @brief Mean value of a floating-point vector.
  5607. * @param[in] *pSrc is input pointer
  5608. * @param[in] blockSize is the number of samples to process
  5609. * @param[out] *pResult is output value.
  5610. * @return none.
  5611. */
  5612. void arm_mean_f32(
  5613. float32_t * pSrc,
  5614. uint32_t blockSize,
  5615. float32_t * pResult);
  5616. /**
  5617. * @brief Variance of the elements of a floating-point vector.
  5618. * @param[in] *pSrc is input pointer
  5619. * @param[in] blockSize is the number of samples to process
  5620. * @param[out] *pResult is output value.
  5621. * @return none.
  5622. */
  5623. void arm_var_f32(
  5624. float32_t * pSrc,
  5625. uint32_t blockSize,
  5626. float32_t * pResult);
  5627. /**
  5628. * @brief Variance of the elements of a Q31 vector.
  5629. * @param[in] *pSrc is input pointer
  5630. * @param[in] blockSize is the number of samples to process
  5631. * @param[out] *pResult is output value.
  5632. * @return none.
  5633. */
  5634. void arm_var_q31(
  5635. q31_t * pSrc,
  5636. uint32_t blockSize,
  5637. q63_t * pResult);
  5638. /**
  5639. * @brief Variance of the elements of a Q15 vector.
  5640. * @param[in] *pSrc is input pointer
  5641. * @param[in] blockSize is the number of samples to process
  5642. * @param[out] *pResult is output value.
  5643. * @return none.
  5644. */
  5645. void arm_var_q15(
  5646. q15_t * pSrc,
  5647. uint32_t blockSize,
  5648. q31_t * pResult);
  5649. /**
  5650. * @brief Root Mean Square of the elements of a floating-point vector.
  5651. * @param[in] *pSrc is input pointer
  5652. * @param[in] blockSize is the number of samples to process
  5653. * @param[out] *pResult is output value.
  5654. * @return none.
  5655. */
  5656. void arm_rms_f32(
  5657. float32_t * pSrc,
  5658. uint32_t blockSize,
  5659. float32_t * pResult);
  5660. /**
  5661. * @brief Root Mean Square of the elements of a Q31 vector.
  5662. * @param[in] *pSrc is input pointer
  5663. * @param[in] blockSize is the number of samples to process
  5664. * @param[out] *pResult is output value.
  5665. * @return none.
  5666. */
  5667. void arm_rms_q31(
  5668. q31_t * pSrc,
  5669. uint32_t blockSize,
  5670. q31_t * pResult);
  5671. /**
  5672. * @brief Root Mean Square of the elements of a Q15 vector.
  5673. * @param[in] *pSrc is input pointer
  5674. * @param[in] blockSize is the number of samples to process
  5675. * @param[out] *pResult is output value.
  5676. * @return none.
  5677. */
  5678. void arm_rms_q15(
  5679. q15_t * pSrc,
  5680. uint32_t blockSize,
  5681. q15_t * pResult);
  5682. /**
  5683. * @brief Standard deviation of the elements of a floating-point vector.
  5684. * @param[in] *pSrc is input pointer
  5685. * @param[in] blockSize is the number of samples to process
  5686. * @param[out] *pResult is output value.
  5687. * @return none.
  5688. */
  5689. void arm_std_f32(
  5690. float32_t * pSrc,
  5691. uint32_t blockSize,
  5692. float32_t * pResult);
  5693. /**
  5694. * @brief Standard deviation of the elements of a Q31 vector.
  5695. * @param[in] *pSrc is input pointer
  5696. * @param[in] blockSize is the number of samples to process
  5697. * @param[out] *pResult is output value.
  5698. * @return none.
  5699. */
  5700. void arm_std_q31(
  5701. q31_t * pSrc,
  5702. uint32_t blockSize,
  5703. q31_t * pResult);
  5704. /**
  5705. * @brief Standard deviation of the elements of a Q15 vector.
  5706. * @param[in] *pSrc is input pointer
  5707. * @param[in] blockSize is the number of samples to process
  5708. * @param[out] *pResult is output value.
  5709. * @return none.
  5710. */
  5711. void arm_std_q15(
  5712. q15_t * pSrc,
  5713. uint32_t blockSize,
  5714. q15_t * pResult);
  5715. /**
  5716. * @brief Floating-point complex magnitude
  5717. * @param[in] *pSrc points to the complex input vector
  5718. * @param[out] *pDst points to the real output vector
  5719. * @param[in] numSamples number of complex samples in the input vector
  5720. * @return none.
  5721. */
  5722. void arm_cmplx_mag_f32(
  5723. float32_t * pSrc,
  5724. float32_t * pDst,
  5725. uint32_t numSamples);
  5726. /**
  5727. * @brief Q31 complex magnitude
  5728. * @param[in] *pSrc points to the complex input vector
  5729. * @param[out] *pDst points to the real output vector
  5730. * @param[in] numSamples number of complex samples in the input vector
  5731. * @return none.
  5732. */
  5733. void arm_cmplx_mag_q31(
  5734. q31_t * pSrc,
  5735. q31_t * pDst,
  5736. uint32_t numSamples);
  5737. /**
  5738. * @brief Q15 complex magnitude
  5739. * @param[in] *pSrc points to the complex input vector
  5740. * @param[out] *pDst points to the real output vector
  5741. * @param[in] numSamples number of complex samples in the input vector
  5742. * @return none.
  5743. */
  5744. void arm_cmplx_mag_q15(
  5745. q15_t * pSrc,
  5746. q15_t * pDst,
  5747. uint32_t numSamples);
  5748. /**
  5749. * @brief Q15 complex dot product
  5750. * @param[in] *pSrcA points to the first input vector
  5751. * @param[in] *pSrcB points to the second input vector
  5752. * @param[in] numSamples number of complex samples in each vector
  5753. * @param[out] *realResult real part of the result returned here
  5754. * @param[out] *imagResult imaginary part of the result returned here
  5755. * @return none.
  5756. */
  5757. void arm_cmplx_dot_prod_q15(
  5758. q15_t * pSrcA,
  5759. q15_t * pSrcB,
  5760. uint32_t numSamples,
  5761. q31_t * realResult,
  5762. q31_t * imagResult);
  5763. /**
  5764. * @brief Q31 complex dot product
  5765. * @param[in] *pSrcA points to the first input vector
  5766. * @param[in] *pSrcB points to the second input vector
  5767. * @param[in] numSamples number of complex samples in each vector
  5768. * @param[out] *realResult real part of the result returned here
  5769. * @param[out] *imagResult imaginary part of the result returned here
  5770. * @return none.
  5771. */
  5772. void arm_cmplx_dot_prod_q31(
  5773. q31_t * pSrcA,
  5774. q31_t * pSrcB,
  5775. uint32_t numSamples,
  5776. q63_t * realResult,
  5777. q63_t * imagResult);
  5778. /**
  5779. * @brief Floating-point complex dot product
  5780. * @param[in] *pSrcA points to the first input vector
  5781. * @param[in] *pSrcB points to the second input vector
  5782. * @param[in] numSamples number of complex samples in each vector
  5783. * @param[out] *realResult real part of the result returned here
  5784. * @param[out] *imagResult imaginary part of the result returned here
  5785. * @return none.
  5786. */
  5787. void arm_cmplx_dot_prod_f32(
  5788. float32_t * pSrcA,
  5789. float32_t * pSrcB,
  5790. uint32_t numSamples,
  5791. float32_t * realResult,
  5792. float32_t * imagResult);
  5793. /**
  5794. * @brief Q15 complex-by-real multiplication
  5795. * @param[in] *pSrcCmplx points to the complex input vector
  5796. * @param[in] *pSrcReal points to the real input vector
  5797. * @param[out] *pCmplxDst points to the complex output vector
  5798. * @param[in] numSamples number of samples in each vector
  5799. * @return none.
  5800. */
  5801. void arm_cmplx_mult_real_q15(
  5802. q15_t * pSrcCmplx,
  5803. q15_t * pSrcReal,
  5804. q15_t * pCmplxDst,
  5805. uint32_t numSamples);
  5806. /**
  5807. * @brief Q31 complex-by-real multiplication
  5808. * @param[in] *pSrcCmplx points to the complex input vector
  5809. * @param[in] *pSrcReal points to the real input vector
  5810. * @param[out] *pCmplxDst points to the complex output vector
  5811. * @param[in] numSamples number of samples in each vector
  5812. * @return none.
  5813. */
  5814. void arm_cmplx_mult_real_q31(
  5815. q31_t * pSrcCmplx,
  5816. q31_t * pSrcReal,
  5817. q31_t * pCmplxDst,
  5818. uint32_t numSamples);
  5819. /**
  5820. * @brief Floating-point complex-by-real multiplication
  5821. * @param[in] *pSrcCmplx points to the complex input vector
  5822. * @param[in] *pSrcReal points to the real input vector
  5823. * @param[out] *pCmplxDst points to the complex output vector
  5824. * @param[in] numSamples number of samples in each vector
  5825. * @return none.
  5826. */
  5827. void arm_cmplx_mult_real_f32(
  5828. float32_t * pSrcCmplx,
  5829. float32_t * pSrcReal,
  5830. float32_t * pCmplxDst,
  5831. uint32_t numSamples);
  5832. /**
  5833. * @brief Minimum value of a Q7 vector.
  5834. * @param[in] *pSrc is input pointer
  5835. * @param[in] blockSize is the number of samples to process
  5836. * @param[out] *result is output pointer
  5837. * @param[in] index is the array index of the minimum value in the input buffer.
  5838. * @return none.
  5839. */
  5840. void arm_min_q7(
  5841. q7_t * pSrc,
  5842. uint32_t blockSize,
  5843. q7_t * result,
  5844. uint32_t * index);
  5845. /**
  5846. * @brief Minimum value of a Q15 vector.
  5847. * @param[in] *pSrc is input pointer
  5848. * @param[in] blockSize is the number of samples to process
  5849. * @param[out] *pResult is output pointer
  5850. * @param[in] *pIndex is the array index of the minimum value in the input buffer.
  5851. * @return none.
  5852. */
  5853. void arm_min_q15(
  5854. q15_t * pSrc,
  5855. uint32_t blockSize,
  5856. q15_t * pResult,
  5857. uint32_t * pIndex);
  5858. /**
  5859. * @brief Minimum value of a Q31 vector.
  5860. * @param[in] *pSrc is input pointer
  5861. * @param[in] blockSize is the number of samples to process
  5862. * @param[out] *pResult is output pointer
  5863. * @param[out] *pIndex is the array index of the minimum value in the input buffer.
  5864. * @return none.
  5865. */
  5866. void arm_min_q31(
  5867. q31_t * pSrc,
  5868. uint32_t blockSize,
  5869. q31_t * pResult,
  5870. uint32_t * pIndex);
  5871. /**
  5872. * @brief Minimum value of a floating-point vector.
  5873. * @param[in] *pSrc is input pointer
  5874. * @param[in] blockSize is the number of samples to process
  5875. * @param[out] *pResult is output pointer
  5876. * @param[out] *pIndex is the array index of the minimum value in the input buffer.
  5877. * @return none.
  5878. */
  5879. void arm_min_f32(
  5880. float32_t * pSrc,
  5881. uint32_t blockSize,
  5882. float32_t * pResult,
  5883. uint32_t * pIndex);
  5884. /**
  5885. * @brief Maximum value of a Q7 vector.
  5886. * @param[in] *pSrc points to the input buffer
  5887. * @param[in] blockSize length of the input vector
  5888. * @param[out] *pResult maximum value returned here
  5889. * @param[out] *pIndex index of maximum value returned here
  5890. * @return none.
  5891. */
  5892. void arm_max_q7(
  5893. q7_t * pSrc,
  5894. uint32_t blockSize,
  5895. q7_t * pResult,
  5896. uint32_t * pIndex);
  5897. /**
  5898. * @brief Maximum value of a Q15 vector.
  5899. * @param[in] *pSrc points to the input buffer
  5900. * @param[in] blockSize length of the input vector
  5901. * @param[out] *pResult maximum value returned here
  5902. * @param[out] *pIndex index of maximum value returned here
  5903. * @return none.
  5904. */
  5905. void arm_max_q15(
  5906. q15_t * pSrc,
  5907. uint32_t blockSize,
  5908. q15_t * pResult,
  5909. uint32_t * pIndex);
  5910. /**
  5911. * @brief Maximum value of a Q31 vector.
  5912. * @param[in] *pSrc points to the input buffer
  5913. * @param[in] blockSize length of the input vector
  5914. * @param[out] *pResult maximum value returned here
  5915. * @param[out] *pIndex index of maximum value returned here
  5916. * @return none.
  5917. */
  5918. void arm_max_q31(
  5919. q31_t * pSrc,
  5920. uint32_t blockSize,
  5921. q31_t * pResult,
  5922. uint32_t * pIndex);
  5923. /**
  5924. * @brief Maximum value of a floating-point vector.
  5925. * @param[in] *pSrc points to the input buffer
  5926. * @param[in] blockSize length of the input vector
  5927. * @param[out] *pResult maximum value returned here
  5928. * @param[out] *pIndex index of maximum value returned here
  5929. * @return none.
  5930. */
  5931. void arm_max_f32(
  5932. float32_t * pSrc,
  5933. uint32_t blockSize,
  5934. float32_t * pResult,
  5935. uint32_t * pIndex);
  5936. /**
  5937. * @brief Q15 complex-by-complex multiplication
  5938. * @param[in] *pSrcA points to the first input vector
  5939. * @param[in] *pSrcB points to the second input vector
  5940. * @param[out] *pDst points to the output vector
  5941. * @param[in] numSamples number of complex samples in each vector
  5942. * @return none.
  5943. */
  5944. void arm_cmplx_mult_cmplx_q15(
  5945. q15_t * pSrcA,
  5946. q15_t * pSrcB,
  5947. q15_t * pDst,
  5948. uint32_t numSamples);
  5949. /**
  5950. * @brief Q31 complex-by-complex multiplication
  5951. * @param[in] *pSrcA points to the first input vector
  5952. * @param[in] *pSrcB points to the second input vector
  5953. * @param[out] *pDst points to the output vector
  5954. * @param[in] numSamples number of complex samples in each vector
  5955. * @return none.
  5956. */
  5957. void arm_cmplx_mult_cmplx_q31(
  5958. q31_t * pSrcA,
  5959. q31_t * pSrcB,
  5960. q31_t * pDst,
  5961. uint32_t numSamples);
  5962. /**
  5963. * @brief Floating-point complex-by-complex multiplication
  5964. * @param[in] *pSrcA points to the first input vector
  5965. * @param[in] *pSrcB points to the second input vector
  5966. * @param[out] *pDst points to the output vector
  5967. * @param[in] numSamples number of complex samples in each vector
  5968. * @return none.
  5969. */
  5970. void arm_cmplx_mult_cmplx_f32(
  5971. float32_t * pSrcA,
  5972. float32_t * pSrcB,
  5973. float32_t * pDst,
  5974. uint32_t numSamples);
  5975. /**
  5976. * @brief Converts the elements of the floating-point vector to Q31 vector.
  5977. * @param[in] *pSrc points to the floating-point input vector
  5978. * @param[out] *pDst points to the Q31 output vector
  5979. * @param[in] blockSize length of the input vector
  5980. * @return none.
  5981. */
  5982. void arm_float_to_q31(
  5983. float32_t * pSrc,
  5984. q31_t * pDst,
  5985. uint32_t blockSize);
  5986. /**
  5987. * @brief Converts the elements of the floating-point vector to Q15 vector.
  5988. * @param[in] *pSrc points to the floating-point input vector
  5989. * @param[out] *pDst points to the Q15 output vector
  5990. * @param[in] blockSize length of the input vector
  5991. * @return none
  5992. */
  5993. void arm_float_to_q15(
  5994. float32_t * pSrc,
  5995. q15_t * pDst,
  5996. uint32_t blockSize);
  5997. /**
  5998. * @brief Converts the elements of the floating-point vector to Q7 vector.
  5999. * @param[in] *pSrc points to the floating-point input vector
  6000. * @param[out] *pDst points to the Q7 output vector
  6001. * @param[in] blockSize length of the input vector
  6002. * @return none
  6003. */
  6004. void arm_float_to_q7(
  6005. float32_t * pSrc,
  6006. q7_t * pDst,
  6007. uint32_t blockSize);
  6008. /**
  6009. * @brief Converts the elements of the Q31 vector to Q15 vector.
  6010. * @param[in] *pSrc is input pointer
  6011. * @param[out] *pDst is output pointer
  6012. * @param[in] blockSize is the number of samples to process
  6013. * @return none.
  6014. */
  6015. void arm_q31_to_q15(
  6016. q31_t * pSrc,
  6017. q15_t * pDst,
  6018. uint32_t blockSize);
  6019. /**
  6020. * @brief Converts the elements of the Q31 vector to Q7 vector.
  6021. * @param[in] *pSrc is input pointer
  6022. * @param[out] *pDst is output pointer
  6023. * @param[in] blockSize is the number of samples to process
  6024. * @return none.
  6025. */
  6026. void arm_q31_to_q7(
  6027. q31_t * pSrc,
  6028. q7_t * pDst,
  6029. uint32_t blockSize);
  6030. /**
  6031. * @brief Converts the elements of the Q15 vector to floating-point vector.
  6032. * @param[in] *pSrc is input pointer
  6033. * @param[out] *pDst is output pointer
  6034. * @param[in] blockSize is the number of samples to process
  6035. * @return none.
  6036. */
  6037. void arm_q15_to_float(
  6038. q15_t * pSrc,
  6039. float32_t * pDst,
  6040. uint32_t blockSize);
  6041. /**
  6042. * @brief Converts the elements of the Q15 vector to Q31 vector.
  6043. * @param[in] *pSrc is input pointer
  6044. * @param[out] *pDst is output pointer
  6045. * @param[in] blockSize is the number of samples to process
  6046. * @return none.
  6047. */
  6048. void arm_q15_to_q31(
  6049. q15_t * pSrc,
  6050. q31_t * pDst,
  6051. uint32_t blockSize);
  6052. /**
  6053. * @brief Converts the elements of the Q15 vector to Q7 vector.
  6054. * @param[in] *pSrc is input pointer
  6055. * @param[out] *pDst is output pointer
  6056. * @param[in] blockSize is the number of samples to process
  6057. * @return none.
  6058. */
  6059. void arm_q15_to_q7(
  6060. q15_t * pSrc,
  6061. q7_t * pDst,
  6062. uint32_t blockSize);
  6063. /**
  6064. * @ingroup groupInterpolation
  6065. */
  6066. /**
  6067. * @defgroup BilinearInterpolate Bilinear Interpolation
  6068. *
  6069. * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
  6070. * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
  6071. * determines values between the grid points.
  6072. * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
  6073. * Bilinear interpolation is often used in image processing to rescale images.
  6074. * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
  6075. *
  6076. * <b>Algorithm</b>
  6077. * \par
  6078. * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
  6079. * For floating-point, the instance structure is defined as:
  6080. * <pre>
  6081. * typedef struct
  6082. * {
  6083. * uint16_t numRows;
  6084. * uint16_t numCols;
  6085. * float32_t *pData;
  6086. * } arm_bilinear_interp_instance_f32;
  6087. * </pre>
  6088. *
  6089. * \par
  6090. * where <code>numRows</code> specifies the number of rows in the table;
  6091. * <code>numCols</code> specifies the number of columns in the table;
  6092. * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
  6093. * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
  6094. * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
  6095. *
  6096. * \par
  6097. * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
  6098. * <pre>
  6099. * XF = floor(x)
  6100. * YF = floor(y)
  6101. * </pre>
  6102. * \par
  6103. * The interpolated output point is computed as:
  6104. * <pre>
  6105. * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
  6106. * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
  6107. * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
  6108. * + f(XF+1, YF+1) * (x-XF)*(y-YF)
  6109. * </pre>
  6110. * Note that the coordinates (x, y) contain integer and fractional components.
  6111. * The integer components specify which portion of the table to use while the
  6112. * fractional components control the interpolation processor.
  6113. *
  6114. * \par
  6115. * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
  6116. */
  6117. /**
  6118. * @addtogroup BilinearInterpolate
  6119. * @{
  6120. */
  6121. /**
  6122. *
  6123. * @brief Floating-point bilinear interpolation.
  6124. * @param[in,out] *S points to an instance of the interpolation structure.
  6125. * @param[in] X interpolation coordinate.
  6126. * @param[in] Y interpolation coordinate.
  6127. * @return out interpolated value.
  6128. */
  6129. __STATIC_INLINE float32_t arm_bilinear_interp_f32(
  6130. const arm_bilinear_interp_instance_f32 * S,
  6131. float32_t X,
  6132. float32_t Y)
  6133. {
  6134. float32_t out;
  6135. float32_t f00, f01, f10, f11;
  6136. float32_t *pData = S->pData;
  6137. int32_t xIndex, yIndex, index;
  6138. float32_t xdiff, ydiff;
  6139. float32_t b1, b2, b3, b4;
  6140. xIndex = (int32_t) X;
  6141. yIndex = (int32_t) Y;
  6142. /* Care taken for table outside boundary */
  6143. /* Returns zero output when values are outside table boundary */
  6144. if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0
  6145. || yIndex > (S->numCols - 1))
  6146. {
  6147. return (0);
  6148. }
  6149. /* Calculation of index for two nearest points in X-direction */
  6150. index = (xIndex - 1) + (yIndex - 1) * S->numCols;
  6151. /* Read two nearest points in X-direction */
  6152. f00 = pData[index];
  6153. f01 = pData[index + 1];
  6154. /* Calculation of index for two nearest points in Y-direction */
  6155. index = (xIndex - 1) + (yIndex) * S->numCols;
  6156. /* Read two nearest points in Y-direction */
  6157. f10 = pData[index];
  6158. f11 = pData[index + 1];
  6159. /* Calculation of intermediate values */
  6160. b1 = f00;
  6161. b2 = f01 - f00;
  6162. b3 = f10 - f00;
  6163. b4 = f00 - f01 - f10 + f11;
  6164. /* Calculation of fractional part in X */
  6165. xdiff = X - xIndex;
  6166. /* Calculation of fractional part in Y */
  6167. ydiff = Y - yIndex;
  6168. /* Calculation of bi-linear interpolated output */
  6169. out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
  6170. /* return to application */
  6171. return (out);
  6172. }
  6173. /**
  6174. *
  6175. * @brief Q31 bilinear interpolation.
  6176. * @param[in,out] *S points to an instance of the interpolation structure.
  6177. * @param[in] X interpolation coordinate in 12.20 format.
  6178. * @param[in] Y interpolation coordinate in 12.20 format.
  6179. * @return out interpolated value.
  6180. */
  6181. __STATIC_INLINE q31_t arm_bilinear_interp_q31(
  6182. arm_bilinear_interp_instance_q31 * S,
  6183. q31_t X,
  6184. q31_t Y)
  6185. {
  6186. q31_t out; /* Temporary output */
  6187. q31_t acc = 0; /* output */
  6188. q31_t xfract, yfract; /* X, Y fractional parts */
  6189. q31_t x1, x2, y1, y2; /* Nearest output values */
  6190. int32_t rI, cI; /* Row and column indices */
  6191. q31_t *pYData = S->pData; /* pointer to output table values */
  6192. uint32_t nCols = S->numCols; /* num of rows */
  6193. /* Input is in 12.20 format */
  6194. /* 12 bits for the table index */
  6195. /* Index value calculation */
  6196. rI = ((X & 0xFFF00000) >> 20u);
  6197. /* Input is in 12.20 format */
  6198. /* 12 bits for the table index */
  6199. /* Index value calculation */
  6200. cI = ((Y & 0xFFF00000) >> 20u);
  6201. /* Care taken for table outside boundary */
  6202. /* Returns zero output when values are outside table boundary */
  6203. if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
  6204. {
  6205. return (0);
  6206. }
  6207. /* 20 bits for the fractional part */
  6208. /* shift left xfract by 11 to keep 1.31 format */
  6209. xfract = (X & 0x000FFFFF) << 11u;
  6210. /* Read two nearest output values from the index */
  6211. x1 = pYData[(rI) + nCols * (cI)];
  6212. x2 = pYData[(rI) + nCols * (cI) + 1u];
  6213. /* 20 bits for the fractional part */
  6214. /* shift left yfract by 11 to keep 1.31 format */
  6215. yfract = (Y & 0x000FFFFF) << 11u;
  6216. /* Read two nearest output values from the index */
  6217. y1 = pYData[(rI) + nCols * (cI + 1)];
  6218. y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
  6219. /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
  6220. out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
  6221. acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
  6222. /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
  6223. out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
  6224. acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
  6225. /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
  6226. out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
  6227. acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
  6228. /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
  6229. out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
  6230. acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
  6231. /* Convert acc to 1.31(q31) format */
  6232. return (acc << 2u);
  6233. }
  6234. /**
  6235. * @brief Q15 bilinear interpolation.
  6236. * @param[in,out] *S points to an instance of the interpolation structure.
  6237. * @param[in] X interpolation coordinate in 12.20 format.
  6238. * @param[in] Y interpolation coordinate in 12.20 format.
  6239. * @return out interpolated value.
  6240. */
  6241. __STATIC_INLINE q15_t arm_bilinear_interp_q15(
  6242. arm_bilinear_interp_instance_q15 * S,
  6243. q31_t X,
  6244. q31_t Y)
  6245. {
  6246. q63_t acc = 0; /* output */
  6247. q31_t out; /* Temporary output */
  6248. q15_t x1, x2, y1, y2; /* Nearest output values */
  6249. q31_t xfract, yfract; /* X, Y fractional parts */
  6250. int32_t rI, cI; /* Row and column indices */
  6251. q15_t *pYData = S->pData; /* pointer to output table values */
  6252. uint32_t nCols = S->numCols; /* num of rows */
  6253. /* Input is in 12.20 format */
  6254. /* 12 bits for the table index */
  6255. /* Index value calculation */
  6256. rI = ((X & 0xFFF00000) >> 20);
  6257. /* Input is in 12.20 format */
  6258. /* 12 bits for the table index */
  6259. /* Index value calculation */
  6260. cI = ((Y & 0xFFF00000) >> 20);
  6261. /* Care taken for table outside boundary */
  6262. /* Returns zero output when values are outside table boundary */
  6263. if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
  6264. {
  6265. return (0);
  6266. }
  6267. /* 20 bits for the fractional part */
  6268. /* xfract should be in 12.20 format */
  6269. xfract = (X & 0x000FFFFF);
  6270. /* Read two nearest output values from the index */
  6271. x1 = pYData[(rI) + nCols * (cI)];
  6272. x2 = pYData[(rI) + nCols * (cI) + 1u];
  6273. /* 20 bits for the fractional part */
  6274. /* yfract should be in 12.20 format */
  6275. yfract = (Y & 0x000FFFFF);
  6276. /* Read two nearest output values from the index */
  6277. y1 = pYData[(rI) + nCols * (cI + 1)];
  6278. y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
  6279. /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
  6280. /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
  6281. /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
  6282. out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
  6283. acc = ((q63_t) out * (0xFFFFF - yfract));
  6284. /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
  6285. out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
  6286. acc += ((q63_t) out * (xfract));
  6287. /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
  6288. out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
  6289. acc += ((q63_t) out * (yfract));
  6290. /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
  6291. out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
  6292. acc += ((q63_t) out * (yfract));
  6293. /* acc is in 13.51 format and down shift acc by 36 times */
  6294. /* Convert out to 1.15 format */
  6295. return (acc >> 36);
  6296. }
  6297. /**
  6298. * @brief Q7 bilinear interpolation.
  6299. * @param[in,out] *S points to an instance of the interpolation structure.
  6300. * @param[in] X interpolation coordinate in 12.20 format.
  6301. * @param[in] Y interpolation coordinate in 12.20 format.
  6302. * @return out interpolated value.
  6303. */
  6304. __STATIC_INLINE q7_t arm_bilinear_interp_q7(
  6305. arm_bilinear_interp_instance_q7 * S,
  6306. q31_t X,
  6307. q31_t Y)
  6308. {
  6309. q63_t acc = 0; /* output */
  6310. q31_t out; /* Temporary output */
  6311. q31_t xfract, yfract; /* X, Y fractional parts */
  6312. q7_t x1, x2, y1, y2; /* Nearest output values */
  6313. int32_t rI, cI; /* Row and column indices */
  6314. q7_t *pYData = S->pData; /* pointer to output table values */
  6315. uint32_t nCols = S->numCols; /* num of rows */
  6316. /* Input is in 12.20 format */
  6317. /* 12 bits for the table index */
  6318. /* Index value calculation */
  6319. rI = ((X & 0xFFF00000) >> 20);
  6320. /* Input is in 12.20 format */
  6321. /* 12 bits for the table index */
  6322. /* Index value calculation */
  6323. cI = ((Y & 0xFFF00000) >> 20);
  6324. /* Care taken for table outside boundary */
  6325. /* Returns zero output when values are outside table boundary */
  6326. if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
  6327. {
  6328. return (0);
  6329. }
  6330. /* 20 bits for the fractional part */
  6331. /* xfract should be in 12.20 format */
  6332. xfract = (X & 0x000FFFFF);
  6333. /* Read two nearest output values from the index */
  6334. x1 = pYData[(rI) + nCols * (cI)];
  6335. x2 = pYData[(rI) + nCols * (cI) + 1u];
  6336. /* 20 bits for the fractional part */
  6337. /* yfract should be in 12.20 format */
  6338. yfract = (Y & 0x000FFFFF);
  6339. /* Read two nearest output values from the index */
  6340. y1 = pYData[(rI) + nCols * (cI + 1)];
  6341. y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
  6342. /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
  6343. out = ((x1 * (0xFFFFF - xfract)));
  6344. acc = (((q63_t) out * (0xFFFFF - yfract)));
  6345. /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
  6346. out = ((x2 * (0xFFFFF - yfract)));
  6347. acc += (((q63_t) out * (xfract)));
  6348. /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
  6349. out = ((y1 * (0xFFFFF - xfract)));
  6350. acc += (((q63_t) out * (yfract)));
  6351. /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
  6352. out = ((y2 * (yfract)));
  6353. acc += (((q63_t) out * (xfract)));
  6354. /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
  6355. return (acc >> 40);
  6356. }
  6357. /**
  6358. * @} end of BilinearInterpolate group
  6359. */
  6360. #ifdef __cplusplus
  6361. }
  6362. #endif
  6363. #endif /* _ARM_MATH_H */
  6364. /**
  6365. *
  6366. * End of file.
  6367. */