aac.js 151 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655
  1. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. (function (global){
  3. var AV = (typeof window !== "undefined" ? window['AV'] : typeof global !== "undefined" ? global['AV'] : null);
  4. var tables = require('./tables');
  5. var ADTSDemuxer = AV.Demuxer.extend(function() {
  6. AV.Demuxer.register(this);
  7. this.probe = function(stream) {
  8. var offset = stream.offset;
  9. // attempt to find ADTS syncword
  10. while (stream.available(2)) {
  11. if ((stream.readUInt16() & 0xfff6) === 0xfff0) {
  12. stream.seek(offset);
  13. return true;
  14. }
  15. }
  16. stream.seek(offset);
  17. return false;
  18. };
  19. this.prototype.init = function() {
  20. this.bitstream = new AV.Bitstream(this.stream);
  21. };
  22. // Reads an ADTS header
  23. // See http://wiki.multimedia.cx/index.php?title=ADTS
  24. this.readHeader = function(stream) {
  25. if (stream.read(12) !== 0xfff)
  26. throw new Error('Invalid ADTS header.');
  27. var ret = {};
  28. stream.advance(3); // mpeg version and layer
  29. var protectionAbsent = !!stream.read(1);
  30. ret.profile = stream.read(2) + 1;
  31. ret.samplingIndex = stream.read(4);
  32. stream.advance(1); // private
  33. ret.chanConfig = stream.read(3);
  34. stream.advance(4); // original/copy, home, copywrite, and copywrite start
  35. ret.frameLength = stream.read(13);
  36. stream.advance(11); // fullness
  37. ret.numFrames = stream.read(2) + 1;
  38. if (!protectionAbsent)
  39. stream.advance(16);
  40. return ret;
  41. };
  42. this.prototype.readChunk = function() {
  43. if (!this.sentHeader) {
  44. var offset = this.stream.offset;
  45. var header = ADTSDemuxer.readHeader(this.bitstream);
  46. this.emit('format', {
  47. formatID: 'aac ',
  48. sampleRate: tables.SAMPLE_RATES[header.samplingIndex],
  49. channelsPerFrame: header.chanConfig,
  50. bitsPerChannel: 16
  51. });
  52. // generate a magic cookie from the ADTS header
  53. var cookie = new Uint8Array(2);
  54. cookie[0] = (header.profile << 3) | ((header.samplingIndex >> 1) & 7);
  55. cookie[1] = ((header.samplingIndex & 1) << 7) | (header.chanConfig << 3);
  56. this.emit('cookie', new AV.Buffer(cookie));
  57. this.stream.seek(offset);
  58. this.sentHeader = true;
  59. }
  60. while (this.stream.available(1)) {
  61. var buffer = this.stream.readSingleBuffer(this.stream.remainingBytes());
  62. this.emit('data', buffer);
  63. }
  64. };
  65. });
  66. module.exports = ADTSDemuxer;
  67. }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  68. },{"./tables":11}],2:[function(require,module,exports){
  69. /*
  70. * AAC.js - Advanced Audio Coding decoder in JavaScript
  71. * Created by Devon Govett
  72. * Copyright (c) 2012, Official.fm Labs
  73. *
  74. * AAC.js is free software; you can redistribute it and/or modify it
  75. * under the terms of the GNU Lesser General Public License as
  76. * published by the Free Software Foundation; either version 3 of the
  77. * License, or (at your option) any later version.
  78. *
  79. * AAC.js is distributed in the hope that it will be useful, but WITHOUT
  80. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  81. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
  82. * Public License for more details.
  83. *
  84. * You should have received a copy of the GNU Lesser General Public
  85. * License along with this library.
  86. * If not, see <http://www.gnu.org/licenses/>.
  87. */
  88. var ICStream = require('./ics');
  89. var Huffman = require('./huffman');
  90. // Channel Coupling Element
  91. function CCEElement(config) {
  92. this.ics = new ICStream(config);
  93. this.channelPair = new Array(8);
  94. this.idSelect = new Int32Array(8);
  95. this.chSelect = new Int32Array(8);
  96. this.gain = new Array(16);
  97. }
  98. CCEElement.BEFORE_TNS = 0;
  99. CCEElement.AFTER_TNS = 1;
  100. CCEElement.AFTER_IMDCT = 2;
  101. const CCE_SCALE = new Float32Array([
  102. 1.09050773266525765921,
  103. 1.18920711500272106672,
  104. 1.4142135623730950488016887,
  105. 2.0
  106. ]);
  107. CCEElement.prototype = {
  108. decode: function(stream, config) {
  109. var channelPair = this.channelPair,
  110. idSelect = this.idSelect,
  111. chSelect = this.chSelect;
  112. this.couplingPoint = 2 * stream.read(1);
  113. this.coupledCount = stream.read(3);
  114. var gainCount = 0;
  115. for (var i = 0; i <= this.coupledCount; i++) {
  116. gainCount++;
  117. channelPair[i] = stream.read(1);
  118. idSelect[i] = stream.read(4);
  119. if (channelPair[i]) {
  120. chSelect[i] = stream.read(2);
  121. if (chSelect[i] === 3)
  122. gainCount++;
  123. } else {
  124. chSelect[i] = 2;
  125. }
  126. }
  127. this.couplingPoint += stream.read(1);
  128. this.couplingPoint |= (this.couplingPoint >>> 1);
  129. var sign = stream.read(1),
  130. scale = CCE_SCALE[stream.read(2)];
  131. this.ics.decode(stream, config, false);
  132. var groupCount = this.ics.info.groupCount,
  133. maxSFB = this.ics.info.maxSFB,
  134. bandTypes = this.ics.bandTypes;
  135. for (var i = 0; i < gainCount; i++) {
  136. var idx = 0,
  137. cge = 1,
  138. gain = 0,
  139. gainCache = 1;
  140. if (i > 0) {
  141. cge = this.couplingPoint === CCEElement.AFTER_IMDCT ? 1 : stream.read(1);
  142. gain = cge ? Huffman.decodeScaleFactor(stream) - 60 : 0;
  143. gainCache = Math.pow(scale, -gain);
  144. }
  145. var gain_i = this.gain[i] = new Float32Array(120);
  146. if (this.couplingPoint === CCEElement.AFTER_IMDCT) {
  147. gain_i[0] = gainCache;
  148. } else {
  149. for (var g = 0; g < groupCount; g++) {
  150. for (var sfb = 0; sfb < maxSFB; sfb++) {
  151. if (bandTypes[idx] !== ICStream.ZERO_BT) {
  152. if (cge === 0) {
  153. var t = Huffman.decodeScaleFactor(stream) - 60;
  154. if (t !== 0) {
  155. var s = 1;
  156. t = gain += t;
  157. if (!sign) {
  158. s -= 2 * (t & 0x1);
  159. t >>>= 1;
  160. }
  161. gainCache = Math.pow(scale, -t) * s;
  162. }
  163. }
  164. gain_i[idx++] = gainCache;
  165. }
  166. }
  167. }
  168. }
  169. }
  170. },
  171. applyIndependentCoupling: function(index, data) {
  172. var gain = this.gain[index][0],
  173. iqData = this.ics.data;
  174. for (var i = 0; i < data.length; i++) {
  175. data[i] += gain * iqData[i];
  176. }
  177. },
  178. applyDependentCoupling: function(index, data) {
  179. var info = this.ics.info,
  180. swbOffsets = info.swbOffsets,
  181. groupCount = info.groupCount,
  182. maxSFB = info.maxSFB,
  183. bandTypes = this.ics.bandTypes,
  184. iqData = this.ics.data;
  185. var idx = 0,
  186. offset = 0,
  187. gains = this.gain[index];
  188. for (var g = 0; g < groupCount; g++) {
  189. var len = info.groupLength[g];
  190. for (var sfb = 0; sfb < maxSFB; sfb++, idx++) {
  191. if (bandTypes[idx] !== ICStream.ZERO_BT) {
  192. var gain = gains[idx];
  193. for (var group = 0; group < len; group++) {
  194. for (var k = swbOffsets[sfb]; k < swbOffsets[swb + 1]; k++) {
  195. data[offset + group * 128 + k] += gain * iqData[offset + group * 128 + k];
  196. }
  197. }
  198. }
  199. }
  200. offset += len * 128;
  201. }
  202. }
  203. };
  204. module.exports = CCEElement;
  205. },{"./huffman":7,"./ics":8}],3:[function(require,module,exports){
  206. /*
  207. * AAC.js - Advanced Audio Coding decoder in JavaScript
  208. * Created by Devon Govett
  209. * Copyright (c) 2012, Official.fm Labs
  210. *
  211. * AAC.js is free software; you can redistribute it and/or modify it
  212. * under the terms of the GNU Lesser General Public License as
  213. * published by the Free Software Foundation; either version 3 of the
  214. * License, or (at your option) any later version.
  215. *
  216. * AAC.js is distributed in the hope that it will be useful, but WITHOUT
  217. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  218. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
  219. * Public License for more details.
  220. *
  221. * You should have received a copy of the GNU Lesser General Public
  222. * License along with this library.
  223. * If not, see <http://www.gnu.org/licenses/>.
  224. */
  225. var ICStream = require('./ics');
  226. // Channel Pair Element
  227. function CPEElement(config) {
  228. this.ms_used = [];
  229. this.left = new ICStream(config);
  230. this.right = new ICStream(config);
  231. }
  232. const MAX_MS_MASK = 128;
  233. const MASK_TYPE_ALL_0 = 0,
  234. MASK_TYPE_USED = 1,
  235. MASK_TYPE_ALL_1 = 2,
  236. MASK_TYPE_RESERVED = 3;
  237. CPEElement.prototype.decode = function(stream, config) {
  238. var left = this.left,
  239. right = this.right,
  240. ms_used = this.ms_used;
  241. if (this.commonWindow = !!stream.read(1)) {
  242. left.info.decode(stream, config, true);
  243. right.info = left.info;
  244. var mask = stream.read(2);
  245. this.maskPresent = !!mask;
  246. switch (mask) {
  247. case MASK_TYPE_USED:
  248. var len = left.info.groupCount * left.info.maxSFB;
  249. for (var i = 0; i < len; i++) {
  250. ms_used[i] = !!stream.read(1);
  251. }
  252. break;
  253. case MASK_TYPE_ALL_0:
  254. case MASK_TYPE_ALL_1:
  255. var val = !!mask;
  256. for (var i = 0; i < MAX_MS_MASK; i++) {
  257. ms_used[i] = val;
  258. }
  259. break;
  260. default:
  261. throw new Error("Reserved ms mask type: " + mask);
  262. }
  263. } else {
  264. for (var i = 0; i < MAX_MS_MASK; i++)
  265. ms_used[i] = false;
  266. }
  267. left.decode(stream, config, this.commonWindow);
  268. right.decode(stream, config, this.commonWindow);
  269. };
  270. module.exports = CPEElement;
  271. },{"./ics":8}],4:[function(require,module,exports){
  272. (function (global){
  273. /*
  274. * AAC.js - Advanced Audio Coding decoder in JavaScript
  275. * Created by Devon Govett
  276. * Copyright (c) 2012, Official.fm Labs
  277. *
  278. * AAC.js is free software; you can redistribute it and/or modify it
  279. * under the terms of the GNU Lesser General Public License as
  280. * published by the Free Software Foundation; either version 3 of the
  281. * License, or (at your option) any later version.
  282. *
  283. * AAC.js is distributed in the hope that it will be useful, but WITHOUT
  284. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  285. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
  286. * Public License for more details.
  287. *
  288. * You should have received a copy of the GNU Lesser General Public
  289. * License along with this library.
  290. * If not, see <http://www.gnu.org/licenses/>.
  291. */
  292. var AV = (typeof window !== "undefined" ? window['AV'] : typeof global !== "undefined" ? global['AV'] : null);
  293. var ADTSDemuxer = require('./adts_demuxer');
  294. var ICStream = require('./ics');
  295. var CPEElement = require('./cpe');
  296. var CCEElement = require('./cce');
  297. var FilterBank = require('./filter_bank');
  298. var tables = require('./tables');
  299. var AACDecoder = AV.Decoder.extend(function() {
  300. AV.Decoder.register('mp4a', this);
  301. AV.Decoder.register('aac ', this);
  302. // AAC profiles
  303. const AOT_AAC_MAIN = 1, // no
  304. AOT_AAC_LC = 2, // yes
  305. AOT_AAC_LTP = 4, // no
  306. AOT_ESCAPE = 31;
  307. // Channel configurations
  308. const CHANNEL_CONFIG_NONE = 0,
  309. CHANNEL_CONFIG_MONO = 1,
  310. CHANNEL_CONFIG_STEREO = 2,
  311. CHANNEL_CONFIG_STEREO_PLUS_CENTER = 3,
  312. CHANNEL_CONFIG_STEREO_PLUS_CENTER_PLUS_REAR_MONO = 4,
  313. CHANNEL_CONFIG_FIVE = 5,
  314. CHANNEL_CONFIG_FIVE_PLUS_ONE = 6,
  315. CHANNEL_CONFIG_SEVEN_PLUS_ONE = 8;
  316. this.prototype.init = function() {
  317. this.format.floatingPoint = true;
  318. }
  319. this.prototype.setCookie = function(buffer) {
  320. var data = AV.Stream.fromBuffer(buffer),
  321. stream = new AV.Bitstream(data);
  322. this.config = {};
  323. this.config.profile = stream.read(5);
  324. if (this.config.profile === AOT_ESCAPE)
  325. this.config.profile = 32 + stream.read(6);
  326. this.config.sampleIndex = stream.read(4);
  327. if (this.config.sampleIndex === 0x0f) {
  328. this.config.sampleRate = stream.read(24);
  329. for (var i = 0; i < tables.SAMPLE_RATES.length; i++) {
  330. if (tables.SAMPLE_RATES[i] === this.config.sampleRate) {
  331. this.config.sampleIndex = i;
  332. break;
  333. }
  334. }
  335. } else {
  336. this.config.sampleRate = tables.SAMPLE_RATES[this.config.sampleIndex];
  337. }
  338. this.config.chanConfig = stream.read(4);
  339. this.format.channelsPerFrame = this.config.chanConfig; // sometimes m4a files encode this wrong
  340. switch (this.config.profile) {
  341. case AOT_AAC_MAIN:
  342. case AOT_AAC_LC:
  343. case AOT_AAC_LTP:
  344. if (stream.read(1)) // frameLengthFlag
  345. throw new Error('frameLengthFlag not supported');
  346. this.config.frameLength = 1024;
  347. if (stream.read(1)) // dependsOnCoreCoder
  348. stream.advance(14); // coreCoderDelay
  349. if (stream.read(1)) { // extensionFlag
  350. if (this.config.profile > 16) { // error resiliant profile
  351. this.config.sectionDataResilience = stream.read(1);
  352. this.config.scalefactorResilience = stream.read(1);
  353. this.config.spectralDataResilience = stream.read(1);
  354. }
  355. stream.advance(1);
  356. }
  357. if (this.config.chanConfig === CHANNEL_CONFIG_NONE) {
  358. stream.advance(4) // element_instance_tag
  359. throw new Error('PCE unimplemented');
  360. }
  361. break;
  362. default:
  363. throw new Error('AAC profile ' + this.config.profile + ' not supported.');
  364. }
  365. this.filter_bank = new FilterBank(false, this.config.chanConfig);
  366. };
  367. const SCE_ELEMENT = 0,
  368. CPE_ELEMENT = 1,
  369. CCE_ELEMENT = 2,
  370. LFE_ELEMENT = 3,
  371. DSE_ELEMENT = 4,
  372. PCE_ELEMENT = 5,
  373. FIL_ELEMENT = 6,
  374. END_ELEMENT = 7;
  375. // The main decoding function.
  376. this.prototype.readChunk = function() {
  377. var stream = this.bitstream;
  378. // check if there is an ADTS header, and read it if so
  379. if (stream.peek(12) === 0xfff)
  380. ADTSDemuxer.readHeader(stream);
  381. this.cces = [];
  382. var elements = [],
  383. config = this.config,
  384. frameLength = config.frameLength,
  385. elementType = null;
  386. while ((elementType = stream.read(3)) !== END_ELEMENT) {
  387. var id = stream.read(4);
  388. switch (elementType) {
  389. // single channel and low frequency elements
  390. case SCE_ELEMENT:
  391. case LFE_ELEMENT:
  392. var ics = new ICStream(this.config);
  393. ics.id = id;
  394. elements.push(ics);
  395. ics.decode(stream, config, false);
  396. break;
  397. // channel pair element
  398. case CPE_ELEMENT:
  399. var cpe = new CPEElement(this.config);
  400. cpe.id = id;
  401. elements.push(cpe);
  402. cpe.decode(stream, config);
  403. break;
  404. // channel coupling element
  405. case CCE_ELEMENT:
  406. var cce = new CCEElement(this.config);
  407. this.cces.push(cce);
  408. cce.decode(stream, config);
  409. break;
  410. // data-stream element
  411. case DSE_ELEMENT:
  412. var align = stream.read(1),
  413. count = stream.read(8);
  414. if (count === 255)
  415. count += stream.read(8);
  416. if (align)
  417. stream.align();
  418. // skip for now...
  419. stream.advance(count * 8);
  420. break;
  421. // program configuration element
  422. case PCE_ELEMENT:
  423. throw new Error("TODO: PCE_ELEMENT")
  424. break;
  425. // filler element
  426. case FIL_ELEMENT:
  427. if (id === 15)
  428. id += stream.read(8) - 1;
  429. // skip for now...
  430. stream.advance(id * 8);
  431. break;
  432. default:
  433. throw new Error('Unknown element')
  434. }
  435. }
  436. stream.align();
  437. this.process(elements);
  438. // Interleave channels
  439. var data = this.data,
  440. channels = data.length,
  441. output = new Float32Array(frameLength * channels),
  442. j = 0;
  443. for (var k = 0; k < frameLength; k++) {
  444. for (var i = 0; i < channels; i++) {
  445. output[j++] = data[i][k] / 32768;
  446. }
  447. }
  448. return output;
  449. };
  450. this.prototype.process = function(elements) {
  451. var channels = this.config.chanConfig;
  452. // if (channels === 1 && psPresent)
  453. // TODO: sbrPresent (2)
  454. var mult = 1;
  455. var len = mult * this.config.frameLength;
  456. var data = this.data = [];
  457. // Initialize channels
  458. for (var i = 0; i < channels; i++) {
  459. data[i] = new Float32Array(len);
  460. }
  461. var channel = 0;
  462. for (var i = 0; i < elements.length && channel < channels; i++) {
  463. var e = elements[i];
  464. if (e instanceof ICStream) { // SCE or LFE element
  465. channel += this.processSingle(e, channel);
  466. } else if (e instanceof CPEElement) {
  467. this.processPair(e, channel);
  468. channel += 2;
  469. } else if (e instanceof CCEElement) {
  470. channel++;
  471. } else {
  472. throw new Error("Unknown element found.")
  473. }
  474. }
  475. };
  476. this.prototype.processSingle = function(element, channel) {
  477. var profile = this.config.profile,
  478. info = element.info,
  479. data = element.data;
  480. if (profile === AOT_AAC_MAIN)
  481. throw new Error("Main prediction unimplemented");
  482. if (profile === AOT_AAC_LTP)
  483. throw new Error("LTP prediction unimplemented");
  484. this.applyChannelCoupling(element, CCEElement.BEFORE_TNS, data, null);
  485. if (element.tnsPresent)
  486. element.tns.process(element, data, false);
  487. this.applyChannelCoupling(element, CCEElement.AFTER_TNS, data, null);
  488. // filterbank
  489. this.filter_bank.process(info, data, this.data[channel], channel);
  490. if (profile === AOT_AAC_LTP)
  491. throw new Error("LTP prediction unimplemented");
  492. this.applyChannelCoupling(element, CCEElement.AFTER_IMDCT, this.data[channel], null);
  493. if (element.gainPresent)
  494. throw new Error("Gain control not implemented");
  495. if (this.sbrPresent)
  496. throw new Error("SBR not implemented");
  497. return 1;
  498. };
  499. this.prototype.processPair = function(element, channel) {
  500. var profile = this.config.profile,
  501. left = element.left,
  502. right = element.right,
  503. l_info = left.info,
  504. r_info = right.info,
  505. l_data = left.data,
  506. r_data = right.data;
  507. // Mid-side stereo
  508. if (element.commonWindow && element.maskPresent)
  509. this.processMS(element, l_data, r_data);
  510. if (profile === AOT_AAC_MAIN)
  511. throw new Error("Main prediction unimplemented");
  512. // Intensity stereo
  513. this.processIS(element, l_data, r_data);
  514. if (profile === AOT_AAC_LTP)
  515. throw new Error("LTP prediction unimplemented");
  516. this.applyChannelCoupling(element, CCEElement.BEFORE_TNS, l_data, r_data);
  517. if (left.tnsPresent)
  518. left.tns.process(left, l_data, false);
  519. if (right.tnsPresent)
  520. right.tns.process(right, r_data, false);
  521. this.applyChannelCoupling(element, CCEElement.AFTER_TNS, l_data, r_data);
  522. // filterbank
  523. this.filter_bank.process(l_info, l_data, this.data[channel], channel);
  524. this.filter_bank.process(r_info, r_data, this.data[channel + 1], channel + 1);
  525. if (profile === AOT_AAC_LTP)
  526. throw new Error("LTP prediction unimplemented");
  527. this.applyChannelCoupling(element, CCEElement.AFTER_IMDCT, this.data[channel], this.data[channel + 1]);
  528. if (left.gainPresent)
  529. throw new Error("Gain control not implemented");
  530. if (right.gainPresent)
  531. throw new Error("Gain control not implemented");
  532. if (this.sbrPresent)
  533. throw new Error("SBR not implemented");
  534. };
  535. // Intensity stereo
  536. this.prototype.processIS = function(element, left, right) {
  537. var ics = element.right,
  538. info = ics.info,
  539. offsets = info.swbOffsets,
  540. windowGroups = info.groupCount,
  541. maxSFB = info.maxSFB,
  542. bandTypes = ics.bandTypes,
  543. sectEnd = ics.sectEnd,
  544. scaleFactors = ics.scaleFactors;
  545. var idx = 0, groupOff = 0;
  546. for (var g = 0; g < windowGroups; g++) {
  547. for (var i = 0; i < maxSFB;) {
  548. var end = sectEnd[idx];
  549. if (bandTypes[idx] === ICStream.INTENSITY_BT || bandTypes[idx] === ICStream.INTENSITY_BT2) {
  550. for (; i < end; i++, idx++) {
  551. var c = bandTypes[idx] === ICStream.INTENSITY_BT ? 1 : -1;
  552. if (element.maskPresent)
  553. c *= element.ms_used[idx] ? -1 : 1;
  554. var scale = c * scaleFactors[idx];
  555. for (var w = 0; w < info.groupLength[g]; w++) {
  556. var off = groupOff + w * 128 + offsets[i],
  557. len = offsets[i + 1] - offsets[i];
  558. for (var j = 0; j < len; j++) {
  559. right[off + j] = left[off + j] * scale;
  560. }
  561. }
  562. }
  563. } else {
  564. idx += end - i;
  565. i = end;
  566. }
  567. }
  568. groupOff += info.groupLength[g] * 128;
  569. }
  570. };
  571. // Mid-side stereo
  572. this.prototype.processMS = function(element, left, right) {
  573. var ics = element.left,
  574. info = ics.info,
  575. offsets = info.swbOffsets,
  576. windowGroups = info.groupCount,
  577. maxSFB = info.maxSFB,
  578. sfbCBl = ics.bandTypes,
  579. sfbCBr = element.right.bandTypes;
  580. var groupOff = 0, idx = 0;
  581. for (var g = 0; g < windowGroups; g++) {
  582. for (var i = 0; i < maxSFB; i++, idx++) {
  583. if (element.ms_used[idx] && sfbCBl[idx] < ICStream.NOISE_BT && sfbCBr[idx] < ICStream.NOISE_BT) {
  584. for (var w = 0; w < info.groupLength[g]; w++) {
  585. var off = groupOff + w * 128 + offsets[i];
  586. for (var j = 0; j < offsets[i + 1] - offsets[i]; j++) {
  587. var t = left[off + j] - right[off + j];
  588. left[off + j] += right[off + j];
  589. right[off + j] = t;
  590. }
  591. }
  592. }
  593. }
  594. groupOff += info.groupLength[g] * 128;
  595. }
  596. };
  597. this.prototype.applyChannelCoupling = function(element, couplingPoint, data1, data2) {
  598. var cces = this.cces,
  599. isChannelPair = element instanceof CPEElement,
  600. applyCoupling = couplingPoint === CCEElement.AFTER_IMDCT ? 'applyIndependentCoupling' : 'applyDependentCoupling';
  601. for (var i = 0; i < cces.length; i++) {
  602. var cce = cces[i],
  603. index = 0;
  604. if (cce.couplingPoint === couplingPoint) {
  605. for (var c = 0; c < cce.coupledCount; c++) {
  606. var chSelect = cce.chSelect[c];
  607. if (cce.channelPair[c] === isChannelPair && cce.idSelect[c] === element.id) {
  608. if (chSelect !== 1) {
  609. cce[applyCoupling](index, data1);
  610. if (chSelect) index++;
  611. }
  612. if (chSelect !== 2)
  613. cce[applyCoupling](index++, data2);
  614. } else {
  615. index += 1 + (chSelect === 3 ? 1 : 0);
  616. }
  617. }
  618. }
  619. }
  620. };
  621. });
  622. module.exports = AACDecoder;
  623. }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  624. },{"./adts_demuxer":1,"./cce":2,"./cpe":3,"./filter_bank":6,"./ics":8,"./tables":11}],5:[function(require,module,exports){
  625. /*
  626. * AAC.js - Advanced Audio Coding decoder in JavaScript
  627. * Created by Devon Govett
  628. * Copyright (c) 2012, Official.fm Labs
  629. *
  630. * AAC.js is free software; you can redistribute it and/or modify it
  631. * under the terms of the GNU Lesser General Public License as
  632. * published by the Free Software Foundation; either version 3 of the
  633. * License, or (at your option) any later version.
  634. *
  635. * AAC.js is distributed in the hope that it will be useful, but WITHOUT
  636. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  637. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
  638. * Public License for more details.
  639. *
  640. * You should have received a copy of the GNU Lesser General Public
  641. * License along with this library.
  642. * If not, see <http://www.gnu.org/licenses/>.
  643. */
  644. function FFT(length) {
  645. this.length = length;
  646. switch (length) {
  647. case 64:
  648. this.roots = generateFFTTableShort(64);
  649. break;
  650. case 512:
  651. this.roots = generateFFTTableLong(512);
  652. break;
  653. case 60:
  654. this.roots = generateFFTTableShort(60);
  655. break;
  656. case 480:
  657. this.roots = generateFFTTableLong(480);
  658. break;
  659. default:
  660. throw new Error("unexpected FFT length: " + length);
  661. }
  662. // processing buffers
  663. this.rev = new Array(length);
  664. for (var i = 0; i < length; i++) {
  665. this.rev[i] = new Float32Array(2);
  666. }
  667. this.a = new Float32Array(2);
  668. this.b = new Float32Array(2);
  669. this.c = new Float32Array(2);
  670. this.d = new Float32Array(2);
  671. this.e1 = new Float32Array(2);
  672. this.e2 = new Float32Array(2);
  673. }
  674. function generateFFTTableShort(len) {
  675. var t = 2 * Math.PI / len,
  676. cosT = Math.cos(t),
  677. sinT = Math.sin(t),
  678. f = new Array(len);
  679. for (var i = 0; i < len; i++) {
  680. f[i] = new Float32Array(2);
  681. }
  682. f[0][0] = 1;
  683. f[0][1] = 0;
  684. var lastImag = 0;
  685. for (var i = 1; i < len; i++) {
  686. f[i][0] = f[i - 1][0] * cosT + lastImag * sinT;
  687. lastImag = lastImag * cosT - f[i - 1][0] * sinT;
  688. f[i][1] = -lastImag;
  689. }
  690. return f;
  691. }
  692. function generateFFTTableLong(len) {
  693. var t = 2 * Math.PI / len,
  694. cosT = Math.cos(t),
  695. sinT = Math.sin(t),
  696. f = new Array(len);
  697. for (var i = 0; i < len; i++) {
  698. f[i] = new Float32Array(3);
  699. }
  700. f[0][0] = 1;
  701. f[0][1] = 0;
  702. f[0][2] = 0;
  703. for (var i = 1; i < len; i++) {
  704. f[i][0] = f[i - 1][0] * cosT + f[i - 1][2] * sinT;
  705. f[i][2] = f[i - 1][2] * cosT - f[i - 1][0] * sinT;
  706. f[i][1] = -f[i][2];
  707. }
  708. return f;
  709. }
  710. FFT.prototype.process = function(input, forward) {
  711. var length = this.length,
  712. imOffset = (forward ? 2 : 1),
  713. scale = (forward ? length : 1),
  714. rev = this.rev,
  715. roots = this.roots;
  716. // bit-reversal
  717. var ii = 0;
  718. for (var i = 0; i < length; i++) {
  719. rev[i][0] = input[ii][0];
  720. rev[i][1] = input[ii][1];
  721. var k = length >>> 1;
  722. while (ii >= k && k > 0) {
  723. ii -= k;
  724. k >>= 1;
  725. }
  726. ii += k;
  727. }
  728. var a = this.a,
  729. b = this.b,
  730. c = this.c,
  731. d = this.d,
  732. e1 = this.e1,
  733. e2 = this.e2;
  734. for (var i = 0; i < length; i++) {
  735. input[i][0] = rev[i][0];
  736. input[i][1] = rev[i][1];
  737. }
  738. // bottom base-4 round
  739. for (var i = 0; i < length; i += 4) {
  740. a[0] = input[i][0] + input[i + 1][0];
  741. a[1] = input[i][1] + input[i + 1][1];
  742. b[0] = input[i + 2][0] + input[i + 3][0];
  743. b[1] = input[i + 2][1] + input[i + 3][1];
  744. c[0] = input[i][0] - input[i + 1][0];
  745. c[1] = input[i][1] - input[i + 1][1];
  746. d[0] = input[i + 2][0] - input[i + 3][0];
  747. d[1] = input[i + 2][1] - input[i + 3][1];
  748. input[i][0] = a[0] + b[0];
  749. input[i][1] = a[1] + b[1];
  750. input[i + 2][0] = a[0] - b[0];
  751. input[i + 2][1] = a[1] - b[1];
  752. e1[0] = c[0] - d[1];
  753. e1[1] = c[1] + d[0];
  754. e2[0] = c[0] + d[1];
  755. e2[1] = c[1] - d[0];
  756. if (forward) {
  757. input[i + 1][0] = e2[0];
  758. input[i + 1][1] = e2[1];
  759. input[i + 3][0] = e1[0];
  760. input[i + 3][1] = e1[1];
  761. } else {
  762. input[i + 1][0] = e1[0];
  763. input[i + 1][1] = e1[1];
  764. input[i + 3][0] = e2[0];
  765. input[i + 3][1] = e2[1];
  766. }
  767. }
  768. // iterations from bottom to top
  769. for (var i = 4; i < length; i <<= 1) {
  770. var shift = i << 1,
  771. m = length / shift;
  772. for(var j = 0; j < length; j += shift) {
  773. for(var k = 0; k < i; k++) {
  774. var km = k * m,
  775. rootRe = roots[km][0],
  776. rootIm = roots[km][imOffset],
  777. zRe = input[i + j + k][0] * rootRe - input[i + j + k][1] * rootIm,
  778. zIm = input[i + j + k][0] * rootIm + input[i + j + k][1] * rootRe;
  779. input[i + j + k][0] = (input[j + k][0] - zRe) * scale;
  780. input[i + j + k][1] = (input[j + k][1] - zIm) * scale;
  781. input[j + k][0] = (input[j + k][0] + zRe) * scale;
  782. input[j + k][1] = (input[j + k][1] + zIm) * scale;
  783. }
  784. }
  785. }
  786. };
  787. module.exports = FFT;
  788. },{}],6:[function(require,module,exports){
  789. /*
  790. * AAC.js - Advanced Audio Coding decoder in JavaScript
  791. * Created by Devon Govett
  792. * Copyright (c) 2012, Official.fm Labs
  793. *
  794. * AAC.js is free software; you can redistribute it and/or modify it
  795. * under the terms of the GNU Lesser General Public License as
  796. * published by the Free Software Foundation; either version 3 of the
  797. * License, or (at your option) any later version.
  798. *
  799. * AAC.js is distributed in the hope that it will be useful, but WITHOUT
  800. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  801. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
  802. * Public License for more details.
  803. *
  804. * You should have received a copy of the GNU Lesser General Public
  805. * License along with this library.
  806. * If not, see <http://www.gnu.org/licenses/>.
  807. */
  808. var ICStream = require('./ics');
  809. var MDCT = require('./mdct');
  810. function FilterBank(smallFrames, channels) {
  811. if (smallFrames) {
  812. throw new Error("WHA?? No small frames allowed.");
  813. }
  814. this.length = 1024;
  815. this.shortLength = 128;
  816. this.mid = (this.length - this.shortLength) / 2;
  817. this.trans = this.shortLength / 2;
  818. this.mdctShort = new MDCT(this.shortLength * 2);
  819. this.mdctLong = new MDCT(this.length * 2);
  820. this.overlaps = new Array(channels);
  821. for (var i = 0; i < channels; i++) {
  822. this.overlaps[i] = new Float32Array(this.length);
  823. }
  824. this.buf = new Float32Array(2 * this.length);
  825. }
  826. function generateSineWindow(len) {
  827. var d = new Float32Array(len);
  828. for (var i = 0; i < len; i++) {
  829. d[i] = Math.sin((i + 0.5) * (Math.PI / (2.0 * len)))
  830. }
  831. return d;
  832. }
  833. function generateKBDWindow(alpha, len) {
  834. var PIN = Math.PI / len,
  835. out = new Float32Array(len),
  836. sum = 0,
  837. f = new Float32Array(len),
  838. alpha2 = (alpha * PIN) * (alpha * PIN);
  839. for (var n = 0; n < len; n++) {
  840. var tmp = n * (len - n) * alpha2,
  841. bessel = 1;
  842. for (var j = 50; j > 0; j--) {
  843. bessel = bessel * tmp / (j * j) + 1;
  844. }
  845. sum += bessel;
  846. f[n] = sum;
  847. }
  848. sum++;
  849. for (var n = 0; n < len; n++) {
  850. out[n] = Math.sqrt(f[n] / sum);
  851. }
  852. return out;
  853. }
  854. const SINE_1024 = generateSineWindow(1024),
  855. SINE_128 = generateSineWindow(128),
  856. KBD_1024 = generateKBDWindow(4, 1024),
  857. KBD_128 = generateKBDWindow(6, 128),
  858. LONG_WINDOWS = [SINE_1024, KBD_1024],
  859. SHORT_WINDOWS = [SINE_128, KBD_128];
  860. FilterBank.prototype.process = function(info, input, output, channel) {
  861. var overlap = this.overlaps[channel],
  862. windowShape = info.windowShape[1],
  863. windowShapePrev = info.windowShape[0],
  864. longWindows = LONG_WINDOWS[windowShape],
  865. shortWindows = SHORT_WINDOWS[windowShape],
  866. longWindowsPrev = LONG_WINDOWS[windowShapePrev],
  867. shortWindowsPrev = SHORT_WINDOWS[windowShapePrev],
  868. length = this.length,
  869. shortLen = this.shortLength,
  870. mid = this.mid,
  871. trans = this.trans,
  872. buf = this.buf,
  873. mdctLong = this.mdctLong,
  874. mdctShort = this.mdctShort;
  875. switch (info.windowSequence) {
  876. case ICStream.ONLY_LONG_SEQUENCE:
  877. mdctLong.process(input, 0, buf, 0);
  878. // add second half output of previous frame to windowed output of current frame
  879. for (var i = 0; i < length; i++) {
  880. output[i] = overlap[i] + (buf[i] * longWindowsPrev[i]);
  881. }
  882. // window the second half and save as overlap for next frame
  883. for (var i = 0; i < length; i++) {
  884. overlap[i] = buf[length + i] * longWindows[length - 1 - i];
  885. }
  886. break;
  887. case ICStream.LONG_START_SEQUENCE:
  888. mdctLong.process(input, 0, buf, 0);
  889. // add second half output of previous frame to windowed output of current frame
  890. for (var i = 0; i < length; i++) {
  891. output[i] = overlap[i] + (buf[i] * longWindowsPrev[i]);
  892. }
  893. // window the second half and save as overlap for next frame
  894. for (var i = 0; i < mid; i++) {
  895. overlap[i] = buf[length + i];
  896. }
  897. for (var i = 0; i < shortLen; i++) {
  898. overlap[mid + i] = buf[length + mid + i] * shortWindows[shortLen - i - 1];
  899. }
  900. for (var i = 0; i < mid; i++) {
  901. overlap[mid + shortLen + i] = 0;
  902. }
  903. break;
  904. case ICStream.EIGHT_SHORT_SEQUENCE:
  905. for (var i = 0; i < 8; i++) {
  906. mdctShort.process(input, i * shortLen, buf, 2 * i * shortLen);
  907. }
  908. // add second half output of previous frame to windowed output of current frame
  909. for (var i = 0; i < mid; i++) {
  910. output[i] = overlap[i];
  911. }
  912. for (var i = 0; i < shortLen; i++) {
  913. output[mid + i] = overlap[mid + i] + buf[i] * shortWindowsPrev[i];
  914. output[mid + 1 * shortLen + i] = overlap[mid + shortLen * 1 + i] + (buf[shortLen * 1 + i] * shortWindows[shortLen - 1 - i]) + (buf[shortLen * 2 + i] * shortWindows[i]);
  915. output[mid + 2 * shortLen + i] = overlap[mid + shortLen * 2 + i] + (buf[shortLen * 3 + i] * shortWindows[shortLen - 1 - i]) + (buf[shortLen * 4 + i] * shortWindows[i]);
  916. output[mid + 3 * shortLen + i] = overlap[mid + shortLen * 3 + i] + (buf[shortLen * 5 + i] * shortWindows[shortLen - 1 - i]) + (buf[shortLen * 6 + i] * shortWindows[i]);
  917. if (i < trans)
  918. output[mid + 4 * shortLen + i] = overlap[mid + shortLen * 4 + i] + (buf[shortLen * 7 + i] * shortWindows[shortLen - 1 - i]) + (buf[shortLen * 8 + i] * shortWindows[i]);
  919. }
  920. // window the second half and save as overlap for next frame
  921. for (var i = 0; i < shortLen; i++) {
  922. if(i >= trans)
  923. overlap[mid + 4 * shortLen + i - length] = (buf[shortLen * 7 + i] * shortWindows[shortLen - 1 - i]) + (buf[shortLen * 8 + i] * shortWindows[i]);
  924. overlap[mid + 5 * shortLen + i - length] = (buf[shortLen * 9 + i] * shortWindows[shortLen - 1 - i]) + (buf[shortLen * 10 + i] * shortWindows[i]);
  925. overlap[mid + 6 * shortLen + i - length] = (buf[shortLen * 11 + i] * shortWindows[shortLen - 1 - i]) + (buf[shortLen * 12 + i]*shortWindows[i]);
  926. overlap[mid + 7 * shortLen + i - length] = (buf[shortLen * 13 + i] * shortWindows[shortLen - 1 - i]) + (buf[shortLen * 14 + i]*shortWindows[i]);
  927. overlap[mid + 8 * shortLen + i - length] = (buf[shortLen * 15 + i] * shortWindows[shortLen - 1 - i]);
  928. }
  929. for (var i = 0; i < mid; i++) {
  930. overlap[mid + shortLen + i] = 0;
  931. }
  932. break;
  933. case ICStream.LONG_STOP_SEQUENCE:
  934. mdctLong.process(input, 0, buf, 0);
  935. // add second half output of previous frame to windowed output of current frame
  936. // construct first half window using padding with 1's and 0's
  937. for (var i = 0; i < mid; i++) {
  938. output[i] = overlap[i];
  939. }
  940. for (var i = 0; i < shortLen; i++) {
  941. output[mid + i] = overlap[mid + i] + (buf[mid + i] * shortWindowsPrev[i]);
  942. }
  943. for (var i = 0; i < mid; i++) {
  944. output[mid + shortLen + i] = overlap[mid + shortLen + i] + buf[mid + shortLen + i];
  945. }
  946. // window the second half and save as overlap for next frame
  947. for (var i = 0; i < length; i++) {
  948. overlap[i] = buf[length + i] * longWindows[length - 1 - i];
  949. }
  950. break;
  951. }
  952. };
  953. module.exports = FilterBank;
  954. },{"./ics":8,"./mdct":9}],7:[function(require,module,exports){
  955. /*
  956. * AAC.js - Advanced Audio Coding decoder in JavaScript
  957. * Created by Devon Govett
  958. * Copyright (c) 2012, Official.fm Labs
  959. *
  960. * AAC.js is free software; you can redistribute it and/or modify it
  961. * under the terms of the GNU Lesser General Public License as
  962. * published by the Free Software Foundation; either version 3 of the
  963. * License, or (at your option) any later version.
  964. *
  965. * AAC.js is distributed in the hope that it will be useful, but WITHOUT
  966. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  967. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
  968. * Public License for more details.
  969. *
  970. * You should have received a copy of the GNU Lesser General Public
  971. * License along with this library.
  972. * If not, see <http://www.gnu.org/licenses/>.
  973. */
  974. // [bit length, codeword, values...]
  975. const HCB1 = [
  976. [1, 0, 0, 0, 0, 0],
  977. [5, 16, 1, 0, 0, 0],
  978. [5, 17, -1, 0, 0, 0],
  979. [5, 18, 0, 0, 0, -1],
  980. [5, 19, 0, 1, 0, 0],
  981. [5, 20, 0, 0, 0, 1],
  982. [5, 21, 0, 0, -1, 0],
  983. [5, 22, 0, 0, 1, 0],
  984. [5, 23, 0, -1, 0, 0],
  985. [7, 96, 1, -1, 0, 0],
  986. [7, 97, -1, 1, 0, 0],
  987. [7, 98, 0, 0, -1, 1],
  988. [7, 99, 0, 1, -1, 0],
  989. [7, 100, 0, -1, 1, 0],
  990. [7, 101, 0, 0, 1, -1],
  991. [7, 102, 1, 1, 0, 0],
  992. [7, 103, 0, 0, -1, -1],
  993. [7, 104, -1, -1, 0, 0],
  994. [7, 105, 0, -1, -1, 0],
  995. [7, 106, 1, 0, -1, 0],
  996. [7, 107, 0, 1, 0, -1],
  997. [7, 108, -1, 0, 1, 0],
  998. [7, 109, 0, 0, 1, 1],
  999. [7, 110, 1, 0, 1, 0],
  1000. [7, 111, 0, -1, 0, 1],
  1001. [7, 112, 0, 1, 1, 0],
  1002. [7, 113, 0, 1, 0, 1],
  1003. [7, 114, -1, 0, -1, 0],
  1004. [7, 115, 1, 0, 0, 1],
  1005. [7, 116, -1, 0, 0, -1],
  1006. [7, 117, 1, 0, 0, -1],
  1007. [7, 118, -1, 0, 0, 1],
  1008. [7, 119, 0, -1, 0, -1],
  1009. [9, 480, 1, 1, -1, 0],
  1010. [9, 481, -1, 1, -1, 0],
  1011. [9, 482, 1, -1, 1, 0],
  1012. [9, 483, 0, 1, 1, -1],
  1013. [9, 484, 0, 1, -1, 1],
  1014. [9, 485, 0, -1, 1, 1],
  1015. [9, 486, 0, -1, 1, -1],
  1016. [9, 487, 1, -1, -1, 0],
  1017. [9, 488, 1, 0, -1, 1],
  1018. [9, 489, 0, 1, -1, -1],
  1019. [9, 490, -1, 1, 1, 0],
  1020. [9, 491, -1, 0, 1, -1],
  1021. [9, 492, -1, -1, 1, 0],
  1022. [9, 493, 0, -1, -1, 1],
  1023. [9, 494, 1, -1, 0, 1],
  1024. [9, 495, 1, -1, 0, -1],
  1025. [9, 496, -1, 1, 0, -1],
  1026. [9, 497, -1, -1, -1, 0],
  1027. [9, 498, 0, -1, -1, -1],
  1028. [9, 499, 0, 1, 1, 1],
  1029. [9, 500, 1, 0, 1, -1],
  1030. [9, 501, 1, 1, 0, 1],
  1031. [9, 502, -1, 1, 0, 1],
  1032. [9, 503, 1, 1, 1, 0],
  1033. [10, 1008, -1, -1, 0, 1],
  1034. [10, 1009, -1, 0, -1, -1],
  1035. [10, 1010, 1, 1, 0, -1],
  1036. [10, 1011, 1, 0, -1, -1],
  1037. [10, 1012, -1, 0, -1, 1],
  1038. [10, 1013, -1, -1, 0, -1],
  1039. [10, 1014, -1, 0, 1, 1],
  1040. [10, 1015, 1, 0, 1, 1],
  1041. [11, 2032, 1, -1, 1, -1],
  1042. [11, 2033, -1, 1, -1, 1],
  1043. [11, 2034, -1, 1, 1, -1],
  1044. [11, 2035, 1, -1, -1, 1],
  1045. [11, 2036, 1, 1, 1, 1],
  1046. [11, 2037, -1, -1, 1, 1],
  1047. [11, 2038, 1, 1, -1, -1],
  1048. [11, 2039, -1, -1, 1, -1],
  1049. [11, 2040, -1, -1, -1, -1],
  1050. [11, 2041, 1, 1, -1, 1],
  1051. [11, 2042, 1, -1, 1, 1],
  1052. [11, 2043, -1, 1, 1, 1],
  1053. [11, 2044, -1, 1, -1, -1],
  1054. [11, 2045, -1, -1, -1, 1],
  1055. [11, 2046, 1, -1, -1, -1],
  1056. [11, 2047, 1, 1, 1, -1]
  1057. ];
  1058. const HCB2 = [
  1059. [3, 0, 0, 0, 0, 0],
  1060. [4, 2, 1, 0, 0, 0],
  1061. [5, 6, -1, 0, 0, 0],
  1062. [5, 7, 0, 0, 0, 1],
  1063. [5, 8, 0, 0, -1, 0],
  1064. [5, 9, 0, 0, 0, -1],
  1065. [5, 10, 0, -1, 0, 0],
  1066. [5, 11, 0, 0, 1, 0],
  1067. [5, 12, 0, 1, 0, 0],
  1068. [6, 26, 0, -1, 1, 0],
  1069. [6, 27, -1, 1, 0, 0],
  1070. [6, 28, 0, 1, -1, 0],
  1071. [6, 29, 0, 0, 1, -1],
  1072. [6, 30, 0, 1, 0, -1],
  1073. [6, 31, 0, 0, -1, 1],
  1074. [6, 32, -1, 0, 0, -1],
  1075. [6, 33, 1, -1, 0, 0],
  1076. [6, 34, 1, 0, -1, 0],
  1077. [6, 35, -1, -1, 0, 0],
  1078. [6, 36, 0, 0, -1, -1],
  1079. [6, 37, 1, 0, 1, 0],
  1080. [6, 38, 1, 0, 0, 1],
  1081. [6, 39, 0, -1, 0, 1],
  1082. [6, 40, -1, 0, 1, 0],
  1083. [6, 41, 0, 1, 0, 1],
  1084. [6, 42, 0, -1, -1, 0],
  1085. [6, 43, -1, 0, 0, 1],
  1086. [6, 44, 0, -1, 0, -1],
  1087. [6, 45, -1, 0, -1, 0],
  1088. [6, 46, 1, 1, 0, 0],
  1089. [6, 47, 0, 1, 1, 0],
  1090. [6, 48, 0, 0, 1, 1],
  1091. [6, 49, 1, 0, 0, -1],
  1092. [7, 100, 0, 1, -1, 1],
  1093. [7, 101, 1, 0, -1, 1],
  1094. [7, 102, -1, 1, -1, 0],
  1095. [7, 103, 0, -1, 1, -1],
  1096. [7, 104, 1, -1, 1, 0],
  1097. [7, 105, 1, 1, 0, -1],
  1098. [7, 106, 1, 0, 1, 1],
  1099. [7, 107, -1, 1, 1, 0],
  1100. [7, 108, 0, -1, -1, 1],
  1101. [7, 109, 1, 1, 1, 0],
  1102. [7, 110, -1, 0, 1, -1],
  1103. [7, 111, -1, -1, -1, 0],
  1104. [7, 112, -1, 0, -1, 1],
  1105. [7, 113, 1, -1, -1, 0],
  1106. [7, 114, 1, 1, -1, 0],
  1107. [8, 230, 1, -1, 0, 1],
  1108. [8, 231, -1, 1, 0, -1],
  1109. [8, 232, -1, -1, 1, 0],
  1110. [8, 233, -1, 0, 1, 1],
  1111. [8, 234, -1, -1, 0, 1],
  1112. [8, 235, -1, -1, 0, -1],
  1113. [8, 236, 0, -1, -1, -1],
  1114. [8, 237, 1, 0, 1, -1],
  1115. [8, 238, 1, 0, -1, -1],
  1116. [8, 239, 0, 1, -1, -1],
  1117. [8, 240, 0, 1, 1, 1],
  1118. [8, 241, -1, 1, 0, 1],
  1119. [8, 242, -1, 0, -1, -1],
  1120. [8, 243, 0, 1, 1, -1],
  1121. [8, 244, 1, -1, 0, -1],
  1122. [8, 245, 0, -1, 1, 1],
  1123. [8, 246, 1, 1, 0, 1],
  1124. [8, 247, 1, -1, 1, -1],
  1125. [8, 248, -1, 1, -1, 1],
  1126. [9, 498, 1, -1, -1, 1],
  1127. [9, 499, -1, -1, -1, -1],
  1128. [9, 500, -1, 1, 1, -1],
  1129. [9, 501, -1, 1, 1, 1],
  1130. [9, 502, 1, 1, 1, 1],
  1131. [9, 503, -1, -1, 1, -1],
  1132. [9, 504, 1, -1, 1, 1],
  1133. [9, 505, -1, 1, -1, -1],
  1134. [9, 506, -1, -1, 1, 1],
  1135. [9, 507, 1, 1, -1, -1],
  1136. [9, 508, 1, -1, -1, -1],
  1137. [9, 509, -1, -1, -1, 1],
  1138. [9, 510, 1, 1, -1, 1],
  1139. [9, 511, 1, 1, 1, -1]
  1140. ];
  1141. const HCB3 = [
  1142. [1, 0, 0, 0, 0, 0],
  1143. [4, 8, 1, 0, 0, 0],
  1144. [4, 9, 0, 0, 0, 1],
  1145. [4, 10, 0, 1, 0, 0],
  1146. [4, 11, 0, 0, 1, 0],
  1147. [5, 24, 1, 1, 0, 0],
  1148. [5, 25, 0, 0, 1, 1],
  1149. [6, 52, 0, 1, 1, 0],
  1150. [6, 53, 0, 1, 0, 1],
  1151. [6, 54, 1, 0, 1, 0],
  1152. [6, 55, 0, 1, 1, 1],
  1153. [6, 56, 1, 0, 0, 1],
  1154. [6, 57, 1, 1, 1, 0],
  1155. [7, 116, 1, 1, 1, 1],
  1156. [7, 117, 1, 0, 1, 1],
  1157. [7, 118, 1, 1, 0, 1],
  1158. [8, 238, 2, 0, 0, 0],
  1159. [8, 239, 0, 0, 0, 2],
  1160. [8, 240, 0, 0, 1, 2],
  1161. [8, 241, 2, 1, 0, 0],
  1162. [8, 242, 1, 2, 1, 0],
  1163. [9, 486, 0, 0, 2, 1],
  1164. [9, 487, 0, 1, 2, 1],
  1165. [9, 488, 1, 2, 0, 0],
  1166. [9, 489, 0, 1, 1, 2],
  1167. [9, 490, 2, 1, 1, 0],
  1168. [9, 491, 0, 0, 2, 0],
  1169. [9, 492, 0, 2, 1, 0],
  1170. [9, 493, 0, 1, 2, 0],
  1171. [9, 494, 0, 2, 0, 0],
  1172. [9, 495, 0, 1, 0, 2],
  1173. [9, 496, 2, 0, 1, 0],
  1174. [9, 497, 1, 2, 1, 1],
  1175. [9, 498, 0, 2, 1, 1],
  1176. [9, 499, 1, 1, 2, 0],
  1177. [9, 500, 1, 1, 2, 1],
  1178. [10, 1002, 1, 2, 0, 1],
  1179. [10, 1003, 1, 0, 2, 0],
  1180. [10, 1004, 1, 0, 2, 1],
  1181. [10, 1005, 0, 2, 0, 1],
  1182. [10, 1006, 2, 1, 1, 1],
  1183. [10, 1007, 1, 1, 1, 2],
  1184. [10, 1008, 2, 1, 0, 1],
  1185. [10, 1009, 1, 0, 1, 2],
  1186. [10, 1010, 0, 0, 2, 2],
  1187. [10, 1011, 0, 1, 2, 2],
  1188. [10, 1012, 2, 2, 1, 0],
  1189. [10, 1013, 1, 2, 2, 0],
  1190. [10, 1014, 1, 0, 0, 2],
  1191. [10, 1015, 2, 0, 0, 1],
  1192. [10, 1016, 0, 2, 2, 1],
  1193. [11, 2034, 2, 2, 0, 0],
  1194. [11, 2035, 1, 2, 2, 1],
  1195. [11, 2036, 1, 1, 0, 2],
  1196. [11, 2037, 2, 0, 1, 1],
  1197. [11, 2038, 1, 1, 2, 2],
  1198. [11, 2039, 2, 2, 1, 1],
  1199. [11, 2040, 0, 2, 2, 0],
  1200. [11, 2041, 0, 2, 1, 2],
  1201. [12, 4084, 1, 0, 2, 2],
  1202. [12, 4085, 2, 2, 0, 1],
  1203. [12, 4086, 2, 1, 2, 0],
  1204. [12, 4087, 2, 2, 2, 0],
  1205. [12, 4088, 0, 2, 2, 2],
  1206. [12, 4089, 2, 2, 2, 1],
  1207. [12, 4090, 2, 1, 2, 1],
  1208. [12, 4091, 1, 2, 1, 2],
  1209. [12, 4092, 1, 2, 2, 2],
  1210. [13, 8186, 0, 2, 0, 2],
  1211. [13, 8187, 2, 0, 2, 0],
  1212. [13, 8188, 1, 2, 0, 2],
  1213. [14, 16378, 2, 0, 2, 1],
  1214. [14, 16379, 2, 1, 1, 2],
  1215. [14, 16380, 2, 1, 0, 2],
  1216. [15, 32762, 2, 2, 2, 2],
  1217. [15, 32763, 2, 2, 1, 2],
  1218. [15, 32764, 2, 1, 2, 2],
  1219. [15, 32765, 2, 0, 1, 2],
  1220. [15, 32766, 2, 0, 0, 2],
  1221. [16, 65534, 2, 2, 0, 2],
  1222. [16, 65535, 2, 0, 2, 2]
  1223. ];
  1224. const HCB4 = [
  1225. [4, 0, 1, 1, 1, 1],
  1226. [4, 1, 0, 1, 1, 1],
  1227. [4, 2, 1, 1, 0, 1],
  1228. [4, 3, 1, 1, 1, 0],
  1229. [4, 4, 1, 0, 1, 1],
  1230. [4, 5, 1, 0, 0, 0],
  1231. [4, 6, 1, 1, 0, 0],
  1232. [4, 7, 0, 0, 0, 0],
  1233. [4, 8, 0, 0, 1, 1],
  1234. [4, 9, 1, 0, 1, 0],
  1235. [5, 20, 1, 0, 0, 1],
  1236. [5, 21, 0, 1, 1, 0],
  1237. [5, 22, 0, 0, 0, 1],
  1238. [5, 23, 0, 1, 0, 1],
  1239. [5, 24, 0, 0, 1, 0],
  1240. [5, 25, 0, 1, 0, 0],
  1241. [7, 104, 2, 1, 1, 1],
  1242. [7, 105, 1, 1, 2, 1],
  1243. [7, 106, 1, 2, 1, 1],
  1244. [7, 107, 1, 1, 1, 2],
  1245. [7, 108, 2, 1, 1, 0],
  1246. [7, 109, 2, 1, 0, 1],
  1247. [7, 110, 1, 2, 1, 0],
  1248. [7, 111, 2, 0, 1, 1],
  1249. [7, 112, 0, 1, 2, 1],
  1250. [8, 226, 0, 1, 1, 2],
  1251. [8, 227, 1, 1, 2, 0],
  1252. [8, 228, 0, 2, 1, 1],
  1253. [8, 229, 1, 0, 1, 2],
  1254. [8, 230, 1, 2, 0, 1],
  1255. [8, 231, 1, 1, 0, 2],
  1256. [8, 232, 1, 0, 2, 1],
  1257. [8, 233, 2, 1, 0, 0],
  1258. [8, 234, 2, 0, 1, 0],
  1259. [8, 235, 1, 2, 0, 0],
  1260. [8, 236, 2, 0, 0, 1],
  1261. [8, 237, 0, 1, 0, 2],
  1262. [8, 238, 0, 2, 1, 0],
  1263. [8, 239, 0, 0, 1, 2],
  1264. [8, 240, 0, 1, 2, 0],
  1265. [8, 241, 0, 2, 0, 1],
  1266. [8, 242, 1, 0, 0, 2],
  1267. [8, 243, 0, 0, 2, 1],
  1268. [8, 244, 1, 0, 2, 0],
  1269. [8, 245, 2, 0, 0, 0],
  1270. [8, 246, 0, 0, 0, 2],
  1271. [9, 494, 0, 2, 0, 0],
  1272. [9, 495, 0, 0, 2, 0],
  1273. [9, 496, 1, 2, 2, 1],
  1274. [9, 497, 2, 2, 1, 1],
  1275. [9, 498, 2, 1, 2, 1],
  1276. [9, 499, 1, 1, 2, 2],
  1277. [9, 500, 1, 2, 1, 2],
  1278. [9, 501, 2, 1, 1, 2],
  1279. [10, 1004, 1, 2, 2, 0],
  1280. [10, 1005, 2, 2, 1, 0],
  1281. [10, 1006, 2, 1, 2, 0],
  1282. [10, 1007, 0, 2, 2, 1],
  1283. [10, 1008, 0, 1, 2, 2],
  1284. [10, 1009, 2, 2, 0, 1],
  1285. [10, 1010, 0, 2, 1, 2],
  1286. [10, 1011, 2, 0, 2, 1],
  1287. [10, 1012, 1, 0, 2, 2],
  1288. [10, 1013, 2, 2, 2, 1],
  1289. [10, 1014, 1, 2, 0, 2],
  1290. [10, 1015, 2, 0, 1, 2],
  1291. [10, 1016, 2, 1, 0, 2],
  1292. [10, 1017, 1, 2, 2, 2],
  1293. [11, 2036, 2, 1, 2, 2],
  1294. [11, 2037, 2, 2, 1, 2],
  1295. [11, 2038, 0, 2, 2, 0],
  1296. [11, 2039, 2, 2, 0, 0],
  1297. [11, 2040, 0, 0, 2, 2],
  1298. [11, 2041, 2, 0, 2, 0],
  1299. [11, 2042, 0, 2, 0, 2],
  1300. [11, 2043, 2, 0, 0, 2],
  1301. [11, 2044, 2, 2, 2, 2],
  1302. [11, 2045, 0, 2, 2, 2],
  1303. [11, 2046, 2, 2, 2, 0],
  1304. [12, 4094, 2, 2, 0, 2],
  1305. [12, 4095, 2, 0, 2, 2]
  1306. ];
  1307. const HCB5 = [
  1308. [1, 0, 0, 0],
  1309. [4, 8, -1, 0],
  1310. [4, 9, 1, 0],
  1311. [4, 10, 0, 1],
  1312. [4, 11, 0, -1],
  1313. [5, 24, 1, -1],
  1314. [5, 25, -1, 1],
  1315. [5, 26, -1, -1],
  1316. [5, 27, 1, 1],
  1317. [7, 112, -2, 0],
  1318. [7, 113, 0, 2],
  1319. [7, 114, 2, 0],
  1320. [7, 115, 0, -2],
  1321. [8, 232, -2, -1],
  1322. [8, 233, 2, 1],
  1323. [8, 234, -1, -2],
  1324. [8, 235, 1, 2],
  1325. [8, 236, -2, 1],
  1326. [8, 237, 2, -1],
  1327. [8, 238, -1, 2],
  1328. [8, 239, 1, -2],
  1329. [8, 240, -3, 0],
  1330. [8, 241, 3, 0],
  1331. [8, 242, 0, -3],
  1332. [8, 243, 0, 3],
  1333. [9, 488, -3, -1],
  1334. [9, 489, 1, 3],
  1335. [9, 490, 3, 1],
  1336. [9, 491, -1, -3],
  1337. [9, 492, -3, 1],
  1338. [9, 493, 3, -1],
  1339. [9, 494, 1, -3],
  1340. [9, 495, -1, 3],
  1341. [9, 496, -2, 2],
  1342. [9, 497, 2, 2],
  1343. [9, 498, -2, -2],
  1344. [9, 499, 2, -2],
  1345. [10, 1000, -3, -2],
  1346. [10, 1001, 3, -2],
  1347. [10, 1002, -2, 3],
  1348. [10, 1003, 2, -3],
  1349. [10, 1004, 3, 2],
  1350. [10, 1005, 2, 3],
  1351. [10, 1006, -3, 2],
  1352. [10, 1007, -2, -3],
  1353. [10, 1008, 0, -4],
  1354. [10, 1009, -4, 0],
  1355. [10, 1010, 4, 1],
  1356. [10, 1011, 4, 0],
  1357. [11, 2024, -4, -1],
  1358. [11, 2025, 0, 4],
  1359. [11, 2026, 4, -1],
  1360. [11, 2027, -1, -4],
  1361. [11, 2028, 1, 4],
  1362. [11, 2029, -1, 4],
  1363. [11, 2030, -4, 1],
  1364. [11, 2031, 1, -4],
  1365. [11, 2032, 3, -3],
  1366. [11, 2033, -3, -3],
  1367. [11, 2034, -3, 3],
  1368. [11, 2035, -2, 4],
  1369. [11, 2036, -4, -2],
  1370. [11, 2037, 4, 2],
  1371. [11, 2038, 2, -4],
  1372. [11, 2039, 2, 4],
  1373. [11, 2040, 3, 3],
  1374. [11, 2041, -4, 2],
  1375. [12, 4084, -2, -4],
  1376. [12, 4085, 4, -2],
  1377. [12, 4086, 3, -4],
  1378. [12, 4087, -4, -3],
  1379. [12, 4088, -4, 3],
  1380. [12, 4089, 3, 4],
  1381. [12, 4090, -3, 4],
  1382. [12, 4091, 4, 3],
  1383. [12, 4092, 4, -3],
  1384. [12, 4093, -3, -4],
  1385. [13, 8188, 4, -4],
  1386. [13, 8189, -4, 4],
  1387. [13, 8190, 4, 4],
  1388. [13, 8191, -4, -4]
  1389. ];
  1390. const HCB6 = [
  1391. [4, 0, 0, 0],
  1392. [4, 1, 1, 0],
  1393. [4, 2, 0, -1],
  1394. [4, 3, 0, 1],
  1395. [4, 4, -1, 0],
  1396. [4, 5, 1, 1],
  1397. [4, 6, -1, 1],
  1398. [4, 7, 1, -1],
  1399. [4, 8, -1, -1],
  1400. [6, 36, 2, -1],
  1401. [6, 37, 2, 1],
  1402. [6, 38, -2, 1],
  1403. [6, 39, -2, -1],
  1404. [6, 40, -2, 0],
  1405. [6, 41, -1, 2],
  1406. [6, 42, 2, 0],
  1407. [6, 43, 1, -2],
  1408. [6, 44, 1, 2],
  1409. [6, 45, 0, -2],
  1410. [6, 46, -1, -2],
  1411. [6, 47, 0, 2],
  1412. [6, 48, 2, -2],
  1413. [6, 49, -2, 2],
  1414. [6, 50, -2, -2],
  1415. [6, 51, 2, 2],
  1416. [7, 104, -3, 1],
  1417. [7, 105, 3, 1],
  1418. [7, 106, 3, -1],
  1419. [7, 107, -1, 3],
  1420. [7, 108, -3, -1],
  1421. [7, 109, 1, 3],
  1422. [7, 110, 1, -3],
  1423. [7, 111, -1, -3],
  1424. [7, 112, 3, 0],
  1425. [7, 113, -3, 0],
  1426. [7, 114, 0, -3],
  1427. [7, 115, 0, 3],
  1428. [7, 116, 3, 2],
  1429. [8, 234, -3, -2],
  1430. [8, 235, -2, 3],
  1431. [8, 236, 2, 3],
  1432. [8, 237, 3, -2],
  1433. [8, 238, 2, -3],
  1434. [8, 239, -2, -3],
  1435. [8, 240, -3, 2],
  1436. [8, 241, 3, 3],
  1437. [9, 484, 3, -3],
  1438. [9, 485, -3, -3],
  1439. [9, 486, -3, 3],
  1440. [9, 487, 1, -4],
  1441. [9, 488, -1, -4],
  1442. [9, 489, 4, 1],
  1443. [9, 490, -4, 1],
  1444. [9, 491, -4, -1],
  1445. [9, 492, 1, 4],
  1446. [9, 493, 4, -1],
  1447. [9, 494, -1, 4],
  1448. [9, 495, 0, -4],
  1449. [9, 496, -4, 2],
  1450. [9, 497, -4, -2],
  1451. [9, 498, 2, 4],
  1452. [9, 499, -2, -4],
  1453. [9, 500, -4, 0],
  1454. [9, 501, 4, 2],
  1455. [9, 502, 4, -2],
  1456. [9, 503, -2, 4],
  1457. [9, 504, 4, 0],
  1458. [9, 505, 2, -4],
  1459. [9, 506, 0, 4],
  1460. [10, 1014, -3, -4],
  1461. [10, 1015, -3, 4],
  1462. [10, 1016, 3, -4],
  1463. [10, 1017, 4, -3],
  1464. [10, 1018, 3, 4],
  1465. [10, 1019, 4, 3],
  1466. [10, 1020, -4, 3],
  1467. [10, 1021, -4, -3],
  1468. [11, 2044, 4, 4],
  1469. [11, 2045, -4, 4],
  1470. [11, 2046, -4, -4],
  1471. [11, 2047, 4, -4]
  1472. ];
  1473. const HCB7 = [
  1474. [1, 0, 0, 0],
  1475. [3, 4, 1, 0],
  1476. [3, 5, 0, 1],
  1477. [4, 12, 1, 1],
  1478. [6, 52, 2, 1],
  1479. [6, 53, 1, 2],
  1480. [6, 54, 2, 0],
  1481. [6, 55, 0, 2],
  1482. [7, 112, 3, 1],
  1483. [7, 113, 1, 3],
  1484. [7, 114, 2, 2],
  1485. [7, 115, 3, 0],
  1486. [7, 116, 0, 3],
  1487. [8, 234, 2, 3],
  1488. [8, 235, 3, 2],
  1489. [8, 236, 1, 4],
  1490. [8, 237, 4, 1],
  1491. [8, 238, 1, 5],
  1492. [8, 239, 5, 1],
  1493. [8, 240, 3, 3],
  1494. [8, 241, 2, 4],
  1495. [8, 242, 0, 4],
  1496. [8, 243, 4, 0],
  1497. [9, 488, 4, 2],
  1498. [9, 489, 2, 5],
  1499. [9, 490, 5, 2],
  1500. [9, 491, 0, 5],
  1501. [9, 492, 6, 1],
  1502. [9, 493, 5, 0],
  1503. [9, 494, 1, 6],
  1504. [9, 495, 4, 3],
  1505. [9, 496, 3, 5],
  1506. [9, 497, 3, 4],
  1507. [9, 498, 5, 3],
  1508. [9, 499, 2, 6],
  1509. [9, 500, 6, 2],
  1510. [9, 501, 1, 7],
  1511. [10, 1004, 3, 6],
  1512. [10, 1005, 0, 6],
  1513. [10, 1006, 6, 0],
  1514. [10, 1007, 4, 4],
  1515. [10, 1008, 7, 1],
  1516. [10, 1009, 4, 5],
  1517. [10, 1010, 7, 2],
  1518. [10, 1011, 5, 4],
  1519. [10, 1012, 6, 3],
  1520. [10, 1013, 2, 7],
  1521. [10, 1014, 7, 3],
  1522. [10, 1015, 6, 4],
  1523. [10, 1016, 5, 5],
  1524. [10, 1017, 4, 6],
  1525. [10, 1018, 3, 7],
  1526. [11, 2038, 7, 0],
  1527. [11, 2039, 0, 7],
  1528. [11, 2040, 6, 5],
  1529. [11, 2041, 5, 6],
  1530. [11, 2042, 7, 4],
  1531. [11, 2043, 4, 7],
  1532. [11, 2044, 5, 7],
  1533. [11, 2045, 7, 5],
  1534. [12, 4092, 7, 6],
  1535. [12, 4093, 6, 6],
  1536. [12, 4094, 6, 7],
  1537. [12, 4095, 7, 7]
  1538. ];
  1539. const HCB8 = [
  1540. [3, 0, 1, 1],
  1541. [4, 2, 2, 1],
  1542. [4, 3, 1, 0],
  1543. [4, 4, 1, 2],
  1544. [4, 5, 0, 1],
  1545. [4, 6, 2, 2],
  1546. [5, 14, 0, 0],
  1547. [5, 15, 2, 0],
  1548. [5, 16, 0, 2],
  1549. [5, 17, 3, 1],
  1550. [5, 18, 1, 3],
  1551. [5, 19, 3, 2],
  1552. [5, 20, 2, 3],
  1553. [6, 42, 3, 3],
  1554. [6, 43, 4, 1],
  1555. [6, 44, 1, 4],
  1556. [6, 45, 4, 2],
  1557. [6, 46, 2, 4],
  1558. [6, 47, 3, 0],
  1559. [6, 48, 0, 3],
  1560. [6, 49, 4, 3],
  1561. [6, 50, 3, 4],
  1562. [6, 51, 5, 2],
  1563. [7, 104, 5, 1],
  1564. [7, 105, 2, 5],
  1565. [7, 106, 1, 5],
  1566. [7, 107, 5, 3],
  1567. [7, 108, 3, 5],
  1568. [7, 109, 4, 4],
  1569. [7, 110, 5, 4],
  1570. [7, 111, 0, 4],
  1571. [7, 112, 4, 5],
  1572. [7, 113, 4, 0],
  1573. [7, 114, 2, 6],
  1574. [7, 115, 6, 2],
  1575. [7, 116, 6, 1],
  1576. [7, 117, 1, 6],
  1577. [8, 236, 3, 6],
  1578. [8, 237, 6, 3],
  1579. [8, 238, 5, 5],
  1580. [8, 239, 5, 0],
  1581. [8, 240, 6, 4],
  1582. [8, 241, 0, 5],
  1583. [8, 242, 4, 6],
  1584. [8, 243, 7, 1],
  1585. [8, 244, 7, 2],
  1586. [8, 245, 2, 7],
  1587. [8, 246, 6, 5],
  1588. [8, 247, 7, 3],
  1589. [8, 248, 1, 7],
  1590. [8, 249, 5, 6],
  1591. [8, 250, 3, 7],
  1592. [9, 502, 6, 6],
  1593. [9, 503, 7, 4],
  1594. [9, 504, 6, 0],
  1595. [9, 505, 4, 7],
  1596. [9, 506, 0, 6],
  1597. [9, 507, 7, 5],
  1598. [9, 508, 7, 6],
  1599. [9, 509, 6, 7],
  1600. [10, 1020, 5, 7],
  1601. [10, 1021, 7, 0],
  1602. [10, 1022, 0, 7],
  1603. [10, 1023, 7, 7]
  1604. ];
  1605. const HCB9 = [
  1606. [1, 0, 0, 0],
  1607. [3, 4, 1, 0],
  1608. [3, 5, 0, 1],
  1609. [4, 12, 1, 1],
  1610. [6, 52, 2, 1],
  1611. [6, 53, 1, 2],
  1612. [6, 54, 2, 0],
  1613. [6, 55, 0, 2],
  1614. [7, 112, 3, 1],
  1615. [7, 113, 2, 2],
  1616. [7, 114, 1, 3],
  1617. [8, 230, 3, 0],
  1618. [8, 231, 0, 3],
  1619. [8, 232, 2, 3],
  1620. [8, 233, 3, 2],
  1621. [8, 234, 1, 4],
  1622. [8, 235, 4, 1],
  1623. [8, 236, 2, 4],
  1624. [8, 237, 1, 5],
  1625. [9, 476, 4, 2],
  1626. [9, 477, 3, 3],
  1627. [9, 478, 0, 4],
  1628. [9, 479, 4, 0],
  1629. [9, 480, 5, 1],
  1630. [9, 481, 2, 5],
  1631. [9, 482, 1, 6],
  1632. [9, 483, 3, 4],
  1633. [9, 484, 5, 2],
  1634. [9, 485, 6, 1],
  1635. [9, 486, 4, 3],
  1636. [10, 974, 0, 5],
  1637. [10, 975, 2, 6],
  1638. [10, 976, 5, 0],
  1639. [10, 977, 1, 7],
  1640. [10, 978, 3, 5],
  1641. [10, 979, 1, 8],
  1642. [10, 980, 8, 1],
  1643. [10, 981, 4, 4],
  1644. [10, 982, 5, 3],
  1645. [10, 983, 6, 2],
  1646. [10, 984, 7, 1],
  1647. [10, 985, 0, 6],
  1648. [10, 986, 8, 2],
  1649. [10, 987, 2, 8],
  1650. [10, 988, 3, 6],
  1651. [10, 989, 2, 7],
  1652. [10, 990, 4, 5],
  1653. [10, 991, 9, 1],
  1654. [10, 992, 1, 9],
  1655. [10, 993, 7, 2],
  1656. [11, 1988, 6, 0],
  1657. [11, 1989, 5, 4],
  1658. [11, 1990, 6, 3],
  1659. [11, 1991, 8, 3],
  1660. [11, 1992, 0, 7],
  1661. [11, 1993, 9, 2],
  1662. [11, 1994, 3, 8],
  1663. [11, 1995, 4, 6],
  1664. [11, 1996, 3, 7],
  1665. [11, 1997, 0, 8],
  1666. [11, 1998, 10, 1],
  1667. [11, 1999, 6, 4],
  1668. [11, 2000, 2, 9],
  1669. [11, 2001, 5, 5],
  1670. [11, 2002, 8, 0],
  1671. [11, 2003, 7, 0],
  1672. [11, 2004, 7, 3],
  1673. [11, 2005, 10, 2],
  1674. [11, 2006, 9, 3],
  1675. [11, 2007, 8, 4],
  1676. [11, 2008, 1, 10],
  1677. [11, 2009, 7, 4],
  1678. [11, 2010, 6, 5],
  1679. [11, 2011, 5, 6],
  1680. [11, 2012, 4, 8],
  1681. [11, 2013, 4, 7],
  1682. [11, 2014, 3, 9],
  1683. [11, 2015, 11, 1],
  1684. [11, 2016, 5, 8],
  1685. [11, 2017, 9, 0],
  1686. [11, 2018, 8, 5],
  1687. [12, 4038, 10, 3],
  1688. [12, 4039, 2, 10],
  1689. [12, 4040, 0, 9],
  1690. [12, 4041, 11, 2],
  1691. [12, 4042, 9, 4],
  1692. [12, 4043, 6, 6],
  1693. [12, 4044, 12, 1],
  1694. [12, 4045, 4, 9],
  1695. [12, 4046, 8, 6],
  1696. [12, 4047, 1, 11],
  1697. [12, 4048, 9, 5],
  1698. [12, 4049, 10, 4],
  1699. [12, 4050, 5, 7],
  1700. [12, 4051, 7, 5],
  1701. [12, 4052, 2, 11],
  1702. [12, 4053, 1, 12],
  1703. [12, 4054, 12, 2],
  1704. [12, 4055, 11, 3],
  1705. [12, 4056, 3, 10],
  1706. [12, 4057, 5, 9],
  1707. [12, 4058, 6, 7],
  1708. [12, 4059, 8, 7],
  1709. [12, 4060, 11, 4],
  1710. [12, 4061, 0, 10],
  1711. [12, 4062, 7, 6],
  1712. [12, 4063, 12, 3],
  1713. [12, 4064, 10, 0],
  1714. [12, 4065, 10, 5],
  1715. [12, 4066, 4, 10],
  1716. [12, 4067, 6, 8],
  1717. [12, 4068, 2, 12],
  1718. [12, 4069, 9, 6],
  1719. [12, 4070, 9, 7],
  1720. [12, 4071, 4, 11],
  1721. [12, 4072, 11, 0],
  1722. [12, 4073, 6, 9],
  1723. [12, 4074, 3, 11],
  1724. [12, 4075, 5, 10],
  1725. [13, 8152, 8, 8],
  1726. [13, 8153, 7, 8],
  1727. [13, 8154, 12, 5],
  1728. [13, 8155, 3, 12],
  1729. [13, 8156, 11, 5],
  1730. [13, 8157, 7, 7],
  1731. [13, 8158, 12, 4],
  1732. [13, 8159, 11, 6],
  1733. [13, 8160, 10, 6],
  1734. [13, 8161, 4, 12],
  1735. [13, 8162, 7, 9],
  1736. [13, 8163, 5, 11],
  1737. [13, 8164, 0, 11],
  1738. [13, 8165, 12, 6],
  1739. [13, 8166, 6, 10],
  1740. [13, 8167, 12, 0],
  1741. [13, 8168, 10, 7],
  1742. [13, 8169, 5, 12],
  1743. [13, 8170, 7, 10],
  1744. [13, 8171, 9, 8],
  1745. [13, 8172, 0, 12],
  1746. [13, 8173, 11, 7],
  1747. [13, 8174, 8, 9],
  1748. [13, 8175, 9, 9],
  1749. [13, 8176, 10, 8],
  1750. [13, 8177, 7, 11],
  1751. [13, 8178, 12, 7],
  1752. [13, 8179, 6, 11],
  1753. [13, 8180, 8, 11],
  1754. [13, 8181, 11, 8],
  1755. [13, 8182, 7, 12],
  1756. [13, 8183, 6, 12],
  1757. [14, 16368, 8, 10],
  1758. [14, 16369, 10, 9],
  1759. [14, 16370, 8, 12],
  1760. [14, 16371, 9, 10],
  1761. [14, 16372, 9, 11],
  1762. [14, 16373, 9, 12],
  1763. [14, 16374, 10, 11],
  1764. [14, 16375, 12, 9],
  1765. [14, 16376, 10, 10],
  1766. [14, 16377, 11, 9],
  1767. [14, 16378, 12, 8],
  1768. [14, 16379, 11, 10],
  1769. [14, 16380, 12, 10],
  1770. [14, 16381, 12, 11],
  1771. [15, 32764, 10, 12],
  1772. [15, 32765, 11, 11],
  1773. [15, 32766, 11, 12],
  1774. [15, 32767, 12, 12]
  1775. ];
  1776. const HCB10 = [
  1777. [4, 0, 1, 1],
  1778. [4, 1, 1, 2],
  1779. [4, 2, 2, 1],
  1780. [5, 6, 2, 2],
  1781. [5, 7, 1, 0],
  1782. [5, 8, 0, 1],
  1783. [5, 9, 1, 3],
  1784. [5, 10, 3, 2],
  1785. [5, 11, 3, 1],
  1786. [5, 12, 2, 3],
  1787. [5, 13, 3, 3],
  1788. [6, 28, 2, 0],
  1789. [6, 29, 0, 2],
  1790. [6, 30, 2, 4],
  1791. [6, 31, 4, 2],
  1792. [6, 32, 1, 4],
  1793. [6, 33, 4, 1],
  1794. [6, 34, 0, 0],
  1795. [6, 35, 4, 3],
  1796. [6, 36, 3, 4],
  1797. [6, 37, 3, 0],
  1798. [6, 38, 0, 3],
  1799. [6, 39, 4, 4],
  1800. [6, 40, 2, 5],
  1801. [6, 41, 5, 2],
  1802. [7, 84, 1, 5],
  1803. [7, 85, 5, 1],
  1804. [7, 86, 5, 3],
  1805. [7, 87, 3, 5],
  1806. [7, 88, 5, 4],
  1807. [7, 89, 4, 5],
  1808. [7, 90, 6, 2],
  1809. [7, 91, 2, 6],
  1810. [7, 92, 6, 3],
  1811. [7, 93, 4, 0],
  1812. [7, 94, 6, 1],
  1813. [7, 95, 0, 4],
  1814. [7, 96, 1, 6],
  1815. [7, 97, 3, 6],
  1816. [7, 98, 5, 5],
  1817. [7, 99, 6, 4],
  1818. [7, 100, 4, 6],
  1819. [8, 202, 6, 5],
  1820. [8, 203, 7, 2],
  1821. [8, 204, 3, 7],
  1822. [8, 205, 2, 7],
  1823. [8, 206, 5, 6],
  1824. [8, 207, 8, 2],
  1825. [8, 208, 7, 3],
  1826. [8, 209, 5, 0],
  1827. [8, 210, 7, 1],
  1828. [8, 211, 0, 5],
  1829. [8, 212, 8, 1],
  1830. [8, 213, 1, 7],
  1831. [8, 214, 8, 3],
  1832. [8, 215, 7, 4],
  1833. [8, 216, 4, 7],
  1834. [8, 217, 2, 8],
  1835. [8, 218, 6, 6],
  1836. [8, 219, 7, 5],
  1837. [8, 220, 1, 8],
  1838. [8, 221, 3, 8],
  1839. [8, 222, 8, 4],
  1840. [8, 223, 4, 8],
  1841. [8, 224, 5, 7],
  1842. [8, 225, 8, 5],
  1843. [8, 226, 5, 8],
  1844. [9, 454, 7, 6],
  1845. [9, 455, 6, 7],
  1846. [9, 456, 9, 2],
  1847. [9, 457, 6, 0],
  1848. [9, 458, 6, 8],
  1849. [9, 459, 9, 3],
  1850. [9, 460, 3, 9],
  1851. [9, 461, 9, 1],
  1852. [9, 462, 2, 9],
  1853. [9, 463, 0, 6],
  1854. [9, 464, 8, 6],
  1855. [9, 465, 9, 4],
  1856. [9, 466, 4, 9],
  1857. [9, 467, 10, 2],
  1858. [9, 468, 1, 9],
  1859. [9, 469, 7, 7],
  1860. [9, 470, 8, 7],
  1861. [9, 471, 9, 5],
  1862. [9, 472, 7, 8],
  1863. [9, 473, 10, 3],
  1864. [9, 474, 5, 9],
  1865. [9, 475, 10, 4],
  1866. [9, 476, 2, 10],
  1867. [9, 477, 10, 1],
  1868. [9, 478, 3, 10],
  1869. [9, 479, 9, 6],
  1870. [9, 480, 6, 9],
  1871. [9, 481, 8, 0],
  1872. [9, 482, 4, 10],
  1873. [9, 483, 7, 0],
  1874. [9, 484, 11, 2],
  1875. [10, 970, 7, 9],
  1876. [10, 971, 11, 3],
  1877. [10, 972, 10, 6],
  1878. [10, 973, 1, 10],
  1879. [10, 974, 11, 1],
  1880. [10, 975, 9, 7],
  1881. [10, 976, 0, 7],
  1882. [10, 977, 8, 8],
  1883. [10, 978, 10, 5],
  1884. [10, 979, 3, 11],
  1885. [10, 980, 5, 10],
  1886. [10, 981, 8, 9],
  1887. [10, 982, 11, 5],
  1888. [10, 983, 0, 8],
  1889. [10, 984, 11, 4],
  1890. [10, 985, 2, 11],
  1891. [10, 986, 7, 10],
  1892. [10, 987, 6, 10],
  1893. [10, 988, 10, 7],
  1894. [10, 989, 4, 11],
  1895. [10, 990, 1, 11],
  1896. [10, 991, 12, 2],
  1897. [10, 992, 9, 8],
  1898. [10, 993, 12, 3],
  1899. [10, 994, 11, 6],
  1900. [10, 995, 5, 11],
  1901. [10, 996, 12, 4],
  1902. [10, 997, 11, 7],
  1903. [10, 998, 12, 5],
  1904. [10, 999, 3, 12],
  1905. [10, 1000, 6, 11],
  1906. [10, 1001, 9, 0],
  1907. [10, 1002, 10, 8],
  1908. [10, 1003, 10, 0],
  1909. [10, 1004, 12, 1],
  1910. [10, 1005, 0, 9],
  1911. [10, 1006, 4, 12],
  1912. [10, 1007, 9, 9],
  1913. [10, 1008, 12, 6],
  1914. [10, 1009, 2, 12],
  1915. [10, 1010, 8, 10],
  1916. [11, 2022, 9, 10],
  1917. [11, 2023, 1, 12],
  1918. [11, 2024, 11, 8],
  1919. [11, 2025, 12, 7],
  1920. [11, 2026, 7, 11],
  1921. [11, 2027, 5, 12],
  1922. [11, 2028, 6, 12],
  1923. [11, 2029, 10, 9],
  1924. [11, 2030, 8, 11],
  1925. [11, 2031, 12, 8],
  1926. [11, 2032, 0, 10],
  1927. [11, 2033, 7, 12],
  1928. [11, 2034, 11, 0],
  1929. [11, 2035, 10, 10],
  1930. [11, 2036, 11, 9],
  1931. [11, 2037, 11, 10],
  1932. [11, 2038, 0, 11],
  1933. [11, 2039, 11, 11],
  1934. [11, 2040, 9, 11],
  1935. [11, 2041, 10, 11],
  1936. [11, 2042, 12, 0],
  1937. [11, 2043, 8, 12],
  1938. [12, 4088, 12, 9],
  1939. [12, 4089, 10, 12],
  1940. [12, 4090, 9, 12],
  1941. [12, 4091, 11, 12],
  1942. [12, 4092, 12, 11],
  1943. [12, 4093, 0, 12],
  1944. [12, 4094, 12, 10],
  1945. [12, 4095, 12, 12]
  1946. ];
  1947. const HCB11 = [
  1948. [4, 0, 0, 0],
  1949. [4, 1, 1, 1],
  1950. [5, 4, 16, 16],
  1951. [5, 5, 1, 0],
  1952. [5, 6, 0, 1],
  1953. [5, 7, 2, 1],
  1954. [5, 8, 1, 2],
  1955. [5, 9, 2, 2],
  1956. [6, 20, 1, 3],
  1957. [6, 21, 3, 1],
  1958. [6, 22, 3, 2],
  1959. [6, 23, 2, 0],
  1960. [6, 24, 2, 3],
  1961. [6, 25, 0, 2],
  1962. [6, 26, 3, 3],
  1963. [7, 54, 4, 1],
  1964. [7, 55, 1, 4],
  1965. [7, 56, 4, 2],
  1966. [7, 57, 2, 4],
  1967. [7, 58, 4, 3],
  1968. [7, 59, 3, 4],
  1969. [7, 60, 3, 0],
  1970. [7, 61, 0, 3],
  1971. [7, 62, 5, 1],
  1972. [7, 63, 5, 2],
  1973. [7, 64, 2, 5],
  1974. [7, 65, 4, 4],
  1975. [7, 66, 1, 5],
  1976. [7, 67, 5, 3],
  1977. [7, 68, 3, 5],
  1978. [7, 69, 5, 4],
  1979. [8, 140, 4, 5],
  1980. [8, 141, 6, 2],
  1981. [8, 142, 2, 6],
  1982. [8, 143, 6, 1],
  1983. [8, 144, 6, 3],
  1984. [8, 145, 3, 6],
  1985. [8, 146, 1, 6],
  1986. [8, 147, 4, 16],
  1987. [8, 148, 3, 16],
  1988. [8, 149, 16, 5],
  1989. [8, 150, 16, 3],
  1990. [8, 151, 16, 4],
  1991. [8, 152, 6, 4],
  1992. [8, 153, 16, 6],
  1993. [8, 154, 4, 0],
  1994. [8, 155, 4, 6],
  1995. [8, 156, 0, 4],
  1996. [8, 157, 2, 16],
  1997. [8, 158, 5, 5],
  1998. [8, 159, 5, 16],
  1999. [8, 160, 16, 7],
  2000. [8, 161, 16, 2],
  2001. [8, 162, 16, 8],
  2002. [8, 163, 2, 7],
  2003. [8, 164, 7, 2],
  2004. [8, 165, 3, 7],
  2005. [8, 166, 6, 5],
  2006. [8, 167, 5, 6],
  2007. [8, 168, 6, 16],
  2008. [8, 169, 16, 10],
  2009. [8, 170, 7, 3],
  2010. [8, 171, 7, 1],
  2011. [8, 172, 16, 9],
  2012. [8, 173, 7, 16],
  2013. [8, 174, 1, 16],
  2014. [8, 175, 1, 7],
  2015. [8, 176, 4, 7],
  2016. [8, 177, 16, 11],
  2017. [8, 178, 7, 4],
  2018. [8, 179, 16, 12],
  2019. [8, 180, 8, 16],
  2020. [8, 181, 16, 1],
  2021. [8, 182, 6, 6],
  2022. [8, 183, 9, 16],
  2023. [8, 184, 2, 8],
  2024. [8, 185, 5, 7],
  2025. [8, 186, 10, 16],
  2026. [8, 187, 16, 13],
  2027. [8, 188, 8, 3],
  2028. [8, 189, 8, 2],
  2029. [8, 190, 3, 8],
  2030. [8, 191, 5, 0],
  2031. [8, 192, 16, 14],
  2032. [8, 193, 11, 16],
  2033. [8, 194, 7, 5],
  2034. [8, 195, 4, 8],
  2035. [8, 196, 6, 7],
  2036. [8, 197, 7, 6],
  2037. [8, 198, 0, 5],
  2038. [9, 398, 8, 4],
  2039. [9, 399, 16, 15],
  2040. [9, 400, 12, 16],
  2041. [9, 401, 1, 8],
  2042. [9, 402, 8, 1],
  2043. [9, 403, 14, 16],
  2044. [9, 404, 5, 8],
  2045. [9, 405, 13, 16],
  2046. [9, 406, 3, 9],
  2047. [9, 407, 8, 5],
  2048. [9, 408, 7, 7],
  2049. [9, 409, 2, 9],
  2050. [9, 410, 8, 6],
  2051. [9, 411, 9, 2],
  2052. [9, 412, 9, 3],
  2053. [9, 413, 15, 16],
  2054. [9, 414, 4, 9],
  2055. [9, 415, 6, 8],
  2056. [9, 416, 6, 0],
  2057. [9, 417, 9, 4],
  2058. [9, 418, 5, 9],
  2059. [9, 419, 8, 7],
  2060. [9, 420, 7, 8],
  2061. [9, 421, 1, 9],
  2062. [9, 422, 10, 3],
  2063. [9, 423, 0, 6],
  2064. [9, 424, 10, 2],
  2065. [9, 425, 9, 1],
  2066. [9, 426, 9, 5],
  2067. [9, 427, 4, 10],
  2068. [9, 428, 2, 10],
  2069. [9, 429, 9, 6],
  2070. [9, 430, 3, 10],
  2071. [9, 431, 6, 9],
  2072. [9, 432, 10, 4],
  2073. [9, 433, 8, 8],
  2074. [9, 434, 10, 5],
  2075. [9, 435, 9, 7],
  2076. [9, 436, 11, 3],
  2077. [9, 437, 1, 10],
  2078. [9, 438, 7, 0],
  2079. [9, 439, 10, 6],
  2080. [9, 440, 7, 9],
  2081. [9, 441, 3, 11],
  2082. [9, 442, 5, 10],
  2083. [9, 443, 10, 1],
  2084. [9, 444, 4, 11],
  2085. [9, 445, 11, 2],
  2086. [9, 446, 13, 2],
  2087. [9, 447, 6, 10],
  2088. [9, 448, 13, 3],
  2089. [9, 449, 2, 11],
  2090. [9, 450, 16, 0],
  2091. [9, 451, 5, 11],
  2092. [9, 452, 11, 5],
  2093. [10, 906, 11, 4],
  2094. [10, 907, 9, 8],
  2095. [10, 908, 7, 10],
  2096. [10, 909, 8, 9],
  2097. [10, 910, 0, 16],
  2098. [10, 911, 4, 13],
  2099. [10, 912, 0, 7],
  2100. [10, 913, 3, 13],
  2101. [10, 914, 11, 6],
  2102. [10, 915, 13, 1],
  2103. [10, 916, 13, 4],
  2104. [10, 917, 12, 3],
  2105. [10, 918, 2, 13],
  2106. [10, 919, 13, 5],
  2107. [10, 920, 8, 10],
  2108. [10, 921, 6, 11],
  2109. [10, 922, 10, 8],
  2110. [10, 923, 10, 7],
  2111. [10, 924, 14, 2],
  2112. [10, 925, 12, 4],
  2113. [10, 926, 1, 11],
  2114. [10, 927, 4, 12],
  2115. [10, 928, 11, 1],
  2116. [10, 929, 3, 12],
  2117. [10, 930, 1, 13],
  2118. [10, 931, 12, 2],
  2119. [10, 932, 7, 11],
  2120. [10, 933, 3, 14],
  2121. [10, 934, 5, 12],
  2122. [10, 935, 5, 13],
  2123. [10, 936, 14, 4],
  2124. [10, 937, 4, 14],
  2125. [10, 938, 11, 7],
  2126. [10, 939, 14, 3],
  2127. [10, 940, 12, 5],
  2128. [10, 941, 13, 6],
  2129. [10, 942, 12, 6],
  2130. [10, 943, 8, 0],
  2131. [10, 944, 11, 8],
  2132. [10, 945, 2, 12],
  2133. [10, 946, 9, 9],
  2134. [10, 947, 14, 5],
  2135. [10, 948, 6, 13],
  2136. [10, 949, 10, 10],
  2137. [10, 950, 15, 2],
  2138. [10, 951, 8, 11],
  2139. [10, 952, 9, 10],
  2140. [10, 953, 14, 6],
  2141. [10, 954, 10, 9],
  2142. [10, 955, 5, 14],
  2143. [10, 956, 11, 9],
  2144. [10, 957, 14, 1],
  2145. [10, 958, 2, 14],
  2146. [10, 959, 6, 12],
  2147. [10, 960, 1, 12],
  2148. [10, 961, 13, 8],
  2149. [10, 962, 0, 8],
  2150. [10, 963, 13, 7],
  2151. [10, 964, 7, 12],
  2152. [10, 965, 12, 7],
  2153. [10, 966, 7, 13],
  2154. [10, 967, 15, 3],
  2155. [10, 968, 12, 1],
  2156. [10, 969, 6, 14],
  2157. [10, 970, 2, 15],
  2158. [10, 971, 15, 5],
  2159. [10, 972, 15, 4],
  2160. [10, 973, 1, 14],
  2161. [10, 974, 9, 11],
  2162. [10, 975, 4, 15],
  2163. [10, 976, 14, 7],
  2164. [10, 977, 8, 13],
  2165. [10, 978, 13, 9],
  2166. [10, 979, 8, 12],
  2167. [10, 980, 5, 15],
  2168. [10, 981, 3, 15],
  2169. [10, 982, 10, 11],
  2170. [10, 983, 11, 10],
  2171. [10, 984, 12, 8],
  2172. [10, 985, 15, 6],
  2173. [10, 986, 15, 7],
  2174. [10, 987, 8, 14],
  2175. [10, 988, 15, 1],
  2176. [10, 989, 7, 14],
  2177. [10, 990, 9, 0],
  2178. [10, 991, 0, 9],
  2179. [10, 992, 9, 13],
  2180. [10, 993, 9, 12],
  2181. [10, 994, 12, 9],
  2182. [10, 995, 14, 8],
  2183. [10, 996, 10, 13],
  2184. [10, 997, 14, 9],
  2185. [10, 998, 12, 10],
  2186. [10, 999, 6, 15],
  2187. [10, 1000, 7, 15],
  2188. [11, 2002, 9, 14],
  2189. [11, 2003, 15, 8],
  2190. [11, 2004, 11, 11],
  2191. [11, 2005, 11, 14],
  2192. [11, 2006, 1, 15],
  2193. [11, 2007, 10, 12],
  2194. [11, 2008, 10, 14],
  2195. [11, 2009, 13, 11],
  2196. [11, 2010, 13, 10],
  2197. [11, 2011, 11, 13],
  2198. [11, 2012, 11, 12],
  2199. [11, 2013, 8, 15],
  2200. [11, 2014, 14, 11],
  2201. [11, 2015, 13, 12],
  2202. [11, 2016, 12, 13],
  2203. [11, 2017, 15, 9],
  2204. [11, 2018, 14, 10],
  2205. [11, 2019, 10, 0],
  2206. [11, 2020, 12, 11],
  2207. [11, 2021, 9, 15],
  2208. [11, 2022, 0, 10],
  2209. [11, 2023, 12, 12],
  2210. [11, 2024, 11, 0],
  2211. [11, 2025, 12, 14],
  2212. [11, 2026, 10, 15],
  2213. [11, 2027, 13, 13],
  2214. [11, 2028, 0, 13],
  2215. [11, 2029, 14, 12],
  2216. [11, 2030, 15, 10],
  2217. [11, 2031, 15, 11],
  2218. [11, 2032, 11, 15],
  2219. [11, 2033, 14, 13],
  2220. [11, 2034, 13, 0],
  2221. [11, 2035, 0, 11],
  2222. [11, 2036, 13, 14],
  2223. [11, 2037, 15, 12],
  2224. [11, 2038, 15, 13],
  2225. [11, 2039, 12, 15],
  2226. [11, 2040, 14, 0],
  2227. [11, 2041, 14, 14],
  2228. [11, 2042, 13, 15],
  2229. [11, 2043, 12, 0],
  2230. [11, 2044, 14, 15],
  2231. [12, 4090, 0, 14],
  2232. [12, 4091, 0, 12],
  2233. [12, 4092, 15, 14],
  2234. [12, 4093, 15, 0],
  2235. [12, 4094, 0, 15],
  2236. [12, 4095, 15, 15]
  2237. ];
  2238. const HCB_SF = [
  2239. [1, 0, 60],
  2240. [3, 4, 59],
  2241. [4, 10, 61],
  2242. [4, 11, 58],
  2243. [4, 12, 62],
  2244. [5, 26, 57],
  2245. [5, 27, 63],
  2246. [6, 56, 56],
  2247. [6, 57, 64],
  2248. [6, 58, 55],
  2249. [6, 59, 65],
  2250. [7, 120, 66],
  2251. [7, 121, 54],
  2252. [7, 122, 67],
  2253. [8, 246, 53],
  2254. [8, 247, 68],
  2255. [8, 248, 52],
  2256. [8, 249, 69],
  2257. [8, 250, 51],
  2258. [9, 502, 70],
  2259. [9, 503, 50],
  2260. [9, 504, 49],
  2261. [9, 505, 71],
  2262. [10, 1012, 72],
  2263. [10, 1013, 48],
  2264. [10, 1014, 73],
  2265. [10, 1015, 47],
  2266. [10, 1016, 74],
  2267. [10, 1017, 46],
  2268. [11, 2036, 76],
  2269. [11, 2037, 75],
  2270. [11, 2038, 77],
  2271. [11, 2039, 78],
  2272. [11, 2040, 45],
  2273. [11, 2041, 43],
  2274. [12, 4084, 44],
  2275. [12, 4085, 79],
  2276. [12, 4086, 42],
  2277. [12, 4087, 41],
  2278. [12, 4088, 80],
  2279. [12, 4089, 40],
  2280. [13, 8180, 81],
  2281. [13, 8181, 39],
  2282. [13, 8182, 82],
  2283. [13, 8183, 38],
  2284. [13, 8184, 83],
  2285. [14, 16370, 37],
  2286. [14, 16371, 35],
  2287. [14, 16372, 85],
  2288. [14, 16373, 33],
  2289. [14, 16374, 36],
  2290. [14, 16375, 34],
  2291. [14, 16376, 84],
  2292. [14, 16377, 32],
  2293. [15, 32756, 87],
  2294. [15, 32757, 89],
  2295. [15, 32758, 30],
  2296. [15, 32759, 31],
  2297. [16, 65520, 86],
  2298. [16, 65521, 29],
  2299. [16, 65522, 26],
  2300. [16, 65523, 27],
  2301. [16, 65524, 28],
  2302. [16, 65525, 24],
  2303. [16, 65526, 88],
  2304. [17, 131054, 25],
  2305. [17, 131055, 22],
  2306. [17, 131056, 23],
  2307. [18, 262114, 90],
  2308. [18, 262115, 21],
  2309. [18, 262116, 19],
  2310. [18, 262117, 3],
  2311. [18, 262118, 1],
  2312. [18, 262119, 2],
  2313. [18, 262120, 0],
  2314. [19, 524242, 98],
  2315. [19, 524243, 99],
  2316. [19, 524244, 100],
  2317. [19, 524245, 101],
  2318. [19, 524246, 102],
  2319. [19, 524247, 117],
  2320. [19, 524248, 97],
  2321. [19, 524249, 91],
  2322. [19, 524250, 92],
  2323. [19, 524251, 93],
  2324. [19, 524252, 94],
  2325. [19, 524253, 95],
  2326. [19, 524254, 96],
  2327. [19, 524255, 104],
  2328. [19, 524256, 111],
  2329. [19, 524257, 112],
  2330. [19, 524258, 113],
  2331. [19, 524259, 114],
  2332. [19, 524260, 115],
  2333. [19, 524261, 116],
  2334. [19, 524262, 110],
  2335. [19, 524263, 105],
  2336. [19, 524264, 106],
  2337. [19, 524265, 107],
  2338. [19, 524266, 108],
  2339. [19, 524267, 109],
  2340. [19, 524268, 118],
  2341. [19, 524269, 6],
  2342. [19, 524270, 8],
  2343. [19, 524271, 9],
  2344. [19, 524272, 10],
  2345. [19, 524273, 5],
  2346. [19, 524274, 103],
  2347. [19, 524275, 120],
  2348. [19, 524276, 119],
  2349. [19, 524277, 4],
  2350. [19, 524278, 7],
  2351. [19, 524279, 15],
  2352. [19, 524280, 16],
  2353. [19, 524281, 18],
  2354. [19, 524282, 20],
  2355. [19, 524283, 17],
  2356. [19, 524284, 11],
  2357. [19, 524285, 12],
  2358. [19, 524286, 14],
  2359. [19, 524287, 13]
  2360. ];
  2361. const CODEBOOKS = [HCB1, HCB2, HCB3, HCB4, HCB5, HCB6, HCB7, HCB8, HCB9, HCB10, HCB11];
  2362. const UNSIGNED = [false, false, true, true, false, false, true, true, true, true, true],
  2363. QUAD_LEN = 4,
  2364. PAIR_LEN = 2;
  2365. var Huffman = {
  2366. findOffset: function(stream, table) {
  2367. var off = 0,
  2368. len = table[off][0],
  2369. cw = stream.read(len);
  2370. while (cw !== table[off][1]) {
  2371. var j = table[++off][0] - len;
  2372. len = table[off][0];
  2373. cw <<= j;
  2374. cw |= stream.read(j);
  2375. }
  2376. return off;
  2377. },
  2378. signValues: function(stream, data, off, len) {
  2379. for (var i = off; i < off + len; i++) {
  2380. if (data[i] && stream.read(1))
  2381. data[i] = -data[i];
  2382. }
  2383. },
  2384. getEscape: function(stream, s) {
  2385. var i = 4;
  2386. while (stream.read(1))
  2387. i++;
  2388. var j = stream.read(i) | (1 << i);
  2389. return s < 0 ? -j : j;
  2390. },
  2391. decodeScaleFactor: function(stream) {
  2392. var offset = this.findOffset(stream, HCB_SF);
  2393. return HCB_SF[offset][2];
  2394. },
  2395. decodeSpectralData: function(stream, cb, data, off) {
  2396. var HCB = CODEBOOKS[cb - 1],
  2397. offset = this.findOffset(stream, HCB);
  2398. data[off] = HCB[offset][2];
  2399. data[off + 1] = HCB[offset][3];
  2400. if (cb < 5) {
  2401. data[off + 2] = HCB[offset][4];
  2402. data[off + 3] = HCB[offset][5];
  2403. }
  2404. // sign and escape
  2405. if (cb < 11) {
  2406. if (UNSIGNED[cb - 1])
  2407. this.signValues(stream, data, off, cb < 5 ? QUAD_LEN : PAIR_LEN);
  2408. } else if (cb === 11 || cb > 15) {
  2409. this.signValues(stream, data, off, cb < 5 ? QUAD_LEN : PAIR_LEN);
  2410. if (Math.abs(data[off]) === 16)
  2411. data[off] = this.getEscape(stream, data[off]);
  2412. if (Math.abs(data[off + 1]) === 16)
  2413. data[off + 1] = this.getEscape(stream, data[off + 1]);
  2414. } else {
  2415. throw new Error("Huffman: unknown spectral codebook: " + cb);
  2416. }
  2417. }
  2418. };
  2419. module.exports = Huffman;
  2420. },{}],8:[function(require,module,exports){
  2421. /*
  2422. * AAC.js - Advanced Audio Coding decoder in JavaScript
  2423. * Created by Devon Govett
  2424. * Copyright (c) 2012, Official.fm Labs
  2425. *
  2426. * AAC.js is free software; you can redistribute it and/or modify it
  2427. * under the terms of the GNU Lesser General Public License as
  2428. * published by the Free Software Foundation; either version 3 of the
  2429. * License, or (at your option) any later version.
  2430. *
  2431. * AAC.js is distributed in the hope that it will be useful, but WITHOUT
  2432. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  2433. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
  2434. * Public License for more details.
  2435. *
  2436. * You should have received a copy of the GNU Lesser General Public
  2437. * License along with this library.
  2438. * If not, see <http://www.gnu.org/licenses/>.
  2439. */
  2440. var tables = require('./tables');
  2441. var Huffman = require('./huffman');
  2442. var TNS = require('./tns');
  2443. // Individual Channel Stream
  2444. function ICStream(config) {
  2445. this.info = new ICSInfo();
  2446. this.bandTypes = new Int32Array(MAX_SECTIONS);
  2447. this.sectEnd = new Int32Array(MAX_SECTIONS);
  2448. this.data = new Float32Array(config.frameLength);
  2449. this.scaleFactors = new Float32Array(MAX_SECTIONS);
  2450. this.randomState = 0x1F2E3D4C;
  2451. this.tns = new TNS(config);
  2452. this.specBuf = new Int32Array(4);
  2453. }
  2454. ICStream.ZERO_BT = 0; // Scalefactors and spectral data are all zero.
  2455. ICStream.FIRST_PAIR_BT = 5; // This and later band types encode two values (rather than four) with one code word.
  2456. ICStream.ESC_BT = 11; // Spectral data are coded with an escape sequence.
  2457. ICStream.NOISE_BT = 13; // Spectral data are scaled white noise not coded in the bitstream.
  2458. ICStream.INTENSITY_BT2 = 14; // Scalefactor data are intensity stereo positions.
  2459. ICStream.INTENSITY_BT = 15; // Scalefactor data are intensity stereo positions.
  2460. ICStream.ONLY_LONG_SEQUENCE = 0;
  2461. ICStream.LONG_START_SEQUENCE = 1;
  2462. ICStream.EIGHT_SHORT_SEQUENCE = 2;
  2463. ICStream.LONG_STOP_SEQUENCE = 3;
  2464. const MAX_SECTIONS = 120,
  2465. MAX_WINDOW_GROUP_COUNT = 8;
  2466. const SF_DELTA = 60,
  2467. SF_OFFSET = 200;
  2468. ICStream.prototype = {
  2469. decode: function(stream, config, commonWindow) {
  2470. this.globalGain = stream.read(8);
  2471. if (!commonWindow)
  2472. this.info.decode(stream, config, commonWindow);
  2473. this.decodeBandTypes(stream, config);
  2474. this.decodeScaleFactors(stream);
  2475. if (this.pulsePresent = stream.read(1)) {
  2476. if (this.info.windowSequence === ICStream.EIGHT_SHORT_SEQUENCE)
  2477. throw new Error("Pulse tool not allowed in eight short sequence.");
  2478. this.decodePulseData(stream);
  2479. }
  2480. if (this.tnsPresent = stream.read(1)) {
  2481. this.tns.decode(stream, this.info);
  2482. }
  2483. if (this.gainPresent = stream.read(1)) {
  2484. throw new Error("TODO: decode gain control/SSR");
  2485. }
  2486. this.decodeSpectralData(stream);
  2487. },
  2488. decodeBandTypes: function(stream, config) {
  2489. var bits = this.info.windowSequence === ICStream.EIGHT_SHORT_SEQUENCE ? 3 : 5,
  2490. groupCount = this.info.groupCount,
  2491. maxSFB = this.info.maxSFB,
  2492. bandTypes = this.bandTypes,
  2493. sectEnd = this.sectEnd,
  2494. idx = 0,
  2495. escape = (1 << bits) - 1;
  2496. for (var g = 0; g < groupCount; g++) {
  2497. var k = 0;
  2498. while (k < maxSFB) {
  2499. var end = k,
  2500. bandType = stream.read(4);
  2501. if (bandType === 12)
  2502. throw new Error("Invalid band type: 12");
  2503. var incr;
  2504. while ((incr = stream.read(bits)) === escape)
  2505. end += incr;
  2506. end += incr;
  2507. if (end > maxSFB)
  2508. throw new Error("Too many bands (" + end + " > " + maxSFB + ")");
  2509. for (; k < end; k++) {
  2510. bandTypes[idx] = bandType;
  2511. sectEnd[idx++] = end;
  2512. }
  2513. }
  2514. }
  2515. },
  2516. decodeScaleFactors: function(stream) {
  2517. var groupCount = this.info.groupCount,
  2518. maxSFB = this.info.maxSFB,
  2519. offset = [this.globalGain, this.globalGain - 90, 0], // spectrum, noise, intensity
  2520. idx = 0,
  2521. noiseFlag = true,
  2522. scaleFactors = this.scaleFactors,
  2523. sectEnd = this.sectEnd,
  2524. bandTypes = this.bandTypes;
  2525. for (var g = 0; g < groupCount; g++) {
  2526. for (var i = 0; i < maxSFB;) {
  2527. var runEnd = sectEnd[idx];
  2528. switch (bandTypes[idx]) {
  2529. case ICStream.ZERO_BT:
  2530. for (; i < runEnd; i++, idx++) {
  2531. scaleFactors[idx] = 0;
  2532. }
  2533. break;
  2534. case ICStream.INTENSITY_BT:
  2535. case ICStream.INTENSITY_BT2:
  2536. for(; i < runEnd; i++, idx++) {
  2537. offset[2] += Huffman.decodeScaleFactor(stream) - SF_DELTA;
  2538. var tmp = Math.min(Math.max(offset[2], -155), 100);
  2539. scaleFactors[idx] = tables.SCALEFACTOR_TABLE[-tmp + SF_OFFSET];
  2540. }
  2541. break;
  2542. case ICStream.NOISE_BT:
  2543. for(; i < runEnd; i++, idx++) {
  2544. if (noiseFlag) {
  2545. offset[1] += stream.read(9) - 256;
  2546. noiseFlag = false;
  2547. } else {
  2548. offset[1] += Huffman.decodeScaleFactor(stream) - SF_DELTA;
  2549. }
  2550. var tmp = Math.min(Math.max(offset[1], -100), 155);
  2551. scaleFactors[idx] = -tables.SCALEFACTOR_TABLE[tmp + SF_OFFSET];
  2552. }
  2553. break;
  2554. default:
  2555. for(; i < runEnd; i++, idx++) {
  2556. offset[0] += Huffman.decodeScaleFactor(stream) - SF_DELTA;
  2557. if(offset[0] > 255)
  2558. throw new Error("Scalefactor out of range: " + offset[0]);
  2559. scaleFactors[idx] = tables.SCALEFACTOR_TABLE[offset[0] - 100 + SF_OFFSET];
  2560. }
  2561. break;
  2562. }
  2563. }
  2564. }
  2565. },
  2566. decodePulseData: function(stream) {
  2567. var pulseCount = stream.read(2) + 1,
  2568. pulseSWB = stream.read(6);
  2569. if (pulseSWB >= this.info.swbCount)
  2570. throw new Error("Pulse SWB out of range: " + pulseSWB);
  2571. if (!this.pulseOffset || this.pulseOffset.length !== pulseCount) {
  2572. // only reallocate if needed
  2573. this.pulseOffset = new Int32Array(pulseCount);
  2574. this.pulseAmp = new Int32Array(pulseCount);
  2575. }
  2576. this.pulseOffset[0] = this.info.swbOffsets[pulseSWB] + stream.read(5);
  2577. this.pulseAmp[0] = stream.read(4);
  2578. if (this.pulseOffset[0] > 1023)
  2579. throw new Error("Pulse offset out of range: " + this.pulseOffset[0]);
  2580. for (var i = 1; i < pulseCount; i++) {
  2581. this.pulseOffset[i] = stream.read(5) + this.pulseOffset[i - 1];
  2582. if (this.pulseOffset[i] > 1023)
  2583. throw new Error("Pulse offset out of range: " + this.pulseOffset[i]);
  2584. this.pulseAmp[i] = stream.read(4);
  2585. }
  2586. },
  2587. decodeSpectralData: function(stream) {
  2588. var data = this.data,
  2589. info = this.info,
  2590. maxSFB = info.maxSFB,
  2591. windowGroups = info.groupCount,
  2592. offsets = info.swbOffsets,
  2593. bandTypes = this.bandTypes,
  2594. scaleFactors = this.scaleFactors,
  2595. buf = this.specBuf;
  2596. var groupOff = 0, idx = 0;
  2597. for (var g = 0; g < windowGroups; g++) {
  2598. var groupLen = info.groupLength[g];
  2599. for (var sfb = 0; sfb < maxSFB; sfb++, idx++) {
  2600. var hcb = bandTypes[idx],
  2601. off = groupOff + offsets[sfb],
  2602. width = offsets[sfb + 1] - offsets[sfb];
  2603. if (hcb === ICStream.ZERO_BT || hcb === ICStream.INTENSITY_BT || hcb === ICStream.INTENSITY_BT2) {
  2604. for (var group = 0; group < groupLen; group++, off += 128) {
  2605. for (var i = off; i < off + width; i++) {
  2606. data[i] = 0;
  2607. }
  2608. }
  2609. } else if (hcb === ICStream.NOISE_BT) {
  2610. // fill with random values
  2611. for (var group = 0; group < groupLen; group++, off += 128) {
  2612. var energy = 0;
  2613. for (var k = 0; k < width; k++) {
  2614. this.randomState = (this.randomState * (1664525 + 1013904223))|0;
  2615. data[off + k] = this.randomState;
  2616. energy += data[off + k] * data[off + k];
  2617. }
  2618. var scale = scaleFactors[idx] / Math.sqrt(energy);
  2619. for (var k = 0; k < width; k++) {
  2620. data[off + k] *= scale;
  2621. }
  2622. }
  2623. } else {
  2624. for (var group = 0; group < groupLen; group++, off += 128) {
  2625. var num = (hcb >= ICStream.FIRST_PAIR_BT) ? 2 : 4;
  2626. for (var k = 0; k < width; k += num) {
  2627. Huffman.decodeSpectralData(stream, hcb, buf, 0);
  2628. // inverse quantization & scaling
  2629. for (var j = 0; j < num; j++) {
  2630. data[off + k + j] = (buf[j] > 0) ? tables.IQ_TABLE[buf[j]] : -tables.IQ_TABLE[-buf[j]];
  2631. data[off + k + j] *= scaleFactors[idx];
  2632. }
  2633. }
  2634. }
  2635. }
  2636. }
  2637. groupOff += groupLen << 7;
  2638. }
  2639. // add pulse data, if present
  2640. if (this.pulsePresent) {
  2641. throw new Error('TODO: add pulse data');
  2642. }
  2643. }
  2644. }
  2645. // Individual Channel Stream Info
  2646. function ICSInfo() {
  2647. this.windowShape = new Int32Array(2);
  2648. this.windowSequence = ICStream.ONLY_LONG_SEQUENCE;
  2649. this.groupLength = new Int32Array(MAX_WINDOW_GROUP_COUNT);
  2650. this.ltpData1Present = false;
  2651. this.ltpData2Present = false;
  2652. }
  2653. ICSInfo.prototype = {
  2654. decode: function(stream, config, commonWindow) {
  2655. stream.advance(1); // reserved
  2656. this.windowSequence = stream.read(2);
  2657. this.windowShape[0] = this.windowShape[1];
  2658. this.windowShape[1] = stream.read(1);
  2659. this.groupCount = 1;
  2660. this.groupLength[0] = 1;
  2661. if (this.windowSequence === ICStream.EIGHT_SHORT_SEQUENCE) {
  2662. this.maxSFB = stream.read(4);
  2663. for (var i = 0; i < 7; i++) {
  2664. if (stream.read(1)) {
  2665. this.groupLength[this.groupCount - 1]++;
  2666. } else {
  2667. this.groupCount++;
  2668. this.groupLength[this.groupCount - 1] = 1;
  2669. }
  2670. }
  2671. this.windowCount = 8;
  2672. this.swbOffsets = tables.SWB_OFFSET_128[config.sampleIndex];
  2673. this.swbCount = tables.SWB_SHORT_WINDOW_COUNT[config.sampleIndex];
  2674. this.predictorPresent = false;
  2675. } else {
  2676. this.maxSFB = stream.read(6);
  2677. this.windowCount = 1;
  2678. this.swbOffsets = tables.SWB_OFFSET_1024[config.sampleIndex];
  2679. this.swbCount = tables.SWB_LONG_WINDOW_COUNT[config.sampleIndex];
  2680. this.predictorPresent = !!stream.read(1);
  2681. if (this.predictorPresent)
  2682. this.decodePrediction(stream, config, commonWindow);
  2683. }
  2684. },
  2685. decodePrediction: function(stream, config, commonWindow) {
  2686. throw new Error('Prediction not implemented.');
  2687. switch (config.profile) {
  2688. case AOT_AAC_MAIN:
  2689. throw new Error('Prediction not implemented.');
  2690. break;
  2691. case AOT_AAC_LTP:
  2692. throw new Error('LTP prediction not implemented.');
  2693. break;
  2694. default:
  2695. throw new Error('Unsupported profile for prediction ' + config.profile);
  2696. }
  2697. }
  2698. };
  2699. module.exports = ICStream;
  2700. },{"./huffman":7,"./tables":11,"./tns":12}],9:[function(require,module,exports){
  2701. /*
  2702. * AAC.js - Advanced Audio Coding decoder in JavaScript
  2703. * Created by Devon Govett
  2704. * Copyright (c) 2012, Official.fm Labs
  2705. *
  2706. * AAC.js is free software; you can redistribute it and/or modify it
  2707. * under the terms of the GNU Lesser General Public License as
  2708. * published by the Free Software Foundation; either version 3 of the
  2709. * License, or (at your option) any later version.
  2710. *
  2711. * AAC.js is distributed in the hope that it will be useful, but WITHOUT
  2712. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  2713. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
  2714. * Public License for more details.
  2715. *
  2716. * You should have received a copy of the GNU Lesser General Public
  2717. * License along with this library.
  2718. * If not, see <http://www.gnu.org/licenses/>.
  2719. */
  2720. var tables = require('./mdct_tables');
  2721. var FFT = require('./fft');
  2722. // Modified Discrete Cosine Transform
  2723. function MDCT(length) {
  2724. this.N = length;
  2725. this.N2 = length >>> 1;
  2726. this.N4 = length >>> 2;
  2727. this.N8 = length >>> 3;
  2728. switch (length) {
  2729. case 2048:
  2730. this.sincos = tables.MDCT_TABLE_2048;
  2731. break;
  2732. case 256:
  2733. this.sincos = tables.MDCT_TABLE_256;
  2734. break;
  2735. case 1920:
  2736. this.sincos = tables.MDCT_TABLE_1920;
  2737. break;
  2738. case 240:
  2739. this.sincos = tables.MDCT_TABLE_240;
  2740. break;
  2741. default:
  2742. throw new Error("unsupported MDCT length: " + length);
  2743. }
  2744. this.fft = new FFT(this.N4);
  2745. this.buf = new Array(this.N4);
  2746. for (var i = 0; i < this.N4; i++) {
  2747. this.buf[i] = new Float32Array(2);
  2748. }
  2749. this.tmp = new Float32Array(2);
  2750. }
  2751. MDCT.prototype.process = function(input, inOffset, output, outOffset) {
  2752. // local access
  2753. var N2 = this.N2,
  2754. N4 = this.N4,
  2755. N8 = this.N8,
  2756. buf = this.buf,
  2757. tmp = this.tmp,
  2758. sincos = this.sincos,
  2759. fft = this.fft;
  2760. // pre-IFFT complex multiplication
  2761. for (var k = 0; k < N4; k++) {
  2762. buf[k][1] = (input[inOffset + 2 * k] * sincos[k][0]) + (input[inOffset + N2 - 1 - 2 * k] * sincos[k][1]);
  2763. buf[k][0] = (input[inOffset + N2 - 1 - 2 * k] * sincos[k][0]) - (input[inOffset + 2 * k] * sincos[k][1]);
  2764. }
  2765. // complex IFFT, non-scaling
  2766. fft.process(buf, false);
  2767. // post-IFFT complex multiplication
  2768. for (var k = 0; k < N4; k++) {
  2769. tmp[0] = buf[k][0];
  2770. tmp[1] = buf[k][1];
  2771. buf[k][1] = (tmp[1] * sincos[k][0]) + (tmp[0] * sincos[k][1]);
  2772. buf[k][0] = (tmp[0] * sincos[k][0]) - (tmp[1] * sincos[k][1]);
  2773. }
  2774. // reordering
  2775. for (var k = 0; k < N8; k += 2) {
  2776. output[outOffset + 2 * k] = buf[N8 + k][1];
  2777. output[outOffset + 2 + 2 * k] = buf[N8 + 1 + k][1];
  2778. output[outOffset + 1 + 2 * k] = -buf[N8 - 1 - k][0];
  2779. output[outOffset + 3 + 2 * k] = -buf[N8 - 2 - k][0];
  2780. output[outOffset + N4 + 2 * k] = buf[k][0];
  2781. output[outOffset + N4 + 2 + 2 * k] = buf[1 + k][0];
  2782. output[outOffset + N4 + 1 + 2 * k] = -buf[N4 - 1 - k][1];
  2783. output[outOffset + N4 + 3 + 2 * k] = -buf[N4 - 2 - k][1];
  2784. output[outOffset + N2 + 2 * k] = buf[N8 + k][0];
  2785. output[outOffset + N2 + 2 + 2 * k] = buf[N8 + 1 + k][0];
  2786. output[outOffset + N2 + 1 + 2 * k] = -buf[N8 - 1 - k][1];
  2787. output[outOffset + N2 + 3 + 2 * k] = -buf[N8 - 2 - k][1];
  2788. output[outOffset + N2 + N4 + 2 * k] = -buf[k][1];
  2789. output[outOffset + N2 + N4 + 2 + 2 * k] = -buf[1 + k][1];
  2790. output[outOffset + N2 + N4 + 1 + 2 * k] = buf[N4 - 1 - k][0];
  2791. output[outOffset + N2 + N4 + 3 + 2 * k] = buf[N4 - 2 - k][0];
  2792. }
  2793. };
  2794. module.exports = MDCT;
  2795. },{"./fft":5,"./mdct_tables":10}],10:[function(require,module,exports){
  2796. /*
  2797. * AAC.js - Advanced Audio Coding decoder in JavaScript
  2798. * Created by Devon Govett
  2799. * Copyright (c) 2012, Official.fm Labs
  2800. *
  2801. * AAC.js is free software; you can redistribute it and/or modify it
  2802. * under the terms of the GNU Lesser General Public License as
  2803. * published by the Free Software Foundation; either version 3 of the
  2804. * License, or (at your option) any later version.
  2805. *
  2806. * AAC.js is distributed in the hope that it will be useful, but WITHOUT
  2807. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  2808. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
  2809. * Public License for more details.
  2810. *
  2811. * You should have received a copy of the GNU Lesser General Public
  2812. * License along with this library.
  2813. * If not, see <http://www.gnu.org/licenses/>.
  2814. */
  2815. exports.MDCT_TABLE_2048 = [
  2816. [0.031249997702054, 0.000011984224612],
  2817. [0.031249813866531, 0.000107857810004],
  2818. [0.031249335895858, 0.000203730380198],
  2819. [0.031248563794535, 0.000299601032804],
  2820. [0.031247497569829, 0.000395468865451],
  2821. [0.031246137231775, 0.000491332975794],
  2822. [0.031244482793177, 0.000587192461525],
  2823. [0.031242534269608, 0.000683046420376],
  2824. [0.031240291679407, 0.000778893950134],
  2825. [0.031237755043684, 0.000874734148645],
  2826. [0.031234924386313, 0.000970566113826],
  2827. [0.031231799733938, 0.001066388943669],
  2828. [0.031228381115970, 0.001162201736253],
  2829. [0.031224668564585, 0.001258003589751],
  2830. [0.031220662114728, 0.001353793602441],
  2831. [0.031216361804108, 0.001449570872710],
  2832. [0.031211767673203, 0.001545334499065],
  2833. [0.031206879765253, 0.001641083580144],
  2834. [0.031201698126266, 0.001736817214719],
  2835. [0.031196222805014, 0.001832534501709],
  2836. [0.031190453853031, 0.001928234540186],
  2837. [0.031184391324617, 0.002023916429386],
  2838. [0.031178035276836, 0.002119579268713],
  2839. [0.031171385769513, 0.002215222157753],
  2840. [0.031164442865236, 0.002310844196278],
  2841. [0.031157206629353, 0.002406444484258],
  2842. [0.031149677129975, 0.002502022121865],
  2843. [0.031141854437973, 0.002597576209488],
  2844. [0.031133738626977, 0.002693105847734],
  2845. [0.031125329773375, 0.002788610137442],
  2846. [0.031116627956316, 0.002884088179689],
  2847. [0.031107633257703, 0.002979539075801],
  2848. [0.031098345762200, 0.003074961927355],
  2849. [0.031088765557222, 0.003170355836197],
  2850. [0.031078892732942, 0.003265719904442],
  2851. [0.031068727382288, 0.003361053234488],
  2852. [0.031058269600939, 0.003456354929021],
  2853. [0.031047519487329, 0.003551624091024],
  2854. [0.031036477142640, 0.003646859823790],
  2855. [0.031025142670809, 0.003742061230921],
  2856. [0.031013516178519, 0.003837227416347],
  2857. [0.031001597775203, 0.003932357484328],
  2858. [0.030989387573042, 0.004027450539462],
  2859. [0.030976885686963, 0.004122505686697],
  2860. [0.030964092234638, 0.004217522031340],
  2861. [0.030951007336485, 0.004312498679058],
  2862. [0.030937631115663, 0.004407434735897],
  2863. [0.030923963698074, 0.004502329308281],
  2864. [0.030910005212362, 0.004597181503027],
  2865. [0.030895755789908, 0.004691990427350],
  2866. [0.030881215564835, 0.004786755188872],
  2867. [0.030866384674000, 0.004881474895632],
  2868. [0.030851263256996, 0.004976148656090],
  2869. [0.030835851456154, 0.005070775579142],
  2870. [0.030820149416533, 0.005165354774124],
  2871. [0.030804157285929, 0.005259885350819],
  2872. [0.030787875214864, 0.005354366419469],
  2873. [0.030771303356593, 0.005448797090784],
  2874. [0.030754441867095, 0.005543176475946],
  2875. [0.030737290905077, 0.005637503686619],
  2876. [0.030719850631972, 0.005731777834961],
  2877. [0.030702121211932, 0.005825998033626],
  2878. [0.030684102811835, 0.005920163395780],
  2879. [0.030665795601276, 0.006014273035101],
  2880. [0.030647199752570, 0.006108326065793],
  2881. [0.030628315440748, 0.006202321602594],
  2882. [0.030609142843557, 0.006296258760782],
  2883. [0.030589682141455, 0.006390136656185],
  2884. [0.030569933517616, 0.006483954405188],
  2885. [0.030549897157919, 0.006577711124743],
  2886. [0.030529573250956, 0.006671405932375],
  2887. [0.030508961988022, 0.006765037946194],
  2888. [0.030488063563118, 0.006858606284900],
  2889. [0.030466878172949, 0.006952110067791],
  2890. [0.030445406016919, 0.007045548414774],
  2891. [0.030423647297133, 0.007138920446372],
  2892. [0.030401602218392, 0.007232225283733],
  2893. [0.030379270988192, 0.007325462048634],
  2894. [0.030356653816724, 0.007418629863497],
  2895. [0.030333750916869, 0.007511727851390],
  2896. [0.030310562504198, 0.007604755136040],
  2897. [0.030287088796968, 0.007697710841838],
  2898. [0.030263330016124, 0.007790594093851],
  2899. [0.030239286385293, 0.007883404017824],
  2900. [0.030214958130781, 0.007976139740197],
  2901. [0.030190345481576, 0.008068800388104],
  2902. [0.030165448669342, 0.008161385089390],
  2903. [0.030140267928416, 0.008253892972610],
  2904. [0.030114803495809, 0.008346323167047],
  2905. [0.030089055611203, 0.008438674802711],
  2906. [0.030063024516947, 0.008530947010354],
  2907. [0.030036710458054, 0.008623138921475],
  2908. [0.030010113682202, 0.008715249668328],
  2909. [0.029983234439732, 0.008807278383932],
  2910. [0.029956072983640, 0.008899224202078],
  2911. [0.029928629569580, 0.008991086257336],
  2912. [0.029900904455860, 0.009082863685067],
  2913. [0.029872897903441, 0.009174555621425],
  2914. [0.029844610175929, 0.009266161203371],
  2915. [0.029816041539579, 0.009357679568679],
  2916. [0.029787192263292, 0.009449109855944],
  2917. [0.029758062618606, 0.009540451204587],
  2918. [0.029728652879702, 0.009631702754871],
  2919. [0.029698963323395, 0.009722863647900],
  2920. [0.029668994229134, 0.009813933025633],
  2921. [0.029638745879000, 0.009904910030891],
  2922. [0.029608218557702, 0.009995793807363],
  2923. [0.029577412552575, 0.010086583499618],
  2924. [0.029546328153577, 0.010177278253107],
  2925. [0.029514965653285, 0.010267877214177],
  2926. [0.029483325346896, 0.010358379530076],
  2927. [0.029451407532220, 0.010448784348962],
  2928. [0.029419212509679, 0.010539090819911],
  2929. [0.029386740582307, 0.010629298092923],
  2930. [0.029353992055740, 0.010719405318933],
  2931. [0.029320967238220, 0.010809411649818],
  2932. [0.029287666440590, 0.010899316238403],
  2933. [0.029254089976290, 0.010989118238474],
  2934. [0.029220238161353, 0.011078816804778],
  2935. [0.029186111314406, 0.011168411093039],
  2936. [0.029151709756664, 0.011257900259961],
  2937. [0.029117033811927, 0.011347283463239],
  2938. [0.029082083806579, 0.011436559861563],
  2939. [0.029046860069582, 0.011525728614630],
  2940. [0.029011362932476, 0.011614788883150],
  2941. [0.028975592729373, 0.011703739828853],
  2942. [0.028939549796957, 0.011792580614500],
  2943. [0.028903234474475, 0.011881310403886],
  2944. [0.028866647103744, 0.011969928361855],
  2945. [0.028829788029135, 0.012058433654299],
  2946. [0.028792657597583, 0.012146825448172],
  2947. [0.028755256158571, 0.012235102911499],
  2948. [0.028717584064137, 0.012323265213377],
  2949. [0.028679641668864, 0.012411311523990],
  2950. [0.028641429329882, 0.012499241014612],
  2951. [0.028602947406859, 0.012587052857618],
  2952. [0.028564196262001, 0.012674746226488],
  2953. [0.028525176260050, 0.012762320295819],
  2954. [0.028485887768276, 0.012849774241331],
  2955. [0.028446331156478, 0.012937107239875],
  2956. [0.028406506796976, 0.013024318469437],
  2957. [0.028366415064615, 0.013111407109155],
  2958. [0.028326056336751, 0.013198372339315],
  2959. [0.028285430993258, 0.013285213341368],
  2960. [0.028244539416515, 0.013371929297933],
  2961. [0.028203381991411, 0.013458519392807],
  2962. [0.028161959105334, 0.013544982810971],
  2963. [0.028120271148172, 0.013631318738598],
  2964. [0.028078318512309, 0.013717526363062],
  2965. [0.028036101592619, 0.013803604872943],
  2966. [0.027993620786463, 0.013889553458039],
  2967. [0.027950876493687, 0.013975371309367],
  2968. [0.027907869116616, 0.014061057619178],
  2969. [0.027864599060052, 0.014146611580959],
  2970. [0.027821066731270, 0.014232032389445],
  2971. [0.027777272540012, 0.014317319240622],
  2972. [0.027733216898487, 0.014402471331737],
  2973. [0.027688900221361, 0.014487487861307],
  2974. [0.027644322925762, 0.014572368029123],
  2975. [0.027599485431266, 0.014657111036262],
  2976. [0.027554388159903, 0.014741716085090],
  2977. [0.027509031536144, 0.014826182379271],
  2978. [0.027463415986904, 0.014910509123778],
  2979. [0.027417541941533, 0.014994695524894],
  2980. [0.027371409831816, 0.015078740790225],
  2981. [0.027325020091965, 0.015162644128704],
  2982. [0.027278373158618, 0.015246404750603],
  2983. [0.027231469470833, 0.015330021867534],
  2984. [0.027184309470088, 0.015413494692460],
  2985. [0.027136893600268, 0.015496822439704],
  2986. [0.027089222307671, 0.015580004324954],
  2987. [0.027041296040997, 0.015663039565269],
  2988. [0.026993115251345, 0.015745927379091],
  2989. [0.026944680392213, 0.015828666986247],
  2990. [0.026895991919487, 0.015911257607961],
  2991. [0.026847050291442, 0.015993698466859],
  2992. [0.026797855968734, 0.016075988786976],
  2993. [0.026748409414401, 0.016158127793763],
  2994. [0.026698711093851, 0.016240114714099],
  2995. [0.026648761474864, 0.016321948776289],
  2996. [0.026598561027585, 0.016403629210082],
  2997. [0.026548110224519, 0.016485155246669],
  2998. [0.026497409540530, 0.016566526118696],
  2999. [0.026446459452830, 0.016647741060271],
  3000. [0.026395260440982, 0.016728799306966],
  3001. [0.026343812986890, 0.016809700095831],
  3002. [0.026292117574797, 0.016890442665397],
  3003. [0.026240174691280, 0.016971026255683],
  3004. [0.026187984825246, 0.017051450108208],
  3005. [0.026135548467924, 0.017131713465990],
  3006. [0.026082866112867, 0.017211815573560],
  3007. [0.026029938255941, 0.017291755676967],
  3008. [0.025976765395322, 0.017371533023784],
  3009. [0.025923348031494, 0.017451146863116],
  3010. [0.025869686667242, 0.017530596445607],
  3011. [0.025815781807646, 0.017609881023449],
  3012. [0.025761633960080, 0.017688999850383],
  3013. [0.025707243634204, 0.017767952181715],
  3014. [0.025652611341960, 0.017846737274313],
  3015. [0.025597737597568, 0.017925354386623],
  3016. [0.025542622917522, 0.018003802778671],
  3017. [0.025487267820581, 0.018082081712071],
  3018. [0.025431672827768, 0.018160190450031],
  3019. [0.025375838462365, 0.018238128257362],
  3020. [0.025319765249906, 0.018315894400484],
  3021. [0.025263453718173, 0.018393488147432],
  3022. [0.025206904397193, 0.018470908767865],
  3023. [0.025150117819228, 0.018548155533070],
  3024. [0.025093094518776, 0.018625227715971],
  3025. [0.025035835032562, 0.018702124591135],
  3026. [0.024978339899534, 0.018778845434780],
  3027. [0.024920609660858, 0.018855389524780],
  3028. [0.024862644859912, 0.018931756140672],
  3029. [0.024804446042284, 0.019007944563666],
  3030. [0.024746013755764, 0.019083954076646],
  3031. [0.024687348550337, 0.019159783964183],
  3032. [0.024628450978184, 0.019235433512536],
  3033. [0.024569321593670, 0.019310902009663],
  3034. [0.024509960953345, 0.019386188745225],
  3035. [0.024450369615932, 0.019461293010596],
  3036. [0.024390548142329, 0.019536214098866],
  3037. [0.024330497095598, 0.019610951304848],
  3038. [0.024270217040961, 0.019685503925087],
  3039. [0.024209708545799, 0.019759871257867],
  3040. [0.024148972179639, 0.019834052603212],
  3041. [0.024088008514157, 0.019908047262901],
  3042. [0.024026818123164, 0.019981854540467],
  3043. [0.023965401582609, 0.020055473741208],
  3044. [0.023903759470567, 0.020128904172192],
  3045. [0.023841892367236, 0.020202145142264],
  3046. [0.023779800854935, 0.020275195962052],
  3047. [0.023717485518092, 0.020348055943974],
  3048. [0.023654946943242, 0.020420724402244],
  3049. [0.023592185719023, 0.020493200652878],
  3050. [0.023529202436167, 0.020565484013703],
  3051. [0.023465997687496, 0.020637573804361],
  3052. [0.023402572067918, 0.020709469346314],
  3053. [0.023338926174419, 0.020781169962854],
  3054. [0.023275060606058, 0.020852674979108],
  3055. [0.023210975963963, 0.020923983722044],
  3056. [0.023146672851322, 0.020995095520475],
  3057. [0.023082151873380, 0.021066009705072],
  3058. [0.023017413637435, 0.021136725608363],
  3059. [0.022952458752826, 0.021207242564742],
  3060. [0.022887287830934, 0.021277559910478],
  3061. [0.022821901485173, 0.021347676983716],
  3062. [0.022756300330983, 0.021417593124488],
  3063. [0.022690484985827, 0.021487307674717],
  3064. [0.022624456069185, 0.021556819978223],
  3065. [0.022558214202547, 0.021626129380729],
  3066. [0.022491760009405, 0.021695235229869],
  3067. [0.022425094115252, 0.021764136875192],
  3068. [0.022358217147572, 0.021832833668171],
  3069. [0.022291129735838, 0.021901324962204],
  3070. [0.022223832511501, 0.021969610112625],
  3071. [0.022156326107988, 0.022037688476709],
  3072. [0.022088611160696, 0.022105559413676],
  3073. [0.022020688306983, 0.022173222284699],
  3074. [0.021952558186166, 0.022240676452909],
  3075. [0.021884221439510, 0.022307921283403],
  3076. [0.021815678710228, 0.022374956143245],
  3077. [0.021746930643469, 0.022441780401478],
  3078. [0.021677977886316, 0.022508393429127],
  3079. [0.021608821087780, 0.022574794599206],
  3080. [0.021539460898790, 0.022640983286719],
  3081. [0.021469897972190, 0.022706958868676],
  3082. [0.021400132962735, 0.022772720724087],
  3083. [0.021330166527077, 0.022838268233979],
  3084. [0.021259999323769, 0.022903600781391],
  3085. [0.021189632013250, 0.022968717751391],
  3086. [0.021119065257845, 0.023033618531071],
  3087. [0.021048299721754, 0.023098302509561],
  3088. [0.020977336071050, 0.023162769078031],
  3089. [0.020906174973670, 0.023227017629698],
  3090. [0.020834817099409, 0.023291047559828],
  3091. [0.020763263119915, 0.023354858265748],
  3092. [0.020691513708680, 0.023418449146848],
  3093. [0.020619569541038, 0.023481819604585],
  3094. [0.020547431294155, 0.023544969042494],
  3095. [0.020475099647023, 0.023607896866186],
  3096. [0.020402575280455, 0.023670602483363],
  3097. [0.020329858877078, 0.023733085303813],
  3098. [0.020256951121327, 0.023795344739427],
  3099. [0.020183852699437, 0.023857380204193],
  3100. [0.020110564299439, 0.023919191114211],
  3101. [0.020037086611150, 0.023980776887692],
  3102. [0.019963420326171, 0.024042136944968],
  3103. [0.019889566137877, 0.024103270708495],
  3104. [0.019815524741412, 0.024164177602859],
  3105. [0.019741296833681, 0.024224857054779],
  3106. [0.019666883113346, 0.024285308493120],
  3107. [0.019592284280817, 0.024345531348888],
  3108. [0.019517501038246, 0.024405525055242],
  3109. [0.019442534089523, 0.024465289047500],
  3110. [0.019367384140264, 0.024524822763141],
  3111. [0.019292051897809, 0.024584125641809],
  3112. [0.019216538071215, 0.024643197125323],
  3113. [0.019140843371246, 0.024702036657681],
  3114. [0.019064968510369, 0.024760643685063],
  3115. [0.018988914202748, 0.024819017655836],
  3116. [0.018912681164234, 0.024877158020562],
  3117. [0.018836270112363, 0.024935064232003],
  3118. [0.018759681766343, 0.024992735745123],
  3119. [0.018682916847054, 0.025050172017095],
  3120. [0.018605976077037, 0.025107372507308],
  3121. [0.018528860180486, 0.025164336677369],
  3122. [0.018451569883247, 0.025221063991110],
  3123. [0.018374105912805, 0.025277553914591],
  3124. [0.018296468998280, 0.025333805916107],
  3125. [0.018218659870421, 0.025389819466194],
  3126. [0.018140679261596, 0.025445594037630],
  3127. [0.018062527905790, 0.025501129105445],
  3128. [0.017984206538592, 0.025556424146920],
  3129. [0.017905715897192, 0.025611478641598],
  3130. [0.017827056720375, 0.025666292071285],
  3131. [0.017748229748511, 0.025720863920056],
  3132. [0.017669235723550, 0.025775193674260],
  3133. [0.017590075389012, 0.025829280822525],
  3134. [0.017510749489986, 0.025883124855762],
  3135. [0.017431258773116, 0.025936725267170],
  3136. [0.017351603986600, 0.025990081552242],
  3137. [0.017271785880180, 0.026043193208768],
  3138. [0.017191805205132, 0.026096059736841],
  3139. [0.017111662714267, 0.026148680638861],
  3140. [0.017031359161915, 0.026201055419541],
  3141. [0.016950895303924, 0.026253183585908],
  3142. [0.016870271897651, 0.026305064647313],
  3143. [0.016789489701954, 0.026356698115431],
  3144. [0.016708549477186, 0.026408083504269],
  3145. [0.016627451985187, 0.026459220330167],
  3146. [0.016546197989277, 0.026510108111806],
  3147. [0.016464788254250, 0.026560746370212],
  3148. [0.016383223546365, 0.026611134628757],
  3149. [0.016301504633341, 0.026661272413168],
  3150. [0.016219632284346, 0.026711159251530],
  3151. [0.016137607269996, 0.026760794674288],
  3152. [0.016055430362340, 0.026810178214254],
  3153. [0.015973102334858, 0.026859309406613],
  3154. [0.015890623962454, 0.026908187788922],
  3155. [0.015807996021446, 0.026956812901119],
  3156. [0.015725219289558, 0.027005184285527],
  3157. [0.015642294545918, 0.027053301486856],
  3158. [0.015559222571044, 0.027101164052208],
  3159. [0.015476004146842, 0.027148771531083],
  3160. [0.015392640056594, 0.027196123475380],
  3161. [0.015309131084956, 0.027243219439406],
  3162. [0.015225478017946, 0.027290058979875],
  3163. [0.015141681642938, 0.027336641655915],
  3164. [0.015057742748656, 0.027382967029073],
  3165. [0.014973662125164, 0.027429034663317],
  3166. [0.014889440563862, 0.027474844125040],
  3167. [0.014805078857474, 0.027520394983066],
  3168. [0.014720577800046, 0.027565686808654],
  3169. [0.014635938186934, 0.027610719175499],
  3170. [0.014551160814797, 0.027655491659740],
  3171. [0.014466246481592, 0.027700003839960],
  3172. [0.014381195986567, 0.027744255297195],
  3173. [0.014296010130247, 0.027788245614933],
  3174. [0.014210689714436, 0.027831974379120],
  3175. [0.014125235542201, 0.027875441178165],
  3176. [0.014039648417870, 0.027918645602941],
  3177. [0.013953929147020, 0.027961587246792],
  3178. [0.013868078536476, 0.028004265705534],
  3179. [0.013782097394294, 0.028046680577462],
  3180. [0.013695986529763, 0.028088831463351],
  3181. [0.013609746753390, 0.028130717966461],
  3182. [0.013523378876898, 0.028172339692540],
  3183. [0.013436883713214, 0.028213696249828],
  3184. [0.013350262076462, 0.028254787249062],
  3185. [0.013263514781960, 0.028295612303478],
  3186. [0.013176642646205, 0.028336171028814],
  3187. [0.013089646486871, 0.028376463043317],
  3188. [0.013002527122799, 0.028416487967743],
  3189. [0.012915285373990, 0.028456245425361],
  3190. [0.012827922061597, 0.028495735041960],
  3191. [0.012740438007915, 0.028534956445849],
  3192. [0.012652834036379, 0.028573909267859],
  3193. [0.012565110971550, 0.028612593141354],
  3194. [0.012477269639111, 0.028651007702224],
  3195. [0.012389310865858, 0.028689152588899],
  3196. [0.012301235479693, 0.028727027442343],
  3197. [0.012213044309615, 0.028764631906065],
  3198. [0.012124738185712, 0.028801965626115],
  3199. [0.012036317939156, 0.028839028251097],
  3200. [0.011947784402191, 0.028875819432161],
  3201. [0.011859138408130, 0.028912338823015],
  3202. [0.011770380791341, 0.028948586079925],
  3203. [0.011681512387245, 0.028984560861718],
  3204. [0.011592534032306, 0.029020262829785],
  3205. [0.011503446564022, 0.029055691648087],
  3206. [0.011414250820918, 0.029090846983152],
  3207. [0.011324947642537, 0.029125728504087],
  3208. [0.011235537869437, 0.029160335882573],
  3209. [0.011146022343175, 0.029194668792871],
  3210. [0.011056401906305, 0.029228726911828],
  3211. [0.010966677402371, 0.029262509918876],
  3212. [0.010876849675891, 0.029296017496036],
  3213. [0.010786919572361, 0.029329249327922],
  3214. [0.010696887938235, 0.029362205101743],
  3215. [0.010606755620926, 0.029394884507308],
  3216. [0.010516523468793, 0.029427287237024],
  3217. [0.010426192331137, 0.029459412985906],
  3218. [0.010335763058187, 0.029491261451573],
  3219. [0.010245236501099, 0.029522832334255],
  3220. [0.010154613511943, 0.029554125336796],
  3221. [0.010063894943698, 0.029585140164654],
  3222. [0.009973081650240, 0.029615876525905],
  3223. [0.009882174486340, 0.029646334131247],
  3224. [0.009791174307650, 0.029676512694001],
  3225. [0.009700081970699, 0.029706411930116],
  3226. [0.009608898332881, 0.029736031558168],
  3227. [0.009517624252453, 0.029765371299366],
  3228. [0.009426260588521, 0.029794430877553],
  3229. [0.009334808201034, 0.029823210019210],
  3230. [0.009243267950778, 0.029851708453456],
  3231. [0.009151640699363, 0.029879925912053],
  3232. [0.009059927309220, 0.029907862129408],
  3233. [0.008968128643591, 0.029935516842573],
  3234. [0.008876245566520, 0.029962889791254],
  3235. [0.008784278942845, 0.029989980717805],
  3236. [0.008692229638191, 0.030016789367235],
  3237. [0.008600098518961, 0.030043315487212],
  3238. [0.008507886452329, 0.030069558828062],
  3239. [0.008415594306230, 0.030095519142772],
  3240. [0.008323222949351, 0.030121196186994],
  3241. [0.008230773251129, 0.030146589719046],
  3242. [0.008138246081733, 0.030171699499915],
  3243. [0.008045642312067, 0.030196525293257],
  3244. [0.007952962813750, 0.030221066865402],
  3245. [0.007860208459119, 0.030245323985357],
  3246. [0.007767380121212, 0.030269296424803],
  3247. [0.007674478673766, 0.030292983958103],
  3248. [0.007581504991203, 0.030316386362302],
  3249. [0.007488459948628, 0.030339503417126],
  3250. [0.007395344421816, 0.030362334904989],
  3251. [0.007302159287206, 0.030384880610993],
  3252. [0.007208905421891, 0.030407140322928],
  3253. [0.007115583703613, 0.030429113831278],
  3254. [0.007022195010752, 0.030450800929220],
  3255. [0.006928740222316, 0.030472201412626],
  3256. [0.006835220217939, 0.030493315080068],
  3257. [0.006741635877866, 0.030514141732814],
  3258. [0.006647988082948, 0.030534681174838],
  3259. [0.006554277714635, 0.030554933212813],
  3260. [0.006460505654964, 0.030574897656119],
  3261. [0.006366672786553, 0.030594574316845],
  3262. [0.006272779992593, 0.030613963009786],
  3263. [0.006178828156839, 0.030633063552447],
  3264. [0.006084818163601, 0.030651875765048],
  3265. [0.005990750897737, 0.030670399470520],
  3266. [0.005896627244644, 0.030688634494512],
  3267. [0.005802448090250, 0.030706580665388],
  3268. [0.005708214321004, 0.030724237814232],
  3269. [0.005613926823871, 0.030741605774849],
  3270. [0.005519586486321, 0.030758684383764],
  3271. [0.005425194196321, 0.030775473480228],
  3272. [0.005330750842327, 0.030791972906214],
  3273. [0.005236257313276, 0.030808182506425],
  3274. [0.005141714498576, 0.030824102128288],
  3275. [0.005047123288102, 0.030839731621963],
  3276. [0.004952484572181, 0.030855070840339],
  3277. [0.004857799241589, 0.030870119639036],
  3278. [0.004763068187541, 0.030884877876411],
  3279. [0.004668292301681, 0.030899345413553],
  3280. [0.004573472476075, 0.030913522114288],
  3281. [0.004478609603205, 0.030927407845180],
  3282. [0.004383704575956, 0.030941002475530],
  3283. [0.004288758287610, 0.030954305877381],
  3284. [0.004193771631837, 0.030967317925516],
  3285. [0.004098745502689, 0.030980038497461],
  3286. [0.004003680794587, 0.030992467473486],
  3287. [0.003908578402316, 0.031004604736602],
  3288. [0.003813439221017, 0.031016450172571],
  3289. [0.003718264146176, 0.031028003669899],
  3290. [0.003623054073616, 0.031039265119839],
  3291. [0.003527809899492, 0.031050234416394],
  3292. [0.003432532520278, 0.031060911456318],
  3293. [0.003337222832760, 0.031071296139114],
  3294. [0.003241881734029, 0.031081388367037],
  3295. [0.003146510121474, 0.031091188045095],
  3296. [0.003051108892766, 0.031100695081051],
  3297. [0.002955678945860, 0.031109909385419],
  3298. [0.002860221178978, 0.031118830871473],
  3299. [0.002764736490604, 0.031127459455239],
  3300. [0.002669225779478, 0.031135795055501],
  3301. [0.002573689944583, 0.031143837593803],
  3302. [0.002478129885137, 0.031151586994444],
  3303. [0.002382546500589, 0.031159043184484],
  3304. [0.002286940690606, 0.031166206093743],
  3305. [0.002191313355067, 0.031173075654800],
  3306. [0.002095665394051, 0.031179651802998],
  3307. [0.001999997707835, 0.031185934476438],
  3308. [0.001904311196878, 0.031191923615985],
  3309. [0.001808606761820, 0.031197619165268],
  3310. [0.001712885303465, 0.031203021070678],
  3311. [0.001617147722782, 0.031208129281370],
  3312. [0.001521394920889, 0.031212943749264],
  3313. [0.001425627799047, 0.031217464429043],
  3314. [0.001329847258653, 0.031221691278159],
  3315. [0.001234054201231, 0.031225624256825],
  3316. [0.001138249528420, 0.031229263328024],
  3317. [0.001042434141971, 0.031232608457502],
  3318. [0.000946608943736, 0.031235659613775],
  3319. [0.000850774835656, 0.031238416768124],
  3320. [0.000754932719759, 0.031240879894597],
  3321. [0.000659083498149, 0.031243048970010],
  3322. [0.000563228072993, 0.031244923973948],
  3323. [0.000467367346520, 0.031246504888762],
  3324. [0.000371502221008, 0.031247791699571],
  3325. [0.000275633598775, 0.031248784394264],
  3326. [0.000179762382174, 0.031249482963498],
  3327. [0.000083889473581, 0.031249887400697]
  3328. ];
  3329. exports.MDCT_TABLE_256 = [
  3330. [0.088387931675923, 0.000271171628935],
  3331. [0.088354655998507, 0.002440238387037],
  3332. [0.088268158780110, 0.004607835236780],
  3333. [0.088128492123423, 0.006772656498875],
  3334. [0.087935740158418, 0.008933398165942],
  3335. [0.087690018991670, 0.011088758687994],
  3336. [0.087391476636423, 0.013237439756448],
  3337. [0.087040292923427, 0.015378147086172],
  3338. [0.086636679392621, 0.017509591195118],
  3339. [0.086180879165703, 0.019630488181053],
  3340. [0.085673166799686, 0.021739560494940],
  3341. [0.085113848121515, 0.023835537710479],
  3342. [0.084503260043847, 0.025917157289369],
  3343. [0.083841770362110, 0.027983165341813],
  3344. [0.083129777532952, 0.030032317381813],
  3345. [0.082367710434230, 0.032063379076803],
  3346. [0.081556028106671, 0.034075126991164],
  3347. [0.080695219477356, 0.036066349323177],
  3348. [0.079785803065216, 0.038035846634965],
  3349. [0.078828326668693, 0.039982432574992],
  3350. [0.077823367035766, 0.041904934592675],
  3351. [0.076771529516540, 0.043802194644686],
  3352. [0.075673447698606, 0.045673069892513],
  3353. [0.074529783025390, 0.047516433390863],
  3354. [0.073341224397728, 0.049331174766491],
  3355. [0.072108487758894, 0.051116200887052],
  3356. [0.070832315663343, 0.052870436519557],
  3357. [0.069513476829429, 0.054592824978055],
  3358. [0.068152765676348, 0.056282328760143],
  3359. [0.066751001845620, 0.057937930171918],
  3360. [0.065309029707361, 0.059558631940996],
  3361. [0.063827717851668, 0.061143457817234],
  3362. [0.062307958565413, 0.062691453160784],
  3363. [0.060750667294763, 0.064201685517134],
  3364. [0.059156782093749, 0.065673245178784],
  3365. [0.057527263059216, 0.067105245733220],
  3366. [0.055863091752499, 0.068496824596852],
  3367. [0.054165270608165, 0.069847143534609],
  3368. [0.052434822330188, 0.071155389164853],
  3369. [0.050672789275903, 0.072420773449336],
  3370. [0.048880232828135, 0.073642534167879],
  3371. [0.047058232755862, 0.074819935377512],
  3372. [0.045207886563797, 0.075952267855771],
  3373. [0.043330308831298, 0.077038849527912],
  3374. [0.041426630540984, 0.078079025877766],
  3375. [0.039497998397473, 0.079072170341994],
  3376. [0.037545574136653, 0.080017684687506],
  3377. [0.035570533825892, 0.080914999371817],
  3378. [0.033574067155622, 0.081763573886112],
  3379. [0.031557376722714, 0.082562897080836],
  3380. [0.029521677306074, 0.083312487473584],
  3381. [0.027468195134911, 0.084011893539132],
  3382. [0.025398167150101, 0.084660693981419],
  3383. [0.023312840259098, 0.085258497987320],
  3384. [0.021213470584847, 0.085804945462053],
  3385. [0.019101322709138, 0.086299707246093],
  3386. [0.016977668910873, 0.086742485313442],
  3387. [0.014843788399692, 0.087133012951149],
  3388. [0.012700966545425, 0.087471054919968],
  3389. [0.010550494103830, 0.087756407596056],
  3390. [0.008393666439096, 0.087988899093631],
  3391. [0.006231782743558, 0.088168389368510],
  3392. [0.004066145255116, 0.088294770302461],
  3393. [0.001898058472816, 0.088367965768336]
  3394. ];
  3395. exports.MDCT_TABLE_1920 = [
  3396. [0.032274858518097, 0.000013202404176],
  3397. [0.032274642494505, 0.000118821372483],
  3398. [0.032274080835421, 0.000224439068308],
  3399. [0.032273173546860, 0.000330054360572],
  3400. [0.032271920638538, 0.000435666118218],
  3401. [0.032270322123873, 0.000541273210231],
  3402. [0.032268378019984, 0.000646874505642],
  3403. [0.032266088347691, 0.000752468873546],
  3404. [0.032263453131514, 0.000858055183114],
  3405. [0.032260472399674, 0.000963632303600],
  3406. [0.032257146184092, 0.001069199104358],
  3407. [0.032253474520390, 0.001174754454853],
  3408. [0.032249457447888, 0.001280297224671],
  3409. [0.032245095009606, 0.001385826283535],
  3410. [0.032240387252262, 0.001491340501313],
  3411. [0.032235334226272, 0.001596838748031],
  3412. [0.032229935985750, 0.001702319893890],
  3413. [0.032224192588507, 0.001807782809271],
  3414. [0.032218104096050, 0.001913226364749],
  3415. [0.032211670573582, 0.002018649431111],
  3416. [0.032204892090000, 0.002124050879359],
  3417. [0.032197768717898, 0.002229429580728],
  3418. [0.032190300533560, 0.002334784406698],
  3419. [0.032182487616965, 0.002440114229003],
  3420. [0.032174330051782, 0.002545417919644],
  3421. [0.032165827925374, 0.002650694350905],
  3422. [0.032156981328790, 0.002755942395358],
  3423. [0.032147790356771, 0.002861160925883],
  3424. [0.032138255107744, 0.002966348815672],
  3425. [0.032128375683825, 0.003071504938250],
  3426. [0.032118152190814, 0.003176628167476],
  3427. [0.032107584738196, 0.003281717377568],
  3428. [0.032096673439141, 0.003386771443102],
  3429. [0.032085418410500, 0.003491789239036],
  3430. [0.032073819772804, 0.003596769640711],
  3431. [0.032061877650267, 0.003701711523874],
  3432. [0.032049592170778, 0.003806613764680],
  3433. [0.032036963465906, 0.003911475239711],
  3434. [0.032023991670893, 0.004016294825985],
  3435. [0.032010676924657, 0.004121071400967],
  3436. [0.031997019369789, 0.004225803842586],
  3437. [0.031983019152549, 0.004330491029241],
  3438. [0.031968676422869, 0.004435131839816],
  3439. [0.031953991334348, 0.004539725153692],
  3440. [0.031938964044252, 0.004644269850758],
  3441. [0.031923594713510, 0.004748764811426],
  3442. [0.031907883506716, 0.004853208916638],
  3443. [0.031891830592124, 0.004957601047881],
  3444. [0.031875436141648, 0.005061940087200],
  3445. [0.031858700330859, 0.005166224917208],
  3446. [0.031841623338985, 0.005270454421097],
  3447. [0.031824205348907, 0.005374627482653],
  3448. [0.031806446547156, 0.005478742986267],
  3449. [0.031788347123916, 0.005582799816945],
  3450. [0.031769907273017, 0.005686796860323],
  3451. [0.031751127191935, 0.005790733002674],
  3452. [0.031732007081789, 0.005894607130928],
  3453. [0.031712547147340, 0.005998418132675],
  3454. [0.031692747596989, 0.006102164896182],
  3455. [0.031672608642773, 0.006205846310406],
  3456. [0.031652130500364, 0.006309461265002],
  3457. [0.031631313389067, 0.006413008650337],
  3458. [0.031610157531816, 0.006516487357501],
  3459. [0.031588663155172, 0.006619896278321],
  3460. [0.031566830489325, 0.006723234305370],
  3461. [0.031544659768083, 0.006826500331981],
  3462. [0.031522151228878, 0.006929693252258],
  3463. [0.031499305112758, 0.007032811961088],
  3464. [0.031476121664387, 0.007135855354151],
  3465. [0.031452601132040, 0.007238822327937],
  3466. [0.031428743767604, 0.007341711779751],
  3467. [0.031404549826572, 0.007444522607730],
  3468. [0.031380019568042, 0.007547253710853],
  3469. [0.031355153254712, 0.007649903988952],
  3470. [0.031329951152882, 0.007752472342725],
  3471. [0.031304413532445, 0.007854957673748],
  3472. [0.031278540666888, 0.007957358884484],
  3473. [0.031252332833290, 0.008059674878300],
  3474. [0.031225790312316, 0.008161904559473],
  3475. [0.031198913388214, 0.008264046833205],
  3476. [0.031171702348814, 0.008366100605636],
  3477. [0.031144157485525, 0.008468064783849],
  3478. [0.031116279093331, 0.008569938275893],
  3479. [0.031088067470786, 0.008671719990782],
  3480. [0.031059522920014, 0.008773408838517],
  3481. [0.031030645746705, 0.008875003730092],
  3482. [0.031001436260110, 0.008976503577507],
  3483. [0.030971894773039, 0.009077907293780],
  3484. [0.030942021601857, 0.009179213792959],
  3485. [0.030911817066483, 0.009280421990133],
  3486. [0.030881281490382, 0.009381530801444],
  3487. [0.030850415200566, 0.009482539144097],
  3488. [0.030819218527589, 0.009583445936373],
  3489. [0.030787691805541, 0.009684250097643],
  3490. [0.030755835372048, 0.009784950548375],
  3491. [0.030723649568268, 0.009885546210147],
  3492. [0.030691134738883, 0.009986036005661],
  3493. [0.030658291232103, 0.010086418858753],
  3494. [0.030625119399655, 0.010186693694402],
  3495. [0.030591619596781, 0.010286859438745],
  3496. [0.030557792182239, 0.010386915019088],
  3497. [0.030523637518292, 0.010486859363916],
  3498. [0.030489155970710, 0.010586691402906],
  3499. [0.030454347908763, 0.010686410066936],
  3500. [0.030419213705216, 0.010786014288099],
  3501. [0.030383753736329, 0.010885502999714],
  3502. [0.030347968381849, 0.010984875136338],
  3503. [0.030311858025010, 0.011084129633775],
  3504. [0.030275423052523, 0.011183265429088],
  3505. [0.030238663854579, 0.011282281460612],
  3506. [0.030201580824838, 0.011381176667967],
  3507. [0.030164174360430, 0.011479949992062],
  3508. [0.030126444861948, 0.011578600375117],
  3509. [0.030088392733446, 0.011677126760663],
  3510. [0.030050018382430, 0.011775528093563],
  3511. [0.030011322219859, 0.011873803320018],
  3512. [0.029972304660138, 0.011971951387578],
  3513. [0.029932966121114, 0.012069971245157],
  3514. [0.029893307024070, 0.012167861843041],
  3515. [0.029853327793724, 0.012265622132901],
  3516. [0.029813028858222, 0.012363251067801],
  3517. [0.029772410649132, 0.012460747602215],
  3518. [0.029731473601443, 0.012558110692033],
  3519. [0.029690218153558, 0.012655339294575],
  3520. [0.029648644747289, 0.012752432368600],
  3521. [0.029606753827855, 0.012849388874320],
  3522. [0.029564545843872, 0.012946207773407],
  3523. [0.029522021247356, 0.013042888029011],
  3524. [0.029479180493710, 0.013139428605762],
  3525. [0.029436024041725, 0.013235828469789],
  3526. [0.029392552353570, 0.013332086588727],
  3527. [0.029348765894794, 0.013428201931728],
  3528. [0.029304665134313, 0.013524173469475],
  3529. [0.029260250544412, 0.013620000174189],
  3530. [0.029215522600735, 0.013715681019643],
  3531. [0.029170481782283, 0.013811214981173],
  3532. [0.029125128571406, 0.013906601035686],
  3533. [0.029079463453801, 0.014001838161674],
  3534. [0.029033486918505, 0.014096925339225],
  3535. [0.028987199457889, 0.014191861550031],
  3536. [0.028940601567655, 0.014286645777401],
  3537. [0.028893693746829, 0.014381277006273],
  3538. [0.028846476497755, 0.014475754223221],
  3539. [0.028798950326094, 0.014570076416472],
  3540. [0.028751115740811, 0.014664242575910],
  3541. [0.028702973254178, 0.014758251693091],
  3542. [0.028654523381760, 0.014852102761253],
  3543. [0.028605766642418, 0.014945794775326],
  3544. [0.028556703558297, 0.015039326731945],
  3545. [0.028507334654823, 0.015132697629457],
  3546. [0.028457660460698, 0.015225906467935],
  3547. [0.028407681507891, 0.015318952249187],
  3548. [0.028357398331639, 0.015411833976768],
  3549. [0.028306811470432, 0.015504550655988],
  3550. [0.028255921466016, 0.015597101293927],
  3551. [0.028204728863381, 0.015689484899442],
  3552. [0.028153234210760, 0.015781700483179],
  3553. [0.028101438059619, 0.015873747057582],
  3554. [0.028049340964652, 0.015965623636907],
  3555. [0.027996943483779, 0.016057329237229],
  3556. [0.027944246178133, 0.016148862876456],
  3557. [0.027891249612061, 0.016240223574335],
  3558. [0.027837954353113, 0.016331410352467],
  3559. [0.027784360972039, 0.016422422234315],
  3560. [0.027730470042780, 0.016513258245214],
  3561. [0.027676282142466, 0.016603917412384],
  3562. [0.027621797851405, 0.016694398764938],
  3563. [0.027567017753080, 0.016784701333894],
  3564. [0.027511942434143, 0.016874824152183],
  3565. [0.027456572484404, 0.016964766254662],
  3566. [0.027400908496833, 0.017054526678124],
  3567. [0.027344951067546, 0.017144104461307],
  3568. [0.027288700795801, 0.017233498644904],
  3569. [0.027232158283994, 0.017322708271577],
  3570. [0.027175324137651, 0.017411732385960],
  3571. [0.027118198965418, 0.017500570034678],
  3572. [0.027060783379060, 0.017589220266351],
  3573. [0.027003077993454, 0.017677682131607],
  3574. [0.026945083426576, 0.017765954683088],
  3575. [0.026886800299502, 0.017854036975468],
  3576. [0.026828229236397, 0.017941928065456],
  3577. [0.026769370864511, 0.018029627011808],
  3578. [0.026710225814170, 0.018117132875340],
  3579. [0.026650794718768, 0.018204444718934],
  3580. [0.026591078214767, 0.018291561607551],
  3581. [0.026531076941680, 0.018378482608238],
  3582. [0.026470791542075, 0.018465206790142],
  3583. [0.026410222661558, 0.018551733224515],
  3584. [0.026349370948775, 0.018638060984730],
  3585. [0.026288237055398, 0.018724189146286],
  3586. [0.026226821636121, 0.018810116786819],
  3587. [0.026165125348656, 0.018895842986112],
  3588. [0.026103148853718, 0.018981366826109],
  3589. [0.026040892815028, 0.019066687390916],
  3590. [0.025978357899296, 0.019151803766819],
  3591. [0.025915544776223, 0.019236715042290],
  3592. [0.025852454118485, 0.019321420307998],
  3593. [0.025789086601733, 0.019405918656817],
  3594. [0.025725442904582, 0.019490209183837],
  3595. [0.025661523708606, 0.019574290986376],
  3596. [0.025597329698327, 0.019658163163984],
  3597. [0.025532861561211, 0.019741824818458],
  3598. [0.025468119987662, 0.019825275053848],
  3599. [0.025403105671008, 0.019908512976470],
  3600. [0.025337819307501, 0.019991537694913],
  3601. [0.025272261596305, 0.020074348320047],
  3602. [0.025206433239491, 0.020156943965039],
  3603. [0.025140334942028, 0.020239323745355],
  3604. [0.025073967411776, 0.020321486778774],
  3605. [0.025007331359476, 0.020403432185395],
  3606. [0.024940427498748, 0.020485159087650],
  3607. [0.024873256546079, 0.020566666610309],
  3608. [0.024805819220816, 0.020647953880491],
  3609. [0.024738116245157, 0.020729020027676],
  3610. [0.024670148344147, 0.020809864183709],
  3611. [0.024601916245669, 0.020890485482816],
  3612. [0.024533420680433, 0.020970883061607],
  3613. [0.024464662381971, 0.021051056059087],
  3614. [0.024395642086630, 0.021131003616670],
  3615. [0.024326360533561, 0.021210724878181],
  3616. [0.024256818464715, 0.021290218989868],
  3617. [0.024187016624830, 0.021369485100415],
  3618. [0.024116955761430, 0.021448522360944],
  3619. [0.024046636624808, 0.021527329925030],
  3620. [0.023976059968027, 0.021605906948708],
  3621. [0.023905226546906, 0.021684252590480],
  3622. [0.023834137120014, 0.021762366011328],
  3623. [0.023762792448662, 0.021840246374720],
  3624. [0.023691193296893, 0.021917892846620],
  3625. [0.023619340431478, 0.021995304595495],
  3626. [0.023547234621902, 0.022072480792330],
  3627. [0.023474876640361, 0.022149420610628],
  3628. [0.023402267261751, 0.022226123226426],
  3629. [0.023329407263659, 0.022302587818300],
  3630. [0.023256297426359, 0.022378813567377],
  3631. [0.023182938532797, 0.022454799657339],
  3632. [0.023109331368588, 0.022530545274437],
  3633. [0.023035476722006, 0.022606049607496],
  3634. [0.022961375383975, 0.022681311847926],
  3635. [0.022887028148061, 0.022756331189727],
  3636. [0.022812435810462, 0.022831106829504],
  3637. [0.022737599170003, 0.022905637966469],
  3638. [0.022662519028125, 0.022979923802453],
  3639. [0.022587196188874, 0.023053963541915],
  3640. [0.022511631458899, 0.023127756391950],
  3641. [0.022435825647437, 0.023201301562294],
  3642. [0.022359779566306, 0.023274598265338],
  3643. [0.022283494029900, 0.023347645716133],
  3644. [0.022206969855176, 0.023420443132400],
  3645. [0.022130207861645, 0.023492989734537],
  3646. [0.022053208871367, 0.023565284745628],
  3647. [0.021975973708940, 0.023637327391451],
  3648. [0.021898503201489, 0.023709116900488],
  3649. [0.021820798178663, 0.023780652503931],
  3650. [0.021742859472618, 0.023851933435691],
  3651. [0.021664687918017, 0.023922958932406],
  3652. [0.021586284352013, 0.023993728233451],
  3653. [0.021507649614247, 0.024064240580942],
  3654. [0.021428784546832, 0.024134495219750],
  3655. [0.021349689994350, 0.024204491397504],
  3656. [0.021270366803840, 0.024274228364600],
  3657. [0.021190815824791, 0.024343705374213],
  3658. [0.021111037909128, 0.024412921682298],
  3659. [0.021031033911210, 0.024481876547605],
  3660. [0.020950804687815, 0.024550569231683],
  3661. [0.020870351098134, 0.024618998998889],
  3662. [0.020789674003759, 0.024687165116394],
  3663. [0.020708774268678, 0.024755066854194],
  3664. [0.020627652759262, 0.024822703485116],
  3665. [0.020546310344257, 0.024890074284826],
  3666. [0.020464747894775, 0.024957178531837],
  3667. [0.020382966284284, 0.025024015507516],
  3668. [0.020300966388600, 0.025090584496093],
  3669. [0.020218749085876, 0.025156884784668],
  3670. [0.020136315256592, 0.025222915663218],
  3671. [0.020053665783549, 0.025288676424605],
  3672. [0.019970801551857, 0.025354166364584],
  3673. [0.019887723448925, 0.025419384781811],
  3674. [0.019804432364452, 0.025484330977848],
  3675. [0.019720929190419, 0.025549004257175],
  3676. [0.019637214821078, 0.025613403927192],
  3677. [0.019553290152943, 0.025677529298230],
  3678. [0.019469156084779, 0.025741379683559],
  3679. [0.019384813517595, 0.025804954399392],
  3680. [0.019300263354632, 0.025868252764895],
  3681. [0.019215506501354, 0.025931274102193],
  3682. [0.019130543865439, 0.025994017736379],
  3683. [0.019045376356769, 0.026056482995518],
  3684. [0.018960004887419, 0.026118669210657],
  3685. [0.018874430371648, 0.026180575715833],
  3686. [0.018788653725892, 0.026242201848076],
  3687. [0.018702675868750, 0.026303546947421],
  3688. [0.018616497720974, 0.026364610356909],
  3689. [0.018530120205464, 0.026425391422602],
  3690. [0.018443544247254, 0.026485889493583],
  3691. [0.018356770773502, 0.026546103921965],
  3692. [0.018269800713483, 0.026606034062902],
  3693. [0.018182634998576, 0.026665679274589],
  3694. [0.018095274562256, 0.026725038918274],
  3695. [0.018007720340083, 0.026784112358263],
  3696. [0.017919973269692, 0.026842898961926],
  3697. [0.017832034290785, 0.026901398099707],
  3698. [0.017743904345116, 0.026959609145127],
  3699. [0.017655584376488, 0.027017531474792],
  3700. [0.017567075330734, 0.027075164468401],
  3701. [0.017478378155718, 0.027132507508750],
  3702. [0.017389493801313, 0.027189559981742],
  3703. [0.017300423219401, 0.027246321276391],
  3704. [0.017211167363854, 0.027302790784828],
  3705. [0.017121727190533, 0.027358967902310],
  3706. [0.017032103657269, 0.027414852027226],
  3707. [0.016942297723858, 0.027470442561102],
  3708. [0.016852310352050, 0.027525738908608],
  3709. [0.016762142505537, 0.027580740477564],
  3710. [0.016671795149944, 0.027635446678948],
  3711. [0.016581269252819, 0.027689856926900],
  3712. [0.016490565783622, 0.027743970638730],
  3713. [0.016399685713714, 0.027797787234924],
  3714. [0.016308630016347, 0.027851306139149],
  3715. [0.016217399666655, 0.027904526778260],
  3716. [0.016125995641641, 0.027957448582309],
  3717. [0.016034418920170, 0.028010070984544],
  3718. [0.015942670482954, 0.028062393421421],
  3719. [0.015850751312545, 0.028114415332610],
  3720. [0.015758662393324, 0.028166136160998],
  3721. [0.015666404711489, 0.028217555352697],
  3722. [0.015573979255046, 0.028268672357047],
  3723. [0.015481387013797, 0.028319486626627],
  3724. [0.015388628979331, 0.028369997617257],
  3725. [0.015295706145012, 0.028420204788004],
  3726. [0.015202619505968, 0.028470107601191],
  3727. [0.015109370059084, 0.028519705522399],
  3728. [0.015015958802984, 0.028568998020472],
  3729. [0.014922386738030, 0.028617984567529],
  3730. [0.014828654866302, 0.028666664638963],
  3731. [0.014734764191593, 0.028715037713449],
  3732. [0.014640715719398, 0.028763103272951],
  3733. [0.014546510456900, 0.028810860802724],
  3734. [0.014452149412962, 0.028858309791325],
  3735. [0.014357633598114, 0.028905449730613],
  3736. [0.014262964024545, 0.028952280115756],
  3737. [0.014168141706090, 0.028998800445240],
  3738. [0.014073167658220, 0.029045010220868],
  3739. [0.013978042898030, 0.029090908947771],
  3740. [0.013882768444231, 0.029136496134411],
  3741. [0.013787345317136, 0.029181771292585],
  3742. [0.013691774538648, 0.029226733937433],
  3743. [0.013596057132255, 0.029271383587441],
  3744. [0.013500194123014, 0.029315719764447],
  3745. [0.013404186537539, 0.029359741993647],
  3746. [0.013308035403995, 0.029403449803598],
  3747. [0.013211741752084, 0.029446842726223],
  3748. [0.013115306613032, 0.029489920296820],
  3749. [0.013018731019584, 0.029532682054063],
  3750. [0.012922016005985, 0.029575127540008],
  3751. [0.012825162607977, 0.029617256300097],
  3752. [0.012728171862781, 0.029659067883165],
  3753. [0.012631044809089, 0.029700561841444],
  3754. [0.012533782487056, 0.029741737730567],
  3755. [0.012436385938281, 0.029782595109573],
  3756. [0.012338856205805, 0.029823133540913],
  3757. [0.012241194334091, 0.029863352590452],
  3758. [0.012143401369021, 0.029903251827477],
  3759. [0.012045478357878, 0.029942830824699],
  3760. [0.011947426349339, 0.029982089158259],
  3761. [0.011849246393462, 0.030021026407731],
  3762. [0.011750939541676, 0.030059642156129],
  3763. [0.011652506846768, 0.030097935989909],
  3764. [0.011553949362874, 0.030135907498976],
  3765. [0.011455268145464, 0.030173556276684],
  3766. [0.011356464251335, 0.030210881919845],
  3767. [0.011257538738598, 0.030247884028732],
  3768. [0.011158492666665, 0.030284562207083],
  3769. [0.011059327096240, 0.030320916062102],
  3770. [0.010960043089307, 0.030356945204470],
  3771. [0.010860641709118, 0.030392649248343],
  3772. [0.010761124020182, 0.030428027811361],
  3773. [0.010661491088253, 0.030463080514646],
  3774. [0.010561743980319, 0.030497806982812],
  3775. [0.010461883764593, 0.030532206843968],
  3776. [0.010361911510496, 0.030566279729717],
  3777. [0.010261828288652, 0.030600025275167],
  3778. [0.010161635170872, 0.030633443118931],
  3779. [0.010061333230142, 0.030666532903129],
  3780. [0.009960923540617, 0.030699294273397],
  3781. [0.009860407177603, 0.030731726878888],
  3782. [0.009759785217550, 0.030763830372273],
  3783. [0.009659058738038, 0.030795604409750],
  3784. [0.009558228817767, 0.030827048651045],
  3785. [0.009457296536545, 0.030858162759415],
  3786. [0.009356262975275, 0.030888946401653],
  3787. [0.009255129215945, 0.030919399248091],
  3788. [0.009153896341616, 0.030949520972603],
  3789. [0.009052565436412, 0.030979311252611],
  3790. [0.008951137585505, 0.031008769769084],
  3791. [0.008849613875105, 0.031037896206544],
  3792. [0.008747995392451, 0.031066690253072],
  3793. [0.008646283225794, 0.031095151600306],
  3794. [0.008544478464390, 0.031123279943448],
  3795. [0.008442582198486, 0.031151074981266],
  3796. [0.008340595519310, 0.031178536416098],
  3797. [0.008238519519057, 0.031205663953853],
  3798. [0.008136355290878, 0.031232457304017],
  3799. [0.008034103928871, 0.031258916179656],
  3800. [0.007931766528065, 0.031285040297416],
  3801. [0.007829344184412, 0.031310829377528],
  3802. [0.007726837994772, 0.031336283143813],
  3803. [0.007624249056906, 0.031361401323680],
  3804. [0.007521578469457, 0.031386183648135],
  3805. [0.007418827331946, 0.031410629851778],
  3806. [0.007315996744755, 0.031434739672811],
  3807. [0.007213087809115, 0.031458512853036],
  3808. [0.007110101627101, 0.031481949137863],
  3809. [0.007007039301610, 0.031505048276306],
  3810. [0.006903901936357, 0.031527810020993],
  3811. [0.006800690635862, 0.031550234128164],
  3812. [0.006697406505433, 0.031572320357675],
  3813. [0.006594050651161, 0.031594068473000],
  3814. [0.006490624179905, 0.031615478241233],
  3815. [0.006387128199278, 0.031636549433095],
  3816. [0.006283563817639, 0.031657281822929],
  3817. [0.006179932144080, 0.031677675188707],
  3818. [0.006076234288412, 0.031697729312034],
  3819. [0.005972471361157, 0.031717443978146],
  3820. [0.005868644473532, 0.031736818975914],
  3821. [0.005764754737440, 0.031755854097848],
  3822. [0.005660803265456, 0.031774549140098],
  3823. [0.005556791170816, 0.031792903902453],
  3824. [0.005452719567407, 0.031810918188350],
  3825. [0.005348589569753, 0.031828591804869],
  3826. [0.005244402293001, 0.031845924562742],
  3827. [0.005140158852914, 0.031862916276347],
  3828. [0.005035860365855, 0.031879566763717],
  3829. [0.004931507948778, 0.031895875846539],
  3830. [0.004827102719212, 0.031911843350155],
  3831. [0.004722645795254, 0.031927469103567],
  3832. [0.004618138295554, 0.031942752939435],
  3833. [0.004513581339303, 0.031957694694082],
  3834. [0.004408976046222, 0.031972294207493],
  3835. [0.004304323536549, 0.031986551323320],
  3836. [0.004199624931030, 0.032000465888879],
  3837. [0.004094881350902, 0.032014037755158],
  3838. [0.003990093917884, 0.032027266776813],
  3839. [0.003885263754166, 0.032040152812170],
  3840. [0.003780391982394, 0.032052695723232],
  3841. [0.003675479725661, 0.032064895375674],
  3842. [0.003570528107494, 0.032076751638847],
  3843. [0.003465538251839, 0.032088264385780],
  3844. [0.003360511283053, 0.032099433493181],
  3845. [0.003255448325892, 0.032110258841438],
  3846. [0.003150350505494, 0.032120740314619],
  3847. [0.003045218947373, 0.032130877800478],
  3848. [0.002940054777404, 0.032140671190449],
  3849. [0.002834859121810, 0.032150120379653],
  3850. [0.002729633107153, 0.032159225266897],
  3851. [0.002624377860318, 0.032167985754674],
  3852. [0.002519094508504, 0.032176401749168],
  3853. [0.002413784179212, 0.032184473160250],
  3854. [0.002308448000231, 0.032192199901481],
  3855. [0.002203087099626, 0.032199581890114],
  3856. [0.002097702605728, 0.032206619047093],
  3857. [0.001992295647121, 0.032213311297057],
  3858. [0.001886867352628, 0.032219658568338],
  3859. [0.001781418851302, 0.032225660792960],
  3860. [0.001675951272410, 0.032231317906644],
  3861. [0.001570465745428, 0.032236629848809],
  3862. [0.001464963400018, 0.032241596562566],
  3863. [0.001359445366028, 0.032246217994727],
  3864. [0.001253912773470, 0.032250494095799],
  3865. [0.001148366752513, 0.032254424819990],
  3866. [0.001042808433471, 0.032258010125204],
  3867. [0.000937238946789, 0.032261249973045],
  3868. [0.000831659423030, 0.032264144328817],
  3869. [0.000726070992868, 0.032266693161525],
  3870. [0.000620474787068, 0.032268896443871],
  3871. [0.000514871936481, 0.032270754152261],
  3872. [0.000409263572030, 0.032272266266801],
  3873. [0.000303650824695, 0.032273432771295],
  3874. [0.000198034825504, 0.032274253653254],
  3875. [0.000092416705518, 0.032274728903884]
  3876. ];
  3877. exports.MDCT_TABLE_240 = [
  3878. [0.091286604111815, 0.000298735779793],
  3879. [0.091247502481454, 0.002688238127538],
  3880. [0.091145864370807, 0.005075898091152],
  3881. [0.090981759437558, 0.007460079287760],
  3882. [0.090755300151030, 0.009839147718664],
  3883. [0.090466641715108, 0.012211472889198],
  3884. [0.090115981961863, 0.014575428926191],
  3885. [0.089703561215976, 0.016929395692256],
  3886. [0.089229662130024, 0.019271759896156],
  3887. [0.088694609490769, 0.021600916198470],
  3888. [0.088098769996564, 0.023915268311810],
  3889. [0.087442552006035, 0.026213230094844],
  3890. [0.086726405258214, 0.028493226639351],
  3891. [0.085950820564309, 0.030753695349588],
  3892. [0.085116329471329, 0.032993087013213],
  3893. [0.084223503897785, 0.035209866863042],
  3894. [0.083272955741727, 0.037402515628894],
  3895. [0.082265336461381, 0.039569530578832],
  3896. [0.081201336628670, 0.041709426549053],
  3897. [0.080081685455930, 0.043820736961749],
  3898. [0.078907150296148, 0.045902014830227],
  3899. [0.077678536117054, 0.047951833750597],
  3900. [0.076396684949434, 0.049968788879362],
  3901. [0.075062475310050, 0.051951497896226],
  3902. [0.073676821599542, 0.053898601951466],
  3903. [0.072240673475749, 0.055808766597225],
  3904. [0.070755015202858, 0.057680682702068],
  3905. [0.069220864976840, 0.059513067348201],
  3906. [0.067639274227625, 0.061304664710718],
  3907. [0.066011326898512, 0.063054246918278],
  3908. [0.064338138703282, 0.064760614894630],
  3909. [0.062620856361546, 0.066422599180399],
  3910. [0.060860656812842, 0.068039060734572],
  3911. [0.059058746410016, 0.069608891715145],
  3912. [0.057216360092450, 0.071131016238378],
  3913. [0.055334760539699, 0.072604391116154],
  3914. [0.053415237306106, 0.074028006570930],
  3915. [0.051459105937014, 0.075400886927784],
  3916. [0.049467707067153, 0.076722091283096],
  3917. [0.047442405501835, 0.077990714149396],
  3918. [0.045384589281588, 0.079205886075941],
  3919. [0.043295668730857, 0.080366774244592],
  3920. [0.041177075491445, 0.081472583040586],
  3921. [0.039030261541332, 0.082522554597810],
  3922. [0.036856698199564, 0.083515969318206],
  3923. [0.034657875117883, 0.084452146364948],
  3924. [0.032435299259796, 0.085330444129049],
  3925. [0.030190493867775, 0.086150260669096],
  3926. [0.027924997419306, 0.086911034123781],
  3927. [0.025640362572491, 0.087612243096981],
  3928. [0.023338155101933, 0.088253407015092],
  3929. [0.021019952825636, 0.088834086456390],
  3930. [0.018687344523641, 0.089353883452193],
  3931. [0.016341928849164, 0.089812441759604],
  3932. [0.013985313232951, 0.090209447105664],
  3933. [0.011619112781631, 0.090544627402740],
  3934. [0.009244949170797, 0.090817752935000],
  3935. [0.006864449533597, 0.091028636515846],
  3936. [0.004479245345574, 0.091177133616206],
  3937. [0.002090971306534, 0.091263142463585]
  3938. ];
  3939. },{}],11:[function(require,module,exports){
  3940. /*
  3941. * AAC.js - Advanced Audio Coding decoder in JavaScript
  3942. * Created by Devon Govett
  3943. * Copyright (c) 2012, Official.fm Labs
  3944. *
  3945. * AAC.js is free software; you can redistribute it and/or modify it
  3946. * under the terms of the GNU Lesser General Public License as
  3947. * published by the Free Software Foundation; either version 3 of the
  3948. * License, or (at your option) any later version.
  3949. *
  3950. * AAC.js is distributed in the hope that it will be useful, but WITHOUT
  3951. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  3952. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
  3953. * Public License for more details.
  3954. *
  3955. * You should have received a copy of the GNU Lesser General Public
  3956. * License along with this library.
  3957. * If not, see <http://www.gnu.org/licenses/>.
  3958. */
  3959. /********************************************************************************
  3960. * Sample offset into the window indicating the beginning of a scalefactor
  3961. * window band
  3962. *
  3963. * scalefactor window band - term for scalefactor bands within a window,
  3964. * given in Table 4.110 to Table 4.128.
  3965. *
  3966. * scalefactor band - a set of spectral coefficients which are scaled by one
  3967. * scalefactor. In case of EIGHT_SHORT_SEQUENCE and grouping a scalefactor band
  3968. * may contain several scalefactor window bands of corresponding frequency. For
  3969. * all other window_sequences scalefactor bands and scalefactor window bands are
  3970. * identical.
  3971. *******************************************************************************/
  3972. const SWB_OFFSET_1024_96 = new Uint16Array([
  3973. 0, 4, 8, 12, 16, 20, 24, 28,
  3974. 32, 36, 40, 44, 48, 52, 56, 64,
  3975. 72, 80, 88, 96, 108, 120, 132, 144,
  3976. 156, 172, 188, 212, 240, 276, 320, 384,
  3977. 448, 512, 576, 640, 704, 768, 832, 896,
  3978. 960, 1024
  3979. ]);
  3980. const SWB_OFFSET_128_96 = new Uint16Array([
  3981. 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128
  3982. ]);
  3983. const SWB_OFFSET_1024_64 = new Uint16Array([
  3984. 0, 4, 8, 12, 16, 20, 24, 28,
  3985. 32, 36, 40, 44, 48, 52, 56, 64,
  3986. 72, 80, 88, 100, 112, 124, 140, 156,
  3987. 172, 192, 216, 240, 268, 304, 344, 384,
  3988. 424, 464, 504, 544, 584, 624, 664, 704,
  3989. 744, 784, 824, 864, 904, 944, 984, 1024
  3990. ]);
  3991. const SWB_OFFSET_128_64 = new Uint16Array([
  3992. 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128
  3993. ]);
  3994. const SWB_OFFSET_1024_48 = new Uint16Array([
  3995. 0, 4, 8, 12, 16, 20, 24, 28,
  3996. 32, 36, 40, 48, 56, 64, 72, 80,
  3997. 88, 96, 108, 120, 132, 144, 160, 176,
  3998. 196, 216, 240, 264, 292, 320, 352, 384,
  3999. 416, 448, 480, 512, 544, 576, 608, 640,
  4000. 672, 704, 736, 768, 800, 832, 864, 896,
  4001. 928, 1024
  4002. ]);
  4003. const SWB_OFFSET_128_48 = new Uint16Array([
  4004. 0, 4, 8, 12, 16, 20, 28, 36,
  4005. 44, 56, 68, 80, 96, 112, 128
  4006. ]);
  4007. const SWB_OFFSET_1024_32 = new Uint16Array([
  4008. 0, 4, 8, 12, 16, 20, 24, 28,
  4009. 32, 36, 40, 48, 56, 64, 72, 80,
  4010. 88, 96, 108, 120, 132, 144, 160, 176,
  4011. 196, 216, 240, 264, 292, 320, 352, 384,
  4012. 416, 448, 480, 512, 544, 576, 608, 640,
  4013. 672, 704, 736, 768, 800, 832, 864, 896,
  4014. 928, 960, 992, 1024
  4015. ]);
  4016. const SWB_OFFSET_1024_24 = new Uint16Array([
  4017. 0, 4, 8, 12, 16, 20, 24, 28,
  4018. 32, 36, 40, 44, 52, 60, 68, 76,
  4019. 84, 92, 100, 108, 116, 124, 136, 148,
  4020. 160, 172, 188, 204, 220, 240, 260, 284,
  4021. 308, 336, 364, 396, 432, 468, 508, 552,
  4022. 600, 652, 704, 768, 832, 896, 960, 1024
  4023. ]);
  4024. const SWB_OFFSET_128_24 = new Uint16Array([
  4025. 0, 4, 8, 12, 16, 20, 24, 28,
  4026. 36, 44, 52, 64, 76, 92, 108, 128
  4027. ]);
  4028. const SWB_OFFSET_1024_16 = new Uint16Array([
  4029. 0, 8, 16, 24, 32, 40, 48, 56,
  4030. 64, 72, 80, 88, 100, 112, 124, 136,
  4031. 148, 160, 172, 184, 196, 212, 228, 244,
  4032. 260, 280, 300, 320, 344, 368, 396, 424,
  4033. 456, 492, 532, 572, 616, 664, 716, 772,
  4034. 832, 896, 960, 1024
  4035. ]);
  4036. const SWB_OFFSET_128_16 = new Uint16Array([
  4037. 0, 4, 8, 12, 16, 20, 24, 28,
  4038. 32, 40, 48, 60, 72, 88, 108, 128
  4039. ]);
  4040. const SWB_OFFSET_1024_8 = new Uint16Array([
  4041. 0, 12, 24, 36, 48, 60, 72, 84,
  4042. 96, 108, 120, 132, 144, 156, 172, 188,
  4043. 204, 220, 236, 252, 268, 288, 308, 328,
  4044. 348, 372, 396, 420, 448, 476, 508, 544,
  4045. 580, 620, 664, 712, 764, 820, 880, 944,
  4046. 1024
  4047. ]);
  4048. const SWB_OFFSET_128_8 = new Uint16Array([
  4049. 0, 4, 8, 12, 16, 20, 24, 28,
  4050. 36, 44, 52, 60, 72, 88, 108, 128
  4051. ]);
  4052. exports.SWB_OFFSET_1024 = [
  4053. SWB_OFFSET_1024_96,
  4054. SWB_OFFSET_1024_96,
  4055. SWB_OFFSET_1024_64,
  4056. SWB_OFFSET_1024_48,
  4057. SWB_OFFSET_1024_48,
  4058. SWB_OFFSET_1024_32,
  4059. SWB_OFFSET_1024_24,
  4060. SWB_OFFSET_1024_24,
  4061. SWB_OFFSET_1024_16,
  4062. SWB_OFFSET_1024_16,
  4063. SWB_OFFSET_1024_16,
  4064. SWB_OFFSET_1024_8
  4065. ];
  4066. exports.SWB_OFFSET_128 = [
  4067. SWB_OFFSET_128_96,
  4068. SWB_OFFSET_128_96,
  4069. SWB_OFFSET_128_64,
  4070. SWB_OFFSET_128_48,
  4071. SWB_OFFSET_128_48,
  4072. SWB_OFFSET_128_48,
  4073. SWB_OFFSET_128_24,
  4074. SWB_OFFSET_128_24,
  4075. SWB_OFFSET_128_16,
  4076. SWB_OFFSET_128_16,
  4077. SWB_OFFSET_128_16,
  4078. SWB_OFFSET_128_8
  4079. ];
  4080. exports.SWB_SHORT_WINDOW_COUNT = new Uint8Array([
  4081. 12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15
  4082. ]);
  4083. exports.SWB_LONG_WINDOW_COUNT = new Uint8Array([
  4084. 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40
  4085. ]);
  4086. /*
  4087. * Scalefactor lookup table
  4088. */
  4089. exports.SCALEFACTOR_TABLE = (function() {
  4090. var table = new Float32Array(428);
  4091. for (var i = 0; i < 428; i++) {
  4092. table[i] = Math.pow(2, (i - 200) / 4);
  4093. }
  4094. return table;
  4095. })();
  4096. /**
  4097. * Inverse quantization lookup table
  4098. */
  4099. exports.IQ_TABLE = (function() {
  4100. var table = new Float32Array(8191),
  4101. four_thirds = 4/3;
  4102. for (var i = 0; i < 8191; i++) {
  4103. table[i] = Math.pow(i, four_thirds);
  4104. }
  4105. return table;
  4106. })();
  4107. exports.SAMPLE_RATES = new Int32Array([
  4108. 96000, 88200, 64000, 48000, 44100, 32000,
  4109. 24000, 22050, 16000, 12000, 11025, 8000, 7350
  4110. ]);
  4111. },{}],12:[function(require,module,exports){
  4112. /*
  4113. * AAC.js - Advanced Audio Coding decoder in JavaScript
  4114. * Created by Devon Govett
  4115. * Copyright (c) 2012, Official.fm Labs
  4116. *
  4117. * AAC.js is free software; you can redistribute it and/or modify it
  4118. * under the terms of the GNU Lesser General Public License as
  4119. * published by the Free Software Foundation; either version 3 of the
  4120. * License, or (at your option) any later version.
  4121. *
  4122. * AAC.js is distributed in the hope that it will be useful, but WITHOUT
  4123. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  4124. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
  4125. * Public License for more details.
  4126. *
  4127. * You should have received a copy of the GNU Lesser General Public
  4128. * License along with this library.
  4129. * If not, see <http://www.gnu.org/licenses/>.
  4130. */
  4131. // Temporal Noise Shaping
  4132. function TNS(config) {
  4133. this.maxBands = TNS_MAX_BANDS_1024[config.sampleIndex]
  4134. this.nFilt = new Int32Array(8);
  4135. this.length = new Array(8);
  4136. this.direction = new Array(8);
  4137. this.order = new Array(8);
  4138. this.coef = new Array(8);
  4139. // Probably could allocate these as needed
  4140. for (var w = 0; w < 8; w++) {
  4141. this.length[w] = new Int32Array(4);
  4142. this.direction[w] = new Array(4);
  4143. this.order[w] = new Int32Array(4);
  4144. this.coef[w] = new Array(4);
  4145. for (var filt = 0; filt < 4; filt++) {
  4146. this.coef[w][filt] = new Float32Array(TNS_MAX_ORDER);
  4147. }
  4148. }
  4149. this.lpc = new Float32Array(TNS_MAX_ORDER);
  4150. this.tmp = new Float32Array(TNS_MAX_ORDER);
  4151. }
  4152. const TNS_MAX_ORDER = 20,
  4153. SHORT_BITS = [1, 4, 3],
  4154. LONG_BITS = [2, 6, 5];
  4155. const TNS_COEF_1_3 = [0.00000000, -0.43388373, 0.64278758, 0.34202015],
  4156. TNS_COEF_0_3 = [0.00000000, -0.43388373, -0.78183150, -0.97492790,
  4157. 0.98480773, 0.86602539, 0.64278758, 0.34202015],
  4158. TNS_COEF_1_4 = [0.00000000, -0.20791170, -0.40673664, -0.58778524,
  4159. 0.67369562, 0.52643216, 0.36124167, 0.18374951],
  4160. TNS_COEF_0_4 = [0.00000000, -0.20791170, -0.40673664, -0.58778524,
  4161. -0.74314481, -0.86602539, -0.95105654, -0.99452192,
  4162. 0.99573416, 0.96182561, 0.89516330, 0.79801720,
  4163. 0.67369562, 0.52643216, 0.36124167, 0.18374951],
  4164. TNS_TABLES = [TNS_COEF_0_3, TNS_COEF_0_4, TNS_COEF_1_3, TNS_COEF_1_4];
  4165. const TNS_MAX_BANDS_1024 = [31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39, 39],
  4166. TNS_MAX_BANDS_128 = [9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14];
  4167. TNS.prototype.decode = function(stream, info) {
  4168. var windowCount = info.windowCount,
  4169. bits = info.windowSequence === 2 ? SHORT_BITS : LONG_BITS;
  4170. for (var w = 0; w < windowCount; w++) {
  4171. if (this.nFilt[w] = stream.read(bits[0])) {
  4172. var coefRes = stream.read(1),
  4173. nFilt_w = this.nFilt[w],
  4174. length_w = this.length[w],
  4175. order_w = this.order[w],
  4176. direction_w = this.direction[w],
  4177. coef_w = this.coef[w];
  4178. for (var filt = 0; filt < nFilt_w; filt++) {
  4179. length_w[filt] = stream.read(bits[1]);
  4180. if ((order_w[filt] = stream.read(bits[2])) > 20)
  4181. throw new Error("TNS filter out of range: " + order_w[filt]);
  4182. if (order_w[filt]) {
  4183. direction_w[filt] = !!stream.read(1);
  4184. var coefCompress = stream.read(1),
  4185. coefLen = coefRes + 3 - coefCompress,
  4186. tmp = 2 * coefCompress + coefRes,
  4187. table = TNS_TABLES[tmp],
  4188. order_w_filt = order_w[filt],
  4189. coef_w_filt = coef_w[filt];
  4190. for (var i = 0; i < order_w_filt; i++)
  4191. coef_w_filt[i] = table[stream.read(coefLen)];
  4192. }
  4193. }
  4194. }
  4195. }
  4196. };
  4197. TNS.prototype.process = function(ics, data, decode) {
  4198. var mmm = Math.min(this.maxBands, ics.maxSFB),
  4199. lpc = this.lpc,
  4200. tmp = this.tmp,
  4201. info = ics.info,
  4202. windowCount = info.windowCount;
  4203. for (var w = 0; w < windowCount; w++) {
  4204. var bottom = info.swbCount,
  4205. nFilt_w = this.nFilt[w],
  4206. length_w = this.length[w],
  4207. order_w = this.order[w],
  4208. coef_w = this.coef[w],
  4209. direction_w = this.direction[w];
  4210. for (var filt = 0; filt < nFilt_w; filt++) {
  4211. var top = bottom,
  4212. bottom = Math.max(0, tmp - length_w[filt]),
  4213. order = order_w[filt];
  4214. if (order === 0) continue;
  4215. // calculate lpc coefficients
  4216. var autoc = coef_w[filt];
  4217. for (var i = 0; i < order; i++) {
  4218. var r = -autoc[i];
  4219. lpc[i] = r;
  4220. for (var j = 0, len = (i + 1) >> 1; j < len; j++) {
  4221. var f = lpc[j],
  4222. b = lpc[i - 1 - j];
  4223. lpc[j] = f + r * b;
  4224. lpc[i - 1 - j] = b + r * f;
  4225. }
  4226. }
  4227. var start = info.swbOffsets[Math.min(bottom, mmm)],
  4228. end = info.swbOffsets[Math.min(top, mmm)],
  4229. size,
  4230. inc = 1;
  4231. if ((size = end - start) <= 0) continue;
  4232. if (direction_w[filt]) {
  4233. inc = -1;
  4234. start = end - 1;
  4235. }
  4236. start += w * 128;
  4237. if (decode) {
  4238. // ar filter
  4239. for (var m = 0; m < size; m++, start += inc) {
  4240. for (var i = 1; i <= Math.min(m, order); i++) {
  4241. data[start] -= data[start - i * inc] * lpc[i - 1];
  4242. }
  4243. }
  4244. } else {
  4245. // ma filter
  4246. for (var m = 0; m < size; m++, start += inc) {
  4247. tmp[0] = data[start];
  4248. for (var i = 1; i <= Math.min(m, order); i++)
  4249. data[start] += tmp[i] * lpc[i - 1];
  4250. for (var i = order; i > 0; i--)
  4251. tmp[i] = tmp[i - 1];
  4252. }
  4253. }
  4254. }
  4255. }
  4256. };
  4257. module.exports = TNS;
  4258. },{}]},{},[4])
  4259. //# sourceMappingURL=aac.js.map