12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
- <html >
- <head><title>Vorbis I specification</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
- <meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
- <!-- html -->
- <meta name="src" content="Vorbis_I_spec.tex">
- <meta name="date" content="2009-06-02 19:28:00">
- <link rel="stylesheet" type="text/css" href="Vorbis_I_spec.css">
- </head><body
- >
- <div class="maketitle">
-
-
-
-
- <h2 class="titleHead">Vorbis I specification</h2>
- <div class="author" ><span
- class="cmr-17">Xiph.org Foundation</span></div>
- <br />
- <div class="date" ><span
- class="cmr-17">June 2, 2009</span></div>
- </div>
- <h3 class="likesectionHead"><a
- id="x1-1000"></a>Contents</h3>
- <div class="tableofcontents">
-  <span class="sectionToc" >1 <a
- href="#x1-20001" id="QQ2-1-2">Introduction and Description</a></span>
- <br />  <span class="subsectionToc" >1.1 <a
- href="#x1-30001.1" id="QQ2-1-3">Overview</a></span>
- <br />   <span class="subsubsectionToc" >1.1.1 <a
- href="#x1-40001.1.1" id="QQ2-1-4">Application</a></span>
- <br />   <span class="subsubsectionToc" >1.1.2 <a
- href="#x1-50001.1.2" id="QQ2-1-5">Classification</a></span>
- <br />   <span class="subsubsectionToc" >1.1.3 <a
- href="#x1-60001.1.3" id="QQ2-1-6">Assumptions</a></span>
- <br />   <span class="subsubsectionToc" >1.1.4 <a
- href="#x1-70001.1.4" id="QQ2-1-7">Codec Setup and Probability Model</a></span>
- <br />   <span class="subsubsectionToc" >1.1.5 <a
- href="#x1-90001.1.5" id="QQ2-1-9">Format Specification</a></span>
- <br />   <span class="subsubsectionToc" >1.1.6 <a
- href="#x1-100001.1.6" id="QQ2-1-10">Hardware Profile</a></span>
- <br />  <span class="subsectionToc" >1.2 <a
- href="#x1-110001.2" id="QQ2-1-11">Decoder Configuration</a></span>
- <br />   <span class="subsubsectionToc" >1.2.1 <a
- href="#x1-120001.2.1" id="QQ2-1-13">Global Config</a></span>
- <br />   <span class="subsubsectionToc" >1.2.2 <a
- href="#x1-130001.2.2" id="QQ2-1-14">Mode</a></span>
-
-
- <br />   <span class="subsubsectionToc" >1.2.3 <a
- href="#x1-140001.2.3" id="QQ2-1-15">Mapping</a></span>
- <br />   <span class="subsubsectionToc" >1.2.4 <a
- href="#x1-150001.2.4" id="QQ2-1-16">Floor</a></span>
- <br />   <span class="subsubsectionToc" >1.2.5 <a
- href="#x1-160001.2.5" id="QQ2-1-17">Residue</a></span>
- <br />   <span class="subsubsectionToc" >1.2.6 <a
- href="#x1-170001.2.6" id="QQ2-1-18">Codebooks</a></span>
- <br />  <span class="subsectionToc" >1.3 <a
- href="#x1-180001.3" id="QQ2-1-19">High-level Decode Process</a></span>
- <br />   <span class="subsubsectionToc" >1.3.1 <a
- href="#x1-190001.3.1" id="QQ2-1-20">Decode Setup</a></span>
- <br />   <span class="subsubsectionToc" >1.3.2 <a
- href="#x1-230001.3.2" id="QQ2-1-24">Decode Procedure</a></span>
- <br /> <span class="sectionToc" >2 <a
- href="#x1-360002" id="QQ2-1-39">Bitpacking Convention</a></span>
- <br />  <span class="subsectionToc" >2.1 <a
- href="#x1-370002.1" id="QQ2-1-40">Overview</a></span>
- <br />   <span class="subsubsectionToc" >2.1.1 <a
- href="#x1-380002.1.1" id="QQ2-1-41">octets, bytes and words</a></span>
- <br />   <span class="subsubsectionToc" >2.1.2 <a
- href="#x1-390002.1.2" id="QQ2-1-42">bit order</a></span>
- <br />   <span class="subsubsectionToc" >2.1.3 <a
- href="#x1-400002.1.3" id="QQ2-1-43">byte order</a></span>
- <br />   <span class="subsubsectionToc" >2.1.4 <a
- href="#x1-410002.1.4" id="QQ2-1-44">coding bits into byte sequences</a></span>
- <br />   <span class="subsubsectionToc" >2.1.5 <a
- href="#x1-420002.1.5" id="QQ2-1-45">signedness</a></span>
- <br />   <span class="subsubsectionToc" >2.1.6 <a
- href="#x1-430002.1.6" id="QQ2-1-46">coding example</a></span>
- <br />   <span class="subsubsectionToc" >2.1.7 <a
- href="#x1-440002.1.7" id="QQ2-1-47">decoding example</a></span>
- <br />   <span class="subsubsectionToc" >2.1.8 <a
- href="#x1-450002.1.8" id="QQ2-1-48">end-of-packet alignment</a></span>
- <br />   <span class="subsubsectionToc" >2.1.9 <a
- href="#x1-460002.1.9" id="QQ2-1-49">reading zero bits</a></span>
- <br /> <span class="sectionToc" >3 <a
- href="#x1-470003" id="QQ2-1-50">Probability Model and Codebooks</a></span>
- <br />  <span class="subsectionToc" >3.1 <a
- href="#x1-480003.1" id="QQ2-1-51">Overview</a></span>
- <br />   <span class="subsubsectionToc" >3.1.1 <a
- href="#x1-490003.1.1" id="QQ2-1-52">Bitwise operation</a></span>
- <br />  <span class="subsectionToc" >3.2 <a
- href="#x1-500003.2" id="QQ2-1-53">Packed codebook format</a></span>
- <br />   <span class="subsubsectionToc" >3.2.1 <a
- href="#x1-510003.2.1" id="QQ2-1-54">codebook decode</a></span>
- <br />  <span class="subsectionToc" >3.3 <a
- href="#x1-570003.3" id="QQ2-1-62">Use of the codebook abstraction</a></span>
- <br /> <span class="sectionToc" >4 <a
- href="#x1-580004" id="QQ2-1-63">Codec Setup and Packet Decode</a></span>
- <br />  <span class="subsectionToc" >4.1 <a
- href="#x1-590004.1" id="QQ2-1-64">Overview</a></span>
- <br />  <span class="subsectionToc" >4.2 <a
- href="#x1-600004.2" id="QQ2-1-65">Header decode and decode setup</a></span>
- <br />   <span class="subsubsectionToc" >4.2.1 <a
- href="#x1-610004.2.1" id="QQ2-1-66">Common header decode</a></span>
- <br />   <span class="subsubsectionToc" >4.2.2 <a
- href="#x1-620004.2.2" id="QQ2-1-67">Identification header</a></span>
-
-
- <br />   <span class="subsubsectionToc" >4.2.3 <a
- href="#x1-630004.2.3" id="QQ2-1-68">Comment header</a></span>
- <br />   <span class="subsubsectionToc" >4.2.4 <a
- href="#x1-640004.2.4" id="QQ2-1-69">Setup header</a></span>
- <br />  <span class="subsectionToc" >4.3 <a
- href="#x1-710004.3" id="QQ2-1-77">Audio packet decode and synthesis</a></span>
- <br />   <span class="subsubsectionToc" >4.3.1 <a
- href="#x1-720004.3.1" id="QQ2-1-78">packet type, mode and window decode</a></span>
- <br />   <span class="subsubsectionToc" >4.3.2 <a
- href="#x1-730004.3.2" id="QQ2-1-79">floor curve decode</a></span>
- <br />   <span class="subsubsectionToc" >4.3.3 <a
- href="#x1-740004.3.3" id="QQ2-1-80">nonzero vector propagate</a></span>
- <br />   <span class="subsubsectionToc" >4.3.4 <a
- href="#x1-750004.3.4" id="QQ2-1-81">residue decode</a></span>
- <br />   <span class="subsubsectionToc" >4.3.5 <a
- href="#x1-760004.3.5" id="QQ2-1-82">inverse coupling</a></span>
- <br />   <span class="subsubsectionToc" >4.3.6 <a
- href="#x1-770004.3.6" id="QQ2-1-83">dot product</a></span>
- <br />   <span class="subsubsectionToc" >4.3.7 <a
- href="#x1-780004.3.7" id="QQ2-1-84">inverse MDCT</a></span>
- <br />   <span class="subsubsectionToc" >4.3.8 <a
- href="#x1-790004.3.8" id="QQ2-1-85">overlap˙add</a></span>
- <br />   <span class="subsubsectionToc" >4.3.9 <a
- href="#x1-800004.3.9" id="QQ2-1-86">output channel order</a></span>
- <br /> <span class="sectionToc" >5 <a
- href="#x1-810005" id="QQ2-1-87">comment field and header specification</a></span>
- <br />  <span class="subsectionToc" >5.1 <a
- href="#x1-820005.1" id="QQ2-1-88">Overview</a></span>
- <br />  <span class="subsectionToc" >5.2 <a
- href="#x1-830005.2" id="QQ2-1-89">Comment encoding</a></span>
- <br />   <span class="subsubsectionToc" >5.2.1 <a
- href="#x1-840005.2.1" id="QQ2-1-90">Structure</a></span>
- <br />   <span class="subsubsectionToc" >5.2.2 <a
- href="#x1-850005.2.2" id="QQ2-1-91">Content vector format</a></span>
- <br />   <span class="subsubsectionToc" >5.2.3 <a
- href="#x1-880005.2.3" id="QQ2-1-94">Encoding</a></span>
- <br /> <span class="sectionToc" >6 <a
- href="#x1-890006" id="QQ2-1-95">Floor type 0 setup and decode</a></span>
- <br />  <span class="subsectionToc" >6.1 <a
- href="#x1-900006.1" id="QQ2-1-96">Overview</a></span>
- <br />  <span class="subsectionToc" >6.2 <a
- href="#x1-910006.2" id="QQ2-1-97">Floor 0 format</a></span>
- <br />   <span class="subsubsectionToc" >6.2.1 <a
- href="#x1-920006.2.1" id="QQ2-1-98">header decode</a></span>
- <br />   <span class="subsubsectionToc" >6.2.2 <a
- href="#x1-930006.2.2" id="QQ2-1-99">packet decode</a></span>
- <br />   <span class="subsubsectionToc" >6.2.3 <a
- href="#x1-940006.2.3" id="QQ2-1-100">curve computation</a></span>
- <br /> <span class="sectionToc" >7 <a
- href="#x1-950007" id="QQ2-1-101">Floor type 1 setup and decode</a></span>
- <br />  <span class="subsectionToc" >7.1 <a
- href="#x1-960007.1" id="QQ2-1-102">Overview</a></span>
- <br />  <span class="subsectionToc" >7.2 <a
- href="#x1-970007.2" id="QQ2-1-103">Floor 1 format</a></span>
- <br />   <span class="subsubsectionToc" >7.2.1 <a
- href="#x1-980007.2.1" id="QQ2-1-104">model</a></span>
- <br />   <span class="subsubsectionToc" >7.2.2 <a
- href="#x1-990007.2.2" id="QQ2-1-109">header decode</a></span>
-
-
- <br /> <span class="sectionToc" >8 <a
- href="#x1-1020008" id="QQ2-1-112">Residue setup and decode</a></span>
- <br />  <span class="subsectionToc" >8.1 <a
- href="#x1-1030008.1" id="QQ2-1-113">Overview</a></span>
- <br />  <span class="subsectionToc" >8.2 <a
- href="#x1-1040008.2" id="QQ2-1-114">Residue format</a></span>
- <br />  <span class="subsectionToc" >8.3 <a
- href="#x1-1050008.3" id="QQ2-1-116">residue 0</a></span>
- <br />  <span class="subsectionToc" >8.4 <a
- href="#x1-1060008.4" id="QQ2-1-117">residue 1</a></span>
- <br />  <span class="subsectionToc" >8.5 <a
- href="#x1-1070008.5" id="QQ2-1-118">residue 2</a></span>
- <br />  <span class="subsectionToc" >8.6 <a
- href="#x1-1080008.6" id="QQ2-1-120">Residue decode</a></span>
- <br />   <span class="subsubsectionToc" >8.6.1 <a
- href="#x1-1090008.6.1" id="QQ2-1-121">header decode</a></span>
- <br />   <span class="subsubsectionToc" >8.6.2 <a
- href="#x1-1100008.6.2" id="QQ2-1-122">packet decode</a></span>
- <br />   <span class="subsubsectionToc" >8.6.3 <a
- href="#x1-1110008.6.3" id="QQ2-1-123">format 0 specifics</a></span>
- <br />   <span class="subsubsectionToc" >8.6.4 <a
- href="#x1-1120008.6.4" id="QQ2-1-124">format 1 specifics</a></span>
- <br />   <span class="subsubsectionToc" >8.6.5 <a
- href="#x1-1130008.6.5" id="QQ2-1-125">format 2 specifics</a></span>
- <br /> <span class="sectionToc" >9 <a
- href="#x1-1140009" id="QQ2-1-126">Helper equations</a></span>
- <br />  <span class="subsectionToc" >9.1 <a
- href="#x1-1150009.1" id="QQ2-1-127">Overview</a></span>
- <br />  <span class="subsectionToc" >9.2 <a
- href="#x1-1160009.2" id="QQ2-1-128">Functions</a></span>
- <br />   <span class="subsubsectionToc" >9.2.1 <a
- href="#x1-1170009.2.1" id="QQ2-1-129">ilog</a></span>
- <br />   <span class="subsubsectionToc" >9.2.2 <a
- href="#x1-1180009.2.2" id="QQ2-1-130">float32˙unpack</a></span>
- <br />   <span class="subsubsectionToc" >9.2.3 <a
- href="#x1-1190009.2.3" id="QQ2-1-131">lookup1˙values</a></span>
- <br />   <span class="subsubsectionToc" >9.2.4 <a
- href="#x1-1200009.2.4" id="QQ2-1-132">low˙neighbor</a></span>
- <br />   <span class="subsubsectionToc" >9.2.5 <a
- href="#x1-1210009.2.5" id="QQ2-1-133">high˙neighbor</a></span>
- <br />   <span class="subsubsectionToc" >9.2.6 <a
- href="#x1-1220009.2.6" id="QQ2-1-134">render˙point</a></span>
- <br />   <span class="subsubsectionToc" >9.2.7 <a
- href="#x1-1230009.2.7" id="QQ2-1-135">render˙line</a></span>
- <br /> <span class="sectionToc" >10 <a
- href="#x1-12400010" id="QQ2-1-136">Tables</a></span>
- <br />  <span class="subsectionToc" >10.1 <a
- href="#x1-12500010.1" id="QQ2-1-137">floor1_inverse_dB_table</a></span>
- <br /> <span class="sectionToc" >A <a
- href="#x1-126000A" id="QQ2-1-138">Embedding Vorbis into an Ogg stream</a></span>
- <br />  <span class="subsectionToc" >A.1 <a
- href="#x1-127000A.1" id="QQ2-1-139">Overview</a></span>
- <br />   <span class="subsubsectionToc" >A.1.1 <a
- href="#x1-128000A.1.1" id="QQ2-1-140">Restrictions</a></span>
- <br />   <span class="subsubsectionToc" >A.1.2 <a
- href="#x1-129000A.1.2" id="QQ2-1-141">MIME type</a></span>
- <br />  <span class="subsectionToc" >A.2 <a
- href="#x1-130000A.2" id="QQ2-1-142">Encapsulation</a></span>
-
-
- <br /> <span class="sectionToc" >B <a
- href="#x1-132000B" id="QQ2-1-144">Vorbis encapsulation in RTP</a></span>
- </div>
-
-
- <h3 class="sectionHead"><span class="titlemark">1 </span> <a
- id="x1-20001"></a>Introduction and Description</h3>
- <!--l. 6--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">1.1 </span> <a
- id="x1-30001.1"></a>Overview</h4>
- <!--l. 8--><p class="noindent" >This document provides a high level description of the Vorbis codec’s construction. A bit-by-bit
- specification appears beginning in <a
- href="#x1-580004">Section 4<!--tex4ht:ref: vorbis:spec:codec --></a>, “<a
- href="#x1-580004">Codec Setup and Packet Decode<!--tex4ht:ref: vorbis:spec:codec --></a>”. The later
- sections assume a high-level understanding of the Vorbis decode process, which is provided
- here.
- <!--l. 15--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">1.1.1 </span> <a
- id="x1-40001.1.1"></a>Application</h5>
- <!--l. 16--><p class="noindent" >Vorbis is a general purpose perceptual audio CODEC intended to allow maximum encoder
- flexibility, thus allowing it to scale competitively over an exceptionally wide range of bitrates. At
- the high quality/bitrate end of the scale (CD or DAT rate stereo, 16/24 bits) it is in the same
- league as MPEG-2 and MPC. Similarly, the 1.0 encoder can encode high-quality CD and DAT
- rate stereo at below 48kbps without resampling to a lower rate. Vorbis is also intended for lower
- and higher sample rates (from 8kHz telephony to 192kHz digital masters) and a range of channel
- representations (monaural, polyphonic, stereo, quadraphonic, 5.1, ambisonic, or up to 255
- discrete channels).
- <!--l. 29--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">1.1.2 </span> <a
- id="x1-50001.1.2"></a>Classification</h5>
- <!--l. 30--><p class="noindent" >Vorbis I is a forward-adaptive monolithic transform CODEC based on the Modified Discrete
- Cosine Transform. The codec is structured to allow addition of a hybrid wavelet filterbank in
- Vorbis II to offer better transient response and reproduction using a transform better suited to
- localized time events.
-
-
- <!--l. 37--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">1.1.3 </span> <a
- id="x1-60001.1.3"></a>Assumptions</h5>
- <!--l. 39--><p class="noindent" >The Vorbis CODEC design assumes a complex, psychoacoustically-aware encoder and simple,
- low-complexity decoder. Vorbis decode is computationally simpler than mp3, although it does
- require more working memory as Vorbis has no static probability model; the vector codebooks
- used in the first stage of decoding from the bitstream are packed in their entirety into the Vorbis
- bitstream headers. In packed form, these codebooks occupy only a few kilobytes; the extent to
- which they are pre-decoded into a cache is the dominant factor in decoder memory
- usage.
- <!--l. 50--><p class="noindent" >Vorbis provides none of its own framing, synchronization or protection against errors; it
- is solely a method of accepting input audio, dividing it into individual frames and
- compressing these frames into raw, unformatted ’packets’. The decoder then accepts
- these raw packets in sequence, decodes them, synthesizes audio frames from them, and
- reassembles the frames into a facsimile of the original audio stream. Vorbis is a free-form
- variable bit rate (VBR) codec and packets have no minimum size, maximum size, or
- fixed/expected size. Packets are designed that they may be truncated (or padded)
- and remain decodable; this is not to be considered an error condition and is used
- extensively in bitrate management in peeling. Both the transport mechanism and
- decoder must allow that a packet may be any size, or end before or after packet decode
- expects.
- <!--l. 64--><p class="noindent" >Vorbis packets are thus intended to be used with a transport mechanism that provides free-form
- framing, sync, positioning and error correction in accordance with these design assumptions, such
- as Ogg (for file transport) or RTP (for network multicast). For purposes of a few examples in this
- document, we will assume that Vorbis is to be embedded in an Ogg stream specifically,
- although this is by no means a requirement or fundamental assumption in the Vorbis
- design.
- <!--l. 72--><p class="noindent" >The specification for embedding Vorbis into an Ogg transport stream is in <a
- href="#x1-126000A">Section A<!--tex4ht:ref: vorbis:over:ogg --></a>,
- “<a
- href="#x1-126000A">Embedding Vorbis into an Ogg stream<!--tex4ht:ref: vorbis:over:ogg --></a>”.
- <!--l. 77--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">1.1.4 </span> <a
- id="x1-70001.1.4"></a>Codec Setup and Probability Model</h5>
- <!--l. 79--><p class="noindent" >Vorbis’ heritage is as a research CODEC and its current design reflects a desire to allow multiple
- decades of continuous encoder improvement before running out of room within the codec
- specification. For these reasons, configurable aspects of codec setup intentionally lean toward the
- extreme of forward adaptive.
-
-
- <!--l. 85--><p class="noindent" >The single most controversial design decision in Vorbis (and the most unusual for a Vorbis
- developer to keep in mind) is that the entire probability model of the codec, the Huffman and
- VQ codebooks, is packed into the bitstream header along with extensive CODEC setup
- parameters (often several hundred fields). This makes it impossible, as it would be with
- MPEG audio layers, to embed a simple frame type flag in each audio packet, or begin
- decode at any frame in the stream without having previously fetched the codec setup
- header.
- <!--l. 95--><p class="noindent" ><span class="likesubparagraphHead"><a
- id="x1-80001.1.4"></a><span
- class="cmbx-12">Note:</span></span> Vorbis <span
- class="cmti-12">can </span>initiate decode at any arbitrary packet within a bitstream so long as the codec
- has been initialized/setup with the setup headers.
- <!--l. 101--><p class="noindent" >Thus, Vorbis headers are both required for decode to begin and relatively large as bitstream
- headers go. The header size is unbounded, although for streaming a rule-of-thumb of 4kB or less
- is recommended (and Xiph.Org’s Vorbis encoder follows this suggestion).
- <!--l. 106--><p class="noindent" >Our own design work indicates the primary liability of the required header is in mindshare; it is
- an unusual design and thus causes some amount of complaint among engineers as this runs
- against current design trends (and also points out limitations in some existing software/interface
- designs, such as Windows’ ACM codec framework). However, we find that it does not
- fundamentally limit Vorbis’ suitable application space.
- <!--l. 115--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">1.1.5 </span> <a
- id="x1-90001.1.5"></a>Format Specification</h5>
- <!--l. 116--><p class="noindent" >The Vorbis format is well-defined by its decode specification; any encoder that produces packets
- that are correctly decoded by the reference Vorbis decoder described below may be considered
- a proper Vorbis encoder. A decoder must faithfully and completely implement the
- specification defined below (except where noted) to be considered a proper Vorbis
- decoder.
- <!--l. 123--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">1.1.6 </span> <a
- id="x1-100001.1.6"></a>Hardware Profile</h5>
-
-
- <!--l. 124--><p class="noindent" >Although Vorbis decode is computationally simple, it may still run into specific limitations of an
- embedded design. For this reason, embedded designs are allowed to deviate in limited ways from
- the ‘full’ decode specification yet still be certified compliant. These optional omissions are
- labelled in the spec where relevant.
- <!--l. 131--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">1.2 </span> <a
- id="x1-110001.2"></a>Decoder Configuration</h4>
- <!--l. 133--><p class="noindent" >Decoder setup consists of configuration of multiple, self-contained component abstractions that
- perform specific functions in the decode pipeline. Each different component instance of a specific
- type is semantically interchangeable; decoder configuration consists both of internal component
- configuration, as well as arrangement of specific instances into a decode pipeline. Componentry
- arrangement is roughly as follows:
- <div class="center"
- >
- <!--l. 141--><p class="noindent" >
- <!--l. 142--><p class="noindent" ><img
- src="components.png" alt="PIC"
- >
- <br /> <table class="caption"
- ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 1: </td><td
- class="content">decoder pipeline configuration</td></tr></table><!--tex4ht:label?: x1-110011 -->
- </div>
- <!--l. 146--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">1.2.1 </span> <a
- id="x1-120001.2.1"></a>Global Config</h5>
- <!--l. 147--><p class="noindent" >Global codec configuration consists of a few audio related fields (sample rate, channels), Vorbis
- version (always ’0’ in Vorbis I), bitrate hints, and the lists of component instances. All other
- configuration is in the context of specific components.
- <!--l. 152--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">1.2.2 </span> <a
- id="x1-130001.2.2"></a>Mode</h5>
-
-
- <!--l. 154--><p class="noindent" >Each Vorbis frame is coded according to a master ’mode’. A bitstream may use one or many
- modes.
- <!--l. 157--><p class="noindent" >The mode mechanism is used to encode a frame according to one of multiple possible
- methods with the intention of choosing a method best suited to that frame. Different
- modes are, e.g. how frame size is changed from frame to frame. The mode number of a
- frame serves as a top level configuration switch for all other specific aspects of frame
- decode.
- <!--l. 164--><p class="noindent" >A ’mode’ configuration consists of a frame size setting, window type (always 0, the Vorbis
- window, in Vorbis I), transform type (always type 0, the MDCT, in Vorbis I) and a mapping
- number. The mapping number specifies which mapping configuration instance to use for low-level
- packet decode and synthesis.
- <!--l. 171--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">1.2.3 </span> <a
- id="x1-140001.2.3"></a>Mapping</h5>
- <!--l. 173--><p class="noindent" >A mapping contains a channel coupling description and a list of ’submaps’ that bundle sets
- of channel vectors together for grouped encoding and decoding. These submaps are
- not references to external components; the submap list is internal and specific to a
- mapping.
- <!--l. 178--><p class="noindent" >A ’submap’ is a configuration/grouping that applies to a subset of floor and residue vectors
- within a mapping. The submap functions as a last layer of indirection such that specific special
- floor or residue settings can be applied not only to all the vectors in a given mode, but also
- specific vectors in a specific mode. Each submap specifies the proper floor and residue
- instance number to use for decoding that submap’s spectral floor and spectral residue
- vectors.
- <!--l. 186--><p class="noindent" >As an example:
- <!--l. 188--><p class="noindent" >Assume a Vorbis stream that contains six channels in the standard 5.1 format. The sixth
- channel, as is normal in 5.1, is bass only. Therefore it would be wasteful to encode a
- full-spectrum version of it as with the other channels. The submapping mechanism can be used
- to apply a full range floor and residue encoding to channels 0 through 4, and a bass-only
- representation to the bass channel, thus saving space. In this example, channels 0-4 belong to
- submap 0 (which indicates use of a full-range floor) and channel 5 belongs to submap 1, which
- uses a bass-only representation.
-
-
- <!--l. 199--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">1.2.4 </span> <a
- id="x1-150001.2.4"></a>Floor</h5>
- <!--l. 201--><p class="noindent" >Vorbis encodes a spectral ’floor’ vector for each PCM channel. This vector is a low-resolution
- representation of the audio spectrum for the given channel in the current frame, generally used
- akin to a whitening filter. It is named a ’floor’ because the Xiph.Org reference encoder has
- historically used it as a unit-baseline for spectral resolution.
- <!--l. 208--><p class="noindent" >A floor encoding may be of two types. Floor 0 uses a packed LSP representation on a dB
- amplitude scale and Bark frequency scale. Floor 1 represents the curve as a piecewise linear
- interpolated representation on a dB amplitude scale and linear frequency scale. The two floors
- are semantically interchangeable in encoding/decoding. However, floor type 1 provides more
- stable inter-frame behavior, and so is the preferred choice in all coupled-stereo and
- high bitrate modes. Floor 1 is also considerably less expensive to decode than floor
- 0.
- <!--l. 218--><p class="noindent" >Floor 0 is not to be considered deprecated, but it is of limited modern use. No known Vorbis
- encoder past Xiph.org’s own beta 4 makes use of floor 0.
- <!--l. 222--><p class="noindent" >The values coded/decoded by a floor are both compactly formatted and make use of entropy
- coding to save space. For this reason, a floor configuration generally refers to multiple
- codebooks in the codebook component list. Entropy coding is thus provided as an
- abstraction, and each floor instance may choose from any and all available codebooks when
- coding/decoding.
- <!--l. 230--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">1.2.5 </span> <a
- id="x1-160001.2.5"></a>Residue</h5>
- <!--l. 231--><p class="noindent" >The spectral residue is the fine structure of the audio spectrum once the floor curve has been
- subtracted out. In simplest terms, it is coded in the bitstream using cascaded (multi-pass) vector
- quantization according to one of three specific packing/coding algorithms numbered
- 0 through 2. The packing algorithm details are configured by residue instance. As
- with the floor components, the final VQ/entropy encoding is provided by external
- codebook instances and each residue instance may choose from any and all available
- codebooks.
- <!--l. 241--><p class="noindent" >
-
-
- <h5 class="subsubsectionHead"><span class="titlemark">1.2.6 </span> <a
- id="x1-170001.2.6"></a>Codebooks</h5>
- <!--l. 243--><p class="noindent" >Codebooks are a self-contained abstraction that perform entropy decoding and, optionally, use
- the entropy-decoded integer value as an offset into an index of output value vectors, returning
- the indicated vector of values.
- <!--l. 248--><p class="noindent" >The entropy coding in a Vorbis I codebook is provided by a standard Huffman binary tree
- representation. This tree is tightly packed using one of several methods, depending on whether
- codeword lengths are ordered or unordered, or the tree is sparse.
- <!--l. 253--><p class="noindent" >The codebook vector index is similarly packed according to index characteristic. Most commonly,
- the vector index is encoded as a single list of values of possible values that are then permuted
- into a list of n-dimensional rows (lattice VQ).
- <!--l. 260--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">1.3 </span> <a
- id="x1-180001.3"></a>High-level Decode Process</h4>
- <!--l. 262--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">1.3.1 </span> <a
- id="x1-190001.3.1"></a>Decode Setup</h5>
- <!--l. 264--><p class="noindent" >Before decoding can begin, a decoder must initialize using the bitstream headers matching the
- stream to be decoded. Vorbis uses three header packets; all are required, in-order, by
- this specification. Once set up, decode may begin at any audio packet belonging to
- the Vorbis stream. In Vorbis I, all packets after the three initial headers are audio
- packets.
- <!--l. 271--><p class="noindent" >The header packets are, in order, the identification header, the comments header, and the setup
- header.
- <!--l. 274--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-200001.3.1"></a><span
- class="cmbx-12">Identification Header</span></span>
- The identification header identifies the bitstream as Vorbis, Vorbis version, and the simple audio
- characteristics of the stream such as sample rate and number of channels.
-
-
- <!--l. 279--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-210001.3.1"></a><span
- class="cmbx-12">Comment Header</span></span>
- The comment header includes user text comments (“tags”) and a vendor string for the
- application/library that produced the bitstream. The encoding and proper use of the comment
- header is described in <a
- href="#x1-810005">Section 5<!--tex4ht:ref: vorbis:spec:comment --></a>, “<a
- href="#x1-810005">comment field and header specification<!--tex4ht:ref: vorbis:spec:comment --></a>”.
- <!--l. 284--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-220001.3.1"></a><span
- class="cmbx-12">Setup Header</span></span>
- The setup header includes extensive CODEC setup information as well as the complete VQ and
- Huffman codebooks needed for decode.
- <!--l. 289--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">1.3.2 </span> <a
- id="x1-230001.3.2"></a>Decode Procedure</h5>
- <!--l. 291--><p class="noindent" >The decoding and synthesis procedure for all audio packets is fundamentally the same.
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-23002x1">decode packet type flag
- </li>
- <li
- class="enumerate" id="x1-23004x2">decode mode number
- </li>
- <li
- class="enumerate" id="x1-23006x3">decode window shape (long windows only)
- </li>
- <li
- class="enumerate" id="x1-23008x4">decode floor
- </li>
- <li
- class="enumerate" id="x1-23010x5">decode residue into residue vectors
- </li>
- <li
- class="enumerate" id="x1-23012x6">inverse channel coupling of residue vectors
- </li>
- <li
- class="enumerate" id="x1-23014x7">generate floor curve from decoded floor data
- </li>
- <li
- class="enumerate" id="x1-23016x8">compute dot product of floor and residue, producing audio spectrum vector
- </li>
- <li
- class="enumerate" id="x1-23018x9">inverse monolithic transform of audio spectrum vector, always an MDCT in Vorbis
- I
-
-
- </li>
- <li
- class="enumerate" id="x1-23020x10">overlap/add left-hand output of transform with right-hand output of previous frame
- </li>
- <li
- class="enumerate" id="x1-23022x11">store right hand-data from transform of current frame for future lapping
- </li>
- <li
- class="enumerate" id="x1-23024x12">if not first frame, return results of overlap/add as audio result of current frame</li></ol>
- <!--l. 308--><p class="noindent" >Note that clever rearrangement of the synthesis arithmetic is possible; as an example, one can
- take advantage of symmetries in the MDCT to store the right-hand transform data of a partial
- MDCT for a 50% inter-frame buffer space savings, and then complete the transform later before
- overlap/add with the next frame. This optimization produces entirely equivalent output and is
- naturally perfectly legal. The decoder must be <span
- class="cmti-12">entirely mathematically equivalent </span>to the
- specification, it need not be a literal semantic implementation.
- <!--l. 317--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-240001.3.2"></a><span
- class="cmbx-12">Packet type decode</span></span>
- Vorbis I uses four packet types. The first three packet types mark each of the three Vorbis
- headers described above. The fourth packet type marks an audio packet. All other packet types
- are reserved; packets marked with a reserved type should be ignored.
- <!--l. 324--><p class="noindent" >Following the three header packets, all packets in a Vorbis I stream are audio. The first step of
- audio packet decode is to read and verify the packet type; <span
- class="cmti-12">a non-audio packet when audio is</span>
- <span
- class="cmti-12">expected indicates stream corruption or a non-compliant stream. The decoder must ignore the</span>
- <span
- class="cmti-12">packet and not attempt decoding it to audio</span>.
- <!--l. 334--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-250001.3.2"></a><span
- class="cmbx-12">Mode decode</span></span>
- Vorbis allows an encoder to set up multiple, numbered packet ’modes’, as described earlier, all of
- which may be used in a given Vorbis stream. The mode is encoded as an integer used as a direct
- offset into the mode instance index.
- <!--l. 341--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-260001.3.2"></a><span
- class="cmbx-12">Window shape decode (long windows only)</span></span>
- Vorbis frames may be one of two PCM sample sizes specified during codec setup. In Vorbis I,
- legal frame sizes are powers of two from 64 to 8192 samples. Aside from coupling, Vorbis
- handles channels as independent vectors and these frame sizes are in samples per
- channel.
-
-
- <!--l. 348--><p class="noindent" >Vorbis uses an overlapping transform, namely the MDCT, to blend one frame into the next,
- avoiding most inter-frame block boundary artifacts. The MDCT output of one frame is windowed
- according to MDCT requirements, overlapped 50% with the output of the previous frame and
- added. The window shape assures seamless reconstruction.
- <!--l. 354--><p class="noindent" >This is easy to visualize in the case of equal sized-windows:
- <div class="center"
- >
- <!--l. 356--><p class="noindent" >
- <!--l. 357--><p class="noindent" ><img
- src="window1.png" alt="PIC"
- >
- <br /> <table class="caption"
- ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 2: </td><td
- class="content">overlap of two equal-sized windows</td></tr></table><!--tex4ht:label?: x1-260012 -->
- </div>
- <!--l. 361--><p class="noindent" >And slightly more complex in the case of overlapping unequal sized windows:
- <div class="center"
- >
- <!--l. 364--><p class="noindent" >
- <!--l. 365--><p class="noindent" ><img
- src="window2.png" alt="PIC"
- >
- <br /> <table class="caption"
- ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 3: </td><td
- class="content">overlap of a long and a short window</td></tr></table><!--tex4ht:label?: x1-260023 -->
- </div>
- <!--l. 369--><p class="noindent" >In the unequal-sized window case, the window shape of the long window must be modified for
- seamless lapping as above. It is possible to correctly infer window shape to be applied to the
- current window from knowing the sizes of the current, previous and next window. It is legal for a
- decoder to use this method. However, in the case of a long window (short windows require no
- modification), Vorbis also codes two flag bits to specify pre- and post- window shape. Although
- not strictly necessary for function, this minor redundancy allows a packet to be fully decoded to
- the point of lapping entirely independently of any other packet, allowing easier abstraction of
- decode layers as well as allowing a greater level of easy parallelism in encode and
- decode.
- <!--l. 382--><p class="noindent" >A description of valid window functions for use with an inverse MDCT can be found in <span class="cite">[<a
- href="#XSporer/Brandenburg/Edler">1</a>]</span>.
- Vorbis windows all use the slope function
- <center class="math-display" >
- <img
- src="Vorbis_I_spec0x.png" alt="y = sin (.5 * π sin2((x + .5)∕n * π)).
-
-
- " class="math-display" ></center>
- <!--l. 385--><p class="nopar" >
- <!--l. 389--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-270001.3.2"></a><span
- class="cmbx-12">floor decode</span></span>
- Each floor is encoded/decoded in channel order, however each floor belongs to a ’submap’ that
- specifies which floor configuration to use. All floors are decoded before residue decode
- begins.
- <!--l. 395--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-280001.3.2"></a><span
- class="cmbx-12">residue decode</span></span>
- Although the number of residue vectors equals the number of channels, channel coupling may
- mean that the raw residue vectors extracted during decode do not map directly to specific
- channels. When channel coupling is in use, some vectors will correspond to coupled magnitude or
- angle. The coupling relationships are described in the codec setup and may differ from frame to
- frame, due to different mode numbers.
- <!--l. 404--><p class="noindent" >Vorbis codes residue vectors in groups by submap; the coding is done in submap order from
- submap 0 through n-1. This differs from floors which are coded using a configuration provided by
- submap number, but are coded individually in channel order.
- <!--l. 411--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-290001.3.2"></a><span
- class="cmbx-12">inverse channel coupling</span></span>
- A detailed discussion of stereo in the Vorbis codec can be found in the document
- <a
- href="stereo.html" >Stereo Channel Coupling in the Vorbis CODEC</a>. Vorbis is not limited to only stereo
- coupling, but the stereo document also gives a good overview of the generic coupling
- mechanism.
- <!--l. 419--><p class="noindent" >Vorbis coupling applies to pairs of residue vectors at a time; decoupling is done in-place a
- pair at a time in the order and using the vectors specified in the current mapping
- configuration. The decoupling operation is the same for all pairs, converting square polar
- representation (where one vector is magnitude and the second angle) back to Cartesian
- representation.
- <!--l. 426--><p class="noindent" >After decoupling, in order, each pair of vectors on the coupling list, the resulting residue vectors
- represent the fine spectral detail of each output channel.
-
-
- <!--l. 432--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-300001.3.2"></a><span
- class="cmbx-12">generate floor curve</span></span>
- The decoder may choose to generate the floor curve at any appropriate time. It is reasonable to
- generate the output curve when the floor data is decoded from the raw packet, or it
- can be generated after inverse coupling and applied to the spectral residue directly,
- combining generation and the dot product into one step and eliminating some working
- space.
- <!--l. 441--><p class="noindent" >Both floor 0 and floor 1 generate a linear-range, linear-domain output vector to be multiplied
- (dot product) by the linear-range, linear-domain spectral residue.
- <!--l. 447--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-310001.3.2"></a><span
- class="cmbx-12">compute floor/residue dot product</span></span>
- This step is straightforward; for each output channel, the decoder multiplies the floor curve and
- residue vectors element by element, producing the finished audio spectrum of each
- channel.
- <!--l. 455--><p class="noindent" >One point is worth mentioning about this dot product; a common mistake in a fixed point
- implementation might be to assume that a 32 bit fixed-point representation for floor and
- residue and direct multiplication of the vectors is sufficient for acceptable spectral depth
- in all cases because it happens to mostly work with the current Xiph.Org reference
- encoder.
- <!--l. 462--><p class="noindent" >However, floor vector values can span <span
- class="cmsy-10x-x-120">~</span>140dB (<span
- class="cmsy-10x-x-120">~</span>24 bits unsigned), and the audio spectrum
- vector should represent a minimum of 120dB (<span
- class="cmsy-10x-x-120">~</span>21 bits with sign), even when output is to a 16
- bit PCM device. For the residue vector to represent full scale if the floor is nailed
- to <span
- class="cmsy-10x-x-120">-</span>140dB, it must be able to span 0 to +140dB. For the residue vector to reach
- full scale if the floor is nailed at 0dB, it must be able to represent <span
- class="cmsy-10x-x-120">-</span>140dB to +0dB.
- Thus, in order to handle full range dynamics, a residue vector may span <span
- class="cmsy-10x-x-120">-</span>140dB to
- +140dB entirely within spec. A 280dB range is approximately 48 bits with sign; thus the
- residue vector must be able to represent a 48 bit range and the dot product must
- be able to handle an effective 48 bit times 24 bit multiplication. This range may be
- achieved using large (64 bit or larger) integers, or implementing a movable binary point
- representation.
- <!--l. 479--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-320001.3.2"></a><span
- class="cmbx-12">inverse monolithic transform (MDCT)</span></span>
- The audio spectrum is converted back into time domain PCM audio via an inverse Modified
- Discrete Cosine Transform (MDCT). A detailed description of the MDCT is available in
- <span class="cite">[<a
- href="#XSporer/Brandenburg/Edler">1</a>]</span>.
- <!--l. 485--><p class="noindent" >Note that the PCM produced directly from the MDCT is not yet finished audio; it must be
-
-
- lapped with surrounding frames using an appropriate window (such as the Vorbis window) before
- the MDCT can be considered orthogonal.
- <!--l. 492--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-330001.3.2"></a><span
- class="cmbx-12">overlap/add data</span></span>
- Windowed MDCT output is overlapped and added with the right hand data of the previous
- window such that the 3/4 point of the previous window is aligned with the 1/4 point of the
- current window (as illustrated in the window overlap diagram). At this point, the audio data
- between the center of the previous frame and the center of the current frame is now finished and
- ready to be returned.
- <!--l. 501--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-340001.3.2"></a><span
- class="cmbx-12">cache right hand data</span></span>
- The decoder must cache the right hand portion of the current frame to be lapped with the left
- hand portion of the next frame.
- <!--l. 507--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-350001.3.2"></a><span
- class="cmbx-12">return finished audio data</span></span>
- The overlapped portion produced from overlapping the previous and current frame data
- is finished data to be returned by the decoder. This data spans from the center of
- the previous window to the center of the current window. In the case of same-sized
- windows, the amount of data to return is one-half block consisting of and only of the
- overlapped portions. When overlapping a short and long window, much of the returned
- range is not actually overlap. This does not damage transform orthogonality. Pay
- attention however to returning the correct data range; the amount of data to be returned
- is:
- <!--l. 519--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb1">
- <a
- id="x1-35002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> window_blocksize(previous_window)/4+window_blocksize(current_window)/4</span>
- </div>
- <!--l. 523--><p class="noindent" >from the center of the previous window to the center of the current window.
- <!--l. 526--><p class="noindent" >Data is not returned from the first frame; it must be used to ’prime’ the decode engine. The
- encoder accounts for this priming when calculating PCM offsets; after the first frame, the proper
- PCM output offset is ’0’ (as no data has been returned yet).
-
-
-
-
- <h3 class="sectionHead"><span class="titlemark">2 </span> <a
- id="x1-360002"></a>Bitpacking Convention</h3>
- <!--l. 6--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">2.1 </span> <a
- id="x1-370002.1"></a>Overview</h4>
- <!--l. 8--><p class="noindent" >The Vorbis codec uses relatively unstructured raw packets containing arbitrary-width binary
- integer fields. Logically, these packets are a bitstream in which bits are coded one-by-one by the
- encoder and then read one-by-one in the same monotonically increasing order by the decoder.
- Most current binary storage arrangements group bits into a native word size of eight bits
- (octets), sixteen bits, thirty-two bits or, less commonly other fixed word sizes. The Vorbis
- bitpacking convention specifies the correct mapping of the logical packet bitstream into an actual
- representation in fixed-width words.
- <!--l. 19--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">2.1.1 </span> <a
- id="x1-380002.1.1"></a>octets, bytes and words</h5>
- <!--l. 21--><p class="noindent" >In most contemporary architectures, a ’byte’ is synonymous with an ’octet’, that is, eight bits.
- This has not always been the case; seven, ten, eleven and sixteen bit ’bytes’ have been used.
- For purposes of the bitpacking convention, a byte implies the native, smallest integer
- storage representation offered by a platform. On modern platforms, this is generally
- assumed to be eight bits (not necessarily because of the processor but because of the
- filesystem/memory architecture. Modern filesystems invariably offer bytes as the fundamental
- atom of storage). A ’word’ is an integer size that is a grouped multiple of this smallest
- size.
- <!--l. 32--><p class="noindent" >The most ubiquitous architectures today consider a ’byte’ to be an octet (eight bits) and a word
- to be a group of two, four or eight bytes (16, 32 or 64 bits). Note however that the Vorbis
- bitpacking convention is still well defined for any native byte size; Vorbis uses the native
- bit-width of a given storage system. This document assumes that a byte is one octet for purposes
- of example.
- <!--l. 39--><p class="noindent" >
-
-
- <h5 class="subsubsectionHead"><span class="titlemark">2.1.2 </span> <a
- id="x1-390002.1.2"></a>bit order</h5>
- <!--l. 41--><p class="noindent" >A byte has a well-defined ’least significant’ bit (LSb), which is the only bit set when the byte is
- storing the two’s complement integer value +1. A byte’s ’most significant’ bit (MSb) is at the
- opposite end of the byte. Bits in a byte are numbered from zero at the LSb to <span
- class="cmmi-12">n </span>(<span
- class="cmmi-12">n </span>= 7 in an
- octet) for the MSb.
- <!--l. 50--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">2.1.3 </span> <a
- id="x1-400002.1.3"></a>byte order</h5>
- <!--l. 52--><p class="noindent" >Words are native groupings of multiple bytes. Several byte orderings are possible in a word; the
- common ones are 3-2-1-0 (’big endian’ or ’most significant byte first’ in which the
- highest-valued byte comes first), 0-1-2-3 (’little endian’ or ’least significant byte first’ in
- which the lowest value byte comes first) and less commonly 3-1-2-0 and 0-2-1-3 (’mixed
- endian’).
- <!--l. 59--><p class="noindent" >The Vorbis bitpacking convention specifies storage and bitstream manipulation at the byte, not
- word, level, thus host word ordering is of a concern only during optimization when writing high
- performance code that operates on a word of storage at a time rather than by byte.
- Logically, bytes are always coded and decoded in order from byte zero through byte
- <span
- class="cmmi-12">n</span>.
- <!--l. 68--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">2.1.4 </span> <a
- id="x1-410002.1.4"></a>coding bits into byte sequences</h5>
- <!--l. 70--><p class="noindent" >The Vorbis codec has need to code arbitrary bit-width integers, from zero to 32 bits
- wide, into packets. These integer fields are not aligned to the boundaries of the byte
- representation; the next field is written at the bit position at which the previous field
- ends.
- <!--l. 75--><p class="noindent" >The encoder logically packs integers by writing the LSb of a binary integer to the logical
- bitstream first, followed by next least significant bit, etc, until the requested number of bits
- have been coded. When packing the bits into bytes, the encoder begins by placing
- the LSb of the integer to be written into the least significant unused bit position of
- the destination byte, followed by the next-least significant bit of the source integer
- and so on up to the requested number of bits. When all bits of the destination byte
- have been filled, encoding continues by zeroing all bits of the next byte and writing
- the next bit into the bit position 0 of that byte. Decoding follows the same process
-
-
- as encoding, but by reading bits from the byte stream and reassembling them into
- integers.
- <!--l. 90--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">2.1.5 </span> <a
- id="x1-420002.1.5"></a>signedness</h5>
- <!--l. 92--><p class="noindent" >The signedness of a specific number resulting from decode is to be interpreted by the decoder
- given decode context. That is, the three bit binary pattern ’b111’ can be taken to represent
- either ’seven’ as an unsigned integer, or ’-1’ as a signed, two’s complement integer. The
- encoder and decoder are responsible for knowing if fields are to be treated as signed or
- unsigned.
- <!--l. 101--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">2.1.6 </span> <a
- id="x1-430002.1.6"></a>coding example</h5>
- <!--l. 103--><p class="noindent" >Code the 4 bit integer value ’12’ [b1100] into an empty bytestream. Bytestream result:
- <!--l. 106--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb2">
- <a
- id="x1-43002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> |</span>
- <br class="fancyvrb" /><a
- id="x1-43004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> V</span>
- <br class="fancyvrb" /><a
- id="x1-43006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-43008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-43010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> [0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> <-</span>
- <br class="fancyvrb" /><a
- id="x1-43012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-43014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-43016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-43018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ...</span>
- <br class="fancyvrb" /><a
- id="x1-43020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> n</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> bytestream</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> ==</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> byte</span>
- <br class="fancyvrb" /><a
- id="x1-43022r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- </div>
- <!--l. 121--><p class="noindent" >Continue by coding the 3 bit integer value ’-1’ [b111]:
- <!--l. 123--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb3">
- <a
- id="x1-43024r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> |</span>
- <br class="fancyvrb" /><a
- id="x1-43026r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> V</span>
- <br class="fancyvrb" /><a
- id="x1-43028r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-43030r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-43032r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> [0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> <-</span>
- <br class="fancyvrb" /><a
- id="x1-43034r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ]</span>
-
-
- <br class="fancyvrb" /><a
- id="x1-43036r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-43038r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-43040r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ...</span>
- <br class="fancyvrb" /><a
- id="x1-43042r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> n</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> bytestream</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> ==</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> byte</span>
- </div>
- <!--l. 137--><p class="noindent" >Continue by coding the 7 bit integer value ’17’ [b0010001]:
- <!--l. 139--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb4">
- <a
- id="x1-43044r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> |</span>
- <br class="fancyvrb" /><a
- id="x1-43046r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> V</span>
- <br class="fancyvrb" /><a
- id="x1-43048r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-43050r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-43052r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> [1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0]</span>
- <br class="fancyvrb" /><a
- id="x1-43054r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> [0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> <-</span>
- <br class="fancyvrb" /><a
- id="x1-43056r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-43058r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-43060r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ...</span>
- <br class="fancyvrb" /><a
- id="x1-43062r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> n</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> bytestream</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> ==</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> bytes</span>
- <br class="fancyvrb" /><a
- id="x1-43064r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> cursor</span><span
- class="cmtt-8"> ==</span><span
- class="cmtt-8"> 6</span>
- </div>
- <!--l. 154--><p class="noindent" >Continue by coding the 13 bit integer value ’6969’ [b110 11001110 01]:
- <!--l. 156--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb5">
- <a
- id="x1-43066r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> |</span>
- <br class="fancyvrb" /><a
- id="x1-43068r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> V</span>
- <br class="fancyvrb" /><a
- id="x1-43070r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-43072r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-43074r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> [1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0]</span>
- <br class="fancyvrb" /><a
- id="x1-43076r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> [0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0]</span>
- <br class="fancyvrb" /><a
- id="x1-43078r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> [1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0]</span>
- <br class="fancyvrb" /><a
- id="x1-43080r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> [0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> <-</span>
- <br class="fancyvrb" /><a
- id="x1-43082r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ...</span>
- <br class="fancyvrb" /><a
- id="x1-43084r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> n</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> bytestream</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> ==</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> bytes</span>
- <br class="fancyvrb" /><a
- id="x1-43086r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- </div>
- <!--l. 173--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">2.1.7 </span> <a
- id="x1-440002.1.7"></a>decoding example</h5>
- <!--l. 175--><p class="noindent" >Reading from the beginning of the bytestream encoded in the above example:
- <!--l. 177--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb6">
-
-
- <a
- id="x1-44002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> |</span>
- <br class="fancyvrb" /><a
- id="x1-44004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> V</span>
- <br class="fancyvrb" /><a
- id="x1-44006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-44008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-44010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> [1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> <-</span>
- <br class="fancyvrb" /><a
- id="x1-44012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> [0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0]</span>
- <br class="fancyvrb" /><a
- id="x1-44014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> [1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0]</span>
- <br class="fancyvrb" /><a
- id="x1-44016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> [0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> bytestream</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> ==</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> bytes</span>
- <br class="fancyvrb" /><a
- id="x1-44018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- </div>
- <!--l. 190--><p class="noindent" >We read two, two-bit integer fields, resulting in the returned numbers ’b00’ and ’b11’. Two things
- are worth noting here:
- <ul class="itemize1">
- <li class="itemize">Although these four bits were originally written as a single four-bit integer, reading
- some other combination of bit-widths from the bitstream is well defined. There are
- no artificial alignment boundaries maintained in the bitstream.
- </li>
- <li class="itemize">The second value is the two-bit-wide integer ’b11’. This value may be interpreted
- either as the unsigned value ’3’, or the signed value ’-1’. Signedness is dependent on
- decode context.</li></ul>
- <!--l. 208--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">2.1.8 </span> <a
- id="x1-450002.1.8"></a>end-of-packet alignment</h5>
- <!--l. 210--><p class="noindent" >The typical use of bitpacking is to produce many independent byte-aligned packets which are
- embedded into a larger byte-aligned container structure, such as an Ogg transport bitstream.
- Externally, each bytestream (encoded bitstream) must begin and end on a byte boundary. Often,
- the encoded bitstream is not an integer number of bytes, and so there is unused (uncoded) space
- in the last byte of a packet.
- <!--l. 218--><p class="noindent" >Unused space in the last byte of a bytestream is always zeroed during the coding process. Thus,
- should this unused space be read, it will return binary zeroes.
- <!--l. 222--><p class="noindent" >Attempting to read past the end of an encoded packet results in an ’end-of-packet’ condition.
- End-of-packet is not to be considered an error; it is merely a state indicating that there is
- insufficient remaining data to fulfill the desired read size. Vorbis uses truncated packets as a
- normal mode of operation, and as such, decoders must handle reading past the end of a packet as
- a typical mode of operation. Any further read operations after an ’end-of-packet’ condition shall
- also return ’end-of-packet’.
-
-
- <!--l. 233--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">2.1.9 </span> <a
- id="x1-460002.1.9"></a>reading zero bits</h5>
- <!--l. 235--><p class="noindent" >Reading a zero-bit-wide integer returns the value ’0’ and does not increment the stream cursor.
- Reading to the end of the packet (but not past, such that an ’end-of-packet’ condition has not
- triggered) and then reading a zero bit integer shall succeed, returning 0, and not trigger an
- end-of-packet condition. Reading a zero-bit-wide integer after a previous read sets ’end-of-packet’
- shall also fail with ’end-of-packet’.
-
-
-
-
- <h3 class="sectionHead"><span class="titlemark">3 </span> <a
- id="x1-470003"></a>Probability Model and Codebooks</h3>
- <!--l. 6--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">3.1 </span> <a
- id="x1-480003.1"></a>Overview</h4>
- <!--l. 8--><p class="noindent" >Unlike practically every other mainstream audio codec, Vorbis has no statically configured
- probability model, instead packing all entropy decoding configuration, VQ and Huffman, into the
- bitstream itself in the third header, the codec setup header. This packed configuration consists of
- multiple ’codebooks’, each containing a specific Huffman-equivalent representation for decoding
- compressed codewords as well as an optional lookup table of output vector values to which a
- decoded Huffman value is applied as an offset, generating the final decoded output corresponding
- to a given compressed codeword.
- <!--l. 18--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">3.1.1 </span> <a
- id="x1-490003.1.1"></a>Bitwise operation</h5>
- <!--l. 19--><p class="noindent" >The codebook mechanism is built on top of the vorbis bitpacker. Both the codebooks themselves
- and the codewords they decode are unrolled from a packet as a series of arbitrary-width values
- read from the stream according to <a
- href="#x1-360002">Section 2<!--tex4ht:ref: vorbis:spec:bitpacking --></a>, “<a
- href="#x1-360002">Bitpacking Convention<!--tex4ht:ref: vorbis:spec:bitpacking --></a>”.
- <!--l. 27--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">3.2 </span> <a
- id="x1-500003.2"></a>Packed codebook format</h4>
- <!--l. 29--><p class="noindent" >For purposes of the examples below, we assume that the storage system’s native byte width is
- eight bits. This is not universally true; see <a
- href="#x1-360002">Section 2<!--tex4ht:ref: vorbis:spec:bitpacking --></a>, “<a
- href="#x1-360002">Bitpacking Convention<!--tex4ht:ref: vorbis:spec:bitpacking --></a>” for discussion
- relating to non-eight-bit bytes.
-
-
- <!--l. 34--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">3.2.1 </span> <a
- id="x1-510003.2.1"></a>codebook decode</h5>
- <!--l. 36--><p class="noindent" >A codebook begins with a 24 bit sync pattern, 0x564342:
- <!--l. 38--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb7">
- <a
- id="x1-51002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 0:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ]</span><span
- class="cmtt-8"> (0x42)</span>
- <br class="fancyvrb" /><a
- id="x1-51004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 1:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> ]</span><span
- class="cmtt-8"> (0x43)</span>
- <br class="fancyvrb" /><a
- id="x1-51006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 2:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ]</span><span
- class="cmtt-8"> (0x56)</span>
- </div>
- <!--l. 44--><p class="noindent" >16 bit <span
- class="cmtt-12">[codebook_dimensions] </span>and 24 bit <span
- class="cmtt-12">[codebook_entries] </span>fields:
- <!--l. 46--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb8">
- <a
- id="x1-51008r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51010r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 3:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-51012r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 4:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> ]</span><span
- class="cmtt-8"> [codebook_dimensions]</span><span
- class="cmtt-8"> (16</span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> unsigned)</span>
- <br class="fancyvrb" /><a
- id="x1-51014r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51016r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 5:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-51018r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 6:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-51020r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 7:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> ]</span><span
- class="cmtt-8"> [codebook_entries]</span><span
- class="cmtt-8"> (24</span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> unsigned)</span>
- <br class="fancyvrb" /><a
- id="x1-51022r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- </div>
- <!--l. 57--><p class="noindent" >Next is the <span
- class="cmtt-12">[ordered] </span>bit flag:
- <!--l. 59--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb9">
- <a
- id="x1-51024r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51026r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 8:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> ]</span><span
- class="cmtt-8"> [ordered]</span><span
- class="cmtt-8"> (1</span><span
- class="cmtt-8"> bit)</span>
- <br class="fancyvrb" /><a
- id="x1-51028r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- </div>
- <!--l. 65--><p class="noindent" >Each entry, numbering a total of <span
- class="cmtt-12">[codebook_entries]</span>, is assigned a codeword length.
- We now read the list of codeword lengths and store these lengths in the array
- <span
- class="cmtt-12">[codebook_codeword_lengths]</span>. Decode of lengths is according to whether the <span
- class="cmtt-12">[ordered] </span>flag
- is set or unset.
- <ul class="itemize1">
- <li class="itemize">If the <span
- class="cmtt-12">[ordered] </span>flag is unset, the codeword list is not length ordered and the decoder
- needs to read each codeword length one-by-one.
- <!--l. 77--><p class="noindent" >The decoder first reads one additional bit flag, the <span
- class="cmtt-12">[sparse] </span>flag. This flag determines
- whether or not the codebook contains unused entries that are not to be included in
-
-
- the codeword decode tree:
- <!--l. 82--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb10">
- <a
- id="x1-51030r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> byte</span><span
- class="cmtt-8"> 8:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> X</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> ]</span><span
- class="cmtt-8"> [sparse]</span><span
- class="cmtt-8"> flag</span><span
- class="cmtt-8"> (1</span><span
- class="cmtt-8"> bit)</span>
- </div>
- <!--l. 86--><p class="noindent" >The decoder now performs for each of the <span
- class="cmtt-12">[codebook_entries] </span>codebook entries:
- <!--l. 89--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb11">
- <a
- id="x1-51032r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51034r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> if([sparse]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> set)</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-51036r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51038r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [flag]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> one</span><span
- class="cmtt-8"> bit;</span>
- <br class="fancyvrb" /><a
- id="x1-51040r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> if([flag]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> set)</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-51042r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51044r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> [length]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> a</span><span
- class="cmtt-8"> five</span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer;</span>
- <br class="fancyvrb" /><a
- id="x1-51046r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> codeword</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> for</span><span
- class="cmtt-8"> this</span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> [length]+1;</span>
- <br class="fancyvrb" /><a
- id="x1-51048r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51050r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span><span
- class="cmtt-8"> else</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-51052r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51054r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> this</span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> unused.</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> mark</span><span
- class="cmtt-8"> it</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> such.</span>
- <br class="fancyvrb" /><a
- id="x1-51056r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51058r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-51060r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51062r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span><span
- class="cmtt-8"> else</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> sparse</span><span
- class="cmtt-8"> flag</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> not</span><span
- class="cmtt-8"> set</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-51064r17"></a><span
- class="cmr-6">17</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51066r18"></a><span
- class="cmr-6">18</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> [length]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> a</span><span
- class="cmtt-8"> five</span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer;</span>
- <br class="fancyvrb" /><a
- id="x1-51068r19"></a><span
- class="cmr-6">19</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 8)</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> codeword</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> for</span><span
- class="cmtt-8"> this</span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> [length]+1;</span>
- <br class="fancyvrb" /><a
- id="x1-51070r20"></a><span
- class="cmr-6">20</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51072r21"></a><span
- class="cmr-6">21</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-51074r22"></a><span
- class="cmr-6">22</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- </div>
- </li>
- <li class="itemize">If the <span
- class="cmtt-12">[ordered] </span>flag is set, the codeword list for this codebook is encoded in
- ascending length order. Rather than reading a length for every codeword, the
- encoder reads the number of codewords per length. That is, beginning at entry
- zero:
- <!--l. 120--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb12">
- <a
- id="x1-51076r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [current_entry]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 0;</span>
- <br class="fancyvrb" /><a
- id="x1-51078r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [current_length]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> a</span><span
- class="cmtt-8"> five</span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> and</span><span
- class="cmtt-8"> add</span><span
- class="cmtt-8"> 1;</span>
- <br class="fancyvrb" /><a
- id="x1-51080r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> [number]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> </span><a
- href="#x1-1170009.2.1"><span
- class="cmtt-8">ilog</span></a><span
- class="cmtt-8">([codebook_entries]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> [current_entry])</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-51082r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> set</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> entries</span><span
- class="cmtt-8"> [current_entry]</span><span
- class="cmtt-8"> through</span><span
- class="cmtt-8"> [current_entry]+[number]-1,</span><span
- class="cmtt-8"> inclusive,</span>
- <br class="fancyvrb" /><a
- id="x1-51084r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> [codebook_codeword_lengths]</span><span
- class="cmtt-8"> array</span><span
- class="cmtt-8"> to</span><span
- class="cmtt-8"> [current_length]</span>
- <br class="fancyvrb" /><a
- id="x1-51086r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> set</span><span
- class="cmtt-8"> [current_entry]</span><span
- class="cmtt-8"> to</span><span
- class="cmtt-8"> [number]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [current_entry]</span>
- <br class="fancyvrb" /><a
- id="x1-51088r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> increment</span><span
- class="cmtt-8"> [current_length]</span><span
- class="cmtt-8"> by</span><span
- class="cmtt-8"> 1</span>
- <br class="fancyvrb" /><a
- id="x1-51090r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> [current_entry]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> greater</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> [codebook_entries]</span><span
- class="cmtt-8"> ERROR</span><span
- class="cmtt-8"> CONDITION;</span>
- <br class="fancyvrb" /><a
- id="x1-51092r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> decoder</span><span
- class="cmtt-8"> will</span><span
- class="cmtt-8"> not</span><span
- class="cmtt-8"> be</span><span
- class="cmtt-8"> able</span><span
- class="cmtt-8"> to</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> this</span><span
- class="cmtt-8"> stream.</span>
- <br class="fancyvrb" /><a
- id="x1-51094r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 8)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> [current_entry]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> less</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> [codebook_entries],</span><span
- class="cmtt-8"> repeat</span><span
- class="cmtt-8"> process</span><span
- class="cmtt-8"> starting</span><span
- class="cmtt-8"> at</span><span
- class="cmtt-8"> 3)</span>
- <br class="fancyvrb" /><a
- id="x1-51096r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 9)</span><span
- class="cmtt-8"> done.</span>
-
-
- </div>
- </li></ul>
- <!--l. 136--><p class="noindent" >After all codeword lengths have been decoded, the decoder reads the vector lookup table. Vorbis
- I supports three lookup types:
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-51098x1">No lookup
- </li>
- <li
- class="enumerate" id="x1-51100x2">Implicitly populated value mapping (lattice VQ)
- </li>
- <li
- class="enumerate" id="x1-51102x3">Explicitly populated value mapping (tessellated or ’foam’ VQ)</li></ol>
- <!--l. 149--><p class="noindent" >The lookup table type is read as a four bit unsigned integer:
- <div class="fancyvrb" id="fancyvrb13">
- <a
- id="x1-51104r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [codebook_lookup_type]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> four</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- </div>
- <!--l. 154--><p class="noindent" >Codebook decode precedes according to <span
- class="cmtt-12">[codebook_lookup_type]</span>:
- <ul class="itemize1">
- <li class="itemize">Lookup type zero indicates no lookup to be read. Proceed past lookup decode.
- </li>
- <li class="itemize">Lookup types one and two are similar, differing only in the number of lookup values to
- be read. Lookup type one reads a list of values that are permuted in a set pattern to
- build a list of vectors, each vector of order <span
- class="cmtt-12">[codebook_dimensions] </span>scalars. Lookup
- type two builds the same vector list, but reads each scalar for each vector explicitly,
- rather than building vectors from a smaller list of possible scalar values. Lookup
- decode proceeds as follows:
- <!--l. 168--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb14">
- <a
- id="x1-51106r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [codebook_minimum_value]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> </span><a
- href="#x1-1180009.2.2"><span
- class="cmtt-8">float32_unpack</span></a><span
- class="cmtt-8">(</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 32</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer)</span>
- <br class="fancyvrb" /><a
- id="x1-51108r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [codebook_delta_value]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> </span><a
- href="#x1-1180009.2.2"><span
- class="cmtt-8">float32_unpack</span></a><span
- class="cmtt-8">(</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 32</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer)</span>
- <br class="fancyvrb" /><a
- id="x1-51110r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> [codebook_value_bits]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> and</span><span
- class="cmtt-8"> add</span><span
- class="cmtt-8"> 1</span>
- <br class="fancyvrb" /><a
- id="x1-51112r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> [codebook_sequence_p]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> a</span><span
- class="cmtt-8"> boolean</span><span
- class="cmtt-8"> flag</span>
- <br class="fancyvrb" /><a
- id="x1-51114r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51116r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [codebook_lookup_type]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-51118r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51120r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> [codebook_lookup_values]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> </span><a
- href="#x1-1190009.2.3"><span
- class="cmtt-8">lookup1_values</span></a><span
- class="cmtt-8">([codebook_entries],</span><span
- class="cmtt-8"> [codebook_dimensions]</span><span
- class="cmtt-8"> )</span>
- <br class="fancyvrb" /><a
- id="x1-51122r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51124r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span><span
- class="cmtt-8"> else</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-51126r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51128r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> [codebook_lookup_values]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [codebook_entries]</span><span
- class="cmtt-8"> *</span><span
- class="cmtt-8"> [codebook_dimensions]</span>
- <br class="fancyvrb" /><a
- id="x1-51130r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51132r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-51134r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-51136r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> a</span><span
- class="cmtt-8"> total</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> [codebook_lookup_values]</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integers</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> [codebook_value_bits]</span><span
- class="cmtt-8"> each;</span>
-
-
- <br class="fancyvrb" /><a
- id="x1-51138r17"></a><span
- class="cmr-6">17</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> store</span><span
- class="cmtt-8"> these</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> order</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> array</span><span
- class="cmtt-8"> [codebook_multiplicands]</span>
- </div>
- </li>
- <li class="itemize">A <span
- class="cmtt-12">[codebook_lookup_type] </span>of greater than two is reserved and indicates a stream that is
- not decodable by the specification in this document.
- </li></ul>
- <!--l. 195--><p class="noindent" >An ’end of packet’ during any read operation in the above steps is considered an error condition
- rendering the stream undecodable.
- <!--l. 198--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-520003.2.1"></a><span
- class="cmbx-12">Huffman decision tree representation</span></span>
- The <span
- class="cmtt-12">[codebook_codeword_lengths] </span>array and <span
- class="cmtt-12">[codebook_entries] </span>value uniquely define the
- Huffman decision tree used for entropy decoding.
- <!--l. 204--><p class="noindent" >Briefly, each used codebook entry (recall that length-unordered codebooks support unused
- codeword entries) is assigned, in order, the lowest valued unused binary Huffman codeword
- possible. Assume the following codeword length list:
- <!--l. 209--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb15">
- <a
- id="x1-52002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 0:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 2</span>
- <br class="fancyvrb" /><a
- id="x1-52004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 1:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 4</span>
- <br class="fancyvrb" /><a
- id="x1-52006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 2:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 4</span>
- <br class="fancyvrb" /><a
- id="x1-52008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 3:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 4</span>
- <br class="fancyvrb" /><a
- id="x1-52010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 4:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 4</span>
- <br class="fancyvrb" /><a
- id="x1-52012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 5:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 2</span>
- <br class="fancyvrb" /><a
- id="x1-52014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 6:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 3</span>
- <br class="fancyvrb" /><a
- id="x1-52016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 7:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 3</span>
- </div>
- <!--l. 220--><p class="noindent" >Assigning codewords in order (lowest possible value of the appropriate length to highest) results
- in the following codeword list:
- <!--l. 223--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb16">
- <a
- id="x1-52018r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 0:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> codeword</span><span
- class="cmtt-8"> 00</span>
- <br class="fancyvrb" /><a
- id="x1-52020r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 1:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> codeword</span><span
- class="cmtt-8"> 0100</span>
- <br class="fancyvrb" /><a
- id="x1-52022r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 2:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> codeword</span><span
- class="cmtt-8"> 0101</span>
- <br class="fancyvrb" /><a
- id="x1-52024r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 3:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> codeword</span><span
- class="cmtt-8"> 0110</span>
- <br class="fancyvrb" /><a
- id="x1-52026r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 4:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> codeword</span><span
- class="cmtt-8"> 0111</span>
- <br class="fancyvrb" /><a
- id="x1-52028r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 5:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> codeword</span><span
- class="cmtt-8"> 10</span>
- <br class="fancyvrb" /><a
- id="x1-52030r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 6:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> codeword</span><span
- class="cmtt-8"> 110</span>
- <br class="fancyvrb" /><a
- id="x1-52032r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> entry</span><span
- class="cmtt-8"> 7:</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> codeword</span><span
- class="cmtt-8"> 111</span>
- </div>
-
-
- <!--l. 235--><p class="noindent" ><span class="likesubparagraphHead"><a
- id="x1-530003.2.1"></a><span
- class="cmbx-12">Note:</span></span> Unlike most binary numerical values in this document, we intend the above codewords to
- be read and used bit by bit from left to right, thus the codeword ’001’ is the bit string ’zero, zero,
- one’. When determining ’lowest possible value’ in the assignment definition above, the leftmost
- bit is the MSb.
- <!--l. 243--><p class="noindent" >It is clear that the codeword length list represents a Huffman decision tree with the entry
- numbers equivalent to the leaves numbered left-to-right:
- <div class="center"
- >
- <!--l. 247--><p class="noindent" >
- <!--l. 248--><p class="noindent" ><img
- src="hufftree.png" alt="PIC"
- >
- <br /> <table class="caption"
- ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 4: </td><td
- class="content">huffman tree illustration</td></tr></table><!--tex4ht:label?: x1-530014 -->
- </div>
- <!--l. 253--><p class="noindent" >As we assign codewords in order, we see that each choice constructs a new leaf in the leftmost
- possible position.
- <!--l. 256--><p class="noindent" >Note that it’s possible to underspecify or overspecify a Huffman tree via the length list.
- In the above example, if codeword seven were eliminated, it’s clear that the tree is
- unfinished:
- <div class="center"
- >
- <!--l. 260--><p class="noindent" >
- <!--l. 261--><p class="noindent" ><img
- src="hufftree-under.png" alt="PIC"
- >
- <br /> <table class="caption"
- ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 5: </td><td
- class="content">underspecified huffman tree illustration</td></tr></table><!--tex4ht:label?: x1-530025 -->
- </div>
- <!--l. 266--><p class="noindent" >Similarly, in the original codebook, it’s clear that the tree is fully populated and a ninth
- codeword is impossible. Both underspecified and overspecified trees are an error condition
- rendering the stream undecodable. Take special care that a codebook with a single used
- entry is handled properly; it consists of a single codework of zero bits and ’reading’
- a value out of such a codebook always returns the single used value and sinks zero
- bits.
- <!--l. 274--><p class="noindent" >Codebook entries marked ’unused’ are simply skipped in the assigning process. They have no
- codeword and do not appear in the decision tree, thus it’s impossible for any bit pattern read
- from the stream to decode to that entry number.
-
-
- <!--l. 281--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-540003.2.1"></a><span
- class="cmbx-12">VQ lookup table vector representation</span></span>
- Unpacking the VQ lookup table vectors relies on the following values:
- <div class="fancyvrb" id="fancyvrb17">
- <a
- id="x1-54002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> [codebook_multiplicands]</span><span
- class="cmtt-8"> array</span>
- <br class="fancyvrb" /><a
- id="x1-54004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [codebook_minimum_value]</span>
- <br class="fancyvrb" /><a
- id="x1-54006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [codebook_delta_value]</span>
- <br class="fancyvrb" /><a
- id="x1-54008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [codebook_sequence_p]</span>
- <br class="fancyvrb" /><a
- id="x1-54010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [codebook_lookup_type]</span>
- <br class="fancyvrb" /><a
- id="x1-54012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [codebook_entries]</span>
- <br class="fancyvrb" /><a
- id="x1-54014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [codebook_dimensions]</span>
- <br class="fancyvrb" /><a
- id="x1-54016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [codebook_lookup_values]</span>
- </div>
- <!--l. 297--><p class="noindent" >Decoding (unpacking) a specific vector in the vector lookup table proceeds according to
- <span
- class="cmtt-12">[codebook_lookup_type]</span>. The unpacked vector values are what a codebook would return
- during audio packet decode in a VQ context.
- <!--l. 302--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-550003.2.1"></a><span
- class="cmbx-12">Vector value decode: Lookup type 1</span></span>
- Lookup type one specifies a lattice VQ lookup table built algorithmically from a list of
- scalar values. Calculate (unpack) the final values of a codebook entry vector from
- the entries in <span
- class="cmtt-12">[codebook_multiplicands] </span>as follows (<span
- class="cmtt-12">[value_vector] </span>is the output
- vector representing the vector of values for entry number <span
- class="cmtt-12">[lookup_offset] </span>in this
- codebook):
- <!--l. 311--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb18">
- <a
- id="x1-55002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [last]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 0;</span>
- <br class="fancyvrb" /><a
- id="x1-55004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [index_divisor]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 1;</span>
- <br class="fancyvrb" /><a
- id="x1-55006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [codebook_dimensions]-1</span><span
- class="cmtt-8"> (once</span><span
- class="cmtt-8"> for</span><span
- class="cmtt-8"> each</span><span
- class="cmtt-8"> scalar</span><span
- class="cmtt-8"> value</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> value</span><span
- class="cmtt-8"> vector)</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-55008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-55010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> [multiplicand_offset]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [lookup_offset]</span><span
- class="cmtt-8"> divided</span><span
- class="cmtt-8"> by</span><span
- class="cmtt-8"> [index_divisor]</span><span
- class="cmtt-8"> using</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-55012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> division</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> modulo</span><span
- class="cmtt-8"> [codebook_lookup_values]</span>
- <br class="fancyvrb" /><a
- id="x1-55014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-55016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [value_vector]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span>
- <br class="fancyvrb" /><a
- id="x1-55018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [codebook_multiplicands]</span><span
- class="cmtt-8"> array</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> number</span><span
- class="cmtt-8"> [multiplicand_offset]</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> *</span>
- <br class="fancyvrb" /><a
- id="x1-55020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [codebook_delta_value]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [codebook_minimum_value]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [last];</span>
- <br class="fancyvrb" /><a
- id="x1-55022r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-55024r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [codebook_sequence_p]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> set</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> then</span><span
- class="cmtt-8"> set</span><span
- class="cmtt-8"> [last]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [value_vector]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span>
- <br class="fancyvrb" /><a
- id="x1-55026r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-55028r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> [index_divisor]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [index_divisor]</span><span
- class="cmtt-8"> *</span><span
- class="cmtt-8"> [codebook_lookup_values]</span>
- <br class="fancyvrb" /><a
- id="x1-55030r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-55032r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-55034r17"></a><span
- class="cmr-6">17</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-55036r18"></a><span
- class="cmr-6">18</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 8)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> calculation</span><span
- class="cmtt-8"> completed.</span>
- </div>
-
-
- <!--l. 334--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-560003.2.1"></a><span
- class="cmbx-12">Vector value decode: Lookup type 2</span></span>
- Lookup type two specifies a VQ lookup table in which each scalar in each vector is explicitly set
- by the <span
- class="cmtt-12">[codebook_multiplicands] </span>array in a one-to-one mapping. Calculate [unpack] the final
- values of a codebook entry vector from the entries in <span
- class="cmtt-12">[codebook_multiplicands] </span>as follows
- (<span
- class="cmtt-12">[value_vector] </span>is the output vector representing the vector of values for entry number
- <span
- class="cmtt-12">[lookup_offset] </span>in this codebook):
- <!--l. 344--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb19">
- <a
- id="x1-56002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [last]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 0;</span>
- <br class="fancyvrb" /><a
- id="x1-56004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [multiplicand_offset]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [lookup_offset]</span><span
- class="cmtt-8"> *</span><span
- class="cmtt-8"> [codebook_dimensions]</span>
- <br class="fancyvrb" /><a
- id="x1-56006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [codebook_dimensions]-1</span><span
- class="cmtt-8"> (once</span><span
- class="cmtt-8"> for</span><span
- class="cmtt-8"> each</span><span
- class="cmtt-8"> scalar</span><span
- class="cmtt-8"> value</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> value</span><span
- class="cmtt-8"> vector)</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-56008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-56010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [value_vector]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span>
- <br class="fancyvrb" /><a
- id="x1-56012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [codebook_multiplicands]</span><span
- class="cmtt-8"> array</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> number</span><span
- class="cmtt-8"> [multiplicand_offset]</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> *</span>
- <br class="fancyvrb" /><a
- id="x1-56014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [codebook_delta_value]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [codebook_minimum_value]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [last];</span>
- <br class="fancyvrb" /><a
- id="x1-56016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-56018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [codebook_sequence_p]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> set</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> then</span><span
- class="cmtt-8"> set</span><span
- class="cmtt-8"> [last]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [value_vector]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span>
- <br class="fancyvrb" /><a
- id="x1-56020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-56022r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> increment</span><span
- class="cmtt-8"> [multiplicand_offset]</span>
- <br class="fancyvrb" /><a
- id="x1-56024r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-56026r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-56028r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-56030r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> calculation</span><span
- class="cmtt-8"> completed.</span>
- </div>
- <!--l. 370--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">3.3 </span> <a
- id="x1-570003.3"></a>Use of the codebook abstraction</h4>
- <!--l. 372--><p class="noindent" >The decoder uses the codebook abstraction much as it does the bit-unpacking convention; a
- specific codebook reads a codeword from the bitstream, decoding it into an entry number, and
- then returns that entry number to the decoder (when used in a scalar entropy coding context), or
- uses that entry number as an offset into the VQ lookup table, returning a vector of values (when
- used in a context desiring a VQ value). Scalar or VQ context is always explicit; any
- call to the codebook mechanism requests either a scalar entry number or a lookup
- vector.
- <!--l. 382--><p class="noindent" >Note that VQ lookup type zero indicates that there is no lookup table; requesting
- decode using a codebook of lookup type 0 in any context expecting a vector return
- value (even in a case where a vector of dimension one) is forbidden. If decoder setup
- or decode requests such an action, that is an error condition rendering the packet
-
-
- undecodable.
- <!--l. 389--><p class="noindent" >Using a codebook to read from the packet bitstream consists first of reading and decoding the
- next codeword in the bitstream. The decoder reads bits until the accumulated bits match a
- codeword in the codebook. This process can be though of as logically walking the
- Huffman decode tree by reading one bit at a time from the bitstream, and using the
- bit as a decision boolean to take the 0 branch (left in the above examples) or the 1
- branch (right in the above examples). Walking the tree finishes when the decode process
- hits a leaf in the decision tree; the result is the entry number corresponding to that
- leaf. Reading past the end of a packet propagates the ’end-of-stream’ condition to the
- decoder.
- <!--l. 401--><p class="noindent" >When used in a scalar context, the resulting codeword entry is the desired return
- value.
- <!--l. 404--><p class="noindent" >When used in a VQ context, the codeword entry number is used as an offset into the VQ lookup
- table. The value returned to the decoder is the vector of scalars corresponding to this
- offset.
-
-
-
-
- <h3 class="sectionHead"><span class="titlemark">4 </span> <a
- id="x1-580004"></a>Codec Setup and Packet Decode</h3>
- <!--l. 6--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">4.1 </span> <a
- id="x1-590004.1"></a>Overview</h4>
- <!--l. 8--><p class="noindent" >This document serves as the top-level reference document for the bit-by-bit decode specification
- of Vorbis I. This document assumes a high-level understanding of the Vorbis decode
- process, which is provided in <a
- href="#x1-20001">Section 1<!--tex4ht:ref: vorbis:spec:intro --></a>, “<a
- href="#x1-20001">Introduction and Description<!--tex4ht:ref: vorbis:spec:intro --></a>”. <a
- href="#x1-360002">Section 2<!--tex4ht:ref: vorbis:spec:bitpacking --></a>,
- “<a
- href="#x1-360002">Bitpacking Convention<!--tex4ht:ref: vorbis:spec:bitpacking --></a>” covers reading and writing bit fields from and to bitstream
- packets.
- <!--l. 16--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">4.2 </span> <a
- id="x1-600004.2"></a>Header decode and decode setup</h4>
- <!--l. 18--><p class="noindent" >A Vorbis bitstream begins with three header packets. The header packets are, in order, the
- identification header, the comments header, and the setup header. All are required for decode
- compliance. An end-of-packet condition during decoding the first or third header packet renders
- the stream undecodable. End-of-packet decoding the comment header is a non-fatal error
- condition.
- <!--l. 25--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">4.2.1 </span> <a
- id="x1-610004.2.1"></a>Common header decode</h5>
- <!--l. 27--><p class="noindent" >Each header packet begins with the same header fields.
- <!--l. 30--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb20">
- <a
- id="x1-61002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [packet_type]</span><span
- class="cmtt-8"> :</span><span
- class="cmtt-8"> 8</span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> value</span>
- <br class="fancyvrb" /><a
- id="x1-61004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> 0x76,</span><span
- class="cmtt-8"> 0x6f,</span><span
- class="cmtt-8"> 0x72,</span><span
- class="cmtt-8"> 0x62,</span><span
- class="cmtt-8"> 0x69,</span><span
- class="cmtt-8"> 0x73:</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> characters</span><span
- class="cmtt-8"> ’v’,’o’,’r’,’b’,’i’,’s’</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> six</span><span
- class="cmtt-8"> octets</span>
- </div>
-
-
- <!--l. 35--><p class="noindent" >Decode continues according to packet type; the identification header is type 1, the comment
- header type 3 and the setup header type 5 (these types are all odd as a packet with a leading
- single bit of ’0’ is an audio packet). The packets must occur in the order of identification,
- comment, setup.
- <!--l. 43--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">4.2.2 </span> <a
- id="x1-620004.2.2"></a>Identification header</h5>
- <!--l. 45--><p class="noindent" >The identification header is a short header of only a few fields used to declare the stream
- definitively as Vorbis, and provide a few externally relevant pieces of information about the audio
- stream. The identification header is coded as follows:
- <!--l. 50--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb21">
- <a
- id="x1-62002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [vorbis_version]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 32</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-62004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [audio_channels]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 8</span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span>
- <br class="fancyvrb" /><a
- id="x1-62006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> [audio_sample_rate]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 32</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-62008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> [bitrate_maximum]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 32</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> signed</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-62010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> [bitrate_nominal]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 32</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> signed</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-62012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> [bitrate_minimum]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 32</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> signed</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-62014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> [blocksize_0]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> exponent</span><span
- class="cmtt-8"> (read</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer)</span>
- <br class="fancyvrb" /><a
- id="x1-62016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 8)</span><span
- class="cmtt-8"> [blocksize_1]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> exponent</span><span
- class="cmtt-8"> (read</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer)</span>
- <br class="fancyvrb" /><a
- id="x1-62018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 9)</span><span
- class="cmtt-8"> [framing_flag]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> one</span><span
- class="cmtt-8"> bit</span>
- </div>
- <!--l. 62--><p class="noindent" ><span
- class="cmtt-12">[vorbis_version] </span>is to read ’0’ in order to be compatible with this document. Both
- <span
- class="cmtt-12">[audio_channels] </span>and <span
- class="cmtt-12">[audio_sample_rate] </span>must read greater than zero. Allowed final
- blocksize values are 64, 128, 256, 512, 1024, 2048, 4096 and 8192 in Vorbis I. <span
- class="cmtt-12">[blocksize_0]</span>
- must be less than or equal to <span
- class="cmtt-12">[blocksize_1]</span>. The framing bit must be nonzero. Failure to meet
- any of these conditions renders a stream undecodable.
- <!--l. 70--><p class="noindent" >The bitrate fields above are used only as hints. The nominal bitrate field especially may be
- considerably off in purely VBR streams. The fields are meaningful only when greater than
- zero.
- <ul class="itemize1">
- <li class="itemize">All three fields set to the same value implies a fixed rate, or tightly bounded, nearly
- fixed-rate bitstream
- </li>
- <li class="itemize">Only nominal set implies a VBR or ABR stream that averages the nominal bitrate
-
-
- </li>
- <li class="itemize">Maximum and or minimum set implies a VBR bitstream that obeys the bitrate limits
- </li>
- <li class="itemize">None set indicates the encoder does not care to speculate.</li></ul>
- <!--l. 84--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">4.2.3 </span> <a
- id="x1-630004.2.3"></a>Comment header</h5>
- <!--l. 85--><p class="noindent" >Comment header decode and data specification is covered in <a
- href="#x1-810005">Section 5<!--tex4ht:ref: vorbis:spec:comment --></a>, “<a
- href="#x1-810005">comment field and
- header specification<!--tex4ht:ref: vorbis:spec:comment --></a>”.
- <!--l. 89--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">4.2.4 </span> <a
- id="x1-640004.2.4"></a>Setup header</h5>
- <!--l. 91--><p class="noindent" >Vorbis codec setup is configurable to an extreme degree:
- <div class="center"
- >
- <!--l. 93--><p class="noindent" >
- <!--l. 94--><p class="noindent" ><img
- src="components.png" alt="PIC"
- >
- <br /> <table class="caption"
- ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 6: </td><td
- class="content">decoder pipeline configuration</td></tr></table><!--tex4ht:label?: x1-640016 -->
- </div>
- <!--l. 99--><p class="noindent" >The setup header contains the bulk of the codec setup information needed for decode. The setup
- header contains, in order, the lists of codebook configurations, time-domain transform
- configurations (placeholders in Vorbis I), floor configurations, residue configurations, channel
- mapping configurations and mode configurations. It finishes with a framing bit of ’1’. Header
- decode proceeds in the following order:
- <!--l. 107--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-650004.2.4"></a><span
- class="cmbx-12">Codebooks</span></span>
-
-
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-65002x1"><span
- class="cmtt-12">[vorbis_codebook_count] </span>= read eight bits as unsigned integer and add one
- </li>
- <li
- class="enumerate" id="x1-65004x2">Decode <span
- class="cmtt-12">[vorbis_codebook_count] </span>codebooks in order as defined in <a
- href="#x1-470003">Section 3<!--tex4ht:ref: vorbis:spec:codebook --></a>,
- “<a
- href="#x1-470003">Probability Model and Codebooks<!--tex4ht:ref: vorbis:spec:codebook --></a>”. Save each configuration, in order, in an array
- of codebook configurations <span
- class="cmtt-12">[vorbis_codebook_configurations]</span>.</li></ol>
- <!--l. 119--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-660004.2.4"></a><span
- class="cmbx-12">Time domain transforms</span></span>
- These hooks are placeholders in Vorbis I. Nevertheless, the configuration placeholder values must
- be read to maintain bitstream sync.
- <!--l. 125--><p class="noindent" >
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-66002x1"><span
- class="cmtt-12">[vorbis_time_count] </span>= read 6 bits as unsigned integer and add one
- </li>
- <li
- class="enumerate" id="x1-66004x2">read <span
- class="cmtt-12">[vorbis_time_count] </span>16 bit values; each value should be zero. If any value is
- nonzero, this is an error condition and the stream is undecodable.</li></ol>
- <!--l. 132--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-670004.2.4"></a><span
- class="cmbx-12">Floors</span></span>
- Vorbis uses two floor types; header decode is handed to the decode abstraction of the appropriate
- type.
- <!--l. 137--><p class="noindent" >
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-67002x1"><span
- class="cmtt-12">[vorbis_floor_count] </span>= read 6 bits as unsigned integer and add one
- </li>
- <li
- class="enumerate" id="x1-67004x2">For each <span
- class="cmtt-12">[i] </span>of <span
- class="cmtt-12">[vorbis_floor_count] </span>floor numbers:
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-67006x1">read the floor type: vector <span
- class="cmtt-12">[vorbis_floor_types] </span>element <span
- class="cmtt-12">[i] </span>= read 16 bits
- as unsigned integer
- </li>
- <li
- class="enumerate" id="x1-67008x2">If the floor type is zero, decode the floor configuration as defined in <a
- href="#x1-890006">Section 6<!--tex4ht:ref: vorbis:spec:floor0 --></a>,
- “<a
- href="#x1-890006">Floor type 0 setup and decode<!--tex4ht:ref: vorbis:spec:floor0 --></a>”; save this configuration in slot <span
- class="cmtt-12">[i] </span>of the floor
- configuration array <span
- class="cmtt-12">[vorbis_floor_configurations]</span>.
-
-
- </li>
- <li
- class="enumerate" id="x1-67010x3">If the floor type is one, decode the floor configuration as defined in <a
- href="#x1-950007">Section 7<!--tex4ht:ref: vorbis:spec:floor1 --></a>,
- “<a
- href="#x1-950007">Floor type 1 setup and decode<!--tex4ht:ref: vorbis:spec:floor1 --></a>”; save this configuration in slot <span
- class="cmtt-12">[i] </span>of the floor
- configuration array <span
- class="cmtt-12">[vorbis_floor_configurations]</span>.
- </li>
- <li
- class="enumerate" id="x1-67012x4">If the the floor type is greater than one, this stream is undecodable; ERROR
- CONDITION</li></ol>
- </li></ol>
- <!--l. 156--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-680004.2.4"></a><span
- class="cmbx-12">Residues</span></span>
- Vorbis uses three residue types; header decode of each type is identical.
- <!--l. 161--><p class="noindent" >
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-68002x1"><span
- class="cmtt-12">[vorbis_residue_count] </span>= read 6 bits as unsigned integer and add one
- </li>
- <li
- class="enumerate" id="x1-68004x2">For each of <span
- class="cmtt-12">[vorbis_residue_count] </span>residue numbers:
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-68006x1">read the residue type; vector <span
- class="cmtt-12">[vorbis_residue_types] </span>element <span
- class="cmtt-12">[i] </span>= read 16
- bits as unsigned integer
- </li>
- <li
- class="enumerate" id="x1-68008x2">If the residue type is zero, one or two, decode the residue configuration as defined
- in <a
- href="#x1-1020008">Section 8<!--tex4ht:ref: vorbis:spec:residue --></a>, “<a
- href="#x1-1020008">Residue setup and decode<!--tex4ht:ref: vorbis:spec:residue --></a>”; save this configuration in slot <span
- class="cmtt-12">[i] </span>of
- the residue configuration array <span
- class="cmtt-12">[vorbis_residue_configurations]</span>.
- </li>
- <li
- class="enumerate" id="x1-68010x3">If the the residue type is greater than two, this stream is undecodable; ERROR
- CONDITION</li></ol>
- </li></ol>
- <!--l. 176--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-690004.2.4"></a><span
- class="cmbx-12">Mappings</span></span>
- Mappings are used to set up specific pipelines for encoding multichannel audio with varying
- channel mapping applications. Vorbis I uses a single mapping type (0), with implicit PCM
- channel mappings.
-
-
- <!--l. 186--><p class="noindent" >
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-69002x1"><span
- class="cmtt-12">[vorbis_mapping_count] </span>= read 6 bits as unsigned integer and add one
- </li>
- <li
- class="enumerate" id="x1-69004x2">For each <span
- class="cmtt-12">[i] </span>of <span
- class="cmtt-12">[vorbis_mapping_count] </span>mapping numbers:
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-69006x1">read the mapping type: 16 bits as unsigned integer. There’s no reason to save
- the mapping type in Vorbis I.
- </li>
- <li
- class="enumerate" id="x1-69008x2">If the mapping type is nonzero, the stream is undecodable
- </li>
- <li
- class="enumerate" id="x1-69010x3">If the mapping type is zero:
- <ol class="enumerate3" >
- <li
- class="enumerate" id="x1-69012x1">read 1 bit as a boolean flag
- <ol class="enumerate4" >
- <li
- class="enumerate" id="x1-69014x1">if set, <span
- class="cmtt-12">[vorbis_mapping_submaps] </span>= read 4 bits as unsigned integer
- and add one
- </li>
- <li
- class="enumerate" id="x1-69016x2">if unset, <span
- class="cmtt-12">[vorbis_mapping_submaps] </span>= 1</li></ol>
- </li>
- <li
- class="enumerate" id="x1-69018x2">read 1 bit as a boolean flag
- <ol class="enumerate4" >
- <li
- class="enumerate" id="x1-69020x1">if set, square polar channel mapping is in use:
- <ul class="itemize1">
- <li class="itemize"><span
- class="cmtt-12">[vorbis_mapping_coupling_steps] </span>= read 8 bits as unsigned
- integer and add one
- </li>
- <li class="itemize">for <span
- class="cmtt-12">[j] </span>each of <span
- class="cmtt-12">[vorbis_mapping_coupling_steps] </span>steps:
- <ul class="itemize2">
- <li class="itemize">vector <span
- class="cmtt-12">[vorbis_mapping_magnitude] </span>element <span
- class="cmtt-12">[j]</span>= read
- <a
- href="#x1-1170009.2.1">ilog</a>(<span
- class="cmtt-12">[audio_channels] </span>- 1) bits as unsigned integer
- </li>
- <li class="itemize">vector <span
- class="cmtt-12">[vorbis_mapping_angle] </span>element <span
- class="cmtt-12">[j]</span>= read
- <a
- href="#x1-1170009.2.1">ilog</a>(<span
- class="cmtt-12">[audio_channels] </span>- 1) bits as unsigned integer
- </li>
-
-
- <li class="itemize">the numbers read in the above two steps are channel numbers
- representing the channel to treat as magnitude and the channel
- to treat as angle, respectively. If for any coupling step the
- angle channel number equals the magnitude channel number, the
- magnitude channel number is greater than <span
- class="cmtt-12">[audio_channels]</span>-1, or
- the angle channel is greater than <span
- class="cmtt-12">[audio_channels]</span>-1, the stream
- is undecodable.</li></ul>
- </li></ul>
- </li>
- <li
- class="enumerate" id="x1-69022x2">if unset, <span
- class="cmtt-12">[vorbis_mapping_coupling_steps] </span>= 0</li></ol>
- </li>
- <li
- class="enumerate" id="x1-69024x3">read 2 bits (reserved field); if the value is nonzero, the stream is undecodable
- </li>
- <li
- class="enumerate" id="x1-69026x4">if <span
- class="cmtt-12">[vorbis_mapping_submaps] </span>is greater than one, we read channel multiplex
- settings. For each <span
- class="cmtt-12">[j] </span>of <span
- class="cmtt-12">[audio_channels] </span>channels:
- <ol class="enumerate4" >
- <li
- class="enumerate" id="x1-69028x1">vector <span
- class="cmtt-12">[vorbis_mapping_mux] </span>element <span
- class="cmtt-12">[j] </span>= read 4 bits as unsigned
- integer
- </li>
- <li
- class="enumerate" id="x1-69030x2">if the value is greater than the highest numbered submap
- (<span
- class="cmtt-12">[vorbis_mapping_submaps] </span>- 1), this in an error condition rendering
- the stream undecodable</li></ol>
- </li>
- <li
- class="enumerate" id="x1-69032x5">for each submap <span
- class="cmtt-12">[j] </span>of <span
- class="cmtt-12">[vorbis_mapping_submaps] </span>submaps, read the floor and
- residue numbers for use in decoding that submap:
- <ol class="enumerate4" >
- <li
- class="enumerate" id="x1-69034x1">read and discard 8 bits (the unused time configuration placeholder)
- </li>
- <li
- class="enumerate" id="x1-69036x2">read 8 bits as unsigned integer for the floor number; save in vector
- <span
- class="cmtt-12">[vorbis_mapping_submap_floor] </span>element <span
- class="cmtt-12">[j]</span>
- </li>
- <li
- class="enumerate" id="x1-69038x3">verify the floor number is not greater than the highest number floor
- configured for the bitstream. If it is, the bitstream is undecodable
- </li>
- <li
- class="enumerate" id="x1-69040x4">read 8 bits as unsigned integer for the residue number; save in vector
- <span
- class="cmtt-12">[vorbis_mapping_submap_residue] </span>element <span
- class="cmtt-12">[j]</span>
-
-
- </li>
- <li
- class="enumerate" id="x1-69042x5">verify the residue number is not greater than the highest number residue
- configured for the bitstream. If it is, the bitstream is undecodable</li></ol>
- </li>
- <li
- class="enumerate" id="x1-69044x6">save this mapping configuration in slot <span
- class="cmtt-12">[i] </span>of the mapping configuration array
- <span
- class="cmtt-12">[vorbis_mapping_configurations]</span>.</li></ol>
- </li></ol>
- </li></ol>
- <!--l. 246--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-700004.2.4"></a><span
- class="cmbx-12">Modes</span></span>
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-70002x1"><span
- class="cmtt-12">[vorbis_mode_count] </span>= read 6 bits as unsigned integer and add one
- </li>
- <li
- class="enumerate" id="x1-70004x2">For each of <span
- class="cmtt-12">[vorbis_mode_count] </span>mode numbers:
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-70006x1"><span
- class="cmtt-12">[vorbis_mode_blockflag] </span>= read 1 bit
- </li>
- <li
- class="enumerate" id="x1-70008x2"><span
- class="cmtt-12">[vorbis_mode_windowtype] </span>= read 16 bits as unsigned integer
- </li>
- <li
- class="enumerate" id="x1-70010x3"><span
- class="cmtt-12">[vorbis_mode_transformtype] </span>= read 16 bits as unsigned integer
- </li>
- <li
- class="enumerate" id="x1-70012x4"><span
- class="cmtt-12">[vorbis_mode_mapping] </span>= read 8 bits as unsigned integer
- </li>
- <li
- class="enumerate" id="x1-70014x5">verify ranges; zero is the only legal value in
- Vorbis I for <span
- class="cmtt-12">[vorbis_mode_windowtype] </span>and <span
- class="cmtt-12">[vorbis_mode_transformtype]</span>.
- <span
- class="cmtt-12">[vorbis_mode_mapping] </span>must not be greater than the highest number mapping
- in use. Any illegal values render the stream undecodable.
- </li>
- <li
- class="enumerate" id="x1-70016x6">save this mode configuration in slot <span
- class="cmtt-12">[i] </span>of the mode configuration array
- <span
- class="cmtt-12">[vorbis_mode_configurations]</span>.</li></ol>
- </li>
- <li
- class="enumerate" id="x1-70018x3">read 1 bit as a framing flag. If unset, a framing error occurred and the stream is not
- decodable.</li></ol>
-
-
- <!--l. 267--><p class="noindent" >After reading mode descriptions, setup header decode is complete.
- <!--l. 276--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">4.3 </span> <a
- id="x1-710004.3"></a>Audio packet decode and synthesis</h4>
- <!--l. 278--><p class="noindent" >Following the three header packets, all packets in a Vorbis I stream are audio. The first step of
- audio packet decode is to read and verify the packet type. <span
- class="cmti-12">A non-audio packet when audio is</span>
- <span
- class="cmti-12">expected indicates stream corruption or a non-compliant stream. The decoder must ignore the</span>
- <span
- class="cmti-12">packet and not attempt decoding it to audio</span>.
- <!--l. 285--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">4.3.1 </span> <a
- id="x1-720004.3.1"></a>packet type, mode and window decode</h5>
- <!--l. 287--><p class="noindent" >
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-72002x1">read 1 bit <span
- class="cmtt-12">[packet_type]</span>; check that packet type is 0 (audio)
- </li>
- <li
- class="enumerate" id="x1-72004x2">read <a
- href="#x1-1170009.2.1">ilog</a>([vorbis˙mode˙count]-1) bits <span
- class="cmtt-12">[mode_number]</span>
- </li>
- <li
- class="enumerate" id="x1-72006x3">decode blocksize <span
- class="cmtt-12">[n] </span>is equal to <span
- class="cmtt-12">[blocksize_0] </span>if <span
- class="cmtt-12">[vorbis_mode_blockflag] </span>is 0,
- else <span
- class="cmtt-12">[n] </span>is equal to <span
- class="cmtt-12">[blocksize_1]</span>.
- </li>
- <li
- class="enumerate" id="x1-72008x4">perform window selection and setup; this window is used later by the inverse
- MDCT:
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-72010x1">if this is a long window (the <span
- class="cmtt-12">[vorbis_mode_blockflag] </span>flag of this mode is
- set):
- <ol class="enumerate3" >
- <li
- class="enumerate" id="x1-72012x1">read 1 bit for <span
- class="cmtt-12">[previous_window_flag]</span>
- </li>
- <li
- class="enumerate" id="x1-72014x2">read 1 bit for <span
- class="cmtt-12">[next_window_flag]</span>
-
-
- </li>
- <li
- class="enumerate" id="x1-72016x3">if <span
- class="cmtt-12">[previous_window_flag] </span>is not set, the left half of the window will
- be a hybrid window for lapping with a short block. See <a
- href="#x1-260001.3.2">paragraph 1.3.2<!--tex4ht:ref: vorbis:spec:window --></a>,
- “<a
- href="#x1-260001.3.2">Window shape decode (long windows only)<!--tex4ht:ref: vorbis:spec:window --></a>” for an illustration of
- overlapping dissimilar windows. Else, the left half window will have normal
- long shape.
- </li>
- <li
- class="enumerate" id="x1-72018x4">if <span
- class="cmtt-12">[next_window_flag] </span>is not set, the right half of the window will be
- a hybrid window for lapping with a short block. See <a
- href="#x1-260001.3.2">paragraph 1.3.2<!--tex4ht:ref: vorbis:spec:window --></a>,
- “<a
- href="#x1-260001.3.2">Window shape decode (long windows only)<!--tex4ht:ref: vorbis:spec:window --></a>” for an illustration of
- overlapping dissimilar windows. Else, the left right window will have normal
- long shape.</li></ol>
- </li>
- <li
- class="enumerate" id="x1-72020x2">if this is a short window, the window is always the same short-window
- shape.</li></ol>
- </li></ol>
- <!--l. 320--><p class="noindent" >Vorbis windows all use the slope function <span
- class="cmmi-12">y </span>= sin(<img
- src="Vorbis_I_spec1x.png" alt="π2" class="frac" align="middle"> <span
- class="cmsy-10x-x-120">*</span> sin <sup><span
- class="cmr-8">2</span></sup>((<span
- class="cmmi-12">x </span>+ 0<span
- class="cmmi-12">.</span>5)<span
- class="cmmi-12">∕n </span><span
- class="cmsy-10x-x-120">* </span><span
- class="cmmi-12">π</span>)), where <span
- class="cmmi-12">n </span>is window
- size and <span
- class="cmmi-12">x </span>ranges 0<span
- class="cmmi-12">…</span><span
- class="cmmi-12">n</span><span
- class="cmsy-10x-x-120">- </span>1, but dissimilar lapping requirements can affect overall shape. Window
- generation proceeds as follows:
- <!--l. 325--><p class="noindent" >
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-72022x1"><span
- class="cmtt-12">[window_center] </span>= <span
- class="cmtt-12">[n] </span>/ 2
- </li>
- <li
- class="enumerate" id="x1-72024x2">if (<span
- class="cmtt-12">[vorbis_mode_blockflag] </span>is set and <span
- class="cmtt-12">[previous_window_flag] </span>is not set)
- then
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-72026x1"><span
- class="cmtt-12">[left_window_start] </span>= <span
- class="cmtt-12">[n]</span>/4 - <span
- class="cmtt-12">[blocksize_0]</span>/4
- </li>
- <li
- class="enumerate" id="x1-72028x2"><span
- class="cmtt-12">[left_window_end] </span>= <span
- class="cmtt-12">[n]</span>/4 + <span
- class="cmtt-12">[blocksize_0]</span>/4
- </li>
- <li
- class="enumerate" id="x1-72030x3"><span
- class="cmtt-12">[left_n] </span>= <span
- class="cmtt-12">[blocksize_0]</span>/2</li></ol>
- <!--l. 335--><p class="noindent" >else
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-72032x1"><span
- class="cmtt-12">[left_window_start] </span>= 0
- </li>
- <li
- class="enumerate" id="x1-72034x2"><span
- class="cmtt-12">[left_window_end] </span>= <span
- class="cmtt-12">[window_center]</span>
-
-
- </li>
- <li
- class="enumerate" id="x1-72036x3"><span
- class="cmtt-12">[left_n] </span>= <span
- class="cmtt-12">[n]</span>/2</li></ol>
- </li>
- <li
- class="enumerate" id="x1-72038x3">if (<span
- class="cmtt-12">[vorbis_mode_blockflag] </span>is set and <span
- class="cmtt-12">[next_window_flag] </span>is not set) then
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-72040x1"><span
- class="cmtt-12">[right_window_start] </span>= <span
- class="cmtt-12">[n]*3</span>/4 - <span
- class="cmtt-12">[blocksize_0]</span>/4
- </li>
- <li
- class="enumerate" id="x1-72042x2"><span
- class="cmtt-12">[right_window_end] </span>= <span
- class="cmtt-12">[n]*3</span>/4 + <span
- class="cmtt-12">[blocksize_0]</span>/4
- </li>
- <li
- class="enumerate" id="x1-72044x3"><span
- class="cmtt-12">[right_n] </span>= <span
- class="cmtt-12">[blocksize_0]</span>/2</li></ol>
- <!--l. 351--><p class="noindent" >else
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-72046x1"><span
- class="cmtt-12">[right_window_start] </span>= <span
- class="cmtt-12">[window_center]</span>
- </li>
- <li
- class="enumerate" id="x1-72048x2"><span
- class="cmtt-12">[right_window_end] </span>= <span
- class="cmtt-12">[n]</span>
- </li>
- <li
- class="enumerate" id="x1-72050x3"><span
- class="cmtt-12">[right_n] </span>= <span
- class="cmtt-12">[n]</span>/2</li></ol>
- </li>
- <li
- class="enumerate" id="x1-72052x4">window from range 0 ... <span
- class="cmtt-12">[left_window_start]</span>-1 inclusive is zero
- </li>
- <li
- class="enumerate" id="x1-72054x5">for <span
- class="cmtt-12">[i] </span>in range <span
- class="cmtt-12">[left_window_start] </span>... <span
- class="cmtt-12">[left_window_end]</span>-1, window(<span
- class="cmtt-12">[i]</span>) =
- sin(<img
- src="Vorbis_I_spec2x.png" alt="π
- 2" class="frac" align="middle"> <span
- class="cmsy-10x-x-120">*</span> sin <sup><span
- class="cmr-8">2</span></sup>( (<span
- class="cmtt-12">[i]</span>-<span
- class="cmtt-12">[left_window_start]</span>+0.5) / <span
- class="cmtt-12">[left_n] </span><span
- class="cmsy-10x-x-120">*</span><img
- src="Vorbis_I_spec3x.png" alt="π
- 2" class="frac" align="middle">) )
- </li>
- <li
- class="enumerate" id="x1-72056x6">window from range <span
- class="cmtt-12">[left_window_end] </span>... <span
- class="cmtt-12">[right_window_start]</span>-1 inclusive is
- one
- </li>
- <li
- class="enumerate" id="x1-72058x7">for <span
- class="cmtt-12">[i] </span>in range <span
- class="cmtt-12">[right_window_start] </span>... <span
- class="cmtt-12">[right_window_end]</span>-1, window(<span
- class="cmtt-12">[i]</span>) =
- sin(<img
- src="Vorbis_I_spec4x.png" alt="π
- 2" class="frac" align="middle"> <span
- class="cmsy-10x-x-120">*</span> sin <sup><span
- class="cmr-8">2</span></sup>( (<span
- class="cmtt-12">[i]</span>-<span
- class="cmtt-12">[right_window_start]</span>+0.5) / <span
- class="cmtt-12">[right_n] </span><span
- class="cmsy-10x-x-120">*</span><img
- src="Vorbis_I_spec5x.png" alt="π
- 2" class="frac" align="middle"> + <img
- src="Vorbis_I_spec6x.png" alt="π
- 2" class="frac" align="middle">) )
- </li>
- <li
- class="enumerate" id="x1-72060x8">window from range <span
- class="cmtt-12">[right_window_start] </span>... <span
- class="cmtt-12">[n]</span>-1 is zero</li></ol>
- <!--l. 367--><p class="noindent" >An end-of-packet condition up to this point should be considered an error that discards this
- packet from the stream. An end of packet condition past this point is to be considered a possible
- nominal occurrence.
-
-
- <!--l. 374--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">4.3.2 </span> <a
- id="x1-730004.3.2"></a>floor curve decode</h5>
- <!--l. 376--><p class="noindent" >From this point on, we assume out decode context is using mode number <span
- class="cmtt-12">[mode_number]</span>
- from configuration array <span
- class="cmtt-12">[vorbis_mode_configurations] </span>and the map number
- <span
- class="cmtt-12">[vorbis_mode_mapping] </span>(specified by the current mode) taken from the mapping configuration
- array <span
- class="cmtt-12">[vorbis_mapping_configurations]</span>.
- <!--l. 383--><p class="noindent" >Floor curves are decoded one-by-one in channel order.
- <!--l. 385--><p class="noindent" >For each floor <span
- class="cmtt-12">[i] </span>of <span
- class="cmtt-12">[audio_channels]</span>
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-73002x1"><span
- class="cmtt-12">[submap_number] </span>= element <span
- class="cmtt-12">[i] </span>of vector [vorbis˙mapping˙mux]
- </li>
- <li
- class="enumerate" id="x1-73004x2"><span
- class="cmtt-12">[floor_number] </span>= element <span
- class="cmtt-12">[submap_number] </span>of vector [vorbis˙submap˙floor]
- </li>
- <li
- class="enumerate" id="x1-73006x3">if the floor type of this floor (vector
- <span
- class="cmtt-12">[vorbis_floor_types] </span>element <span
- class="cmtt-12">[floor_number]</span>) is zero then decode the floor for
- channel <span
- class="cmtt-12">[i] </span>according to the <a
- href="#x1-930006.2.2">subsubsection 6.2.2<!--tex4ht:ref: vorbis:spec:floor0-decode --></a>, “<a
- href="#x1-930006.2.2">packet decode<!--tex4ht:ref: vorbis:spec:floor0-decode --></a>”
- </li>
- <li
- class="enumerate" id="x1-73008x4">if the type of this floor is one then decode the floor for channel <span
- class="cmtt-12">[i] </span>according to the
- <a
- href="#x1-1000007.2.2">paragraph 7.2.2<!--tex4ht:ref: vorbis:spec:floor1-decode --></a>, “<a
- href="#x1-1000007.2.2">packet decode<!--tex4ht:ref: vorbis:spec:floor1-decode --></a>”
- </li>
- <li
- class="enumerate" id="x1-73010x5">save the needed decoded floor information for channel for later synthesis
- </li>
- <li
- class="enumerate" id="x1-73012x6">if the decoded floor returned ’unused’, set vector <span
- class="cmtt-12">[no_residue] </span>element <span
- class="cmtt-12">[i] </span>to true,
- else set vector <span
- class="cmtt-12">[no_residue] </span>element <span
- class="cmtt-12">[i] </span>to false</li></ol>
- <!--l. 405--><p class="noindent" >An end-of-packet condition during floor decode shall result in packet decode zeroing all channel
- output vectors and skipping to the add/overlap output stage.
- <!--l. 411--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">4.3.3 </span> <a
- id="x1-740004.3.3"></a>nonzero vector propagate</h5>
- <!--l. 413--><p class="noindent" >A possible result of floor decode is that a specific vector is marked ’unused’ which indicates that
- that final output vector is all-zero values (and the floor is zero). The residue for that vector is not
- coded in the stream, save for one complication. If some vectors are used and some are not,
-
-
- channel coupling could result in mixing a zeroed and nonzeroed vector to produce two nonzeroed
- vectors.
- <!--l. 420--><p class="noindent" >for each <span
- class="cmtt-12">[i] </span>from 0 ... <span
- class="cmtt-12">[vorbis_mapping_coupling_steps]</span>-1
- <!--l. 422--><p class="noindent" >
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-74002x1">if either <span
- class="cmtt-12">[no_residue] </span>entry for channel (<span
- class="cmtt-12">[vorbis_mapping_magnitude] </span>element
- <span
- class="cmtt-12">[i]</span>) or channel (<span
- class="cmtt-12">[vorbis_mapping_angle] </span>element <span
- class="cmtt-12">[i]</span>) are set to false, then both
- must be set to false. Note that an ’unused’ floor has no decoded floor information; it
- is important that this is remembered at floor curve synthesis time.</li></ol>
- <!--l. 435--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">4.3.4 </span> <a
- id="x1-750004.3.4"></a>residue decode</h5>
- <!--l. 437--><p class="noindent" >Unlike floors, which are decoded in channel order, the residue vectors are decoded in submap
- order.
- <!--l. 440--><p class="noindent" >for each submap <span
- class="cmtt-12">[i] </span>in order from 0 ... <span
- class="cmtt-12">[vorbis_mapping_submaps]</span>-1
- <!--l. 442--><p class="noindent" >
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-75002x1"><span
- class="cmtt-12">[ch] </span>= 0
- </li>
- <li
- class="enumerate" id="x1-75004x2">for each channel <span
- class="cmtt-12">[j] </span>in order from 0 ... <span
- class="cmtt-12">[audio_channels] </span>- 1
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-75006x1">if channel <span
- class="cmtt-12">[j] </span>in submap <span
- class="cmtt-12">[i] </span>(vector <span
- class="cmtt-12">[vorbis_mapping_mux] </span>element <span
- class="cmtt-12">[j] </span>is equal to
- <span
- class="cmtt-12">[i]</span>)
- <ol class="enumerate3" >
- <li
- class="enumerate" id="x1-75008x1">if vector <span
- class="cmtt-12">[no_residue] </span>element <span
- class="cmtt-12">[j] </span>is true
- <ol class="enumerate4" >
- <li
- class="enumerate" id="x1-75010x1">vector <span
- class="cmtt-12">[do_not_decode_flag] </span>element <span
- class="cmtt-12">[ch] </span>is set</li></ol>
- <!--l. 452--><p class="noindent" >else
- <ol class="enumerate4" >
- <li
- class="enumerate" id="x1-75012x1">vector <span
- class="cmtt-12">[do_not_decode_flag] </span>element <span
- class="cmtt-12">[ch] </span>is unset</li></ol>
- </li>
- <li
- class="enumerate" id="x1-75014x2">increment <span
- class="cmtt-12">[ch]</span></li></ol>
-
-
- </li></ol>
- </li>
- <li
- class="enumerate" id="x1-75016x3"><span
- class="cmtt-12">[residue_number] </span>= vector <span
- class="cmtt-12">[vorbis_mapping_submap_residue] </span>element <span
- class="cmtt-12">[i]</span>
- </li>
- <li
- class="enumerate" id="x1-75018x4"><span
- class="cmtt-12">[residue_type] </span>= vector <span
- class="cmtt-12">[vorbis_residue_types] </span>element <span
- class="cmtt-12">[residue_number]</span>
- </li>
- <li
- class="enumerate" id="x1-75020x5">decode <span
- class="cmtt-12">[ch] </span>vectors using residue <span
- class="cmtt-12">[residue_number]</span>, according to type <span
- class="cmtt-12">[residue_type]</span>,
- also passing vector <span
- class="cmtt-12">[do_not_decode_flag] </span>to indicate which vectors in the bundle should
- not be decoded. Correct per-vector decode length is <span
- class="cmtt-12">[n]</span>/2.
- </li>
- <li
- class="enumerate" id="x1-75022x6"><span
- class="cmtt-12">[ch] </span>= 0
- </li>
- <li
- class="enumerate" id="x1-75024x7">for each channel <span
- class="cmtt-12">[j] </span>in order from 0 ... <span
- class="cmtt-12">[audio_channels]</span>
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-75026x1">if channel <span
- class="cmtt-12">[j] </span>is in submap <span
- class="cmtt-12">[i] </span>(vector <span
- class="cmtt-12">[vorbis_mapping_mux] </span>element <span
- class="cmtt-12">[j] </span>is equal
- to <span
- class="cmtt-12">[i]</span>)
- <ol class="enumerate3" >
- <li
- class="enumerate" id="x1-75028x1">residue vector for channel <span
- class="cmtt-12">[j] </span>is set to decoded residue vector <span
- class="cmtt-12">[ch]</span>
- </li>
- <li
- class="enumerate" id="x1-75030x2">increment <span
- class="cmtt-12">[ch]</span></li></ol>
- </li></ol>
- </li></ol>
- <!--l. 479--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">4.3.5 </span> <a
- id="x1-760004.3.5"></a>inverse coupling</h5>
- <!--l. 481--><p class="noindent" >for each <span
- class="cmtt-12">[i] </span>from <span
- class="cmtt-12">[vorbis_mapping_coupling_steps]</span>-1 descending to 0
- <!--l. 483--><p class="noindent" >
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-76002x1"><span
- class="cmtt-12">[magnitude_vector] </span>= the residue vector for channel (vector
- <span
- class="cmtt-12">[vorbis_mapping_magnitude] </span>element <span
- class="cmtt-12">[i]</span>)
- </li>
- <li
- class="enumerate" id="x1-76004x2"><span
- class="cmtt-12">[angle_vector] </span>= the residue vector for channel (vector <span
- class="cmtt-12">[vorbis_mapping_angle]</span>
-
-
- element <span
- class="cmtt-12">[i]</span>)
- </li>
- <li
- class="enumerate" id="x1-76006x3">for each scalar value <span
- class="cmtt-12">[M] </span>in vector <span
- class="cmtt-12">[magnitude_vector] </span>and the corresponding scalar value
- <span
- class="cmtt-12">[A] </span>in vector <span
- class="cmtt-12">[angle_vector]</span>:
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-76008x1">if (<span
- class="cmtt-12">[M] </span>is greater than zero)
- <ol class="enumerate3" >
- <li
- class="enumerate" id="x1-76010x1">if (<span
- class="cmtt-12">[A] </span>is greater than zero)
- <ol class="enumerate4" >
- <li
- class="enumerate" id="x1-76012x1"><span
- class="cmtt-12">[new_M] </span>= <span
- class="cmtt-12">[M]</span>
- </li>
- <li
- class="enumerate" id="x1-76014x2"><span
- class="cmtt-12">[new_A] </span>= <span
- class="cmtt-12">[M]</span>-<span
- class="cmtt-12">[A]</span></li></ol>
- <!--l. 497--><p class="noindent" >else
- <ol class="enumerate4" >
- <li
- class="enumerate" id="x1-76016x1"><span
- class="cmtt-12">[new_A] </span>= <span
- class="cmtt-12">[M]</span>
- </li>
- <li
- class="enumerate" id="x1-76018x2"><span
- class="cmtt-12">[new_M] </span>= <span
- class="cmtt-12">[M]</span>+<span
- class="cmtt-12">[A]</span></li></ol>
- </li></ol>
- <!--l. 504--><p class="noindent" >else
- <ol class="enumerate3" >
- <li
- class="enumerate" id="x1-76020x1">if (<span
- class="cmtt-12">[A] </span>is greater than zero)
- <ol class="enumerate4" >
- <li
- class="enumerate" id="x1-76022x1"><span
- class="cmtt-12">[new_M] </span>= <span
- class="cmtt-12">[M]</span>
- </li>
- <li
- class="enumerate" id="x1-76024x2"><span
- class="cmtt-12">[new_A] </span>= <span
- class="cmtt-12">[M]</span>+<span
- class="cmtt-12">[A]</span></li></ol>
- <!--l. 511--><p class="noindent" >else
- <ol class="enumerate4" >
- <li
- class="enumerate" id="x1-76026x1"><span
- class="cmtt-12">[new_A] </span>= <span
- class="cmtt-12">[M]</span>
- </li>
- <li
- class="enumerate" id="x1-76028x2"><span
- class="cmtt-12">[new_M] </span>= <span
- class="cmtt-12">[M]</span>-<span
- class="cmtt-12">[A]</span></li></ol>
- </li></ol>
- </li>
- <li
- class="enumerate" id="x1-76030x2">set scalar value <span
- class="cmtt-12">[M] </span>in vector <span
- class="cmtt-12">[magnitude_vector] </span>to <span
- class="cmtt-12">[new_M]</span>
-
-
- </li>
- <li
- class="enumerate" id="x1-76032x3">set scalar value <span
- class="cmtt-12">[A] </span>in vector <span
- class="cmtt-12">[angle_vector] </span>to <span
- class="cmtt-12">[new_A]</span></li></ol>
- </li></ol>
- <!--l. 528--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">4.3.6 </span> <a
- id="x1-770004.3.6"></a>dot product</h5>
- <!--l. 530--><p class="noindent" >For each channel, synthesize the floor curve from the decoded floor information, according to
- packet type. Note that the vector synthesis length for floor computation is <span
- class="cmtt-12">[n]</span>/2.
- <!--l. 534--><p class="noindent" >For each channel, multiply each element of the floor curve by each element of that
- channel’s residue vector. The result is the dot product of the floor and residue vectors for
- each channel; the produced vectors are the length <span
- class="cmtt-12">[n]</span>/2 audio spectrum for each
- channel.
- <!--l. 542--><p class="noindent" >One point is worth mentioning about this dot product; a common mistake in a fixed point
- implementation might be to assume that a 32 bit fixed-point representation for floor and
- residue and direct multiplication of the vectors is sufficient for acceptable spectral depth
- in all cases because it happens to mostly work with the current Xiph.Org reference
- encoder.
- <!--l. 549--><p class="noindent" >However, floor vector values can span <span
- class="cmsy-10x-x-120">~</span>140dB (<span
- class="cmsy-10x-x-120">~</span>24 bits unsigned), and the audio spectrum
- vector should represent a minimum of 120dB (<span
- class="cmsy-10x-x-120">~</span>21 bits with sign), even when output is to a 16
- bit PCM device. For the residue vector to represent full scale if the floor is nailed
- to <span
- class="cmsy-10x-x-120">-</span>140dB, it must be able to span 0 to +140dB. For the residue vector to reach
- full scale if the floor is nailed at 0dB, it must be able to represent <span
- class="cmsy-10x-x-120">-</span>140dB to +0dB.
- Thus, in order to handle full range dynamics, a residue vector may span <span
- class="cmsy-10x-x-120">-</span>140dB to
- +140dB entirely within spec. A 280dB range is approximately 48 bits with sign; thus the
- residue vector must be able to represent a 48 bit range and the dot product must
- be able to handle an effective 48 bit times 24 bit multiplication. This range may be
- achieved using large (64 bit or larger) integers, or implementing a movable binary point
- representation.
- <!--l. 566--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">4.3.7 </span> <a
- id="x1-780004.3.7"></a>inverse MDCT</h5>
- <!--l. 568--><p class="noindent" >Convert the audio spectrum vector of each channel back into time domain PCM audio via an
-
-
- inverse Modified Discrete Cosine Transform (MDCT). A detailed description of the MDCT is
- available in <span class="cite">[<a
- href="#XSporer/Brandenburg/Edler">1</a>]</span>. The window function used for the MDCT is the function described
- earlier.
- <!--l. 575--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">4.3.8 </span> <a
- id="x1-790004.3.8"></a>overlap˙add</h5>
- <!--l. 577--><p class="noindent" >Windowed MDCT output is overlapped and added with the right hand data of the previous
- window such that the 3/4 point of the previous window is aligned with the 1/4 point of the
- current window (as illustrated in <a
- href="#x1-260001.3.2">paragraph 1.3.2<!--tex4ht:ref: vorbis:spec:window --></a>, “<a
- href="#x1-260001.3.2">Window shape decode (long windows
- only)<!--tex4ht:ref: vorbis:spec:window --></a>”). The overlapped portion produced from overlapping the previous and current frame data
- is finished data to be returned by the decoder. This data spans from the center of
- the previous window to the center of the current window. In the case of same-sized
- windows, the amount of data to return is one-half block consisting of and only of the
- overlapped portions. When overlapping a short and long window, much of the returned
- range does not actually overlap. This does not damage transform orthogonality. Pay
- attention however to returning the correct data range; the amount of data to be returned
- is:
- <!--l. 591--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb22">
- <a
- id="x1-79002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> window_blocksize(previous_window)/4+window_blocksize(current_window)/4</span>
- </div>
- <!--l. 595--><p class="noindent" >from the center (element windowsize/2) of the previous window to the center (element
- windowsize/2-1, inclusive) of the current window.
- <!--l. 598--><p class="noindent" >Data is not returned from the first frame; it must be used to ’prime’ the decode engine. The
- encoder accounts for this priming when calculating PCM offsets; after the first frame, the proper
- PCM output offset is ’0’ (as no data has been returned yet).
- <!--l. 605--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">4.3.9 </span> <a
- id="x1-800004.3.9"></a>output channel order</h5>
- <!--l. 607--><p class="noindent" >Vorbis I specifies only a channel mapping type 0. In mapping type 0, channel mapping is
- implicitly defined as follows for standard audio applications:
- <!--l. 611--><p class="noindent" >
-
-
- <dl class="description"><dt class="description">
- <span
- class="cmssbx-10x-x-120">three channels</span> </dt><dd
- class="description">the stream is monophonic
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">two channels</span> </dt><dd
- class="description">the stream is stereo. channel order: left, right
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">three channels</span> </dt><dd
- class="description">the stream is a 1d-surround encoding. channel order: left, center, right
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">four channels</span> </dt><dd
- class="description">the stream is quadraphonic surround. channel order: front left, front right,
- rear left, rear right
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">five channels</span> </dt><dd
- class="description">the stream is five-channel surround. channel order: front left, front center,
- front right, rear left, rear right
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">six channels</span> </dt><dd
- class="description">the stream is 5.1 surround. channel order: front left, front center, front right,
- rear left, rear right, LFE
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">greater than six channels</span> </dt><dd
- class="description">channel use and order is defined by the application
- </dd></dl>
- <!--l. 639--><p class="noindent" >Applications using Vorbis for dedicated purposes may define channel mapping as seen fit. Future
- channel mappings (such as three and four channel <a
- href="http://www.ambisonic.net/" >Ambisonics</a>) will make use of channel
- mappings other than mapping 0.
-
-
-
-
- <h3 class="sectionHead"><span class="titlemark">5 </span> <a
- id="x1-810005"></a>comment field and header specification</h3>
- <!--l. 6--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">5.1 </span> <a
- id="x1-820005.1"></a>Overview</h4>
- <!--l. 8--><p class="noindent" >The Vorbis text comment header is the second (of three) header packets that begin a Vorbis
- bitstream. It is meant for short text comments, not arbitrary metadata; arbitrary metadata
- belongs in a separate logical bitstream (usually an XML stream type) that provides greater
- structure and machine parseability.
- <!--l. 14--><p class="noindent" >The comment field is meant to be used much like someone jotting a quick note on the bottom of
- a CDR. It should be a little information to remember the disc by and explain it to others; a
- short, to-the-point text note that need not only be a couple words, but isn’t going to be more
- than a short paragraph. The essentials, in other words, whatever they turn out to be,
- eg:
- <!--l. 21--><p class="noindent" >
- <div class="quote">
- <!--l. 22--><p class="noindent" >Honest Bob and the Factory-to-Dealer-Incentives, <span
- class="cmti-12">“I’m Still Around”</span>, opening
- for Moxy Früvous, 1997.</div>
- <!--l. 29--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">5.2 </span> <a
- id="x1-830005.2"></a>Comment encoding</h4>
- <!--l. 31--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">5.2.1 </span> <a
- id="x1-840005.2.1"></a>Structure</h5>
- <!--l. 33--><p class="noindent" >The comment header is logically a list of eight-bit-clean vectors; the number of vectors is
- bounded to 2<sup><span
- class="cmr-8">32</span></sup> <span
- class="cmsy-10x-x-120">- </span>1 and the length of each vector is limited to 2<sup><span
- class="cmr-8">32</span></sup> <span
- class="cmsy-10x-x-120">- </span>1 bytes. The vector length is
-
-
- encoded; the vector contents themselves are not null terminated. In addition to the vector list,
- there is a single vector for vendor name (also 8 bit clean, length encoded in 32 bits). For
- example, the 1.0 release of libvorbis set the vendor string to “Xiph.Org libVorbis I
- 20020717”.
- <!--l. 41--><p class="noindent" >The vector lengths and number of vectors are stored lsb first, according to the bit
- packing conventions of the vorbis codec. However, since data in the comment header
- is octet-aligned, they can simply be read as unaligned 32 bit little endian unsigned
- integers.
- <!--l. 46--><p class="noindent" >The comment header is decoded as follows:
- <!--l. 48--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb23">
- <a
- id="x1-84002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [vendor_length]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> 32</span><span
- class="cmtt-8"> bits</span>
- <br class="fancyvrb" /><a
- id="x1-84004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [vendor_string]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> a</span><span
- class="cmtt-8"> UTF-8</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> [vendor_length]</span><span
- class="cmtt-8"> octets</span>
- <br class="fancyvrb" /><a
- id="x1-84006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> [user_comment_list_length]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> 32</span><span
- class="cmtt-8"> bits</span>
- <br class="fancyvrb" /><a
- id="x1-84008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [user_comment_list_length]</span><span
- class="cmtt-8"> times</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-84010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> [length]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> 32</span><span
- class="cmtt-8"> bits</span>
- <br class="fancyvrb" /><a
- id="x1-84012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> this</span><span
- class="cmtt-8"> iteration’s</span><span
- class="cmtt-8"> user</span><span
- class="cmtt-8"> comment</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> a</span><span
- class="cmtt-8"> UTF-8</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> [length]</span><span
- class="cmtt-8"> octets</span>
- <br class="fancyvrb" /><a
- id="x1-84014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-84016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> [framing_bit]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> a</span><span
- class="cmtt-8"> single</span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> boolean</span>
- <br class="fancyvrb" /><a
- id="x1-84018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 8)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [framing_bit]</span><span
- class="cmtt-8"> unset</span><span
- class="cmtt-8"> or</span><span
- class="cmtt-8"> end-of-packet</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> then</span><span
- class="cmtt-8"> ERROR</span>
- <br class="fancyvrb" /><a
- id="x1-84020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 9)</span><span
- class="cmtt-8"> done.</span>
- </div>
- <!--l. 64--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">5.2.2 </span> <a
- id="x1-850005.2.2"></a>Content vector format</h5>
- <!--l. 66--><p class="noindent" >The comment vectors are structured similarly to a UNIX environment variable. That is,
- comment fields consist of a field name and a corresponding value and look like:
- <!--l. 70--><p class="noindent" >
- <div class="quote">
- <!--l. 71--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb24">
- <a
- id="x1-85002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> comment[0]="ARTIST=me";</span>
- <br class="fancyvrb" /><a
- id="x1-85004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> comment[1]="TITLE=the</span><span
- class="cmtt-8"> sound</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> Vorbis";</span>
- </div>
- </div>
-
-
- <!--l. 77--><p class="noindent" >The field name is case-insensitive and may consist of ASCII 0x20 through 0x7D, 0x3D (’=’)
- excluded. ASCII 0x41 through 0x5A inclusive (characters A-Z) is to be considered equivalent to
- ASCII 0x61 through 0x7A inclusive (characters a-z).
- <!--l. 83--><p class="noindent" >The field name is immediately followed by ASCII 0x3D (’=’); this equals sign is used to
- terminate the field name.
- <!--l. 87--><p class="noindent" >0x3D is followed by 8 bit clean UTF-8 encoded value of the field contents to the end of the
- field.
- <!--l. 91--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-860005.2.2"></a><span
- class="cmbx-12">Field names</span></span>
- Below is a proposed, minimal list of standard field names with a description of intended use. No
- single or group of field names is mandatory; a comment header may contain one, all or none of
- the names in this list.
- <!--l. 98--><p class="noindent" >
- <dl class="description"><dt class="description">
- <span
- class="cmssbx-10x-x-120">TITLE</span> </dt><dd
- class="description">Track/Work name
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">VERSION</span> </dt><dd
- class="description">The version field may be used to differentiate multiple versions of the same
- track title in a single collection. (e.g. remix info)
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">ALBUM</span> </dt><dd
- class="description">The collection name to which this track belongs
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">TRACKNUMBER</span> </dt><dd
- class="description">The track number of this piece if part of a specific larger collection or
- album
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">ARTIST</span> </dt><dd
- class="description">The artist generally considered responsible for the work. In popular music this is
- usually the performing band or singer. For classical music it would be the composer.
- For an audio book it would be the author of the original text.
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">PERFORMER</span> </dt><dd
- class="description">The artist(s) who performed the work. In classical music this would be the
- conductor, orchestra, soloists. In an audio book it would be the actor who did the
- reading. In popular music this is typically the same as the ARTIST and is omitted.
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">COPYRIGHT</span> </dt><dd
- class="description">Copyright attribution, e.g., ’2001 Nobody’s Band’ or ’1999 Jack Moffitt’
- </dd><dt class="description">
-
-
- <span
- class="cmssbx-10x-x-120">LICENSE</span> </dt><dd
- class="description">License information, eg, ’All Rights Reserved’, ’Any Use Permitted’, a URL to
- a license such as a Creative
- Commons license (”www.creativecommons.org/blahblah/license.html”) or the EFF
- Open Audio License (’distributed under the terms of the Open Audio License. see
- http://www.eff.org/IP/Open˙licenses/eff˙oal.html for details’), etc.
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">ORGANIZATION</span> </dt><dd
- class="description">Name of the organization producing the track (i.e. the ’record label’)
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">DESCRIPTION</span> </dt><dd
- class="description">A short text description of the contents
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">GENRE</span> </dt><dd
- class="description">A short text indication of music genre
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">DATE</span> </dt><dd
- class="description">Date the track was recorded
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">LOCATION</span> </dt><dd
- class="description">Location where track was recorded
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">CONTACT</span> </dt><dd
- class="description">Contact information for the creators or distributors of the track. This could
- be a URL, an email address, the physical address of the producing label.
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">ISRC</span> </dt><dd
- class="description">International Standard Recording Code for the track; see <a
- href="http://www.ifpi.org/isrc/" >the ISRC intro page</a> for
- more information on ISRC numbers.
- </dd></dl>
- <!--l. 158--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-870005.2.2"></a><span
- class="cmbx-12">Implications</span></span>
- Field names should not be ’internationalized’; this is a concession to simplicity not
- an attempt to exclude the majority of the world that doesn’t speak English. Field
- <span
- class="cmti-12">contents</span>, however, use the UTF-8 character encoding to allow easy representation of any
- language.
- <!--l. 166--><p class="noindent" >We have the length of the entirety of the field and restrictions on the field name so that
- the field name is bounded in a known way. Thus we also have the length of the field
- contents.
- <!--l. 170--><p class="noindent" >Individual ’vendors’ may use non-standard field names within reason. The proper
- use of comment fields should be clear through context at this point. Abuse will be
- discouraged.
-
-
- <!--l. 174--><p class="noindent" >There is no vendor-specific prefix to ’nonstandard’ field names. Vendors should make some effort
- to avoid arbitrarily polluting the common namespace. We will generally collect the more useful
- tags here to help with standardization.
- <!--l. 179--><p class="noindent" >Field names are not required to be unique (occur once) within a comment header. As an
- example, assume a track was recorded by three well know artists; the following is permissible,
- and encouraged:
- <!--l. 183--><p class="noindent" >
- <div class="quote">
- <!--l. 184--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb25">
- <a
- id="x1-87002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ARTIST=Dizzy</span><span
- class="cmtt-8"> Gillespie</span>
- <br class="fancyvrb" /><a
- id="x1-87004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ARTIST=Sonny</span><span
- class="cmtt-8"> Rollins</span>
- <br class="fancyvrb" /><a
- id="x1-87006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> ARTIST=Sonny</span><span
- class="cmtt-8"> Stitt</span>
- </div>
- </div>
- <!--l. 197--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">5.2.3 </span> <a
- id="x1-880005.2.3"></a>Encoding</h5>
- <!--l. 199--><p class="noindent" >The comment header comprises the entirety of the second bitstream header packet. Unlike the
- first bitstream header packet, it is not generally the only packet on the second page and may not
- be restricted to within the second bitstream page. The length of the comment header packet is
- (practically) unbounded. The comment header packet is not optional; it must be present in the
- bitstream even if it is effectively empty.
- <!--l. 207--><p class="noindent" >The comment header is encoded as follows (as per Ogg’s standard bitstream mapping which
- renders least-significant-bit of the word to be coded into the least significant available bit of the
- current bitstream octet first):
- <!--l. 212--><p class="noindent" >
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-88002x1">Vendor string length (32 bit unsigned quantity specifying number of octets)
- </li>
- <li
- class="enumerate" id="x1-88004x2">Vendor string ([vendor string length] octets coded from beginning of string to end of
- string, not null terminated)
-
-
- </li>
- <li
- class="enumerate" id="x1-88006x3">Number of comment fields (32 bit unsigned quantity specifying number of fields)
- </li>
- <li
- class="enumerate" id="x1-88008x4">Comment field 0 length (if [Number of comment fields] <span
- class="cmmi-12">> </span>0; 32 bit unsigned quantity
- specifying number of octets)
- </li>
- <li
- class="enumerate" id="x1-88010x5">Comment field 0 ([Comment field 0 length] octets coded from beginning of string to
- end of string, not null terminated)
- </li>
- <li
- class="enumerate" id="x1-88012x6">Comment field 1 length (if [Number of comment fields] <span
- class="cmmi-12">> </span>1...)...
- </li></ol>
- <!--l. 234--><p class="noindent" >This is actually somewhat easier to describe in code; implementation of the above can be found
- in <span
- class="cmtt-12">vorbis/lib/info.c</span>, <span
- class="cmtt-12">_vorbis_pack_comment() </span>and <span
- class="cmtt-12">_vorbis_unpack_comment()</span>.
-
-
-
-
- <h3 class="sectionHead"><span class="titlemark">6 </span> <a
- id="x1-890006"></a>Floor type 0 setup and decode</h3>
- <!--l. 6--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">6.1 </span> <a
- id="x1-900006.1"></a>Overview</h4>
- <!--l. 8--><p class="noindent" >Vorbis floor type zero uses Line Spectral Pair (LSP, also alternately known as Line Spectral
- Frequency or LSF) representation to encode a smooth spectral envelope curve as the frequency
- response of the LSP filter. This representation is equivalent to a traditional all-pole infinite
- impulse response filter as would be used in linear predictive coding; LSP representation may be
- converted to LPC representation and vice-versa.
- <!--l. 18--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">6.2 </span> <a
- id="x1-910006.2"></a>Floor 0 format</h4>
- <!--l. 20--><p class="noindent" >Floor zero configuration consists of six integer fields and a list of VQ codebooks for use in
- coding/decoding the LSP filter coefficient values used by each frame.
- <!--l. 24--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">6.2.1 </span> <a
- id="x1-920006.2.1"></a>header decode</h5>
- <!--l. 26--><p class="noindent" >Configuration information for instances of floor zero decodes from the codec setup header (third
- packet). configuration decode proceeds as follows:
- <!--l. 30--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb26">
- <a
- id="x1-92002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [floor0_order]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> 8</span><span
- class="cmtt-8"> bits</span>
- <br class="fancyvrb" /><a
- id="x1-92004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [floor0_rate]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> 16</span><span
- class="cmtt-8"> bits</span>
- <br class="fancyvrb" /><a
- id="x1-92006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> [floor0_bark_map_size]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> 16</span><span
- class="cmtt-8"> bits</span>
- <br class="fancyvrb" /><a
- id="x1-92008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> [floor0_amplitude_bits]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> six</span><span
- class="cmtt-8"> bits</span>
- <br class="fancyvrb" /><a
- id="x1-92010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> [floor0_amplitude_offset]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> eight</span><span
- class="cmtt-8"> bits</span>
- <br class="fancyvrb" /><a
- id="x1-92012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> [floor0_number_of_books]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> four</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> and</span><span
- class="cmtt-8"> add</span><span
- class="cmtt-8"> 1</span>
- <br class="fancyvrb" /><a
- id="x1-92014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> array</span><span
- class="cmtt-8"> [floor0_book_list]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> a</span><span
- class="cmtt-8"> list</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> [floor0_number_of_books]</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integers</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> eight</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> each;</span>
- </div>
-
-
- <!--l. 40--><p class="noindent" >An end-of-packet condition during any of these bitstream reads renders this stream undecodable.
- In addition, any element of the array <span
- class="cmtt-12">[floor0_book_list] </span>that is greater than the maximum
- codebook number for this bitstream is an error condition that also renders the stream
- undecodable.
- <!--l. 48--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">6.2.2 </span> <a
- id="x1-930006.2.2"></a>packet decode</h5>
- <!--l. 50--><p class="noindent" >Extracting a floor0 curve from an audio packet consists of first decoding the curve
- amplitude and <span
- class="cmtt-12">[floor0_order] </span>LSP coefficient values from the bitstream, and then
- computing the floor curve, which is defined as the frequency response of the decoded LSP
- filter.
- <!--l. 56--><p class="noindent" >Packet decode proceeds as follows:
- <div class="fancyvrb" id="fancyvrb27">
- <a
- id="x1-93002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [amplitude]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> [floor0_amplitude_bits]</span><span
- class="cmtt-8"> bits</span>
- <br class="fancyvrb" /><a
- id="x1-93004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [amplitude]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> greater</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> zero</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-93006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> [coefficients]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> empty,</span><span
- class="cmtt-8"> zero</span><span
- class="cmtt-8"> length</span><span
- class="cmtt-8"> vector</span>
- <br class="fancyvrb" /><a
- id="x1-93008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> [booknumber]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> </span><a
- href="#x1-1170009.2.1"><span
- class="cmtt-8">ilog</span></a><span
- class="cmtt-8">(</span><span
- class="cmtt-8"> [floor0_number_of_books]</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> bits</span>
- <br class="fancyvrb" /><a
- id="x1-93010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [booknumber]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> greater</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> highest</span><span
- class="cmtt-8"> number</span><span
- class="cmtt-8"> decode</span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> then</span><span
- class="cmtt-8"> packet</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> undecodable</span>
- <br class="fancyvrb" /><a
- id="x1-93012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> [last]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> zero;</span>
- <br class="fancyvrb" /><a
- id="x1-93014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [temp_vector]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> from</span><span
- class="cmtt-8"> bitstream</span><span
- class="cmtt-8"> using</span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> number</span><span
- class="cmtt-8"> [floor0_book_list]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [booknumber]</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> VQ</span><span
- class="cmtt-8"> context.</span>
- <br class="fancyvrb" /><a
- id="x1-93016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 8)</span><span
- class="cmtt-8"> add</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> scalar</span><span
- class="cmtt-8"> value</span><span
- class="cmtt-8"> [last]</span><span
- class="cmtt-8"> to</span><span
- class="cmtt-8"> each</span><span
- class="cmtt-8"> scalar</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [temp_vector]</span>
- <br class="fancyvrb" /><a
- id="x1-93018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 9)</span><span
- class="cmtt-8"> [last]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> value</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> last</span><span
- class="cmtt-8"> scalar</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [temp_vector]</span>
- <br class="fancyvrb" /><a
- id="x1-93020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 10)</span><span
- class="cmtt-8"> concatenate</span><span
- class="cmtt-8"> [temp_vector]</span><span
- class="cmtt-8"> onto</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> end</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> [coefficients]</span><span
- class="cmtt-8"> vector</span>
- <br class="fancyvrb" /><a
- id="x1-93022r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 11)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (length</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [coefficients]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> less</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> [floor0_order],</span><span
- class="cmtt-8"> continue</span><span
- class="cmtt-8"> at</span><span
- class="cmtt-8"> step</span><span
- class="cmtt-8"> 6</span>
- <br class="fancyvrb" /><a
- id="x1-93024r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-93026r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-93028r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-93030r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 12)</span><span
- class="cmtt-8"> done.</span>
- <br class="fancyvrb" /><a
- id="x1-93032r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- </div>
- <!--l. 76--><p class="noindent" >Take note of the following properties of decode:
- <ul class="itemize1">
- <li class="itemize">An <span
- class="cmtt-12">[amplitude] </span>value of zero must result in a return code that indicates this channel
- is unused in this frame (the output of the channel will be all-zeroes in synthesis).
- Several later stages of decode don’t occur for an unused channel.
- </li>
- <li class="itemize">An end-of-packet condition during decode should be considered a nominal occruence;
- if end-of-packet is reached during any read operation above, floor decode is to return
- ’unused’ status as if the <span
- class="cmtt-12">[amplitude] </span>value had read zero at the beginning of decode.
- </li>
- <li class="itemize">The book number used for decode can, in fact, be stored in the bitstream in <a
- href="#x1-1170009.2.1">ilog</a>(
-
-
- <span
- class="cmtt-12">[floor0_number_of_books] </span>- 1 ) bits. Nevertheless, the above specification is correct
- and values greater than the maximum possible book value are reserved.
- </li>
- <li class="itemize">The number of scalars read into the vector <span
- class="cmtt-12">[coefficients] </span>may be greater
- than <span
- class="cmtt-12">[floor0_order]</span>, the number actually required for curve computation. For
- example, if the VQ codebook used for the floor currently being decoded has a
- <span
- class="cmtt-12">[codebook_dimensions] </span>value of three and <span
- class="cmtt-12">[floor0_order] </span>is ten, the only way to
- fill all the needed scalars in <span
- class="cmtt-12">[coefficients] </span>is to to read a total of twelve scalars
- as four vectors of three scalars each. This is not an error condition, and care must
- be taken not to allow a buffer overflow in decode. The extra values are not used and
- may be ignored or discarded.</li></ul>
- <!--l. 104--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">6.2.3 </span> <a
- id="x1-940006.2.3"></a>curve computation</h5>
- <!--l. 106--><p class="noindent" >Given an <span
- class="cmtt-12">[amplitude] </span>integer and <span
- class="cmtt-12">[coefficients] </span>vector from packet decode as well
- as the [floor0˙order], [floor0˙rate], [floor0˙bark˙map˙size], [floor0˙amplitude˙bits] and
- [floor0˙amplitude˙offset] values from floor setup, and an output vector size <span
- class="cmtt-12">[n] </span>specified by the
- decode process, we compute a floor output vector.
- <!--l. 113--><p class="noindent" >If the value <span
- class="cmtt-12">[amplitude] </span>is zero, the return value is a length <span
- class="cmtt-12">[n] </span>vector with all-zero
- scalars. Otherwise, begin by assuming the following definitions for the given vector to be
- synthesized:
- <center class="par-math-display" >
- <img
- src="Vorbis_I_spec7x.png" alt=" {
- min (floor0xbarkxmapxsize - 1,f oobar) for i ∈ [0, n - 1]
- mapi = - 1 for i = n
- " class="par-math-display" ></center>
- <!--l. 128--><p class="nopar" >
- <!--l. 130--><p class="noindent" >where
- <center class="par-math-display" >
- <img
- src="Vorbis_I_spec8x.png" alt=" ⌊ ⌋
- (floor0xrate ⋅ i) floor0xbarkxmapxsize
- foobar = bark -------2n------- ⋅-bark(.5 ⋅-floor0xrate-)
- " class="par-math-display" ></center>
-
-
- <!--l. 137--><p class="nopar" >
- <!--l. 139--><p class="noindent" >and
- <center class="par-math-display" >
- <img
- src="Vorbis_I_spec9x.png" alt=" 2
- bark(x) = 13.1arctan (.00074x ) + 2.24 arctan(.0000000185x + .0001x )
- " class="par-math-display" ></center>
- <!--l. 143--><p class="nopar" >
- <!--l. 145--><p class="noindent" >The above is used to synthesize the LSP curve on a Bark-scale frequency axis, then map the
- result to a linear-scale frequency axis. Similarly, the below calculation synthesizes the output
- LSP curve <span
- class="cmtt-12">[output] </span>on a log (dB) amplitude scale, mapping it to linear amplitude in the last
- step:
- <!--l. 150--><p class="noindent" >
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-94002x1"><span
- class="cmtt-12">[i] </span>= 0
- </li>
- <li
- class="enumerate" id="x1-94004x2"><span
- class="cmtt-12">[</span><span
- class="cmmi-12">ω</span><span
- class="cmtt-12">] </span>= <span
- class="cmmi-12">π </span>* map element <span
- class="cmtt-12">[i] </span>/ <span
- class="cmtt-12">[floor0_bark_map_size]</span>
- </li>
- <li
- class="enumerate" id="x1-94006x3">if ( <span
- class="cmtt-12">[floor0_order] </span>is odd )
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-94008x1">calculate <span
- class="cmtt-12">[p] </span>and <span
- class="cmtt-12">[q] </span>according to: <div class="eqnarray">
- <center class="math-display" >
- <img
- src="Vorbis_I_spec10x.png" alt=" floor0xorder-3
- 2 ∏2 2
- p = (1 - cos ω) 4(cos([coefficients ]2j+1) - cosω )
- j=0
- floor0x∏or2der-1
- q = 1- 4(cos([coefficients ]2j) - cosω )2
- 4 j=0
-
-
- " class="math-display" ></center>
- </div>
- </li></ol>
- <!--l. 162--><p class="noindent" >else <span
- class="cmtt-12">[floor0_order] </span>is even
- <ol class="enumerate2" >
- <li
- class="enumerate" id="x1-94011x1">calculate <span
- class="cmtt-12">[p] </span>and <span
- class="cmtt-12">[q] </span>according to: <div class="eqnarray">
- <center class="math-display" >
- <img
- src="Vorbis_I_spec11x.png" alt=" floor0xorder-2
- (1 - cos2ω) ∏2 2
- p = -----2------ 4(cos([coefficients ]2j+1) - cosω )
- j=0
- 2 floor0xor2der-2
- q = (1 +-cos-ω)- ∏ 4(cos([coefficients ] ) - cosω )2
- 2 j=0 2j
- " class="math-display" ></center>
- </div>
- </li></ol>
- </li>
- <li
- class="enumerate" id="x1-94014x4">calculate <span
- class="cmtt-12">[linear_floor_value] </span>according to:
- <center class="math-display" >
- <img
- src="Vorbis_I_spec12x.png" alt=" ( ( ))
- amplitude---⋅ floor0xamplitutexoffset---
- exp .11512925 (2floor0xamplitudexbits - 1)√ p + q - floor0xamplitudexoffset
- " class="math-display" ></center>
- <!--l. 177--><p class="nopar" >
- </li>
- <li
- class="enumerate" id="x1-94016x5"><span
- class="cmtt-12">[iteration_condition] </span>= map element <span
- class="cmtt-12">[i]</span>
-
-
- </li>
- <li
- class="enumerate" id="x1-94018x6"><span
- class="cmtt-12">[output] </span>element <span
- class="cmtt-12">[i] </span>= <span
- class="cmtt-12">[linear_floor_value]</span>
- </li>
- <li
- class="enumerate" id="x1-94020x7">increment <span
- class="cmtt-12">[i]</span>
- </li>
- <li
- class="enumerate" id="x1-94022x8">if ( map element <span
- class="cmtt-12">[i] </span>is equal to <span
- class="cmtt-12">[iteration_condition] </span>) continue at step
- 5
- </li>
- <li
- class="enumerate" id="x1-94024x9">if ( <span
- class="cmtt-12">[i] </span>is less than <span
- class="cmtt-12">[n] </span>) continue at step 2
- </li>
- <li
- class="enumerate" id="x1-94026x10">done</li></ol>
-
-
-
-
- <h3 class="sectionHead"><span class="titlemark">7 </span> <a
- id="x1-950007"></a>Floor type 1 setup and decode</h3>
- <!--l. 6--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">7.1 </span> <a
- id="x1-960007.1"></a>Overview</h4>
- <!--l. 8--><p class="noindent" >Vorbis floor type one uses a piecewise straight-line representation to encode a spectral envelope
- curve. The representation plots this curve mechanically on a linear frequency axis and a
- logarithmic (dB) amplitude axis. The integer plotting algorithm used is similar to Bresenham’s
- algorithm.
- <!--l. 16--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">7.2 </span> <a
- id="x1-970007.2"></a>Floor 1 format</h4>
- <!--l. 18--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">7.2.1 </span> <a
- id="x1-980007.2.1"></a>model</h5>
- <!--l. 20--><p class="noindent" >Floor type one represents a spectral curve as a series of line segments. Synthesis constructs a
- floor curve using iterative prediction in a process roughly equivalent to the following simplified
- description:
- <ul class="itemize1">
- <li class="itemize">the first line segment (base case) is a logical line spanning from x˙0,y˙0 to x˙1,y˙1
- where in the base case x˙0=0 and x˙1=[n], the full range of the spectral floor to be
- computed.
- </li>
- <li class="itemize">the induction step chooses a point x˙new within an existing logical line segment and
- produces a y˙new value at that point computed from the existing line’s y value at
- x˙new (as plotted by the line) and a difference value decoded from the bitstream
- packet.
-
-
- </li>
- <li class="itemize">floor computation produces two new line segments, one running from x˙0,y˙0 to
- x˙new,y˙new and from x˙new,y˙new to x˙1,y˙1. This step is performed logically even if
- y˙new represents no change to the amplitude value at x˙new so that later refinement
- is additionally bounded at x˙new.
- </li>
- <li class="itemize">the induction step repeats, using a list of x values specified in the codec setup header
- at floor 1 initialization time. Computation is completed at the end of the x value list.
- </li></ul>
- <!--l. 48--><p class="noindent" >Consider the following example, with values chosen for ease of understanding rather than
- representing typical configuration:
- <!--l. 51--><p class="noindent" >For the below example, we assume a floor setup with an [n] of 128. The list of selected X values
- in increasing order is 0,16,32,48,64,80,96,112 and 128. In list order, the values interleave as 0,
- 128, 64, 32, 96, 16, 48, 80 and 112. The corresponding list-order Y values as decoded from an
- example packet are 110, 20, -5, -45, 0, -25, -10, 30 and -10. We compute the floor in the following
- way, beginning with the first line:
- <div class="center"
- >
- <!--l. 59--><p class="noindent" >
- <!--l. 60--><p class="noindent" ><img
- src="floor1-1.png" alt="PIC"
- >
- <br /> <table class="caption"
- ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 7: </td><td
- class="content">graph of example floor</td></tr></table><!--tex4ht:label?: x1-980017 -->
- </div>
- <!--l. 64--><p class="noindent" >We now draw new logical lines to reflect the correction to new˙Y, and iterate for X positions 32
- and 96:
- <div class="center"
- >
- <!--l. 67--><p class="noindent" >
- <!--l. 68--><p class="noindent" ><img
- src="floor1-2.png" alt="PIC"
- >
- <br /> <table class="caption"
- ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 8: </td><td
- class="content">graph of example floor</td></tr></table><!--tex4ht:label?: x1-980028 -->
- </div>
- <!--l. 72--><p class="noindent" >Although the new Y value at X position 96 is unchanged, it is still used later as an endpoint for
- further refinement. From here on, the pattern should be clear; we complete the floor computation
- as follows:
-
-
- <div class="center"
- >
- <!--l. 76--><p class="noindent" >
- <!--l. 77--><p class="noindent" ><img
- src="floor1-3.png" alt="PIC"
- >
- <br /> <table class="caption"
- ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 9: </td><td
- class="content">graph of example floor</td></tr></table><!--tex4ht:label?: x1-980039 -->
- </div>
- <div class="center"
- >
- <!--l. 81--><p class="noindent" >
- <!--l. 82--><p class="noindent" ><img
- src="floor1-4.png" alt="PIC"
- >
- <br /> <table class="caption"
- ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 10: </td><td
- class="content">graph of example floor</td></tr></table><!--tex4ht:label?: x1-9800410 -->
- </div>
- <!--l. 86--><p class="noindent" >A more efficient algorithm with carefully defined integer rounding behavior is used for actual
- decode, as described later. The actual algorithm splits Y value computation and line plotting
- into two steps with modifications to the above algorithm to eliminate noise accumulation
- through integer roundoff/truncation.
- <!--l. 94--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">7.2.2 </span> <a
- id="x1-990007.2.2"></a>header decode</h5>
- <!--l. 96--><p class="noindent" >A list of floor X values is stored in the packet header in interleaved format (used in list order
- during packet decode and synthesis). This list is split into partitions, and each partition is
- assigned to a partition class. X positions 0 and [n] are implicit and do not belong to an explicit
- partition or partition class.
- <!--l. 102--><p class="noindent" >A partition class consists of a representation vector width (the number of Y values which
- the partition class encodes at once), a ’subclass’ value representing the number of
- alternate entropy books the partition class may use in representing Y values, the list of
- [subclass] books and a master book used to encode which alternate books were chosen
- for representation in a given packet. The master/subclass mechanism is meant to be
- used as a flexible representation cascade while still using codebooks only in a scalar
- context.
-
-
- <!--l. 112--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb28">
- <a
- id="x1-99002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-99004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [floor1_partitions]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-99006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [maximum_class]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> -1</span>
- <br class="fancyvrb" /><a
- id="x1-99008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [floor1_partitions]-1</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-99010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-99012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_partition_class_list]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-99014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-99016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-99018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-99020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> [maximum_class]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> largest</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> scalar</span><span
- class="cmtt-8"> value</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_partition_class_list]</span>
- <br class="fancyvrb" /><a
- id="x1-99022r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [maximum_class]</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-99024r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-99026r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_class_dimensions]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> and</span><span
- class="cmtt-8"> add</span><span
- class="cmtt-8"> 1</span>
- <br class="fancyvrb" /><a
- id="x1-99028r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8">  8)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_class_subclasses]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-99030r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 9)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_class_subclasses]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> nonzero</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-99032r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-99034r17"></a><span
- class="cmr-6">17</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 10)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_class_masterbooks]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 8</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-99036r18"></a><span
- class="cmr-6">18</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-99038r19"></a><span
- class="cmr-6">19</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-99040r20"></a><span
- class="cmr-6">20</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-99042r21"></a><span
- class="cmr-6">21</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 11)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [j]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> (2</span><span
- class="cmtt-8"> exponent</span><span
- class="cmtt-8"> [floor1_class_subclasses]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i])</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-99044r22"></a><span
- class="cmr-6">22</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-99046r23"></a><span
- class="cmr-6">23</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 12)</span><span
- class="cmtt-8"> array</span><span
- class="cmtt-8"> [floor1_subclass_books]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i],[j]</span><span
- class="cmtt-8"> =</span>
- <br class="fancyvrb" /><a
- id="x1-99048r24"></a><span
- class="cmr-6">24</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 8</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> and</span><span
- class="cmtt-8"> subtract</span><span
- class="cmtt-8"> one</span>
- <br class="fancyvrb" /><a
- id="x1-99050r25"></a><span
- class="cmr-6">25</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-99052r26"></a><span
- class="cmr-6">26</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-99054r27"></a><span
- class="cmr-6">27</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-99056r28"></a><span
- class="cmr-6">28</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 13)</span><span
- class="cmtt-8"> [floor1_multiplier]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> and</span><span
- class="cmtt-8"> add</span><span
- class="cmtt-8"> one</span>
- <br class="fancyvrb" /><a
- id="x1-99058r29"></a><span
- class="cmr-6">29</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 14)</span><span
- class="cmtt-8"> [rangebits]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-99060r30"></a><span
- class="cmr-6">30</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 15)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_X_list]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [0]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-99062r31"></a><span
- class="cmr-6">31</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 16)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_X_list]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [1]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> exponent</span><span
- class="cmtt-8"> [rangebits];</span>
- <br class="fancyvrb" /><a
- id="x1-99064r32"></a><span
- class="cmr-6">32</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 17)</span><span
- class="cmtt-8"> [floor1_values]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 2</span>
- <br class="fancyvrb" /><a
- id="x1-99066r33"></a><span
- class="cmr-6">33</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 18)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [floor1_partitions]-1</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-99068r34"></a><span
- class="cmr-6">34</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-99070r35"></a><span
- class="cmr-6">35</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 19)</span><span
- class="cmtt-8"> [current_class_number]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_partition_class_list]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span>
- <br class="fancyvrb" /><a
- id="x1-99072r36"></a><span
- class="cmr-6">36</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 20)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [j]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> ([floor1_class_dimensions]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [current_class_number])-1</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-99074r37"></a><span
- class="cmr-6">37</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 21)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_X_list]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> ([floor1_values])</span><span
- class="cmtt-8"> =</span>
- <br class="fancyvrb" /><a
- id="x1-99076r38"></a><span
- class="cmr-6">38</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> [rangebits]</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-99078r39"></a><span
- class="cmr-6">39</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 22)</span><span
- class="cmtt-8"> increment</span><span
- class="cmtt-8"> [floor1_values]</span><span
- class="cmtt-8"> by</span><span
- class="cmtt-8"> one</span>
- <br class="fancyvrb" /><a
- id="x1-99080r40"></a><span
- class="cmr-6">40</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-99082r41"></a><span
- class="cmr-6">41</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-99084r42"></a><span
- class="cmr-6">42</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-99086r43"></a><span
- class="cmr-6">43</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 23)</span><span
- class="cmtt-8"> done</span>
- </div>
- <!--l. 158--><p class="noindent" >An end-of-packet condition while reading any aspect of a floor 1 configuration during
- setup renders a stream undecodable. In addition, a <span
- class="cmtt-12">[floor1_class_masterbooks] </span>or
- <span
- class="cmtt-12">[floor1_subclass_books] </span>scalar element greater than the highest numbered codebook
- configured in this stream is an error condition that renders the stream undecodable.
- <!--l. 165--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-1000007.2.2"></a><span
- class="cmbx-12">packet decode</span></span>
- Packet decode begins by checking the <span
- class="cmtt-12">[nonzero] </span>flag:
-
-
- <!--l. 169--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb29">
- <a
- id="x1-100002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [nonzero]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> boolean</span>
- </div>
- <!--l. 173--><p class="noindent" >If <span
- class="cmtt-12">[nonzero] </span>is unset, that indicates this channel contained no audio energy in this frame.
- Decode immediately returns a status indicating this floor curve (and thus this channel) is unused
- this frame. (A return status of ’unused’ is different from decoding a floor that has all
- points set to minimum representation amplitude, which happens to be approximately
- -140dB).
- <!--l. 181--><p class="noindent" >Assuming <span
- class="cmtt-12">[nonzero] </span>is set, decode proceeds as follows:
- <!--l. 183--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb30">
- <a
- id="x1-100004r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [range]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span><span
- class="cmtt-8"> 256,</span><span
- class="cmtt-8"> 128,</span><span
- class="cmtt-8"> 86,</span><span
- class="cmtt-8"> 64</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> ([floor1_multiplier]-1)</span>
- <br class="fancyvrb" /><a
- id="x1-100006r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [0]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> </span><a
- href="#x1-1170009.2.1"><span
- class="cmtt-8">ilog</span></a><span
- class="cmtt-8">([range]-1)</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-100008r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [1]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> </span><a
- href="#x1-1170009.2.1"><span
- class="cmtt-8">ilog</span></a><span
- class="cmtt-8">([range]-1)</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-100010r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> [offset]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 2;</span>
- <br class="fancyvrb" /><a
- id="x1-100012r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [floor1_partitions]-1</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-100014r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-100016r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> [class]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_partition_class]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span>
- <br class="fancyvrb" /><a
- id="x1-100018r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> [cdim]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_class_dimensions]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [class]</span>
- <br class="fancyvrb" /><a
- id="x1-100020r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 8)</span><span
- class="cmtt-8"> [cbits]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_class_subclasses]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [class]</span>
- <br class="fancyvrb" /><a
- id="x1-100022r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 9)</span><span
- class="cmtt-8"> [csub]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> (2</span><span
- class="cmtt-8"> exponent</span><span
- class="cmtt-8"> [cbits])-1</span>
- <br class="fancyvrb" /><a
- id="x1-100024r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 10)</span><span
- class="cmtt-8"> [cval]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-100026r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 11)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [cbits]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> greater</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> zero</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-100028r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-100030r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 12)</span><span
- class="cmtt-8"> [cval]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> from</span><span
- class="cmtt-8"> packet</span><span
- class="cmtt-8"> using</span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> number</span>
- <br class="fancyvrb" /><a
- id="x1-100032r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> (vector</span><span
- class="cmtt-8"> [floor1_class_masterbooks]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [class])</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> scalar</span><span
- class="cmtt-8"> context</span>
- <br class="fancyvrb" /><a
- id="x1-100034r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-100036r17"></a><span
- class="cmr-6">17</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-100038r18"></a><span
- class="cmr-6">18</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 13)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [j]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [cdim]-1</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-100040r19"></a><span
- class="cmr-6">19</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-100042r20"></a><span
- class="cmr-6">20</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 14)</span><span
- class="cmtt-8"> [book]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> array</span><span
- class="cmtt-8"> [floor1_subclass_books]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [class],([cval]</span><span
- class="cmtt-8"> bitwise</span><span
- class="cmtt-8"> AND</span><span
- class="cmtt-8"> [csub])</span>
- <br class="fancyvrb" /><a
- id="x1-100044r21"></a><span
- class="cmr-6">21</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 15)</span><span
- class="cmtt-8"> [cval]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [cval]</span><span
- class="cmtt-8"> right</span><span
- class="cmtt-8"> shifted</span><span
- class="cmtt-8"> [cbits]</span><span
- class="cmtt-8"> bits</span>
- <br class="fancyvrb" /><a
- id="x1-100046r22"></a><span
- class="cmr-6">22</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8">  </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 16)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [book]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> not</span><span
- class="cmtt-8"> less</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> zero</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-100048r23"></a><span
- class="cmr-6">23</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-100050r24"></a><span
- class="cmr-6">24</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8">  </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 17)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> ([j]+[offset])</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> from</span><span
- class="cmtt-8"> packet</span><span
- class="cmtt-8"> using</span><span
- class="cmtt-8"> codebook</span>
- <br class="fancyvrb" /><a
- id="x1-100052r25"></a><span
- class="cmr-6">25</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [book]</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> scalar</span><span
- class="cmtt-8"> context</span>
- <br class="fancyvrb" /><a
- id="x1-100054r26"></a><span
- class="cmr-6">26</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-100056r27"></a><span
- class="cmr-6">27</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span><span
- class="cmtt-8"> else</span><span
- class="cmtt-8"> [book]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> less</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> zero</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-100058r28"></a><span
- class="cmr-6">28</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-100060r29"></a><span
- class="cmr-6">29</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8">  </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 18)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> ([j]+[offset])</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-100062r30"></a><span
- class="cmr-6">30</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-100064r31"></a><span
- class="cmr-6">31</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-100066r32"></a><span
- class="cmr-6">32</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-100068r33"></a><span
- class="cmr-6">33</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-100070r34"></a><span
- class="cmr-6">34</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 19)</span><span
- class="cmtt-8"> [offset]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [offset]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [cdim]</span>
- <br class="fancyvrb" /><a
- id="x1-100072r35"></a><span
- class="cmr-6">35</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-100074r36"></a><span
- class="cmr-6">36</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-100076r37"></a><span
- class="cmr-6">37</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-100078r38"></a><span
- class="cmr-6">38</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 20)</span><span
- class="cmtt-8"> done</span>
- </div>
- <!--l. 224--><p class="noindent" >An end-of-packet condition during curve decode should be considered a nominal occurrence; if
-
-
- end-of-packet is reached during any read operation above, floor decode is to return ’unused’
- status as if the <span
- class="cmtt-12">[nonzero] </span>flag had been unset at the beginning of decode.
- <!--l. 230--><p class="noindent" >Vector <span
- class="cmtt-12">[floor1_Y] </span>contains the values from packet decode needed for floor 1 synthesis.
- <!--l. 235--><p class="noindent" ><span class="paragraphHead"><a
- id="x1-1010007.2.2"></a><span
- class="cmbx-12">curve computation</span></span>
- Curve computation is split into two logical steps; the first step derives final Y amplitude values
- from the encoded, wrapped difference values taken from the bitstream. The second step
- plots the curve lines. Also, although zero-difference values are used in the iterative
- prediction to find final Y values, these points are conditionally skipped during final
- line computation in step two. Skipping zero-difference values allows a smoother line
- fit.
- <!--l. 245--><p class="noindent" >Although some aspects of the below algorithm look like inconsequential optimizations,
- implementors are warned to follow the details closely. Deviation from implementing a strictly
- equivalent algorithm can result in serious decoding errors.
- <!--l. 250--><p class="noindent" >
- <dl class="description"><dt class="description">
- <span
- class="cmssbx-10x-x-120">step 1: amplitude value synthesis</span> </dt><dd
- class="description">
- <!--l. 253--><p class="noindent" >Unwrap the always-positive-or-zero values read from the packet into +/- difference
- values, then apply to line prediction.
- <!--l. 256--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb31">
- <a
- id="x1-101002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [range]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span><span
- class="cmtt-8"> 256,</span><span
- class="cmtt-8"> 128,</span><span
- class="cmtt-8"> 86,</span><span
- class="cmtt-8"> 64</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> ([floor1_multiplier]-1)</span>
- <br class="fancyvrb" /><a
- id="x1-101004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_step2_flag]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [0]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> set</span>
- <br class="fancyvrb" /><a
- id="x1-101006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_step2_flag]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [1]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> set</span>
- <br class="fancyvrb" /><a
- id="x1-101008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_final_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [0]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [0]</span>
- <br class="fancyvrb" /><a
- id="x1-101010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_final_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [1]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [1]</span>
- <br class="fancyvrb" /><a
- id="x1-101012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [floor1_values]-1</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> [low_neighbor_offset]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> </span><a
- href="#x1-1200009.2.4"><span
- class="cmtt-8">low_neighbor</span></a><span
- class="cmtt-8">([floor1_X_list],[i])</span>
- <br class="fancyvrb" /><a
- id="x1-101018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 8)</span><span
- class="cmtt-8"> [high_neighbor_offset]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> </span><a
- href="#x1-1210009.2.5"><span
- class="cmtt-8">high_neighbor</span></a><span
- class="cmtt-8">([floor1_X_list],[i])</span>
- <br class="fancyvrb" /><a
- id="x1-101020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101022r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 9)</span><span
- class="cmtt-8"> [predicted]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> </span><a
- href="#x1-1220009.2.6"><span
- class="cmtt-8">render_point</span></a><span
- class="cmtt-8">(</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_X_list]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [low_neighbor_offset],</span>
- <br class="fancyvrb" /><a
- id="x1-101024r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8">  </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_final_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [low_neighbor_offset],</span>
- <br class="fancyvrb" /><a
- id="x1-101026r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_X_list]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [high_neighbor_offset],</span>
- <br class="fancyvrb" /><a
- id="x1-101028r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8">  </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_final_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [high_neighbor_offset],</span>
- <br class="fancyvrb" /><a
- id="x1-101030r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_X_list]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> )</span>
- <br class="fancyvrb" /><a
- id="x1-101032r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101034r17"></a><span
- class="cmr-6">17</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 10)</span><span
- class="cmtt-8"> [val]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span>
- <br class="fancyvrb" /><a
- id="x1-101036r18"></a><span
- class="cmr-6">18</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 11)</span><span
- class="cmtt-8"> [highroom]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [range]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> [predicted]</span>
- <br class="fancyvrb" /><a
- id="x1-101038r19"></a><span
- class="cmr-6">19</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 12)</span><span
- class="cmtt-8"> [lowroom]</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [predicted]</span>
- <br class="fancyvrb" /><a
- id="x1-101040r20"></a><span
- class="cmr-6">20</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 13)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [highroom]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> less</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> [lowroom]</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101042r21"></a><span
- class="cmr-6">21</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101044r22"></a><span
- class="cmr-6">22</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 14)</span><span
- class="cmtt-8"> [room]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [highroom]</span><span
- class="cmtt-8"> *</span><span
- class="cmtt-8"> 2</span>
- <br class="fancyvrb" /><a
- id="x1-101046r23"></a><span
- class="cmr-6">23</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
-
-
- <br class="fancyvrb" /><a
- id="x1-101048r24"></a><span
- class="cmr-6">24</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span><span
- class="cmtt-8"> else</span><span
- class="cmtt-8"> [highroom]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> not</span><span
- class="cmtt-8"> less</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> [lowroom]</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101050r25"></a><span
- class="cmr-6">25</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101052r26"></a><span
- class="cmr-6">26</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 15)</span><span
- class="cmtt-8"> [room]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [lowroom]</span><span
- class="cmtt-8"> *</span><span
- class="cmtt-8"> 2</span>
- <br class="fancyvrb" /><a
- id="x1-101054r27"></a><span
- class="cmr-6">27</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101056r28"></a><span
- class="cmr-6">28</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-101058r29"></a><span
- class="cmr-6">29</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101060r30"></a><span
- class="cmr-6">30</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 16)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [val]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> nonzero</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101062r31"></a><span
- class="cmr-6">31</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101064r32"></a><span
- class="cmr-6">32</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 17)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_step2_flag]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [low_neighbor_offset]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> set</span>
- <br class="fancyvrb" /><a
- id="x1-101066r33"></a><span
- class="cmr-6">33</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 18)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_step2_flag]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [high_neighbor_offset]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> set</span>
- <br class="fancyvrb" /><a
- id="x1-101068r34"></a><span
- class="cmr-6">34</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 19)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_step2_flag]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> set</span>
- <br class="fancyvrb" /><a
- id="x1-101070r35"></a><span
- class="cmr-6">35</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 20)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [val]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> greater</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> or</span><span
- class="cmtt-8"> equal</span><span
- class="cmtt-8"> to</span><span
- class="cmtt-8"> [room]</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101072r36"></a><span
- class="cmr-6">36</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101074r37"></a><span
- class="cmr-6">37</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 21)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [highroom]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> greater</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> [lowroom]</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101076r38"></a><span
- class="cmr-6">38</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101078r39"></a><span
- class="cmr-6">39</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 22)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_final_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [val]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> [lowroom]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [predicted]</span>
- <br class="fancyvrb" /><a
- id="x1-101080r40"></a><span
- class="cmr-6">40</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101082r41"></a><span
- class="cmr-6">41</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8">  </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span><span
- class="cmtt-8"> else</span><span
- class="cmtt-8"> [highroom]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> not</span><span
- class="cmtt-8"> greater</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> [lowroom]</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101084r42"></a><span
- class="cmr-6">42</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101086r43"></a><span
- class="cmr-6">43</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 23)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_final_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [predicted]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> [val]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [highroom]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> 1</span>
- <br class="fancyvrb" /><a
- id="x1-101088r44"></a><span
- class="cmr-6">44</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101090r45"></a><span
- class="cmr-6">45</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-101092r46"></a><span
- class="cmr-6">46</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101094r47"></a><span
- class="cmr-6">47</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span><span
- class="cmtt-8"> else</span><span
- class="cmtt-8"> [val]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> less</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> [room]</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101096r48"></a><span
- class="cmr-6">48</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101098r49"></a><span
- class="cmr-6">49</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8">  </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 24)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> ([val]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> odd)</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101100r50"></a><span
- class="cmr-6">50</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101102r51"></a><span
- class="cmr-6">51</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 25)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_final_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span>
- <br class="fancyvrb" /><a
- id="x1-101104r52"></a><span
- class="cmr-6">52</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [predicted]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> (([val]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> divided</span><span
- class="cmtt-8"> by</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> using</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> division)</span>
- <br class="fancyvrb" /><a
- id="x1-101106r53"></a><span
- class="cmr-6">53</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101108r54"></a><span
- class="cmr-6">54</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span><span
- class="cmtt-8"> else</span><span
- class="cmtt-8"> [val]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> even</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101110r55"></a><span
- class="cmr-6">55</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101112r56"></a><span
- class="cmr-6">56</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 26)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_final_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span>
- <br class="fancyvrb" /><a
- id="x1-101114r57"></a><span
- class="cmr-6">57</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [predicted]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> ([val]</span><span
- class="cmtt-8"> /</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> using</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> division)</span>
- <br class="fancyvrb" /><a
- id="x1-101116r58"></a><span
- class="cmr-6">58</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101118r59"></a><span
- class="cmr-6">59</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-101120r60"></a><span
- class="cmr-6">60</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101122r61"></a><span
- class="cmr-6">61</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-101124r62"></a><span
- class="cmr-6">62</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101126r63"></a><span
- class="cmr-6">63</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span><span
- class="cmtt-8"> else</span><span
- class="cmtt-8"> [val]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> zero</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101128r64"></a><span
- class="cmr-6">64</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101130r65"></a><span
- class="cmr-6">65</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 27)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_step2_flag]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> unset</span>
- <br class="fancyvrb" /><a
- id="x1-101132r66"></a><span
- class="cmr-6">66</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 28)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_final_Y]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [predicted]</span>
- <br class="fancyvrb" /><a
- id="x1-101134r67"></a><span
- class="cmr-6">67</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101136r68"></a><span
- class="cmr-6">68</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-101138r69"></a><span
- class="cmr-6">69</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101140r70"></a><span
- class="cmr-6">70</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-101142r71"></a><span
- class="cmr-6">71</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101144r72"></a><span
- class="cmr-6">72</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 29)</span><span
- class="cmtt-8"> done</span>
- <br class="fancyvrb" /><a
- id="x1-101146r73"></a><span
- class="cmr-6">73</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- </div>
- </dd><dt class="description">
- <span
- class="cmssbx-10x-x-120">step 2: curve synthesis</span> </dt><dd
- class="description">
- <!--l. 336--><p class="noindent" >Curve synthesis generates a return vector <span
- class="cmtt-12">[floor] </span>of length <span
- class="cmtt-12">[n] </span>(where <span
- class="cmtt-12">[n] </span>is provided by
- the decode process calling to floor decode). Floor 1 curve synthesis makes use of the
- <span
- class="cmtt-12">[floor1_X_list]</span>, <span
- class="cmtt-12">[floor1_final_Y] </span>and <span
- class="cmtt-12">[floor1_step2_flag] </span>vectors, as well as
- [floor1˙multiplier] and [floor1˙values] values.
- <!--l. 343--><p class="noindent" >Decode begins by sorting the scalars from vectors <span
- class="cmtt-12">[floor1_X_list]</span>, <span
- class="cmtt-12">[floor1_final_Y] </span>and
-
-
- <span
- class="cmtt-12">[floor1_step2_flag] </span>together into new vectors <span
- class="cmtt-12">[floor1_X_list]’</span>, <span
- class="cmtt-12">[floor1_final_Y]’</span>
- and <span
- class="cmtt-12">[floor1_step2_flag]’ </span>according to ascending sort order of the values in
- <span
- class="cmtt-12">[floor1_X_list]</span>. That is, sort the values of <span
- class="cmtt-12">[floor1_X_list] </span>and then apply the same
- permutation to elements of the other two vectors so that the X, Y and step2˙flag values still
- match.
- <!--l. 353--><p class="noindent" >Then compute the final curve in one pass:
- <!--l. 355--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb32">
- <a
- id="x1-101148r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [hx]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-101150r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [lx]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-101152r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> [ly]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor1_final_Y]’</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [0]</span><span
- class="cmtt-8"> *</span><span
- class="cmtt-8"> [floor1_multiplier]</span>
- <br class="fancyvrb" /><a
- id="x1-101154r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [floor1_values]-1</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101156r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101158r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [floor1_step2_flag]’</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> set</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101160r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101162r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> [hy]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [floor1_final_Y]’</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> *</span><span
- class="cmtt-8"> [floor1_multiplier]</span>
- <br class="fancyvrb" /><a
- id="x1-101164r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8">  </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> [hx]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [floor1_X_list]’</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span>
- <br class="fancyvrb" /><a
- id="x1-101166r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 8)</span><span
- class="cmtt-8"> </span><a
- href="#x1-1230009.2.7"><span
- class="cmtt-8">render_line</span></a><span
- class="cmtt-8">(</span><span
- class="cmtt-8"> [lx],</span><span
- class="cmtt-8"> [ly],</span><span
- class="cmtt-8"> [hx],</span><span
- class="cmtt-8"> [hy],</span><span
- class="cmtt-8"> [floor]</span><span
- class="cmtt-8"> )</span>
- <br class="fancyvrb" /><a
- id="x1-101168r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 9)</span><span
- class="cmtt-8"> [lx]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [hx]</span>
- <br class="fancyvrb" /><a
- id="x1-101170r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8">  </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 10)</span><span
- class="cmtt-8"> [ly]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [hy]</span>
- <br class="fancyvrb" /><a
- id="x1-101172r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-101174r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-101176r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101178r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 11)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [hx]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> less</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> [n]</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101180r17"></a><span
- class="cmr-6">17</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101182r18"></a><span
- class="cmr-6">18</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 12)</span><span
- class="cmtt-8"> </span><a
- href="#x1-1230009.2.7"><span
- class="cmtt-8">render_line</span></a><span
- class="cmtt-8">(</span><span
- class="cmtt-8"> [hx],</span><span
- class="cmtt-8"> [hy],</span><span
- class="cmtt-8"> [n],</span><span
- class="cmtt-8"> [hy],</span><span
- class="cmtt-8"> [floor]</span><span
- class="cmtt-8"> )</span>
- <br class="fancyvrb" /><a
- id="x1-101184r19"></a><span
- class="cmr-6">19</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101186r20"></a><span
- class="cmr-6">20</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-101188r21"></a><span
- class="cmr-6">21</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101190r22"></a><span
- class="cmr-6">22</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 13)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [hx]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> greater</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> [n]</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">{</span>
- <br class="fancyvrb" /><a
- id="x1-101192r23"></a><span
- class="cmr-6">23</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101194r24"></a><span
- class="cmr-6">24</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 14)</span><span
- class="cmtt-8"> truncate</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor]</span><span
- class="cmtt-8"> to</span><span
- class="cmtt-8"> [n]</span><span
- class="cmtt-8"> elements</span>
- <br class="fancyvrb" /><a
- id="x1-101196r25"></a><span
- class="cmr-6">25</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101198r26"></a><span
- class="cmr-6">26</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmsy-8">}</span>
- <br class="fancyvrb" /><a
- id="x1-101200r27"></a><span
- class="cmr-6">27</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101202r28"></a><span
- class="cmr-6">28</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 15)</span><span
- class="cmtt-8"> for</span><span
- class="cmtt-8"> each</span><span
- class="cmtt-8"> scalar</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [floor],</span><span
- class="cmtt-8"> perform</span><span
- class="cmtt-8"> a</span><span
- class="cmtt-8"> lookup</span><span
- class="cmtt-8"> substitution</span><span
- class="cmtt-8"> using</span>
- <br class="fancyvrb" /><a
- id="x1-101204r29"></a><span
- class="cmr-6">29</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> scalar</span><span
- class="cmtt-8"> value</span><span
- class="cmtt-8"> from</span><span
- class="cmtt-8"> [floor]</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> an</span><span
- class="cmtt-8"> offset</span><span
- class="cmtt-8"> into</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> </span><a
- href="#x1-12500010.1"><span
- class="cmtt-8">[floor1_inverse_dB_static_table]</span></a>
- <br class="fancyvrb" /><a
- id="x1-101206r30"></a><span
- class="cmr-6">30</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-101208r31"></a><span
- class="cmr-6">31</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 16)</span><span
- class="cmtt-8"> done</span>
- <br class="fancyvrb" /><a
- id="x1-101210r32"></a><span
- class="cmr-6">32</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- </div>
- </dd></dl>
-
-
- <h3 class="sectionHead"><span class="titlemark">8 </span> <a
- id="x1-1020008"></a>Residue setup and decode</h3>
- <!--l. 6--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">8.1 </span> <a
- id="x1-1030008.1"></a>Overview</h4>
- <!--l. 8--><p class="noindent" >A residue vector represents the fine detail of the audio spectrum of one channel in an audio frame
- after the encoder subtracts the floor curve and performs any channel coupling. A residue vector
- may represent spectral lines, spectral magnitude, spectral phase or hybrids as mixed by channel
- coupling. The exact semantic content of the vector does not matter to the residue
- abstraction.
- <!--l. 15--><p class="noindent" >Whatever the exact qualities, the Vorbis residue abstraction codes the residue vectors into the
- bitstream packet, and then reconstructs the vectors during decode. Vorbis makes use of three
- different encoding variants (numbered 0, 1 and 2) of the same basic vector encoding
- abstraction.
- <!--l. 23--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">8.2 </span> <a
- id="x1-1040008.2"></a>Residue format</h4>
- <!--l. 25--><p class="noindent" >Residue format partitions each vector in the vector bundle into chunks, classifies each
- chunk, encodes the chunk classifications and finally encodes the chunks themselves
- using the the specific VQ arrangement defined for each selected classification. The
- exact interleaving and partitioning vary by residue encoding number, however the
- high-level process used to classify and encode the residue vector is the same in all three
- variants.
- <!--l. 33--><p class="noindent" >A set of coded residue vectors are all of the same length. High level coding structure, ignoring for
- the moment exactly how a partition is encoded and simply trusting that it is, is as
- follows:
- <ul class="itemize1">
- <li class="itemize">Each vector is partitioned into multiple equal sized chunks according to configuration
- specified. If we have a vector size of <span
- class="cmti-12">n</span>, a partition size <span
- class="cmti-12">residue˙partition˙size</span>, and
- a total of <span
- class="cmti-12">ch </span>residue vectors, the total number of partitioned chunks coded is
-
-
- <span
- class="cmti-12">n</span>/<span
- class="cmti-12">residue˙partition˙size</span>*<span
- class="cmti-12">ch</span>. It is important to note that the integer division truncates.
- In the below example, we assume an example <span
- class="cmti-12">residue˙partition˙size </span>of 8.
- </li>
- <li class="itemize">Each partition in each vector has a classification number that specifies which of
- multiple configured VQ codebook setups are used to decode that partition. The
- classification numbers of each partition can be thought of as forming a vector in
- their own right, as in the illustration below. Just as the residue vectors are coded
- in grouped partitions to increase encoding efficiency, the classification vector is also
- partitioned into chunks. The integer elements of each scalar in a classification chunk
- are built into a single scalar that represents the classification numbers in that chunk.
- In the below example, the classification codeword encodes two classification numbers.
- </li>
- <li class="itemize">The values in a residue vector may be encoded monolithically in a single pass through
- the residue vector, but more often efficient codebook design dictates that each vector
- is encoded as the additive sum of several passes through the residue vector using
- more than one VQ codebook. Thus, each residue value potentially accumulates values
- from multiple decode passes. The classification value associated with a partition is
- the same in each pass, thus the classification codeword is coded only in the first pass.
- </li></ul>
- <div class="center"
- >
- <!--l. 70--><p class="noindent" >
- <!--l. 71--><p class="noindent" ><img
- src="residue-pack.png" alt="PIC"
- >
- <br /> <table class="caption"
- ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 11: </td><td
- class="content">illustration of residue vector format</td></tr></table><!--tex4ht:label?: x1-10400111 -->
- </div>
- <!--l. 77--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">8.3 </span> <a
- id="x1-1050008.3"></a>residue 0</h4>
- <!--l. 79--><p class="noindent" >Residue 0 and 1 differ only in the way the values within a residue partition are interleaved during
- partition encoding (visually treated as a black box–or cyan box or brown box–in the above
- figure).
- <!--l. 83--><p class="noindent" >Residue encoding 0 interleaves VQ encoding according to the dimension of the codebook used to
-
-
- encode a partition in a specific pass. The dimension of the codebook need not be the same in
- multiple passes, however the partition size must be an even multiple of the codebook
- dimension.
- <!--l. 89--><p class="noindent" >As an example, assume a partition vector of size eight, to be encoded by residue 0 using
- codebook sizes of 8, 4, 2 and 1:
- <!--l. 92--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb33">
- <a
- id="x1-105002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-105004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> original</span><span
- class="cmtt-8"> residue</span><span
- class="cmtt-8"> vector:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-105006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-105008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> dimensions</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> encoded</span><span
- class="cmtt-8"> as:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-105010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-105012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> dimensions</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> encoded</span><span
- class="cmtt-8"> as:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-105014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-105016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> dimensions</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> encoded</span><span
- class="cmtt-8"> as:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-105018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-105020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> dimensions</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> encoded</span><span
- class="cmtt-8"> as:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-105022r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- </div>
- <!--l. 106--><p class="noindent" >It is worth mentioning at this point that no configurable value in the residue coding setup is
- restricted to a power of two.
- <!--l. 111--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">8.4 </span> <a
- id="x1-1060008.4"></a>residue 1</h4>
- <!--l. 113--><p class="noindent" >Residue 1 does not interleave VQ encoding. It represents partition vector scalars in order. As
- with residue 0, however, partition length must be an integer multiple of the codebook dimension,
- although dimension may vary from pass to pass.
- <!--l. 118--><p class="noindent" >As an example, assume a partition vector of size eight, to be encoded by residue 0 using
- codebook sizes of 8, 4, 2 and 1:
- <!--l. 121--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb34">
- <a
- id="x1-106002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-106004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> original</span><span
- class="cmtt-8"> residue</span><span
- class="cmtt-8"> vector:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-106006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-106008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> dimensions</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> encoded</span><span
- class="cmtt-8"> as:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-106010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-106012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> dimensions</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> encoded</span><span
- class="cmtt-8"> as:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-106014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-106016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> dimensions</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> encoded</span><span
- class="cmtt-8"> as:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-106018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-106020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> dimensions</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> encoded</span><span
- class="cmtt-8"> as:</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 1</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 4</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 5</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> ],</span><span
- class="cmtt-8"> [</span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> ]</span>
- <br class="fancyvrb" /><a
- id="x1-106022r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
-
-
- </div>
- <!--l. 137--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">8.5 </span> <a
- id="x1-1070008.5"></a>residue 2</h4>
- <!--l. 139--><p class="noindent" >Residue type two can be thought of as a variant of residue type 1. Rather than encoding multiple
- passed-in vectors as in residue type 1, the <span
- class="cmti-12">ch </span>passed in vectors of length <span
- class="cmti-12">n </span>are first interleaved
- and flattened into a single vector of length <span
- class="cmti-12">ch</span>*<span
- class="cmti-12">n</span>. Encoding then proceeds as in type 1. Decoding
- is as in type 1 with decode interleave reversed. If operating on a single vector to begin with,
- residue type 1 and type 2 are equivalent.
- <div class="center"
- >
- <!--l. 147--><p class="noindent" >
- <!--l. 148--><p class="noindent" ><img
- src="residue2.png" alt="PIC"
- >
- <br /> <table class="caption"
- ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 12: </td><td
- class="content">illustration of residue type 2</td></tr></table><!--tex4ht:label?: x1-10700112 -->
- </div>
- <!--l. 153--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">8.6 </span> <a
- id="x1-1080008.6"></a>Residue decode</h4>
- <!--l. 155--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">8.6.1 </span> <a
- id="x1-1090008.6.1"></a>header decode</h5>
- <!--l. 157--><p class="noindent" >Header decode for all three residue types is identical.
- <div class="fancyvrb" id="fancyvrb35">
- <a
- id="x1-109002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [residue_begin]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 24</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-109004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [residue_end]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 24</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-109006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> [residue_partition_size]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 24</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> and</span><span
- class="cmtt-8"> add</span><span
- class="cmtt-8"> one</span>
- <br class="fancyvrb" /><a
- id="x1-109008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> [residue_classifications]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 6</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> and</span><span
- class="cmtt-8"> add</span><span
- class="cmtt-8"> one</span>
-
-
- <br class="fancyvrb" /><a
- id="x1-109010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> [residue_classbook]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 8</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- </div>
- <!--l. 166--><p class="noindent" ><span
- class="cmtt-12">[residue_begin] </span>and <span
- class="cmtt-12">[residue_end] </span>select the specific sub-portion of each vector that is
- actually coded; it implements akin to a bandpass where, for coding purposes, the vector
- effectively begins at element <span
- class="cmtt-12">[residue_begin] </span>and ends at <span
- class="cmtt-12">[residue_end]</span>. Preceding and
- following values in the unpacked vectors are zeroed. Note that for residue type 2, these
- values as well as <span
- class="cmtt-12">[residue_partition_size]</span>apply to the interleaved vector, not the
- individual vectors before interleave. <span
- class="cmtt-12">[residue_partition_size] </span>is as explained above,
- <span
- class="cmtt-12">[residue_classifications] </span>is the number of possible classification to which a partition can
- belong and <span
- class="cmtt-12">[residue_classbook] </span>is the codebook number used to code classification
- codewords. The number of dimensions in book <span
- class="cmtt-12">[residue_classbook] </span>determines how
- many classification values are grouped into a single classification codeword. Note that
- the number of entries and dimensions in book <span
- class="cmtt-12">[residue_classbook]</span>, along with
- <span
- class="cmtt-12">[residue_classifications]</span>, overdetermines to possible number of classification
- codewords. If <span
- class="cmtt-12">[residue_classifications]</span>ˆ<span
- class="cmtt-12">[residue_classbook]</span>.dimensions exceeds
- <span
- class="cmtt-12">[residue_classbook]</span>.entries, the bitstream should be regarded to be undecodable.
- <!--l. 190--><p class="noindent" >Next we read a bitmap pattern that specifies which partition classes code values in which
- passes.
- <!--l. 193--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb36">
- <a
- id="x1-109012r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [residue_classifications]-1</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-109014r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-109016r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [high_bits]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-109018r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> [low_bits]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 3</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-109020r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> [bitflag]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> one</span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> boolean</span>
- <br class="fancyvrb" /><a
- id="x1-109022r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [bitflag]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> set</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> then</span><span
- class="cmtt-8"> [high_bits]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> five</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-109024r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [residue_cascade]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [high_bits]</span><span
- class="cmtt-8"> *</span><span
- class="cmtt-8"> 8</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [low_bits]</span>
- <br class="fancyvrb" /><a
- id="x1-109026r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-109028r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> done</span>
- </div>
- <!--l. 205--><p class="noindent" >Finally, we read in a list of book numbers, each corresponding to specific bit set in the cascade
- bitmap. We loop over the possible codebook classifications and the maximum possible number of
- encoding stages (8 in Vorbis I, as constrained by the elements of the cascade bitmap being eight
- bits):
- <!--l. 211--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb37">
- <a
- id="x1-109030r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [residue_classifications]-1</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-109032r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-109034r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [j]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-109036r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-109038r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [residue_cascade]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> [j]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> set</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-109040r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-109042r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> array</span><span
- class="cmtt-8"> [residue_books]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i][j]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> 8</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> as</span><span
- class="cmtt-8"> unsigned</span><span
- class="cmtt-8"> integer</span>
- <br class="fancyvrb" /><a
- id="x1-109044r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-109046r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span><span
- class="cmtt-8"> else</span><span
- class="cmtt-8"> {</span>
-
-
- <br class="fancyvrb" /><a
- id="x1-109048r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-109050r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> array</span><span
- class="cmtt-8"> [residue_books]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i][j]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> unused</span>
- <br class="fancyvrb" /><a
- id="x1-109052r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-109054r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-109056r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-109058r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-109060r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-109062r17"></a><span
- class="cmr-6">17</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> done</span>
- </div>
- <!--l. 231--><p class="noindent" >An end-of-packet condition at any point in header decode renders the stream undecodable. In
- addition, any codebook number greater than the maximum numbered codebook set up in this
- stream also renders the stream undecodable.
- <!--l. 238--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">8.6.2 </span> <a
- id="x1-1100008.6.2"></a>packet decode</h5>
- <!--l. 240--><p class="noindent" >Format 0 and 1 packet decode is identical except for specific partition interleave. Format 2 packet
- decode can be built out of the format 1 decode process. Thus we describe first the decode
- infrastructure identical to all three formats.
- <!--l. 245--><p class="noindent" >In addition to configuration information, the residue decode process is passed the number of
- vectors in the submap bundle and a vector of flags indicating if any of the vectors are not to be
- decoded. If the passed in number of vectors is 3 and vector number 1 is marked ’do not decode’,
- decode skips vector 1 during the decode loop. However, even ’do not decode’ vectors are
- allocated and zeroed.
- <!--l. 252--><p class="noindent" >Depending on the values of <span
- class="cmtt-12">[residue_begin] </span>and <span
- class="cmtt-12">[residue_end]</span>, it is obvious that the
- encoded portion of a residue vector may be the entire possible residue vector or some other strict
- subset of the actual residue vector size with zero padding at either uncoded end. However, it is
- also possible to set <span
- class="cmtt-12">[residue_begin] </span>and <span
- class="cmtt-12">[residue_end] </span>to specify a range partially or wholly
- beyond the maximum vector size. Before beginning residue decode, limit <span
- class="cmtt-12">[residue_begin]</span>
- and <span
- class="cmtt-12">[residue_end] </span>to the maximum possible vector size as follows. We assume that
- the number of vectors being encoded, <span
- class="cmtt-12">[ch] </span>is provided by the higher level decoding
- process.
- <!--l. 266--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb38">
- <a
- id="x1-110002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [actual_size]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> current</span><span
- class="cmtt-8"> blocksize/2;</span>
- <br class="fancyvrb" /><a
- id="x1-110004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> residue</span><span
- class="cmtt-8"> encoding</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> format</span><span
- class="cmtt-8"> 2</span>
- <br class="fancyvrb" /><a
- id="x1-110006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> [actual_size]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [actual_size]</span><span
- class="cmtt-8"> *</span><span
- class="cmtt-8"> [ch];</span>
- <br class="fancyvrb" /><a
- id="x1-110008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> [limit_residue_begin]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> maximum</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> ([residue_begin],[actual_size]);</span>
- <br class="fancyvrb" /><a
- id="x1-110010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> [limit_residue_end]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> maximum</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> ([residue_end],[actual_size]);</span>
- </div>
-
-
- <!--l. 274--><p class="noindent" >The following convenience values are conceptually useful to clarifying the decode process:
- <!--l. 277--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb39">
- <a
- id="x1-110012r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [classwords_per_codeword]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [codebook_dimensions]</span><span
- class="cmtt-8"> value</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> [residue_classbook]</span>
- <br class="fancyvrb" /><a
- id="x1-110014r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [n_to_read]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [limit_residue_end]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> [limit_residue_begin]</span>
- <br class="fancyvrb" /><a
- id="x1-110016r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> [partitions_to_read]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [n_to_read]</span><span
- class="cmtt-8"> /</span><span
- class="cmtt-8"> [residue_partition_size]</span>
- </div>
- <!--l. 283--><p class="noindent" >Packet decode proceeds as follows, matching the description offered earlier in the document.
- <div class="fancyvrb" id="fancyvrb40">
- <a
- id="x1-110018r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> allocate</span><span
- class="cmtt-8"> and</span><span
- class="cmtt-8"> zero</span><span
- class="cmtt-8"> all</span><span
- class="cmtt-8"> vectors</span><span
- class="cmtt-8"> that</span><span
- class="cmtt-8"> will</span><span
- class="cmtt-8"> be</span><span
- class="cmtt-8"> returned.</span>
- <br class="fancyvrb" /><a
- id="x1-110020r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> ([n_to_read]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> zero),</span><span
- class="cmtt-8"> stop;</span><span
- class="cmtt-8"> there</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> no</span><span
- class="cmtt-8"> residue</span><span
- class="cmtt-8"> to</span><span
- class="cmtt-8"> decode.</span>
- <br class="fancyvrb" /><a
- id="x1-110022r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [pass]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> 7</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-110024r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110026r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> [partition_count]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-110028r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110030r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> while</span><span
- class="cmtt-8"> [partition_count]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> less</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> [partitions_to_read]</span>
- <br class="fancyvrb" /><a
- id="x1-110032r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110034r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> ([pass]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> zero)</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-110036r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110038r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [j]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ..</span><span
- class="cmtt-8"> [ch]-1</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-110040r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110042r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 8)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [j]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> not</span><span
- class="cmtt-8"> marked</span><span
- class="cmtt-8"> ’do</span><span
- class="cmtt-8"> not</span><span
- class="cmtt-8"> decode’</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-110044r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110046r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 9)</span><span
- class="cmtt-8"> [temp]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> from</span><span
- class="cmtt-8"> packet</span><span
- class="cmtt-8"> using</span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> [residue_classbook]</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> scalar</span><span
- class="cmtt-8"> context</span>
- <br class="fancyvrb" /><a
- id="x1-110048r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 10)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> descending</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> [classwords_per_codeword]-1</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-110050r17"></a><span
- class="cmr-6">17</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110052r18"></a><span
- class="cmr-6">18</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 11)</span><span
- class="cmtt-8"> array</span><span
- class="cmtt-8"> [classifications]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [j],([i]+[partition_count])</span><span
- class="cmtt-8"> =</span>
- <br class="fancyvrb" /><a
- id="x1-110054r19"></a><span
- class="cmr-6">19</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [temp]</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> modulo</span><span
- class="cmtt-8"> [residue_classifications]</span>
- <br class="fancyvrb" /><a
- id="x1-110056r20"></a><span
- class="cmr-6">20</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 12)</span><span
- class="cmtt-8"> [temp]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [temp]</span><span
- class="cmtt-8"> /</span><span
- class="cmtt-8"> [residue_classifications]</span><span
- class="cmtt-8"> using</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> division</span>
- <br class="fancyvrb" /><a
- id="x1-110058r21"></a><span
- class="cmr-6">21</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110060r22"></a><span
- class="cmr-6">22</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-110062r23"></a><span
- class="cmr-6">23</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110064r24"></a><span
- class="cmr-6">24</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-110066r25"></a><span
- class="cmr-6">25</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110068r26"></a><span
- class="cmr-6">26</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-110070r27"></a><span
- class="cmr-6">27</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110072r28"></a><span
- class="cmr-6">28</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-110074r29"></a><span
- class="cmr-6">29</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110076r30"></a><span
- class="cmr-6">30</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 13)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ..</span><span
- class="cmtt-8"> ([classwords_per_codeword]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> while</span><span
- class="cmtt-8"> [partition_count]</span>
- <br class="fancyvrb" /><a
- id="x1-110078r31"></a><span
- class="cmr-6">31</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> also</span><span
- class="cmtt-8"> less</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> [partitions_to_read]</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-110080r32"></a><span
- class="cmr-6">32</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110082r33"></a><span
- class="cmr-6">33</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 14)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [j]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ..</span><span
- class="cmtt-8"> [ch]-1</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-110084r34"></a><span
- class="cmr-6">34</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110086r35"></a><span
- class="cmr-6">35</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 15)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [j]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> not</span><span
- class="cmtt-8"> marked</span><span
- class="cmtt-8"> ’do</span><span
- class="cmtt-8"> not</span><span
- class="cmtt-8"> decode’</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-110088r36"></a><span
- class="cmr-6">36</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110090r37"></a><span
- class="cmr-6">37</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 16)</span><span
- class="cmtt-8"> [vqclass]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> array</span><span
- class="cmtt-8"> [classifications]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [j],[partition_count]</span>
- <br class="fancyvrb" /><a
- id="x1-110092r38"></a><span
- class="cmr-6">38</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 17)</span><span
- class="cmtt-8"> [vqbook]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> array</span><span
- class="cmtt-8"> [residue_books]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [vqclass],[pass]</span>
- <br class="fancyvrb" /><a
- id="x1-110094r39"></a><span
- class="cmr-6">39</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 18)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> ([vqbook]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> not</span><span
- class="cmtt-8"> ’unused’)</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-110096r40"></a><span
- class="cmr-6">40</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110098r41"></a><span
- class="cmr-6">41</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 19)</span><span
- class="cmtt-8"> decode</span><span
- class="cmtt-8"> partition</span><span
- class="cmtt-8"> into</span><span
- class="cmtt-8"> output</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> number</span><span
- class="cmtt-8"> [j],</span><span
- class="cmtt-8"> starting</span><span
- class="cmtt-8"> at</span><span
- class="cmtt-8"> scalar</span>
- <br class="fancyvrb" /><a
- id="x1-110100r42"></a><span
- class="cmr-6">42</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> offset</span><span
- class="cmtt-8"> [limit_residue_begin]+[partition_count]*[residue_partition_size]</span><span
- class="cmtt-8"> using</span>
- <br class="fancyvrb" /><a
- id="x1-110102r43"></a><span
- class="cmr-6">43</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> number</span><span
- class="cmtt-8"> [vqbook]</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> VQ</span><span
- class="cmtt-8"> context</span>
- <br class="fancyvrb" /><a
- id="x1-110104r44"></a><span
- class="cmr-6">44</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-110106r45"></a><span
- class="cmr-6">45</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-110108r46"></a><span
- class="cmr-6">46</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110110r47"></a><span
- class="cmr-6">47</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 20)</span><span
- class="cmtt-8"> increment</span><span
- class="cmtt-8"> [partition_count]</span><span
- class="cmtt-8"> by</span><span
- class="cmtt-8"> one</span>
- <br class="fancyvrb" /><a
- id="x1-110112r48"></a><span
- class="cmr-6">48</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110114r49"></a><span
- class="cmr-6">49</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
-
-
- <br class="fancyvrb" /><a
- id="x1-110116r50"></a><span
- class="cmr-6">50</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-110118r51"></a><span
- class="cmr-6">51</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-110120r52"></a><span
- class="cmr-6">52</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-110122r53"></a><span
- class="cmr-6">53</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 21)</span><span
- class="cmtt-8"> done</span>
- <br class="fancyvrb" /><a
- id="x1-110124r54"></a><span
- class="cmr-6">54</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- </div>
- <!--l. 341--><p class="noindent" >An end-of-packet condition during packet decode is to be considered a nominal occurrence.
- Decode returns the result of vector decode up to that point.
- <!--l. 347--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">8.6.3 </span> <a
- id="x1-1110008.6.3"></a>format 0 specifics</h5>
- <!--l. 349--><p class="noindent" >Format zero decodes partitions exactly as described earlier in the ’Residue Format: residue 0’
- section. The following pseudocode presents the same algorithm. Assume:
- <ul class="itemize1">
- <li class="itemize"><span
- class="cmtt-12">[n] </span>is the value in <span
- class="cmtt-12">[residue_partition_size]</span>
- </li>
- <li class="itemize"><span
- class="cmtt-12">[v] </span>is the residue vector
- </li>
- <li class="itemize"><span
- class="cmtt-12">[offset] </span>is the beginning read offset in [v]</li></ul>
- <!--l. 360--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb41">
- <a
- id="x1-111002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [step]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [n]</span><span
- class="cmtt-8"> /</span><span
- class="cmtt-8"> [codebook_dimensions]</span>
- <br class="fancyvrb" /><a
- id="x1-111004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [step]-1</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-111006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-111008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [entry_temp]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> from</span><span
- class="cmtt-8"> packet</span><span
- class="cmtt-8"> using</span><span
- class="cmtt-8"> current</span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> VQ</span><span
- class="cmtt-8"> context</span>
- <br class="fancyvrb" /><a
- id="x1-111010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [j]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [codebook_dimensions]-1</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-111012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-111014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [v]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> ([offset]+[i]+[j]*[step])</span><span
- class="cmtt-8"> =</span>
- <br class="fancyvrb" /><a
- id="x1-111016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8">  </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [v]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> ([offset]+[i]+[j]*[step])</span><span
- class="cmtt-8"> +</span>
- <br class="fancyvrb" /><a
- id="x1-111018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [entry_temp]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [j]</span>
- <br class="fancyvrb" /><a
- id="x1-111020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-111022r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-111024r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-111026r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-111028r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-111030r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> done</span>
- <br class="fancyvrb" /><a
- id="x1-111032r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- </div>
-
-
- <!--l. 381--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">8.6.4 </span> <a
- id="x1-1120008.6.4"></a>format 1 specifics</h5>
- <!--l. 383--><p class="noindent" >Format 1 decodes partitions exactly as described earlier in the ’Residue Format: residue 1’
- section. The following pseudocode presents the same algorithm. Assume:
- <ul class="itemize1">
- <li class="itemize"><span
- class="cmtt-12">[n] </span>is the value in <span
- class="cmtt-12">[residue_partition_size]</span>
- </li>
- <li class="itemize"><span
- class="cmtt-12">[v] </span>is the residue vector
- </li>
- <li class="itemize"><span
- class="cmtt-12">[offset] </span>is the beginning read offset in [v]</li></ul>
- <!--l. 395--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb42">
- <a
- id="x1-112002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-112004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [entry_temp]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> read</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> from</span><span
- class="cmtt-8"> packet</span><span
- class="cmtt-8"> using</span><span
- class="cmtt-8"> current</span><span
- class="cmtt-8"> codebook</span><span
- class="cmtt-8"> in</span><span
- class="cmtt-8"> VQ</span><span
- class="cmtt-8"> context</span>
- <br class="fancyvrb" /><a
- id="x1-112006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [j]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [codebook_dimensions]-1</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-112008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-112010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [v]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> ([offset]+[i])</span><span
- class="cmtt-8"> =</span>
- <br class="fancyvrb" /><a
- id="x1-112012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8">  </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [v]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> ([offset]+[i])</span><span
- class="cmtt-8"> +</span>
- <br class="fancyvrb" /><a
- id="x1-112014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [entry_temp]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [j]</span>
- <br class="fancyvrb" /><a
- id="x1-112016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> increment</span><span
- class="cmtt-8"> [i]</span>
- <br class="fancyvrb" /><a
- id="x1-112018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-112020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-112022r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-112024r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> less</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> [n]</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> continue</span><span
- class="cmtt-8"> at</span><span
- class="cmtt-8"> step</span><span
- class="cmtt-8"> 2</span>
- <br class="fancyvrb" /><a
- id="x1-112026r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> done</span>
- </div>
- <!--l. 413--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">8.6.5 </span> <a
- id="x1-1130008.6.5"></a>format 2 specifics</h5>
- <!--l. 415--><p class="noindent" >Format 2 is reducible to format 1. It may be implemented as an additional step prior to and an
- additional post-decode step after a normal format 1 decode.
- <!--l. 418--><p class="noindent" >Format 2 handles ’do not decode’ vectors differently than residue 0 or 1; if all vectors are marked
- ’do not decode’, no decode occurrs. However, if at least one vector is to be decoded, all
- the vectors are decoded. We then request normal format 1 to decode a single vector
- representing all output channels, rather than a vector for each channel. After decode,
- deinterleave the vector into independent vectors, one for each output channel. That
-
-
- is:
- <!--l. 425--><p class="noindent" >
- <ol class="enumerate1" >
- <li
- class="enumerate" id="x1-113002x1">If all vectors 0 through <span
- class="cmti-12">ch</span>-1 are marked ’do not decode’, allocate and clear a single
- vector <span
- class="cmtt-12">[v]</span>of length <span
- class="cmti-12">ch*n </span>and skip step 2 below; proceed directly to the post-decode
- step.
- </li>
- <li
- class="enumerate" id="x1-113004x2">Rather than performing format 1 decode to produce <span
- class="cmti-12">ch </span>vectors of length <span
- class="cmti-12">n </span>each, call
- format 1 decode to produce a single vector <span
- class="cmtt-12">[v] </span>of length <span
- class="cmti-12">ch*n</span>.
- </li>
- <li
- class="enumerate" id="x1-113006x3">Post decode: Deinterleave the single vector <span
- class="cmtt-12">[v] </span>returned by format 1 decode as
- described above into <span
- class="cmti-12">ch </span>independent vectors, one for each outputchannel, according
- to:
- <div class="fancyvrb" id="fancyvrb43">
- <a
- id="x1-113008r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [n]-1</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-113010r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-113012r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [j]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [ch]-1</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-113014r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-113016r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> output</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> number</span><span
- class="cmtt-8"> [j]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [i]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [v]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> ([i]</span><span
- class="cmtt-8"> *</span><span
- class="cmtt-8"> [ch]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [j])</span>
- <br class="fancyvrb" /><a
- id="x1-113018r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-113020r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-113022r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-113024r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-113026r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> done</span>
- </div>
- </li></ol>
-
-
-
-
- <h3 class="sectionHead"><span class="titlemark">9 </span> <a
- id="x1-1140009"></a>Helper equations</h3>
- <!--l. 6--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">9.1 </span> <a
- id="x1-1150009.1"></a>Overview</h4>
- <!--l. 8--><p class="noindent" >The equations below are used in multiple places by the Vorbis codec specification. Rather than
- cluttering up the main specification documents, they are defined here and referenced where
- appropriate.
- <!--l. 13--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">9.2 </span> <a
- id="x1-1160009.2"></a>Functions</h4>
- <!--l. 15--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">9.2.1 </span> <a
- id="x1-1170009.2.1"></a>ilog</h5>
- <!--l. 17--><p class="noindent" >The ”ilog(x)” function returns the position number (1 through n) of the highest set bit in the
- two’s complement integer value <span
- class="cmtt-12">[x]</span>. Values of <span
- class="cmtt-12">[x] </span>less than zero are defined to return
- zero.
- <!--l. 20--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb44">
- <a
- id="x1-117002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [return_value]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 0;</span>
- <br class="fancyvrb" /><a
- id="x1-117004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [x]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> greater</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> zero</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-117006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-117008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> increment</span><span
- class="cmtt-8"> [return_value];</span>
- <br class="fancyvrb" /><a
- id="x1-117010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> logical</span><span
- class="cmtt-8"> shift</span><span
- class="cmtt-8"> [x]</span><span
- class="cmtt-8"> one</span><span
- class="cmtt-8"> bit</span><span
- class="cmtt-8"> to</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> right,</span><span
- class="cmtt-8"> padding</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> MSb</span><span
- class="cmtt-8"> with</span><span
- class="cmtt-8"> zero</span>
- <br class="fancyvrb" /><a
- id="x1-117012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> repeat</span><span
- class="cmtt-8"> at</span><span
- class="cmtt-8"> step</span><span
- class="cmtt-8"> 2)</span>
- <br class="fancyvrb" /><a
- id="x1-117014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-117016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-117018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-117020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> done</span>
- </div>
-
-
- <!--l. 33--><p class="noindent" >Examples:
- <ul class="itemize1">
- <li class="itemize">ilog(0) = 0;
- </li>
- <li class="itemize">ilog(1) = 1;
- </li>
- <li class="itemize">ilog(2) = 2;
- </li>
- <li class="itemize">ilog(3) = 2;
- </li>
- <li class="itemize">ilog(4) = 3;
- </li>
- <li class="itemize">ilog(7) = 3;
- </li>
- <li class="itemize">ilog(negative number) = 0;</li></ul>
- <!--l. 48--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">9.2.2 </span> <a
- id="x1-1180009.2.2"></a>float32˙unpack</h5>
- <!--l. 50--><p class="noindent" >”float32˙unpack(x)” is intended to translate the packed binary representation of a Vorbis
- codebook float value into the representation used by the decoder for floating point numbers. For
- purposes of this example, we will unpack a Vorbis float32 into a host-native floating point
- number.
- <!--l. 56--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb45">
- <a
- id="x1-118002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> [mantissa]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [x]</span><span
- class="cmtt-8"> bitwise</span><span
- class="cmtt-8"> AND</span><span
- class="cmtt-8"> 0x1fffff</span><span
- class="cmtt-8"> (unsigned</span><span
- class="cmtt-8"> result)</span>
- <br class="fancyvrb" /><a
- id="x1-118004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [sign]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [x]</span><span
- class="cmtt-8"> bitwise</span><span
- class="cmtt-8"> AND</span><span
- class="cmtt-8"> 0x80000000</span><span
- class="cmtt-8"> (unsigned</span><span
- class="cmtt-8"> result)</span>
- <br class="fancyvrb" /><a
- id="x1-118006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> [exponent]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [x]</span><span
- class="cmtt-8"> bitwise</span><span
- class="cmtt-8"> AND</span><span
- class="cmtt-8"> 0x7fe00000)</span><span
- class="cmtt-8"> shifted</span><span
- class="cmtt-8"> right</span><span
- class="cmtt-8"> 21</span><span
- class="cmtt-8"> bits</span><span
- class="cmtt-8"> (unsigned</span><span
- class="cmtt-8"> result)</span>
- <br class="fancyvrb" /><a
- id="x1-118008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [sign]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> nonzero</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> then</span><span
- class="cmtt-8"> negate</span><span
- class="cmtt-8"> [mantissa]</span>
- <br class="fancyvrb" /><a
- id="x1-118010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> return</span><span
- class="cmtt-8"> [mantissa]</span><span
- class="cmtt-8"> *</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> 2</span><span
- class="cmtt-8"> ^</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [exponent]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> 788</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> )</span>
- </div>
-
-
- <!--l. 66--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">9.2.3 </span> <a
- id="x1-1190009.2.3"></a>lookup1˙values</h5>
- <!--l. 68--><p class="noindent" >”lookup1˙values(codebook˙entries,codebook˙dimensions)” is used to compute the correct length of
- the value index for a codebook VQ lookup table of lookup type 1. The values on this list are
- permuted to construct the VQ vector lookup table of size <span
- class="cmtt-12">[codebook_entries]</span>.
- <!--l. 74--><p class="noindent" >The return value for this function is defined to be ’the greatest integer value for which
- <span
- class="cmtt-12">[return_value] </span>to the power of <span
- class="cmtt-12">[codebook_dimensions] </span>is less than or equal to
- <span
- class="cmtt-12">[codebook_entries]</span>’.
- <!--l. 81--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">9.2.4 </span> <a
- id="x1-1200009.2.4"></a>low˙neighbor</h5>
- <!--l. 83--><p class="noindent" >”low˙neighbor(v,x)” finds the position <span
- class="cmtt-12">n </span>in vector <span
- class="cmtt-12">[v] </span>of the greatest value scalar element for
- which <span
- class="cmtt-12">n </span>is less than <span
- class="cmtt-12">[x] </span>and vector <span
- class="cmtt-12">[v] </span>element <span
- class="cmtt-12">n </span>is less than vector <span
- class="cmtt-12">[v] </span>element
- <span
- class="cmtt-12">[x]</span>.
- <!--l. 88--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">9.2.5 </span> <a
- id="x1-1210009.2.5"></a>high˙neighbor</h5>
- <!--l. 90--><p class="noindent" >”high˙neighbor(v,x)” finds the position <span
- class="cmtt-12">n </span>in vector [v] of the lowest value scalar element for
- which <span
- class="cmtt-12">n </span>is less than <span
- class="cmtt-12">[x] </span>and vector <span
- class="cmtt-12">[v] </span>element <span
- class="cmtt-12">n </span>is greater than vector <span
- class="cmtt-12">[v] </span>element
- <span
- class="cmtt-12">[x]</span>.
- <!--l. 97--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">9.2.6 </span> <a
- id="x1-1220009.2.6"></a>render˙point</h5>
- <!--l. 99--><p class="noindent" >”render˙point(x0,y0,x1,y1,X)” is used to find the Y value at point X along the line specified by
- x0, x1, y0 and y1. This function uses an integer algorithm to solve for the point directly without
- calculating intervening values along the line.
- <!--l. 104--><p class="noindent" >
-
-
- <div class="fancyvrb" id="fancyvrb46">
- <a
- id="x1-122002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [dy]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [y1]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> [y0]</span>
- <br class="fancyvrb" /><a
- id="x1-122004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> [adx]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [x1]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> [x0]</span>
- <br class="fancyvrb" /><a
- id="x1-122006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> [ady]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> absolute</span><span
- class="cmtt-8"> value</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> [dy]</span>
- <br class="fancyvrb" /><a
- id="x1-122008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> [err]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [ady]</span><span
- class="cmtt-8"> *</span><span
- class="cmtt-8"> ([X]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> [x0])</span>
- <br class="fancyvrb" /><a
- id="x1-122010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> [off]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [err]</span><span
- class="cmtt-8"> /</span><span
- class="cmtt-8"> [adx]</span><span
- class="cmtt-8"> using</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> division</span>
- <br class="fancyvrb" /><a
- id="x1-122012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [dy]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> less</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> zero</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-122014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-122016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> [Y]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [y0]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> [off]</span>
- <br class="fancyvrb" /><a
- id="x1-122018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-122020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span><span
- class="cmtt-8"> else</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-122022r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-122024r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 8)</span><span
- class="cmtt-8"> [Y]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [y0]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [off]</span>
- <br class="fancyvrb" /><a
- id="x1-122026r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-122028r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-122030r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-122032r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 9)</span><span
- class="cmtt-8"> done</span>
- </div>
- <!--l. 125--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">9.2.7 </span> <a
- id="x1-1230009.2.7"></a>render˙line</h5>
- <!--l. 127--><p class="noindent" >Floor decode type one uses the integer line drawing algorithm of ”render˙line(x0, y0, x1, y1, v)”
- to construct an integer floor curve for contiguous piecewise line segments. Note that it has not
- been relevant elsewhere, but here we must define integer division as rounding division of both
- positive and negative numbers toward zero.
- <!--l. 134--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb47">
- <a
- id="x1-123002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1)</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [dy]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [y1]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> [y0]</span>
- <br class="fancyvrb" /><a
- id="x1-123004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2)</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [adx]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [x1]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> [x0]</span>
- <br class="fancyvrb" /><a
- id="x1-123006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3)</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [ady]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> absolute</span><span
- class="cmtt-8"> value</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> [dy]</span>
- <br class="fancyvrb" /><a
- id="x1-123008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4)</span><span
- class="cmtt-8"> [base]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [dy]</span><span
- class="cmtt-8"> /</span><span
- class="cmtt-8"> [adx]</span><span
- class="cmtt-8"> using</span><span
- class="cmtt-8"> integer</span><span
- class="cmtt-8"> division</span>
- <br class="fancyvrb" /><a
- id="x1-123010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5)</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [x]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [x0]</span>
- <br class="fancyvrb" /><a
- id="x1-123012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6)</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [y]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [y0]</span>
- <br class="fancyvrb" /><a
- id="x1-123014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7)</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [err]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> 0</span>
- <br class="fancyvrb" /><a
- id="x1-123016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 8)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [dy]</span><span
- class="cmtt-8"> is</span><span
- class="cmtt-8"> less</span><span
- class="cmtt-8"> than</span><span
- class="cmtt-8"> 0</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-123020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123022r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 9)</span><span
- class="cmtt-8"> [sy]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [base]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> 1</span>
- <br class="fancyvrb" /><a
- id="x1-123024r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123026r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span><span
- class="cmtt-8"> else</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-123028r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123030r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 10)</span><span
- class="cmtt-8"> [sy]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [base]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> 1</span>
- <br class="fancyvrb" /><a
- id="x1-123032r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123034r17"></a><span
- class="cmr-6">17</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-123036r18"></a><span
- class="cmr-6">18</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123038r19"></a><span
- class="cmr-6">19</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 11)</span><span
- class="cmtt-8"> [ady]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [ady]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> (absolute</span><span
- class="cmtt-8"> value</span><span
- class="cmtt-8"> of</span><span
- class="cmtt-8"> [base])</span><span
- class="cmtt-8"> *</span><span
- class="cmtt-8"> [adx]</span>
- <br class="fancyvrb" /><a
- id="x1-123040r20"></a><span
- class="cmr-6">20</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 12)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [v]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [x]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [y]</span>
- <br class="fancyvrb" /><a
- id="x1-123042r21"></a><span
- class="cmr-6">21</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123044r22"></a><span
- class="cmr-6">22</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 13)</span><span
- class="cmtt-8"> iterate</span><span
- class="cmtt-8"> [x]</span><span
- class="cmtt-8"> over</span><span
- class="cmtt-8"> the</span><span
- class="cmtt-8"> range</span><span
- class="cmtt-8"> [x0]+1</span><span
- class="cmtt-8"> ...</span><span
- class="cmtt-8"> [x1]-1</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-123046r23"></a><span
- class="cmr-6">23</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123048r24"></a><span
- class="cmr-6">24</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 14)</span><span
- class="cmtt-8"> [err]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [err]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [ady];</span>
-
-
- <br class="fancyvrb" /><a
- id="x1-123050r25"></a><span
- class="cmr-6">25</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 15)</span><span
- class="cmtt-8"> if</span><span
- class="cmtt-8"> (</span><span
- class="cmtt-8"> [err]</span><span
- class="cmtt-8"> >=</span><span
- class="cmtt-8"> [adx]</span><span
- class="cmtt-8"> )</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-123052r26"></a><span
- class="cmr-6">26</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123054r27"></a><span
- class="cmr-6">27</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 16)</span><span
- class="cmtt-8"> [err]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [err]</span><span
- class="cmtt-8"> -</span><span
- class="cmtt-8"> [adx]</span>
- <br class="fancyvrb" /><a
- id="x1-123056r28"></a><span
- class="cmr-6">28</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 17)</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> [y]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [y]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [sy]</span>
- <br class="fancyvrb" /><a
- id="x1-123058r29"></a><span
- class="cmr-6">29</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123060r30"></a><span
- class="cmr-6">30</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span><span
- class="cmtt-8"> else</span><span
- class="cmtt-8"> {</span>
- <br class="fancyvrb" /><a
- id="x1-123062r31"></a><span
- class="cmr-6">31</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123064r32"></a><span
- class="cmr-6">32</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 18)</span><span
- class="cmtt-8"> [y]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [y]</span><span
- class="cmtt-8"> +</span><span
- class="cmtt-8"> [base]</span>
- <br class="fancyvrb" /><a
- id="x1-123066r33"></a><span
- class="cmr-6">33</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123068r34"></a><span
- class="cmr-6">34</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- <br class="fancyvrb" /><a
- id="x1-123070r35"></a><span
- class="cmr-6">35</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123072r36"></a><span
- class="cmr-6">36</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 19)</span><span
- class="cmtt-8"> vector</span><span
- class="cmtt-8"> [v]</span><span
- class="cmtt-8"> element</span><span
- class="cmtt-8"> [x]</span><span
- class="cmtt-8"> =</span><span
- class="cmtt-8"> [y]</span>
- <br class="fancyvrb" /><a
- id="x1-123074r37"></a><span
- class="cmr-6">37</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span>
- <br class="fancyvrb" /><a
- id="x1-123076r38"></a><span
- class="cmr-6">38</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> }</span>
- </div>
-
-
-
-
- <h3 class="sectionHead"><span class="titlemark">10 </span> <a
- id="x1-12400010"></a>Tables</h3>
- <!--l. 6--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">10.1 </span> <a
- id="x1-12500010.1"></a>floor1_inverse_dB_table</h4>
- <!--l. 8--><p class="noindent" >The vector <span
- class="cmtt-12">[floor1_inverse_dB_table] </span>is a 256 element static lookup table consiting of the
- following values (read left to right then top to bottom):
- <!--l. 12--><p class="noindent" >
- <div class="fancyvrb" id="fancyvrb48">
- <a
- id="x1-125002r1"></a><span
- class="cmr-6">1</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1.0649863e-07,</span><span
- class="cmtt-8"> 1.1341951e-07,</span><span
- class="cmtt-8"> 1.2079015e-07,</span><span
- class="cmtt-8"> 1.2863978e-07,</span>
- <br class="fancyvrb" /><a
- id="x1-125004r2"></a><span
- class="cmr-6">2</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1.3699951e-07,</span><span
- class="cmtt-8"> 1.4590251e-07,</span><span
- class="cmtt-8"> 1.5538408e-07,</span><span
- class="cmtt-8"> 1.6548181e-07,</span>
- <br class="fancyvrb" /><a
- id="x1-125006r3"></a><span
- class="cmr-6">3</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1.7623575e-07,</span><span
- class="cmtt-8"> 1.8768855e-07,</span><span
- class="cmtt-8"> 1.9988561e-07,</span><span
- class="cmtt-8"> 2.1287530e-07,</span>
- <br class="fancyvrb" /><a
- id="x1-125008r4"></a><span
- class="cmr-6">4</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2.2670913e-07,</span><span
- class="cmtt-8"> 2.4144197e-07,</span><span
- class="cmtt-8"> 2.5713223e-07,</span><span
- class="cmtt-8"> 2.7384213e-07,</span>
- <br class="fancyvrb" /><a
- id="x1-125010r5"></a><span
- class="cmr-6">5</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2.9163793e-07,</span><span
- class="cmtt-8"> 3.1059021e-07,</span><span
- class="cmtt-8"> 3.3077411e-07,</span><span
- class="cmtt-8"> 3.5226968e-07,</span>
- <br class="fancyvrb" /><a
- id="x1-125012r6"></a><span
- class="cmr-6">6</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3.7516214e-07,</span><span
- class="cmtt-8"> 3.9954229e-07,</span><span
- class="cmtt-8"> 4.2550680e-07,</span><span
- class="cmtt-8"> 4.5315863e-07,</span>
- <br class="fancyvrb" /><a
- id="x1-125014r7"></a><span
- class="cmr-6">7</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4.8260743e-07,</span><span
- class="cmtt-8"> 5.1396998e-07,</span><span
- class="cmtt-8"> 5.4737065e-07,</span><span
- class="cmtt-8"> 5.8294187e-07,</span>
- <br class="fancyvrb" /><a
- id="x1-125016r8"></a><span
- class="cmr-6">8</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 6.2082472e-07,</span><span
- class="cmtt-8"> 6.6116941e-07,</span><span
- class="cmtt-8"> 7.0413592e-07,</span><span
- class="cmtt-8"> 7.4989464e-07,</span>
- <br class="fancyvrb" /><a
- id="x1-125018r9"></a><span
- class="cmr-6">9</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7.9862701e-07,</span><span
- class="cmtt-8"> 8.5052630e-07,</span><span
- class="cmtt-8"> 9.0579828e-07,</span><span
- class="cmtt-8"> 9.6466216e-07,</span>
- <br class="fancyvrb" /><a
- id="x1-125020r10"></a><span
- class="cmr-6">10</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1.0273513e-06,</span><span
- class="cmtt-8"> 1.0941144e-06,</span><span
- class="cmtt-8"> 1.1652161e-06,</span><span
- class="cmtt-8"> 1.2409384e-06,</span>
- <br class="fancyvrb" /><a
- id="x1-125022r11"></a><span
- class="cmr-6">11</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1.3215816e-06,</span><span
- class="cmtt-8"> 1.4074654e-06,</span><span
- class="cmtt-8"> 1.4989305e-06,</span><span
- class="cmtt-8"> 1.5963394e-06,</span>
- <br class="fancyvrb" /><a
- id="x1-125024r12"></a><span
- class="cmr-6">12</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1.7000785e-06,</span><span
- class="cmtt-8"> 1.8105592e-06,</span><span
- class="cmtt-8"> 1.9282195e-06,</span><span
- class="cmtt-8"> 2.0535261e-06,</span>
- <br class="fancyvrb" /><a
- id="x1-125026r13"></a><span
- class="cmr-6">13</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2.1869758e-06,</span><span
- class="cmtt-8"> 2.3290978e-06,</span><span
- class="cmtt-8"> 2.4804557e-06,</span><span
- class="cmtt-8"> 2.6416497e-06,</span>
- <br class="fancyvrb" /><a
- id="x1-125028r14"></a><span
- class="cmr-6">14</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2.8133190e-06,</span><span
- class="cmtt-8"> 2.9961443e-06,</span><span
- class="cmtt-8"> 3.1908506e-06,</span><span
- class="cmtt-8"> 3.3982101e-06,</span>
- <br class="fancyvrb" /><a
- id="x1-125030r15"></a><span
- class="cmr-6">15</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3.6190449e-06,</span><span
- class="cmtt-8"> 3.8542308e-06,</span><span
- class="cmtt-8"> 4.1047004e-06,</span><span
- class="cmtt-8"> 4.3714470e-06,</span>
- <br class="fancyvrb" /><a
- id="x1-125032r16"></a><span
- class="cmr-6">16</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4.6555282e-06,</span><span
- class="cmtt-8"> 4.9580707e-06,</span><span
- class="cmtt-8"> 5.2802740e-06,</span><span
- class="cmtt-8"> 5.6234160e-06,</span>
- <br class="fancyvrb" /><a
- id="x1-125034r17"></a><span
- class="cmr-6">17</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5.9888572e-06,</span><span
- class="cmtt-8"> 6.3780469e-06,</span><span
- class="cmtt-8"> 6.7925283e-06,</span><span
- class="cmtt-8"> 7.2339451e-06,</span>
- <br class="fancyvrb" /><a
- id="x1-125036r18"></a><span
- class="cmr-6">18</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7.7040476e-06,</span><span
- class="cmtt-8"> 8.2047000e-06,</span><span
- class="cmtt-8"> 8.7378876e-06,</span><span
- class="cmtt-8"> 9.3057248e-06,</span>
- <br class="fancyvrb" /><a
- id="x1-125038r19"></a><span
- class="cmr-6">19</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 9.9104632e-06,</span><span
- class="cmtt-8"> 1.0554501e-05,</span><span
- class="cmtt-8"> 1.1240392e-05,</span><span
- class="cmtt-8"> 1.1970856e-05,</span>
- <br class="fancyvrb" /><a
- id="x1-125040r20"></a><span
- class="cmr-6">20</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1.2748789e-05,</span><span
- class="cmtt-8"> 1.3577278e-05,</span><span
- class="cmtt-8"> 1.4459606e-05,</span><span
- class="cmtt-8"> 1.5399272e-05,</span>
- <br class="fancyvrb" /><a
- id="x1-125042r21"></a><span
- class="cmr-6">21</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1.6400004e-05,</span><span
- class="cmtt-8"> 1.7465768e-05,</span><span
- class="cmtt-8"> 1.8600792e-05,</span><span
- class="cmtt-8"> 1.9809576e-05,</span>
- <br class="fancyvrb" /><a
- id="x1-125044r22"></a><span
- class="cmr-6">22</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2.1096914e-05,</span><span
- class="cmtt-8"> 2.2467911e-05,</span><span
- class="cmtt-8"> 2.3928002e-05,</span><span
- class="cmtt-8"> 2.5482978e-05,</span>
- <br class="fancyvrb" /><a
- id="x1-125046r23"></a><span
- class="cmr-6">23</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 2.7139006e-05,</span><span
- class="cmtt-8"> 2.8902651e-05,</span><span
- class="cmtt-8"> 3.0780908e-05,</span><span
- class="cmtt-8"> 3.2781225e-05,</span>
- <br class="fancyvrb" /><a
- id="x1-125048r24"></a><span
- class="cmr-6">24</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 3.4911534e-05,</span><span
- class="cmtt-8"> 3.7180282e-05,</span><span
- class="cmtt-8"> 3.9596466e-05,</span><span
- class="cmtt-8"> 4.2169667e-05,</span>
- <br class="fancyvrb" /><a
- id="x1-125050r25"></a><span
- class="cmr-6">25</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 4.4910090e-05,</span><span
- class="cmtt-8"> 4.7828601e-05,</span><span
- class="cmtt-8"> 5.0936773e-05,</span><span
- class="cmtt-8"> 5.4246931e-05,</span>
- <br class="fancyvrb" /><a
- id="x1-125052r26"></a><span
- class="cmr-6">26</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 5.7772202e-05,</span><span
- class="cmtt-8"> 6.1526565e-05,</span><span
- class="cmtt-8"> 6.5524908e-05,</span><span
- class="cmtt-8"> 6.9783085e-05,</span>
- <br class="fancyvrb" /><a
- id="x1-125054r27"></a><span
- class="cmr-6">27</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 7.4317983e-05,</span><span
- class="cmtt-8"> 7.9147585e-05,</span><span
- class="cmtt-8"> 8.4291040e-05,</span><span
- class="cmtt-8"> 8.9768747e-05,</span>
- <br class="fancyvrb" /><a
- id="x1-125056r28"></a><span
- class="cmr-6">28</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 9.5602426e-05,</span><span
- class="cmtt-8"> 0.00010181521,</span><span
- class="cmtt-8"> 0.00010843174,</span><span
- class="cmtt-8"> 0.00011547824,</span>
- <br class="fancyvrb" /><a
- id="x1-125058r29"></a><span
- class="cmr-6">29</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.00012298267,</span><span
- class="cmtt-8"> 0.00013097477,</span><span
- class="cmtt-8"> 0.00013948625,</span><span
- class="cmtt-8"> 0.00014855085,</span>
- <br class="fancyvrb" /><a
- id="x1-125060r30"></a><span
- class="cmr-6">30</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.00015820453,</span><span
- class="cmtt-8"> 0.00016848555,</span><span
- class="cmtt-8"> 0.00017943469,</span><span
- class="cmtt-8"> 0.00019109536,</span>
- <br class="fancyvrb" /><a
- id="x1-125062r31"></a><span
- class="cmr-6">31</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.00020351382,</span><span
- class="cmtt-8"> 0.00021673929,</span><span
- class="cmtt-8"> 0.00023082423,</span><span
- class="cmtt-8"> 0.00024582449,</span>
- <br class="fancyvrb" /><a
- id="x1-125064r32"></a><span
- class="cmr-6">32</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.00026179955,</span><span
- class="cmtt-8"> 0.00027881276,</span><span
- class="cmtt-8"> 0.00029693158,</span><span
- class="cmtt-8"> 0.00031622787,</span>
- <br class="fancyvrb" /><a
- id="x1-125066r33"></a><span
- class="cmr-6">33</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.00033677814,</span><span
- class="cmtt-8"> 0.00035866388,</span><span
- class="cmtt-8"> 0.00038197188,</span><span
- class="cmtt-8"> 0.00040679456,</span>
- <br class="fancyvrb" /><a
- id="x1-125068r34"></a><span
- class="cmr-6">34</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.00043323036,</span><span
- class="cmtt-8"> 0.00046138411,</span><span
- class="cmtt-8"> 0.00049136745,</span><span
- class="cmtt-8"> 0.00052329927,</span>
- <br class="fancyvrb" /><a
- id="x1-125070r35"></a><span
- class="cmr-6">35</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.00055730621,</span><span
- class="cmtt-8"> 0.00059352311,</span><span
- class="cmtt-8"> 0.00063209358,</span><span
- class="cmtt-8"> 0.00067317058,</span>
- <br class="fancyvrb" /><a
- id="x1-125072r36"></a><span
- class="cmr-6">36</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.00071691700,</span><span
- class="cmtt-8"> 0.00076350630,</span><span
- class="cmtt-8"> 0.00081312324,</span><span
- class="cmtt-8"> 0.00086596457,</span>
- <br class="fancyvrb" /><a
- id="x1-125074r37"></a><span
- class="cmr-6">37</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.00092223983,</span><span
- class="cmtt-8"> 0.00098217216,</span><span
- class="cmtt-8"> 0.0010459992,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0011139742,</span>
- <br class="fancyvrb" /><a
- id="x1-125076r38"></a><span
- class="cmr-6">38</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0011863665,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0012634633,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0013455702,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0014330129,</span>
- <br class="fancyvrb" /><a
- id="x1-125078r39"></a><span
- class="cmr-6">39</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0015261382,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0016253153,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0017309374,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0018434235,</span>
- <br class="fancyvrb" /><a
- id="x1-125080r40"></a><span
- class="cmr-6">40</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0019632195,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0020908006,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0022266726,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0023713743,</span>
- <br class="fancyvrb" /><a
- id="x1-125082r41"></a><span
- class="cmr-6">41</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0025254795,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0026895994,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0028643847,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0030505286,</span>
- <br class="fancyvrb" /><a
- id="x1-125084r42"></a><span
- class="cmr-6">42</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0032487691,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0034598925,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0036847358,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0039241906,</span>
-
-
- <br class="fancyvrb" /><a
- id="x1-125086r43"></a><span
- class="cmr-6">43</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0041792066,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0044507950,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0047400328,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0050480668,</span>
- <br class="fancyvrb" /><a
- id="x1-125088r44"></a><span
- class="cmr-6">44</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0053761186,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0057254891,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0060975636,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0064938176,</span>
- <br class="fancyvrb" /><a
- id="x1-125090r45"></a><span
- class="cmr-6">45</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0069158225,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0073652516,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0078438871,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0083536271,</span>
- <br class="fancyvrb" /><a
- id="x1-125092r46"></a><span
- class="cmr-6">46</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.0088964928,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.009474637,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.010090352,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.010746080,</span>
- <br class="fancyvrb" /><a
- id="x1-125094r47"></a><span
- class="cmr-6">47</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.011444421,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.012188144,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.012980198,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.013823725,</span>
- <br class="fancyvrb" /><a
- id="x1-125096r48"></a><span
- class="cmr-6">48</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.014722068,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.015678791,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.016697687,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.017782797,</span>
- <br class="fancyvrb" /><a
- id="x1-125098r49"></a><span
- class="cmr-6">49</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.018938423,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.020169149,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.021479854,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.022875735,</span>
- <br class="fancyvrb" /><a
- id="x1-125100r50"></a><span
- class="cmr-6">50</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.024362330,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.025945531,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.027631618,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.029427276,</span>
- <br class="fancyvrb" /><a
- id="x1-125102r51"></a><span
- class="cmr-6">51</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.031339626,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.033376252,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.035545228,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.037855157,</span>
- <br class="fancyvrb" /><a
- id="x1-125104r52"></a><span
- class="cmr-6">52</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.040315199,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.042935108,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.045725273,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.048696758,</span>
- <br class="fancyvrb" /><a
- id="x1-125106r53"></a><span
- class="cmr-6">53</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.051861348,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.055231591,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.058820850,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.062643361,</span>
- <br class="fancyvrb" /><a
- id="x1-125108r54"></a><span
- class="cmr-6">54</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.066714279,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.071049749,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.075666962,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.080584227,</span>
- <br class="fancyvrb" /><a
- id="x1-125110r55"></a><span
- class="cmr-6">55</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.085821044,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.091398179,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.097337747,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.10366330,</span>
- <br class="fancyvrb" /><a
- id="x1-125112r56"></a><span
- class="cmr-6">56</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.11039993,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.11757434,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.12521498,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.13335215,</span>
- <br class="fancyvrb" /><a
- id="x1-125114r57"></a><span
- class="cmr-6">57</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.14201813,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.15124727,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.16107617,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.17154380,</span>
- <br class="fancyvrb" /><a
- id="x1-125116r58"></a><span
- class="cmr-6">58</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.18269168,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.19456402,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.20720788,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.22067342,</span>
- <br class="fancyvrb" /><a
- id="x1-125118r59"></a><span
- class="cmr-6">59</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.23501402,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.25028656,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.26655159,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.28387361,</span>
- <br class="fancyvrb" /><a
- id="x1-125120r60"></a><span
- class="cmr-6">60</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.30232132,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.32196786,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.34289114,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.36517414,</span>
- <br class="fancyvrb" /><a
- id="x1-125122r61"></a><span
- class="cmr-6">61</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.38890521,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.41417847,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.44109412,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.46975890,</span>
- <br class="fancyvrb" /><a
- id="x1-125124r62"></a><span
- class="cmr-6">62</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.50028648,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.53279791,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.56742212,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.60429640,</span>
- <br class="fancyvrb" /><a
- id="x1-125126r63"></a><span
- class="cmr-6">63</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.64356699,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.68538959,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.72993007,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.77736504,</span>
- <br class="fancyvrb" /><a
- id="x1-125128r64"></a><span
- class="cmr-6">64</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.82788260,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.88168307,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 0.9389798,</span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> </span><span
- class="cmtt-8"> 1.</span>
- </div>
-
-
-
-
- <h3 class="sectionHead"><span class="titlemark">A </span> <a
- id="x1-126000A"></a>Embedding Vorbis into an Ogg stream</h3>
- <!--l. 6--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">A.1 </span> <a
- id="x1-127000A.1"></a>Overview</h4>
- <!--l. 8--><p class="noindent" >This document describes using Ogg logical and physical transport streams to encapsulate Vorbis
- compressed audio packet data into file form.
- <!--l. 12--><p class="noindent" >The <a
- href="#x1-20001">Section 1<!--tex4ht:ref: vorbis:spec:intro --></a>, “<a
- href="#x1-20001">Introduction and Description<!--tex4ht:ref: vorbis:spec:intro --></a>” provides an overview of the construction of
- Vorbis audio packets.
- <!--l. 15--><p class="noindent" >The <a
- href="oggstream.html" >Ogg bitstream overview</a> and <a
- href="framing.html" >Ogg logical bitstream and framing spec</a> provide detailed
- descriptions of Ogg transport streams. This specification document assumes a working
- knowledge of the concepts covered in these named backround documents. Please read them
- first.
- <!--l. 22--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">A.1.1 </span> <a
- id="x1-128000A.1.1"></a>Restrictions</h5>
- <!--l. 24--><p class="noindent" >The Ogg/Vorbis I specification currently dictates that Ogg/Vorbis streams use Ogg transport
- streams in degenerate, unmultiplexed form only. That is:
- <ul class="itemize1">
- <li class="itemize">A meta-headerless Ogg file encapsulates the Vorbis I packets
- </li>
- <li class="itemize">The Ogg stream may be chained, i.e., contain multiple, contigous logical streams
- (links).
- </li>
- <li class="itemize">The Ogg stream must be unmultiplexed (only one stream, a Vorbis audio stream,
- per link)
- </li></ul>
-
-
- <!--l. 41--><p class="noindent" >This is not to say that it is not currently possible to multiplex Vorbis with other media
- types into a multi-stream Ogg file. At the time this document was written, Ogg was
- becoming a popular container for low-bitrate movies consisting of DivX video and Vorbis
- audio. However, a ’Vorbis I audio file’ is taken to imply Vorbis audio existing alone
- within a degenerate Ogg stream. A compliant ’Vorbis audio player’ is not required to
- implement Ogg support beyond the specific support of Vorbis within a degenrate Ogg
- stream (naturally, application authors are encouraged to support full multiplexed Ogg
- handling).
- <!--l. 55--><p class="noindent" >
- <h5 class="subsubsectionHead"><span class="titlemark">A.1.2 </span> <a
- id="x1-129000A.1.2"></a>MIME type</h5>
- <!--l. 57--><p class="noindent" >The MIME type of Ogg files depend on the context. Specifically, complex multimedia and
- applications should use <span
- class="cmtt-12">application/ogg</span>, while visual media should use <span
- class="cmtt-12">video/ogg</span>, and audio
- <span
- class="cmtt-12">audio/ogg</span>. Vorbis data encapsulated in Ogg may appear in any of those types. RTP
- encapsulated Vorbis should use <span
- class="cmtt-12">audio/vorbis </span>+ <span
- class="cmtt-12">audio/vorbis-config</span>.
- <!--l. 65--><p class="noindent" >
- <h4 class="subsectionHead"><span class="titlemark">A.2 </span> <a
- id="x1-130000A.2"></a>Encapsulation</h4>
- <!--l. 67--><p class="noindent" >Ogg encapsulation of a Vorbis packet stream is straightforward.
- <ul class="itemize1">
- <li class="itemize">The first Vorbis packet (the identification header), which uniquely identifies a stream
- as Vorbis audio, is placed alone in the first page of the logical Ogg stream. This
- results in a first Ogg page of exactly 58 bytes at the very beginning of the logical
- stream.
- </li>
- <li class="itemize">This first page is marked ’beginning of stream’ in the page flags.
- </li>
- <li class="itemize">The second and third vorbis packets (comment and setup headers) may span one or
- more pages beginning on the second page of the logical stream. However many pages
- they span, the third header packet finishes the page on which it ends. The next (first
- audio) packet must begin on a fresh page.
-
-
- </li>
- <li class="itemize">The granule position of these first pages containing only headers is zero.
- </li>
- <li class="itemize">The first audio packet of the logical stream begins a fresh Ogg page.
- </li>
- <li class="itemize">Packets are placed into ogg pages in order until the end of stream.
- </li>
- <li class="itemize">The last page is marked ’end of stream’ in the page flags.
- </li>
- <li class="itemize">Vorbis packets may span page boundaries.
- </li>
- <li class="itemize">The granule position of pages containing Vorbis audio is in units of PCM audio
- samples (per channel; a stereo stream’s granule position does not increment at twice
- the speed of a mono stream).
- </li>
- <li class="itemize">The granule position of a page represents the end PCM sample position of the last
- packet <span
- class="cmti-12">completed </span>on that page. The ’last PCM sample’ is the last complete sample
- returned by decode, not an internal sample awaiting lapping with a subsequent block.
- A page that is entirely spanned by a single packet (that completes on a subsequent
- page) has no granule position, and the granule position is set to ’-1’.
- <!--l. 126--><p class="noindent" >Note that the last decoded (fully lapped) PCM sample from a packet is not
- necessarily the middle sample from that block. If, eg, the current Vorbis packet
- encodes a ”long block” and the next Vorbis packet encodes a ”short block”, the last
- decodable sample from the current packet be at position (3*long_block_length/4) -
- (short_block_length/4).
- </li>
- <li class="itemize">The granule (PCM) position of the first page need not indicate that the stream
- started at position zero. Although the granule position belongs to the last completed
- packet on the page and a valid granule position must be positive, by inference it may
- indicate that the PCM position of the beginning of audio is positive or negative.
- <ul class="itemize2">
- <li class="itemize">A positive starting value simply indicates that this stream begins at some
- positive time offset, potentially within a larger program. This is a common case
- when connecting to the middle of broadcast stream.
- </li>
- <li class="itemize">A negative value indicates that output samples preceeding time zero should be
-
-
- discarded during decoding; this technique is used to allow sample-granularity
- editing of the stream start time of already-encoded Vorbis streams. The number
- of samples to be discarded must not exceed the overlap-add span of the first two
- audio packets.
- </li></ul>
- <!--l. 161--><p class="noindent" >In both of these cases in which the initial audio PCM starting offset is nonzero, the
- second finished audio packet must flush the page on which it appears and the
- third packet begin a fresh page. This allows the decoder to always be able to
- perform PCM position adjustments before needing to return any PCM data from
- synthesis, resulting in correct positioning information without any aditional seeking
- logic.
- <!--l. 170--><p class="noindent" ><span class="likesubparagraphHead"><a
- id="x1-131000A.2"></a><span
- class="cmbx-12">Note:</span></span> Failure to do so should, at worst, cause a decoder implementation to return
- incorrect positioning information for seeking operations at the very beginning of the
- stream.
- </li>
- <li class="itemize">A granule position on the final page in a stream that indicates less audio data than the
- final packet would normally return is used to end the stream on other than even frame
- boundaries. The difference between the actual available data returned and the
- declared amount indicates how many trailing samples to discard from the decoding
- process.
- </li></ul>
-
-
- <h3 class="sectionHead"><span class="titlemark">B </span> <a
- id="x1-132000B"></a>Vorbis encapsulation in RTP</h3>
- <!--l. 8--><p class="noindent" >Please consult RFC 5215 <span
- class="cmti-12">“RTP Payload Format for Vorbis Encoded Audio” </span>for description of
- how to embed Vorbis audio in an RTP stream.
-
-
-
-
- <h3 class="likesectionHead"><a
- id="x1-133000B"></a>Colophon</h3>
- <!--l. 6--><p class="noindent" ><img
- src="Vorbis_I_spec13x.png" alt="PIC" class="graphics"><!--tex4ht:graphics
- name="Vorbis_I_spec13x.png" src="xifish.pdf"
- -->
- <!--l. 10--><p class="noindent" >Ogg is a <a
- href="http://www.xiph.org/" >Xiph.org Foundation</a> effort to protect essential tenets of Internet multimedia from
- corporate hostage-taking; Open Source is the net’s greatest tool to keep everyone honest. See
- <a
- href="http://www.xiph.org/about.html" >About the Xiph.org Foundation</a> for details.
- <!--l. 17--><p class="noindent" >Ogg Vorbis is the first Ogg audio CODEC. Anyone may freely use and distribute the Ogg and
- Vorbis specification, whether in a private, public or corporate capacity. However, the Xiph.org
- Foundation and the Ogg project (xiph.org) reserve the right to set the Ogg Vorbis specification
- and certify specification compliance.
- <!--l. 23--><p class="noindent" >Xiph.org’s Vorbis software CODEC implementation is distributed under a BSD-like license. This
- does not restrict third parties from distributing independent implementations of Vorbis software
- under other licenses.
- <!--l. 28--><p class="noindent" >Ogg, Vorbis, Xiph.org Foundation and their logos are trademarks (tm) of the <a
- href="http://www.xiph.org/" >Xiph.org
- Foundation</a>. These pages are copyright (C) 1994-2007 Xiph.org Foundation. All rights
- reserved.
- <!--l. 33--><p class="noindent" >This document is set using <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span
- class="E">E</span>X</span></span>.
-
-
- <h3 class="likesectionHead"><a
- id="x1-134000B"></a>References</h3>
- <!--l. 123--><p class="noindent" >
- <div class="thebibliography">
- <p class="bibitem" ><span class="biblabel">
- [1]<span class="bibsp">   </span></span><a
- id="XSporer/Brandenburg/Edler"></a>T. Sporer, K. Brandenburg and
- B. Edler, The use of multirate filter banks for coding of high quality digital audio,
- <a
- href="http://www.iocon.com/resource/docs/ps/eusipco_corrected.ps" class="url" ><span
- class="cmtt-12">http://www.iocon.com/resource/docs/ps/eusipco_corrected.ps</span></a>.
- </p>
- </div>
-
- </body></html>
-
|