UNPKG

modified-dicom-pacs

Version:

A modified version of DICOM PACS implementation

2 lines 21.5 kB
(self.webpackChunk_name_=self.webpackChunk_name_||[]).push([[610],{8726:function(s,e){!function(t){if("object"==typeof e&&void 0!==s)s.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jpeg=t()}}((function(){return function s(e,t,o){function r(a,n){if(!t[a]){if(!e[a]){var l="function"==typeof require&&require;if(!n&&l)return l(a,!0);if(i)return i(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var c=t[a]={exports:{}};e[a][0].call(c.exports,(function(s){var t=e[a][1][s];return r(t||s)}),c,c.exports,s,e,t,o)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;a<o.length;a++)r(o[a]);return r}({1:[function(s,e,t){"use strict";var o=o||{};o.lossless=o.lossless||{},o.lossless.ComponentSpec=o.lossless.ComponentSpec||function(){this.hSamp=0,this.quantTableSel=0,this.vSamp=0},"undefined"!==typeof e&&e.exports&&(e.exports=o.lossless.ComponentSpec)},{}],2:[function(s,e,t){"use strict";var o=o||{};o.lossless=o.lossless||{},o.lossless.DataStream=o.lossless.DataStream||function(s,e,t){this.buffer=new Uint8Array(s,e,t),this.index=0},o.lossless.DataStream.prototype.get16=function(){var s=(this.buffer[this.index]<<8)+this.buffer[this.index+1];return this.index+=2,s},o.lossless.DataStream.prototype.get8=function(){var s=this.buffer[this.index];return this.index+=1,s},"undefined"!==typeof e&&e.exports&&(e.exports=o.lossless.DataStream)},{}],3:[function(s,e,t){"use strict";var o,r=r||{};r.lossless=r.lossless||{},r.lossless.DataStream=r.lossless.DataStream||(void 0!==s?s("./data-stream.js"):null),r.lossless.HuffmanTable=r.lossless.HuffmanTable||(void 0!==s?s("./huffman-table.js"):null),r.lossless.QuantizationTable=r.lossless.QuantizationTable||(void 0!==s?s("./quantization-table.js"):null),r.lossless.ScanHeader=r.lossless.ScanHeader||(void 0!==s?s("./scan-header.js"):null),r.lossless.FrameHeader=r.lossless.FrameHeader||(void 0!==s?s("./frame-header.js"):null),r.lossless.Utils=r.lossless.Utils||(void 0!==s?s("./utils.js"):null),r.lossless.Decoder=r.lossless.Decoder||function(s,e){this.buffer=s,this.frame=new r.lossless.FrameHeader,this.huffTable=new r.lossless.HuffmanTable,this.quantTable=new r.lossless.QuantizationTable,this.scan=new r.lossless.ScanHeader,this.DU=r.lossless.Utils.createArray(10,4,64),this.HuffTab=r.lossless.Utils.createArray(4,2,12800),this.IDCT_Source=[],this.nBlock=[],this.acTab=r.lossless.Utils.createArray(10,1),this.dcTab=r.lossless.Utils.createArray(10,1),this.qTab=r.lossless.Utils.createArray(10,1),this.marker=0,this.markerIndex=0,this.numComp=0,this.restartInterval=0,this.selection=0,this.xDim=0,this.yDim=0,this.xLoc=0,this.yLoc=0,this.numBytes=0,this.outputData=null,this.restarting=!1,this.mask=0,void 0!==e&&(this.numBytes=e)},r.lossless.Decoder.IDCT_P=[0,5,40,16,45,2,7,42,21,56,8,61,18,47,1,4,41,23,58,13,32,24,37,10,63,17,44,3,6,43,20,57,15,34,29,48,53,26,39,9,60,19,46,22,59,12,33,31,50,55,25,36,11,62,14,35,28,49,52,27,38,30,51,54],r.lossless.Decoder.TABLE=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],r.lossless.Decoder.MAX_HUFFMAN_SUBTREE=50,r.lossless.Decoder.MSB=2147483648,r.lossless.Decoder.RESTART_MARKER_BEGIN=65488,r.lossless.Decoder.RESTART_MARKER_END=65495,r.lossless.Decoder.prototype.decompress=function(s,e,t){return this.decode(s,e,t).buffer},r.lossless.Decoder.prototype.decode=function(s,e,t,o){var i,a,n,l,h=0,c=[],u=[],f=[];if(void 0!==s&&(this.buffer=s),void 0!==o&&(this.numBytes=o),this.stream=new r.lossless.DataStream(this.buffer,e,t),this.buffer=null,this.xLoc=0,this.yLoc=0,65496!==(i=this.stream.get16()))throw new Error("Not a JPEG file");for(i=this.stream.get16();i>>4!=4092||65476===i;){switch(i){case 65476:this.huffTable.read(this.stream,this.HuffTab);break;case 65484:throw new Error("Program doesn't support arithmetic coding. (format throw new IOException)");case 65499:this.quantTable.read(this.stream,r.lossless.Decoder.TABLE);break;case 65501:this.restartInterval=this.readNumber();break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:this.readApp();break;case 65534:this.readComment();break;default:if(i>>8!=255)throw new Error("ERROR: format throw new IOException! (decode)")}i=this.stream.get16()}if(i<65472||i>65479)throw new Error("ERROR: could not handle arithmetic code!");this.frame.read(this.stream),i=this.stream.get16();do{for(;65498!==i;){switch(i){case 65476:this.huffTable.read(this.stream,this.HuffTab);break;case 65484:throw new Error("Program doesn't support arithmetic coding. (format throw new IOException)");case 65499:this.quantTable.read(this.stream,r.lossless.Decoder.TABLE);break;case 65501:this.restartInterval=this.readNumber();break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:this.readApp();break;case 65534:this.readComment();break;default:if(i>>8!=255)throw new Error("ERROR: format throw new IOException! (Parser.decode)")}i=this.stream.get16()}switch(this.precision=this.frame.precision,this.components=this.frame.components,this.numBytes||(this.numBytes=parseInt(Math.ceil(this.precision/8))),1==this.numBytes?this.mask=255:this.mask=65535,this.scan.read(this.stream),this.numComp=this.scan.numComp,this.selection=this.scan.selection,1===this.numBytes?3===this.numComp?(this.getter=this.getValueRGB,this.setter=this.setValueRGB,this.output=this.outputRGB):(this.getter=this.getValue8,this.setter=this.setValue8,this.output=this.outputSingle):(this.getter=this.getValue16,this.setter=this.setValue16,this.output=this.outputSingle),this.selection){case 2:this.selector=this.select2;break;case 3:this.selector=this.select3;break;case 4:this.selector=this.select4;break;case 5:this.selector=this.select5;break;case 6:this.selector=this.select6;break;case 7:this.selector=this.select7;break;default:this.selector=this.select1}for(this.scanComps=this.scan.components,this.quantTables=this.quantTable.quantTables,a=0;a<this.numComp;a+=1)n=this.scanComps[a].scanCompSel,this.qTab[a]=this.quantTables[this.components[n].quantTableSel],this.nBlock[a]=this.components[n].vSamp*this.components[n].hSamp,this.dcTab[a]=this.HuffTab[this.scanComps[a].dcTabSel][0],this.acTab[a]=this.HuffTab[this.scanComps[a].acTabSel][1];for(this.xDim=this.frame.dimX,this.yDim=this.frame.dimY,1==this.numBytes?this.outputData=new Uint8Array(new ArrayBuffer(this.xDim*this.yDim*this.numBytes*this.numComp)):this.outputData=new Uint16Array(new ArrayBuffer(this.xDim*this.yDim*this.numBytes*this.numComp)),h+=1;;){for(u[0]=0,f[0]=0,a=0;a<10;a+=1)c[a]=1<<this.precision-1;if(0===this.restartInterval){for(i=this.decodeUnit(c,u,f);0===i&&this.xLoc<this.xDim&&this.yLoc<this.yDim;)this.output(c),i=this.decodeUnit(c,u,f);break}for(l=0;l<this.restartInterval&&(this.restarting=0==l,i=this.decodeUnit(c,u,f),this.output(c),0===i);l+=1);if(0===i&&(0!==this.markerIndex?(i=65280|this.marker,this.markerIndex=0):i=this.stream.get16()),!(i>=r.lossless.Decoder.RESTART_MARKER_BEGIN&&i<=r.lossless.Decoder.RESTART_MARKER_END))break}65500===i&&1===h&&(this.readNumber(),i=this.stream.get16())}while(65497!==i&&this.xLoc<this.xDim&&this.yLoc<this.yDim&&0===h);return this.outputData},r.lossless.Decoder.prototype.decodeUnit=function(s,e,t){return 1==this.numComp?this.decodeSingle(s,e,t):3==this.numComp?this.decodeRGB(s,e,t):-1},r.lossless.Decoder.prototype.select1=function(s){return this.getPreviousX(s)},r.lossless.Decoder.prototype.select2=function(s){return this.getPreviousY(s)},r.lossless.Decoder.prototype.select3=function(s){return this.getPreviousXY(s)},r.lossless.Decoder.prototype.select4=function(s){return this.getPreviousX(s)+this.getPreviousY(s)-this.getPreviousXY(s)},r.lossless.Decoder.prototype.select5=function(s){return this.getPreviousX(s)+(this.getPreviousY(s)-this.getPreviousXY(s)>>1)},r.lossless.Decoder.prototype.select6=function(s){return this.getPreviousY(s)+(this.getPreviousX(s)-this.getPreviousXY(s)>>1)},r.lossless.Decoder.prototype.select7=function(s){return(this.getPreviousX(s)+this.getPreviousY(s))/2},r.lossless.Decoder.prototype.decodeRGB=function(s,e,t){var o,i,a,n,l,h,c,u;for(s[0]=this.selector(0),s[1]=this.selector(1),s[2]=this.selector(2),l=0;l<this.numComp;l+=1)for(n=this.qTab[l],i=this.acTab[l],a=this.dcTab[l],h=0;h<this.nBlock[l];h+=1){for(c=0;c<this.IDCT_Source.length;c+=1)this.IDCT_Source[c]=0;if((o=this.getHuffmanValue(a,e,t))>=65280)return o;for(s[l]=this.IDCT_Source[0]=s[l]+this.getn(t,o,e,t),this.IDCT_Source[0]*=n[0],u=1;u<64;u+=1){if((o=this.getHuffmanValue(i,e,t))>=65280)return o;if(u+=o>>4,0==(15&o)){if(o>>4==0)break}else this.IDCT_Source[r.lossless.Decoder.IDCT_P[u]]=this.getn(t,15&o,e,t)*n[u]}}return 0},r.lossless.Decoder.prototype.decodeSingle=function(s,e,t){var o,i,a,n;for(this.restarting?(this.restarting=!1,s[0]=1<<this.frame.precision-1):s[0]=this.selector(),i=0;i<this.nBlock[0];i+=1){if((o=this.getHuffmanValue(this.dcTab[0],e,t))>=65280)return o;if((n=(a=this.getn(s,o,e,t))>>8)>=r.lossless.Decoder.RESTART_MARKER_BEGIN&&n<=r.lossless.Decoder.RESTART_MARKER_END)return n;s[0]+=a}return 0},r.lossless.Decoder.prototype.getHuffmanValue=function(s,e,t){var o,i;if(65535,t[0]<8?(e[0]<<=8,255===(i=this.stream.get8())&&(this.marker=this.stream.get8(),0!==this.marker&&(this.markerIndex=9)),e[0]|=i):t[0]-=8,0!=((o=s[e[0]>>t[0]])&r.lossless.Decoder.MSB)){if(0!==this.markerIndex)return this.markerIndex=0,65280|this.marker;e[0]&=65535>>16-t[0],e[0]<<=8,255===(i=this.stream.get8())&&(this.marker=this.stream.get8(),0!==this.marker&&(this.markerIndex=9)),e[0]|=i,o=s[256*(255&o)+(e[0]>>t[0])],t[0]+=8}if(t[0]+=8-(o>>8),t[0]<0)throw new Error("index="+t[0]+" temp="+e[0]+" code="+o+" in HuffmanValue()");return t[0]<this.markerIndex?(this.markerIndex=0,65280|this.marker):(e[0]&=65535>>16-t[0],255&o)},r.lossless.Decoder.prototype.getn=function(s,e,t,o){var r,i;if(1,-1,65535,0===e)return 0;if(16===e)return s[0]>=0?-32768:32768;if(o[0]-=e,o[0]>=0){if(o[0]<this.markerIndex&&!this.isLastPixel())return this.markerIndex=0,(65280|this.marker)<<8;r=t[0]>>o[0],t[0]&=65535>>16-o[0]}else{if(t[0]<<=8,255===(i=this.stream.get8())&&(this.marker=this.stream.get8(),0!==this.marker&&(this.markerIndex=9)),t[0]|=i,o[0]+=8,o[0]<0){if(0!==this.markerIndex)return this.markerIndex=0,(65280|this.marker)<<8;t[0]<<=8,255===(i=this.stream.get8())&&(this.marker=this.stream.get8(),0!==this.marker&&(this.markerIndex=9)),t[0]|=i,o[0]+=8}if(o[0]<0)throw new Error("index="+o[0]+" in getn()");if(o[0]<this.markerIndex)return this.markerIndex=0,(65280|this.marker)<<8;r=t[0]>>o[0],t[0]&=65535>>16-o[0]}return r<1<<e-1&&(r+=1+(-1<<e)),r},r.lossless.Decoder.prototype.getPreviousX=function(s){return this.xLoc>0?this.getter(this.yLoc*this.xDim+this.xLoc-1,s):this.yLoc>0?this.getPreviousY(s):1<<this.frame.precision-1},r.lossless.Decoder.prototype.getPreviousXY=function(s){return this.xLoc>0&&this.yLoc>0?this.getter((this.yLoc-1)*this.xDim+this.xLoc-1,s):this.getPreviousY(s)},r.lossless.Decoder.prototype.getPreviousY=function(s){return this.yLoc>0?this.getter((this.yLoc-1)*this.xDim+this.xLoc,s):this.getPreviousX(s)},r.lossless.Decoder.prototype.isLastPixel=function(){return this.xLoc===this.xDim-1&&this.yLoc===this.yDim-1},r.lossless.Decoder.prototype.outputSingle=function(s){this.xLoc<this.xDim&&this.yLoc<this.yDim&&(this.setter(this.yLoc*this.xDim+this.xLoc,this.mask&s[0]),this.xLoc+=1,this.xLoc>=this.xDim&&(this.yLoc+=1,this.xLoc=0))},r.lossless.Decoder.prototype.outputRGB=function(s){var e=this.yLoc*this.xDim+this.xLoc;this.xLoc<this.xDim&&this.yLoc<this.yDim&&(this.setter(e,s[0],0),this.setter(e,s[1],1),this.setter(e,s[2],2),this.xLoc+=1,this.xLoc>=this.xDim&&(this.yLoc+=1,this.xLoc=0))},r.lossless.Decoder.prototype.setValue8=function(s,e){this.outputData[s]=e},r.lossless.Decoder.prototype.getValue8=function(s){return this.outputData[s]},(o=new ArrayBuffer(2),new DataView(o).setInt16(0,256,!0),256===new Int16Array(o)[0])?(r.lossless.Decoder.prototype.setValue16=r.lossless.Decoder.prototype.setValue8,r.lossless.Decoder.prototype.getValue16=r.lossless.Decoder.prototype.getValue8):(r.lossless.Decoder.prototype.setValue16=function(s,e){this.outputData[s]=(255&e)<<8|e>>8&255},r.lossless.Decoder.prototype.getValue16=function(s){var e=this.outputData[s];return(255&e)<<8|e>>8&255}),r.lossless.Decoder.prototype.setValueRGB=function(s,e,t){this.outputData[3*s+t]=e},r.lossless.Decoder.prototype.getValueRGB=function(s,e){return this.outputData[3*s+e]},r.lossless.Decoder.prototype.readApp=function(){var s=0,e=this.stream.get16();for(s+=2;s<e;)this.stream.get8(),s+=1;return e},r.lossless.Decoder.prototype.readComment=function(){var s,e="",t=0;for(s=this.stream.get16(),t+=2;t<s;)e+=this.stream.get8(),t+=1;return e},r.lossless.Decoder.prototype.readNumber=function(){if(4!==this.stream.get16())throw new Error("ERROR: Define number format throw new IOException [Ld!=4]");return this.stream.get16()},"undefined"!==typeof e&&e.exports&&(e.exports=r.lossless.Decoder)},{"./data-stream.js":2,"./frame-header.js":4,"./huffman-table.js":5,"./quantization-table.js":7,"./scan-header.js":9,"./utils.js":10}],4:[function(s,e,t){"use strict";var o=o||{};o.lossless=o.lossless||{},o.lossless.ComponentSpec=o.lossless.ComponentSpec||(void 0!==s?s("./component-spec.js"):null),o.lossless.DataStream=o.lossless.DataStream||(void 0!==s?s("./data-stream.js"):null),o.lossless.FrameHeader=o.lossless.FrameHeader||function(){this.components=[],this.dimX=0,this.dimY=0,this.numComp=0,this.precision=0},o.lossless.FrameHeader.prototype.read=function(s){var e,t,r,i,a=0;for(e=s.get16(),a+=2,this.precision=s.get8(),a+=1,this.dimY=s.get16(),a+=2,this.dimX=s.get16(),a+=2,this.numComp=s.get8(),a+=1,t=1;t<=this.numComp;t+=1){if(a>e)throw new Error("ERROR: frame format error");if(r=s.get8(),(a+=1)>=e)throw new Error("ERROR: frame format error [c>=Lf]");i=s.get8(),a+=1,this.components[r]||(this.components[r]=new o.lossless.ComponentSpec),this.components[r].hSamp=i>>4,this.components[r].vSamp=15&i,this.components[r].quantTableSel=s.get8(),a+=1}if(a!==e)throw new Error("ERROR: frame format error [Lf!=count]");return 1},"undefined"!==typeof e&&e.exports&&(e.exports=o.lossless.FrameHeader)},{"./component-spec.js":1,"./data-stream.js":2}],5:[function(s,e,t){"use strict";var o=o||{};o.lossless=o.lossless||{},o.lossless.DataStream=o.lossless.DataStream||(void 0!==s?s("./data-stream.js"):null),o.lossless.Utils=o.lossless.Utils||(void 0!==s?s("./utils.js"):null),o.lossless.HuffmanTable=o.lossless.HuffmanTable||function(){this.l=o.lossless.Utils.createArray(4,2,16),this.th=[],this.v=o.lossless.Utils.createArray(4,2,16,200),this.tc=o.lossless.Utils.createArray(4,2),this.tc[0][0]=0,this.tc[1][0]=0,this.tc[2][0]=0,this.tc[3][0]=0,this.tc[0][1]=0,this.tc[1][1]=0,this.tc[2][1]=0,this.tc[3][1]=0,this.th[0]=0,this.th[1]=0,this.th[2]=0,this.th[3]=0},o.lossless.HuffmanTable.MSB=2147483648,o.lossless.HuffmanTable.prototype.read=function(s,e){var t,o,r,i,a,n,l=0;for(t=s.get16(),l+=2;l<t;){if(l+=1,(r=15&(o=s.get8()))>3)throw new Error("ERROR: Huffman table ID > 3");if((i=o>>4)>2)throw new Error("ERROR: Huffman table [Table class > 2 ]");for(this.th[r]=1,this.tc[r][i]=1,a=0;a<16;a+=1)this.l[r][i][a]=s.get8(),l+=1;for(a=0;a<16;a+=1)for(n=0;n<this.l[r][i][a];n+=1){if(l>t)throw new Error("ERROR: Huffman table format error [count>Lh]");this.v[r][i][a][n]=s.get8(),l+=1}}if(l!==t)throw new Error("ERROR: Huffman table format error [count!=Lf]");for(a=0;a<4;a+=1)for(n=0;n<2;n+=1)0!==this.tc[a][n]&&this.buildHuffTable(e[a][n],this.l[a][n],this.v[a][n]);return 1},o.lossless.HuffmanTable.prototype.buildHuffTable=function(s,e,t){var r,i,a,n,l;for(256,i=0,a=0;a<8;a+=1)for(n=0;n<e[a];n+=1)for(l=0;l<256>>a+1;l+=1)s[i]=t[a][n]|a+1<<8,i+=1;for(a=1;i<256;a+=1,i+=1)s[i]=a|o.lossless.HuffmanTable.MSB;for(r=1,i=0,a=8;a<16;a+=1)for(n=0;n<e[a];n+=1){for(l=0;l<256>>a-7;l+=1)s[256*r+i]=t[a][n]|a+1<<8,i+=1;if(i>=256){if(i>256)throw new Error("ERROR: Huffman table error(1)!");i=0,r+=1}}},"undefined"!==typeof e&&e.exports&&(e.exports=o.lossless.HuffmanTable)},{"./data-stream.js":2,"./utils.js":10}],6:[function(s,e,t){"use strict";var o=o||{};o.lossless=o.lossless||{},o.lossless.ComponentSpec=o.lossless.ComponentSpec||(void 0!==s?s("./component-spec.js"):null),o.lossless.DataStream=o.lossless.DataStream||(void 0!==s?s("./data-stream.js"):null),o.lossless.Decoder=o.lossless.Decoder||(void 0!==s?s("./decoder.js"):null),o.lossless.FrameHeader=o.lossless.FrameHeader||(void 0!==s?s("./frame-header.js"):null),o.lossless.HuffmanTable=o.lossless.HuffmanTable||(void 0!==s?s("./huffman-table.js"):null),o.lossless.QuantizationTable=o.lossless.QuantizationTable||(void 0!==s?s("./quantization-table.js"):null),o.lossless.ScanComponent=o.lossless.ScanComponent||(void 0!==s?s("./scan-component.js"):null),o.lossless.ScanHeader=o.lossless.ScanHeader||(void 0!==s?s("./scan-header.js"):null),o.lossless.Utils=o.lossless.Utils||(void 0!==s?s("./utils.js"):null),"undefined"!==typeof e&&e.exports&&(e.exports=o)},{"./component-spec.js":1,"./data-stream.js":2,"./decoder.js":3,"./frame-header.js":4,"./huffman-table.js":5,"./quantization-table.js":7,"./scan-component.js":8,"./scan-header.js":9,"./utils.js":10}],7:[function(s,e,t){"use strict";var o=o||{};o.lossless=o.lossless||{},o.lossless.DataStream=o.lossless.DataStream||(void 0!==s?s("./data-stream.js"):null),o.lossless.Utils=o.lossless.Utils||(void 0!==s?s("./utils.js"):null),o.lossless.QuantizationTable=o.lossless.QuantizationTable||function(){this.precision=[],this.tq=[],this.quantTables=o.lossless.Utils.createArray(4,64),this.tq[0]=0,this.tq[1]=0,this.tq[2]=0,this.tq[3]=0},o.lossless.QuantizationTable.enhanceQuantizationTable=function(s,e){var t;for(t=0;t<8;t+=1)s[e[0+t]]*=90,s[e[32+t]]*=90,s[e[16+t]]*=118,s[e[48+t]]*=49,s[e[40+t]]*=71,s[e[8+t]]*=126,s[e[56+t]]*=25,s[e[24+t]]*=106;for(t=0;t<8;t+=1)s[e[0+8*t]]*=90,s[e[4+8*t]]*=90,s[e[2+8*t]]*=118,s[e[6+8*t]]*=49,s[e[5+8*t]]*=71,s[e[1+8*t]]*=126,s[e[7+8*t]]*=25,s[e[3+8*t]]*=106;for(t=0;t<64;t+=1)s[t]>>=6},o.lossless.QuantizationTable.prototype.read=function(s,e){var t,r,i,a,n=0;for(t=s.get16(),n+=2;n<t;){if(n+=1,(i=15&(r=s.get8()))>3)throw new Error("ERROR: Quantization table ID > 3");if(this.precision[i]=r>>4,0===this.precision[i])this.precision[i]=8;else{if(1!==this.precision[i])throw new Error("ERROR: Quantization table precision error");this.precision[i]=16}if(this.tq[i]=1,8===this.precision[i]){for(a=0;a<64;a+=1){if(n>t)throw new Error("ERROR: Quantization table format error");this.quantTables[i][a]=s.get8(),n+=1}o.lossless.QuantizationTable.enhanceQuantizationTable(this.quantTables[i],e)}else{for(a=0;a<64;a+=1){if(n>t)throw new Error("ERROR: Quantization table format error");this.quantTables[i][a]=s.get16(),n+=2}o.lossless.QuantizationTable.enhanceQuantizationTable(this.quantTables[i],e)}}if(n!==t)throw new Error("ERROR: Quantization table error [count!=Lq]");return 1},"undefined"!==typeof e&&e.exports&&(e.exports=o.lossless.QuantizationTable)},{"./data-stream.js":2,"./utils.js":10}],8:[function(s,e,t){"use strict";var o=o||{};o.lossless=o.lossless||{},o.lossless.ScanComponent=o.lossless.ScanComponent||function(){this.acTabSel=0,this.dcTabSel=0,this.scanCompSel=0},"undefined"!==typeof e&&e.exports&&(e.exports=o.lossless.ScanComponent)},{}],9:[function(s,e,t){"use strict";var o=o||{};o.lossless=o.lossless||{},o.lossless.DataStream=o.lossless.DataStream||(void 0!==s?s("./data-stream.js"):null),o.lossless.ScanComponent=o.lossless.ScanComponent||(void 0!==s?s("./scan-component.js"):null),o.lossless.ScanHeader=o.lossless.ScanHeader||function(){this.ah=0,this.al=0,this.numComp=0,this.selection=0,this.spectralEnd=0,this.components=[]},o.lossless.ScanHeader.prototype.read=function(s){var e,t,r,i=0;for(e=s.get16(),i+=2,this.numComp=s.get8(),i+=1,t=0;t<this.numComp;t+=1){if(this.components[t]=new o.lossless.ScanComponent,i>e)throw new Error("ERROR: scan header format error");this.components[t].scanCompSel=s.get8(),i+=1,r=s.get8(),i+=1,this.components[t].dcTabSel=r>>4,this.components[t].acTabSel=15&r}if(this.selection=s.get8(),i+=1,this.spectralEnd=s.get8(),i+=1,r=s.get8(),this.ah=r>>4,this.al=15&r,(i+=1)!==e)throw new Error("ERROR: scan header format error [count!=Ns]");return 1},"undefined"!==typeof e&&e.exports&&(e.exports=o.lossless.ScanHeader)},{"./data-stream.js":2,"./scan-component.js":8}],10:[function(s,e,t){"use strict";var o=o||{};o.lossless=o.lossless||{},o.lossless.Utils=o.lossless.Utils||{},o.lossless.Utils.createArray=function(s){var e=new Array(s||0),t=s;if(arguments.length>1)for(var r=Array.prototype.slice.call(arguments,1);t--;)e[s-1-t]=o.lossless.Utils.createArray.apply(this,r);return e},o.lossless.Utils.makeCRCTable=function(){for(var s,e=[],t=0;t<256;t++){s=t;for(var o=0;o<8;o++)s=1&s?3988292384^s>>>1:s>>>1;e[t]=s}return e},o.lossless.Utils.crc32=function(s){for(var e=new Uint8Array(s.buffer),t=o.lossless.Utils.crcTable||(o.lossless.Utils.crcTable=o.lossless.Utils.makeCRCTable()),r=-1,i=0;i<e.length;i++)r=r>>>8^t[255&(r^e[i])];return(-1^r)>>>0},"undefined"!==typeof e&&e.exports&&(e.exports=o.lossless.Utils)},{}]},{},[6])(6)}))}}]); //# sourceMappingURL=610.min.worker.js.map