UNPKG

rlayers

Version:

React Components for OpenLayers

1 lines 1.45 kB
"use strict";(self.webpackChunkrlayers=self.webpackChunkrlayers||[]).push([[5121],{2132(e,t,r){function o(e,t){let r=e.length-t,o=0;do{for(let r=t;r>0;r--)e[o+t]+=e[o],o++;r-=t}while(r>0)}function n(e,t,r){let o=0,n=e.length;const l=n/r;for(;n>t;){for(let r=t;r>0;--r)e[o+t]+=e[o],++o;n-=t}const i=e.slice();for(let t=0;t<l;++t)for(let o=0;o<r;++o)e[r*t+o]=i[(r-o-1)*l+t]}r.d(t,{A:()=>l});class l{constructor(e){this.parameters=e}decodeBlock(e){throw new Error("decodeBlock not implemented")}async decode(e){const t=await this.decodeBlock(e),{tileWidth:r,tileHeight:l,predictor:i,bitsPerSample:s,planarConfiguration:a}=this.parameters;return 1!==i?function(e,t,r,l,i,s){if(!t||1===t)return e;for(let e=0;e<i.length;++e){if(i[e]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(i[e]!==i[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const a=i[0]/8,c=2===s?1:i.length;for(let s=0;s<l&&!(s*c*r*a>=e.byteLength);++s){let l;if(2===t){switch(i[0]){case 8:l=new Uint8Array(e,s*c*r*a,c*r*a);break;case 16:l=new Uint16Array(e,s*c*r*a,c*r*a/2);break;case 32:l=new Uint32Array(e,s*c*r*a,c*r*a/4);break;default:throw new Error(`Predictor 2 not allowed with ${i[0]} bits per sample.`)}o(l,c)}else 3===t&&(l=new Uint8Array(e,s*c*r*a,c*r*a),n(l,c,a))}return e}(t,i,r,l,s,a):t}}},5121(e,t,r){r.d(t,{default:()=>n});var o=r(2132);class n extends o.A{decodeBlock(e){return e}}}}]);