aac.js 146 KB

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