vpuapi.h 290 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242
  1. //SPDX-License-Identifier: LGPL-2.1 OR BSD-3-Clause
  2. /*
  3. * Copyright (c) 2019, Chips&Media
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice, this
  10. * list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright notice,
  12. * this list of conditions and the following disclaimer in the documentation
  13. * and/or other materials provided with the distribution.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  16. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  19. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  22. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. #ifndef VPUAPI_H_INCLUDED
  27. #define VPUAPI_H_INCLUDED
  28. #ifdef USE_FEEDING_METHOD_BUFFER
  29. #include "wave511/vpuapi/vpuconfig.h"
  30. #include "wave511/vpuapi/vputypes.h"
  31. #include "wave511/vdi/vdi.h"
  32. #include "wave511/vdi/vdi_osal.h"
  33. #include "wave511/vpuapi/vpuerror.h"
  34. #else
  35. #include "vpuconfig.h"
  36. #include "vputypes.h"
  37. #include "../vdi/vdi.h"
  38. #include "../vdi/vdi_osal.h"
  39. #include "vpuerror.h"
  40. #endif
  41. #define MAX_GDI_IDX 31
  42. #define MAX_REG_FRAME MAX_GDI_IDX*2 // 2 for WTL
  43. #define WAVE5_ENC_FBC50_LUMA_TABLE_SIZE(_w, _h) (VPU_ALIGN2048(VPU_ALIGN32(_w))*VPU_ALIGN4(_h)/64)
  44. #define WAVE5_ENC_FBC50_CHROMA_TABLE_SIZE(_w, _h) (VPU_ALIGN2048(VPU_ALIGN32(_w)/2)*VPU_ALIGN4(_h)/128)
  45. #define WAVE5_ENC_FBC50_LOSSLESS_LUMA_10BIT_FRAME_SIZE(_w, _h) ((VPU_ALIGN32(_w)+127)/128*VPU_ALIGN4(_h)*160)
  46. #define WAVE5_ENC_FBC50_LOSSLESS_LUMA_8BIT_FRAME_SIZE(_w, _h) ((VPU_ALIGN32(_w)+127)/128*VPU_ALIGN4(_h)*128)
  47. #define WAVE5_ENC_FBC50_LOSSLESS_CHROMA_10BIT_FRAME_SIZE(_w, _h) ((VPU_ALIGN32(_w)/2+127)/128*VPU_ALIGN4(_h)/2*160)
  48. #define WAVE5_ENC_FBC50_LOSSLESS_CHROMA_8BIT_FRAME_SIZE(_w, _h) ((VPU_ALIGN32(_w)/2+127)/128*VPU_ALIGN4(_h)/2*128)
  49. #define WAVE5_ENC_FBC50_LOSSY_LUMA_FRAME_SIZE(_w, _h, _tx) ((VPU_ALIGN32(_w)+127)/128*VPU_ALIGN4(_h)*VPU_ALIGN32(_tx))
  50. #define WAVE5_ENC_FBC50_LOSSY_CHROMA_FRAME_SIZE(_w, _h, _tx) ((VPU_ALIGN32(_w)/2+127)/128*VPU_ALIGN4(_h)/2*VPU_ALIGN32(_tx))
  51. /* YUV422 cframe */
  52. #define WAVE5_ENC_FBC50_422_CHROMA_TABLE_SIZE(_w, _h) (VPU_ALIGN2048(VPU_ALIGN32(_w)/2)*VPU_ALIGN4(_h)/128*2)
  53. #define WAVE5_ENC_FBC50_LOSSLESS_422_CHROMA_10BIT_FRAME_SIZE(_w, _h) ((VPU_ALIGN32(_w)/2+127)/128*VPU_ALIGN4(_h)*160)
  54. #define WAVE5_ENC_FBC50_LOSSLESS_422_CHROMA_8BIT_FRAME_SIZE(_w, _h) ((VPU_ALIGN32(_w)/2+127)/128*VPU_ALIGN4(_h)*128)
  55. #define WAVE5_ENC_FBC50_LOSSY_422_CHROMA_FRAME_SIZE(_w, _h, _tx) ((VPU_ALIGN32(_w)/2+127)/128*VPU_ALIGN4(_h)*VPU_ALIGN32(_tx))
  56. #define WAVE5_DEC_HEVC_MVCOL_BUF_SIZE(_w, _h) (((_w+63)/64)*((_h+63)/64)*256+ 64)
  57. #define WAVE5_DEC_AVC_MVCOL_BUF_SIZE(_w, _h) ((((VPU_ALIGN256(_w)/16)*(VPU_ALIGN16(_h)/16)) + 16)*80)
  58. #define WAVE5_DEC_VP9_MVCOL_BUF_SIZE(_w, _h) (((VPU_ALIGN64(_w)*VPU_ALIGN64(_h))>>2))
  59. #define WAVE5_DEC_AVS2_MVCOL_BUF_SIZE(_w, _h) (((VPU_ALIGN64(_w)*VPU_ALIGN64(_h))>>5)) // 1 CTU16 = 8bytes, VPU_ALIGN64(w)/16*VPU_ALIGN64(h)/16 * 8 = VPU_ALIGN64(w)*VPU_ALIGN64(h)/32
  60. // AV1 MVCOL BUF SIZE : MFMV + Segment ID + CDF probs table + Film grain param Y + Film graim param C
  61. #define WAVE5_DEC_AV1_MVCOL_BUF_SIZE(_w, _h) (((VPU_ALIGN64(_w)/64)*256 + (VPU_ALIGN256(_w)/64)*128)*(VPU_ALIGN64(_h)/64) + ((VPU_ALIGN64(_w)/64)*(VPU_ALIGN64(_h)/64)*96) + 41984 + 8192 + 4864)
  62. #define WAVE5_DEC_SVAC_MVCOL_BUF_SIZE(_w, _h) (((VPU_ALIGN128(_w)*VPU_ALIGN128(_h))>>2))
  63. #define WAVE5_FBC_LUMA_TABLE_SIZE(_w, _h) (VPU_ALIGN64(_h)*VPU_ALIGN256(_w)/32)
  64. #define WAVE5_FBC_CHROMA_TABLE_SIZE(_w, _h) (VPU_ALIGN64(_h)*VPU_ALIGN256(_w/2)/32)
  65. #define WAVE5_ENC_AVC_MVCOL_BUF_SIZE(_w, _h) (VPU_ALIGN64(_w)*VPU_ALIGN64(_h)/32)
  66. #define WAVE5_ENC_HEVC_MVCOL_BUF_SIZE(_w, _h) (VPU_ALIGN64(_w)/64*VPU_ALIGN64(_h)/64*128)
  67. #define WAVE5_ENC_SVAC_MVCOL_0_BUF_SIZE(_w, _h) (VPU_ALIGN64(_w)/64*VPU_ALIGN64(_h)/64*128) // same as hevc enc.
  68. #define WAVE5_ENC_SVAC_MVCOL_1_BUF_SIZE(_w, _h) (VPU_ALIGN64(_w)/64*VPU_ALIGN64(_h)/64*512) // 2nd col-mv buffer (fixed size)
  69. //------------------------------------------------------------------------------
  70. // common struct and definition
  71. //------------------------------------------------------------------------------
  72. /**
  73. * @brief
  74. @verbatim
  75. This is an enumeration for declaring codec standard type variables. Currently,
  76. VPU supports many different video standards such as H.265/HEVC, MPEG4 SP/ASP, H.263 Profile 3, H.264/AVC
  77. BP/MP/HP, VC1 SP/MP/AP, Divx3, MPEG1, MPEG2, RealVideo 8/9/10, AVS Jizhun/Guangdian profile, AVS2,
  78. Theora, VP3, VP8/VP9 and SVAC.
  79. NOTE: MPEG-1 decoder operation is handled as a special case of MPEG2 decoder.
  80. STD_THO must be always 9.
  81. @endverbatim
  82. */
  83. typedef enum {
  84. STD_AVC,
  85. STD_VC1,
  86. STD_MPEG2,
  87. STD_MPEG4,
  88. STD_H263,
  89. STD_DIV3,
  90. STD_RV,
  91. STD_AVS,
  92. STD_THO = 9,
  93. STD_VP3,
  94. STD_VP8,
  95. STD_HEVC,
  96. STD_VP9,
  97. STD_AVS2,
  98. STD_SVAC,
  99. STD_AV1,
  100. STD_MAX
  101. } CodStd;
  102. /**
  103. * @brief
  104. @verbatim
  105. This is an enumeration for declaring SET_PARAM command options.
  106. Depending on this, SET_PARAM command parameter registers have different settings.
  107. NOTE: This is only for WAVE encoder IP.
  108. @endverbatim
  109. */
  110. typedef enum {
  111. OPT_COMMON = 0, /**< SET_PARAM command option for encoding sequence */
  112. OPT_CUSTOM_GOP = 1, /**< SET_PARAM command option for setting custom GOP */
  113. OPT_CUSTOM_HEADER = 2, /**< SET_PARAM command option for setting custom VPS/SPS/PPS */
  114. OPT_VUI = 3, /**< SET_PARAM command option for encoding VUI */
  115. OPT_CHANGE_PARAM = 0x10, /**< SET_PARAM command option for parameters change (WAVE Encoder only) */
  116. #ifdef SUPPORT_LOOK_AHEAD_RC
  117. OPT_LOOKAHEAD_PARAM_1 = 0x100, /**< SET_PARAM command option for Look Ahead RC parameters setting */
  118. OPT_LOOKAHEAD_PARAM_2 = 0x101, /**< SET_PARAM command option for Look Ahead RC parameters setting */
  119. OPT_LOOKAHEAD_PARAM_3 = 0x102, /**< SET_PARAM command option for Look Ahead RC parameters setting */
  120. OPT_LOOKAHEAD_PARAM_4 = 0x103, /**< SET_PARAM command option for Look Ahead RC parameters setting */
  121. OPT_LOOKAHEAD_PARAM_5 = 0x104, /**< SET_PARAM command option for Look Ahead RC parameters setting */
  122. #endif
  123. } SET_PARAM_OPTION;
  124. /**
  125. * @brief
  126. @verbatim
  127. This is an enumeration for declaring the operation mode of DEC_PIC_HDR command. (WAVE decoder only)
  128. @endverbatim
  129. */
  130. typedef enum {
  131. INIT_SEQ_NORMAL = 0x01, /**< It initializes some parameters (i.e. buffer mode) required for decoding sequence, performs sequence header, and returns information on the sequence. */
  132. INIT_SEQ_W_THUMBNAIL = 0x11, /**< It decodes only the first I picture of sequence to get thumbnail. */
  133. } DEC_PIC_HDR_OPTION;
  134. /**
  135. * @brief
  136. @verbatim
  137. This is an enumeration for declaring the running option of DEC_PIC command. (WAVE decoder only)
  138. @endverbatim
  139. */
  140. typedef enum {
  141. DEC_PIC_NORMAL = 0x00, /**< It is normal mode of DEC_PIC command. */
  142. DEC_PIC_W_THUMBNAIL = 0x10, /**< It handles CRA picture as BLA picture not to use reference from the previously decoded pictures. */
  143. SKIP_NON_IRAP = 0x11, /**< It is thumbnail mode (skip non-IRAP without reference reg.) */
  144. SKIP_NON_RECOVERY = 0x12, /**< It skips to decode non-IRAP pictures. */
  145. SKIP_NON_REF_PIC = 0x13, /**< It skips to decode non-reference pictures which correspond to sub-layer non-reference picture with MAX_DEC_TEMP_ID. (The sub-layer non-reference picture is the one whose nal_unit_type equal to TRAIL_N, TSA_N, STSA_N, RADL_N, RASL_N, RSV_VCL_N10, RSV_VCL_N12, or RSV_VCL_N14. )*/
  146. SKIP_TEMPORAL_LAYER = 0x14, /**< It decodes only frames whose temporal id is equal to or less than MAX_DEC_TEMP_ID. */
  147. SKIP_SVAC_BL = 0x20, /**< It skips base layer pictures. */
  148. SKIP_SVAC_EL = 0x40 /**< It skips enhance layer pictures. */
  149. } DEC_PIC_OPTION;
  150. /**
  151. * @brief
  152. @verbatim
  153. This is an enumeration for declaring options of getting a write pointer of bitstream buffer. (WAVE encoder only)
  154. @endverbatim
  155. */
  156. typedef enum {
  157. GET_ENC_PIC_DONE_WRPTR = 0x00, /**< It reads the write pointer of bitstream buffer after picture encoding is done. */
  158. GET_ENC_BSBUF_FULL_WRPTR = 0x01, /**< It reads the write pointer of bitstream buffer when buffer full is occurred. */
  159. GET_ENC_LOW_LATENCY_WRPTR = 0x02, /**< It reads the write pointer of bitstream buffer when low latency encoding is done. */
  160. } ENC_QUERY_WRPTR_SEL;
  161. /************************************************************************/
  162. /* Limitations */
  163. /************************************************************************/
  164. #define MAX_FRAMEBUFFER_COUNT 31 /* The 32nd framebuffer is reserved for WTL */
  165. /************************************************************************/
  166. /* PROFILE & LEVEL */
  167. /************************************************************************/
  168. /* HEVC */
  169. #define HEVC_PROFILE_MAIN 1
  170. #define HEVC_PROFILE_MAIN10 2
  171. #define HEVC_PROFILE_STILLPICTURE 3
  172. #define HEVC_PROFILE_MAIN10_STILLPICTURE 2
  173. /* VP9 */
  174. #define VP9_PROFILE_0 0
  175. #define VP9_PROFILE_1 1
  176. #define VP9_PROFILE_2 2
  177. #define VP9_PROFILE_3 3
  178. /* AVS2 */
  179. #define AVS2_PROFILE_MAIN_PICTURE 0x12
  180. #define AVS2_PROFILE_MAIN 0x20
  181. #define AVS2_PROFILE_MAIN10 0x22
  182. /* Tier */
  183. #define HEVC_TIER_MAIN 0
  184. #define HEVC_TIER_HIGH 1
  185. /* Level */
  186. #define HEVC_LEVEL(_Major, _Minor) (_Major*10+_Minor)
  187. /* H.264 */
  188. #define H264_PROFILE_BP 66
  189. #define H264_PROFILE_MP 77
  190. #define H264_PROFILE_EXTENDED 88
  191. #define H264_PROFILE_HP 100
  192. #define H264_PROFILE_HIGH10 110
  193. #define H264_PROFILE_HIGH10_INTRA 120
  194. #define H264_PROFILE_HIGH422 122
  195. #define H264_PROFILE_HIGH444 244
  196. #define H264_PROFILE_CAVLC_444_INTRA 44
  197. /* SAVC */
  198. #define SVAC_PROFILE_BASE 0x11
  199. #define SVAC_PROFILE_ADVANCE 0x33
  200. /* H265 USER_DATA(SPS & SEI) ENABLE FLAG */
  201. #define H265_USERDATA_FLAG_RESERVED_0 (0)
  202. #define H265_USERDATA_FLAG_RESERVED_1 (1)
  203. #define H265_USERDATA_FLAG_VUI (2)
  204. #define H265_USERDATA_FLAG_RESERVED_3 (3)
  205. #define H265_USERDATA_FLAG_PIC_TIMING (4)
  206. #define H265_USERDATA_FLAG_ITU_T_T35_PRE (5) /* SEI Prefix: user_data_registered_itu_t_t35 */
  207. #define H265_USERDATA_FLAG_UNREGISTERED_PRE (6) /* SEI Prefix: user_data_unregistered */
  208. #define H265_USERDATA_FLAG_ITU_T_T35_SUF (7) /* SEI Suffix: user_data_registered_itu_t_t35 */
  209. #define H265_USERDATA_FLAG_UNREGISTERED_SUF (8) /* SEI Suffix: user_data_unregistered */
  210. #define H265_USERDATA_FLAG_RECOVERY_POINT (9) /* SEI RESERVED */
  211. #define H265_USERDATA_FLAG_MASTERING_COLOR_VOL (10) /* SEI Prefix: mastering_display_color_volume */
  212. #define H265_USERDATA_FLAG_CHROMA_RESAMPLING_FILTER_HINT (11) /* SEI Prefix: chroma_resampling_filter_hint */
  213. #define H265_USERDATA_FLAG_KNEE_FUNCTION_INFO (12) /* SEI Prefix: knee_function_info */
  214. #define H265_USERDATA_FLAG_TONE_MAPPING_INFO (13) /* SEI Prefix: tone_mapping_info */
  215. #define H265_USERDATA_FLAG_FILM_GRAIN_CHARACTERISTICS_INFO (14) /* SEI Prefix: film_grain_characteristics_info */
  216. #define H265_USERDATA_FLAG_CONTENT_LIGHT_LEVEL_INFO (15) /* SEI Prefix: content_light_level_info */
  217. #define H265_USERDATA_FLAG_COLOUR_REMAPPING_INFO (16) /* SEI Prefix: content_light_level_info */
  218. #define H265_USERDATA_FLAG_ITU_T_T35_PRE_1 (28) /* SEI Prefix: additional user_data_registered_itu_t_t35 */
  219. #define H265_USERDATA_FLAG_ITU_T_T35_PRE_2 (29) /* SEI Prefix: additional user_data_registered_itu_t_t35 */
  220. #define H265_USERDATA_FLAG_ITU_T_T35_SUF_1 (30) /* SEI Suffix: additional user_data_registered_itu_t_t35 */
  221. #define H265_USERDATA_FLAG_ITU_T_T35_SUF_2 (31) /* SEI Suffix: additional user_data_registered_itu_t_t35 */
  222. /* H264 USER_DATA(SPS & SEI) ENABLE FLAG */
  223. #define H264_USERDATA_FLAG_RESERVED_0 (0) /* SEI RESERVED */
  224. #define H264_USERDATA_FLAG_RESERVED_1 (1) /* SEI RESERVED */
  225. #define H264_USERDATA_FLAG_VUI (2) /* SEI RESERVED */
  226. #define H264_USERDATA_FLAG_RESERVED_3 (3) /* SEI RESERVED */
  227. #define H264_USERDATA_FLAG_PIC_TIMING (4) /* SEI : pic_timing */
  228. #define H264_USERDATA_FLAG_ITU_T_T35 (5) /* SEI : user_data_registered_itu_t_t35 */
  229. #define H264_USERDATA_FLAG_UNREGISTERED (6) /* SEI Prefix: user_data_unregistered */
  230. #define H264_USERDATA_FLAG_RESERVED_7 (7) /* SEI RESERVED */
  231. #define H264_USERDATA_FLAG_RESERVED_8 (8) /* SEI RESERVED */
  232. #define H264_USERDATA_FLAG_RESERVED_9 (9) /* SEI RESERVED */
  233. #define H264_USERDATA_FLAG_RESERVED_10 (10) /* SEI : mastering_display_color_volume */
  234. #define H264_USERDATA_FLAG_RESERVED_11 (11) /* SEI RESERVED */
  235. #define H264_USERDATA_FLAG_RESERVED_12 (12) /* SEI RESERVED */
  236. #define H264_USERDATA_FLAG_TONE_MAPPING_INFO (13) /* SEI : tone_mapping_info */
  237. #define H264_USERDATA_FLAG_FILM_GRAIN_CHARACTERISTICS_INFO (14) /* SEI : film_grain_characteristics_info */
  238. #define H264_USERDATA_FLAG_RESERVED_15 (15) /* SEI RESERVED */
  239. #define H264_USERDATA_FLAG_COLOUR_REMAPPING_INFO (16) /* SEI : colour_remapping_info */
  240. #define H264_USERDATA_FLAG_ITU_T_T35_1 (28) /* SEI : user_data_registered_itu_t_t35_1 */
  241. #define H264_USERDATA_FLAG_ITU_T_T35_2 (29) /* SEI : user_data_registered_itu_t_t35_2 */
  242. /************************************************************************/
  243. /* Error codes */
  244. /************************************************************************/
  245. /**
  246. * @brief This is an enumeration for declaring return codes from API function calls.
  247. The meaning of each return code is the same for all of the API functions, but the reasons of
  248. non-successful return might be different. Some details of those reasons are
  249. briefly described in the API definition chapter. In this chapter, the basic meaning
  250. of each return code is presented.
  251. */
  252. typedef enum {
  253. RETCODE_SUCCESS, /**< This means that operation was done successfully. */ /* 0 */
  254. RETCODE_FAILURE, /**< This means that operation was not done successfully. When un-recoverable decoder error happens such as header parsing errors, this value is returned from VPU API. */
  255. RETCODE_INVALID_HANDLE, /**< This means that the given handle for the current API function call was invalid (for example, not initialized yet, improper function call for the given handle, etc.). */
  256. RETCODE_INVALID_PARAM, /**< This means that the given argument parameters (for example, input data structure) was invalid (not initialized yet or not valid anymore). */
  257. RETCODE_INVALID_COMMAND, /**< This means that the given command was invalid (for example, undefined, or not allowed in the given instances). */
  258. RETCODE_ROTATOR_OUTPUT_NOT_SET, /**< This means that rotator output buffer was not allocated even though postprocessor (rotation, mirroring, or deringing) is enabled. */ /* 5 */
  259. RETCODE_ROTATOR_STRIDE_NOT_SET, /**< This means that rotator stride was not provided even though postprocessor (rotation, mirroring, or deringing) is enabled. */
  260. RETCODE_FRAME_NOT_COMPLETE, /**< This means that frame decoding operation was not completed yet, so the given API function call cannot be allowed. */
  261. RETCODE_INVALID_FRAME_BUFFER, /**< This means that the given source frame buffer pointers were invalid in encoder (not initialized yet or not valid anymore). */
  262. RETCODE_INSUFFICIENT_FRAME_BUFFERS, /**< This means that the given numbers of frame buffers were not enough for the operations of the given handle. This return code is only received when calling VPU_DecRegisterFrameBuffer() or VPU_EncRegisterFrameBuffer() function. */
  263. RETCODE_INVALID_STRIDE, /**< This means that the given stride was invalid (for example, 0, not a multiple of 8 or smaller than picture size). This return code is only allowed in API functions which set stride. */ /* 10 */
  264. RETCODE_WRONG_CALL_SEQUENCE, /**< This means that the current API function call was invalid considering the allowed sequences between API functions (for example, missing one crucial function call before this function call). */
  265. RETCODE_CALLED_BEFORE, /**< This means that multiple calls of the current API function for a given instance are invalid. */
  266. RETCODE_NOT_INITIALIZED, /**< This means that VPU was not initialized yet. Before calling any API functions, the initialization API function, VPU_Init(), should be called at the beginning. */
  267. RETCODE_USERDATA_BUF_NOT_SET, /**< This means that there is no memory allocation for reporting userdata. Before setting user data enable, user data buffer address and size should be set with valid value. */
  268. RETCODE_MEMORY_ACCESS_VIOLATION, /**< This means that access violation to the protected memory has been occurred. */ /* 15 */
  269. RETCODE_VPU_RESPONSE_TIMEOUT, /**< This means that VPU response time is too long, time out. */
  270. RETCODE_INSUFFICIENT_RESOURCE, /**< This means that VPU cannot allocate memory due to lack of memory. */
  271. RETCODE_NOT_FOUND_BITCODE_PATH, /**< This means that BIT_CODE_FILE_PATH has a wrong firmware path or firmware size is 0 when calling VPU_InitWithBitcode() function. */
  272. RETCODE_NOT_SUPPORTED_FEATURE, /**< This means that HOST application uses an API option that is not supported in current hardware. */
  273. RETCODE_NOT_FOUND_VPU_DEVICE, /**< This means that HOST application uses the undefined product ID. */ /* 20 */
  274. RETCODE_CP0_EXCEPTION, /**< This means that coprocessor exception has occurred. (WAVE only) */
  275. RETCODE_STREAM_BUF_FULL, /**< This means that stream buffer is full in encoder. */
  276. RETCODE_ACCESS_VIOLATION_HW, /**< This means that GDI access error has occurred. It might come from violation of write protection region or spec-out GDI read/write request. (WAVE only) */
  277. RETCODE_QUERY_FAILURE, /**< This means that query command was not successful. (WAVE5 only) */
  278. RETCODE_QUEUEING_FAILURE, /**< This means that commands cannot be queued. (WAVE5 only) */
  279. RETCODE_VPU_STILL_RUNNING, /**< This means that VPU cannot be flushed or closed now, because VPU is running. (WAVE5 only) */
  280. RETCODE_REPORT_NOT_READY, /**< This means that report is not ready for Query(GET_RESULT) command. (WAVE5 only) */
  281. RETCODE_VLC_BUF_FULL, /**< This means that VLC buffer is full in encoder. (WAVE5 only) */
  282. RETCODE_INVALID_SFS_INSTANCE, /**< This means that current instance can't run sub-framesync. (already an instance was running with sub-frame sync (WAVE5 only) */
  283. RETCODE_ERROR_FW_FATAL, /**< This means that firmware detects a fatal error. (WAVE5 only) */
  284. } RetCode;
  285. /************************************************************************/
  286. /* Utility macros */
  287. /************************************************************************/
  288. #define VPU_CEIL(_data, _align) (((_data)+(_align-1))&~(_align-1))
  289. #define VPU_ALIGN4(_x) (((_x)+0x03)&~0x03)
  290. #define VPU_ALIGN8(_x) (((_x)+0x07)&~0x07)
  291. #define VPU_ALIGN16(_x) (((_x)+0x0f)&~0x0f)
  292. #define VPU_ALIGN32(_x) (((_x)+0x1f)&~0x1f)
  293. #define VPU_ALIGN64(_x) (((_x)+0x3f)&~0x3f)
  294. #define VPU_ALIGN128(_x) (((_x)+0x7f)&~0x7f)
  295. #define VPU_ALIGN256(_x) (((_x)+0xff)&~0xff)
  296. #define VPU_ALIGN512(_x) (((_x)+0x1ff)&~0x1ff)
  297. #define VPU_ALIGN2048(_x) (((_x)+0x7ff)&~0x7ff)
  298. #define VPU_ALIGN4096(_x) (((_x)+0xfff)&~0xfff)
  299. #define VPU_ALIGN16384(_x) (((_x)+0x3fff)&~0x3fff)
  300. /************************************************************************/
  301. /* */
  302. /************************************************************************/
  303. #define INTERRUPT_TIMEOUT_VALUE (-1)
  304. /**
  305. * \brief parameters of DEC_SET_SEQ_CHANGE_MASK
  306. */
  307. #define SEQ_CHANGE_ENABLE_PROFILE (1<<5)
  308. #define SEQ_CHANGE_ENABLE_SIZE (1<<16)
  309. #define SEQ_CHANGE_ENABLE_BITDEPTH (1<<18)
  310. #define SEQ_CHANGE_ENABLE_DPB_COUNT (1<<19)
  311. #define SEQ_CHANGE_INTER_RES_CHANGE (1<<17) /* VP9 */
  312. #define SEQ_CHANGE_ENABLE_ALL_VP9 (SEQ_CHANGE_ENABLE_PROFILE | \
  313. SEQ_CHANGE_ENABLE_SIZE | \
  314. SEQ_CHANGE_INTER_RES_CHANGE | \
  315. SEQ_CHANGE_ENABLE_BITDEPTH | \
  316. SEQ_CHANGE_ENABLE_DPB_COUNT)
  317. #define SEQ_CHANGE_ENABLE_ALL_HEVC (SEQ_CHANGE_ENABLE_PROFILE | \
  318. SEQ_CHANGE_ENABLE_SIZE | \
  319. SEQ_CHANGE_ENABLE_BITDEPTH | \
  320. SEQ_CHANGE_ENABLE_DPB_COUNT)
  321. #define SEQ_CHANGE_ENABLE_ALL_AVS2 (SEQ_CHANGE_ENABLE_PROFILE | \
  322. SEQ_CHANGE_ENABLE_SIZE | \
  323. SEQ_CHANGE_ENABLE_BITDEPTH | \
  324. SEQ_CHANGE_ENABLE_DPB_COUNT)
  325. #define SEQ_CHANGE_ENABLE_ALL_SVAC (SEQ_CHANGE_ENABLE_PROFILE | \
  326. SEQ_CHANGE_ENABLE_SIZE | \
  327. SEQ_CHANGE_ENABLE_BITDEPTH | \
  328. SEQ_CHANGE_ENABLE_DPB_COUNT)
  329. #define SEQ_CHANGE_ENABLE_ALL_AVC (SEQ_CHANGE_ENABLE_SIZE | \
  330. SEQ_CHANGE_ENABLE_BITDEPTH | \
  331. SEQ_CHANGE_ENABLE_DPB_COUNT)
  332. #define SEQ_CHANGE_ENABLE_ALL_AV1 (SEQ_CHANGE_ENABLE_PROFILE | \
  333. SEQ_CHANGE_ENABLE_SIZE | \
  334. SEQ_CHANGE_ENABLE_BITDEPTH | \
  335. SEQ_CHANGE_ENABLE_DPB_COUNT)
  336. #define DISPLAY_IDX_FLAG_SEQ_END -1
  337. #define DISPLAY_IDX_FLAG_NO_FB -3
  338. #define DECODED_IDX_FLAG_NO_FB -1
  339. #define DECODED_IDX_FLAG_SKIP -2
  340. #define DECODED_IDX_FLAG_UNSUPPORT -4 // avc decoder in WAVE5
  341. #define RECON_IDX_FLAG_ENC_END -1
  342. #define RECON_IDX_FLAG_ENC_DELAY -2
  343. #define RECON_IDX_FLAG_HEADER_ONLY -3
  344. #define RECON_IDX_FLAG_CHANGE_PARAM -4
  345. #define MAX_ROI_NUMBER 10
  346. /**
  347. * @brief This is a special enumeration type for some configuration commands
  348. * which can be issued to VPU by HOST application. Most of these commands can be called occasionally,
  349. * not periodically for changing the configuration of decoder or encoder operation running on VPU.
  350. *
  351. */
  352. typedef enum {
  353. ENABLE_ROTATION, /**< This command enables rotation. In this case, `parameter` is ignored. This command returns RETCODE_SUCCESS. */
  354. DISABLE_ROTATION, /**< This command disables rotation. In this case, `parameter` is ignored. This command returns RETCODE_SUCCESS. */
  355. ENABLE_MIRRORING, /**< This command enables mirroring. In this case, `parameter` is ignored. This command returns RETCODE_SUCCESS. */
  356. DISABLE_MIRRORING,/**< This command disables mirroring. In this case, `parameter` is ignored. This command returns RETCODE_SUCCESS. */
  357. /**
  358. @verbatim
  359. This command sets mirror direction of the post-rotator, and `parameter` is
  360. interpreted as a pointer to MirrorDirection. The `parameter` should be one of
  361. MIRDIR_NONE, MIRDIR_VER, MIRDIR_HOR, and MIRDIR_HOR_VER.
  362. @* MIRDIR_NONE: No mirroring
  363. @* MIRDIR_VER: Vertical mirroring
  364. @* MIRDIR_HOR: Horizontal mirroring
  365. @* MIRDIR_HOR_VER: Both directions
  366. This command has one of the following return codes.::
  367. * RETCODE_SUCCESS:
  368. Operation was done successfully, which means given mirroring direction is valid.
  369. * RETCODE_INVALID_PARAM:
  370. The given argument parameter, `parameter`, was invalid, which means given mirroring
  371. direction is invalid.
  372. @endverbatim
  373. */
  374. SET_MIRROR_DIRECTION,
  375. /**
  376. @verbatim
  377. This command sets counter-clockwise angle for post-rotation, and `parameter` is
  378. interpreted as a pointer to the integer which represents rotation angle in
  379. degrees. Rotation angle should be one of 0, 90, 180, and 270.
  380. This command has one of the following return codes.::
  381. * RETCODE_SUCCESS:
  382. Operation was done successfully, which means given rotation angle is valid.
  383. * RETCODE_INVALID_PARAM:
  384. The given argument parameter, `parameter`, was invalid, which means given rotation
  385. angle is invalid.
  386. @endverbatim
  387. */
  388. SET_ROTATION_ANGLE,
  389. /**
  390. @verbatim
  391. This command sets rotator output buffer address. (CODA decoder only) The `parameter` is interpreted as
  392. the pointer of a structure representing physical addresses of YCbCr components
  393. of output frame. For storing the rotated output for display, at least one more
  394. frame buffer should be allocated. When multiple display buffers are required,
  395. HOST application could change the buffer pointer of rotated output at every frame by
  396. issuing this command.
  397. This command has one of the following return codes.::
  398. * RETCODE_SUCCESS:
  399. Operation was done successfully, which means given rotation angle is valid.
  400. * RETCODE_INVALID_PARAM:
  401. The given argument parameter, `parameter`, was invalid, which means given frame
  402. buffer pointer is invalid.
  403. @endverbatim
  404. */
  405. SET_ROTATOR_OUTPUT,
  406. /**
  407. @verbatim
  408. This command sets the stride size of the frame buffer containing rotated output. (CODA decoder only)
  409. The `parameter` is interpreted as the value of stride of the rotated output.
  410. This command has one of the following return codes.::
  411. * RETCODE_SUCCESS:
  412. Operation was done successfully, which means given rotation angle is valid.
  413. * RETCODE_INVALID_STRIDE:
  414. The given argument parameter, `parameter`, was invalid, which means given value of
  415. stride is invalid. The value of stride must be greater than 0 and a multiple of 8.
  416. @endverbatim
  417. */
  418. SET_ROTATOR_STRIDE,
  419. DEC_GET_SEQ_INFO, /**< This command returns the information of the current sequence with <<vpuapi_h_DecInitialInfo>>. This command is mainly used for getting new sequence information after change of sequence. */
  420. /**
  421. @verbatim
  422. This command applies SPS stream received from a certain
  423. out-of-band reception scheme to the decoder.
  424. The stream should be in RBSP format and in big Endian.
  425. The argument `parameter` is interpreted as a pointer to DecParamSet structure.
  426. In this case, `paraSet` is an array of 32 bits which contains SPS RBSP, and `size`
  427. is the size of the stream in bytes.
  428. This command has one of the following return codes.::
  429. * RETCODE_SUCCESS:
  430. Operation was done successfully, which means transferring an SPS RBSP to decoder
  431. was done successfully.
  432. * RETCODE_INVALID_COMMAND:
  433. The given argument `cmd` was invalid, which means the given `cmd` was undefined,
  434. or not allowed in the current instance. In this case, current instance might not
  435. be an H.264/AVC decoder instance.
  436. * RETCODE_INVALID_PARAM:
  437. The given argument parameter, `parameter`, was invalid, which means it has a null
  438. pointer, or given values for some member variables are improper values.
  439. @endverbatim
  440. */
  441. DEC_SET_SPS_RBSP,
  442. /**
  443. @verbatim
  444. This command applies PPS stream received from a certain
  445. out-of-band reception scheme to the decoder. The stream should be in RBSP format and in
  446. big Endian. The argument `parameter` is interpreted as a pointer to a DecParamSet structure.
  447. In this case, paraSet is an array of 32 bits which contains PPS RBSP, and `size`
  448. is the size of the stream in bytes.
  449. This command has one of the following return codes.::
  450. * RETCODE_SUCCESS:
  451. Operation was done successfully, which means transferring a PPS RBSP to decoder
  452. was done successfully.
  453. * RETCODE_INVALID_COMMAND:
  454. The given argument `cmd` was invalid, which means the given cmd was undefined,
  455. or not allowed in the current instance. In this case, current instance might not
  456. be an H.264/AVC decoder instance.
  457. * RETCODE_INVALID_PARAM:
  458. The given argument parameter, `parameter`, was invalid, which means it has a null
  459. pointer, or given values for some member variables are improper values.
  460. @endverbatim
  461. */
  462. DEC_SET_PPS_RBSP,
  463. /**
  464. @verbatim
  465. This command sets DEC_SET_SEQ_CHANGE_MASK which allows VPU to notify change of sequence information
  466. such as picture size, DPB count, profile, and bit-depth.
  467. This command has one of the following return codes.::
  468. * RETCODE_SUCCESS:
  469. Operation was done successfully, which means transferring a PPS RBSP to decoder
  470. was done successfully.
  471. * RETCODE_INVALID_PARAM:
  472. The given argument parameter, `parameter`, was invalid, which means it has a null
  473. pointer, or given values for some member variables are improper values.
  474. @endverbatim
  475. */
  476. DEC_SET_SEQ_CHANGE_MASK,
  477. ENABLE_DERING, /**< This command enables deringing filter of the post-rotator. (CODA decoder only) In this case, `parameter` is ignored. This command returns RETCODE_SUCCESS. */
  478. DISABLE_DERING, /**< This command disables deringing filter of the post-rotator. (CODA decoder only) In this case, `parameter` is ignored. This command returns RETCODE_SUCCESS. */
  479. /**
  480. @verbatim
  481. This command sets the secondary channel of AXI for saving memory bandwidth to
  482. dedicated memory. The argument `parameter` is interpreted as a pointer to <<vpuapi_h_SecAxiUse>> which
  483. represents an enable flag and physical address which is related with the secondary
  484. channel.
  485. This command has one of the following return codes::
  486. * RETCODE_SUCCESS:
  487. Operation was done successfully, which means given value for setting secondary
  488. AXI is valid.
  489. * RETCODE_INVALID_PARAM:
  490. The given argument parameter, `parameter`, was invalid, which means given value is
  491. invalid.
  492. @endverbatim
  493. */
  494. SET_SEC_AXI,
  495. SET_DRAM_CONFIG, /**< This command sets the DRAM attributes to use tiled map. The argument `parameter` is interpreted as a pointer to <<vpuapi_h_DRAMConfig>>. It returns RETCODE_INVALID_PARAM when any value is not given to the argument parameter, `parameter`. (CODA960 only) */ //coda960 only
  496. GET_DRAM_CONFIG, /**< This command gets the DRAM attributes to use tiled map. The argument `parameter` is interpreted as a pointer to <<vpuapi_h_DRAMConfig>>. It returns RETCODE_INVALID_PARAM when any value is not given to the argument parameter, `parameter`. (CODA960 only) */ //coda960 only
  497. /**
  498. @verbatim
  499. This command enables user data report. This command ignores `parameter`.
  500. This command has one of the following return codes.::
  501. * RETCODE_SUCCESS:
  502. Operation was done successfully, which means enabling user data report is done
  503. successfully.
  504. * RETCODE_USERDATA_BUF_NOT_SET:
  505. This means user data buffer address and size have not set yet.
  506. @endverbatim
  507. */
  508. ENABLE_REP_USERDATA,
  509. DISABLE_REP_USERDATA,/**< This command disables user data report. This command ignores `parameter` and returns RETCODE_SUCCESS. */
  510. /**
  511. @verbatim
  512. This command sets user data buffer address. `parameter` is interpreted as a pointer
  513. to address. This command returns as follows.
  514. This command has one of the following return codes.::
  515. * RETCODE_SUCCESS:
  516. Operation was done successfully, which means given value of address is valid and
  517. setting is done successfully.
  518. * RETCODE_INVALID_PARAM:
  519. The given argument parameter `parameter` was invalid, which means given value of
  520. address is invalid. The value of address must be greater than 0 and a multiple
  521. of 8.
  522. @endverbatim
  523. */
  524. SET_ADDR_REP_USERDATA,
  525. /**
  526. @verbatim
  527. This command sets user data buffer address (virtual address) as well as physical address by using SET_ADDR_REP_USERDATA
  528. `parameter` is interpreted as a pointer to address. This command returns as follows.
  529. This command has one of the following return codes.::
  530. * RETCODE_SUCCESS:
  531. Operation was done successfully, which means given value of address is valid and setting is done successfully.
  532. * RETCODE_USERDATA_BUF_NOT_SET:
  533. SET_ADDR_REP_USERDATA command was not been executed
  534. * RETCODE_INVALID_PARAM:
  535. The given argument parameter `parameter` was invalid, which means given value of address is invalid.
  536. The value of address must be greater than 0 and a multiple of 8.
  537. @endverbatim
  538. */
  539. SET_VIRT_ADDR_REP_USERDATA,
  540. /**
  541. @verbatim
  542. This command sets the size of user data buffer which is set with
  543. SET_ADDR_REP_USERDATA command. `parameter` is interpreted as a pointer to the value
  544. of size. This command returns RETCODE_SUCCESS.
  545. According to codec standards, user data type means as below.
  546. @* H.264/AVC
  547. @** 4 : user_data_registered_itu_t_t35
  548. @** 5 : user_data_unregistered
  549. More details are in Annex D of H.264 specifications.
  550. @* VC1
  551. @** 31 : Sequence Level user data
  552. @** 30 : Entry-point Level user data
  553. @** 29 : Frame Level user data
  554. @** 28 : Field Level user data
  555. @** 27 : Slice Level user data
  556. @* MPEG2
  557. @** 0 : Sequence user data
  558. @** 1 : GOP user data
  559. @** 2 : Picture user data
  560. @* MPEG4
  561. @** 0 : VOS user data
  562. @** 1 : VIS user data
  563. @** 2 : VOL user data
  564. @** 3 : GOV user data
  565. The user data size 0 - 15 is used to make offset from userDataBuf Base + 8x17.
  566. It specifies byte size of user data 0 to 15 excluding 0 padding byte,
  567. which exists between user data. So HOST reads 1 user data from
  568. userDataBuf Base + 8x17 + 0 User Data Size + 0 Padding.
  569. Size of 0 padding is (8 - (User Data Size % 8))%8.
  570. @endverbatim
  571. */
  572. SET_SIZE_REP_USERDATA,
  573. /**
  574. @verbatim
  575. This command sets the interrupt flag of user data buffer overflow. (CODA9 only)
  576. @* 0 : interrupt mode
  577. @* 1 : interrupt disable mode
  578. @endverbatim
  579. */
  580. SET_USERDATA_REPORT_MODE,
  581. /**
  582. @verbatim
  583. This command sets the configuration of cache. The `parameter` is interpreted as a pointer to MaverickCacheConfig. (CODA9 only)
  584. This command has one of the following return codes.::
  585. * RETCODE_SUCCESS:
  586. Operation was done successfully, which means given value is valid and setting is done successfully.
  587. * RETCODE_INVALID_PARAM:
  588. The given argument parameter, `parameter`, was invalid. The value of address must be not zero.
  589. @endverbatim
  590. */
  591. SET_CACHE_CONFIG,
  592. /**
  593. @verbatim
  594. This command gets tiled map configuration according to `TiledMapConfig` structure. (CODA9 only)
  595. This command has one of the following return codes.::
  596. * RETCODE_SUCCESS:
  597. Operation was done successfully, which means given value is valid and setting is done successfully.
  598. * RETCODE_INVALID_PARAM:
  599. The given argument parameter, `parameter`, was invalid, which means it has a null pointer,
  600. or given values for some member variables are improper values.
  601. @endverbatim
  602. */
  603. GET_TILEDMAP_CONFIG,
  604. /**
  605. @verbatim
  606. This command sets the low delay decoding options which enable low delay decoding and indicate the number of MB row. (CODA9 decoder only)
  607. The argument `parameter` is interpreted as a pointer to LowDelayInfo which represents an enable flag and the number of MB row.
  608. If low delay decoding is enabled, VPU sends an interrupt and indexFrameDisplay to HOST when the number of MB row decoding is done.
  609. If the interrupt is issued, HOST should clear the interrupt and read indexFrameDisplay from the RET_DEC_PIC_FRAME_IDX register in order to display.
  610. @endverbatim
  611. */
  612. SET_LOW_DELAY_CONFIG,
  613. /**
  614. @verbatim
  615. This command gets the low delay decoding options which enable low delay decoding and indicate the number of MB row. (CODA decoder only)
  616. The argument `parameter` is interpreted as a pointer to LowDelayInfo which represents an enable flag and the number of MB row.
  617. If low delay decoding is enabled, VPU sends an interrupt and indexFrameDisplay to HOST when the number of MB row decoding is done.
  618. If the interrupt is issued, HOST should clear the interrupt and read indexFrameDisplay from the RET_DEC_PIC_FRAME_IDX register in order to display.
  619. @endverbatim
  620. */
  621. GET_LOW_DELAY_OUTPUT,
  622. /**
  623. @verbatim
  624. HOST can set the frameBufDelay value of <<vpuapi_h_DecInitialInfo>>. (CODA9 H.264/AVC decoder only)
  625. This command is useful when HOST is sure of display reorder delay of stream and wants to display soonner than
  626. frameBufDelay value of <<vpuapi_h_DecInitialInfo>> which is calculated based on video specification by VPU.
  627. However, if HOST set an invalid frameBufDelay value, it might lead to failure of display.
  628. @endverbatim
  629. */
  630. DEC_SET_FRAME_DELAY,
  631. DEC_SET_WTL_FRAME_FORMAT, /**< This command sets FrameBufferFormat for WTL. */
  632. DEC_GET_FIELD_PIC_TYPE, /**< This command gets a field picture type of decoded picture after INT_BIT_DEC_FIELD interrupt is issued. */
  633. /**
  634. @verbatim
  635. HOST can get decoder output information according to display index in <<vpuapi_h_DecOutputInfo>> structure.
  636. HOST can set display index using member variable `indexFrameDisplay`.
  637. This command returns RETCODE_SUCCESS.
  638. * Example code
  639. .........................................................................
  640. DecOutputInfo decOutputInfo;
  641. decOutputInfo. indexFrameDisplay = disp_index;
  642. VPU_DecGiveCommand(handle, DEC_GET_DISPLAY_OUTPUT_INFO, & decOutputInfo);
  643. .........................................................................
  644. @endverbatim
  645. */
  646. DEC_GET_DISPLAY_OUTPUT_INFO,
  647. /**
  648. @verbatim
  649. HOST can enable display buffer reordering when decoding H.264 streams. (CODA9 H.264 decoder and WAVE decoder only)
  650. In H.264 case, output decoded picture may be re-ordered if pic_order_cnt_type is 0 or 1. In that case, decoder
  651. must delay output display for re-ordering but some applications (ex. video telephony) do not
  652. want such display delay.
  653. @endverbatim
  654. */
  655. DEC_ENABLE_REORDER,
  656. /**
  657. @verbatim
  658. HOST can disable output display buffer reorder-ing. Then BIT processor does not re-order output buffer when pic_order_cnt_type is 0 or 1. If
  659. In H.264/AVC case. pic_order_cnt_type is 2 or the other standard case, this flag is ignored because output display
  660. buffer reordering is not allowed.
  661. @endverbatim
  662. */
  663. DEC_DISABLE_REORDER,
  664. /**
  665. @verbatim
  666. This command sets error conceal mode for H.264 decoder.
  667. This command must be issued through VPU_DecGiveCommand() before calling VPU_DecGetInitialInfo() or VPU_DecIssueSeqInit().
  668. In other words, error conceal mode cannot be applied once a sequence initialized.
  669. @* AVC_ERROR_CONCEAL_MODE_DEFAULT - VPU performs error concealment in default mode.
  670. @* AVC_ERROR_CONCEAL_MODE_ENABLE_SELECTIVE_CONCEAL_MISSING_REFERENCE -
  671. VPU performs error concealment using another framebuffer if the error comes from missing reference frame.
  672. @* AVC_ERROR_CONCEAL_MODE_DISABLE_CONCEAL_MISSING_REFERENCE -
  673. VPU does not perform error concealment if the error comes from missing reference frame.
  674. @* AVC_ERROR_CONCEAL_MODE_DISABLE_CONCEAL_WRONG_FRAME_NUM -
  675. VPU does not perform error concealment if the error comes from wrong frame_num syntax.
  676. @endverbatim
  677. */
  678. DEC_SET_AVC_ERROR_CONCEAL_MODE,
  679. /**
  680. @verbatim
  681. HOST can free all the frame buffers allocated by VPUAPI. (CODA9 only)
  682. This command is useful when VPU detects sequence change.
  683. For example, if HOST knows resolution change while decoding through `sequenceChanged` variable of <<vpuapi_h_DecOutputInfo>> structure,
  684. HOST should change the size of frame buffer accordingly.
  685. This command is used to release the frame buffers allocated for the previous sequence.
  686. Then VPU_DecGetInitialInfo() and VPU_DecIsseuSeqInit() are called before frame buffer allocation for a new sequence.
  687. @endverbatim
  688. */
  689. DEC_FREE_FRAME_BUFFER,
  690. DEC_GET_FRAMEBUF_INFO, /**< This command gives HOST the information of framebuffer in <<vpuapi_h_DecGetFramebufInfo>>. (WAVE only) */
  691. DEC_RESET_FRAMEBUF_INFO, /**< This command resets the information of framebuffer. Unlike DEC_FREE_FRAME_BUFFER, it does not release the assigned memory itself. This command is used for sequence change along with DEC_GET_FRAMEBUF_INFO. */
  692. /**
  693. @verbatim
  694. This command decodes only an I-frame of picture from bitstream for using it as a thumbnail.
  695. It requires as little as size of frame buffer since I-picture does not need any reference picture.
  696. If HOST issues this command and sets one frame buffer address to FrameBuffer array in VPU_DecRegisterFrameBuffer(),
  697. only the frame buffer is used.
  698. And please make sure that the number of frame buffer `num` should be registered as minFrameBufferCount.
  699. @endverbatim
  700. */
  701. ENABLE_DEC_THUMBNAIL_MODE,
  702. /**
  703. @verbatim
  704. Applications can set a display flag for each frame buffer by calling this function after creating
  705. decoder instance. If a certain display flag of frame buffer is set, the frame buffer cannot be used in the
  706. decoding process. Applications can control displaying a buffer with this command
  707. to prevent VPU from using buffer in every decoding process.
  708. This command is the opposite of what VPU_DecClrDispFlag() does.
  709. @endverbatim
  710. */
  711. DEC_SET_DISPLAY_FLAG,
  712. DEC_GET_SCALER_INFO, /**< This command returns setting information to downscale an image such as enable, width, and height. */
  713. DEC_SET_SCALER_INFO, /**< This command sets information to downscale an image such as enable, width, and height. */
  714. DEC_SET_TARGET_TEMPORAL_ID, /**< This command decodes only a frame whose temporal id is equal to or less than the given target temporal id. (H.265/HEVC decoder only) */ //!<< H.265 temporal scalability
  715. DEC_SET_BWB_CUR_FRAME_IDX, /**< This command specifies the index of linear frame buffer which needs to be changed to due to change of inter-frame resolution while decoding. (VP9 decoder only) */
  716. DEC_SET_FBC_CUR_FRAME_IDX, /**< This command specifies the index of FBC frame buffer which needs to be changed to due to change of inter-frame resolution while decoding. (VP9 decoder only) */
  717. DEC_SET_INTER_RES_INFO_ON, /**< This command informs inter-frame resolution has been changed while decoding. After this command issued, VPU reallocates one frame buffer for the change. (VP9 decoder only) */
  718. DEC_SET_INTER_RES_INFO_OFF, /**< This command releases the flag informing inter-frame resolution change. It should be issued after reallocation of one frame buffer is completed. (VP9 decoder only) */
  719. DEC_FREE_FBC_TABLE_BUFFER, /**< This command frees one FBC table to deal with inter-frame resolution change. (VP9 decoder only) */
  720. DEC_FREE_MV_BUFFER, /**< This command frees one MV buffer to deal with inter-frame resolution change. (VP9 decoder only) */
  721. DEC_ALLOC_FBC_Y_TABLE_BUFFER, /**< This command allocates one FBC luma table to deal with inter-frame resolution change. (VP9 decoder only) */
  722. DEC_ALLOC_FBC_C_TABLE_BUFFER, /**< This command allocates one FBC chroma table to deal with inter-frame resolution change. (VP9 decoder only) */
  723. DEC_ALLOC_MV_BUFFER, /**< This command allocates one MV buffer to deal with inter-frame resolution change. (VP9 decoder only) */
  724. DEC_SET_TEMPORAL_ID_MODE, /**< This command specifies the target temporal layer id selection mode. (WAVE decoder only) */
  725. /**
  726. @verbatim
  727. This command writes an RBSP format of the SPS/PPS to parameter buffer.(CODA9 encoder only)
  728. This command has one of the following return codes.::
  729. * RETCODE_SUCCESS:
  730. Operation was done successfully, which means the requested header
  731. syntax was successfully inserted.
  732. * RETCODE_INVALID_COMMAND:
  733. This means the given argument cmd was invalid
  734. which means the given cmd was undefined, or not allowed in the current instance. In this
  735. case, the current instance might not be an MPEG4 encoder instance.
  736. * RETCODE_INVALID_PARAM:
  737. The given argument parameter `parameter` was invalid, which means
  738. it has a null pointer, or given values for some member variables are improper values.
  739. @endverbatim
  740. */
  741. ENC_SET_PARAM,
  742. //vpu put header stream to bitstream buffer
  743. /**
  744. @verbatim
  745. This command inserts an MPEG4 header syntax or SPS or PPS to the HEVC/AVC bitstream to the bitstream
  746. during encoding. It is valid for all types of encoders. The argument `parameter` is interpreted as a pointer to <<vpuapi_h_EncHeaderParam>> holding
  747. * buf is a physical address pointing the generated stream location
  748. * size is the size of generated stream in bytes
  749. * headerType is a type of header that HOST application wants to generate and have values as
  750. <<vpuapi_h_Mp4HeaderType>>, <<vpuapi_h_AvcHeaderType>>, <<vpuapi_h_WaveEncHeaderType>>.
  751. This command has one of the following return codes.::
  752. +
  753. --
  754. * RETCODE_SUCCESS:
  755. Operation was done successfully, which means the requested header
  756. syntax was successfully inserted.
  757. * RETCODE_INVALID_COMMAND:
  758. This means the given argument cmd was invalid
  759. which means the given cmd was undefined, or not allowed in the current instance. In this
  760. case, the current instance might not be an MPEG4 encoder instance.
  761. * RETCODE_INVALID_PARAM:
  762. The given argument parameter `parameter` or headerType
  763. was invalid, which means it has a null pointer, or given values for some member variables
  764. are improper values.
  765. * RETCODE_VPU_RESPONSE_TIMEOUT:
  766. Operation has not recieved any response from VPU and has timed out.
  767. --
  768. @endverbatim
  769. */
  770. ENC_PUT_VIDEO_HEADER,
  771. /**
  772. @verbatim
  773. This command changes intra MB refresh number of header syntax during encoding. (ChangeParam command for CODA9 encoder only)
  774. The argument `parameter` is interpreted as a pointer to integer which
  775. represents an intra refresh number. It should be between 0 and
  776. macroblock number of encoded picture.
  777. This command returns the following code.::
  778. * RETCODE_SUCCESS:
  779. Operation was done successfully, which means the requested header syntax was
  780. successfully inserted.
  781. * RETCODE_VPU_RESPONSE_TIMEOUT:
  782. Operation has not received any response from VPU and has timed out.
  783. @endverbatim
  784. */
  785. ENC_SET_INTRA_MB_REFRESH_NUMBER,
  786. /**
  787. @verbatim
  788. This command enables HEC(Header Extension Code) syntax of MPEG4.
  789. This command ignores the argument `parameter` and returns one of the following return codes.::
  790. * RETCODE_SUCCESS:
  791. Operation was done successfully, which means the requested header syntax was
  792. successfully inserted.
  793. * RETCODE_INVALID_COMMAND:
  794. This means the given argument, cmd, was invalid which means the given cmd was
  795. undefined, or not allowed in the current instance. In this case, the current
  796. instance might not be an MPEG4 encoder instance.
  797. * RETCODE_VPU_RESPONSE_TIMEOUT:
  798. Operation has not received any response from VPU and has timed out.
  799. @endverbatim
  800. */
  801. ENC_ENABLE_HEC,
  802. /**
  803. @verbatim
  804. This command disables HEC(Header Extension Code) syntax of MPEG4.
  805. This command ignores the argument `parameter` and returns one of the following return codes.::
  806. * RETCODE_SUCCESS:
  807. Operation was done successfully, which means the requested header syntax was
  808. successfully inserted.
  809. * RETCODE_INVALID_COMMAND:
  810. This means the given argument, cmd, was invalid which means the given cmd was
  811. undefined, or not allowed in the current instance. In this case, the current
  812. instance might not be an MPEG4 encoder instance.
  813. * RETCODE_VPU_RESPONSE_TIMEOUT:
  814. Operation has not received any response from VPU and has timed out.
  815. @endverbatim
  816. */
  817. ENC_DISABLE_HEC,
  818. /**
  819. @verbatim
  820. This command changes slice inforamtion of header syntax during encoding. (ChangeParam command for CODA9 encoder only)
  821. The argument `parameter` is interpreted as a pointer to <<vpuapi_h_EncSliceMode>>
  822. structure holding
  823. * sliceMode is a mode which means enabling multi slice structure
  824. * sliceSizeMode is the mode representing mode of calculating one slicesize
  825. * sliceSize is the size of one slice.
  826. This command has one of the following return codes.::
  827. +
  828. --
  829. * RETCODE_SUCCESS:
  830. Operation was done successfully, which means the requested header syntax was
  831. successfully inserted.
  832. * RETCODE_INVALID_PARAM:
  833. The given argument parameter `parameter` or `headerType` was invalid, which means it
  834. has a null pointer, or given values for some member variables are improper
  835. values.
  836. * RETCODE_VPU_RESPONSE_TIMEOUT:
  837. Operation has not received any response from VPU and has timed out.
  838. --
  839. @endverbatim
  840. */
  841. ENC_SET_SLICE_INFO,
  842. /**
  843. @verbatim
  844. This command changes GOP number of header syntax during encoding. (ChangeParam command for CODA9 encoder only)
  845. The argument `parameter` is interpreted as a pointer to the integer which
  846. represents a GOP number.
  847. This command has one of the following return codes.::
  848. * RETCODE_SUCCESS:
  849. Operation was done successfully, which means the requested header syntax was
  850. successfully inserted.
  851. * RETCODE_INVALID_PARAM:
  852. The given argument parameter `parameter` or `headerType` was invalid, which means it
  853. has a null pointer, or given values for some member variables are improper
  854. values.
  855. * RETCODE_VPU_RESPONSE_TIMEOUT:
  856. Operation has not received any response from VPU and has timed out.
  857. @endverbatim
  858. */
  859. ENC_SET_GOP_NUMBER,
  860. /**
  861. @verbatim
  862. This command changes intra QP value of header syntax during encoding. (ChangeParam command for CODA9 encoder only)
  863. The argument `parameter` is interpreted as a pointer to the integer which
  864. represents a Constant I frame QP. The Constant I frame QP should be between 1 and 31
  865. for MPEG4 and between 0 and 51 for H.264/AVC.
  866. This command has one of the following return codes.::
  867. * RETCODE_SUCCESS:
  868. Operation was done successfully, which means the requested header syntax was
  869. successfully inserted.
  870. * RETCODE_INVALID_COMMAND:
  871. This means the given argument `cmd` was invalid which means the given cmd was
  872. undefined, or not allowed in the current instance. In this case, the current
  873. instance might not be an encoder instance.
  874. * RETCODE_INVALID_PARAM:
  875. The given argument parameter `parameter` or `headerType` was invalid, which means it
  876. has a null pointer, or given values for some member variables are improper
  877. values.
  878. * RETCODE_VPU_RESPONSE_TIMEOUT:
  879. Operation has not received any response from VPU and has timed out.
  880. @endverbatim
  881. */
  882. ENC_SET_INTRA_QP,
  883. /**
  884. @verbatim
  885. This command changes bitrate inforamtion of header syntax during encoding. (ChangeParam command for CODA9 encoder only)
  886. The argument `parameter` is interpreted as a pointer to the integer which
  887. represents a bitrate. It should be between 0 and 32767.
  888. This command has one of the following return codes.::
  889. * RETCODE_SUCCESS:
  890. Operation was done successfully, which means the requested header syntax was
  891. successfully inserted.
  892. * RETCODE_INVALID_COMMAND:
  893. This means the given argument `cmd` was invalid which means the given `cmd` was
  894. undefined, or not allowed in the current instance. In this case, the current
  895. instance might not be an encoder instance.
  896. * RETCODE_INVALID_PARAM:
  897. The given argument parameter `parameter` or `headerType` was invalid, which means it
  898. has a null pointer, or given values for some member variables are improper
  899. values.
  900. * RETCODE_VPU_RESPONSE_TIMEOUT:
  901. Operation has not received any response from VPU and has timed out.
  902. @endverbatim
  903. */
  904. ENC_SET_BITRATE,
  905. /**
  906. @verbatim
  907. This command changes frame rate of header syntax during encoding. (ChangeParam command for CODA9 encoder only)
  908. The argument `parameter` is interpreted as a pointer to the integer which
  909. represents a frame rate value. The fraem rate should be greater than 0.
  910. This command has one of the following return codes.::
  911. * RETCODE_SUCCESS:
  912. Operation was done successfully, which means the requested header syntax was
  913. successfully inserted.
  914. * RETCODE_INVALID_COMMAND:
  915. This means the given argument `cmd` was invalid which means the given `cmd` was
  916. undefined, or not allowed in the current instance. In this case, the current
  917. instance might not be an encoder instance.
  918. * RETCODE_INVALID_PARAM:
  919. The given argument parameter `parameter` or `headerType` was invalid, which means it
  920. has a null pointer, or given values for some member variables are improper
  921. values.
  922. * RETCODE_VPU_RESPONSE_TIMEOUT:
  923. Operation has not received any response from VPU and has timed out.
  924. @endverbatim
  925. */
  926. ENC_SET_FRAME_RATE,
  927. /**
  928. @verbatim
  929. This command changes encoding parameter(s) during the encoding operation. (WAVE encoder only)
  930. The argument `parameter` is interpreted as a pointer to <<vpuapi_h_EncChangeParam>> structure holding
  931. * enable_option : Set an enum value that is associated with parameters to change (multiple option allowed).
  932. For instance, if bitrate and framerate need to be changed in the middle of encoding, that requires some setting like below.
  933. EncChangeParam changeParam;
  934. changeParam.enable_option = ENC_RC_TARGET_RATE_CHANGE | ENC_FRAME_RATE_CHANGE;
  935. changeParam.bitrate = 14213000;
  936. changeParam.frameRate = 15;
  937. VPU_EncGiveCommand(handle, ENC_SET_PARA_CHANGE, &changeParam);
  938. This command has one of the following return codes.::
  939. +
  940. --
  941. * RETCODE_SUCCESS:
  942. Operation was done successfully, which means the requested header syntax was
  943. successfully inserted.
  944. * RETCODE_INVALID_COMMAND:
  945. This means the given argument `cmd` was invalid which means the given `cmd` was
  946. undefined, or not allowed in the current instance. In this case, the current
  947. instance might not be an H.264/AVC encoder instance.
  948. * RETCODE_INVALID_PARAM:
  949. The given argument parameter `parameter` or `headerType` was invalid, which means it
  950. has a null pointer, or given values for some member variables are improper
  951. values.
  952. * RETCODE_VPU_RESPONSE_TIMEOUT:
  953. Operation has not received any response from VPU and has timed out.
  954. --
  955. @endverbatim
  956. */
  957. ENC_SET_PARA_CHANGE,
  958. ENABLE_LOGGING, /**< HOST can activate message logging once VPU_DecOpen() or VPU_EncOpen() is called. */
  959. DISABLE_LOGGING, /**< HOST can deactivate message logging which is off as default. */
  960. DEC_GET_QUEUE_STATUS, /**< This command returns the number of queued commands for the current decode instance and the number of queued commands for the total decode instances. */
  961. ENC_GET_QUEUE_STATUS, /**< This command returns the number of queued commands for the current encode instance and the number of queued commands for the total encode instances. */
  962. GET_BANDWIDTH_REPORT, /**< This command reports the amount of bytes which are transferred on AXI bus. */ /* WAVE52x products. */
  963. ENC_WRPTR_SEL, /**< This command sets <<vpuapi_h_ENC_QUERY_WRPTR_SEL>>. */
  964. /**
  965. @verbatim
  966. This commmand sets the count of cycles per tick which is mostly a constant value to internal timer. Cycle per tick is used to calculate the number of cycle from the number of ticks that firmware returns. (WAVE5 only)
  967. This command returns RETCODE_SUCCESS.
  968. @endverbatim
  969. */
  970. SET_CYCLE_PER_TICK,
  971. /**
  972. @verbatim
  973. This command obtains the value of releaseSrcFlag when srcReleaseIntEnable is 1 and source release interrupt is occurred. (WAVE5 only)
  974. This command has one of the following return codes.::
  975. * RETCODE_SUCCESS:
  976. Requested operation was done successfully.
  977. * RETCODE_QUERY_FAILURE:
  978. This means this query command was not successful. (WAVE5 only)
  979. * RETCODE_INVALID_COMMAND:
  980. This means the given argument `cmd` was invalid which means the given `cmd` was
  981. undefined, or not allowed in the current instance.
  982. @endverbatim
  983. */
  984. ENC_GET_SRC_BUF_FLAG,
  985. /**
  986. @verbatim
  987. This command returns the debug information on error situations such as hang-up. (WAVE5 only)
  988. This command has one of the following return codes.::
  989. * RETCODE_SUCCESS:
  990. Requested operation was done successfully.
  991. * RETCODE_REPORT_NOT_READY:
  992. This means that report is not ready for this command. (WAVE5 only)
  993. * RETCODE_QUERY_FAILURE:
  994. This means this query command was not successful. (WAVE5 only)
  995. * RETCODE_INVALID_COMMAND:
  996. This means the given argument `cmd` was invalid which means the given `cmd` was
  997. undefined, or not allowed in the current instance.
  998. @endverbatim
  999. */
  1000. GET_DEBUG_INFORM,
  1001. #ifdef SUPPORT_LOOK_AHEAD_RC
  1002. ENC_SET_LARC_DATA, /* < This command sets Look Ahead RC data */
  1003. #endif
  1004. CMD_END
  1005. } CodecCommand;
  1006. /**
  1007. * @brief This is an enumeration type for representing error conceal modes. (H.264/AVC decoder only)
  1008. */
  1009. typedef enum {
  1010. AVC_ERROR_CONCEAL_MODE_DEFAULT = 0, /**< basic error concealment and error concealment for missing reference frame, wrong frame_num syntax (default) */
  1011. AVC_ERROR_CONCEAL_MODE_ENABLE_SELECTIVE_CONCEAL_MISSING_REFERENCE = 1, /**< error concealment - selective error concealment for missing reference frame */
  1012. AVC_ERROR_CONCEAL_MODE_DISABLE_CONCEAL_MISSING_REFERENCE = 2, /**< error concealment - disable error concealment for missing reference frame */
  1013. AVC_ERROR_CONCEAL_MODE_DISABLE_CONCEAL_WRONG_FRAME_NUM = 4, /**< error concealment - disable error concealment for wrong frame_num syntax */
  1014. } AVCErrorConcealMode;
  1015. /**
  1016. * @brief This is an enumeration type for representing the way of writing chroma data in planar format of frame buffer.
  1017. */
  1018. typedef enum {
  1019. CBCR_ORDER_NORMAL, /**< Cb data are written in Cb buffer, and Cr data are written in Cr buffer. */
  1020. CBCR_ORDER_REVERSED /**< Cr data are written in Cb buffer, and Cb data are written in Cr buffer. */
  1021. } CbCrOrder;
  1022. /**
  1023. * @brief This is an enumeration type for representing the mirroring direction.
  1024. */
  1025. typedef enum {
  1026. MIRDIR_NONE, /**< No mirroring */
  1027. MIRDIR_VER, /**< Vertical mirroring */
  1028. MIRDIR_HOR, /**< Horizontal mirroring */
  1029. MIRDIR_HOR_VER /**< Horizontal and vertical mirroring */
  1030. } MirrorDirection;
  1031. /**
  1032. * @brief This is an enumeration type for representing chroma formats of the frame buffer and pixel formats in packed mode.
  1033. */
  1034. typedef enum {
  1035. FORMAT_ERR = -1,
  1036. FORMAT_420 = 0 , /* 8bit */
  1037. FORMAT_422 , /* 8bit */
  1038. FORMAT_224 , /* 8bit */
  1039. FORMAT_444 , /* 8bit */
  1040. FORMAT_400 , /* 8bit */
  1041. /* Little Endian Perspective */
  1042. /* | addr 0 | addr 1 | */
  1043. FORMAT_420_P10_16BIT_MSB = 5, /* lsb |000000xx|xxxxxxxx | msb */
  1044. FORMAT_420_P10_16BIT_LSB , /* lsb |xxxxxxx |xx000000 | msb */
  1045. FORMAT_420_P10_32BIT_MSB , /* lsb |00xxxxxxxxxxxxxxxxxxxxxxxxxxx| msb */
  1046. FORMAT_420_P10_32BIT_LSB , /* lsb |xxxxxxxxxxxxxxxxxxxxxxxxxxx00| msb */
  1047. /* 4:2:2 packed format */
  1048. /* Little Endian Perspective */
  1049. /* | addr 0 | addr 1 | */
  1050. FORMAT_422_P10_16BIT_MSB , /* lsb |000000xx |xxxxxxxx | msb */
  1051. FORMAT_422_P10_16BIT_LSB , /* lsb |xxxxxxxx |xx000000 | msb */
  1052. FORMAT_422_P10_32BIT_MSB , /* lsb |00xxxxxxxxxxxxxxxxxxxxxxxxxxx| msb */
  1053. FORMAT_422_P10_32BIT_LSB , /* lsb |xxxxxxxxxxxxxxxxxxxxxxxxxxx00| msb */
  1054. FORMAT_YUYV , /**< 8bit packed format : Y0U0Y1V0 Y2U1Y3V1 ... */
  1055. FORMAT_YUYV_P10_16BIT_MSB, /* lsb |000000xxxxxxxxxx | msb */ /**< 10bit packed(YUYV) format(1Pixel=2Byte) */
  1056. FORMAT_YUYV_P10_16BIT_LSB, /* lsb |xxxxxxxxxx000000 | msb */ /**< 10bit packed(YUYV) format(1Pixel=2Byte) */
  1057. FORMAT_YUYV_P10_32BIT_MSB, /* lsb |00xxxxxxxxxxxxxxxxxxxxxxxxxxx| msb */ /**< 10bit packed(YUYV) format(3Pixel=4Byte) */
  1058. FORMAT_YUYV_P10_32BIT_LSB, /* lsb |xxxxxxxxxxxxxxxxxxxxxxxxxxx00| msb */ /**< 10bit packed(YUYV) format(3Pixel=4Byte) */
  1059. FORMAT_YVYU , /**< 8bit packed format : Y0V0Y1U0 Y2V1Y3U1 ... */
  1060. FORMAT_YVYU_P10_16BIT_MSB, /* lsb |000000xxxxxxxxxx | msb */ /**< 10bit packed(YVYU) format(1Pixel=2Byte) */
  1061. FORMAT_YVYU_P10_16BIT_LSB, /* lsb |xxxxxxxxxx000000 | msb */ /**< 10bit packed(YVYU) format(1Pixel=2Byte) */
  1062. FORMAT_YVYU_P10_32BIT_MSB, /* lsb |00xxxxxxxxxxxxxxxxxxxxxxxxxxx| msb */ /**< 10bit packed(YVYU) format(3Pixel=4Byte) */
  1063. FORMAT_YVYU_P10_32BIT_LSB, /* lsb |xxxxxxxxxxxxxxxxxxxxxxxxxxx00| msb */ /**< 10bit packed(YVYU) format(3Pixel=4Byte) */
  1064. FORMAT_UYVY , /**< 8bit packed format : U0Y0V0Y1 U1Y2V1Y3 ... */
  1065. FORMAT_UYVY_P10_16BIT_MSB, /* lsb |000000xxxxxxxxxx | msb */ /**< 10bit packed(UYVY) format(1Pixel=2Byte) */
  1066. FORMAT_UYVY_P10_16BIT_LSB, /* lsb |xxxxxxxxxx000000 | msb */ /**< 10bit packed(UYVY) format(1Pixel=2Byte) */
  1067. FORMAT_UYVY_P10_32BIT_MSB, /* lsb |00xxxxxxxxxxxxxxxxxxxxxxxxxxx| msb */ /**< 10bit packed(UYVY) format(3Pixel=4Byte) */
  1068. FORMAT_UYVY_P10_32BIT_LSB, /* lsb |xxxxxxxxxxxxxxxxxxxxxxxxxxx00| msb */ /**< 10bit packed(UYVY) format(3Pixel=4Byte) */
  1069. FORMAT_VYUY , /**< 8bit packed format : V0Y0U0Y1 V1Y2U1Y3 ... */
  1070. FORMAT_VYUY_P10_16BIT_MSB, /* lsb |000000xxxxxxxxxx | msb */ /**< 10bit packed(VYUY) format(1Pixel=2Byte) */
  1071. FORMAT_VYUY_P10_16BIT_LSB, /* lsb |xxxxxxxxxx000000 | msb */ /**< 10bit packed(VYUY) format(1Pixel=2Byte) */
  1072. FORMAT_VYUY_P10_32BIT_MSB, /* lsb |00xxxxxxxxxxxxxxxxxxxxxxxxxxx| msb */ /**< 10bit packed(VYUY) format(3Pixel=4Byte) */
  1073. FORMAT_VYUY_P10_32BIT_LSB, /* lsb |xxxxxxxxxxxxxxxxxxxxxxxxxxx00| msb */ /**< 10bit packed(VYUY) format(3Pixel=4Byte) */
  1074. FORMAT_MAX,
  1075. } FrameBufferFormat;
  1076. /**
  1077. * @brief This is an enumeration type for representing output image formats of down scaler.
  1078. */
  1079. typedef enum{
  1080. YUV_FORMAT_I420, /**< This format is a 420 planar format, which is described as forcc I420. */
  1081. YUV_FORMAT_NV12, /**< This format is a 420 semi-planar format with U and V interleaved, which is described as fourcc NV12. */
  1082. YUV_FORMAT_NV21, /**< This format is a 420 semi-planar format with V and U interleaved, which is described as fourcc NV21. */
  1083. YUV_FORMAT_I422, /**< This format is a 422 planar format, which is described as forcc I422. */
  1084. YUV_FORMAT_NV16, /**< This format is a 422 semi-planar format with U and V interleaved, which is described as fourcc NV16. */
  1085. YUV_FORMAT_NV61, /**< This format is a 422 semi-planar format with V and U interleaved, which is described as fourcc NV61. */
  1086. YUV_FORMAT_UYVY, /**< This format is a 422 packed mode with UYVY, which is described as fourcc UYVY. */
  1087. YUV_FORMAT_YUYV, /**< This format is a 422 packed mode with YUYV, which is described as fourcc YUYV. */
  1088. } ScalerImageFormat;
  1089. /**
  1090. * @brief This is an enumeration type for representing YUV packed format.
  1091. */
  1092. typedef enum {
  1093. NOT_PACKED = 0,
  1094. PACKED_YUYV,
  1095. PACKED_YVYU,
  1096. PACKED_UYVY,
  1097. PACKED_VYUY,
  1098. } PackedFormatNum;
  1099. /**
  1100. * @brief This is an enumeration type for representing interrupt bit positions for CODA series.
  1101. */
  1102. typedef enum {
  1103. INT_BIT_INIT = 0,
  1104. INT_BIT_SEQ_INIT = 1,
  1105. INT_BIT_SEQ_END = 2,
  1106. INT_BIT_PIC_RUN = 3,
  1107. INT_BIT_FRAMEBUF_SET = 4,
  1108. INT_BIT_ENC_HEADER = 5,
  1109. INT_BIT_DEC_PARA_SET = 7,
  1110. INT_BIT_DEC_BUF_FLUSH = 8,
  1111. INT_BIT_USERDATA = 9,
  1112. INT_BIT_DEC_FIELD = 10,
  1113. INT_BIT_DEC_MB_ROWS = 13,
  1114. INT_BIT_BIT_BUF_EMPTY = 14,
  1115. INT_BIT_BIT_BUF_FULL = 15
  1116. } InterruptBit;
  1117. /* For backward compatibility */
  1118. typedef InterruptBit Coda9InterruptBit;
  1119. /**
  1120. * @brief This is an enumeration type for representing interrupt bit positions.
  1121. NOTE: This is only for WAVE5 IP.
  1122. */
  1123. typedef enum {
  1124. INT_WAVE5_INIT_VPU = 0,
  1125. INT_WAVE5_WAKEUP_VPU = 1,
  1126. INT_WAVE5_SLEEP_VPU = 2,
  1127. INT_WAVE5_CREATE_INSTANCE = 3,
  1128. INT_WAVE5_FLUSH_INSTANCE = 4,
  1129. INT_WAVE5_DESTORY_INSTANCE = 5,
  1130. INT_WAVE5_INIT_SEQ = 6,
  1131. INT_WAVE5_SET_FRAMEBUF = 7,
  1132. INT_WAVE5_DEC_PIC = 8,
  1133. INT_WAVE5_ENC_PIC = 8,
  1134. INT_WAVE5_ENC_SET_PARAM = 9,
  1135. #ifdef SUPPORT_SOURCE_RELEASE_INTERRUPT
  1136. INT_WAVE5_ENC_SRC_RELEASE = 10,
  1137. #endif
  1138. INT_WAVE5_ENC_LOW_LATENCY = 13,
  1139. INT_WAVE5_DEC_QUERY = 14,
  1140. INT_WAVE5_BSBUF_EMPTY = 15,
  1141. INT_WAVE5_BSBUF_FULL = 15,
  1142. } Wave5InterruptBit;
  1143. /**
  1144. * @brief This is an enumeration type for representing picture types.
  1145. */
  1146. typedef enum {
  1147. PIC_TYPE_I = 0, /**< I picture */
  1148. PIC_TYPE_KEY = 0, /**< KEY frame for SVAC and AV1*/
  1149. PIC_TYPE_P = 1, /**< P picture */
  1150. PIC_TYPE_INTER = 1, /**< Inter frame for SVAC and AV1*/
  1151. PIC_TYPE_B = 2, /**< B picture (except VC1) */
  1152. PIC_TYPE_REPEAT = 2, /**< Repeat frame (VP9 only) */
  1153. PIC_TYPE_AV1_INTRA = 2, /**< Intra only frame (AV1 only) */
  1154. PIC_TYPE_VC1_BI = 2, /**< VC1 BI picture (VC1 only) */
  1155. PIC_TYPE_VC1_B = 3, /**< VC1 B picture (VC1 only) */
  1156. PIC_TYPE_D = 3, /**< D picture in MPEG2 that is only composed of DC coefficients (MPEG2 only) */
  1157. PIC_TYPE_S = 3, /**< S picture in MPEG4 that is an acronym of Sprite and used for GMC (MPEG4 only)*/
  1158. PIC_TYPE_AVS2_F = 3, /**< F picture in AVS2 */
  1159. PIC_TYPE_AV1_SWITCH = 3, /**< Switch frame (AV1 only) */
  1160. PIC_TYPE_VC1_P_SKIP = 4, /**< VC1 P skip picture (VC1 only) */
  1161. PIC_TYPE_MP4_P_SKIP_NOT_CODED = 4, /**< Not Coded P Picture in MPEG4 packed mode */
  1162. PIC_TYPE_AVS2_S = 4, /**< S picture in AVS2 */
  1163. PIC_TYPE_IDR = 5, /**< H.264/H.265 IDR picture */
  1164. PIC_TYPE_AVS2_G = 5, /**< G picture in AVS2 */
  1165. PIC_TYPE_AVS2_GB = 6, /**< GB picture in AVS2 */
  1166. PIC_TYPE_MAX /**< No Meaning */
  1167. }PicType;
  1168. /**
  1169. * @brief This is an enumeration type for H.264/AVC NPF (Non Paired Field) information.
  1170. */
  1171. typedef enum {
  1172. PAIRED_FIELD = 0,
  1173. TOP_FIELD_MISSING = 1,
  1174. BOT_FIELD_MISSING = 2,
  1175. }AvcNpfFieldInfo;
  1176. /**
  1177. * @brief This is an enumeration type for specifying frame buffer types when tiled2linear or wtlEnable is used.
  1178. */
  1179. typedef enum {
  1180. FF_NONE = 0, /**< Frame buffer type when tiled2linear or wtlEnable is disabled */
  1181. FF_FRAME = 1, /**< Frame buffer type to store one frame */
  1182. FF_FIELD = 2, /**< Frame buffer type to store top field or bottom field separately */
  1183. }FrameFlag;
  1184. /**
  1185. * @brief This is an enumeration type for representing bitstream handling modes in decoder.
  1186. */
  1187. typedef enum {
  1188. BS_MODE_INTERRUPT, /**< VPU returns an interrupt when bitstream buffer is empty while decoding. VPU waits for more bitstream to be filled. */
  1189. BS_MODE_RESERVED, /**< Reserved for the future */
  1190. BS_MODE_PIC_END, /**< VPU tries to decode with very small amount of bitstream (not a complete 512-byte chunk). If it is not successful, VPU performs error concealment for the rest of the frame. */
  1191. }BitStreamMode;
  1192. /**
  1193. * @brief This is an enumeration type for representing software reset options.
  1194. */
  1195. typedef enum {
  1196. SW_RESET_SAFETY, /**< It resets VPU in safe way. It waits until pending bus transaction is completed and then perform reset. */
  1197. SW_RESET_FORCE, /**< It forces to reset VPU without waiting pending bus transaction to be completed. It is used for immediate termination such as system off. */
  1198. SW_RESET_ON_BOOT /**< This is the default reset mode that is executed since system booting. This mode is actually executed in VPU_Init(), so does not have to be used independently. */
  1199. }SWResetMode;
  1200. /**
  1201. * @brief This is an enumeration type for representing product IDs.
  1202. */
  1203. typedef enum {
  1204. PRODUCT_ID_980,
  1205. PRODUCT_ID_960 = 1,
  1206. PRODUCT_ID_950 = 1, // same with CODA960
  1207. PRODUCT_ID_512,
  1208. PRODUCT_ID_515,
  1209. PRODUCT_ID_521,
  1210. PRODUCT_ID_511,
  1211. PRODUCT_ID_517,
  1212. PRODUCT_ID_NONE,
  1213. }ProductId;
  1214. #define PRODUCT_ID_W_SERIES(x) (x == PRODUCT_ID_512 || x == PRODUCT_ID_515 || x == PRODUCT_ID_521 || x == PRODUCT_ID_511 || x == PRODUCT_ID_517)
  1215. #define PRODUCT_ID_NOT_W_SERIES(x) !PRODUCT_ID_W_SERIES(x)
  1216. /**
  1217. * @brief This is an enumeration type for representing map types for frame buffer.
  1218. NOTE: Tiled maps are only for CODA9. Please find them in the CODA9 datasheet for detailed information.
  1219. */
  1220. typedef enum {
  1221. /**
  1222. @verbatim
  1223. Linear frame map type
  1224. NOTE: Products earlier than CODA9 can only set this linear map type.
  1225. @endverbatim
  1226. */
  1227. LINEAR_FRAME_MAP = 0, /**< Linear frame map type */
  1228. TILED_FRAME_V_MAP = 1, /**< Tiled frame vertical map type (CODA9 only) */
  1229. TILED_FRAME_H_MAP = 2, /**< Tiled frame horizontal map type (CODA9 only) */
  1230. TILED_FIELD_V_MAP = 3, /**< Tiled field vertical map type (CODA9 only) */
  1231. TILED_MIXED_V_MAP = 4, /**< Tiled mixed vertical map type (CODA9 only) */
  1232. TILED_FRAME_MB_RASTER_MAP = 5, /**< Tiled frame MB raster map type (CODA9 only) */
  1233. TILED_FIELD_MB_RASTER_MAP = 6, /**< Tiled field MB raster map type (CODA9 only) */
  1234. TILED_FRAME_NO_BANK_MAP = 7, /**< Tiled frame no bank map. (CODA9 only) */ // coda980 only
  1235. TILED_FIELD_NO_BANK_MAP = 8, /**< Tiled field no bank map. (CODA9 only) */ // coda980 only
  1236. LINEAR_FIELD_MAP = 9, /**< Linear field map type. (CODA9 only) */ // coda980 only
  1237. CODA_TILED_MAP_TYPE_MAX = 10,
  1238. ARM_COMPRESSED_FRAME_MAP = 10, /**< AFBC(ARM Frame Buffer Compression) compressed frame map type */ // AFBC enabled WAVE decoder
  1239. COMPRESSED_FRAME_MAP_V50_LOSSLESS_8BIT = 11, /**< CFRAME50(Chips&Media Frame Buffer Compression) compressed framebuffer type */
  1240. COMPRESSED_FRAME_MAP_V50_LOSSLESS_10BIT = 12, /**< CFRAME50(Chips&Media Frame Buffer Compression) compressed framebuffer type */
  1241. COMPRESSED_FRAME_MAP_V50_LOSSY = 13, /**< CFRAME50(Chips&Media Frame Buffer Compression) compressed framebuffer type */
  1242. COMPRESSED_FRAME_MAP_V50_LOSSLESS_422_8BIT = 14, /**< CFRAME50(Chips&Media Frame Buffer Compression) compressed 4:2:2 framebuffer type */
  1243. COMPRESSED_FRAME_MAP_V50_LOSSLESS_422_10BIT = 15, /**< CFRAME50(Chips&Media Frame Buffer Compression) compressed 4:2:2 framebuffer type */
  1244. COMPRESSED_FRAME_MAP_V50_LOSSY_422 = 16, /**< CFRAME50(Chips&Media Frame Buffer Compression) compressed 4:2:2 framebuffer type */
  1245. COMPRESSED_FRAME_MAP = 17, /**< Compressed frame map type (WAVE only) */ // WAVE4 only
  1246. COMPRESSED_FRAME_MAP_SVAC_SVC_BL = 18, /**< Compressed frame map type for base layer in SVAC encoder */
  1247. COMPRESSED_FRAME_MAP_DUAL_CORE_8BIT = 19, /**< 8bit compressed frame map type for dual core */
  1248. COMPRESSED_FRAME_MAP_DUAL_CORE_10BIT = 20, /**< 10bit compressed frame map type for dual core */
  1249. PVRIC_COMPRESSED_FRAME_LOSSLESS_MAP = 21, /**< PVRIC compressed frame map type for lossless mode*/
  1250. PVRIC_COMPRESSED_FRAME_LOSSY_MAP = 22, /**< PVRIC compressed frame map type for lossy mode */
  1251. TILED_MAP_TYPE_MAX
  1252. } TiledMapType;
  1253. /**
  1254. * @brief This is an enumeration for declaring a type of framebuffer that is allocated when VPU_DecAllocateFrameBuffer()
  1255. and VPU_EncAllocateFrameBuffer() function call.
  1256. */
  1257. typedef enum {
  1258. FB_TYPE_CODEC, /**< A framebuffer type used for decoding or encoding */
  1259. FB_TYPE_PPU, /**< A framebuffer type used for additional allocation of framebuffer for postprocessing(rotation/mirror) or display (tiled2linear) purpose */
  1260. } FramebufferAllocType;
  1261. /**
  1262. * @brief This is a data structure of hardware attributes for VPU.
  1263. */
  1264. typedef struct {
  1265. Uint32 productId; /**< The product ID */
  1266. Uint32 productNumber; /**< The product number. ex) 512 */
  1267. char productName[8]; /**< The product name in ascii code */
  1268. Uint32 productVersion; /**< The product version number */
  1269. Uint32 fwVersion; /**< The F/W version */
  1270. Uint32 customerId; /**< Customer ID number */
  1271. Uint32 supportDecoders; /**< bitmask: See <<vpuapi_h_CodStd>> */
  1272. Uint32 supportEncoders; /**< bitmask: See <<vpuapi_h_CodStd>> */
  1273. Uint32 numberOfMemProtectRgns; /**< It is always 10. */
  1274. Uint32 maxNumVcores; /**< The number of core in the VPU */
  1275. BOOL supportWTL; /**< This indicates whether a product supports the WTL or not */
  1276. BOOL supportTiled2Linear; /**< This indicates whether a product supports the Tile2Linear or not */
  1277. BOOL supportTiledMap; /**< This indicates whether a product supports the TiledMap or not */
  1278. BOOL supportMapTypes; /**< This indicates whether a product supports map types. */
  1279. BOOL supportLinear2Tiled; /**< This indicates whether a product supports the Linear2Tiled. - Encoder feature */
  1280. BOOL support128bitBus; /**< This indicates whether a product supports 128bit bus. */
  1281. BOOL supportThumbnailMode; /**< This indicates whether a product supports the thumbnail mode. */
  1282. BOOL supportBitstreamMode; /**< This indicates whether a product supports bitstream modes such as pic-end mode and ringbuffer mode. */
  1283. BOOL supportFBCBWOptimization; /**< This indicates whether a product supports the FBC optimization. */
  1284. BOOL supportGDIHW; /**< This indicates whether a product supports the GDI. */
  1285. BOOL supportCommandQueue; /**< This indicates whether a product supports the Command Queue. */
  1286. BOOL supportBackbone; /**< This indicates whether a product supports the Backbone. Higher version of the GDI. */
  1287. BOOL supportNewTimer; /**< 0: timeeScale=32768, 1: timerScale=256 (tick = cycle/timerScale) */
  1288. BOOL support2AlignScaler; /**< This indicates whether a product supports the 2-align scaler. */
  1289. BOOL supportAVC10bitEnc; /**< This indicates whether a product supports AVC 10bit encoder */
  1290. BOOL supportHEVC10bitEnc; /**< This indicates whether a product supports HEVC 10bit encoder */
  1291. Uint32 supportEndianMask; /**< A variable of supported endian mode in product */
  1292. Uint32 framebufferCacheType; /**< 0: None, 1: Maverick-I, 2: Maverick-II */
  1293. Uint32 bitstreamBufferMargin; /**< A variable to leave a margin in bistream buffer for GBU operation. This is valid when ringBufferEnable is 1. (CODA9 only) */
  1294. Uint32 hwConfigDef0; /**< System configuration information (internal use only) such as external memory interface, external model information, and output support */
  1295. Uint32 hwConfigDef1; /**< General hardware configuration information (internal use only) */
  1296. Uint32 hwConfigFeature; /**< supported codec standards */
  1297. Uint32 hwConfigDate; /**< Configuation Date Decimal, ex)20151130 */
  1298. Uint32 hwConfigRev; /**< SVN revision, ex) 83521 */
  1299. Uint32 hwConfigType; /**< Not defined yet */
  1300. BOOL supportDualCore; /**< This indicates whether a product has two vcores. */
  1301. BOOL supportVcoreBackbone; /**< This indicates whether a product supports the vcore backbone version.*/
  1302. } VpuAttr;
  1303. /**
  1304. * @brief
  1305. @verbatim
  1306. This is a data structure of tiled map information.
  1307. NOTE: WAVE does not support tiledmap type so this structure is not used in the product.
  1308. @endverbatim
  1309. */
  1310. typedef struct {
  1311. // gdi2.0
  1312. int xy2axiLumMap[32];
  1313. int xy2axiChrMap[32];
  1314. int xy2axiConfig;
  1315. // gdi1.0
  1316. int xy2caMap[16];
  1317. int xy2baMap[16];
  1318. int xy2raMap[16];
  1319. int rbc2axiMap[32];
  1320. int xy2rbcConfig;
  1321. unsigned long tiledBaseAddr;
  1322. // common
  1323. int mapType;
  1324. int productId;
  1325. int tbSeparateMap;
  1326. int topBotSplit;
  1327. int tiledMap;
  1328. int convLinear;
  1329. } TiledMapConfig;
  1330. /**
  1331. * @brief This is a data structure of DRAM information(CODA960 and BODA950 only) and CFRAME50 configuration(WAVE5 only)
  1332. VPUAPI sets default values for this structure.
  1333. However, HOST application can configure if the default values are not associated with their DRAM
  1334. or desirable to change.
  1335. */
  1336. typedef struct {
  1337. int rasBit; /**< This value is used for width of RAS bit. (13 on the CNM FPGA platform) */
  1338. int casBit; /**< This value is used for width of CAS bit. (9 on the CNM FPGA platform) */
  1339. int bankBit; /**< This value is used for width of BANK bit. (2 on the CNM FPGA platform) */
  1340. int busBit; /**< This value is used for width of system BUS bit. (3 on CNM FPGA platform) */
  1341. int tx16y; /**< This value is used for CFRAME50(Chips&Media Frame Buffer Compression) (WAVE5 only) */
  1342. int tx16c; /**< This value is used for CFRAME50(Chips&Media Frame Buffer Compression) (WAVE5 only) */
  1343. } DRAMConfig;
  1344. /**
  1345. * @brief
  1346. @verbatim
  1347. This is a data structure for representing frame buffer information such as pointer of each YUV
  1348. component, endian, map type, etc.
  1349. All of the 3 component addresses must be aligned to AXI bus width.
  1350. HOST application must allocate external SDRAM spaces for those components by using this data
  1351. structure. For example, YCbCr 4:2:0, one pixel value
  1352. of a component occupies one byte, so the frame data sizes of Cb and Cr buffer are 1/4 of Y buffer size.
  1353. In case of CbCr interleave mode, Cb and Cr frame data are written to memory area started from bufCb address.
  1354. Also, in case that the map type of frame buffer is a field type, the base addresses of frame buffer for bottom fields -
  1355. bufYBot, bufCbBot and bufCrBot should be set separately.
  1356. @endverbatim
  1357. */
  1358. typedef struct {
  1359. PhysicalAddress bufY; /**< It indicates the base address for Y component in the physical address space when linear map is used. It is the RAS base address for Y component when tiled map is used (CODA9). It is also compressed Y buffer or ARM compressed framebuffer (WAVE). */
  1360. PhysicalAddress bufCb; /**< It indicates the base address for Cb component in the physical address space when linear map is used. It is the RAS base address for Cb component when tiled map is used (CODA9). It is also compressed CbCr buffer (WAVE) */
  1361. PhysicalAddress bufCr; /**< It indicates the base address for Cr component in the physical address space when linear map is used. It is the RAS base address for Cr component when tiled map is used (CODA9). */
  1362. PhysicalAddress bufYBot; /**< It indicates the base address for Y bottom field component in the physical address space when linear map is used. It is the RAS base address for Y bottom field component when tiled map is used (CODA980 only). */ // coda980 only
  1363. PhysicalAddress bufCbBot; /**< It indicates the base address for Cb bottom field component in the physical address space when linear map is used. It is the RAS base address for Cb bottom field component when tiled map is used (CODA980 only). */ // coda980 only
  1364. PhysicalAddress bufCrBot; /**< It indicates the base address for Cr bottom field component in the physical address space when linear map is used. It is the RAS base address for Cr bottom field component when tiled map is used (CODA980 only). */ // coda980 only
  1365. /**
  1366. @verbatim
  1367. It specifies a chroma interleave mode of frame buffer.
  1368. @* 0 : Cb data are written in Cb frame memory and Cr data are written in Cr frame memory. (chroma separate mode)
  1369. @* 1 : Cb and Cr data are written in the same chroma memory. (chroma interleave mode)
  1370. @endverbatim
  1371. */
  1372. int cbcrInterleave;
  1373. /**
  1374. @verbatim
  1375. It specifies the way chroma data is interleaved in the frame buffer, bufCb or bufCbBot.
  1376. @* 0 : CbCr data is interleaved in chroma memory (NV12).
  1377. @* 1 : CrCb data is interleaved in chroma memory (NV21).
  1378. @endverbatim
  1379. */
  1380. int nv21;
  1381. /**
  1382. @verbatim
  1383. It specifies endianess of frame buffer.
  1384. @* 0 : little endian format
  1385. @* 1 : big endian format
  1386. @* 2 : 32 bit little endian format
  1387. @* 3 : 32 bit big endian format
  1388. @* 16 ~ 31 : 128 bit endian format
  1389. NOTE: For setting specific values of 128 bit endiness, please refer to the 'WAVE Datasheet'.
  1390. @endverbatim
  1391. */
  1392. int endian;
  1393. int myIndex; /**< A frame buffer index to identify each frame buffer that is processed by VPU. */
  1394. TiledMapType mapType; /**< A map type for GDI inferface or FBC (Frame Buffer Compression). NOTE: For detailed map types, please refer to <<vpuapi_h_TiledMapType>>. */
  1395. int stride; /**< A horizontal stride for given frame buffer */
  1396. int width; /**< A width for given frame buffer */
  1397. int height; /**< A height for given frame buffer */
  1398. int size; /**< A size for given frame buffer */
  1399. int lumaBitDepth; /**< Bit depth for luma component */
  1400. int chromaBitDepth; /**< Bit depth for chroma component */
  1401. FrameBufferFormat format; /**< A YUV format of frame buffer */
  1402. /**
  1403. @verbatim
  1404. It enables source frame data with long burst length to be loaded for reducing DMA latency (CODA9 encoder only).
  1405. @* 0 : disable the long-burst mode.
  1406. @* 1 : enable the long-burst mode.
  1407. @endverbatim
  1408. */
  1409. int sourceLBurstEn;
  1410. int sequenceNo; /**< A sequence number that the frame belongs to. It increases by 1 every time a sequence changes in decoder. */
  1411. BOOL updateFbInfo; /**< If this is TRUE, VPU updates API-internal framebuffer information when any of the information is changed. */
  1412. } FrameBuffer;
  1413. /**
  1414. * @brief This is a data structure for representing framebuffer parameters.
  1415. It is used when framebuffer allocation using VPU_DecAllocateFrameBuffer() or VPU_EncAllocateFrameBuffer().
  1416. */
  1417. typedef struct {
  1418. int mapType; /**< <<vpuapi_h_TiledMapType>> */
  1419. /**
  1420. @verbatim
  1421. @* 0 : Cb data are written in Cb frame memory and Cr data are written in Cr frame memory. (chroma separate mode)
  1422. @* 1 : Cb and Cr data are written in the same chroma memory. (chroma interleave mode)
  1423. @endverbatim
  1424. */
  1425. int cbcrInterleave;
  1426. int nv21; /**< 1 : CrCb (NV21), 0 : CbCr (NV12). This is valid when cbcrInterleave is 1. */
  1427. FrameBufferFormat format; /**< <<vpuapi_h_FrameBufferFormat>> */
  1428. int stride; /**< A stride value of frame buffer */
  1429. int height; /**< A height of frame buffer */
  1430. int size; /**< A size of frame buffer */
  1431. int lumaBitDepth; /**< A bit-depth of luma sample */
  1432. int chromaBitDepth; /**< A bit-depth of chroma sample */
  1433. int endian; /**< An endianess of frame buffer */
  1434. int num; /**< The number of frame buffer to allocate */
  1435. int type; /**< <<vpuapi_h_FramebufferAllocType>> */
  1436. } FrameBufferAllocInfo;
  1437. /**
  1438. * @brief
  1439. @verbatim
  1440. This is a data structure for representing rectangular window information in a
  1441. frame.
  1442. In order to specify a display window (or display window after cropping), this structure is
  1443. provided to HOST application. Each value means an offset from the start point of
  1444. a frame and therefore, all variables have positive values.
  1445. @endverbatim
  1446. */
  1447. typedef struct {
  1448. Uint32 left; /**< A horizontal pixel offset of top-left corner of rectangle from (0, 0) */
  1449. Uint32 top; /**< A vertical pixel offset of top-left corner of rectangle from (0, 0) */
  1450. Uint32 right; /**< A horizontal pixel offset of bottom-right corner of rectangle from (0, 0) */
  1451. Uint32 bottom; /**< A vertical pixel offset of bottom-right corner of rectangle from (0, 0) */
  1452. } VpuRect;
  1453. //Theora specific display information
  1454. /**
  1455. * @brief This is a data structure of picture size information. This structure is valid only for Theora decoding case.
  1456. When HOST application allocates frame buffers and gets a displayable picture region, HOST application needs this information.
  1457. */
  1458. typedef struct {
  1459. int frameWidth; /**< This value is used for width of frame buffer. */
  1460. int frameHeight; /**< This value is used for height of frame buffer. */
  1461. int picWidth; /**< This value is used for width of the picture region to be displayed. */
  1462. int picHeight; /**< This value is used for height of the picture region to be displayed. */
  1463. int picOffsetX; /**< This value is located at the lower-left corner of the picture region to be displayed. */
  1464. int picOffsetY; /**< This value is located at the lower-left corner of the picture region to be displayed. */
  1465. } ThoScaleInfo;
  1466. // VP8 specific display information
  1467. /**
  1468. * @brief This is a data structure of picture upscaling information for post-processing out of decoding loop.
  1469. This structure is valid only for VP8 decoding case and can never be used by VPU itself.
  1470. If HOST application has an upsampling device, this information is useful for them.
  1471. When the HOST application allocates a frame buffer, HOST application needs upscaled resolution derived by this information
  1472. to allocate enough (maximum) memory for variable resolution picture decoding.
  1473. */
  1474. typedef struct {
  1475. /**
  1476. @verbatim
  1477. This is an upscaling factor for horizontal expansion.
  1478. The value could be 0 to 3, and meaning of each value is described in below table.
  1479. .Upsampling Ratio by Scale Factor
  1480. [separator="|", frame="all", grid="all"]
  1481. `50`50_70
  1482. h/vScaleFactor | Upsampling Ratio
  1483. ________________________________________________________________________________
  1484. 0 |1
  1485. 1 |5/4
  1486. 2 |5/3
  1487. 3 |2/1
  1488. ________________________________________________________________________________
  1489. @endverbatim
  1490. */
  1491. unsigned hScaleFactor : 2;
  1492. unsigned vScaleFactor : 2; /**< This is an upscaling factor for vertical expansion. The value could be 0 to 3, meaning of each value is described in above table. */
  1493. unsigned picWidth : 14; /**< Picture width in unit of sample */
  1494. unsigned picHeight : 14; /**< Picture height in unit of sample */
  1495. } Vp8ScaleInfo;
  1496. typedef struct {
  1497. BOOL enScaler;
  1498. Uint32 scaleWidth;
  1499. Uint32 scaleHeight;
  1500. } ScalerInfo;
  1501. /**
  1502. * @brief The data structure to enable low delay decoding.
  1503. */
  1504. typedef struct {
  1505. /**
  1506. @verbatim
  1507. This enables low delay decoding. (CODA980 H.264/AVC decoder only)
  1508. If this flag is 1, VPU sends an interrupt to HOST application when numRows decoding is done.
  1509. * 0 : disable
  1510. * 1 : enable
  1511. When this field is enabled, reorderEnable, tiled2LinearEnable, and the post-rotator should be disabled.
  1512. @endverbatim
  1513. */
  1514. int lowDelayEn;
  1515. /**
  1516. @verbatim
  1517. This field indicates the number of mb rows (macroblock unit).
  1518. The value is from 1 to height/16 - 1.
  1519. If the value of this field is 0 or picture height/16, low delay decoding is disabled even though lowDelayEn is 1.
  1520. @endverbatim
  1521. */
  1522. int numRows;
  1523. } LowDelayInfo;
  1524. /**
  1525. * @brief This is a data structure for representing use of secondary AXI for each hardware block.
  1526. */
  1527. typedef struct {
  1528. union {
  1529. struct {
  1530. int useBitEnable; /**< This enables AXI secondary channel for prediction data of the BIT-processor. */
  1531. int useIpEnable; /**< This enables AXI secondary channel for row pixel data of IP. */
  1532. int useDbkYEnable; /**< This enables AXI secondary channel for temporal luminance data of the de-blocking filter. */
  1533. int useDbkCEnable; /**< This enables AXI secondary channel for temporal chrominance data of the de-blocking filter. */
  1534. int useOvlEnable; /**< This enables AXI secondary channel for temporal data of the the overlap filter (VC1 only). */
  1535. int useBtpEnable; /**< This enables AXI secondary channel for bit-plane data of the BIT-processor (VC1 only). */
  1536. } coda9;
  1537. struct {
  1538. // for Decoder
  1539. int useSclEnable; /**< This enables AXI secondary channel for Scaler line buffer. */
  1540. int useBitEnable; /**< This enables AXI secondary channel for prediction data of the BIT-processor. */
  1541. int useIpEnable; /**< This enables AXI secondary channel for row pixel data of IP. */
  1542. int useLfRowEnable; /**< This enables AXI secondary channel for loopfilter. */
  1543. // for Encoder
  1544. int useEncImdEnable; /**< This enables AXI secondary channel for intra mode decision. */
  1545. int useEncLfEnable; /**< This enables AXI secondary channel for loopfilter. */
  1546. int useEncRdoEnable; /**< This enables AXI secondary channel for RDO. */
  1547. } wave;
  1548. } u;
  1549. } SecAxiUse;
  1550. // For MaverickCache1
  1551. /**
  1552. * @brief This is a data structure for representing cache rectangle area for each component of MC reference frame. (CODA9 only)
  1553. */
  1554. typedef struct {
  1555. unsigned BufferSize : 8; /**< This is the cache buffer size for each component and can be set with 0 to 255. The unit of this value is fixed with 256byte. */
  1556. unsigned PageSizeX : 4; /**< This is the cache page size and can be set as 0 to 4. With this value(n), 8*(2^n) byte is requested as the width of a page. */
  1557. unsigned PageSizeY : 4; /**< This is the cache page size and can be set as 0 to 7. With this value(m), a page width*(2^m) byte is requested as the rectangle of a page.*/
  1558. unsigned CacheSizeX : 4; /**< This is the component data cache size, and it can be set as 0 to 7 in a page unit. Then there can be 2^n pages in x(y)-direction. Make sure that for luma component the CacheSizeX + CacheSizeY must be less than 8. For chroma components, CacheSizeX + CacheSizeY must be less than 7. */
  1559. unsigned CacheSizeY : 4; /**< This is the component data cache size, and it can be set as 0 to 7 in a page unit. Then there can be 2^n pages in x(y)-direction. Make sure that for luma component the CacheSizeX + CacheSizeY must be less than 8. For chroma components, CacheSizeX + CacheSizeY must be less than 7. */
  1560. unsigned Reserved : 8;
  1561. } CacheSizeCfg;
  1562. /**
  1563. * @brief This is a data structure for cache configuration. (CODA9 only)
  1564. */
  1565. typedef struct {
  1566. struct {
  1567. union {
  1568. Uint32 word;
  1569. CacheSizeCfg cfg; /**< <<vpuapi_h_CacheSizeCfg>> */
  1570. } luma;
  1571. union {
  1572. Uint32 word;
  1573. CacheSizeCfg cfg; /**< <<vpuapi_h_CacheSizeCfg>> */
  1574. } chroma;
  1575. /**
  1576. @verbatim
  1577. It disables cache function.
  1578. @* 1 : cache off
  1579. @* 0 : cache on
  1580. @endverbatim
  1581. */
  1582. unsigned Bypass : 1;
  1583. /**
  1584. @verbatim
  1585. It enables two frame caching mode.
  1586. @* 1 : dual mode (caching for FrameIndex0 and FrameIndex1)
  1587. @* 0 : single mode (caching for FrameIndex0)
  1588. @endverbatim
  1589. */
  1590. unsigned DualConf : 1;
  1591. /**
  1592. @verbatim
  1593. Mode for page merging
  1594. @* 0 : disable
  1595. @* 1 : horizontal
  1596. @* 2 : vertical
  1597. We recommend you to set 1 (horizontal) in tiled map or to set 2 (vertical) in linear map.
  1598. @endverbatim
  1599. */
  1600. unsigned PageMerge : 2;
  1601. } type1;
  1602. struct {
  1603. /**
  1604. @verbatim
  1605. CacheMode represents cache configuration.
  1606. @* [10:9] : cache line processing direction and merge mode
  1607. @* [8:5] : CacheWayShape
  1608. @** [8:7] : CacheWayLuma
  1609. @** [6:5] : CacheWayChroma
  1610. @* [4] reserved
  1611. @* [3] CacheBurstMode
  1612. @** 0: burst 4
  1613. @** 1: bust 8
  1614. @* [2] CacheMapType
  1615. @** 0: linear
  1616. @** 1: tiled
  1617. @* [1] CacheBypassME
  1618. @** 0: cache enable
  1619. @** 1: cache disable (bypass)
  1620. @* [0] CacheBypassMC
  1621. @** 0: cache enable
  1622. @** 1: cache disable (bypass)
  1623. @endverbatim
  1624. */
  1625. unsigned int CacheMode;
  1626. } type2;
  1627. } MaverickCacheConfig;
  1628. /**
  1629. * @brief This structure is used when HOST application additionally wants to send SPS data
  1630. or PPS data from external way. The resulting SPS data or PPS data can be used in
  1631. real applications as a kind of out-of-band information.
  1632. */
  1633. typedef struct {
  1634. Uint32 * paraSet; /**< The SPS/PPS rbsp data */
  1635. int size; /**< The size of stream in byte */
  1636. } DecParamSet;
  1637. typedef enum {
  1638. DEC_TASK, DEC_WORK, DEC_FBC, DEC_FBCY_TBL, DEC_FBCC_TBL, DEC_BS, DEC_FB_LINEAR, DEC_MV, DEC_ETC,
  1639. ENC_TASK, ENC_WORK, ENC_FBC, ENC_FBCY_TBL, ENC_FBCC_TBL, ENC_BS, ENC_SRC, ENC_MV, ENC_SUBSAMBUF, ENC_ETC
  1640. }MemTypes;
  1641. struct CodecInst;
  1642. //------------------------------------------------------------------------------
  1643. // decode struct and definition
  1644. //------------------------------------------------------------------------------
  1645. #define VPU_HANDLE_INSTANCE_NO(_handle) (_handle->instIndex)
  1646. #define VPU_HANDLE_CORE_INDEX(_handle) (((CodecInst*)_handle)->coreIdx)
  1647. #define VPU_HANDLE_PRODUCT_ID(_handle) (((CodecInst*)_handle)->productId)
  1648. #define VPU_CONVERT_WTL_INDEX(_handle, _index) ((((CodecInst*)_handle)->CodecInfo->decInfo).numFbsForDecoding+_index)
  1649. #define VPU_HANDLE_TO_DECINFO(_handle) (&(((CodecInst*)_handle)->CodecInfo->decInfo))
  1650. #define VPU_HANDLE_TO_ENCINFO(_handle) (&(((CodecInst*)_handle)->CodecInfo->encInfo))
  1651. /**
  1652. * @brief
  1653. @verbatim
  1654. This is a dedicated type for handle returned when a decoder instance or a encoder instance is
  1655. opened.
  1656. @endverbatim
  1657. */
  1658. typedef struct CodecInst* VpuHandle;
  1659. /**
  1660. * @brief
  1661. @verbatim
  1662. This is a dedicated type for decoder handle returned when a decoder instance is
  1663. opened. A decoder instance can be referred to by the corresponding handle. CodecInst
  1664. is a type managed internally by API. Application does not need to care about it.
  1665. NOTE: This type is vaild for decoder only.
  1666. @endverbatim
  1667. */
  1668. typedef struct CodecInst* DecHandle;
  1669. /**
  1670. * @brief This is a data structure for H.264/AVC specific picture information. Only H.264/AVC decoder
  1671. returns this structure after decoding a frame. For details about all these
  1672. flags, please find them in H.264/AVC VUI syntax.
  1673. */
  1674. typedef struct {
  1675. /**
  1676. @verbatim
  1677. @* 1 : It indicates that the temporal distance between the decoder output times of any
  1678. two consecutive pictures in output order is constrained as fixed_frame_rate_flag
  1679. in H.264/AVC VUI syntax.
  1680. @* 0 : It indicates that no such constraints apply to the temporal distance between
  1681. the decoder output times of any two consecutive pictures in output order
  1682. @endverbatim
  1683. */
  1684. int fixedFrameRateFlag;
  1685. /**
  1686. @verbatim
  1687. timing_info_present_flag in H.264/AVC VUI syntax
  1688. @* 1 : FixedFrameRateFlag is valid.
  1689. @* 0 : FixedFrameRateFlag is not valid.
  1690. @endverbatim
  1691. */
  1692. int timingInfoPresent;
  1693. int chromaLocBotField; /**< chroma_sample_loc_type_bottom_field in H.264/AVC VUI syntax. It specifies the location of chroma samples for the bottom field. */
  1694. int chromaLocTopField; /**< chroma_sample_loc_type_top_field in H.264/AVC VUI syntax. It specifiesf the location of chroma samples for the top field. */
  1695. int chromaLocInfoPresent; /**< chroma_loc_info_present_flag in H.264/AVC VUI syntax. */
  1696. /**
  1697. @verbatim
  1698. chroma_loc_info_present_flag in H.264/AVC VUI syntax
  1699. @* 1 : ChromaSampleLocTypeTopField and ChromaSampleLoc TypeTopField are valid.
  1700. @* 0 : ChromaSampleLocTypeTopField and ChromaSampleLoc TypeTopField are not valid.
  1701. @endverbatim
  1702. */
  1703. int colorPrimaries; /**< colour_primaries syntax in VUI parameter in H.264/AVC */
  1704. int colorDescPresent; /**< colour_description_present_flag in VUI parameter in H.264/AVC */
  1705. int isExtSAR; /**< This flag indicates whether aspectRateInfo represents 8bit aspect_ratio_idc or 32bit extended_SAR. If the aspect_ratio_idc is extended_SAR mode, this flag returns 1. */
  1706. int vidFullRange; /**< video_full_range in VUI parameter in H.264/AVC */
  1707. int vidFormat; /**< video_format in VUI parameter in H.264/AVC */
  1708. int vidSigTypePresent; /**< video_signal_type_present_flag in VUI parameter in H.264/AVC */
  1709. int vuiParamPresent; /**< vui_parameters_present_flag in VUI parameter in H.264/AVC */
  1710. int vuiPicStructPresent; /**< pic_struct_present_flag of VUI in H.264/AVC. This field is valid only for H.264/AVC decoding. */
  1711. int vuiPicStruct; /**< pic_struct in H.264/AVC VUI reporting (Table D-1 in H.264/AVC specification) */
  1712. } AvcVuiInfo;
  1713. /**
  1714. * @brief This is a data structure for bar information of MPEG2 user data.
  1715. For more details on this, please refer to 'ATSC Digital Television Standard: Part 4:2009'.
  1716. */
  1717. typedef struct {
  1718. /**
  1719. @verbatim
  1720. A 14-bit unsigned integer value representing the last horizontal
  1721. luminance sample of a vertical pillarbox bar area at the left side of the reconstructed frame.
  1722. Pixels shall be numbered from zero, starting with the leftmost pixel.
  1723. This variable is initialized to -1.
  1724. @endverbatim
  1725. */
  1726. int barLeft;
  1727. /**
  1728. @verbatim
  1729. A 14-bit unsigned integer value representing the first horizontal
  1730. luminance sample of a vertical pillarbox bar area at the right side of the reconstructed frame.
  1731. Pixels shall be numbered from zero, starting with the leftmost pixel.
  1732. This variable is initialized to -1.
  1733. @endverbatim
  1734. */
  1735. int barRight;
  1736. /**
  1737. @verbatim
  1738. A 14-bit unsigned integer value representing the first line of a
  1739. horizontal letterbox bar area at the top of the reconstructed frame. Designation of line
  1740. numbers shall be as defined per each applicable standard in Table 6.9.
  1741. This variable is initialized to -1.
  1742. @endverbatim
  1743. */
  1744. int barTop;
  1745. /**
  1746. @verbatim
  1747. A 14-bit unsigned integer value representing the first line of a
  1748. horizontal letterbox bar area at the bottom of the reconstructed frame. Designation of line
  1749. numbers shall be as defined per each applicable standard in Table 6.9.
  1750. This variable is initialized to -1.
  1751. @endverbatim
  1752. */
  1753. int barBottom;
  1754. } MP2BarDataInfo;
  1755. /**
  1756. * @brief
  1757. @verbatim
  1758. This is a data structure for MP2PicDispExtInfo.
  1759. NOTE: For detailed information on these fields,
  1760. please refer to the MPEG2 standard specification.
  1761. @endverbatim
  1762. */
  1763. typedef struct {
  1764. Uint32 offsetNum; /**< This is number of frame_centre_offset with a range of 0 to 3, inclusive. */
  1765. Int16 horizontalOffset1; /**< A horizontal offset of display rectangle in units of 1/16th sample */
  1766. Int16 horizontalOffset2; /**< A horizontal offset of display rectangle in units of 1/16th sample */
  1767. Int16 horizontalOffset3; /**< A horizontal offset of display rectangle in units of 1/16th sample */
  1768. Int16 verticalOffset1; /**< A vertical offset of display rectangle in units of 1/16th sample */
  1769. Int16 verticalOffset2; /**< A vertical offset of display rectangle in units of 1/16th sample */
  1770. Int16 verticalOffset3; /**< A vertical offset of display rectangle in units of 1/16th sample */
  1771. } MP2PicDispExtInfo;
  1772. /**
  1773. * @brief This data structure is a group of common decoder parameters to run VPU with a new decoding instance.
  1774. This is used when HOST application calls VPU_Decopen().
  1775. */
  1776. typedef struct {
  1777. CodStd bitstreamFormat; /**< A standard type of bitstream in decoder operation. It is one of codec standards defined in CodStd. */
  1778. PhysicalAddress bitstreamBuffer; /**< The start address of bitstream buffer from which the decoder can get the next bitstream. This address must be aligned to AXI bus width. */
  1779. int bitstreamBufferSize;/**< The size of the buffer pointed by bitstreamBuffer in byte. This value must be a multiple of 1024. */
  1780. /**
  1781. @verbatim
  1782. @* 0 : disable
  1783. @* 1 : enable
  1784. When this field is set in case of MPEG4, H.263 (post-processing), DivX3 or MPEG2 decoding,
  1785. VPU generates MPEG4 deblocking filtered output.
  1786. @endverbatim
  1787. */
  1788. int mp4DeblkEnable;
  1789. /**
  1790. @verbatim
  1791. @* 0 : no extension of H.264/AVC
  1792. @* 1 : MVC extension of H.264/AVC
  1793. @endverbatim
  1794. */
  1795. int avcExtension;
  1796. /**
  1797. @verbatim
  1798. @* 0 : MPEG4
  1799. @* 1 : DivX 5.0 or higher
  1800. @* 2 : Xvid
  1801. @* 5 : DivX 4.0
  1802. @* 6 : old Xvid
  1803. @* 256 : Sorenson Spark
  1804. NOTE: This variable is only valid when decoding MPEG4 stream.
  1805. @endverbatim
  1806. */
  1807. int mp4Class;
  1808. int tiled2LinearEnable; /**< It enables a tiled to linear map conversion feature for display. */
  1809. /**
  1810. @verbatim
  1811. It specifies which picture type is converted to. (CODA980 only)
  1812. @* 1 : conversion to linear frame map (when FrameFlag enum is FF_FRAME)
  1813. @* 2 : conversion to linear field map (when FrameFlag enum is FF_FIELD)
  1814. @endverbatim
  1815. */
  1816. int tiled2LinearMode;
  1817. /**
  1818. @verbatim
  1819. It enables WTL(Write Linear) function. If this field is enabled,
  1820. VPU writes a non-linear and a linear format of the decoded frame to the frame buffer at the same time. - first in linear map and second in tiled or compressed map.
  1821. Basically, VPU only writes a non-linear format of frame.
  1822. If you want to get a linear format of frame for display, WTL should be enabled.
  1823. @endverbatim
  1824. */
  1825. int wtlEnable;
  1826. /**
  1827. @verbatim
  1828. It specifies whether VPU writes in frame linear map or in field linear map when WTL is enabled. (CODA980 only)
  1829. @* 1 : write decoded frames in frame linear map (when FrameFlag enum is FF_FRAME)
  1830. @* 2 : write decoded frames in field linear map (when FrameFlag enum is FF_FIELD)
  1831. @endverbatim
  1832. */
  1833. int wtlMode;
  1834. /**
  1835. @verbatim
  1836. @* 0 : Cb data are written in Cb frame memory and Cr data are written in Cr frame memory. (chroma separate mode)
  1837. @* 1 : Cb and Cr data are written in the same chroma memory. (chroma interleave mode)
  1838. @endverbatim
  1839. */
  1840. int cbcrInterleave;
  1841. /**
  1842. @verbatim
  1843. CrCb interleaved mode (NV21).
  1844. @* 0 : decoded chroma data is written in CbCr (NV12) format.
  1845. @* 1 : decoded chroma data is written in CrCb (NV21) format.
  1846. This is only valid if cbcrInterleave is 1.
  1847. @endverbatim
  1848. */
  1849. int nv21;
  1850. /**
  1851. @verbatim
  1852. CbCr order in planar mode (YV12 format)
  1853. @* 0 : Cb data are written first and then Cr written in their separate plane.
  1854. @* 1 : Cr data are written first and then Cb written in their separate plane.
  1855. @endverbatim
  1856. */
  1857. int cbcrOrder;
  1858. /**
  1859. @verbatim
  1860. It writes output with 8 burst in linear map mode. (CODA9 only)
  1861. @* 0 : burst write back is disabled
  1862. @* 1 : burst write back is enabled.
  1863. @endverbatim
  1864. */
  1865. int bwbEnable;
  1866. /**
  1867. @verbatim
  1868. The endianess of the frame buffer for reference and reconstruction
  1869. @* 0 : little endian format
  1870. @* 1 : big endian format
  1871. @* 2 : 32 bit little endian format
  1872. @* 3 : 32 bit big endian format
  1873. @* 16 ~ 31 : 128 bit endian format
  1874. NOTE: For setting specific values of 128 bit endiness, please refer to the 'WAVE Datasheet'.
  1875. @endverbatim
  1876. */
  1877. EndianMode frameEndian;
  1878. /**
  1879. @verbatim
  1880. The endianess of the bitstream buffer
  1881. @* 0 : little endian format
  1882. @* 1 : big endian format
  1883. @* 2 : 32 bits little endian format
  1884. @* 3 : 32 bits big endian format
  1885. @* 16 ~ 31 : 128 bit endian format
  1886. NOTE: For setting specific values of 128 bit endiness, please refer to the 'WAVE Datasheet'.
  1887. @endverbatim
  1888. */
  1889. EndianMode streamEndian;
  1890. /**
  1891. @verbatim
  1892. When a read pointer reaches a write pointer in the middle of decoding one picture,
  1893. @* 0 : VPU sends an interrupt to HOST application and waits for more bitstream to decode. (interrupt mode)
  1894. @* 1 : reserved
  1895. @* 2 : VPU decodes bitstream from read pointer to write pointer. (PicEnd mode)
  1896. @endverbatim
  1897. */
  1898. BitStreamMode bitstreamMode;
  1899. Uint32 coreIdx; /**< VPU core index number (0 ~ [number of VPU core] - 1) */
  1900. /**
  1901. Work buffer SDRAM address/size information. In parallel decoding operation, work buffer is shared between VPU cores.
  1902. The work buffer address is set to this member variable when VPU_Decopen() is called.
  1903. Unless HOST application sets the address and size of work buffer, VPU allocates automatically work buffer
  1904. when VPU_DecOpen() is executed.
  1905. */
  1906. vpu_buffer_t vbWork;
  1907. Uint32 virtAxiID; /**< AXI_ID to distinguish guest OS. For virtualization only. Set this value in highest bit order.*/
  1908. BOOL bwOptimization; /**< Bandwidth optimization feature which allows WTL(Write to Linear)-enabled VPU to skip writing compressed format of non-reference pictures or linear format of non-display pictures to the frame buffer for BW saving reason. */
  1909. /**
  1910. @verbatim
  1911. It sets the selection mode of temporal ID.
  1912. @* 0: use the target temporal_id as absolute value.
  1913. @** TARGET_DEC_TEMP_ID = TARGET_DEC_TEMP_ID_PLUS1 -1
  1914. @** When using an absolute value, decoder can keep the decoding layer ID.
  1915. @** If the SPS_MAX_SUB_LAYER is changed in the bitstream, the temporal skip ratio can be changed.
  1916. @* 1: use the target temporal_id as relative value
  1917. @** TARGET_DEC_TEMP_ID = SPS_MAX_SUB_LAYER - REL_TARGET_TEMP_ID
  1918. @** SPS_MAX_SUB_LAYER is signalled from bitstream.
  1919. @** When using a relative value, decoder can keep the temporal skip ratio, regardless of the change of SPS_MAX_SUB_LAYER in the bitstream.
  1920. @endverbatim
  1921. */
  1922. BOOL tempIdSelectMode;
  1923. /**
  1924. @verbatim
  1925. @* 0: AV1_STREAM_IVF AV1 bistream contained by IVF format
  1926. @* 1: AV1_STREAM_OBU OBU syntax bitstream
  1927. @* 2: AV1_STREAM_ANNEXB Length delimited bitstream format
  1928. NOTE: This variable is only valid when decoding AV1 stream.
  1929. @endverbatim
  1930. */
  1931. int av1Format;
  1932. } DecOpenParam;
  1933. /**
  1934. * @brief This is a data structure to get information necessary to start decoding from the decoder.
  1935. */
  1936. typedef struct {
  1937. /**
  1938. @verbatim
  1939. Horizontal picture size in pixel
  1940. This width value is used while allocating decoder frame buffers. In some
  1941. cases, this returned value, the display picture width declared on stream header,
  1942. should be aligned to a specific value depending on product and video standard before allocating frame buffers.
  1943. @endverbatim
  1944. */
  1945. Int32 picWidth;
  1946. /**
  1947. @verbatim
  1948. Vertical picture size in pixel
  1949. This height value is used while allocating decoder frame buffers.
  1950. In some cases, this returned value, the display picture height declared on stream header,
  1951. should be aligned to a specific value depending on product and video standard before allocating frame buffers.
  1952. @endverbatim
  1953. */
  1954. Int32 picHeight;
  1955. /**
  1956. @verbatim
  1957. The numerator part of frame rate fraction
  1958. NOTE: The meaning of this flag can vary by codec standards.
  1959. For details about this,
  1960. please refer to 'Appendix: FRAME RATE NUMERATORS in programmer\'s guide'.
  1961. @endverbatim
  1962. */
  1963. Int32 fRateNumerator;
  1964. /**
  1965. @verbatim
  1966. The denominator part of frame rate fraction
  1967. NOTE: The meaning of this flag can vary by codec standards.
  1968. For details about this,
  1969. please refer to 'Appendix: FRAME RATE DENOMINATORS in programmer\'s guide'.
  1970. @endverbatim
  1971. */
  1972. Int32 fRateDenominator;
  1973. /**
  1974. @verbatim
  1975. Picture cropping rectangle information (H.264/H.265/AVS decoder only)
  1976. This structure specifies the cropping rectangle information.
  1977. The size and position of cropping window in full frame buffer is presented
  1978. by using this structure.
  1979. @endverbatim
  1980. */
  1981. VpuRect picCropRect;
  1982. Int32 mp4DataPartitionEnable; /**< data_partitioned syntax value in MPEG4 VOL header */
  1983. Int32 mp4ReversibleVlcEnable; /**< reversible_vlc syntax value in MPEG4 VOL header */
  1984. /**
  1985. @verbatim
  1986. @* 0 : not h.263 stream
  1987. @* 1 : h.263 stream(mpeg4 short video header)
  1988. @endverbatim
  1989. */
  1990. Int32 mp4ShortVideoHeader;
  1991. /**
  1992. @verbatim
  1993. @* 0 : Annex J disabled
  1994. @* 1 : Annex J (optional deblocking filter mode) enabled
  1995. @endverbatim
  1996. */
  1997. Int32 h263AnnexJEnable;
  1998. Int32 minFrameBufferCount; /**< This is the minimum number of frame buffers required for decoding. Applications must allocate at least as many as this number of frame buffers and register the number of buffers to VPU using VPU_DecRegisterFrameBuffer() before decoding pictures. */
  1999. Int32 frameBufDelay; /**< This is the maximum display frame buffer delay for buffering decoded picture reorder. VPU may delay decoded picture display for display reordering when H.264/H.265, pic_order_cnt_type 0 or 1 case and for B-frame handling in VC1 decoder. */
  2000. Int32 normalSliceSize; /**< This is the recommended size of buffer used to save slice in normal case. This value is determined by quarter of the memory size for one raw YUV image in KB unit. This is only for H.264. */
  2001. Int32 worstSliceSize; /**< This is the recommended size of buffer used to save slice in worst case. This value is determined by half of the memory size for one raw YUV image in KB unit. This is only for H.264. */
  2002. // Report Information
  2003. Int32 maxSubLayers; /**< Number of temporal sub-layers. */
  2004. /**
  2005. @verbatim
  2006. @* H.265/H.264 : profile_idc
  2007. @* VC1
  2008. @** 0 : Simple profile
  2009. @** 1 : Main profile
  2010. @** 2 : Advanced profile
  2011. @* MPEG2
  2012. @** 3\'b101 : Simple
  2013. @** 3\'b100 : Main
  2014. @** 3\'b011 : SNR Scalable
  2015. @** 3\'b10 : Spatially Scalable
  2016. @** 3\'b001 : High
  2017. @* MPEG4
  2018. @** 8\'b00000000 : SP
  2019. @** 8\'b00001111 : ASP
  2020. @* Real Video
  2021. @** 8 (version 8)
  2022. @** 9 (version 9)
  2023. @** 10 (version 10)
  2024. @* AVS
  2025. @** 8\'b0010 0000 : Jizhun profile
  2026. @** 8\'b0100 1000 : Guangdian profile
  2027. @* AVS2
  2028. @** 8\'b0001 0010 : Main picture profile
  2029. @** 8\'b0010 0000 : Main profile
  2030. @** 8\'b0010 0010 : Main10 profile
  2031. @* VC1 : level in struct B
  2032. @* VP8 : Profile 0 - 3
  2033. @* VP9 : Profile 0 - 3
  2034. @endverbatim
  2035. */
  2036. Int32 profile;
  2037. /**
  2038. @verbatim
  2039. @* H.265/H.264 : level_idc
  2040. @* VC1 : level
  2041. @* MPEG2 :
  2042. @** 4\'b1010 : Low
  2043. @** 4\'b1000 : Main
  2044. @** 4\'b0110 : High 1440,
  2045. @** 4\'b0100 : High
  2046. @* MPEG4 :
  2047. @** SP
  2048. @*** 4\'b1000 : L0
  2049. @*** 4\'b0001 : L1
  2050. @*** 4\'b0010 : L2
  2051. @*** 4\'b0011 : L3
  2052. @** ASP
  2053. @*** 4\'b0000 : L0
  2054. @*** 4\'b0001 : L1
  2055. @*** 4\'b0010 : L2
  2056. @*** 4\'b0011 : L3
  2057. @*** 4\'b0100 : L4
  2058. @*** 4\'b0101 : L5
  2059. @* Real Video : N/A (real video does not have any level info).
  2060. @* AVS :
  2061. @** 4\'b0000 : L2.0
  2062. @** 4\'b0001 : L4.0
  2063. @** 4\'b0010 : L4.2
  2064. @** 4\'b0011 : L6.0
  2065. @** 4\'b0100 : L6.2
  2066. @endverbatim
  2067. */
  2068. Int32 level;
  2069. /**
  2070. @verbatim
  2071. A tier indicator
  2072. @* 0 : Main
  2073. @* 1 : High
  2074. @endverbatim
  2075. */
  2076. Int32 tier;
  2077. Int32 interlace; /**< When this value is 1, decoded stream may be decoded into progressive or interlace frame. Otherwise, decoded stream is progressive frame. */
  2078. Int32 constraint_set_flag[4]; /**< constraint_set0_flag ~ constraint_set3_flag in H.264/AVC SPS */
  2079. Int32 direct8x8Flag; /**< direct_8x8_inference_flag in H.264/AVC SPS */
  2080. Int32 vc1Psf; /**< Progressive Segmented Frame(PSF) in VC1 sequence layer */
  2081. Int32 isExtSAR; /**< This flag indicates whether aspectRateInfo represents 8bit aspect_ratio_idc or 32bit extended_SAR. If the aspect_ratio_idc is extended_SAR mode, this flag returns 1. */
  2082. /**
  2083. @verbatim
  2084. This is one of the SPS syntax elements in H.264.
  2085. @* 0 : max_num_ref_frames is 0.
  2086. @* 1 : max_num_ref_frames is not 0.
  2087. @endverbatim
  2088. */
  2089. Int32 maxNumRefFrmFlag;
  2090. Int32 maxNumRefFrm; /**< num_ref_frames syntax value of SPS (CODA9 H.264 decoder only) */
  2091. /**
  2092. @verbatim
  2093. @* H.264/AVC : When avcIsExtSAR is 0, this indicates aspect_ratio_idc[7:0]. When avcIsExtSAR is 1, this indicates sar_width[31:16] and sar_height[15:0].
  2094. If aspect_ratio_info_present_flag = 0, the register returns -1 (0xffffffff).
  2095. @* VC1 : this reports ASPECT_HORIZ_SIZE[15:8] and ASPECT_VERT_SIZE[7:0].
  2096. @* MPEG2 : this value is index of Table 6-3 in ISO/IEC 13818-2.
  2097. @* MPEG4/H.263 : this value is index of Table 6-12 in ISO/IEC 14496-2.
  2098. @* RV : aspect_ratio_info
  2099. @* AVS : this value is the aspect_ratio_info[3:0] which is used as index of Table 7-5 in AVS Part2
  2100. @endverbatim
  2101. */
  2102. Int32 aspectRateInfo;
  2103. Int32 bitRate; /**< The bitrate value written in bitstream syntax. If there is no bitRate, this reports -1. */
  2104. ThoScaleInfo thoScaleInfo; /**< This is the Theora picture size information. Refer to <<vpuapi_h_ThoScaleInfo>>. */
  2105. Vp8ScaleInfo vp8ScaleInfo; /**< This is VP8 upsampling information. Refer to <<vpuapi_h_Vp8ScaleInfo>>. */
  2106. Int32 mp2LowDelay; /**< This is low_delay syntax of sequence extension in MPEG2 specification. */
  2107. Int32 mp2DispVerSize; /**< This is display_vertical_size syntax of sequence display extension in MPEG2 specification. */
  2108. Int32 mp2DispHorSize; /**< This is display_horizontal_size syntax of sequence display extension in MPEG2 specification. */
  2109. Uint32 userDataHeader; /**< Refer to userDataHeader in <<vpuapi_h_DecOutputExtData>>. */
  2110. Int32 userDataNum; /**< Refer to userDataNum in <<vpuapi_h_DecOutputExtData>>. */
  2111. Int32 userDataSize; /**< Refer to userDataSize in <<vpuapi_h_DecOutputExtData>>. */
  2112. Int32 userDataBufFull;/**< Refer to userDataBufFull in <<vpuapi_h_DecOutputExtData>>. */
  2113. //VUI information
  2114. Int32 chromaFormatIDC;/**< A chroma format indicator */
  2115. Int32 lumaBitdepth; /**< A bit-depth of luma sample */
  2116. Int32 chromaBitdepth; /**< A bit-depth of chroma sample */
  2117. /**
  2118. @verbatim
  2119. This is an error reason of sequence header decoding.
  2120. For detailed meaning of returned value,
  2121. please refer to the 'Appendix: ERROR DEFINITION in programmer\'s guide'.
  2122. @endverbatim
  2123. */
  2124. Uint32 seqInitErrReason;
  2125. /**
  2126. @verbatim
  2127. This is warning information of sequence header decoding.
  2128. For detailed meaning of returned value,
  2129. please refer to the 'Appendix: ERROR DEFINITION in programmer\'s guide'.
  2130. @endverbatim
  2131. */
  2132. Int32 warnInfo;
  2133. PhysicalAddress rdPtr; /**< A read pointer of bitstream buffer */
  2134. PhysicalAddress wrPtr; /**< A write pointer of bitstream buffer */
  2135. AvcVuiInfo avcVuiInfo; /**< This is H.264/AVC VUI information. Refer to <<vpuapi_h_AvcVuiInfo>>. */
  2136. MP2BarDataInfo mp2BardataInfo;/**< This is bar information in MPEG2 user data. For details about this, please see the document 'ATSC Digital Television Standard: Part 4:2009'. */
  2137. Uint32 sequenceNo; /**< This is the number of sequence information. This variable is increased by 1 when VPU detects change of sequence. */
  2138. /**
  2139. @verbatim
  2140. This is an spatial SVC flag.
  2141. @* 0 : Non-SVC stream
  2142. @* 1 : SVC stream
  2143. @endverbatim
  2144. */
  2145. Int32 spatialSvcEnable;
  2146. /**
  2147. @verbatim
  2148. This is an spatial SVC mode.
  2149. @* 0 : disable inter-layer prediction (simulcast).
  2150. @* 1 : enable inter-layer prediction in which EL picture is predicted with motion vector information from the base layer picture.
  2151. @endverbatim
  2152. */
  2153. Int32 spatialSvcMode;
  2154. /**
  2155. @verbatim
  2156. This is an output bit-depth. This is only for AVS2
  2157. @* 8 : output bit-depth is 8.
  2158. @* 10 : output bit-depth is 10.
  2159. @endverbatim
  2160. */
  2161. Uint32 outputBitDepth;
  2162. Uint32 vlcBufSize; /**< The size of task buffer */
  2163. Uint32 paramBufSize; /**< The size of task buffer */
  2164. } DecInitialInfo;
  2165. // Report Information
  2166. #define WAVE_SKIPMODE_WAVE_NONE 0
  2167. #define WAVE_SKIPMODE_NON_IRAP 1
  2168. #define WAVE_SKIPMODE_NON_REF 2
  2169. #define SEL_SVAC_ALL_LAYER 0
  2170. #define SEL_SVAC_BL 1
  2171. #define SEL_SVAC_EL 2
  2172. /**
  2173. * @brief The data structure for options of picture decoding.
  2174. */
  2175. typedef struct {
  2176. /**
  2177. @verbatim
  2178. @* 0 : disable
  2179. @* 1 : enable
  2180. @* 2 : I frame search enable (H.264/AVC only)
  2181. If this option is enabled, then decoder performs skipping frame decoding until
  2182. decoder meets an I (IDR) frame. If there is no I frame in given stream, decoder
  2183. waits for I (IDR) frame.
  2184. Especially in H.264/AVC stream decoding, they might have I-frame and IDR frame.
  2185. Therefore HOST application should set iframeSearchEnable value according to frame type.
  2186. If HOST application wants to search IDR frame, this flag should be set to 1 like other standards.
  2187. Otherwise if HOST application wants to search I frame, this flag should be set to 2.
  2188. Note that when decoder meets EOS (End Of Sequence) code during I-Search, decoder
  2189. returns -1 (0xFFFF). And if this option is enabled,
  2190. skipframeMode options are ignored.
  2191. NOTE: CODA9 only supports it.
  2192. @endverbatim
  2193. */
  2194. Int32 iframeSearchEnable;
  2195. /**
  2196. @verbatim
  2197. Skip frame function enable and operation mode
  2198. In case of CODA9,
  2199. @* 0 : skip frame disable
  2200. @* 1 : skip frames except I (IDR) frames
  2201. @* 2 : skip non-reference frames
  2202. After the skip, decoder returns -2 (0xFFFE) of the decoded index when decoder does not have any
  2203. frames displayed.
  2204. In case of WAVE5,
  2205. @* 0x0 : skip frame off
  2206. @* 0x1 : skip non-RAP pictures (skip any picture which is neither IDR, CRA, nor BLA).
  2207. @* 0x2 : skip non-reference pictures
  2208. @* 0x3 : reserved
  2209. @* 0x4~0xf : reserved
  2210. NOTE: When decoder meets EOS (End Of Sequence) code during frame skip,
  2211. decoder returns -1(0xFFFF).
  2212. @endverbatim
  2213. */
  2214. Int32 skipframeMode;
  2215. /**
  2216. @verbatim
  2217. Selects which layer of SVAC spatial SVC stream is decoded.
  2218. @* 0: decodes both BL(Base Layer) and EL(Enhanced Layer) picture.
  2219. @* 1: decodes BL picture.
  2220. @* 2: decodes EL picture.
  2221. @endverbatim
  2222. */
  2223. Int32 selSvacLayer;
  2224. union {
  2225. /**
  2226. @verbatim
  2227. Forces to flush a display index of the frame buffer that
  2228. delayed without decoding of the current picture.
  2229. @* 0 : disable
  2230. @* 1 : enable flushing
  2231. @endverbatim
  2232. */
  2233. Int32 mp2PicFlush;
  2234. /**
  2235. @verbatim
  2236. Sets a de-blocking filter mode for RV streams.
  2237. @* 0 : enable de-blocking filter for all pictures.
  2238. @* 1 : disable de-blocking filter for all pictures.
  2239. @* 2 : disable de-blocking filter for P and B pictures.
  2240. @* 3 : disable de-blocking filter only for B pictures.
  2241. @endverbatim
  2242. */
  2243. Int32 rvDbkMode;
  2244. } DecStdParam;
  2245. BOOL craAsBlaFlag; /**< It handles CRA picture as BLA picture not to use reference from the previous decoded pictures (H.265/HEVC only) */
  2246. Uint32 qosEnable; /**< It updates QoS control information. To update QoS values, qosEnable must be 1. */
  2247. Uint32 qosConfig; /**< It enables register based QoS control. If register based QoS control feature is enabled, QoS for AXI is set by given qosValVcore0 and qosValVcore1 respectively. */
  2248. Uint32 qosValVcore0; /**< Qos value for VCORE0 */
  2249. Uint32 qosValVcore1; /**< Qos value for VCORE1 */
  2250. } DecParam;
  2251. // Report Information
  2252. /**
  2253. * @brief The data structure to get result information from decoding a frame.
  2254. */
  2255. typedef struct {
  2256. /**
  2257. @verbatim
  2258. This variable indicates which userdata is reported by VPU. (WAVE only)
  2259. When this variable is not zero, each bit corresponds to the `H265_USERDATA_FLAG_XXX`.
  2260. // H265 USER_DATA(SPS & SEI) ENABLE FLAG
  2261. #define H265_USERDATA_FLAG_RESERVED_0 (0)
  2262. #define H265_USERDATA_FLAG_RESERVED_1 (1)
  2263. #define H265_USERDATA_FLAG_VUI (2)
  2264. #define H265_USERDATA_FLAG_RESERVED_3 (3)
  2265. #define H265_USERDATA_FLAG_PIC_TIMING (4)
  2266. #define H265_USERDATA_FLAG_ITU_T_T35_PRE (5)
  2267. #define H265_USERDATA_FLAG_UNREGISTERED_PRE (6)
  2268. #define H265_USERDATA_FLAG_ITU_T_T35_SUF (7)
  2269. #define H265_USERDATA_FLAG_UNREGISTERED_SUF (8)
  2270. #define H265_USERDATA_FLAG_RECOVERY_POINT (9)
  2271. #define H265_USERDATA_FLAG_MASTERING_COLOR_VOL (10)
  2272. #define H265_USERDATA_FLAG_CHROMA_RESAMPLING_FILTER_HINT (11)
  2273. #define H265_USERDATA_FLAG_KNEE_FUNCTION_INFO (12)
  2274. Userdata are written from the memory address specified to SET_ADDR_REP_USERDATA,
  2275. and userdata consists of two parts, header (offset and size) and userdata as shown below.
  2276. -------------------------------------
  2277. | offset_00(32bit) | size_00(32bit) |
  2278. | offset_01(32bit) | size_01(32bit) |
  2279. | ... | header
  2280. | ... |
  2281. | offset_31(32bit) | size_31(32bit) |
  2282. -------------------------------------
  2283. | | data
  2284. | |
  2285. @endverbatim
  2286. */
  2287. Uint32 userDataHeader;
  2288. Uint32 userDataNum; /**< This is the number of user data. */
  2289. Uint32 userDataSize; /**< This is the size of user data. */
  2290. Uint32 userDataBufFull; /**< When userDataEnable is enabled, decoder reports frame buffer status into the userDataBufAddr and userDataSize in byte size. When user data report mode is 1 and the user data size is bigger than the user data buffer size, VPU reports user data as much as buffer size, skips the remainings and sets userDataBufFull. */
  2291. Uint32 activeFormat; /**< active_format (4bit syntax value) in AFD user data. The default value is 0000b. This is valid only for H.264/AVC and MPEG2 stream. */
  2292. } DecOutputExtData;
  2293. // VP8 specific header information
  2294. /**
  2295. * @brief This is a data structure for VP8 specific hearder information and reference frame indices.
  2296. Only VP8 decoder returns this structure after decoding a frame.
  2297. */
  2298. typedef struct {
  2299. unsigned showFrame : 1; /**< This flag is the frame header syntax, meaning whether the current decoded frame is displayable or not. It is 0 when the current frame is not for display, and 1 when the current frame is for display. */
  2300. unsigned versionNumber : 3; /**< This is the VP8 profile version number information in the frame header. The version number enables or disables certain features in bitstream. It can be defined with one of the four different profiles, 0 to 3 and each of them indicates different decoding complexity. */
  2301. unsigned refIdxLast : 8; /**< This is the frame buffer index for the Last reference frame. This field is valid only for next inter frame decoding. */
  2302. unsigned refIdxAltr : 8; /**< This is the frame buffer index for the altref(Alternative Reference) reference frame. This field is valid only for next inter frame decoding. */
  2303. unsigned refIdxGold : 8; /**< This is the frame buffer index for the Golden reference frame. This field is valid only for next inter frame decoding. */
  2304. } Vp8PicInfo;
  2305. // MVC specific picture information
  2306. /**
  2307. * @brief This is a data structure for MVC specific picture information. Only MVC decoder returns this structure after decoding a frame.
  2308. */
  2309. typedef struct {
  2310. int viewIdxDisplay; /**< This is view index order of display frame buffer corresponding to indexFrameDisplay of <<vpuapi_h_DecOutputInfo>> structure. */
  2311. int viewIdxDecoded; /**< This is view index order of decoded frame buffer corresponding to indexFrameDecoded of <<vpuapi_h_DecOutputInfo>> structure. */
  2312. } MvcPicInfo;
  2313. // AVC specific SEI information (frame packing arrangement SEI)
  2314. /**
  2315. * @brief This is a data structure for H.264/AVC FPA(Frame Packing Arrangement) SEI.
  2316. For detailed information, refer to 'ISO/IEC 14496-10 D.2.25 Frame packing arrangement SEI message semantics'.
  2317. */
  2318. typedef struct {
  2319. /**
  2320. @verbatim
  2321. This is a flag to indicate whether H.264/AVC FPA SEI exists or not.
  2322. @* 0 : H.264/AVC FPA SEI does not exist.
  2323. @* 1 : H.264/AVC FPA SEI exists.
  2324. @endverbatim
  2325. */
  2326. unsigned exist;
  2327. unsigned framePackingArrangementId; /**< 0 ~ 2^32-1 : An identifying number that may be used to identify the usage of the frame packing arrangement SEI message. */
  2328. unsigned framePackingArrangementCancelFlag; /**< 1 indicates that the frame packing arrangement SEI message cancels the persistence of any previous frame packing arrangement SEI message in output order. */
  2329. unsigned quincunxSamplingFlag; /**< It indicates whether each color component plane of each constituent frame is quincunx sampled. */
  2330. unsigned spatialFlippingFlag; /**< It indicates that one of the two constituent frames is spatially flipped. */
  2331. unsigned frame0FlippedFlag; /**< It indicates which one of the two constituent frames is flipped. */
  2332. unsigned fieldViewsFlag; /**< 1 indicates that all pictures in the current coded video sequence are coded as complementary field pairs. */
  2333. unsigned currentFrameIsFrame0Flag; /**< It indicates the current decoded frame and the next decoded frame in output order. */
  2334. unsigned frame0SelfContainedFlag; /**< It indicates whether inter prediction operations within the decoding process for the samples of constituent frame 0 of the coded video sequence refer to samples of any constituent frame 1. */
  2335. unsigned frame1SelfContainedFlag; /**< It indicates whether inter prediction operations within the decoding process for the samples of constituent frame 1 of the coded video sequence refer to samples of any constituent frame 0. */
  2336. unsigned framePackingArrangementExtensionFlag; /**< 0 indicates that no additional data follows within the frame packing arrangement SEI message. */
  2337. unsigned framePackingArrangementType; /**< The type of packing arrangement of the frames */
  2338. unsigned contentInterpretationType; /**< It indicates the intended interpretation of the constituent frames. */
  2339. unsigned frame0GridPositionX; /**< It specifies the horizontal location of the upper left sample of constituent frame 0 to the right of the spatial reference point. */
  2340. unsigned frame0GridPositionY; /**< It specifies the vertical location of the upper left sample of constituent frame 0 below the spatial reference point. */
  2341. unsigned frame1GridPositionX; /**< It specifies the horizontal location of the upper left sample of constituent frame 1 to the right of the spatial reference point. */
  2342. unsigned frame1GridPositionY; /**< It specifies the vertical location of the upper left sample of constituent frame 1 below the spatial reference point. */
  2343. unsigned framePackingArrangementRepetitionPeriod; /**< It indicates persistence of the frame packing arrangement SEI message. */
  2344. } AvcFpaSei;
  2345. // H.264/AVC specific HRD information
  2346. /**
  2347. * @brief This is a data structure for H.264/AVC specific picture information. (H.264/AVC decoder only)
  2348. VPU returns this structure after decoding a frame. For detailed information, refer to 'ISO/IEC 14496-10 E.1 VUI syntax'.
  2349. */
  2350. typedef struct {
  2351. int cpbMinus1; /**< It indicates cpb_cnt_minus1 syntax. */
  2352. int vclHrdParamFlag; /**< It indicates vcl_hrd_parameters_present_flag syntax. */
  2353. int nalHrdParamFlag; /**< It indicates nal_hrd_parameters_present_flag syntax. */
  2354. } AvcHrdInfo;
  2355. // H.264/AVC specific Recovery Point information
  2356. /**
  2357. * @brief This is a data structure for H.264/AVC specific picture information. (H.264/AVC decoder only)
  2358. VPU returns this structure after decoding a frame. For detailed information, refer to 'ISO/IEC 14496-10 D.1.7 Recovery point SEI message syntax'.
  2359. */
  2360. typedef struct {
  2361. /**
  2362. @verbatim
  2363. This is a flag to indicate whether H.264/AVC RP SEI exists or not.
  2364. @* 0 : H.264/AVC RP SEI does not exist.
  2365. @* 1 : H.264/AVC RP SEI exists.
  2366. @endverbatim
  2367. */
  2368. unsigned exist;
  2369. int recoveryFrameCnt; /**< It indicates recovery_frame_cnt syntax. */
  2370. int exactMatchFlag; /**< It indicates exact_match_flag syntax. */
  2371. int brokenLinkFlag; /**< It indicates broken_link_flag syntax. */
  2372. int changingSliceGroupIdc; /**< It indicates changing_slice_group_idc syntax. */
  2373. } AvcRpSei;
  2374. // HEVC specific Recovery Point information
  2375. /**
  2376. * @brief This is a data structure for H.265/HEVC specific picture information. (H.265/HEVC decoder only)
  2377. VPU returns this structure after decoding a frame.
  2378. */
  2379. typedef struct {
  2380. /**
  2381. @verbatim
  2382. This is a flag to indicate whether H.265/HEVC Recovery Point SEI exists or not.
  2383. @* 0 : H.265/HEVC RP SEI does not exist.
  2384. @* 1 : H.265/HEVC RP SEI exists.
  2385. @endverbatim
  2386. */
  2387. unsigned exist;
  2388. int recoveryPocCnt; /**< recovery_poc_cnt */
  2389. int exactMatchFlag; /**< exact_match_flag */
  2390. int brokenLinkFlag; /**< broken_link_flag */
  2391. } H265RpSei;
  2392. /**
  2393. * @brief This is a data structure of spatial scalable video coding information such as SVC layer and SVC mode (SVAC only)
  2394. */
  2395. typedef struct {
  2396. /**
  2397. @verbatim
  2398. This is the spatial SVC mode.
  2399. @* 0 : disable inter-layer prediction. (simulcast)
  2400. @* 1 : enable inter-layer prediction in which EL picture is predicted with motion vector information from the base layer picture.
  2401. @endverbatim
  2402. */
  2403. int spatialSvcMode;
  2404. /**
  2405. @verbatim
  2406. This is the layer information of SVC stream.
  2407. @* 0 : base layer picture
  2408. @* 1 : enhance layer picture
  2409. @endverbatim
  2410. */
  2411. int spatialSvcLayer;
  2412. int spatialSvcFlag; /**< An spatial SVC flag */
  2413. } SvacInfo;
  2414. /**
  2415. * @brief This is a data structure for AVS2 specific picture information.
  2416. */
  2417. typedef struct {
  2418. int decodedPOI; /**< A POI value of picture that has currently been decoded and with decoded index. When indexFrameDecoded is -1, it returns -1. */
  2419. int displayPOI; /**< A POI value of picture with display index. When indexFrameDisplay is -1, it returns -1. */
  2420. } Avs2Info;
  2421. /**
  2422. * @brief This is a data structure for AV1 specific picture information.
  2423. */
  2424. typedef struct {
  2425. int enableScreenContents; /**< It indicates whether screen content tool is enabled. */
  2426. int enableIntraBlockCopy; /**< It indicates whether intra block copy is enabled. */
  2427. } Av1Info;
  2428. /**
  2429. * @brief The data structure to get result information from decoding a frame.
  2430. */
  2431. typedef struct {
  2432. /**
  2433. @verbatim
  2434. This is a frame buffer index for the picture to be displayed at the moment among
  2435. frame buffers which are registered using VPU_DecRegisterFrameBuffer(). Frame
  2436. data to be displayed are stored into the frame buffer with this index.
  2437. When there is no display delay, this index is always
  2438. the same with indexFrameDecoded. However, if display delay does exist for display reordering in AVC
  2439. or B-frames in VC1), this index might be different with indexFrameDecoded.
  2440. By checking this index, HOST application can easily know whether sequence decoding has been finished or not.
  2441. @* -3(0xFFFD) or -2(0xFFFE) : it is when a display output cannot be given due to picture reordering or skip option.
  2442. @* -1(0xFFFF) : it is when there is no more output for display at the end of sequence decoding.
  2443. @endverbatim
  2444. */
  2445. int indexFrameDisplay;
  2446. int indexFrameDisplayForTiled; /**< In case of WTL mode, this index indicates a display index of tiled or compressed framebuffer. */
  2447. /**
  2448. @verbatim
  2449. This is a frame buffer index of decoded picture among frame buffers which were
  2450. registered using VPU_DecRegisterFrameBuffer(). The currently decoded frame is stored into the frame buffer specified by
  2451. this index.
  2452. * -2 : it indicates that no decoded output is generated because decoder meets EOS (End Of Sequence) or skip.
  2453. * -1 : it indicates that decoder fails to decode a picture because there is no available frame buffer.
  2454. @endverbatim
  2455. */
  2456. int indexFrameDecoded;
  2457. int indexInterFrameDecoded; /**< In case of VP9 codec, this indicates an index of the frame buffer to reallocate for the next frame's decoding. VPU returns this information when detecting change of the inter-frame resolution. */
  2458. int indexFrameDecodedForTiled; /**< In case of WTL mode, this indicates a decoded index of tiled or compressed framebuffer. */
  2459. int nalType; /**< This is nal Type of decoded picture. Please refer to nal_unit_type in Table 7-1 - NAL unit type codes and NAL unit type classes in H.265/HEVC specification. (WAVE only) */
  2460. int picType; /**< This is the picture type of decoded picture. It reports the picture type of bottom field for interlaced stream. <<vpuapi_h_PicType>>. */
  2461. int picTypeFirst; /**< This is only valid in interlaced mode and indicates the picture type of the top field. */
  2462. int numOfErrMBs; /**< This is the total number of error coded unit(MB/CTU) in the decoded picture. */
  2463. int numOfTotMBs; /**< This is the total number of coded unit(MB/CTU) in the decoded picture. */
  2464. int numOfErrMBsInDisplay; /**< This is the total number of error coded unit(MB/CTU) in the display picture of indexFrameDisplay. */
  2465. int numOfTotMBsInDisplay; /**< This is the total number of coded unit(MB/CTU) in the display picture of indexFrameDisplay. In normal stream, numOfTotMBs and numOfTotMBsInDisplay always have the same value. However, in case of sequence change stream(resolution change), they might be different. */
  2466. BOOL refMissingFrameFlag; /**< This indicates that the current frame's references are missing in decoding.*/
  2467. int notSufficientSliceBuffer; /**< This is a flag which represents whether slice save buffer is not sufficient to decode the current picture. VPU might not get the last part of the current picture stream due to buffer overflow, which leads to macroblock errors. HOST application can continue decoding the remaining pictures of the current bitstream without closing the current instance, even though several pictures could be error-corrupted. (H.264/AVC BP only) */
  2468. int notSufficientPsBuffer; /**< This is a flag which represents whether PS (SPS/PPS) save buffer is not sufficient to decode the current picture. VPU might not get the last part of the current picture stream due to buffer overflow. HOST application must close the current instance, since the following picture streams cannot be decoded properly for loss of SPS/PPS data. (H.264/AVC only) */
  2469. /**
  2470. @verbatim
  2471. This variable indicates whether decoding process was finished completely or not. If stream
  2472. has error in the picture header syntax or has the first slice header syntax of H.264/AVC
  2473. stream, VPU returns 0 without proceeding MB decode routine.
  2474. @* 0 : it indicates incomplete finish of decoding process.
  2475. @* 1 : it indicates complete finish of decoding process.
  2476. @endverbatim
  2477. */
  2478. Uint32 decodingSuccess;
  2479. /**
  2480. @verbatim
  2481. @* 0 : progressive frame which consists of one picture
  2482. @* 1 : interlaced frame which consists of two fields
  2483. @endverbatim
  2484. */
  2485. int interlacedFrame;
  2486. /**
  2487. @verbatim
  2488. This is a flag which represents whether chunk in bitstream buffer should be reused or not, even after VPU_DecStartOneFrame() is executed.
  2489. This flag is meaningful when bitstream buffer operates in PicEnd mode. In that mode, VPU consumes all the bitstream in bitstream buffer for the current VPU_DecStartOneFrame()
  2490. in assumption that one chunk is one frame.
  2491. However, there might be a few cases that chunk needs to be reused such as the following:
  2492. * DivX or XivD stream : One chunk can contain P frame and B frame to reduce display delay.
  2493. In that case after decoding P frame, this flag is set to 1. HOST application should try decoding with the rest of chunk data to get B frame.
  2494. * H.264/AVC NPF stream : After the first field has been decoded, this flag is set to 1. HOST application should check if the next field is NPF or not.
  2495. * No DPB available: VPU is not able to consume chunk with no frame buffers available at the moment. Thus, the whole chunk should be provided again.
  2496. @endverbatim
  2497. */
  2498. int chunkReuseRequired;
  2499. VpuRect rcDisplay; /**< This field reports the rectangular region in pixel unit after decoding one frame - the region of `indexFrameDisplay` frame buffer. */
  2500. int dispPicWidth; /**< This field reports the width of a picture to be displayed in pixel unit after decoding one frame - width of `indexFrameDisplay` frame bufffer. */
  2501. int dispPicHeight; /**< This field reports the height of a picture to be displayed in pixel unit after decoding one frame - height of `indexFrameDisplay` frame bufffer. */
  2502. VpuRect rcDecoded; /**< This field reports the rectangular region in pixel unit after decoding one frame - the region of `indexFrameDecoded` frame buffer. */
  2503. int decPicWidth; /**< This field reports the width of a decoded picture in pixel unit after decoding one frame - width of `indexFrameDecoded` frame bufffer. */
  2504. int decPicHeight; /**< This field reports the height of a decoded picture in pixel unit after decoding one frame - height of `indexFrameDecoded` frame bufffer. */
  2505. int aspectRateInfo; /**< This is aspect ratio information for each standard. Refer to aspectRateInfo of <<vpuapi_h_DecInitialInfo>>. */
  2506. int fRateNumerator; /**< The numerator part of frame rate fraction. Note that the meaning of this flag can vary by codec standards. For details about this, please refer to 'Appendix: FRAME RATE NUMERATORS in programmer\'s guide'. */
  2507. int fRateDenominator; /**< The denominator part of frame rate fraction. Note that the meaning of this flag can vary by codec standards. For details about this, please refer to 'Appendix: FRAME RATE DENOMINATORS in programmer\'s guide'. */
  2508. Vp8ScaleInfo vp8ScaleInfo; /**< This is VP8 upsampling information. Refer to <<vpuapi_h_Vp8ScaleInfo>>. */
  2509. Vp8PicInfo vp8PicInfo; /**< This is VP8 frame header information. Refer to <<vpuapi_h_Vp8PicInfo>>. */
  2510. MvcPicInfo mvcPicInfo; /**< This is MVC related picture information. Refer to <<vpuapi_h_MvcPicInfo>>. */
  2511. AvcFpaSei avcFpaSei; /**< This is H.264/AVC frame packing arrangement SEI information. Refer to <<vpuapi_h_AvcFpaSei>>. */
  2512. AvcHrdInfo avcHrdInfo; /**< This is H.264/AVC HRD information. Refer to <<vpuapi_h_AvcHrdInfo>>. */
  2513. AvcVuiInfo avcVuiInfo; /**< This is H.264/AVC VUI information. Refer to <<vpuapi_h_AvcVuiInfo>>. */
  2514. SvacInfo svacInfo; /**< This field reports the information of SVC stream. Refer to <<vpuapi_h_SvacInfo>>. */
  2515. Avs2Info avs2Info; /**< This is AVS2 picture information. Refer to <<vpuapi_h_Avs2Info>>. */
  2516. Av1Info av1Info; /**< This is AVS1 picture information. Refer to <<vpuapi_h_Av1Info>>. */
  2517. int decodedPOC; /**< A POC value of picture that has currently been decoded and with decoded index. When indexFrameDecoded is -1, it returns -1. */
  2518. int displayPOC; /**< A POC value of picture with display index. When indexFrameDisplay is -1, it returns -1. */
  2519. int temporalId; /**< A temporal ID of the picture */
  2520. /**
  2521. @verbatim
  2522. This field is valid only for VC1 decoding. Field information of display frame index
  2523. is returned on `indexFrameDisplay`.
  2524. @* 0 : paired fields
  2525. @* 1 : bottom (top-field missing)
  2526. @* 2 : top (bottom-field missing)
  2527. @endverbatim
  2528. */
  2529. int vc1NpfFieldInfo;
  2530. int mp2DispVerSize; /**< This is display_vertical_size syntax of sequence display extension in MPEG2 specification. */
  2531. int mp2DispHorSize; /**< This is display_horizontal_size syntax of sequence display extension in MPEG2 specification. */
  2532. /**
  2533. @verbatim
  2534. This field is valid only for MPEG2 decoding. Field information of display frame index
  2535. is returned on `indexFrameDisplay`.
  2536. @* 0 : paired fields
  2537. @* 1 : bottom (top-field missing)
  2538. @* 2 : top (bottom-field missing)
  2539. @endverbatim
  2540. */
  2541. int mp2NpfFieldInfo;
  2542. MP2BarDataInfo mp2BardataInfo; /**< This is bar information in MPEG2 user data. For details about this, please see the document 'ATSC Digital Television Standard: Part 4:2009'. */
  2543. MP2PicDispExtInfo mp2PicDispExtInfo; /**< For meaning of each field, please see <<vpuapi_h_MP2PicDispExtInfo>>. */
  2544. AvcRpSei avcRpSei; /**< This is H.264/AVC recovery point SEI information. Refer to <<vpuapi_h_AvcRpSei>>. */
  2545. H265RpSei h265RpSei; /**< This is H.265/HEVC recovery point SEI information. Refer to <<vpuapi_h_H265RpSei>>. */
  2546. /**
  2547. @verbatim
  2548. This field is valid only for H.264/AVC decoding.
  2549. Field information of display frame index is returned on `indexFrameDisplay`.
  2550. Refer to the <<vpuapi_h_AvcNpfFieldInfo>>.
  2551. @* 0 : paired fields
  2552. @* 1 : bottom (top-field missing)
  2553. @* 2 : top (bottom-field missing)
  2554. @endverbatim
  2555. */
  2556. int avcNpfFieldInfo;
  2557. int avcPocPic; /**< This field reports the POC value of frame picture in case of H.264/AVC decoding. */
  2558. int avcPocTop; /**< This field reports the POC value of top field picture in case of H.264/AVC decoding. */
  2559. int avcPocBot; /**< This field reports the POC value of bottom field picture in case of H.264/AVC decoding. */
  2560. // Report Information
  2561. /**
  2562. @verbatim
  2563. This variable indicates that the decoded picture is progressive or interlaced
  2564. picture. The value of pictureStructure is used as below.
  2565. @* H.264/AVC : MBAFF
  2566. @* VC1 : FCM
  2567. @** 0 : progressive
  2568. @** 2 : frame interlace
  2569. @** 3 : field interlaced
  2570. @* MPEG2 : picture structure
  2571. @** 1 : top field
  2572. @** 2 : bottom field
  2573. @** 3 : frame
  2574. @* MPEG4 : N/A
  2575. @* Real Video : N/A
  2576. @* H.265/HEVC : N/A
  2577. @endverbatim
  2578. */
  2579. int pictureStructure;
  2580. /**
  2581. @verbatim
  2582. For decoded picture consisting of two fields, this variable reports
  2583. @* 0 : VPU decodes the bottom field and then top field.
  2584. @* 1 : VPU decodes the top field and then bottom field.
  2585. Regardless of this variable, VPU writes the decoded image of top field picture at each odd line and the decoded image of bottom field picture at each even line in frame buffer.
  2586. @endverbatim
  2587. */
  2588. int topFieldFirst;
  2589. int repeatFirstField; /**< This variable indicates Repeat First Field that repeats to display the first field. This flag is valid for VC1, AVS, and MPEG2. */
  2590. int progressiveFrame; /**< This variable indicates progressive_frame in MPEG2 picture coding extention or in AVS picture header. In the case of VC1, this variable means RPTFRM (Repeat Frame Count), which is used during display process. */
  2591. int fieldSequence; /**< This variable indicates field_sequence in picture coding extention in MPEG2. */
  2592. int frameDct; /**< This variable indicates frame_pred_frame_dct in sequence extension of MPEG2. */
  2593. int nalRefIdc; /**< This variable indicates if the currently decoded frame is a reference frame or not. This flag is valid for H.264/AVC only. */
  2594. /**
  2595. @verbatim
  2596. @* H.264/AVC, MPEG2, and VC1
  2597. @** 0 : the decoded frame has paired fields.
  2598. @** 1 : the decoded frame has a top-field missing.
  2599. @** 2 : the decoded frame has a bottom-field missing.
  2600. @endverbatim
  2601. */
  2602. int decFrameInfo;
  2603. int picStrPresent; /**< It indicates pic_struct_present_flag in H.264/AVC pic_timing SEI. */
  2604. int picTimingStruct; /**< It indicates pic_struct in H.264/AVC pic_timing SEI reporting. (Table D-1 in H.264/AVC specification.) If pic_timing SEI is not presented, pic_struct is inferred by the D.2.1. pic_struct part in H.264/AVC specification. This field is valid only for H.264/AVC decoding. */
  2605. int progressiveSequence;/**< It indicates progressive_sequence in sequence extension of MPEG2. */
  2606. int mp4TimeIncrement; /**< It indicates vop_time_increment_resolution in MPEG4 VOP syntax. */
  2607. int mp4ModuloTimeBase; /**< It indicates modulo_time_base in MPEG4 VOP syntax. */
  2608. DecOutputExtData decOutputExtData; /**< The data structure to get additional information about a decoded frame. Refer to <<vpuapi_h_DecOutputExtData>>. */
  2609. int consumedByte; /**< The number of bytes that are consumed by VPU. */
  2610. int rdPtr; /**< A stream buffer read pointer for the current decoder instance */
  2611. int wrPtr; /**< A stream buffer write pointer for the current decoder instance */
  2612. /**
  2613. @verbatim
  2614. The start byte position of the current frame after decoding the frame for audio-to-video synchronization
  2615. H.265/HEVC or H.264/AVC decoder seeks only 3-byte start code
  2616. (0x000001) while other decoders seek 4-byte start code(0x00000001).
  2617. @endverbatim
  2618. */
  2619. PhysicalAddress bytePosFrameStart;
  2620. PhysicalAddress bytePosFrameEnd; /**< It indicates the end byte position of the current frame after decoding. This information helps audio-to-video synchronization. */
  2621. FrameBuffer dispFrame; /**< It indicates the display frame buffer address and information. Refer to <<vpuapi_h_FrameBuffer>>. */
  2622. int frameDisplayFlag; /**< It reports a frame buffer flag to be displayed. */
  2623. /**
  2624. @verbatim
  2625. This variable reports that sequence has been changed while H.264/AVC stream decoding.
  2626. If it is 1, HOST application can get the new sequence information by calling VPU_DecGetInitialInfo() or VPU_DecIssueSeqInit().
  2627. For H.265/HEVC decoder, each bit has a different meaning as follows.
  2628. @* sequenceChanged[5] : it indicates that the profile_idc has been changed.
  2629. @* sequenceChanged[16] : it indicates that the resolution has been changed.
  2630. @* sequenceChanged[19] : it indicates that the required number of frame buffer has been changed.
  2631. @endverbatim
  2632. */
  2633. int sequenceChanged;
  2634. // CODA9: [0] 1 - sequence changed
  2635. // WAVEX: [5] 1 - H.265 profile changed
  2636. // [16] 1 - resolution changed
  2637. // [19] 1 - number of DPB changed
  2638. int streamEndFlag; /**< This variable reports the status of `end of stream` flag. This information can be used for low delay decoding (CODA980 only). */
  2639. int frameCycle; /**< This variable reports the number of cycles for processing a frame. */
  2640. int errorReason; /**< This variable reports the error reason that occurs while decoding. For error description, please find the 'Appendix: Error Definition' in the Programmer's Guide. */
  2641. Uint32 errorReasonExt; /**< This variable reports the specific reason of error. For error description, please find the 'Appendix: Error Definition' in the Programmer's Guide. (WAVE only) */
  2642. int warnInfo; /**< This variable reports the warning information that occurs while decoding. For warning description, please find the 'Appendix: Error Definition' in the Programmer's Guide. */
  2643. Uint32 sequenceNo; /**< This variable increases by 1 whenever sequence changes. If it happens, HOST should call VPU_DecFrameBufferFlush() to get the decoded result that remains in the buffer in the form of DecOutputInfo array. HOST can recognize with this variable whether this frame is in the current sequence or in the previous sequence when it is displayed. (WAVE only) */
  2644. int rvTr; /**< This variable reports RV timestamp for Ref frame. */
  2645. int rvTrB; /**< This variable reports RV timestamp for B frame. */
  2646. /**
  2647. @verbatim
  2648. This variable reports the result of pre-scan which is the start of decoding routine for DEC_PIC command. (WAVE only)
  2649. In the prescan phase, VPU parses bitstream and pre-allocates frame buffers.
  2650. @* -2 : it is when VPU prescanned bitstream(bitstream consumed), but a decode buffer was not allocated for the bitstream during pre-scan, since there was only header information.
  2651. @* -1 : it is when VPU detected full of framebuffer while pre-scannig (bitstream not consumed).
  2652. @* >= 0 : it indicates that prescan has been successfully done. This index is returned to a decoded index for the next decoding.
  2653. @endverbatim
  2654. */
  2655. int indexFramePrescan;
  2656. Uint32 decHostCmdTick; /**< Tick of DEC_PIC command for the picture */
  2657. Uint32 decSeekStartTick; /**< Start tick of seeking slices of the picture */
  2658. Uint32 decSeekEndTick; /**< End tick of seeking slices of the picture */
  2659. Uint32 decParseStartTick; /**< Start tick of parsing slices of the picture */
  2660. Uint32 decParseEndTick; /**< End tick of parsing slices of the picture */
  2661. Uint32 decDecodeStartTick; /**< Start tick of decoding slices of the picture */
  2662. Uint32 decDecodeEndTick; /**< End tick of decoding slices of the picture */
  2663. Uint32 seekCycle; /**< The number of cycles for seeking slices of a picture in the internal pipeline. (Theoretically, framecycle = seekCycle + parseCycle + decodedCycle) */
  2664. Uint32 parseCycle; /**< The number of cycles for parsing slices of a picture in the internal pipeline. (Theoretically, framecycle = seekCycle + parseCycle + decodedCycle) */
  2665. Uint32 DecodedCycle; /**< The number of cycles for decoding slices of a picture in the internal pipeline. (Theoretically, framecycle = seekCycle + parseCycle + decodedCycle) */
  2666. /**
  2667. @verbatim
  2668. A CTU size (only for WAVE series)
  2669. @* 16 : CTU16x16
  2670. @* 32 : CTU32x32
  2671. @* 64 : CTU64x64
  2672. @endverbatim
  2673. */
  2674. Int32 ctuSize;
  2675. Int32 outputFlag; /**< This variable reports the value of pic_output_flag syntax in HEVC slice_segment_header. (WAVE5 only) */
  2676. } DecOutputInfo;
  2677. /**
  2678. * @brief This is a data structure of frame buffer information. It is used for parameter when host issues DEC_GET_FRAMEBUF_INFO of <<vpuapi_h_VPU_DecGiveCommand>>.
  2679. */
  2680. typedef struct {
  2681. vpu_buffer_t vbFrame; /**< The information of frame buffer where compressed frame is saved */
  2682. vpu_buffer_t vbWTL; /**< The information of frame buffer where decoded, uncompressed frame is saved with linear format if WTL is on */
  2683. vpu_buffer_t vbFbcYTbl[MAX_REG_FRAME]; /**< The information of frame buffer to save luma offset table of compressed frame */
  2684. vpu_buffer_t vbFbcCTbl[MAX_REG_FRAME]; /**< The information of frame buffer to save chroma offset table of compressed frame */
  2685. vpu_buffer_t vbMvCol[MAX_REG_FRAME]; /**< The information of frame buffer to save co-located motion vector buffer */
  2686. vpu_buffer_t vbTask; /**< The information of task buffer used for command queue */
  2687. FrameBuffer framebufPool[64]; /**< This is an array of <<vpuapi_h_FrameBuffer>> which contains the information of each frame buffer. When WTL is enabled, the number of framebufPool would be [number of compressed frame buffer] x 2, and the starting index of frame buffer for WTL is framebufPool[number of compressed frame buffer]. */
  2688. } DecGetFramebufInfo;
  2689. /**
  2690. * @brief This is a data structure of queue command information. It is used for parameter when host issues DEC_GET_QUEUE_STATUS of <<vpuapi_h_VPU_DecGiveCommand>>. (WAVE5 only)
  2691. */
  2692. typedef struct {
  2693. Uint32 instanceQueueCount; /**< This variable indicates the number of queued commands of the instance. */
  2694. Uint32 reportQueueCount; /**< This variable indicates the number of report queued commands of all instances. */
  2695. } QueueStatusInfo;
  2696. //------------------------------------------------------------------------------
  2697. // encode struct and definition
  2698. //------------------------------------------------------------------------------
  2699. #define MAX_NUM_TEMPORAL_LAYER 7
  2700. #define MAX_GOP_NUM 8
  2701. /**
  2702. * @brief
  2703. @verbatim
  2704. This is a dedicated type for encoder handle returned when an encoder instance is
  2705. opened. An encoder instance can be referred to by the corresponding handle. CodecInst
  2706. is a type managed internally by API. Application does not need to care about it.
  2707. NOTE: This type is vaild for encoder only.
  2708. @endverbatim
  2709. */
  2710. typedef struct CodecInst EncInst;
  2711. /**
  2712. * @brief
  2713. @verbatim
  2714. This is a dedicated type for encoder handle returned when an encoder instance is
  2715. opened. An encoder instance can be referred by the corresponding handle. EncInst
  2716. is a type managed internally by API. Application does not need to care about it.
  2717. NOTE: This type is vaild for encoder only.
  2718. @endverbatim
  2719. */
  2720. typedef EncInst * EncHandle;
  2721. /**
  2722. * @brief This is a data structure for configuring MPEG4-specific parameters in encoder applications. (CODA9 encoder only)
  2723. */
  2724. typedef struct {
  2725. int mp4DataPartitionEnable; /**< It encodes with MPEG4 data_partitioned coding tool. */
  2726. int mp4ReversibleVlcEnable; /**< It encodes with MPEG4 reversible_vlc coding tool. */
  2727. int mp4IntraDcVlcThr; /**< It encodes with MPEG4 intra_dc_vlc_thr coding tool. The valid range is 0 - 7. */
  2728. int mp4HecEnable; /**< It encodes with MPEG4 HEC (Header Extension Code) coding tool. */
  2729. int mp4Verid; /**< It encodes with value of MPEG4 part 2 standard version ID. Version 1 and version 2 are allowed. */
  2730. } EncMp4Param;
  2731. /**
  2732. * @brief This is a data structure for configuring H.263-specific parameters in encoder applications. (CODA9 encoder only)
  2733. */
  2734. typedef struct {
  2735. int h263AnnexIEnable; /**< It encodes with H.263 Annex I - Advanced INTRA Coding mode. */
  2736. int h263AnnexJEnable; /**< It encodes with H.263 Annex J - Deblocking Filter mode. */
  2737. int h263AnnexKEnable; /**< It encodes with H.263 Annex K - Slice Structured mode. */
  2738. int h263AnnexTEnable; /**< It encodes with H.263 Annex T - Modified Quantization mode. */
  2739. } EncH263Param;
  2740. /**
  2741. * @brief This is a data structure for custom GOP parameters of the given picture. (WAVE encoder only)
  2742. */
  2743. typedef struct {
  2744. int picType; /**< A picture type of Nth picture in the custom GOP */
  2745. int pocOffset; /**< A POC of Nth picture in the custom GOP */
  2746. int picQp; /**< A quantization parameter of Nth picture in the custom GOP */
  2747. int numRefPicL0; /**< The number of reference L0 of Nth picture in the custom GOP */
  2748. int refPocL0; /**< A POC of reference L0 of Nth picture in the custom GOP */
  2749. int refPocL1; /**< A POC of reference L1 of Nth picture in the custom GOP */
  2750. int temporalId; /**< A temporal ID of Nth picture in the custom GOP */
  2751. } CustomGopPicParam;
  2752. /**
  2753. * @brief This is a data structure for custom GOP parameters. (WAVE encoder only)
  2754. */
  2755. typedef struct {
  2756. int customGopSize; /**< The size of custom GOP (0~8) */
  2757. CustomGopPicParam picParam[MAX_GOP_NUM]; /**< Picture parameters of Nth picture in custom GOP */
  2758. } CustomGopParam;
  2759. /**
  2760. * @brief This is a data structure for setting custom map options in H.265/HEVC encoder. (WAVE5 encoder only).
  2761. */
  2762. typedef struct {
  2763. int roiAvgQp; /**< It sets an average QP of ROI map. */
  2764. int customRoiMapEnable; /**< It enables ROI map. */
  2765. int customLambdaMapEnable; /**< It enables custom lambda map. */
  2766. int customModeMapEnable; /**< It enables to force CTU to be encoded with intra or to be skipped. */
  2767. int customCoefDropEnable; /**< It enables to force all coefficients to be zero after TQ or not for each CTU (to be dropped).*/
  2768. /**
  2769. @verbatim
  2770. It indicates the start buffer address of custom map.
  2771. Each custom CTU map takes 8 bytes and holds mode, coefficient drop flag, QPs, and lambdas like the below illustration.
  2772. image::../figure/wave520_ctumap.svg["Format of custom Map", width=300]
  2773. @endverbatim
  2774. */
  2775. PhysicalAddress addrCustomMap;
  2776. } WaveCustomMapOpt;
  2777. /**
  2778. * @brief This is a data structure for setting VUI parameters in H.265/HEVC encoder. (WAVE only)
  2779. */
  2780. typedef struct {
  2781. Uint32 vuiParamFlags; /**< It specifies vui_parameters_present_flag. */
  2782. Uint32 vuiAspectRatioIdc; /**< It specifies aspect_ratio_idc. */
  2783. Uint32 vuiSarSize; /**< It specifies sar_width and sar_height (only valid when aspect_ratio_idc is equal to 255). */
  2784. Uint32 vuiOverScanAppropriate; /**< It specifies overscan_appropriate_flag. */
  2785. Uint32 videoSignal; /**< It specifies video_signal_type_present_flag. */
  2786. Uint32 vuiChromaSampleLoc; /**< It specifies chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field. */
  2787. Uint32 vuiDispWinLeftRight; /**< It specifies def_disp_win_left_offset and def_disp_win_right_offset. */
  2788. Uint32 vuiDispWinTopBottom; /**< It specifies def_disp_win_top_offset and def_disp_win_bottom_offset. */
  2789. } HevcVuiParam;
  2790. /**
  2791. * @brief This is a data structure of HEVC/AVC encoder parameters for WAVE5.
  2792. */
  2793. typedef struct {
  2794. /**
  2795. @verbatim
  2796. A profile indicator (HEVC only)
  2797. @* 0 : The firmware determines a profile according to internalbitdepth.
  2798. @* 1 : Main profile
  2799. @* 2 : Main10 profile
  2800. @* 3 : Main still picture profile
  2801. NOTE: In AVC encoder, a profile cannot be set by host application. The firmware decides it based on internalbitdepth. It is HIGH profile for bitdepth of 8 and HIGH10 profile for bitdepth of 10.
  2802. @endverbatim
  2803. */
  2804. int profile;
  2805. int enStillPicture; /**< Still picture profile */
  2806. int level; /**< A level indicator (level * 10) */
  2807. /**
  2808. @verbatim
  2809. A tier indicator
  2810. @* 0 : Main tier
  2811. @* 1 : High tier
  2812. @endverbatim
  2813. */
  2814. int tier;
  2815. /**
  2816. @verbatim
  2817. An internal bit-depth which is used for actual encoding
  2818. For example, if you set internalBitDepth as 8 for 10bit source picture,
  2819. VPU encodes the 10bit source picture into 8bit picture stream.
  2820. If nothing is given to internalBitDepth, VPU encodes source YUV based on srcBitDepth.
  2821. @endverbatim
  2822. */
  2823. int internalBitDepth;
  2824. int losslessEnable; /**< It enables lossless coding. */
  2825. int constIntraPredFlag; /**< It enables constrained intra prediction. */
  2826. /**
  2827. @verbatim
  2828. A GOP structure preset option
  2829. @* 0 : custom GOP
  2830. @* Other values : <<vpuapi_h_GOP_PRESET_IDX>>
  2831. @endverbatim
  2832. */
  2833. int gopPresetIdx;
  2834. /**
  2835. @verbatim
  2836. The type of I picture to be inserted at every intraPeriod
  2837. @* 0 : Non-IRAP
  2838. @* 1 : CRA
  2839. @* 2 : IDR
  2840. @endverbatim
  2841. */
  2842. int decodingRefreshType;
  2843. int intraQP; /**< A quantization parameter of intra picture */
  2844. int intraPeriod; /**< A period of intra picture in GOP size */
  2845. /**
  2846. @verbatim
  2847. t enables every IDR frame to include VPS/SPS/PPS
  2848. @* 0 : No froced Header(VPS/SPS/PPS)
  2849. @* 1 : Forced Header before IDR frame
  2850. @* 2 : Forced Header before key frame
  2851. @endverbatim
  2852. */
  2853. int forcedIdrHeaderEnable;
  2854. int confWinTop; /**< A top offset of conformance window */
  2855. int confWinBot; /**< A bottom offset of conformance window */
  2856. int confWinLeft; /**< A left offset of conformance window */
  2857. int confWinRight; /**< A right offset of conformance window */
  2858. /**
  2859. @verbatim
  2860. A slice mode for independent slice
  2861. @* 0 : no multi-slice
  2862. @* 1 : slice in CTU number
  2863. @endverbatim
  2864. */
  2865. int independSliceMode;
  2866. int independSliceModeArg; /**< The number of CTU for a slice when independSliceMode is set with 1 */
  2867. /**
  2868. @verbatim
  2869. A slice mode for dependent slice
  2870. @* 0 : no multi-slice
  2871. @* 1 : slice in CTU number
  2872. @* 2 : slice in number of byte
  2873. @endverbatim
  2874. */
  2875. int dependSliceMode;
  2876. int dependSliceModeArg; /**< The number of CTU or bytes for a slice when dependSliceMode is set with 1 or 2 */
  2877. /**
  2878. @verbatim
  2879. An intra refresh mode
  2880. @* 0 : no intra refresh
  2881. @* 1 : row
  2882. @* 2 : column
  2883. @* 3 : step size in CTU
  2884. @* 4 : adaptive intra refresh
  2885. @endverbatim
  2886. */
  2887. int intraRefreshMode;
  2888. /**
  2889. @verbatim
  2890. It Specifies an intra CTU refresh interval. Depending on intraRefreshMode,
  2891. it can mean one of the followings.
  2892. @* The number of consecutive CTU rows for IntraCtuRefreshMode of 1
  2893. @* The number of consecutive CTU columns for IntraCtuRefreshMode of 2
  2894. @* A step size in CTU for IntraCtuRefreshMode of 3
  2895. @* The number of Intra CTUs to be encoded in a picture for IntraCtuRefreshMode of 4
  2896. @endverbatim
  2897. */
  2898. int intraRefreshArg;
  2899. /**
  2900. @verbatim
  2901. It uses one of the recommended encoder parameter presets.
  2902. @* 0 : custom setting
  2903. @* 1 : recommended encoder parameters (slow encoding speed, highest picture quality)
  2904. @* 2 : boost mode (normal encoding speed, moderate picture quality)
  2905. @* 3 : fast mode (fast encoding speed, low picture quality)
  2906. @endverbatim
  2907. */
  2908. int useRecommendEncParam;
  2909. int scalingListEnable; /**< It enables a scaling list. */
  2910. /**
  2911. @verbatim
  2912. It enables CU(Coding Unit) size to be used in encoding process. Host application can also select multiple CU sizes.
  2913. @* 3'b001 : 8x8
  2914. @* 3'b010 : 16x16
  2915. @* 3'b100 : 32x32
  2916. @endverbatim
  2917. */
  2918. int cuSizeMode;
  2919. int tmvpEnable; /**< It enables temporal motion vector prediction. */
  2920. int wppEnable; /**< It enables WPP (Wave-front Parallel Processing). WPP is unsupported in ring buffer mode of bitstream buffer. */
  2921. int maxNumMerge; /**< It specifies the number of merge candidates in RDO (1 or 2). 2 of maxNumMerge (default) offers better quality of encoded picture, while 1 of maxNumMerge improves encoding performance. */
  2922. int disableDeblk; /**< It disables in-loop deblocking filtering. */
  2923. int lfCrossSliceBoundaryEnable; /**< It enables filtering across slice boundaries for in-loop deblocking. */
  2924. int betaOffsetDiv2; /**< It sets BetaOffsetDiv2 for deblocking filter. */
  2925. int tcOffsetDiv2; /**< It sets TcOffsetDiv3 for deblocking filter. */
  2926. int skipIntraTrans; /**< It enables the transform stage to be skipped for an intra CU. This value is set to transform_skip_enabled_flag in PPS. */
  2927. int saoEnable; /**< It enables SAO (Sample Adaptive Offset). */
  2928. int intraNxNEnable; /**< It enables intra NxN PUs. */
  2929. /**
  2930. @verbatim
  2931. It specifies picture bits allocation mode.
  2932. It is only valid when RateControl is enabled and GOP size is larger than 1.
  2933. @* 0 : More referenced pictures have more bits than less referenced pictures do.
  2934. @* 1 : All pictures in GOP have similar amount of bits.
  2935. @* 2 : Each picture in GOP is allocated a portion (fixedBitRatio) of total bit budget.
  2936. @endverbatim
  2937. */
  2938. int bitAllocMode;
  2939. /**
  2940. @verbatim
  2941. A fixed bit ratio (1 ~ 255) for each picture of GOP's bit
  2942. allocation
  2943. @* N = 0 ~ (MAX_GOP_SIZE - 1)
  2944. @* MAX_GOP_SIZE = 8
  2945. For instance when MAX_GOP_SIZE is 3, FixedBitRatio0, FixedBitRatio1, and FixedBitRatio2 can be set as 2, 1, and 1 repsectively for
  2946. the fixed bit ratio 2:1:1. This is only valid when BitAllocMode is 2.
  2947. @endverbatim
  2948. */
  2949. int fixedBitRatio[MAX_GOP_NUM];
  2950. int cuLevelRCEnable; /**< It enable CU level rate control. */
  2951. int hvsQPEnable; /**< It enable CU QP adjustment for subjective quality enhancement. */
  2952. int hvsQpScale; /**< A QP scaling factor for CU QP adjustment when hvsQpScaleEnable is 1 */
  2953. int hvsMaxDeltaQp; /**< A maximum delta QP for HVS */
  2954. // CUSTOM_GOP
  2955. CustomGopParam gopParam; /**< <<vpuapi_h_CustomGopParam>> */
  2956. int roiEnable; /**< It enables ROI map. NOTE: It is valid when rate control is on. */
  2957. Uint32 numUnitsInTick; /**< It specifies the number of time units of a clock operating at the frequency time_scale Hz. This is used to to calculate frameRate syntax. */
  2958. Uint32 timeScale; /**< It specifies the number of time units that pass in one second. This is used to to calculate frameRate syntax. */
  2959. Uint32 numTicksPocDiffOne; /**< It specifies the number of clock ticks corresponding to a difference of picture order count values equal to 1. This is used to calculate frameRate syntax. */
  2960. int chromaCbQpOffset; /**< The value of chroma(Cb) QP offset */
  2961. int chromaCrQpOffset; /**< The value of chroma(Cr) QP offset */
  2962. int initialRcQp; /**< The value of initial QP by HOST application. This value is meaningless if INITIAL_RC_QP is 63.*/
  2963. Uint32 nrYEnable; /**< It enables noise reduction algorithm to Y component. */
  2964. Uint32 nrCbEnable; /**< It enables noise reduction algorithm to Cb component. */
  2965. Uint32 nrCrEnable; /**< It enables noise reduction algorithm to Cr component. */
  2966. // ENC_NR_WEIGHT
  2967. Uint32 nrIntraWeightY; /**< A weight to Y noise level for intra picture (0 ~ 31). nrIntraWeight/4 is multiplied to the noise level that has been estimated. This weight is put for intra frame to be filtered more strongly or more weakly than just with the estimated noise level. */
  2968. Uint32 nrIntraWeightCb; /**< A weight to Cb noise level for intra picture (0 ~ 31) */
  2969. Uint32 nrIntraWeightCr; /**< A weight to Cr noise level for intra picture (0 ~ 31) */
  2970. Uint32 nrInterWeightY; /**< A weight to Y noise level for inter picture (0 ~ 31). nrInterWeight/4 is multiplied to the noise level that has been estimated. This weight is put for inter frame to be filtered more strongly or more weakly than just with the estimated noise level. */
  2971. Uint32 nrInterWeightCb; /**< A weight to Cb noise level for inter picture (0 ~ 31) */
  2972. Uint32 nrInterWeightCr; /**< A weight to Cr noise level for inter picture (0 ~ 31) */
  2973. Uint32 nrNoiseEstEnable; /**< It enables noise estimation for noise reduction. When this is disabled, host carries out noise estimation with nrNoiseSigmaY/Cb/Cr. */
  2974. Uint32 nrNoiseSigmaY; /**< It specifies Y noise standard deviation when nrNoiseEstEnable is 0. */
  2975. Uint32 nrNoiseSigmaCb; /**< It specifies Cb noise standard deviation when nrNoiseEstEnable is 0. */
  2976. Uint32 nrNoiseSigmaCr; /**< It specifies Cr noise standard deviation when nrNoiseEstEnable is 0. */
  2977. Uint32 useLongTerm; /**< It enables long-term reference function. */
  2978. // newly added for WAVE Encoder
  2979. Uint32 monochromeEnable; /**< It enables monochrom encoding mode. */
  2980. Uint32 strongIntraSmoothEnable; /**< It enables strong intra smoothing. */
  2981. Uint32 weightPredEnable; /**< It enables to use weighted prediction.*/
  2982. Uint32 bgDetectEnable; /**< It enables background detection. */
  2983. Uint32 bgThrDiff; /**< It specifies the threshold of max difference that is used in s2me block. It is valid when background detection is on. */
  2984. Uint32 bgThrMeanDiff; /**< It specifies the threshold of mean difference that is used in s2me block. It is valid when background detection is on. */
  2985. Uint32 bgLambdaQp; /**< It specifies the minimum lambda QP value to be used in the background area. */
  2986. int bgDeltaQp; /**< It specifies the difference between the lambda QP value of background and the lambda QP value of foreground. */
  2987. Uint32 customLambdaEnable; /**< It enables custom lambda table. */
  2988. Uint32 customMDEnable; /**< It enables custom mode decision. */
  2989. int pu04DeltaRate; /**< A value which is added to the total cost of 4x4 blocks */
  2990. int pu08DeltaRate; /**< A value which is added to the total cost of 8x8 blocks */
  2991. int pu16DeltaRate; /**< A value which is added to the total cost of 16x16 blocks */
  2992. int pu32DeltaRate; /**< A value which is added to the total cost of 32x32 blocks */
  2993. int pu04IntraPlanarDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 4x4 Planar intra prediction mode. */
  2994. int pu04IntraDcDeltaRate; /**< A value which is added to rate when calculating cost (=distortion + rate) in 4x4 DC intra prediction mode. */
  2995. int pu04IntraAngleDeltaRate; /**< A value which is added to rate when calculating cost (=distortion + rate) in 4x4 Angular intra prediction mode. */
  2996. int pu08IntraPlanarDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 8x8 Planar intra prediction mode.*/
  2997. int pu08IntraDcDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 8x8 DC intra prediction mode.*/
  2998. int pu08IntraAngleDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 8x8 Angular intra prediction mode. */
  2999. int pu16IntraPlanarDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 16x16 Planar intra prediction mode. */
  3000. int pu16IntraDcDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 16x16 DC intra prediction mode */
  3001. int pu16IntraAngleDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 16x16 Angular intra prediction mode */
  3002. int pu32IntraPlanarDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 32x32 Planar intra prediction mode */
  3003. int pu32IntraDcDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 32x32 DC intra prediction mode */
  3004. int pu32IntraAngleDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 32x32 Angular intra prediction mode */
  3005. int cu08IntraDeltaRate; /**< A value which is added to rate when calculating cost for intra CU8x8 */
  3006. int cu08InterDeltaRate; /**< A value which is added to rate when calculating cost for inter CU8x8 */
  3007. int cu08MergeDeltaRate; /**< A value which is added to rate when calculating cost for merge CU8x8 */
  3008. int cu16IntraDeltaRate; /**< A value which is added to rate when calculating cost for intra CU16x16 */
  3009. int cu16InterDeltaRate; /**< A value which is added to rate when calculating cost for inter CU16x16 */
  3010. int cu16MergeDeltaRate; /**< A value which is added to rate when calculating cost for merge CU16x16 */
  3011. int cu32IntraDeltaRate; /**< A value which is added to rate when calculating cost for intra CU32x32 */
  3012. int cu32InterDeltaRate; /**< A value which is added to rate when calculating cost for inter CU32x32 */
  3013. int cu32MergeDeltaRate; /**< A value which is added to rate when calculating cost for merge CU32x32 */
  3014. int coefClearDisable; /**< It disables the transform coefficient clearing algorithm for P or B picture. If this is 1, all-zero coefficient block is not evaluated in RDO. */
  3015. int minQpI; /**< A minimum QP of I picture for rate control */
  3016. int maxQpI; /**< A maximum QP of I picture for rate control */
  3017. int minQpP; /**< A minimum QP of P picture for rate control */
  3018. int maxQpP; /**< A maximum QP of P picture for rate control */
  3019. int minQpB; /**< A minimum QP of B picture for rate control */
  3020. int maxQpB; /**< A maximum QP of B picture for rate control */
  3021. PhysicalAddress customLambdaAddr; /**< It specifies the address of custom lambda map. */
  3022. PhysicalAddress userScalingListAddr; /**< It specifies the address of user scaling list file. */
  3023. // SVAC encoder only
  3024. int svcEnable; /**< It enables to encode with SVC spatial (picture size) scalability. (SVAC encoder only) */
  3025. int svcMode; /**< It specifies an SVC mode. (SVAC encoder only) */
  3026. int lumaDcQpOffset; /**< A delta quantization parameter for luma DC coefficients (SVAC encoder only) */
  3027. int chromaDcQpOffset; /**< A delta quantization parameter for chroma DC coefficients (SVAC encoder only) */
  3028. int chromaAcQpOffset; /**< A delta quantization parameter for chroma AC coefficients (SVAC encoder only) */
  3029. // for H.264 on WAVE
  3030. int avcIdrPeriod; /**< A period of IDR picture (0 ~ 1024). 0 - implies an infinite period */
  3031. int rdoSkip; /**< It skips RDO(rate distortion optimization). */
  3032. int lambdaScalingEnable; /**< It enables lambda scaling using custom GOP. */
  3033. int transform8x8Enable; /**< It enables 8x8 intra prediction and 8x8 transform. */
  3034. /**
  3035. @verbatim
  3036. A slice mode for independent slice
  3037. @* 0 : no multi-slice
  3038. @* 1 : slice in MB number
  3039. @endverbatim
  3040. */
  3041. int avcSliceMode;
  3042. int avcSliceArg; /**< The number of MB for a slice when avcSliceMode is set with 1 */
  3043. /**
  3044. @verbatim
  3045. An intra refresh mode
  3046. @* 0 : no intra refresh
  3047. @* 1 : row
  3048. @* 2 : column
  3049. @* 3 : step size in CTU
  3050. @endverbatim
  3051. */
  3052. int intraMbRefreshMode;
  3053. /**
  3054. @verbatim
  3055. It Specifies an intra MB refresh interval. Depending on intraMbRefreshMode,
  3056. it can mean one of the followings.
  3057. @* The number of consecutive MB rows for intraMbRefreshMode of 1
  3058. @* The number of consecutive MB columns for intraMbRefreshMode of 2
  3059. @* A step size in MB for intraMbRefreshMode of 3
  3060. @endverbatim
  3061. */
  3062. int intraMbRefreshArg;
  3063. int mbLevelRcEnable; /**< It enables MB-level rate control. */
  3064. /**
  3065. @verbatim
  3066. It selects the entropy coding mode used in encoding process.
  3067. 0 : CAVLC
  3068. 1 : CABAC
  3069. @endverbatim
  3070. */
  3071. int entropyCodingMode;
  3072. int s2fmeDisable; /**< It disables s2me_fme (only for AVC encoder). */
  3073. Uint32 rcWeightParam; /**< Adjusts the speed of updating parameters to the rate control model. If RcWeightFactor is set with a large value, the RC parameters are updated slowly. (Min: 1, Max: 31)*/
  3074. Uint32 rcWeightBuf; /**< It is the smoothing factor in the estimation. (Min: 1, Max: 255) This parameter indicates the speed of adjusting bitrate toward fullness of buffer as a reaction parameter. As it becomess larger, the bit-rate error promptly affects the target bit allocation of the following picture. */
  3075. HevcVuiParam vuiParam; /**< <<vpuapi_h_HevcVuiParam>> */
  3076. #ifdef SUPPORT_LOOK_AHEAD_RC
  3077. int larcEnable;
  3078. int larcPass;
  3079. int larcSize;
  3080. int larcWeight;
  3081. #endif
  3082. }EncWaveParam;
  3083. /**
  3084. * @brief This is an enumeration for encoder parameter change. (WAVE5 encoder only)
  3085. */
  3086. typedef enum {
  3087. // COMMON parameters which can be changed frame by frame.
  3088. ENC_SET_CHANGE_PARAM_PPS = (1<<0),
  3089. ENC_SET_CHANGE_PARAM_INTRA_PARAM = (1<<1),
  3090. ENC_SET_CHANGE_PARAM_RC_TARGET_RATE = (1<<8),
  3091. ENC_SET_CHANGE_PARAM_RC = (1<<9),
  3092. ENC_SET_CHANGE_PARAM_RC_MIN_MAX_QP = (1<<10),
  3093. ENC_SET_CHANGE_PARAM_RC_BIT_RATIO_LAYER = (1<<11),
  3094. ENC_SET_CHANGE_PARAM_RC_INTER_MIN_MAX_QP = (1<<12),
  3095. ENC_SET_CHANGE_PARAM_RC_WEIGHT = (1<<13),
  3096. ENC_SET_CHANGE_PARAM_INDEPEND_SLICE = (1<<16),
  3097. ENC_SET_CHANGE_PARAM_DEPEND_SLICE = (1<<17),
  3098. ENC_SET_CHANGE_PARAM_RDO = (1<<18),
  3099. ENC_SET_CHANGE_PARAM_NR = (1<<19),
  3100. ENC_SET_CHANGE_PARAM_BG = (1<<20),
  3101. ENC_SET_CHANGE_PARAM_CUSTOM_MD = (1<<21),
  3102. ENC_SET_CHANGE_PARAM_CUSTOM_LAMBDA = (1<<22),
  3103. ENC_SET_CHANGE_PARAM_VUI_HRD_PARAM = (1<<23),
  3104. } Wave5ChangeParam;
  3105. /**
  3106. * @brief This is a data structure for encoding parameters that have changed.
  3107. */
  3108. typedef struct {
  3109. int enable_option; /**< A flag to decide which parameter will change, <<vpuapi_h_Wave5ChangeParam>> */
  3110. // ENC_SET_CHANGE_PARAM_PPS (lossless, WPP can't be changed while encoding)
  3111. int constIntraPredFlag; /**< It enables constrained intra prediction. */
  3112. int lfCrossSliceBoundaryEnable; /**< It enables filtering across slice boundaries for in-loop deblocking. */
  3113. int weightPredEnable; /**< It enables to use weighted prediction.*/
  3114. int disableDeblk; /**< It disables in-loop deblocking filtering. */
  3115. int betaOffsetDiv2; /**< It sets BetaOffsetDiv2 for deblocking filter. */
  3116. int tcOffsetDiv2; /**< It sets TcOffsetDiv3 for deblocking filter. */
  3117. int chromaCbQpOffset; /**< The value of chroma(Cb) QP offset */
  3118. int chromaCrQpOffset; /**< The value of chroma(Cr) QP offset */
  3119. int lumaDcQpOffset; /**< The value of DC QP offset for Y component (for SVAC encoder) */
  3120. int chromaDcQpOffset; /**< The value of DC QP offset for Cb/Cr component (for SVAC encoder) */
  3121. int chromaAcQpOffset; /**< The value of AC QP offset for Cb/Cr component (for SVAC encoder) */
  3122. int transform8x8Enable; /**< (for H.264 encoder) */
  3123. int entropyCodingMode; /**< (for H.264 encoder) */
  3124. // ENC_SET_CHANGE_PARAM_INDEPEND_SLICE
  3125. /**
  3126. @verbatim
  3127. A slice mode for independent slice
  3128. @* 0 : no multi-slice
  3129. @* 1 : slice in CTU number
  3130. @endverbatim
  3131. */
  3132. int independSliceMode;
  3133. int independSliceModeArg; /**< The number of CTU for a slice when independSliceMode is set with 1 */
  3134. // ENC_SET_CHANGE_PARAM_DEPEND_SLICE
  3135. /**
  3136. @verbatim
  3137. A slice mode for dependent slice
  3138. @* 0 : no multi-slice
  3139. @* 1 : slice in CTU number
  3140. @* 2 : slice in number of byte
  3141. @endverbatim
  3142. */
  3143. int dependSliceMode;
  3144. int dependSliceModeArg; /**< The number of CTU or bytes for a slice when dependSliceMode is set with 1 or 2 */
  3145. /**
  3146. @verbatim
  3147. A slice mode for independent slice
  3148. @* 0 : no multi-slice
  3149. @* 1 : slice in MB number
  3150. @endverbatim
  3151. */
  3152. int avcSliceArg;
  3153. int avcSliceMode; /**< The number of MB for a slice when avcSliceMode is set with 1 */
  3154. // ENC_SET_CHANGE_PARAM_RDO (cuSizeMode, MonoChrom, and RecommendEncParam
  3155. // can't be changed while encoding)
  3156. int coefClearDisable; /**< It disables the transform coefficient clearing algorithm for P or B picture. If this is 1, all-zero coefficient block is not evaluated in RDO. */
  3157. int intraNxNEnable; /**< It enables intra NxN PUs. */
  3158. int maxNumMerge; /**< It specifies the number of merge candidates in RDO (1 or 2). 2 of maxNumMerge (default) offers better quality of encoded picture, while 1 of maxNumMerge improves encoding performance. */
  3159. int customLambdaEnable; /**< It enables custom lambda table. */
  3160. int customMDEnable; /**< It enables custom mode decision. */
  3161. int rdoSkip; /**< It skips RDO(rate distortion optimization) in H.264 encoder. */
  3162. int lambdaScalingEnable; /**< It enables to use custom lambda scaling list. */
  3163. // ENC_SET_CHANGE_PARAM_RC_TARGET_RATE
  3164. int bitRate; /**< A target bitrate when separateBitrateEnable is 0 */
  3165. // ENC_SET_CHANGE_PARAM_RC
  3166. // (rcEnable, cuLevelRc, bitAllocMode, RoiEnable, RcInitQp can't be changed while encoding)
  3167. int hvsQPEnable; /**< It enables CU QP adjustment for subjective quality enhancement. */
  3168. int hvsQpScale; /**< QP scaling factor for CU QP adjustment when hvcQpenable is 1. */
  3169. int vbvBufferSize; /**< It specifies the size of the VBV buffer in msec (10 ~ 3000). For example, 3000 should be set for 3 seconds. This value is valid when rcEnable is 1. VBV buffer size in bits is EncBitrate * VbvBufferSize / 1000. */
  3170. int mbLevelRcEnable; /**< It enables MB level rate control. (for H.264 encoder) */
  3171. // ENC_SET_CHANGE_PARAM_RC_MIN_MAX_QP
  3172. int minQpI; /**< A minimum QP of I picture for rate control */
  3173. int maxQpI; /**< A maximum QP of I picture for rate control */
  3174. int hvsMaxDeltaQp; /**< A maximum delta QP for HVS */
  3175. // ENC_SET_CHANGE_PARAM_RC_INTER_MIN_MAX_QP
  3176. int minQpP; /**< A minimum QP of P picture for rate control */
  3177. int minQpB; /**< A minimum QP of B picture for rate control */
  3178. int maxQpP; /**< A maximum QP of P picture for rate control */
  3179. int maxQpB; /**< A maximum QP of B picture for rate control */
  3180. // ENC_SET_CHANGE_PARAM_RC_BIT_RATIO_LAYER
  3181. /**
  3182. @verbatim
  3183. A fixed bit ratio (1 ~ 255) for each picture of GOP's bit
  3184. allocation
  3185. @* N = 0 ~ (MAX_GOP_SIZE - 1)
  3186. @* MAX_GOP_SIZE = 8
  3187. For instance when MAX_GOP_SIZE is 3, FixedBitRatio0, FixedBitRatio1, and FixedBitRatio2 can be set as 2, 1, and 1 repsectively for
  3188. the fixed bit ratio 2:1:1. This is only valid when BitAllocMode is 2.
  3189. @endverbatim
  3190. */
  3191. int fixedBitRatio[MAX_GOP_NUM];
  3192. // ENC_SET_CHANGE_PARAM_BG (bgDetectEnable can't be changed while encoding)
  3193. int s2fmeDisable; /**< It disables s2me_fme (only for AVC encoder). */
  3194. Uint32 bgThrDiff; /**< It specifies the threshold of max difference that is used in s2me block. It is valid when background detection is on. */
  3195. Uint32 bgThrMeanDiff; /**< It specifies the threshold of mean difference that is used in s2me block. It is valid when background detection is on. */
  3196. Uint32 bgLambdaQp; /**< It specifies the minimum lambda QP value to be used in the background area. */
  3197. int bgDeltaQp; /**< It specifies the difference between the lambda QP value of background and the lambda QP value of foreground. */
  3198. // ENC_SET_CHANGE_PARAM_NR
  3199. Uint32 nrYEnable; /**< It enables noise reduction algorithm to Y component. */
  3200. Uint32 nrCbEnable; /**< It enables noise reduction algorithm to Cb component. */
  3201. Uint32 nrCrEnable; /**< It enables noise reduction algorithm to Cr component. */
  3202. Uint32 nrNoiseEstEnable; /**< It enables noise estimation for noise reduction. When this is disabled, host carries out noise estimation with nrNoiseSigmaY/Cb/Cr. */
  3203. Uint32 nrNoiseSigmaY; /**< It specifies Y noise standard deviation when nrNoiseEstEnable is 0. */
  3204. Uint32 nrNoiseSigmaCb; /**< It specifies Cb noise standard deviation when nrNoiseEstEnable is 0. */
  3205. Uint32 nrNoiseSigmaCr; /**< It specifies Cr noise standard deviation when nrNoiseEstEnable is 0. */
  3206. Uint32 nrIntraWeightY; /**< A weight to Y noise level for intra picture (0 ~ 31). nrIntraWeight/4 is multiplied to the noise level that has been estimated. This weight is put for intra frame to be filtered more strongly or more weakly than just with the estimated noise level. */
  3207. Uint32 nrIntraWeightCb; /**< A weight to Cb noise level for intra picture (0 ~ 31) */
  3208. Uint32 nrIntraWeightCr; /**< A weight to Cr noise level for intra picture (0 ~ 31) */
  3209. Uint32 nrInterWeightY; /**< A weight to Y noise level for inter picture (0 ~ 31). nrInterWeight/4 is multiplied to the noise level that has been estimated. This weight is put for inter frame to be filtered more strongly or more weakly than just with the estimated noise level. */
  3210. Uint32 nrInterWeightCb; /**< A weight to Cb noise level for inter picture (0 ~ 31) */
  3211. Uint32 nrInterWeightCr; /**< A weight to Cr noise level for inter picture (0 ~ 31) */
  3212. // ENC_SET_CHANGE_PARAM_CUSTOM_MD
  3213. int pu04DeltaRate; /**< A value which is added to the total cost of 4x4 blocks */
  3214. int pu08DeltaRate; /**< A value which is added to the total cost of 8x8 blocks */
  3215. int pu16DeltaRate; /**< A value which is added to the total cost of 16x16 blocks */
  3216. int pu32DeltaRate; /**< A value which is added to the total cost of 32x32 blocks */
  3217. int pu04IntraPlanarDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 4x4 Planar intra prediction mode. */
  3218. int pu04IntraDcDeltaRate; /**< A value which is added to rate when calculating cost (=distortion + rate) in 4x4 DC intra prediction mode. */
  3219. int pu04IntraAngleDeltaRate; /**< A value which is added to rate when calculating cost (=distortion + rate) in 4x4 Angular intra prediction mode. */
  3220. int pu08IntraPlanarDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 8x8 Planar intra prediction mode.*/
  3221. int pu08IntraDcDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 8x8 DC intra prediction mode.*/
  3222. int pu08IntraAngleDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 8x8 Angular intra prediction mode. */
  3223. int pu16IntraPlanarDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 16x16 Planar intra prediction mode. */
  3224. int pu16IntraDcDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 16x16 DC intra prediction mode */
  3225. int pu16IntraAngleDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 16x16 Angular intra prediction mode */
  3226. int pu32IntraPlanarDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 32x32 Planar intra prediction mode */
  3227. int pu32IntraDcDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 32x32 DC intra prediction mode */
  3228. int pu32IntraAngleDeltaRate; /**< A value which is added to rate when calculating cost(=distortion + rate) in 32x32 Angular intra prediction mode */
  3229. int cu08IntraDeltaRate; /**< A value which is added to rate when calculating cost for intra CU8x8 */
  3230. int cu08InterDeltaRate; /**< A value which is added to rate when calculating cost for inter CU8x8 */
  3231. int cu08MergeDeltaRate; /**< A value which is added to rate when calculating cost for merge CU8x8 */
  3232. int cu16IntraDeltaRate; /**< A value which is added to rate when calculating cost for intra CU16x16 */
  3233. int cu16InterDeltaRate; /**< A value which is added to rate when calculating cost for intra CU16x16 */
  3234. int cu16MergeDeltaRate; /**< A value which is added to rate when calculating cost for intra CU16x16 */
  3235. int cu32IntraDeltaRate; /**< A value which is added to rate when calculating cost for intra CU32x32 */
  3236. int cu32InterDeltaRate; /**< A value which is added to rate when calculating cost for intra CU32x32 */
  3237. int cu32MergeDeltaRate; /**< A value which is added to rate when calculating cost for intra CU32x32 */
  3238. // ENC_SET_CHANGE_PARAM_CUSTOM_LAMBDA
  3239. PhysicalAddress customLambdaAddr; /**< It specifies the address of custom lambda map. */
  3240. // ENC_SET_CHANGE_PARAM_INTRA_PARAM
  3241. int intraQP; /**< A quantization parameter of intra picture */
  3242. int intraPeriod; /**< A period of intra picture in GOP size */
  3243. int avcIdrPeriod; /**< A period of IDR picture (0 ~ 1024). 0 - implies an infinite period(for H.264 encoder) */
  3244. /**
  3245. @verbatim
  3246. t enables every IDR frame to include VPS/SPS/PPS
  3247. @* 0 : No froced Header(VPS/SPS/PPS)
  3248. @* 1 : Forced Header before IDR frame
  3249. @* 2 : Forced Header before key frame
  3250. @endverbatim
  3251. */
  3252. int forcedIdrHeaderEnable;
  3253. // ENC_SET_CHANGE_PARAM_RC_WEIGHT
  3254. Uint32 rcWeightBuf; /**< It is the smoothing factor in the estimation. (Min: 1, Max: 255) This parameter indicates the speed of adjusting bitrate toward fullness of buffer as a reaction parameter. As it becomess larger, the bit-rate error promptly affects the target bit allocation of the following picture. */
  3255. Uint32 rcWeightParam; /**< Adjusts the speed of updating parameters to the rate control model. If RcWeightFactor is set with a large value, the RC parameters are updated slowly. (Min: 1, Max: 31)*/
  3256. }EncChangeParam;
  3257. /**
  3258. * @brief This is a data structure for configuring PPS information at H.264/AVC.
  3259. */
  3260. typedef struct {
  3261. int ppsId; /**< H.264 picture_parameter_set_id in PPS. This shall be in the range of 0 to 255, inclusive. */
  3262. /**
  3263. @verbatim
  3264. It selects the entropy coding method used in the encoding process.
  3265. @* 0 : CAVLC
  3266. @* 1 : CABAC
  3267. @* 2 : CAVLC/CABAC select according to PicType
  3268. @endverbatim
  3269. */
  3270. int entropyCodingMode;
  3271. int cabacInitIdc; /**< It specifies the index for determining the initialization table used in the initialisation process for CABAC. The value of cabac_init_idc shall be in the range of 0 ~ 2. */
  3272. /**
  3273. @verbatim
  3274. It specifies whether to enable 8x8 intra prediction and 8x8 transform or not.
  3275. @* 0 : disable 8x8 intra and 8x8 transform (BP)
  3276. @* 1 : enable 8x8 intra and 8x8 transform (HP)
  3277. @endverbatim
  3278. */
  3279. int transform8x8Mode;
  3280. } AvcPpsParam;
  3281. /**
  3282. * @brief This is a data structure for configuring H.264/AVC-specific parameters in encoder applications. (CODA9 only)
  3283. */
  3284. typedef struct {
  3285. /**
  3286. @verbatim
  3287. @* 0 : disable
  3288. @* 1 : enable
  3289. @endverbatim
  3290. */
  3291. int constrainedIntraPredFlag;
  3292. /**
  3293. @verbatim
  3294. @* 0 : enable
  3295. @* 1 : disable
  3296. @* 2 : disable deblocking filter at slice boundaries
  3297. @endverbatim
  3298. */
  3299. int disableDeblk;
  3300. int deblkFilterOffsetAlpha; /**< It sets deblk_filter_offset_alpha (-6 to 6). */
  3301. int deblkFilterOffsetBeta; /**< It sets deblk_filter_offset_beta (-6 to 6). */
  3302. int chromaQpOffset; /**< It sets chroma_qp_offset (-12 to 12). */
  3303. /**
  3304. @verbatim
  3305. @* 0 : disable
  3306. @* 1 : enable
  3307. If this is 1, VPU generates AUD RBSP at the start of every picture.
  3308. @endverbatim
  3309. */
  3310. int audEnable;
  3311. /**
  3312. @verbatim
  3313. @* 0 : disable
  3314. @* 1 : enable
  3315. If this is 1, VPU generates frame_cropping_flag syntax in the SPS header.
  3316. @endverbatim
  3317. */
  3318. int frameCroppingFlag;
  3319. int frameCropLeft; /**< The sample number of left cropping region in a picture line. See the frame_crop_left_offset syntax in H.264/AVC SPS tabular form. The least significant bit of this parameter should be always zero. */
  3320. int frameCropRight; /**< The sample number of right cropping region in a picture line. See the frame_crop_right_offset syntax in H.264/AVC SPS tabular form. The least significant bit of this parameter should be always zero. */
  3321. int frameCropTop; /**< The sample number of top cropping region in a picture column. See the frame_crop_top_offset syntax in H.264/AVC SPS tabular form. The least significant bit of this parameter should be always zero. */
  3322. int frameCropBottom; /**< The sample number of bottom cropping region in a picture column. See the frame_crop_bottom_offset syntax in H.264/AVC SPS tabular form. The least significant bit of this parameter should be always zero. */
  3323. int level; /**< H.264/AVC level_idc in SPS */
  3324. /**
  3325. @verbatim
  3326. @* 0 : Baseline profile
  3327. @* 1 : Main profile
  3328. @* 2 : High profile
  3329. @endverbatim
  3330. */
  3331. int profile;
  3332. } EncAvcParam;
  3333. /**
  3334. * @brief This structure is used for declaring an encoder slice mode and its options. It is newly added for more flexible usage of slice mode control in encoder. (CODA9 only)
  3335. */
  3336. typedef struct{
  3337. /**
  3338. @verbatim
  3339. @* 0 : one slice per picture
  3340. @* 1 : multiple slices per picture
  3341. @* 2 : multiple slice encoding mode 2 for H.264 only.
  3342. Slice separation::
  3343. In MPEG4, resync-marker and packet header are inserted between
  3344. slice boundaries. In short video header (H.263) with Annex K of 0, GOB headers are inserted
  3345. at every GOB layer start. In short video header (H.263) with Annex K of 1, multiple
  3346. slices are generated. In AVC, multiple slice layer RBSP is generated.
  3347. @endverbatim
  3348. */
  3349. int sliceMode;
  3350. /**
  3351. @verbatim
  3352. This parameter means the size of generated slice.
  3353. @* 0 : sliceSize is defined by the amount of bits when sliceMode is 1.
  3354. @* 1 : sliceSize is defined by the number of MBs in a slice when sliceMode is 1.
  3355. @* 2 : sliceSize is defined by MBs run-length table (only for H.264) when sliceMode is 2.
  3356. This parameter is ignored when sliceMode of 0 or
  3357. in short video header mode with Annex K of 0.
  3358. @endverbatim
  3359. */
  3360. int sliceSizeMode;
  3361. int sliceSize; /**< The size of a slice in bits or in MB numbers included in a slice, which is specified by the variable, sliceSizeMode. This parameter is ignored when sliceMode is 0 or in short video header mode with Annex K of 0. */
  3362. } EncSliceMode;
  3363. /**
  3364. * @brief This data structure is used when HOST wants to open a new encoder instance.
  3365. */
  3366. typedef struct {
  3367. PhysicalAddress bitstreamBuffer; /**< The start address of bitstream buffer into which encoder puts bitstream. This address must be aligned to AXI bus width. */
  3368. Uint32 bitstreamBufferSize; /**< The size of the buffer in bytes pointed by bitstreamBuffer. This value must be a multiple of 1024. */
  3369. CodStd bitstreamFormat; /**< The standard type of bitstream in encoder operation. It is one of STD_MPEG4, STD_H263, STD_AVC and STD_HEVC. */
  3370. /**
  3371. @verbatim
  3372. @* 0 : line-buffer mode
  3373. @* 1 : ring-buffer mode
  3374. This flag sets the streaming mode for the current encoder instance. There are two
  3375. streaming modes: packet-based streaming with ring-buffer (buffer-reset mode) and
  3376. frame-based streaming with line buffer (buffer-flush mode).
  3377. @endverbatim
  3378. */
  3379. int ringBufferEnable;
  3380. int picWidth; /**< The width of a picture to be encoded in unit of sample. */
  3381. int picHeight; /**< The height of a picture to be encoded in unit of sample. */
  3382. /**
  3383. @verbatim
  3384. It is a linear-to-tiled enable mode. (CODA9 only)
  3385. The source frame can be converted from linear format to tiled format in PrP (Pre-Processing) block.
  3386. @* 0 : disable linear-to-tiled-map conversion
  3387. @* 1 : enable linear-to-tiled-map conversion
  3388. @endverbatim
  3389. */
  3390. int linear2TiledEnable;
  3391. /**
  3392. @verbatim
  3393. It can specify the map type of source frame buffer when linear2TiledEnable is enabled. (CODA980 only)
  3394. @* 1 : source frame buffer is in linear frame map.
  3395. @* 2 : source frame buffer is in linear field map.
  3396. @endverbatim
  3397. */
  3398. int linear2TiledMode;
  3399. /**
  3400. @verbatim
  3401. (CODA9)
  3402. The 16 LSB bits, [15:0], is a numerator and 16 MSB bits, [31:16], is a
  3403. denominator for calculating frame rate. The numerator means clock ticks per
  3404. second, and the denominator is clock ticks between frames minus 1.
  3405. So the frame rate can be defined by (numerator/(denominator + 1)),
  3406. which equals to (frameRateInfo & 0xffff) /((frameRateInfo >> 16) + 1).
  3407. For example, the value 30 of frameRateInfo represents 30 frames/sec, and the
  3408. value 0x3e87530 represents 29.97 frames/sec.
  3409. (WAVE)
  3410. A frame rate indicator for rate control
  3411. For example, the value 30 of frameRateInfo represents 30 frames/sec.
  3412. @endverbatim
  3413. */
  3414. int frameRateInfo;
  3415. /**
  3416. @verbatim
  3417. The horizontal search range for Motion Estimation (CODA980 only)
  3418. @* 0 : horizontal search range (-64 ~ 63)
  3419. @* 1 : horizontal search range (-48 ~ 47)
  3420. @* 2 : horizontal search range (-32 ~ 31)
  3421. @* 3 : horizontal search range (-16 ~ 15)
  3422. @endverbatim
  3423. */
  3424. int MESearchRangeX;
  3425. /**
  3426. @verbatim
  3427. The vertical search range for Motion Estimation (CODA980 only)
  3428. @* 0 : vertical search range (-48 ~ 47)
  3429. @* 1 : vertical search range(-32 ~ 31)
  3430. @* 2 : vertical search range(-16 ~ 15)
  3431. @endverbatim
  3432. */
  3433. int MESearchRangeY;
  3434. /**
  3435. @verbatim
  3436. An enable flag for initial QP offset for I picture in GOP. (CODA980 only)
  3437. @* 0 : disable (default)
  3438. @* 1 : enable
  3439. This value is valid for H.264/AVC encoder and ignored when RcEnable is 0.
  3440. @endverbatim
  3441. */
  3442. int rcGopIQpOffsetEn;
  3443. /**
  3444. @verbatim
  3445. An initial QP offset for I picture in GOP (CODA980 only)
  3446. rcGopIQpOffset (-4 to 4) is added to an I picture QP value.
  3447. This value is valid for H.264/AVC encoder and ignored when RcEnable is 0 or RcGopIQpOffsetEn is 0.
  3448. @endverbatim
  3449. */
  3450. int rcGopIQpOffset;
  3451. /**
  3452. @verbatim
  3453. The search range for Motion Estimation (CODA960 only)
  3454. @* 0 : horizontal(-128 ~ 127) and vertical(-64 ~ 63)
  3455. @* 1 : horizontal(-64 ~ 63) and vertical(-32 ~ 31)
  3456. @* 2 : horizontal(-32 ~ 31) and vertical(-16 ~ 15)
  3457. @* 3 : horizontal(-16 ~ 15) and vertical(-16 ~ 15)
  3458. @endverbatim
  3459. */
  3460. int MESearchRange;
  3461. /**
  3462. @verbatim
  3463. vbv_buffer_size in bits
  3464. This value is ignored if rate control is disabled.
  3465. The value 0 means that encoder does not check reference decoder buffer size constraints.
  3466. @endverbatim
  3467. */
  3468. int vbvBufferSize;
  3469. /**
  3470. @verbatim
  3471. Frame skip indicates that encoder can skip frame encoding automatically when
  3472. bitstream has been generated much so far considering the given target bitrate. (CODA9 only)
  3473. This parameter is ignored if rate control is disabled.
  3474. @* 0 : enable frame skip function.
  3475. @* 1 : disable frame skip function.
  3476. NOTE: This variable is for CODA9. For WAVE, host can use EncParam.skipPicture.
  3477. @endverbatim
  3478. */
  3479. int frameSkipDisable;
  3480. /**
  3481. @verbatim
  3482. This variable defines the interval of I picture. (CODA9 only)
  3483. @* 0 : only first I picture
  3484. @* 1 : all I pictures
  3485. @* 2 : IPIP ...
  3486. @* 3 : IPPIPP ...
  3487. The maximum value is 32767, but in practice, a smaller value should be
  3488. chosen by HOST application for error resilience.
  3489. @endverbatim
  3490. */
  3491. int gopSize;
  3492. /**
  3493. An interval of adding an IDR picture (CODA9 only)
  3494. */
  3495. int idrInterval;
  3496. /**
  3497. @verbatim
  3498. A block mode enable flag for Motion Estimation. (H.264/AVC only).
  3499. HOST can use some combination (bitwise or-ing) of each value under below.
  3500. @* 4'b0000 or 4'b1111 : use all block mode
  3501. @* 4'b0001 : enable 16x16 block mode
  3502. @* 4'b0010 : enable 16x8 block mode
  3503. @* 4'b0100 : enable 8x16 block mode
  3504. @* 4'b1000 : enable 8x8 block mode
  3505. @endverbatim
  3506. */
  3507. int meBlkMode;
  3508. EncSliceMode sliceMode; /**< <<vpuapi_h_EncSliceMode>> */
  3509. /**
  3510. @verbatim
  3511. The number of intra MB to be inserted in picture (CODA9 only)
  3512. @* 0 : intra MB refresh is not used.
  3513. @* Other value : intraRefreshNum of MBs are encoded as intra MBs in every P frame.
  3514. @endverbatim
  3515. */
  3516. int intraRefreshNum;
  3517. /**
  3518. @verbatim
  3519. Consecutive intra MB refresh mode (CODA9 only)
  3520. This option is valid only when IntraMbRefresh-Num[15:0] is not 0.
  3521. @* 0 : Consecutive intra MB refresh mode is disabled. IntraMbRefreshNum of MBs are encoded
  3522. as intra MB at the predefined interval
  3523. size.
  3524. @* 1 : IntraMbRefreshNum of consecutive MBs are encoded as intra MB.
  3525. @endverbatim
  3526. */
  3527. int ConscIntraRefreshEnable;
  3528. /**
  3529. @verbatim
  3530. The maximum quantized step parameter for encoding process
  3531. In MPEG4/H.263 mode, the maximum value is 31.
  3532. In H.264 mode, allowed maximum value is 51.
  3533. NOTE: This variable is only for CODA9. For WAVE, host can use waveParam.maxQpI, maxQpP and maxQpB in EncOpenParam.
  3534. @endverbatim
  3535. */
  3536. int userQpMax;
  3537. //h.264 only
  3538. int maxIntraSize; /**< The maximum bit size for intra frame. (CODA9 H.264/AVC only) */
  3539. int userMaxDeltaQp; /**< The maximum delta QP for encoding process. (CODA9 H.264/AVC only) */
  3540. int userMinDeltaQp; /**< The minimum delta QP for encoding process. (CODA9 H.264/AVC only) */
  3541. int userQpMin; /**< The minimum quantized step parameter for encoding process. (CODA9 H.264/AVC only) */
  3542. /**
  3543. @verbatim
  3544. The PMV option for Motion Estimation. (CODA9 only)
  3545. If this field is 1, encoding quality can be worse than when it is 0.
  3546. @* 0 : Motion Estimation engine uses PMV that was derived from neighbor MV.
  3547. @* 1 : Motion Estimation engine uses Zero PMV.
  3548. @endverbatim
  3549. */
  3550. int MEUseZeroPmv;
  3551. /**
  3552. @verbatim
  3553. Additional weight of intra cost for mode decision to reduce intra MB density (CODA9 only)
  3554. By default, it could be zero.
  3555. If this variable have some value W,
  3556. and the cost of best intra mode that was decided by Refine-Intra-Mode-Decision is ICOST,
  3557. the Final Intra Cost FIC is like the below,
  3558. FIC = ICOST + W
  3559. So, if this field is not zero,
  3560. the Final Intra Cost have additional weight. Then the mode decision logic is likely to decide inter mode rather than intra mode for MBs.
  3561. @endverbatim
  3562. */
  3563. int intraCostWeight;
  3564. /**
  3565. @verbatim
  3566. The quantization parameter for I frame (CODA9 only)
  3567. When this value is -1, the quantization
  3568. parameter for I frame is automatically determined by VPU.
  3569. @endverbatim
  3570. */
  3571. //mp4 only
  3572. int rcIntraQp;
  3573. /**
  3574. @verbatim
  3575. A gamma is a smoothing factor in motion estimation. A value for gamma is
  3576. factor * 32768, the factor value is selected from the range 0 &le; factor &le; 1. (CODA9 only)
  3577. @* If the factor value is close to 0, QP changes slowly.
  3578. @* If the factor value is close to 1, QP changes quickly.
  3579. The default gamma value is 0.75 * 32768
  3580. @endverbatim
  3581. */
  3582. int userGamma;
  3583. /**
  3584. @verbatim
  3585. Encoder rate control mode setting (CODA9 only)
  3586. @* 0 : normal mode rate control - QP changes for every MB
  3587. @* 1 : FRAME_LEVEL rate control - QP changes for every frame
  3588. @* 2 : SLICE_LEVEL rate control - QP changes for every slice
  3589. @* 3 : USER DEFINED MB LEVEL rate control - QP changes for every number of mbInterval
  3590. @endverbatim
  3591. */
  3592. int rcIntervalMode;
  3593. /**
  3594. @verbatim
  3595. The user defined MB interval value (CODA9 only)
  3596. This value is used only when rcIntervalMode is 3.
  3597. @endverbatim
  3598. */
  3599. int mbInterval;
  3600. /**
  3601. @verbatim
  3602. @* CODA9
  3603. @** Target bit rate in kbps. If it is 0, it means that rate control is disabled.
  3604. @* WAVE series
  3605. @** Target bit rate in bps
  3606. @endverbatim
  3607. */
  3608. int bitRate;
  3609. int bitRateBL; /**< The bitrate value of base layer (SVAC encoder only) */
  3610. /**
  3611. @verbatim
  3612. Time delay in mili-seconds (CODA9 only)
  3613. It is the amount of time in ms taken for bitstream to reach initial occupancy of the vbv buffer from zero level.
  3614. This value is ignored if rate
  3615. control is disabled. The value 0 means VPU does not check for reference
  3616. decoder buffer delay constraints.
  3617. @endverbatim
  3618. */
  3619. int rcInitDelay;
  3620. /**
  3621. @verbatim
  3622. @* WAVE series
  3623. @** 0 : rate control is off.
  3624. @** 1 : rate control is on.
  3625. @* CODA9
  3626. @** 0 : constant QP (VBR, rate control off)
  3627. @** 1 : constant bitrate (CBR)
  3628. @** 2 : average bitrate (ABR)
  3629. @** 4 : picture level rate control
  3630. @endverbatim
  3631. */
  3632. int rcEnable;
  3633. union {
  3634. EncMp4Param mp4Param; /**< <<vpuapi_h_EncMp4Param>> */
  3635. EncH263Param h263Param; /**< <<vpuapi_h_EncH263Param>> */
  3636. EncAvcParam avcParam; /**< <<vpuapi_h_EncAvcParam>> */
  3637. EncWaveParam waveParam; /**< <<vpuapi_h_EncWaveParam>> */
  3638. } EncStdParam;
  3639. // Maverick-II Cache Configuration
  3640. /**
  3641. @verbatim
  3642. Cache MC bypass (CODA9 only)
  3643. @* 0 : MC uses a cache.
  3644. @* 1 : MC does not use a cache.
  3645. @endverbatim
  3646. */
  3647. int cacheBypass;
  3648. /**
  3649. @verbatim
  3650. @* 0 : Cb data are written in Cb frame memory and Cr data are written in Cr frame memory. (chroma separate mode)
  3651. @* 1 : Cb and Cr data are written in the same chroma memory. (chroma interleave mode)
  3652. @endverbatim
  3653. */
  3654. int cbcrInterleave;
  3655. /**
  3656. @verbatim
  3657. CbCr order in planar mode (YV12 format)
  3658. @* 0 : Cb data are written first and then Cr written in their separate plane.
  3659. @* 1 : Cr data are written first and then Cb written in their separate plane.
  3660. @endverbatim
  3661. */
  3662. int cbcrOrder;
  3663. /**
  3664. @verbatim
  3665. The endianess of the frame buffer for reference and reconstruction
  3666. @* 0 : little endian format
  3667. @* 1 : big endian format
  3668. @* 2 : 32 bit little endian format
  3669. @* 3 : 32 bit big endian format
  3670. @* 16 ~ 31 : 128 bit endian format
  3671. NOTE: For setting specific values of 128 bit endiness, please refer to the 'WAVE Datasheet'.
  3672. @endverbatim
  3673. */
  3674. int frameEndian;
  3675. /**
  3676. @verbatim
  3677. The endianess of the bitstream buffer
  3678. @* 0 : little endian format
  3679. @* 1 : big endian format
  3680. @* 2 : 32 bit little endian format
  3681. @* 3 : 32 bit big endian format
  3682. @* 16 ~ 31 : 128 bit endian format
  3683. NOTE: For setting specific values of 128 bit endiness, please refer to the 'WAVE Datasheet'.
  3684. @endverbatim
  3685. */
  3686. int streamEndian;
  3687. /**
  3688. @verbatim
  3689. The endianess of the frame buffer for source YUV
  3690. @* 0 : little endian format
  3691. @* 1 : big endian format
  3692. @* 2 : 32 bit little endian format
  3693. @* 3 : 32 bit big endian format
  3694. @* 16 ~ 31 : 128 bit endian format
  3695. NOTE: For setting specific values of 128 bit endiness, please refer to the 'WAVE Datasheet'.
  3696. @endverbatim
  3697. */
  3698. int sourceEndian;
  3699. /**
  3700. @verbatim
  3701. It writes output with 8 burst in linear map mode. (CODA9 only)
  3702. @* 0 : burst write back is disabled
  3703. @* 1 : burst write back is enabled.
  3704. @endverbatim
  3705. */
  3706. int bwbEnable;
  3707. /**
  3708. @verbatim
  3709. @* 0 : Disable
  3710. @* 1 : Enable
  3711. This flag is used to encode frame-based streaming video with line buffer.
  3712. If this field is set, VPU sends a buffer full interrupt when line buffer is full and waits until the interrupt is cleared.
  3713. HOST should read the bitstream in line buffer and clear the interrupt.
  3714. If this field is not set, VPU does not send a buffer full interrupt even if line buffer is full.
  3715. @endverbatim
  3716. */
  3717. int lineBufIntEn;
  3718. int packedFormat; /**< <<vpuapi_h_PackedFormatNum>> */
  3719. FrameBufferFormat srcFormat; /**< A color format of source image defined in <<vpuapi_h_FrameBufferFormat>>. */
  3720. FrameBufferFormat outputFormat; /**< A color format of output image defined in <<vpuapi_h_FrameBufferFormat>>. */
  3721. int srcBitDepth; /**< A bit-depth of source image */
  3722. /**
  3723. @verbatim
  3724. VPU core index number
  3725. * 0 to (number of VPU core - 1)
  3726. @endverbatim
  3727. */
  3728. Uint32 coreIdx;
  3729. /**
  3730. @verbatim
  3731. @* 0 : CbCr data is interleaved in chroma source frame memory. (NV12)
  3732. @* 1 : CrCb data is interleaved in chroma source frame memory. (NV21)
  3733. @endverbatim
  3734. */
  3735. int nv21;
  3736. Uint32 virtAxiID; /**< AXI-ID for the V-CPU part (for virtualization) */
  3737. BOOL enablePTS; /**< An enable flag to report PTS(Presentation Timestamp) */
  3738. int lowLatencyMode; /**< 2bits low latency mode setting. bit[1]: low latency interrupt enable, bit[0]: fast bitstream-packing enable (only for WAVE5) */
  3739. BOOL enableNonRefFbcWrite; /**< If it is TRUE, FBC data of non-reference picture are written into framebuffer. */
  3740. int picWidthBL; /**< The width of the BL(base layer) picture in SVC (SVAC encoder only) */
  3741. int picHeightBL; /**< The height of the BL(base layer) picture in SVC (SVAC encoder only) */
  3742. int sourceBufCount; /**< The number of source frame buffer in encoder */
  3743. int streamBufCount; /**< The number of stream buffer in encoder */
  3744. int streamBufSize; /**< The size of stream buffer in encoder */
  3745. int rcWeightFactor; /**< Adjusts the speed of updating parameters to the rate control model. If RcWeightFactor is set with a large value, the RC parameters are updated slowly. (Min: 1, Max: 32, default: 2) */
  3746. #ifdef SUPPORT_SOURCE_RELEASE_INTERRUPT
  3747. int srcReleaseIntEnable; /**< It enables released source buffer interrupt. */
  3748. #endif
  3749. int ringBufferWrapEnable; /**< It enables read and write pointers to be wrapped around under buffer fullness in ring buffer mode. */
  3750. } EncOpenParam;
  3751. /**
  3752. * @brief This is a data structure which contains the number of source frame buffer and reconstructed frame buffer required for running an encoder instance. This is returned after calling GetInitialInfo().
  3753. */
  3754. typedef struct {
  3755. int minFrameBufferCount; /**< Minimum number of frame buffer */
  3756. int minSrcFrameCount; /**< Minimum number of source buffer */
  3757. int maxLatencyPictures; /**< Maximum number of picture latency */
  3758. int seqInitErrReason; /**< Error information */
  3759. int warnInfo; /**< Warn information */
  3760. Uint32 vlcBufSize; /**< The size of task buffer */
  3761. Uint32 paramBufSize; /**< The size of task buffer */
  3762. } EncInitialInfo;
  3763. #ifdef SUPPORT_LOOK_AHEAD_RC
  3764. #define LOOK_AHEAD_RC_MIN_SIZE 1
  3765. #define LOOK_AHEAD_RC_MAX_SIZE 80
  3766. #define LOOK_AHEAD_RC_DATA_SIZE (LOOK_AHEAD_RC_MAX_SIZE+(MAX_SRC_BUFFER_NUM*2)+COMMAND_QUEUE_DEPTH)
  3767. typedef struct {
  3768. int larcData[LOOK_AHEAD_RC_DATA_SIZE][3];
  3769. int Pass1encPicCnt;
  3770. int Pass2encPicCnt;
  3771. int larcPass1Finish;
  3772. int larcPass;
  3773. } EncLarcInfo;
  3774. #endif
  3775. /**
  3776. * @brief This is a data structure for setting NAL unit coding options.
  3777. */
  3778. typedef struct {
  3779. int implicitHeaderEncode; /**< Whether HOST application encodes a header implicitly or not. If this value is 1, three encode options encodeVPS, encodeSPS, and encodePPS are ignored. */
  3780. int encodeVCL; /**< A flag to encode VCL nal unit explicitly */
  3781. int encodeVPS; /**< A flag to encode VPS nal unit explicitly */
  3782. int encodeSPS; /**< A flag to encode SPS nal unit explicitly */
  3783. int encodePPS; /**< A flag to encode PPS nal unit explicitly */
  3784. int encodeAUD; /**< A flag to encode AUD nal unit explicitly */
  3785. int encodeEOS; /**< A flag to encode EOS nal unit explicitly. This should be set when to encode the last source picture of sequence. */
  3786. int encodeEOB; /**< A flag to encode EOB nal unit explicitly. This should be set when to encode the last source picture of sequence. */
  3787. int encodeVUI; /**< A flag to encode VUI nal unit explicitly */
  3788. int encodeFiller; /**< A flag to encode Filler nal unit explicitly (WAVE5 only) */
  3789. } EncCodeOpt;
  3790. /**
  3791. * @brief This is a data structure for configuring picture encode operation. The variables can change every time one picture is encoded.
  3792. */
  3793. typedef struct {
  3794. FrameBuffer* sourceFrame; /**< This member must represent the frame buffer containing source image to be encoded. */
  3795. /**
  3796. @verbatim
  3797. If this value is 0, the picture type is determined by the encoder
  3798. according to the various parameters such as encoded frame number and GOP size.
  3799. If this value is 1, the frame is encoded as an I-picture regardless of the
  3800. frame number or GOP size, and I-picture period calculation is reset to
  3801. initial state. In MPEG4 and H.263 case, I-picture is sufficient for decoder
  3802. refresh. In H.264/AVC case, the picture is encoded as an IDR (Instantaneous
  3803. Decoding Refresh) picture.
  3804. This value is ignored if skipPicture is 1. (CODA9 only)
  3805. @endverbatim
  3806. */
  3807. int forceIPicture;
  3808. /**
  3809. @verbatim
  3810. If this value is 0, the encoder encodes a picture as normal.
  3811. If this value is 1, the encoder ignores sourceFrame and generates a skipped
  3812. picture. (WAVE only) In this case, the reconstructed image at decoder side is a duplication
  3813. of the previous picture. The skipped picture is encoded as P-type regardless of
  3814. the GOP size.
  3815. @endverbatim
  3816. */
  3817. int skipPicture;
  3818. int quantParam; /**< This value is used for all quantization parameters in case of VBR - no rate control. (CODA9 only) */
  3819. /**
  3820. @verbatim
  3821. The start address of picture stream buffer under line-buffer mode.
  3822. This variable represents the start of picture stream for encoded output. In
  3823. buffer-reset mode, HOST might use multiple picture stream buffers for the
  3824. best performance. By using this variable, HOST application could re-register the
  3825. start position of the picture stream while issuing a picture encoding operation.
  3826. The buffer size is specified by the following variable, picStreamBufferSize. In packet-based streaming
  3827. with ring-buffer, this variable is ignored.
  3828. NOTE: This variable is only meaningful when line-buffer mode is enabled.
  3829. @endverbatim
  3830. */
  3831. PhysicalAddress picStreamBufferAddr;
  3832. /**
  3833. @verbatim
  3834. This variable represents the byte size of picture stream buffer. This variable is
  3835. so crucial in line-buffer mode. That is because encoder output could be
  3836. corrupted if this size is smaller than any picture encoded output. So this value
  3837. should be big enough for storing multiple picture streams with average size. In
  3838. packet-based streaming with ring-buffer, this variable is ignored.
  3839. @endverbatim
  3840. */
  3841. int picStreamBufferSize;
  3842. /**
  3843. @verbatim
  3844. @* 0 : progressive (frame) encoding
  3845. @* 1 : interlaced (field) encoding
  3846. This is only for CODA9.
  3847. @endverbatim
  3848. */
  3849. int fieldRun;
  3850. int forcePicQpEnable; /**< A flag to use a force picture quantization parameter (WAVE only) */
  3851. int forcePicQpI; /**< A force picture quantization parameter for I picture. It is valid when forcePicQpEnable is 1. (WAVE only) */
  3852. int forcePicQpP; /**< A force picture quantization parameter for P picture. It is valid when forcePicQpEnable is 1. (WAVE only) */
  3853. int forcePicQpB; /**< A force picture quantization parameter for B picture. It is valid when forcePicQpEnable is 1. (WAVE only) */
  3854. int forcePicTypeEnable; /**< A flag to use a force picture type (WAVE only) */
  3855. int forcePicType; /**< A force picture type (I, P, B, IDR, CRA). It is valid when forcePicTypeEnable is 1. (WAVE only) */
  3856. int srcIdx; /**< A source frame buffer index (WAVE only) */
  3857. int srcEndFlag; /**< A flag indicating that there is no more source frame buffer to encode (WAVE only) */
  3858. EncCodeOpt codeOption; /**< <<vpuapi_h_EncCodeOpt>> (WAVE only) */
  3859. Uint32 useCurSrcAsLongtermPic; /**< A flag for the current picture to be used as a longterm reference picture later when other picture's encoding (WAVE only) */
  3860. Uint32 useLongtermRef; /**< A flag to use a longterm reference picture in DPB when encoding the current picture (WAVE only) */
  3861. Uint64 pts; /**< The presentation Timestamp (PTS) of input source */
  3862. Uint32 coda9RoiEnable; /**< A flag to use ROI (CODA9 only) */
  3863. Uint32 coda9RoiPicAvgQp; /**< A average value of ROI QP for a picture (CODA9 only) */
  3864. PhysicalAddress roiQpMapAddr; /**< The start address of ROI QP map (CODA9 only) */
  3865. Uint32 nonRoiQp; /**< A non-ROI QP for a picture */
  3866. // belows are newly added for WAVE5 encoder
  3867. WaveCustomMapOpt customMapOpt; /**< <<vpuapi_h_WaveCustomMapOpt>> */
  3868. Uint32 wpPixSigmaY; /**< Pixel variance of Y component for weighted prediction */
  3869. Uint32 wpPixSigmaCb; /**< Pixel variance of Cb component for weighted prediction */
  3870. Uint32 wpPixSigmaCr; /**< Pixel variance of Cr component for weighted prediction */
  3871. Uint32 wpPixMeanY; /**< Pixel mean value of Y component for weighted prediction */
  3872. Uint32 wpPixMeanCb; /**< Pixel mean value of Cb component for weighted prediction */
  3873. Uint32 wpPixMeanCr; /**< Pixel mean value of Cr component for weighted prediction */
  3874. Uint32 forceAllCtuCoefDropEnable; /**< It forces all coefficients to be zero after TQ . */
  3875. // only for SVAC encoder
  3876. Int32 userFilterLevelEnable; /**< It enables to set the user filter level. (SVAC encoder only) */
  3877. Int32 lfFilterLevel; /**< It specifies the loop filter level. (0 ~ 63) The userFilterLevelEnable must be 1. (SVAC encoder only) */
  3878. Int32 sharpLevel; /**< It specifies the sharpness level of filter. (0 ~ 7) (SVAC encoder only) */
  3879. Int32 lfRefDeltaIntra; /**< It specifies a delta value of filter level for key frame. (-63 ~ 63) (SVAC encoder only) */
  3880. Int32 lfRefDeltaRef0; /**< It specifies a delta value of filter level for Ref0 (Dynamic Ref) frame. (-63 ~ 63) (SVAC encoder only) */
  3881. Int32 lfRefDeltaRef1; /**< It specifies a delta value of filter level for Ref1 (Optional Ref) frame. (-63 ~ 63) (SVAC encoder only) */
  3882. Int32 lfModeDelta; /**< It specifies a delta value of filter level according to inter/intra mode. (-63 ~ 63) (SVAC encoder only) */
  3883. /**
  3884. @verbatim
  3885. It specifies an spatial SVC layer.
  3886. @* 0 : base layer picture
  3887. @* 1 : enhanced layer picture
  3888. @endverbatim
  3889. */
  3890. Int32 svcLayerFlag;
  3891. FrameBuffer* OffsetTblBuffer; /**< A offset table buffer address for Cframe50 */
  3892. Uint32 qosEnable; /**< It updates QoS control information. To update QoS values, qosEnable must be 1. */
  3893. Uint32 qosConfig; /**< It enables register based QoS control. If register based QoS control feature is enabled, QoS for AXI is set by given qosValVcore0 and qosValVcore1 respectively. */
  3894. Uint32 qosValVcore0; /**< Qos value for VCORE0 */
  3895. Uint32 qosValVcore1; /**< Qos value for VCORE1 */
  3896. #ifdef SUPPORT_LOOK_AHEAD_RC
  3897. int larcData[3];
  3898. #endif
  3899. } EncParam;
  3900. /**
  3901. * @brief This structure is used for reporting encoder information. (CODA9 only)
  3902. */
  3903. typedef struct {
  3904. /**
  3905. @verbatim
  3906. @* 0 : reporting disable
  3907. @* 1 : reporting enable
  3908. @endverbatim
  3909. */
  3910. int enable;
  3911. int type; /**< This value is used for picture type reporting in MVInfo and Sliceinfo. */
  3912. int sz; /**< This value means the size for each reporting data (MBinfo, MVinfo, Sliceinfo). */
  3913. PhysicalAddress addr; /**< The start address of each reporting buffer into which encoder puts data. */
  3914. } EncReportInfo;
  3915. /**
  3916. * @brief This is a data structure for reporting the results of picture encoding operations.
  3917. */
  3918. typedef struct {
  3919. /**
  3920. @verbatim
  3921. The physical address of the starting point of newly encoded picture stream
  3922. If dynamic buffer allocation is enabled in line-buffer mode, this value is
  3923. identical with the specified picture stream buffer address by HOST.
  3924. @endverbatim
  3925. */
  3926. PhysicalAddress bitstreamBuffer;
  3927. Uint32 bitstreamSize; /**< The byte size of encoded bitstream */
  3928. int bitstreamWrapAround;/**< This is a flag to indicate that the write point is wrapped around in bitsteam buffer in case of ring buffer mode. If this flag is 1 in line buffer mode, it indicates fullness of bitstream buffer. Then HOST application needs a larger bitstream buffer. */
  3929. int picType; /**< <<vpuapi_h_PicType>> */
  3930. int numOfSlices; /**< The number of slices of the currently being encoded Picture */
  3931. int reconFrameIndex; /**< A reconstructed frame index. The reconstructed frame can be used for reference of future frame. */
  3932. FrameBuffer reconFrame; /**< A reconstructed frame address and information. Please refer to <<vpuapi_h_FrameBuffer>>. */
  3933. int rdPtr; /**< A read pointer in bitstream buffer, which is where HOST has read encoded bitstream from the buffer */
  3934. int wrPtr; /**< A write pointer in bitstream buffer, which is where VPU has written encoded bitstream into the buffer */
  3935. int picSkipped; /**< A flag which represents whether the current encoding has been skipped or not. (WAVE5 only) */
  3936. int numOfIntra; /**< The number of intra coded block (WAVE5 HEVC only) */
  3937. int numOfMerge; /**< The number of merge block in 8x8 (WAVE5 HEVC only) */
  3938. int numOfSkipBlock; /**< The number of skip block in 8x8 (WAVE5 HEVC only) */
  3939. int avgCtuQp; /**< The average value of CTU QPs (WAVE5 only) */
  3940. int encPicByte; /**< The number of encoded picture bytes (WAVE5 only) */
  3941. int encGopPicIdx; /**< The GOP index of the currently encoded picture (WAVE5 only) */
  3942. int encPicPoc; /**< The POC(picture order count) value of the currently encoded picture (WAVE5 only) */
  3943. int releaseSrcFlag; /**< The source buffer indicator of the encoded pictures(WAVE5 only) */
  3944. int encSrcIdx; /**< The source buffer index of the currently encoded picture (WAVE5 only) */
  3945. int encNumNut; /**< The number of nal_unit_type of the currently encoded picture (WAVE5 only) */
  3946. int encVclNut; /**< The VCL NAL unit type of the currently encoded picture(WAVE5 only). For more information, refer to the RET_QUERY_ENC_VCL_NUT register in programmer's guide. */
  3947. int encPicCnt; /**< The encoded picture number (WAVE5 only) */
  3948. int errorReason; /**< The error reason of the currently encoded picture (WAVE5 only) */
  3949. int warnInfo; /**< The warning information of the currently encoded picture (WAVE5 only) */
  3950. // Report Information
  3951. EncReportInfo mbInfo; /**< The parameter for reporting MB data(CODA9 only) . Please refer to <<vpuapi_h_EncReportInfo>> structure. */
  3952. EncReportInfo mvInfo; /**< The parameter for reporting motion vector(CODA9 only). Please refer to <<vpuapi_h_EncReportInfo>> structure. */
  3953. EncReportInfo sliceInfo;/**< The parameter for reporting slice information(CODA9 only). Please refer to <<vpuapi_h_EncReportInfo>> structure. */
  3954. int frameCycle; /**< The parameter for reporting the cycle number of encoding one frame.*/
  3955. Uint64 pts; /**< The PTS(Presentation Timestamp) of the encoded picture which is retrieved and managed from VPU API */
  3956. Uint32 cyclePerTick; /**< The number of cycles per tick */
  3957. Uint32 encHostCmdTick; /**< Tick of ENC_PIC command for the picture */
  3958. Uint32 encPrepareStartTick; /**< Start tick of preparing slices of the picture */
  3959. Uint32 encPrepareEndTick; /**< End tick of preparing slices of the picture */
  3960. Uint32 encProcessingStartTick; /**< Start tick of processing slices of the picture */
  3961. Uint32 encProcessingEndTick; /**< End tick of processing slices of the picture */
  3962. Uint32 encEncodeStartTick; /**< Start tick of encoding slices of the picture */
  3963. Uint32 encEncodeEndTick; /**< End tick of encoding slices of the picture */
  3964. Uint32 prepareCycle; /**< The number of cycles for preparing slices of a picture */
  3965. Uint32 processing; /**< The number of cycles for processing slices of a picture */
  3966. Uint32 EncodedCycle; /**< The number of cycles for encoding slices of a picture */
  3967. Uint32 picDistortionLow; /**< The 32bit lowest difference value(SSD) between an original block and a reconstructed block in the encoded picture. It can be an indicator for image quality. Host cannot tune quality by using this value, because this value is not an input parameter, but a reporting value. */
  3968. Uint32 picDistortionHigh; /**< The 32bit highest difference value(SSD) between an original block and a reconstructed block in the encoded picture. It can be an indicator for image quality. Host cannot tune quality by using this value, because this value is not an input parameter, but a reporting value. */
  3969. /**
  3970. @verbatim
  3971. SVC layer type of the encoded picture
  3972. @* 0 : BL picture
  3973. @* 1 : EL picture
  3974. @endverbatim
  3975. */
  3976. Uint32 isSvcLayerEL;
  3977. #ifdef SUPPORT_LOOK_AHEAD_RC
  3978. int larcData[3];
  3979. #endif
  3980. RetCode result; /**< The return value of VPU_EncGetOutputInfo() */
  3981. } EncOutputInfo;
  3982. /**
  3983. * @brief This structure is used for adding a header syntax layer into the encoded bitstream.
  3984. The headerType, buf, and zeropaddingEnable are input parameters to VPU. The size
  3985. is a returned value from VPU after completing requested operation.
  3986. */
  3987. typedef struct {
  3988. PhysicalAddress buf; /**< A physical address pointing the generated stream location */
  3989. size_t size; /**< The size of the generated stream in bytes */
  3990. Int32 headerType; /**< This is a type of header that HOST wants to generate such as <<vpuapi_h_Mp4HeaderType>>, <<vpuapi_h_AvcHeaderType>> or <<vpuapi_h_WaveEncHeaderType>>. */
  3991. BOOL zeroPaddingEnable; /**< It enables header to be padded at the end with zero for byte alignment. (CODA9 only) */
  3992. } EncHeaderParam;
  3993. /**
  3994. * @brief This is a special enumeration type for MPEG4 top-level header classes such as
  3995. visual sequence header, visual object header and video object layer header.
  3996. It is for MPEG4 encoder only.
  3997. */
  3998. typedef enum {
  3999. VOL_HEADER, /**< Video object layer header */
  4000. VOS_HEADER, /**< Visual object sequence header */
  4001. VIS_HEADER /**< Video object header */
  4002. } Mp4HeaderType;
  4003. /**
  4004. * @brief This is a special enumeration type for AVC parameter sets such as sequence
  4005. parameter set and picture parameter set. It is for AVC encoder only.
  4006. */
  4007. typedef enum {
  4008. SPS_RBSP, /**< Sequence parameter set */
  4009. PPS_RBSP, /**< Picture parameter set */
  4010. SPS_RBSP_MVC, /**< Subset sequence parameter set */
  4011. PPS_RBSP_MVC, /**< Picture parameter set for dependent view */
  4012. } AvcHeaderType;
  4013. /**
  4014. * @brief This is a special enumeration type for explicit encoding headers such as VPS, SPS, PPS. (WAVE encoder only)
  4015. */
  4016. typedef enum {
  4017. CODEOPT_ENC_VPS = (1 << 2), /**< A flag to encode VPS nal unit explicitly */
  4018. CODEOPT_ENC_SPS = (1 << 3), /**< A flag to encode SPS nal unit explicitly */
  4019. CODEOPT_ENC_PPS = (1 << 4), /**< A flag to encode PPS nal unit explicitly */
  4020. } WaveEncHeaderType;
  4021. /**
  4022. * @brief This is a special enumeration type for NAL unit coding options
  4023. */
  4024. typedef enum {
  4025. CODEOPT_ENC_HEADER_IMPLICIT = (1 << 0), /**< A flag to encode (a) headers (VPS, SPS, PPS) implicitly for generating bitstreams conforming to spec. */
  4026. CODEOPT_ENC_VCL = (1 << 1), /**< A flag to encode VCL nal unit explicitly */
  4027. } ENC_PIC_CODE_OPTION;
  4028. /**
  4029. * @brief This is a special enumeration type for defining GOP structure presets.
  4030. */
  4031. typedef enum {
  4032. PRESET_IDX_CUSTOM_GOP = 0, /**< User defined GOP structure */
  4033. PRESET_IDX_ALL_I = 1, /**< All Intra, gopsize = 1 */
  4034. PRESET_IDX_IPP = 2, /**< Consecutive P, cyclic gopsize = 1 */
  4035. PRESET_IDX_IBBB = 3, /**< Consecutive B, cyclic gopsize = 1 */
  4036. PRESET_IDX_IBPBP = 4, /**< gopsize = 2 */
  4037. PRESET_IDX_IBBBP = 5, /**< gopsize = 4 */
  4038. PRESET_IDX_IPPPP = 6, /**< Consecutive P, cyclic gopsize = 4 */
  4039. PRESET_IDX_IBBBB = 7, /**< Consecutive B, cyclic gopsize = 4 */
  4040. PRESET_IDX_RA_IB = 8, /**< Random Access, cyclic gopsize = 8 */
  4041. } GOP_PRESET_IDX;
  4042. #ifdef __cplusplus
  4043. extern "C" {
  4044. #endif
  4045. /**
  4046. * @brief
  4047. @verbatim
  4048. This function initializes VPU hardware and its data
  4049. structures/resources. HOST application must call this function only once before calling
  4050. VPU_DeInit().
  4051. NOTE: Before use, HOST application needs to define the header file path of BIT firmware to BIT_CODE_FILE_PATH.
  4052. @endverbatim
  4053. */
  4054. RetCode VPU_Init(
  4055. Uint32 coreIdx /**<[Input] An index of VPU core. This value can be from 0 to (number of VPU core - 1).*/
  4056. );
  4057. /**
  4058. * @brief
  4059. @verbatim
  4060. This function initializes VPU hardware and its data structures/resources.
  4061. HOST application must call this function only once before calling VPU_DeInit().
  4062. VPU_InitWithBitcodec() is basically same as VPU_Init() except that it takes additional arguments, a buffer pointer where
  4063. BIT firmware binary is located and the size.
  4064. HOST application can use this function when they wish to load a binary format of BIT firmware,
  4065. instead of it including the header file of BIT firmware.
  4066. Particularly in multi core running environment with different VPU products,
  4067. this function must be used because each core needs to load different firmware.
  4068. @endverbatim
  4069. *
  4070. * @return
  4071. @verbatim
  4072. *RETCODE_SUCCESS* ::
  4073. Operation was done successfully, which means VPU has been initialized successfully.
  4074. *RETCODE_CALLED_BEFORE* ::
  4075. This function call is invalid which means multiple calls of the current API function
  4076. for a given instance are not allowed. In this case, VPU has been already
  4077. initialized, so that this function call is meaningless and not allowed anymore.
  4078. *RETCODE_NOT_FOUND_BITCODE_PATH* ::
  4079. The header file path of BIT firmware has not been defined.
  4080. *RETCODE_VPU_RESPONSE_TIMEOUT* ::
  4081. Operation has not received any response from VPU and has timed out.
  4082. *RETCODE_FAILURE* ::
  4083. Operation was failed.
  4084. @endverbatim
  4085. */
  4086. RetCode VPU_InitWithBitcode(
  4087. Uint32 coreIdx, /**< [Input] An index of VPU core */
  4088. const Uint16 *bitcode, /**< [Input] Buffer where binary format of BIT firmware is located */
  4089. Uint32 sizeInWord /**< [Input] Size of binary BIT firmware in short integer */
  4090. );
  4091. /**
  4092. * @brief This function returns whether VPU is currently running or not.
  4093. * @param coreIdx [Input] An index of VPU core
  4094. * @return
  4095. @verbatim
  4096. @* 0 : VPU is not running.
  4097. @* 1 or more : VPU is running.
  4098. @endverbatim
  4099. */
  4100. Int32 VPU_IsInit(
  4101. Uint32 coreIdx
  4102. );
  4103. /**
  4104. * @brief This function frees all the resources allocated by VPUAPI and releases the device driver.
  4105. VPU_Init() and VPU_DeInit() always work in pairs.
  4106. * @return none
  4107. */
  4108. RetCode VPU_DeInit(
  4109. Uint32 coreIdx /**< [Input] An index of VPU core */
  4110. );
  4111. /**
  4112. * @brief
  4113. @verbatim
  4114. This function waits for interrupts to be issued from VPU during the given timeout period. VPU sends an interrupt when
  4115. it completes a command or meets an exceptional case. (CODA9 only)
  4116. The behavior of this function depends on VDI layer\'s implementation.
  4117. Timeout may not work according to implementation of VDI layer.
  4118. @endverbatim
  4119. * @param coreIdx [Input] An index of VPU core
  4120. * @param timeout [Input] Time to wait
  4121. * @return
  4122. @verbatim
  4123. * -1 : timeout
  4124. * Non -1 value : The value of InterruptBit
  4125. @endverbatim
  4126. */
  4127. Int32 VPU_WaitInterrupt(
  4128. Uint32 coreIdx,
  4129. int timeout
  4130. );
  4131. /**
  4132. * @brief
  4133. @verbatim
  4134. This function waits for interrupts to be issued from VPU during the given timeout period. VPU sends an interrupt when
  4135. it completes a command or meets an exceptional case. (WAVE only)
  4136. The behavior of this function depends on VDI layer\'s implementation.
  4137. Timeout may not work according to implementation of VDI layer.
  4138. @endverbatim
  4139. * @param handle [Input] A decoder/encoder handle obtained from VPU_DecOpen()/VPU_EncOpen()
  4140. * @param timeout [Input] Time to wait
  4141. * @return
  4142. @verbatim
  4143. * -1 : timeout
  4144. * Non -1 value : The value of InterruptBit
  4145. @endverbatim
  4146. */
  4147. Int32 VPU_WaitInterruptEx(
  4148. VpuHandle handle,
  4149. int timeout
  4150. );
  4151. /**
  4152. * @brief This function clears VPU interrupts that are pending.
  4153. * @return None
  4154. */
  4155. void VPU_ClearInterrupt(
  4156. Uint32 coreIdx /**< [Input] An index of VPU core */
  4157. );
  4158. /**
  4159. * @brief This function clears VPU interrupts for a specific instance.
  4160. * @return None
  4161. */
  4162. void VPU_ClearInterruptEx(
  4163. VpuHandle handle, /**< [Input] A decoder/encoder handle obtained from VPU_DecOpen()/VPU_EncOpen() */
  4164. Int32 intrFlag /**< [Input] An interrupt flag to be cleared */
  4165. );
  4166. /**
  4167. * @brief
  4168. @verbatim
  4169. This function stops the current decode or encode operation and resets the internal blocks - BPU_CORE, BPU_BUS, VCE_CORE, and VCE_BUS.
  4170. It can be used when VPU is having a longer delay(timeout) or seems hang-up.
  4171. *SW_RESET_SAFETY*
  4172. SW_RESET_SAFETY moves the context back to the state before calling the current VPU_DecStartOneFrame()/VPU_EncStartOneFrame().
  4173. After calling `VPU_SWReset()` with SW_RESET_SAFETY, HOST can resume decoding/encoding from the next picture by calling VPU_DecStartOneFrame()/VPU_EncStartOneFrame().
  4174. It works only for the current instance, so this function does not affect other instance\'s running in multi-instance operation.
  4175. This is some applicable scenario of using SW_RESET_SAFETY especially for occurrance of hang-up.
  4176. For example, when VPU is hung up with frame 1, HOST application calls `VPU_SWReset()` and calls `VPU_DecStartOneFrame()` for frame 2
  4177. with specifying the start address and read pointer.
  4178. If there is still problem with frame 2, we recommend as below.
  4179. @* calling `VPU_SWReset()` with SW_RESET_SAFETY and `seq_init()`
  4180. @* calling `VPU_SWReset()` with SW_RESET_SAFETY and enabling iframe search.
  4181. *SW_RESET_FORCE*
  4182. Unlike the SW_RESET_SAFETY, SW_RESET_FORCE requires to restart the whole process from initialization of VPU
  4183. , setting parameters, and registering frame buffers.
  4184. @endverbatim
  4185. * @return
  4186. @verbatim
  4187. *RETCODE_SUCCESS* ::
  4188. Operation was done successfully.
  4189. @endverbatim
  4190. */
  4191. RetCode VPU_SWReset(
  4192. Uint32 coreIdx, /**<[Input] An index of VPU core */
  4193. /**
  4194. @verbatim
  4195. [Input] Way of reset
  4196. @* SW_RESET_SAFETY : It waits for completion of ongoing bus transactions. If remaining bus transactions are done, VPU goes into the reset process. (recommended mode)
  4197. @* SW_RESET_FORCE : It forces to do SW_RESET immediately no matter whether bus transactions are completed or not. It might affect what other blocks do with bus. We do not recommend using this mode.
  4198. @* SW_RESET_ON_BOOT : This is the default reset mode which is only executed while system boots up. In fact, SW_RESET_ON_BOOT is executed in VPU_Init() and there is no separate use case.
  4199. @endverbatim
  4200. */
  4201. SWResetMode resetMode,
  4202. void* pendingInst /**< [Input] An instance handle */
  4203. );
  4204. /**
  4205. * @brief
  4206. @verbatim
  4207. This function resets VPU as VPU_SWReset() does, but
  4208. it is done by the system reset signal and all the internal contexts are initialized.
  4209. Therefore, HOST application needs to call `VPU_Init()` after `VPU_HWReset()`.
  4210. `VPU_HWReset()` requires vdi_hw_reset part of VDI module to be implemented before use.
  4211. @endverbatim
  4212. * @return
  4213. @verbatim
  4214. *RETCODE_SUCCESS* ::
  4215. Operation was done successfully.
  4216. @endverbatim
  4217. */
  4218. RetCode VPU_HWReset(
  4219. Uint32 coreIdx /**< [Input] An index of VPU core */
  4220. );
  4221. /**
  4222. * @brief
  4223. @verbatim
  4224. This function saves or restores context when VPU is powered on or off.
  4225. NOTE: This is a tip for safe operation -
  4226. call this function to make VPU enter into a sleep state before power down, and
  4227. after the power off call this function again to return to a wake state.
  4228. @endverbatim
  4229. * @return
  4230. @verbatim
  4231. *RETCODE_SUCCESS* ::
  4232. Operation was done successfully.
  4233. @endverbatim
  4234. */
  4235. RetCode VPU_SleepWake(
  4236. Uint32 coreIdx, /**< [Input] An index of VPU core */
  4237. /**
  4238. @verbatim
  4239. [Input]
  4240. @* 1 : saves all of the VPU contexts and converts into a sleep state.
  4241. @* 0 : restores all of the VPU contexts and converts back to a wake state.
  4242. @endverbatim
  4243. */
  4244. int iSleepWake
  4245. );
  4246. /**
  4247. * @brief This function returns the product ID of VPU which is currently running.
  4248. * @return Product information. Please refer to the <<vpuapi_h_ProductId>> enumeration.
  4249. */
  4250. int VPU_GetProductId(
  4251. int coreIdx /**< [Input] VPU core index number */
  4252. );
  4253. /**
  4254. * @brief This function returns the product information of VPU which is currently running on the system.
  4255. * @return
  4256. @verbatim
  4257. *RETCODE_SUCCESS* ::
  4258. Operation was done successfully, which means version information is acquired
  4259. successfully.
  4260. *RETCODE_FAILURE* ::
  4261. Operation was failed, which means the current firmware does not contain any version
  4262. information.
  4263. *RETCODE_NOT_INITIALIZED* ::
  4264. VPU was not initialized at all before calling this function. Application should
  4265. initialize VPU by calling VPU_Init() before calling this function.
  4266. *RETCODE_FRAME_NOT_COMPLETE* ::
  4267. This means frame decoding operation was not completed yet, so the given API
  4268. function call cannot be performed this time. A frame-decoding operation should
  4269. be completed by calling VPU_DecGetOutputInfo(). Even though the result of the
  4270. current frame operation is not necessary, HOST application should call
  4271. VPU_DecGetOutputInfo() to proceed this function call.
  4272. *RETCODE_VPU_RESPONSE_TIMEOUT* ::
  4273. Operation has not received any response from VPU and has timed out.
  4274. @endverbatim
  4275. */
  4276. RetCode VPU_GetVersionInfo(
  4277. Uint32 coreIdx, /**< [Input] An index of VPU core */
  4278. /**
  4279. @verbatim
  4280. [Output]
  4281. @* Version_number[15:12] - Major revision
  4282. @* Version_number[11:8] - Hardware minor revision
  4283. @* Version_number[7:0] - Software minor revision
  4284. @endverbatim
  4285. */
  4286. Uint32* versionInfo,
  4287. Uint32* revision, /**< [Output] Revision information */
  4288. Uint32* productId /**< [Output] Product information. Refer to the <<vpuapi_h_ProductId>> enumeration */
  4289. );
  4290. /**
  4291. * @brief This function returns the hardware attributes for VPU. <<vpuapi_h_VpuAttr>>
  4292. * @return
  4293. @verbatim
  4294. *RETCODE_SUCCESS* ::
  4295. Operation was done successfully, which means version information is acquired
  4296. successfully.
  4297. @endverbatim
  4298. */
  4299. RetCode VPU_GetProductInfo(
  4300. Uint32 coreIdx, /**< [Input] An index of VPU core */
  4301. VpuAttr* productInfo /**< [Output] <<vpuapi_h_VpuAttr>> */
  4302. );
  4303. /**
  4304. * @brief This function returns the number of instances opened.
  4305. * @return The number of instances opened
  4306. */
  4307. int VPU_GetOpenInstanceNum(
  4308. Uint32 coreIdx /**< [Input] An index of VPU core */
  4309. );
  4310. /**
  4311. * @brief This function returns the size of one frame buffer that is required for VPU to decode or encode a frame.
  4312. *
  4313. * @return The size of frame buffer to be allocated
  4314. */
  4315. int VPU_GetFrameBufSize(
  4316. VpuHandle handle, /**< [Input] A decoder/encoder handle obtained from VPU_DecOpen()/VPU_EncOpen() */
  4317. int coreIdx, /**< [Input] VPU core index number */
  4318. int stride, /**< [Input] The stride of image */
  4319. int height, /**< [Input] The height of image */
  4320. int mapType, /**< [Input] The map type of framebuffer */
  4321. int format, /**< [Input] The color format of framebuffer */
  4322. int interleave, /**< [Input] Whether to use CBCR interleave mode or not */
  4323. DRAMConfig* pDramCfg /**< [Input] Attributes of DRAM. It is only valid for CODA960. Set NULL for this variable in case of other products. */
  4324. );
  4325. // function for decode
  4326. /**
  4327. * @brief
  4328. This function opens a decoder instance in order to start a new decoder operation.
  4329. By calling this function, HOST application can get a handle by which they can refer to a decoder instance.
  4330. HOST application needs this kind of handle under multiple instances running codec.
  4331. Once HOST application gets a handle, the HOST application must pass this handle to all subsequent decoder-related functions.
  4332. * @return
  4333. @verbatim
  4334. *RETCODE_SUCCESS* ::
  4335. Operation was done successfully, which means a new decoder instance was created
  4336. successfully.
  4337. *RETCODE_FAILURE* ::
  4338. Operation was failed, which means getting a new decoder instance was not done
  4339. successfully. If there is no free instance anymore, this value is returned
  4340. in this function call.
  4341. *RETCODE_INVALID_PARAM* ::
  4342. The given argument parameter, `pop`, was invalid, which means it has a null
  4343. pointer, or given values for some member variables are improper values.
  4344. *RETCODE_NOT_INITIALIZED* ::
  4345. This means VPU was not initialized yet before calling this function.
  4346. Applications should initialize VPU by calling VPU_Init() before calling this
  4347. function.
  4348. @endverbatim
  4349. */
  4350. RetCode VPU_DecOpen(
  4351. DecHandle *pHandle, /**< [Output] A pointer to DecHandle type variable which specifies each instance for HOST application. */
  4352. DecOpenParam *pop /**< [Input] A pointer to <<vpuapi_h_DecOpenParam>> which describes required parameters for creating a new decoder instance. */
  4353. );
  4354. /**
  4355. * @brief This function closes the given decoder instance.
  4356. By calling this function, HOST application can end decoding of the sequence and release the instance.
  4357. After completion of this function call, relevant resources of the instance get
  4358. free. Once HOST application closes an instance, the HOST application cannot call any further
  4359. decoder-specific function with the current handle before re-opening a new
  4360. decoder instance with the same handle.
  4361. * @return
  4362. @verbatim
  4363. *RETCODE_SUCCESS* ::
  4364. Operation was done successfully, which means the current decoder instance was closed
  4365. successfully.
  4366. *RETCODE_INVALID_HANDLE* ::
  4367. +
  4368. --
  4369. This means the given handle for the current API function call, handle, was invalid.
  4370. This return code might be caused if
  4371. * `handle` is not the handle which has been obtained by VPU_DecOpen()
  4372. * `handle` is the handle of an instance which has been closed already, etc.
  4373. --
  4374. *RETCODE_VPU_RESPONSE_TIMEOUT* ::
  4375. Operation has not received any response from VPU and has timed out.
  4376. *RETCODE_FRAME_NOT_COMPLETE* ::
  4377. This means frame decoding operation was not completed yet, so the given API
  4378. function call cannot be performed this time. A frame decoding operation should
  4379. be completed by calling VPU_DecGetOutputInfo(). Even though the result of the
  4380. current frame operation is not necessary, HOST application should call
  4381. VPU_DecGetOutputInfo() to proceed this function call.
  4382. @endverbatim
  4383. */
  4384. RetCode VPU_DecClose(
  4385. DecHandle handle /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4386. );
  4387. /**
  4388. * @brief
  4389. @verbatim
  4390. This function decodes the sequence header in the bitstream buffer and returns crucial information for running decode operation such as
  4391. the required number of frame buffers.
  4392. Applications must pass the address of <<vpuapi_h_DecInitialInfo>> structure, where the
  4393. decoder stores information such as picture size, number of necessary frame
  4394. buffers, etc. For the details, see definition of <<vpuapi_h_DecInitialInfo>> data structure.
  4395. This function should be called once after creating a decoder instance and before starting frame decoding.
  4396. It is HOST application\'s responsibility to provide sufficient amount of bitstream to
  4397. the decoder so that bitstream buffer does not get empty before this function returns.
  4398. If HOST application cannot ensure to feed stream enough, they can use the Forced
  4399. Escape option by using VPU_DecSetEscSeqInit().
  4400. This function call plays the same role of calling DecIssueSeqInit() and DecCompleteSeqInit().
  4401. @endverbatim
  4402. * @return
  4403. @verbatim
  4404. *RETCODE_SUCCESS* ::
  4405. Operation was done successfully, which means required information of the stream
  4406. data to be decoded was received successfully.
  4407. *RETCODE_FAILURE* ::
  4408. Operation was failed, which means there was an error in getting information for
  4409. configuring the decoder.
  4410. *RETCODE_INVALID_HANDLE* ::
  4411. +
  4412. --
  4413. This means the given handle for the current API function call, `handle`, was invalid.
  4414. This return code might be caused if
  4415. * `handle` is not a handle which has been obtained by VPU_DecOpen().
  4416. * `handle` is a handle of an instance which has been closed already, etc.
  4417. --
  4418. *RETCODE_INVALID_PARAM* ::
  4419. The given argument parameter, `info`, was invalid, which means it has a null
  4420. pointer, or given values for some member variables are improper values.
  4421. *RETCODE_FRAME_NOT_COMPLETE* ::
  4422. This means that frame decoding operation was not completed yet, so the given API function call cannot be allowed.
  4423. *RETCODE_WRONG_CALL_SEQUENCE* ::
  4424. This means the current API function call was invalid considering the allowed
  4425. sequences between API functions. In this case, HOST might call this
  4426. function before successfully putting bitstream data by calling
  4427. VPU_DecUpdateBitstreamBuffer(). In order to perform this functions call,
  4428. bitstream data including sequence level header should be transferred into
  4429. bitstream buffer before calling VPU_DecGetInitialInfo().
  4430. *RETCODE_CALLED_BEFORE* ::
  4431. This function call might be invalid, which means multiple calls of the current API
  4432. function for a given instance are not allowed. In this case, decoder initial
  4433. information has been already received, so that this function call is meaningless
  4434. and not allowed anymore.
  4435. *RETCODE_VPU_RESPONSE_TIMEOUT* ::
  4436. Operation has not received any response from VPU and has timed out.
  4437. @endverbatim
  4438. */
  4439. RetCode VPU_DecGetInitialInfo(
  4440. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4441. DecInitialInfo* info /**< [Output] A pointer to <<vpuapi_h_DecInitialInfo>> data structure */
  4442. );
  4443. /**
  4444. * @brief
  4445. @verbatim
  4446. This function starts decoding sequence header. Returning from this function does not mean
  4447. the completion of decoding sequence header, and it is just that decoding sequence header was initiated.
  4448. Every call of this function should be matched with VPU_DecCompleteSeqInit() with the same handle.
  4449. Without calling a pair of these funtions, HOST can not call any other API functions
  4450. except for VPU_DecGetBitstreamBuffer(), and VPU_DecUpdateBitstreamBuffer().
  4451. A pair of VPU_DecIssueSeqInit() and VPU_DecCompleteSeqInit() or just VPU_DecGetInitialInfo() should be called
  4452. at least once after creating a decoder instance and before starting frame decoding.
  4453. @endverbatim
  4454. *
  4455. * @return
  4456. @verbatim
  4457. *RETCODE_SUCCESS* ::
  4458. Operation was done successfully, which means the request for information of the stream data to be
  4459. decoded was sent successfully
  4460. *RETCODE_FAILURE* ::
  4461. Operation was failed, which means there was an error in getting information for configuring
  4462. the decoder.
  4463. *RETCODE_INVALID_HANDLE* ::
  4464. +
  4465. --
  4466. This means the given handle for the current API function call, `handle`, was invalid. This return
  4467. code might be caused if
  4468. * `handle` is not a handle which has been obtained by VPU_DecOpen().
  4469. * `handle` is a handle of an instance which has been closed already, etc.
  4470. --
  4471. *RETCODE_FRAME_NOT_COMPLETE* ::
  4472. This means frame decoding operation was not completed yet, so the given API function call
  4473. cannot be performed this time. A frame decoding operation should be completed by calling
  4474. VPU_DecIssueSeqInit(). Even though the result of the current frame operation is not necessary,
  4475. HOST should call VPU_DecIssueSeqInit() to proceed this function call.
  4476. *RETCODE_WRONG_CALL_SEQUENCE* ::
  4477. This means the current API function call was invalid considering the allowed sequences between
  4478. API functions. In this case, HOST application might call this function before successfully putting
  4479. bitstream data by calling VPU_DecUpdateBitstreamBuffer(). In order to perform this functions
  4480. call, bitstream data including sequence level header should be transferred into bitstream buffer
  4481. before calling VPU_ DecIssueSeqInit().
  4482. *RETCODE_QUEUEING_FAILURE* ::
  4483. This means that the current API function call cannot be queued because queue buffers are full at the moment.
  4484. @endverbatim
  4485. */
  4486. RetCode VPU_DecIssueSeqInit(
  4487. DecHandle handle /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4488. );
  4489. /**
  4490. * @brief This function returns the <<vpuapi_h_DecInitialInfo>> structure which holds crucial sequence information for decoder
  4491. such as picture size, number of necessary frame buffers, etc.
  4492. * @return
  4493. @verbatim
  4494. *RETCODE_SUCCESS* ::
  4495. Operation was done successfully, which means required information of the stream
  4496. data to be decoded was received successfully.
  4497. *RETCODE_FAILURE* ::
  4498. Operation was failed, which means there was a failure in getting sequence information for some reason - syntax errror, unableness to find sequence header, or
  4499. missing complete sequence header.
  4500. *RETCODE_INVALID_HANDLE* ::
  4501. +
  4502. --
  4503. This means the given handle for the current API function call, `handle`, was invalid. This return
  4504. code might be caused if
  4505. * `handle` is not a handle which has been obtained by VPU_DecOpen().
  4506. * `handle` is a handle of an instance which has been closed already, etc.
  4507. --
  4508. *RETCODE_INVALID_PARAM* ::
  4509. The given argument parameter, pInfo, was invalid, which means it has a null pointer, or given
  4510. values for some member variables are improper values.
  4511. *RETCODE_WRONG_CALL_SEQUENCE* ::
  4512. This means the current API function call was invalid considering the allowed sequences between
  4513. API functions. It might happen because VPU_DecIssueSeqInit () with the same handle was
  4514. not called before calling this function
  4515. *RETCODE_CALLED_BEFORE* ::
  4516. This function call might be invalid, which means multiple calls of the current API function for a given
  4517. instance are not allowed. In this case, decoder initial information has been already received,
  4518. so that this function call is meaningless and not allowed anymore.
  4519. @endverbatim
  4520. */
  4521. RetCode VPU_DecCompleteSeqInit(
  4522. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4523. DecInitialInfo* info /**< [Output] A pointer to <<vpuapi_h_DecInitialInfo>> data structure */
  4524. );
  4525. /**
  4526. * @brief
  4527. @verbatim
  4528. This is a special function to allow HOST to escape from waiting state while VPU_DecIssueSeqInit()/VPU_DecCompleteSeqInit() are executed.
  4529. When escape flag is set to 1 and stream buffer empty happens, VPU terminates VPU_DecIssueSeqInit()/VPU_DecCompleteSeqInit() operation
  4530. without issuing empty interrupt.
  4531. This function only works in ring buffer mode of bitstream buffer.
  4532. @endverbatim
  4533. * @return
  4534. @verbatim
  4535. *RETCODE_SUCCESS* ::
  4536. Operation was done successfully, which means Force escape flag is successfully set.
  4537. *RETCODE_INVALID_HANDLE* ::
  4538. +
  4539. --
  4540. This means the given handle for the current API function call, `handle`, was invalid. This return
  4541. code might be caused if
  4542. * `handle` is not the handle which has been obtained by VPU_DecOpen().
  4543. * `handle` is the handle of an instance which has been closed already, etc.
  4544. --
  4545. *RETCODE_INVALID_PARAM* ::
  4546. BitstreamMode of DecOpenParam structure is not BS_MODE_INTERRUPT (ring buffer mode).
  4547. @endverbatim
  4548. */
  4549. RetCode VPU_DecSetEscSeqInit(
  4550. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4551. int escape /**< [Input] A flag to enable or disable forced escape from SEQ_INIT */
  4552. );
  4553. /**
  4554. * @brief This function is used for registering frame buffers with the acquired
  4555. information from VPU_DecGetInitialInfo() or VPU_DecCompleteSeqInit(). The frame buffers pointed to by
  4556. bufArray are managed internally within VPU. These include reference
  4557. frames, reconstructed frame, etc. `num` must
  4558. not be less than `minFrameBufferCount` obtained by VPU_DecGetInitialInfo() or VPU_DecCompleteSeqInit().
  4559. * @return
  4560. @verbatim
  4561. *RETCODE_SUCCESS* ::
  4562. Operation was done successfully, which means registering frame buffer
  4563. information was done successfully.
  4564. *RETCODE_INVALID_HANDLE* ::
  4565. +
  4566. --
  4567. This means the given handle for the current API function call, `handle`, was invalid.
  4568. This return code might be caused if
  4569. * `handle` is not a handle which has been obtained by VPU_DecOpen().
  4570. * `handle` is a handle of an instance which has been closed already, etc.
  4571. --
  4572. *RETCODE_FRAME_NOT_COMPLETE* ::
  4573. This means VPU operation was not completed yet, so the given API
  4574. function call cannot be performed this time.
  4575. *RETCODE_WRONG_CALL_SEQUENCE* ::
  4576. This means the current API function call was invalid considering the allowed
  4577. sequences between API functions. HOST might call this
  4578. function before calling VPU_DecGetInitialInfo() successfully. This function
  4579. should be called after successful calling VPU_DecGetInitialInfo().
  4580. *RETCODE_INVALID_FRAME_BUFFER* ::
  4581. This happens when pBuffer was invalid, which means pBuffer was not initialized
  4582. yet or not valid anymore.
  4583. *RETCODE_INSUFFICIENT_FRAME_BUFFERS* ::
  4584. This means the given number of frame buffers, num, was not enough for the
  4585. decoder operations of the given handle. It should be greater than or equal to
  4586. the value requested by VPU_DecGetInitialInfo().
  4587. *RETCODE_INVALID_STRIDE* ::
  4588. The given argument stride was invalid, which means it is smaller than the
  4589. decoded picture width, or is not a multiple of AXI bus width in this case.
  4590. *RETCODE_CALLED_BEFORE* ::
  4591. This function call is invalid which means multiple calls of the current API function
  4592. for a given instance are not allowed. In this case, registering decoder frame
  4593. buffers has been already done, so that this function call is meaningless and not
  4594. allowed anymore.
  4595. *RETCODE_VPU_RESPONSE_TIMEOUT* ::
  4596. Operation has not recieved any response from VPU and has timed out.
  4597. @endverbatim
  4598. */
  4599. RetCode VPU_DecRegisterFrameBuffer(
  4600. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4601. FrameBuffer* bufArray, /**< [Input] The allocated frame buffer address and information in <<vpuapi_h_FrameBuffer>>. If this parameter is NULL, this function (not HOST application) allocates frame buffers. */
  4602. int num, /**< [Input] A number of frame buffers. VPU can allocate frame buffers as many as this given value. */
  4603. int stride, /**< [Input] A stride value of the given frame buffers */
  4604. int height, /**< [Input] A frame height */
  4605. int mapType /**< [Input] A Map type for GDI inferface or FBC (Frame Buffer Compression) in <<vpuapi_h_TiledMapType>> */
  4606. );
  4607. /**
  4608. * @brief This function is used for registering frame buffers with the acquired
  4609. information from VPU_DecGetInitialInfo() or VPU_DecCompleteSeqInit().
  4610. This function is functionally same as VPU_DecRegisterFrameBuffer(), but
  4611. it can give linear (display) frame buffers and compressed buffers separately with different numbers
  4612. unlike the way VPU_DecRegisterFrameBuffer() does.
  4613. VPU_DecRegisterFrameBuffer() assigns only the same number of frame buffers for linear buffer and for compressed buffer,
  4614. which can take up huge memory space.
  4615. * @return
  4616. @verbatim
  4617. *RETCODE_SUCCESS* ::
  4618. Operation was done successfully, which means registering frame buffer
  4619. information was done successfully.
  4620. *RETCODE_INVALID_HANDLE* ::
  4621. +
  4622. --
  4623. This means the given handle for the current API function call, `handle`, was invalid.
  4624. This return code might be caused if
  4625. * `handle` is not a handle which has been obtained by VPU_DecOpen().
  4626. * `handle` is a handle of an instance which has been closed already, etc.
  4627. --
  4628. *RETCODE_FRAME_NOT_COMPLETE* ::
  4629. This means VPU operation was not completed yet, so the given API
  4630. function call cannot be performed this time.
  4631. *RETCODE_WRONG_CALL_SEQUENCE* ::
  4632. This means the current API function call was invalid considering the allowed
  4633. sequences between API functions. HOST might call this
  4634. function before calling VPU_DecGetInitialInfo() successfully. This function
  4635. should be called after successful calling VPU_DecGetInitialInfo().
  4636. *RETCODE_INVALID_FRAME_BUFFER* ::
  4637. This happens when pBuffer was invalid, which means pBuffer was not initialized
  4638. yet or not valid anymore.
  4639. *RETCODE_INSUFFICIENT_FRAME_BUFFERS* ::
  4640. This means the given number of frame buffers, num, was not enough for the
  4641. decoder operations of the given handle. It should be greater than or equal to
  4642. the value requested by VPU_DecGetInitialInfo().
  4643. *RETCODE_INVALID_STRIDE* ::
  4644. The given argument stride was invalid, which means it is smaller than the
  4645. decoded picture width, or is not a multiple of AXI bus width in this case.
  4646. *RETCODE_CALLED_BEFORE* ::
  4647. This function call is invalid which means multiple calls of the current API function
  4648. for a given instance are not allowed. In this case, registering decoder frame
  4649. buffers has been already done, so that this function call is meaningless and not
  4650. allowed anymore.
  4651. *RETCODE_VPU_RESPONSE_TIMEOUT* ::
  4652. Operation has not recieved any response from VPU and has timed out.
  4653. @endverbatim
  4654. */
  4655. RetCode VPU_DecRegisterFrameBufferEx(
  4656. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4657. FrameBuffer* bufArray, /**< [Input] The allocated frame buffer address and information in <<vpuapi_h_FrameBuffer>>. If this parameter is NULL, this function (not HOST application) allocates frame buffers. */
  4658. int numOfDecFbs, /**< [Input] The number of compressed frame buffer */
  4659. int numOfDisplayFbs, /**< [Input] The number of linear frame buffer when WTL is enabled. In WAVE, this should be equal to or larger than framebufDelay of <<vpuapi_h_DecInitialInfo>> + 2. */
  4660. int stride, /**< [Input] A stride value of the given frame buffers */
  4661. int height, /**< [Input] A frame height */
  4662. int mapType /**< [Input] A Map type for GDI inferface or FBC (Frame Buffer Compression) in <<vpuapi_h_TiledMapType>> */
  4663. );
  4664. /**
  4665. * @brief
  4666. This is a special function for VP9 decoder that allows HOST application to replace one of the registered array of frame buffers
  4667. with a single new set of frame buffers - linear frame buffer, FBC frame buffer, and ColMv buffer.
  4668. This is the dedicated function only for the case that a new inter-frame is coded using a different resolution
  4669. than the previous frame.
  4670. * @return
  4671. @verbatim
  4672. *RETCODE_SUCCESS* ::
  4673. Operation was done successfully, which means registering frame buffer
  4674. information was done successfully.
  4675. *RETCODE_INVALID_HANDLE* ::
  4676. +
  4677. --
  4678. This means the given handle for the current API function call, `handle`, was invalid.
  4679. This return code might be caused if
  4680. * `handle` is not a handle which has been obtained by VPU_DecOpen().
  4681. * `handle` is a handle of an instance which has been closed already, etc.
  4682. --
  4683. *RETCODE_NOT_SUPPORTED_FEATURE* ::
  4684. This means that HOST application uses this API call in other than VP9 decoder.
  4685. *RETCODE_INSUFFICIENT_RESOURCE* ::
  4686. This means failure to allocate a framebuffer due to lack of memory.
  4687. *RETCODE_VPU_RESPONSE_TIMEOUT* ::
  4688. Operation has not recieved any response from VPU and has timed out.
  4689. @endverbatim
  4690. */
  4691. RetCode VPU_DecUpdateFrameBuffer(
  4692. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4693. FrameBuffer* fbcFb, /**< [Input] The new FBC frame buffer index */
  4694. FrameBuffer* linearFb, /**< [Input] The new linear frame buffer index */
  4695. Int32 mvColIndex, /**< [Input] The new co-located motion vector buffer index */
  4696. Int32 picWidth, /**< [Input] The new frame width */
  4697. Int32 picHeight /**< [Input] The new frame height */
  4698. );
  4699. /**
  4700. * @brief
  4701. This is a special function that allows HOST to allocate directly the frame buffer
  4702. for decoding (Recon) or for display or post-processor unit (PPU) such as Rotator
  4703. or Tiled2Linear.
  4704. In normal operation, VPU API allocates frame buffers when the argument `bufArray` in VPU_DecRegisterFrameBuffer() is set to 0.
  4705. However, for any other reason HOST can use this function to allocate frame buffers by themselves.
  4706. * @return
  4707. @verbatim
  4708. *RETCODE_SUCCESS* ::
  4709. Operation was done successfully, which means the framebuffer is allocated successfully.
  4710. *RETCODE_INVALID_HANDLE* ::
  4711. This means the given handle for the current API function call, handle, was invalid. This return code might be caused if
  4712. +
  4713. --
  4714. * `handle` is not the handle which has been obtained by VPU_DecOpen().
  4715. * `handle` is the handle of an instance which has been closed already, etc.
  4716. --
  4717. *RETCODE_WRONG_CALL_SEQUENCE* ::
  4718. This means the current API function call was invalid considering the allowed sequences between API functions.
  4719. It might happen because VPU_DecRegisterFrameBuffer() for (FramebufferAllocType.FB_TYPE_CODEC) has not been called,
  4720. before this function call for allocating frame buffer for PPU (FramebufferAllocType.FB_TYPE_PPU).
  4721. *RETCODE_INSUFFICIENT_RESOURCE* ::
  4722. This means failure to allocate a framebuffer due to lack of memory
  4723. *RETCODE_INVALID_PARAM* ::
  4724. The given argument parameter, index, was invalid, which means it has improper values.
  4725. @endverbatim
  4726. */
  4727. RetCode VPU_DecAllocateFrameBuffer(
  4728. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4729. FrameBufferAllocInfo info, /**< [Input] <<vpuapi_h_FrameBufferAllocInfo>> */
  4730. FrameBuffer* frameBuffer /**< [Output] <<vpuapi_h_FrameBuffer>> structure that holds information of allocated frame buffers */
  4731. );
  4732. /**
  4733. * @brief
  4734. @verbatim
  4735. This function returns frame buffer information of the given frame buffer index.
  4736. It does not affect actual decoding and simply does obtain the information of frame buffer.
  4737. This function is more helpful especially when frame buffers are automatically assigned in VPU_DecRegisterFrameBuffer() and HOST wants to know about the allocated frame buffer.
  4738. @endverbatim
  4739. *
  4740. * @return
  4741. @verbatim
  4742. *RETCODE_SUCCESS* ::
  4743. Operation was done successfully, which means registering frame buffer
  4744. information was done successfully.
  4745. *RETCODE_INVALID_HANDLE* ::
  4746. +
  4747. --
  4748. This means the given handle for the current API function call, `handle`, was invalid.
  4749. This return code might be caused if
  4750. * `handle` is not a handle which has been obtained by VPU_DecOpen().
  4751. * `handle` is a handle of an instance which has been closed already, etc.
  4752. --
  4753. *RETCODE_INVALID_PARAM* ::
  4754. The given argument parameter, frameIdx, was invalid, which means frameIdx is larger than allocated framebuffer.
  4755. @endverbatim
  4756. */
  4757. RetCode VPU_DecGetFrameBuffer(
  4758. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4759. int frameIdx, /**< [Input] An index of frame buffer */
  4760. FrameBuffer* frameBuf /**< [Output] Allocated frame buffer address and information in <<vpuapi_h_FrameBuffer>>. */
  4761. );
  4762. /**
  4763. * @brief This function starts decoding one frame.
  4764. For the completion of decoding one frame, VPU_DecGetOutputInfo() should be called
  4765. with the same handle.
  4766. *
  4767. * @return
  4768. @verbatim
  4769. *RETCODE_SUCCESS* ::
  4770. +
  4771. --
  4772. Operation was done successfully, which means decoding a new frame was started
  4773. successfully.
  4774. NOTE: This return value does not mean that decoding a frame was completed
  4775. successfully.
  4776. --
  4777. *RETCODE_INVALID_HANDLE* ::
  4778. +
  4779. --
  4780. This means the given handle for the current API function call, `handle`, was invalid.
  4781. This return code might be caused if
  4782. * `handle` is not a handle which has been obtained by VPU_DecOpen().
  4783. * `handle` is a handle of an instance which has been closed already, etc.
  4784. --
  4785. *RETCODE_FRAME_NOT_COMPLETE* ::
  4786. This means VPU operation was not completed yet, so the given API
  4787. function call cannot be performed this time.
  4788. *RETCODE_WRONG_CALL_SEQUENCE* ::
  4789. This means the current API function call was invalid considering the allowed
  4790. sequences between API functions. HOST might call this
  4791. function before successfully calling VPU_DecRegisterFrameBuffer(). This function
  4792. should be called after calling VPU_ DecRegisterFrameBuffer() successfully.
  4793. *RETCODE_QUEUEING_FAILURE* ::
  4794. This means that the current API function call cannot be queued because queue buffers are full at the moment.
  4795. @endverbatim
  4796. */
  4797. RetCode VPU_DecStartOneFrame(
  4798. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4799. DecParam *param /**< [Input] <<vpuapi_h_DecParam>> which describes picture decoding parameters for the given decoder instance */
  4800. );
  4801. /**
  4802. * @brief VPU returns the result of frame decoding which
  4803. includes information on decoded picture, syntax value, frame buffer, other report values, and etc.
  4804. HOST should call this function after frame decoding is finished.
  4805. * @return
  4806. @verbatim
  4807. *RETCODE_SUCCESS* ::
  4808. Operation was done successfully, which means receiving the output information of the
  4809. current frame was done successfully.
  4810. *RETCODE_FAILURE* ::
  4811. Operation was failed, which means there was an error in getting information for
  4812. configuring the decoder.
  4813. *RETCODE_INVALID_HANDLE* ::
  4814. This means argument handle is invalid. This includes cases where `handle` is not
  4815. a handle which has been obtained by VPU_DecOpen(), `handle` is a handle to an
  4816. instance already closed, or `handle` is a handle to a decoder instance.
  4817. *RETCODE_INVALID_PARAM* ::
  4818. The given argument parameter, pInfo, was invalid, which means it has a null
  4819. pointer, or given values for some member variables are improper values.
  4820. *RETCODE_QUERY_FAILURE* ::
  4821. This means this query command was not successful. (WAVE5 only)
  4822. *RETCODE_REPORT_NOT_READY* ::
  4823. This means that report is not ready for this query(GET_RESULT) command. (WAVE5 only)
  4824. @endverbatim
  4825. */
  4826. RetCode VPU_DecGetOutputInfo(
  4827. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4828. DecOutputInfo* info /**< [Output] A pointer to <<vpuapi_h_DecOutputInfo>> which describes picture decoding results for the current decoder instance. */
  4829. );
  4830. /**
  4831. * @brief This function executes an additional command such to set Secondary AXI or to report user data which is given by HOST application.
  4832. It allows HOST application to set directly the variables that can be set only through the API layer.
  4833. Some command-specific return codes are also presented.
  4834. * @return
  4835. @verbatim
  4836. *RETCODE_INVALID_COMMAND* ::
  4837. The given argument, cmd, was invalid, which means the given cmd was undefined,
  4838. or not allowed in the current instance.
  4839. *RETCODE_INVALID_HANDLE* ::
  4840. +
  4841. --
  4842. This means the given handle for the current API function call, `handle`, was invalid.
  4843. This return code might be caused if
  4844. * `handle` is not a handle which has been obtained by VPU_DecOpen().
  4845. * `handle` is a handle of an instance which has been closed already, etc.
  4846. --
  4847. *RETCODE_FRAME_NOT_COMPLETE* ::
  4848. This means VPU operation was not completed yet, so the given API
  4849. function call cannot be performed this time.
  4850. *RETCODE_VPU_RESPONSE_TIMEOUT* ::
  4851. Operation has not received any response from VPU and has timed out.
  4852. *RETCODE_QUEUEING_FAILURE* ::
  4853. This means that the current API function call cannot be queued because queue buffers are full at the moment.
  4854. @endverbatim
  4855. */
  4856. RetCode VPU_DecGiveCommand(
  4857. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4858. CodecCommand cmd, /**< [Input] A variable specifying the given command of <<vpuapi_h_CodecCommand>> */
  4859. void* parameter /**< [Input/Output] A pointer to command-specific data structure which describes picture I/O parameters for the current decoder instance */
  4860. );
  4861. /**
  4862. * @brief
  4863. @verbatim
  4864. This function returns the read pointer, write pointer, available space of the bitstream in ringbuffer mode.
  4865. Before decoding bitstream, HOST application must feed the decoder with bitstream. To
  4866. do that, HOST application must know where to put bitstream and the maximum size.
  4867. Applications can get the information by calling this function. This way is more
  4868. efficient than providing arbitrary bitstream buffer to the decoder as far as
  4869. VPU is concerned.
  4870. The given size is the total sum of free space in ring buffer. So when
  4871. HOST application downloads this given size of bitstream, Wrptr could meet the end of
  4872. stream buffer. In this case, the HOST application should wrap-around the Wrptr back to the
  4873. beginning of stream buffer, and download the remaining bits. If not, decoder
  4874. operation could be crashed.
  4875. @endverbatim
  4876. *
  4877. * @return
  4878. @verbatim
  4879. *RETCODE_SUCCESS* ::
  4880. Operation was done successfully, which means required information for decoder
  4881. stream buffer was received successfully.
  4882. *RETCODE_INVALID_HANDLE* ::
  4883. +
  4884. --
  4885. This means the given handle for the current API function call, `handle`, was invalid.
  4886. This return code might be caused if
  4887. * `handle` is not the handle which has been obtained by VPU_DecOpen().
  4888. * `handle` is the handle of an instance which has been closed already, etc.
  4889. --
  4890. *RETCODE_INVALID_PARAM* ::
  4891. The given argument parameter, pRdptr, pWrptr or size, was invalid, which means
  4892. it has a null pointer, or given values for some member variables are improper
  4893. values.
  4894. @endverbatim
  4895. */
  4896. RetCode VPU_DecGetBitstreamBuffer(
  4897. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4898. PhysicalAddress *prdPrt, /**< [Output] A stream buffer read pointer for the current decoder instance */
  4899. PhysicalAddress *pwrPtr, /**< [Output] A stream buffer write pointer for the current decoder instance */
  4900. Uint32 *size /**< [Output] A variable specifying the available space in bitstream buffer for the current decoder instance */
  4901. );
  4902. /**
  4903. * @brief This function notifies VPU of how much bitstream has been transferred to the bitstream buffer.
  4904. By just giving the size as an argument, API automatically handles pointer wrap-around and updates the write
  4905. pointer.
  4906. *
  4907. * @return
  4908. @verbatim
  4909. *RETCODE_SUCCESS* ::
  4910. Operation was done successfully, which means putting new stream data was done successfully.
  4911. *RETCODE_INVALID_HANDLE* ::
  4912. +
  4913. --
  4914. This means the given handle for the current API function call, `handle`, was invalid.
  4915. This return code might be caused if
  4916. * `handle` is not the handle which has been obtained by VPU_DecOpen().
  4917. * `handle` is the handle of an instance which has been closed already, etc.
  4918. --
  4919. *RETCODE_INVALID_PARAM* ::
  4920. The given argument parameter, size, was invalid, which means size is larger than
  4921. the value obtained from VPU_DecGetBitstreamBuffer(), or than the available space
  4922. in the bitstream buffer.
  4923. @endverbatim
  4924. */
  4925. RetCode VPU_DecUpdateBitstreamBuffer(
  4926. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4927. /**
  4928. @verbatim
  4929. [Input]
  4930. A variable specifying the amount of bits transferred into bitstream buffer for the current decoder instance.
  4931. @* 0 : It means that no more bitstream exists to feed (end of stream).
  4932. If 0 is set for `size`, VPU decodes just remaing bitstream and returns -1 to `indexFrameDisplay`.
  4933. @* -1: It enables to resume decoding without calling VPU_DecClose()
  4934. after remaining stream has completely been decoded to the end of stream by VPU_DecUpdateBitstreamBuffer(handle, 0).
  4935. @* -2 : It enables to decode until the current write pointer and force to end decoding.
  4936. It is for an exceptional case such as failure of finding sequence header in interrupt mode.
  4937. If that happens, VPU is in a state seeking sequence header, while HOST keeps feeding to the end of bistream, but never gets
  4938. the command done signal for a long time.
  4939. @endverbatim
  4940. */
  4941. int size
  4942. );
  4943. /**
  4944. * @brief
  4945. This function specifies the location of read pointer in bitstream buffer.
  4946. It can also set a write pointer with a same value of read pointer (addr) when updateWrPtr is not a zero value.
  4947. This function is used to operate bitstream buffer in PicEnd mode.
  4948. * @return
  4949. @verbatim
  4950. *RETCODE_SUCCESS* ::
  4951. Operation was done successfully, which means required information of the stream data to be
  4952. decoded was received successfully.
  4953. *RETCODE_FAILURE* ::
  4954. Operation was failed, which means there was an error in getting information for configuring
  4955. the decoder.
  4956. *RETCODE_INVALID_HANDLE* ::
  4957. +
  4958. --
  4959. This means the given handle for the current API function call, `handle`, was invalid. This return
  4960. code might be caused if
  4961. * `handle` is not a handle which has been obtained by VPU_DecOpen().
  4962. * `handle` is a handle of an instance which has been closed already, etc.
  4963. --
  4964. *RETCODE_FRAME_NOT_COMPLETE* ::
  4965. This means frame decoding operation was not completed yet, so the given API function call
  4966. cannot be performed this time. A frame decoding operation should be completed by calling
  4967. VPU_ DecSetRdPtr().
  4968. @endverbatim
  4969. */
  4970. RetCode VPU_DecSetRdPtr(
  4971. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  4972. PhysicalAddress addr, /**< [Input] Updated read or write pointer */
  4973. int updateWrPtr /**< [Input] A flag whether to move the write pointer to where the read pointer is located */
  4974. );
  4975. /**
  4976. * @brief
  4977. @verbatim
  4978. This function flushes all of the decoded framebuffer contexts that remain in decoder firmware.
  4979. It can be used to do random access (like skip picture) or to continue seamless decode operation without calling VPU_DecClose()
  4980. after change of sequence.
  4981. NOTE: In WAVE, this function returns all of the decoded framebuffer contexts that remain.
  4982. pRetNum always has 0 in CODA9.
  4983. @endverbatim
  4984. *
  4985. * @return
  4986. @verbatim
  4987. *RETCODE_SUCCESS* ::
  4988. Operation was done successfully, which means receiving the output information of the
  4989. current frame was done successfully.
  4990. *RETCODE_FRAME_NOT_COMPLETE* ::
  4991. This means frame decoding operation was not completed yet, so the given API
  4992. function call cannot be performed this time. A frame decoding operation should
  4993. be completed by calling VPU_DecGetOutputInfo(). Even though the result of the
  4994. current frame operation is not necessary, HOST should call
  4995. VPU_DecGetOutputInfo() to proceed this function call.
  4996. *RETCODE_INVALID_HANDLE* ::
  4997. This means argument handle is invalid. This includes cases where `handle` is not
  4998. a handle which has been obtained by VPU_DecOpen(), `handle` is a handle to an
  4999. instance already closed, or `handle` is a handle to an decoder instance.
  5000. Also,this value is returned when VPU_DecStartOneFrame() is matched with
  5001. VPU_DecGetOutputInfo() with different handles.
  5002. *RETCODE_VPU_RESPONSE_TIMEOUT* ::
  5003. Operation has not recieved any response from VPU and has timed out.
  5004. @endverbatim
  5005. */
  5006. RetCode VPU_DecFrameBufferFlush(
  5007. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  5008. DecOutputInfo* pRemainingInfo, /**< [Output] All of the decoded framebuffer contexts are stored in display order as array of <<vpuapi_h_DecOutputInfo>>.
  5009. If this is NULL, the remaining information is not returned. */
  5010. Uint32* pRetNum /**< [Output] The number of the decoded frame buffer contexts. It this is null, the information is not returned. */
  5011. );
  5012. /**
  5013. * @brief This function clears a display flag of the given index of frame buffer.
  5014. If the display flag of frame buffer is cleared, the
  5015. frame buffer can be reused in the decoding process.
  5016. VPU API keeps the display index of frame buffer remained until VPU_DecClrDispFlag() is called.
  5017. * @return
  5018. @verbatim
  5019. *RETCODE_SUCCESS* ::
  5020. Operation was done successfully, which means receiving the output information of the
  5021. current frame was done successfully.
  5022. *RETCODE_INVALID_HANDLE* ::
  5023. This means argument handle is invalid. This includes cases where `handle` is not
  5024. a handle which has been obtained by VPU_DecOpen(), `handle` is a handle to an
  5025. instance already closed, or `handle` is a handle to an decoder instance.
  5026. Also,this value is returned when VPU_DecStartOneFrame() is matched with
  5027. VPU_DecGetOutputInfo() with different handles.
  5028. *RETCODE_WRONG_CALL_SEQUENCE* ::
  5029. This means the current API function call was invalid considering the allowed
  5030. sequences between API functions.
  5031. It might happen because VPU_DecRegisterFrameBuffer() with the
  5032. same handle was not called before calling this function.
  5033. *RETCODE_INVALID_PARAM* ::
  5034. The given argument parameter, index, was invalid, which means it has improper
  5035. values.
  5036. @endverbatim
  5037. */
  5038. RetCode VPU_DecClrDispFlag(
  5039. DecHandle handle, /**< [Input] A decoder handle obtained from VPU_DecOpen() */
  5040. int index /**< [Input] A frame buffer index to be cleared */
  5041. );
  5042. // function for encode
  5043. /**
  5044. * @brief This function opens an encoder instance in order to start a new encoder operation.
  5045. By calling this function, HOST application can get a
  5046. handle specifying a new encoder instance. Because VPU supports multiple
  5047. instances of codec operations, HOST application needs this kind of handles for the
  5048. all codec instances now on running. Once HOST application gets a handle, the HOST application
  5049. must use this handle to represent the target instances for all subsequent
  5050. encoder-related functions.
  5051. * @return
  5052. @verbatim
  5053. *RETCODE_SUCCESS* ::
  5054. Operation was done successfully, which means a new encoder instance was opened
  5055. successfully.
  5056. *RETCODE_FAILURE* ::
  5057. Operation was failed, which means getting a new encoder instance was not done
  5058. successfully. If there is no free instance anymore, this value is returned
  5059. in this function call.
  5060. *RETCODE_INVALID_PARAM* ::
  5061. The given argument parameter, pOpenParam, was invalid, which means it has a null
  5062. pointer, or given values for some member variables are improper values.
  5063. *RETCODE_NOT_INITIALIZED* ::
  5064. VPU was not initialized at all before calling this function. Application should
  5065. initialize VPU by calling VPU_Init() before calling this function.
  5066. @endverbatim
  5067. */
  5068. RetCode VPU_EncOpen(
  5069. EncHandle* handle, /**< [Output] A pointer to EncHandle type variable which specifies each instance for HOST application. If no instance is available, null handle is returned. */
  5070. EncOpenParam* encOpParam /**< [Input] A pointer to <<vpuapi_h_EncOpenParam>> structure which describes required parameters for creating a new encoder instance. */
  5071. );
  5072. /**
  5073. * @brief This function closes the given encoder instance.
  5074. By calling this function, HOST application can end encoding of the sequence and release the instance.
  5075. After completion of this function call, relevant resources of the instance get
  5076. free. Once HOST application closes an instance, the HOST application cannot call any further
  5077. encoder-specific function with the current handle before re-opening a new
  5078. encoder instance with the same handle.
  5079. * @return
  5080. @verbatim
  5081. *RETCODE_SUCCESS* ::
  5082. Operation was done successfully. That means the current encoder instance was closed
  5083. successfully.
  5084. *RETCODE_INVALID_HANDLE* ::
  5085. This means the given handle for the current API function call, pHandle, was invalid.
  5086. This return code might be caused if
  5087. +
  5088. --
  5089. * pHandle is not a handle which has been obtained by VPU_EncOpen().
  5090. * pHandle is a handle of an instance which has been closed already, etc.
  5091. --
  5092. *RETCODE_FRAME_NOT_COMPLETE* ::
  5093. This means frame decoding or encoding operation was not completed yet, so the
  5094. given API function call cannot be performed this time. A frame encoding or
  5095. decoding operation should be completed by calling VPU_EncGetOutputInfo() or
  5096. VPU_DecGetOutputInfo(). Even though the result of the current frame operation is
  5097. not necessary, HOST application should call VPU_EncGetOutputInfo() or
  5098. VPU_DecGetOutputInfo() to proceed this function call.
  5099. *RETCODE_VPU_RESPONSE_TIMEOUT* ::
  5100. Operation has not recieved any response from VPU and has timed out.
  5101. @endverbatim
  5102. */
  5103. RetCode VPU_EncClose(
  5104. EncHandle handle /**< [Input] An encoder handle obtained from VPU_EncOpen() */
  5105. );
  5106. /**
  5107. * @brief This function sets sequence information including source width and height
  5108. and many other parameters such as coding tools, GOP preset, rate control, etc.
  5109. It also returns the required parameters such as minFrameBufferCount. (CODA9 only)
  5110. * @return
  5111. @verbatim
  5112. *RETCODE_SUCCESS* ::
  5113. Operation was done successfully, which means receiving the initial parameters
  5114. was done successfully.
  5115. *RETCODE_FAILURE* ::
  5116. Operation was failed, which means there was an error in getting information for
  5117. configuring the encoder.
  5118. *RETCODE_INVALID_HANDLE* ::
  5119. This means the given handle for the current API function call, pHandle, was invalid.
  5120. This return code might be caused if
  5121. * pHandle is not a handle which has been obtained by VPU_EncOpen().
  5122. * pHandle is a handle of an instance which has been closed already, etc.
  5123. *RETCODE_FRAME_NOT_COMPLETE* ::
  5124. This means frame decoding or encoding operation was not completed yet, so the
  5125. given API function call cannot be performed this time. A frame encoding or
  5126. decoding operation should be completed by calling VPU_EncGetOutputInfo() or
  5127. VPU_DecGetOutputInfo(). Even though the result of the current frame operation is
  5128. not necessary, HOST application should call VPU_EncGetOutputInfo() or
  5129. VPU_DecGetOutputInfo() to proceed this function call.
  5130. *RETCODE_INVALID_PARAM* ::
  5131. The given argument parameter, pInitialInfo, was invalid, which means it has a
  5132. null pointer, or given values for some member variables are improper values.
  5133. *RETCODE_CALLED_BEFORE* ::
  5134. This function call is invalid which means multiple calls of the current API function
  5135. for a given instance are not allowed. In this case, encoder initial information
  5136. has been received already, so that this function call is meaningless and not
  5137. allowed anymore.
  5138. *RETCODE_VPU_RESPONSE_TIMEOUT* ::
  5139. Operation has not recieved any response from VPU and has timed out.
  5140. @endverbatim
  5141. */
  5142. RetCode VPU_EncGetInitialInfo(
  5143. EncHandle handle, /**< [Input] An encoder handle obtained from VPU_EncOpen() */
  5144. EncInitialInfo* encInitInfo /**< [Output] A pointer to <<vpuapi_h_EncInitialInfo>> structure which describes required sequence information for the current encoder instance. */
  5145. );
  5146. /**
  5147. * @brief Before starting encoder operation, HOST application should set sequence information including source width and height
  5148. and many other parameters such as coding tools, GOP preset, rate control, etc. (WAVE only)
  5149. * @return
  5150. @verbatim
  5151. *RETCODE_SUCCESS* ::
  5152. Operation was done successfully, which means receiving the initial parameters
  5153. was done successfully.
  5154. *RETCODE_FAILURE* ::
  5155. Operation was failed, which means there was an error in getting information for
  5156. configuring the encoder.
  5157. *RETCODE_INVALID_HANDLE* ::
  5158. This means the given handle for the current API function call, pHandle, was invalid.
  5159. This return code might be caused if
  5160. * pHandle is not a handle which has been obtained by VPU_EncOpen().
  5161. * pHandle is a handle of an instance which has been closed already, etc.
  5162. *RETCODE_FRAME_NOT_COMPLETE* ::
  5163. This means frame decoding or encoding operation was not completed yet, so the
  5164. given API function call cannot be performed this time. A frame encoding or
  5165. decoding operation should be completed by calling VPU_EncGetOutputInfo() or
  5166. VPU_DecGetOutputInfo(). Even though the result of the current frame operation is
  5167. not necessary, HOST application should call VPU_EncGetOutputInfo() or
  5168. VPU_DecGetOutputInfo() to proceed this function call.
  5169. *RETCODE_INVALID_PARAM* ::
  5170. The given argument parameter, pInitialInfo, was invalid, which means it has a
  5171. null pointer, or given values for some member variables are improper values.
  5172. *RETCODE_CALLED_BEFORE* ::
  5173. This function call is invalid which means multiple calls of the current API function
  5174. for a given instance are not allowed. In this case, encoder initial information
  5175. has been received already, so that this function call is meaningless and not
  5176. allowed anymore.
  5177. *RETCODE_QUEUEING_FAILURE* ::
  5178. This means that the current API function call cannot be queued because queue buffers are full at the moment.
  5179. @endverbatim
  5180. */
  5181. RetCode VPU_EncIssueSeqInit(
  5182. EncHandle handle /**< [Input] A encoder handle obtained from VPU_EncOpen() */
  5183. );
  5184. /**
  5185. * @brief Before starting encoder operation, HOST application must allocate frame buffers
  5186. according to the information obtained from this function. This function returns the required parameters such as minFrameBufferCount. (WAVE only)
  5187. * @return
  5188. @verbatim
  5189. *RETCODE_SUCCESS* ::
  5190. Operation was done successfully, which means receiving the initial parameters
  5191. was done successfully.
  5192. *RETCODE_FAILURE* ::
  5193. Operation was failed, which means there was an error in getting information for
  5194. configuring the encoder.
  5195. *RETCODE_INVALID_HANDLE* ::
  5196. This means the given handle for the current API function call, pHandle, was invalid.
  5197. This return code might be caused if
  5198. * pHandle is not a handle which has been obtained by VPU_EncOpen().
  5199. * pHandle is a handle of an instance which has been closed already, etc.
  5200. *RETCODE_FRAME_NOT_COMPLETE* ::
  5201. This means frame decoding or encoding operation was not completed yet, so the
  5202. given API function call cannot be performed this time. A frame encoding or
  5203. decoding operation should be completed by calling VPU_EncGetOutputInfo() or
  5204. VPU_DecGetOutputInfo(). Even though the result of the current frame operation is
  5205. not necessary, HOST application should call VPU_EncGetOutputInfo() or
  5206. VPU_DecGetOutputInfo() to proceed this function call.
  5207. *RETCODE_INVALID_PARAM* ::
  5208. The given argument parameter, pInitialInfo, was invalid, which means it has a
  5209. null pointer, or given values for some member variables are improper values.
  5210. *RETCODE_CALLED_BEFORE* ::
  5211. This function call is invalid which means multiple calls of the current API function
  5212. for a given instance are not allowed. In this case, encoder initial information
  5213. has been received already, so that this function call is meaningless and not
  5214. allowed anymore.
  5215. @endverbatim
  5216. */
  5217. RetCode VPU_EncCompleteSeqInit(
  5218. EncHandle handle, /**< [Input] A encoder handle obtained from VPU_EncOpen() */
  5219. EncInitialInfo * info /**< [Output] A pointer to <<vpuapi_h_EncInitialInfo>> structure which describes required sequence information for the current encoder instance. */
  5220. );
  5221. /**
  5222. * @brief
  5223. @verbatim
  5224. This function registers frame buffers requested by VPU_EncGetInitialInfo(). The
  5225. frame buffers pointed to by pBuffer are managed internally within VPU.
  5226. These include reference frames, reconstructed frames, etc. Applications must not
  5227. change the contents of the array of frame buffers during the life time of the
  5228. instance, and `num` must not be less than minFrameBufferCount obtained by
  5229. VPU_EncGetInitialInfo().
  5230. The distance between a pixel in a row and the corresponding pixel in the next
  5231. row is called a stride. The value of stride must be a multiple of 8. The
  5232. address of the first pixel in the second row does not necessarily coincide with
  5233. the value next to the last pixel in the first row. In other words, a stride can
  5234. be greater than the picture width in pixels.
  5235. Applications should not set a stride value smaller than the picture width.
  5236. So, for Y component, HOST application must allocate at least a space of size
  5237. (frame height \* stride), and Cb or Cr component,
  5238. (frame height/2 \* stride/2), respectively.
  5239. But make sure that in Cb/Cr non-interleave (separate Cb/Cr) map,
  5240. a stride for the luminance frame buffer should be multiple of 16 so that a stride
  5241. for the chrominance frame buffer becomes a multiple of 8.
  5242. @endverbatim
  5243. * @return
  5244. @verbatim
  5245. *RETCODE_SUCCESS* ::
  5246. Operation was done successfully, which means registering frame buffers were done
  5247. successfully.
  5248. *RETCODE_INVALID_HANDLE* ::
  5249. This means the given handle for the current API function call, pHandle, was invalid.
  5250. This return code might be caused if
  5251. * handle is not a handle which has been obtained by VPU_EncOpen().
  5252. * handle is a handle of an instance which has been closed already, etc.
  5253. *RETCODE_FRAME_NOT_COMPLETE* ::
  5254. This means frame decoding or encoding operation was not completed yet, so the
  5255. given API function call cannot be performed this time. A frame encoding or
  5256. decoding operation should be completed by calling VPU_EncGetOutputInfo() or
  5257. VPU_DecGetOutputInfo(). Even though the result of the current frame operation is
  5258. not necessary, HOST application should call VPU_EncGetOutputInfo() or
  5259. VPU_DecGetOutputInfo() to proceed this function call.
  5260. *RETCODE_WRONG_CALL_SEQUENCE* ::
  5261. This means the current API function call was invalid considering the allowed
  5262. sequences between API functions. HOST application might call this
  5263. function before calling VPU_EncGetInitialInfo() successfully. This function
  5264. should be called after successful calling of VPU_EncGetInitialInfo().
  5265. *RETCODE_INVALID_FRAME_BUFFER* ::
  5266. This means argument pBuffer were invalid, which means it was not initialized
  5267. yet or not valid anymore.
  5268. *RETCODE_INSUFFICIENT_FRAME_BUFFERS* ::
  5269. This means the given number of frame buffers, num, was not enough for the
  5270. encoder operations of the given handle. It should be greater than or equal to
  5271. the value of minFrameBufferCount obtained from VPU_EncGetInitialInfo().
  5272. *RETCODE_INVALID_STRIDE* ::
  5273. This means the given argument stride was invalid, which means it is 0, or is not
  5274. a multiple of 8 in this case.
  5275. *RETCODE_CALLED_BEFORE* ::
  5276. This function call is invalid which means multiple calls of the current API function
  5277. for a given instance are not allowed. It might happen when registering frame buffer for
  5278. this instance has been done already so that this function call is meaningless
  5279. and not allowed anymore.
  5280. *RETCODE_VPU_RESPONSE_TIMEOUT* ::
  5281. Operation has not recieved any response from VPU and has timed out.
  5282. @endverbatim
  5283. */
  5284. RetCode VPU_EncRegisterFrameBuffer(
  5285. EncHandle handle, /**< [Input] An encoder handle obtained from VPU_EncOpen() */
  5286. FrameBuffer* bufArray, /**< [Input] Allocated frame buffer address and information in <<vpuapi_h_FrameBuffer>>. If this parameter is set to -1, VPU allocates frame buffers. */
  5287. int num, /**< [Input] A number of frame buffers. VPU can allocate frame buffers as many as this given value. */
  5288. int stride, /**< [Input] A stride value of the given frame buffers */
  5289. int height, /**< [Input] Frame height */
  5290. TiledMapType mapType /**< [Input] Map type of frame buffer */
  5291. );
  5292. /**
  5293. * @brief This is a special function that enables HOST application to allocate directly the frame buffer
  5294. for encoding or for Pre-processor (PRP) such as Rotator.
  5295. In normal operation, VPU API allocates frame buffers when the argument `bufArray` in VPU_EncRegisterFrameBuffer() is set to 0.
  5296. However, for any other reason HOST application can use this function to allocate frame buffers by themselves.
  5297. * @return
  5298. @verbatim
  5299. *RETCODE_SUCCESS* ::
  5300. Operation was done successfully, which means the framebuffer is allocated successfully.
  5301. *RETCODE_INVALID_HANDLE* ::
  5302. This means the given handle for the current API function call, pHandle, was invalid. This return code might be caused if
  5303. +
  5304. --
  5305. * handle is not a handle which has been obtained by VPU_EncOpen().
  5306. * handle is a handle of an instance which has been closed already, etc.
  5307. --
  5308. *RETCODE_WRONG_CALL_SEQUENCE* ::
  5309. This means the current API function call was invalid considering the allowed sequences between API functions.
  5310. It might happen because VPU_EncRegisterFrameBuffer() for (FramebufferAllocType.FB_TYPE_CODEC) has not been called,
  5311. before this function call for allocating frame buffer for PRP (FramebufferAllocType.FB_TYPE_PPU).
  5312. *RETCODE_INSUFFICIENT_RESOURCE* ::
  5313. This means failure to allocate a framebuffer due to lack of memory
  5314. *RETCODE_INVALID_PARAM* ::
  5315. The given argument parameter, index, was invalid, which means it has improper values
  5316. @endverbatim
  5317. */
  5318. RetCode VPU_EncAllocateFrameBuffer(
  5319. EncHandle handle, /**< [Input] An encoder handle obtained from VPU_EncOpen() */
  5320. FrameBufferAllocInfo info, /**< [Input] <<vpuapi_h_FrameBufferAllocInfo>> */
  5321. FrameBuffer *frameBuffer /**< [Output] <<vpuapi_h_FrameBuffer>> that holds information of allocated frame buffers */
  5322. );
  5323. /**
  5324. * @brief
  5325. @verbatim
  5326. This function starts encoding one frame. Returning from this function does not
  5327. mean the completion of encoding one frame, and it is just that encoding one
  5328. frame was initiated.
  5329. Every call of this function should be matched with VPU_EncGetOutputInfo()
  5330. with the same handle. In other words, HOST application should call VPU_EncGetOutputInfo() once to get the result of VPU_EncStartOneFrame() call.
  5331. For CODA9, without "sequential" calling a pair of VPU_EncStartOneFrame() and VPU_EncGetOutputInfo(),
  5332. HOST application cannot call any other API functions except VPU_EncGetBitstreamBuffer(), and VPU_EncUpdateBitstreamBuffer().
  5333. @endverbatim
  5334. * @return
  5335. @verbatim
  5336. *RETCODE_SUCCESS* ::
  5337. Operation was done successfully, which means encoding a new frame was started
  5338. successfully.
  5339. +
  5340. --
  5341. NOTE: This return value does not mean that encoding a frame was completed
  5342. successfully.
  5343. --
  5344. *RETCODE_INVALID_HANDLE* ::
  5345. This means the given handle for the current API function call, pHandle, was invalid.
  5346. This return code might be caused if
  5347. +
  5348. --
  5349. * handle is not a handle which has been obtained by VPU_EncOpen().
  5350. * handle is a handle of an instance which has been closed already, etc.
  5351. --
  5352. *RETCODE_FRAME_NOT_COMPLETE* ::
  5353. This means frame decoding or encoding operation was not completed yet, so the
  5354. given API function call cannot be performed this time. A frame encoding or
  5355. decoding operation should be completed by calling VPU_EncGetOutputInfo() or
  5356. VPU_DecGetOutputInfo(). Even though the result of the current frame operation is
  5357. not necessary, HOST application should call VPU_EncGetOutputInfo() or
  5358. VPU_DecGetOutputInfo() to proceed this function call.
  5359. *RETCODE_WRONG_CALL_SEQUENCE* ::
  5360. This means the current API function call was invalid considering the allowed
  5361. sequences between API functions. In this case, HOST application might call this
  5362. function before successfully calling VPU_EncRegisterFrameBuffer(). This function
  5363. should be called after successfully calling VPU_EncRegisterFrameBuffer().
  5364. *RETCODE_INVALID_PARAM* ::
  5365. The given argument parameter, `parameter`, was invalid, which means it has a null
  5366. pointer, or given values for some member variables are improper values.
  5367. *RETCODE_INVALID_FRAME_BUFFER* ::
  5368. This means sourceFrame in input structure EncParam was invalid, which means
  5369. sourceFrame was not valid even though picture-skip is disabled.
  5370. *RETCODE_QUEUEING_FAILURE* ::
  5371. This means that the current API function call cannot be queued because queue buffers are full at the moment.
  5372. @endverbatim
  5373. */
  5374. RetCode VPU_EncStartOneFrame(
  5375. EncHandle handle, /**< [Input] An encoder handle obtained from VPU_EncOpen() */
  5376. EncParam * param /**< [Input] A pointer to <<vpuapi_h_EncParam>> structure which describes picture encoding parameters for the current encoder instance. */
  5377. );
  5378. /**
  5379. * @brief This function gets information of the output of encoding. Application can obtain
  5380. the picture type, the address and size of the generated bitstream, and the number
  5381. of generated slices. HOST application should call this function after frame
  5382. encoding is finished, and before starting the further processing.
  5383. * @return
  5384. @verbatim
  5385. *RETCODE_SUCCESS* ::
  5386. Operation was done successfully, which means the output information of the current
  5387. frame encoding was received successfully.
  5388. *RETCODE_INVALID_HANDLE* ::
  5389. The given handle for the current API function call, pHandle, was invalid. This
  5390. return code might be caused if
  5391. +
  5392. --
  5393. * handle is not a handle which has been obtained by VPU_EncOpen(), for example
  5394. a decoder handle,
  5395. * handle is a handle of an instance which has been closed already,
  5396. * handle is not the same handle as the last VPU_EncStartOneFrame() has, etc.
  5397. --
  5398. *RETCODE_WRONG_CALL_SEQUENCE* ::
  5399. This means the current API function call was invalid considering the allowed
  5400. sequences between API functions. HOST application might call this
  5401. function before calling VPU_EncStartOneFrame() successfully. This function
  5402. should be called after successful calling of VPU_EncStartOneFrame().
  5403. *RETCODE_INVALID_PARAM* ::
  5404. The given argument parameter, pInfo, was invalid, which means it has a null
  5405. pointer, or given values for some member variables are improper values.
  5406. *RETCODE_QUERY_FAILURE* ::
  5407. This means this query command was not successful. (WAVE5 only)
  5408. *RETCODE_REPORT_NOT_READY* ::
  5409. This means that report is not ready for this query(GET_RESULT) command. (WAVE5 only)
  5410. @endverbatim
  5411. */
  5412. RetCode VPU_EncGetOutputInfo(
  5413. EncHandle handle, /**< [Input] An encoder handle obtained from VPU_EncOpen(). */
  5414. EncOutputInfo * info /**< [Output] A pointer to <<vpuapi_h_EncOutputInfo>> structure which describes picture encoding results for the current encoder instance. */
  5415. );
  5416. /**
  5417. * @brief This function executes an additional function such rotator or changeParam which is given by HOST application.
  5418. It allows HOST application to set directly the variables that can be set only through the API layer.
  5419. Some command-specific return codes are also presented.
  5420. * @return
  5421. @verbatim
  5422. *RETCODE_INVALID_COMMAND* ::
  5423. This means the given argument, cmd, was invalid which means the given cmd was
  5424. undefined, or not allowed in the current instance.
  5425. *RETCODE_INVALID_HANDLE* ::
  5426. This means the given handle for the current API function call, pHandle, was invalid.
  5427. This return code might be caused if
  5428. +
  5429. --
  5430. * pHandle is not a handle which has been obtained by VPU_EncOpen().
  5431. * pHandle is a handle of an instance which has been closed already, etc.
  5432. --
  5433. *RETCODE_FRAME_NOT_COMPLETE* ::
  5434. This means frame decoding or encoding operation was not completed yet, so the
  5435. given API function call cannot be performed this time. A frame encoding or
  5436. decoding operation should be completed by calling VPU_EncGetOutputInfo() or
  5437. VPU_DecGetOutputInfo(). Even though the result of the current frame operation is
  5438. not necessary, HOST application should call VPU_EncGetOutputInfo() or
  5439. VPU_DecGetOutputInfo() to proceed this function call.
  5440. *RETCODE_VPU_RESPONSE_TIMEOUT* ::
  5441. Operation has not received any response from VPU and has timed out.
  5442. *RETCODE_QUEUEING_FAILURE* ::
  5443. This means that the current API function call cannot be queued because queue buffers are full at the moment.
  5444. @endverbatim
  5445. */
  5446. RetCode VPU_EncGiveCommand(
  5447. EncHandle handle, /**< [Input] An encoder handle obtained from VPU_EncOpen() */
  5448. CodecCommand cmd, /**< [Input] A variable specifying the given command of <<vpuapi_h_CodecCommand>> */
  5449. void * parameter /**< [Input/Output] A pointer to command-specific data structure which describes picture I/O parameters for the current encoder instance */
  5450. );
  5451. /**
  5452. * @brief After encoding a frame, HOST application must get the bitstream from encoder.
  5453. This function returns the location of encoded stream and the maximum size in bitstream buffer.
  5454. * @return
  5455. @verbatim
  5456. *RETCODE_SUCCESS* ::
  5457. Operation was done successfully. That means the current encoder instance was closed
  5458. successfully.
  5459. *RETCODE_INVALID_HANDLE* ::
  5460. This means the given handle for the current API function call, pHandle, was invalid.
  5461. This return code might be caused if
  5462. +
  5463. --
  5464. * pHandle is not a handle which has been obtained by VPU_EncOpen().
  5465. * pHandle is a handle of an instance which has been closed already, etc.
  5466. --
  5467. *RETCODE_INVALID_PARAM* ::
  5468. The given argument parameter, pRdptr, pWrptr or size, was invalid, which means
  5469. it has a null pointer, or given values for some member variables are improper
  5470. values.
  5471. @endverbatim
  5472. */
  5473. RetCode VPU_EncGetBitstreamBuffer(
  5474. EncHandle handle, /**< [Input] An encoder handle obtained from VPU_EncOpen() */
  5475. PhysicalAddress *prdPrt, /**< [Output] A stream buffer read pointer for the current encoder instance */
  5476. PhysicalAddress *pwrPtr, /**< [Output] A stream buffer write pointer for the current encoder instance */
  5477. int * size /**< [Output] A variable indicating the written stream size in bitstream buffer for the current encoder instance */
  5478. );
  5479. /**
  5480. * @brief This function informs VPU API of how much bitstream has been transferred by HOST application from
  5481. the address obtained from VPU_EncGetBitstreamBuffer(). By just giving the size
  5482. as an argument, API automatically handles pointer wrap-around and updates the read
  5483. pointer.
  5484. * @return
  5485. @verbatim
  5486. *RETCODE_SUCCESS* ::
  5487. Operation was done successfully. That means the current encoder instance was closed
  5488. successfully.
  5489. *RETCODE_INVALID_HANDLE* ::
  5490. This means the given handle for the current API function call, pHandle, was invalid.
  5491. This return code might be caused if
  5492. +
  5493. --
  5494. * pHandle is not a handle which has been obtained by VPU_EncOpen().
  5495. * pHandle is a handle of an instance which has been closed already, etc.
  5496. --
  5497. *RETCODE_INVALID_PARAM* ::
  5498. The given argument parameter, size, was invalid, which means size is larger than
  5499. the value obtained from VPU_EncGetBitstreamBuffer().
  5500. @endverbatim
  5501. */
  5502. RetCode VPU_EncUpdateBitstreamBuffer(
  5503. EncHandle handle, /**< [Input] An encoder handle obtained from VPU_EncOpen() */
  5504. int size /**< [Input] A variable indicating the stream size read by HOST application from the bitstream buffer */
  5505. );
  5506. /**
  5507. * @brief This function specifies the location of write pointer in bitstream buffer. It can also set a read
  5508. pointer with the same value of write pointer (addr) when updateRdPtr is not a zero value.
  5509. This function can be used regardless of bitstream buffer mode.
  5510. * @return
  5511. @verbatim
  5512. *RETCODE_SUCCESS* ::
  5513. Operation was done successfully, which means required information of the stream data to be
  5514. encoded was received successfully.
  5515. *RETCODE_FAILURE* ::
  5516. Operation was failed, which means there was an error in getting information for configuring
  5517. the encoder.
  5518. *RETCODE_INVALID_HANDLE* ::
  5519. +
  5520. --
  5521. This means the given handle for the current API function call, `handle`, was invalid. This return
  5522. code might be caused if
  5523. * `handle` is not a handle which has been obtained by VPU_EncOpen().
  5524. * `handle` is a handle of an instance which has been closed already, etc.
  5525. --
  5526. *RETCODE_FRAME_NOT_COMPLETE* ::
  5527. This means frame encoding operation was not completed yet, so the given API function call
  5528. cannot be performed this time. A frame encoding operation should be completed by calling
  5529. VPU_ EncSetRdPtr ().
  5530. @endverbatim
  5531. */
  5532. RetCode VPU_EncSetWrPtr(
  5533. EncHandle handle, /**< [Input] An encoder handle obtained from VPU_EncOpen() */
  5534. PhysicalAddress addr, /**< [Input] Updated write pointer */
  5535. int updateRdPtr /**< [Input] A flag whether to move the read pointer to where the write pointer is located */
  5536. );
  5537. #ifdef __cplusplus
  5538. }
  5539. #endif
  5540. #endif