/*!
 * Speedy Vision version 0.9.1
 * GPU-accelerated Computer Vision for JavaScript
 * Copyright 2020-2022 Alexandre Martins <alemartf(at)gmail.com> (https://github.com/alemart)
 * https://github.com/alemart/speedy-vision
 *
 * @license Apache-2.0
 * Date: 2022-06-08T04:17:18.963Z
 */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Speedy=t():e.Speedy=t()}(self,(function(){return(()=>{var e={3135:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(2411),o=n(7905),s=n(3841);let r="raf",A="default";class a extends i.R{static get powerPreference(){return o.$.powerPreference}static set powerPreference(e){o.$.powerPreference=e}static get gpuPollingMode(){return r}static set gpuPollingMode(e){if("raf"!==e&&"asap"!==e)throw new s.mG(`Invalid GPU polling mode: "${e}"`);r=e}static get logging(){return A}static set logging(e){if("default"!==e&&"none"!==e)throw new s.mG(`Invalid logging mode: "${e}"`);A=e}}},5137:(e,t,n)=>{"use strict";n.d(t,{N:()=>A});var i=n(4368),o=n(5484),s=n(3841);const r=Object.freeze({float32:Float32Array});class A{constructor(e,t,n){o.c.assert(e>0&&t>0),o.c.assert(n===A.DEFAULT_DTYPE),this._rows=0|e,this._columns=0|t,this._dtype=n}get rows(){return this._rows}get columns(){return this._columns}get dtype(){return this._dtype}static get DEFAULT_DTYPE(){return"float32"}static get BUFFER_TYPE(){return r}plus(e){return new u(this,e)}minus(e){return new I(this,e)}times(e){return"number"==typeof e?new p(this,e):new f(this,e)}transpose(){return new g(this)}inverse(){return new h(this)}compMult(e){return new m(this,e)}ldiv(e){return new C(this,e)}toString(){return`SpeedyMatrixExpr(rows=${this.rows}, columns=${this.columns})`}_evaluate(e,t){throw new s.Mi}}const{SpeedyMatrix:a}=n(8007);class c extends A{constructor(e,t,n){super(e,t,n),this._tempMatrix=a.Zeros(this.rows,this.columns,this.dtype)}}class l extends c{constructor(e,t,n){super(e,t,n.dtype),this._operand=n}_evaluate(e,t){const n=this._operand._evaluate(e,t),o=this._tempMatrix,s=i.r.allocateMat32(e,t,o),r=i.r.allocateMat32(e,t,n);return i.r.copyToMat32(e,t,r,n),this._compute(e,t,s,r),i.r.copyFromMat32(e,t,s,o),i.r.deallocateMat32(e,t,r),i.r.deallocateMat32(e,t,s),o}_compute(e,t,n,i){throw new s.Mi}}class d extends c{constructor(e,t,n,i){o.c.assert(n.dtype===i.dtype),super(e,t,n.dtype),this._left=n,this._right=i}_evaluate(e,t){const n=this._left._evaluate(e,t),o=this._right._evaluate(e,t),s=this._tempMatrix,r=i.r.allocateMat32(e,t,s),A=i.r.allocateMat32(e,t,n),a=i.r.allocateMat32(e,t,o);return i.r.copyToMat32(e,t,A,n),i.r.copyToMat32(e,t,a,o),this._compute(e,t,r,A,a),i.r.copyFromMat32(e,t,r,s),i.r.deallocateMat32(e,t,a),i.r.deallocateMat32(e,t,A),i.r.deallocateMat32(e,t,r),s}_compute(e,t,n,i,o){throw new s.Mi}}class g extends l{constructor(e){super(e.columns,e.rows,e)}_compute(e,t,n,i){e.exports.Mat32_transpose(n,i)}}class h extends l{constructor(e){o.c.assert(e.rows===e.columns),super(e.rows,e.columns,e),this._size=e.rows}_compute(e,t,n,i){switch(this._size){case 0:break;case 1:e.exports.Mat32_inverse1(n,i);break;case 2:e.exports.Mat32_inverse2(n,i);break;case 3:e.exports.Mat32_inverse3(n,i);break;default:e.exports.Mat32_qr_inverse(n,i)}}}class p extends l{constructor(e,t){super(e.rows,e.columns,e),this._scalar=+t}_compute(e,t,n,i){e.exports.Mat32_scale(n,i,this._scalar)}}class u extends d{constructor(e,t){o.c.assert(e.rows===t.rows&&e.columns===t.columns),super(e.rows,e.columns,e,t)}_compute(e,t,n,i,o){e.exports.Mat32_add(n,i,o)}}class I extends d{constructor(e,t){o.c.assert(e.rows===t.rows&&e.columns===t.columns),super(e.rows,e.columns,e,t)}_compute(e,t,n,i,o){e.exports.Mat32_subtract(n,i,o)}}class f extends d{constructor(e,t){o.c.assert(e.columns===t.rows),super(e.rows,t.columns,e,t)}_compute(e,t,n,i,o){e.exports.Mat32_multiply(n,i,o)}}class m extends d{constructor(e,t){o.c.assert(e.rows===t.rows&&e.columns===t.columns),super(t.rows,t.columns,e,t)}_compute(e,t,n,i,o){e.exports.Mat32_compmult(n,i,o)}}class C extends d{constructor(e,t){const n=e.rows,i=e.columns;o.c.assert(n>=i&&t.rows===n&&1===t.columns),super(i,1,e,t)}_compute(e,t,n,i,o){e.exports.Mat32_qr_ols(n,i,o,2)}}},4368:(e,t,n)=>{"use strict";n.d(t,{r:()=>g});var i=n(4500),o=n(3841),s=n(5484),r=n(3020);const A=n(4209);let a=null,c=null;const l={as:{object:d=new WebAssembly.Memory({initial:16,maximum:256}),uint8:new Uint8Array(d.buffer),int32:new Int32Array(d.buffer),uint32:new Uint32Array(d.buffer),float32:new Float32Array(d.buffer),float64:new Float64Array(d.buffer)}};var d;class g{static ready(){return new i.s(((e,t)=>{g._ready(e,t)}))}static get handle(){if(!a||!c)throw new o.IT("Can't get WASM handle: routines not yet loaded");return{wasm:a,memory:l,module:c}}static imports(e){const t=new h(e);return Object.getOwnPropertyNames(h.prototype).filter((e=>"function"==typeof t[e]&&"constructor"!==e)).reduce(((e,n)=>(e[n]=t[n],e)),Object.create(null))}static allocateMat32(e,t,n){const i=e.exports.malloc(n.data.byteLength);return e.exports.Mat32_create(n.rows,n.columns,n.step0,n.step1,n._data.length,i)}static deallocateMat32(e,t,n){const i=e.exports.Mat32_data(n);return e.exports.free(n),e.exports.free(i),0}static copyToMat32(e,t,n,i){s.c.assert(i.data.byteLength===e.exports.Mat32_dataSize(n));const o=e.exports.Mat32_data(n);return t.as.float32.set(i.data,o/Float32Array.BYTES_PER_ELEMENT),n}static copyFromMat32(e,t,n,i){s.c.assert(i.data.byteLength===e.exports.Mat32_dataSize(n));const o=e.exports.Mat32_data(n)/Float32Array.BYTES_PER_ELEMENT;for(let e=i.data.length-1;e>=0;e--)i.data[e]=t.as.float32[o+e];return n}static _ready(e,t,n=1e3){null!==a&&null!==c?e({wasm:a,memory:l,module:c}):n<=0?t(new o.W5("Can't load WASM routines")):setTimeout(g._ready,0,e,t,n-1)}}class h{constructor(e){return Object.getOwnPropertyNames(this.constructor.prototype).filter((e=>"function"==typeof this[e])).filter((e=>"constructor"!==e)).forEach((e=>{this[e]=this[e].bind(this)})),this.memory=e,this.cstring=new p(e),Object.freeze(this)}print(e){s.c.log(this.cstring.get(e))}fatal(e){throw new o.IT(this.cstring.get(e))}bytefill(e,t,n){this.memory.as.uint8.fill(e,t,n)}copyWithin(e,t,n){this.memory.as.uint8.copyWithin(e,t,n)}}class p{constructor(e){this._decoder=new TextDecoder("utf-8"),this._memory=e}get(e){const t=this._memory.as.uint8,n=this._memory.as.uint8.byteLength;let i=e;for(;i<n&&0!==t[i];)++i;return this._decoder.decode(t.subarray(e,i))}}!function(e){if(!r.LITTLE_ENDIAN)throw new o.B8("Can't run WebAssembly code: not in a little-endian machine!");i.s.resolve(A).then((e=>(e=>Uint8Array.from(atob(e),(e=>e.charCodeAt(0))))(e))).then((t=>WebAssembly.instantiate(t,{env:{memory:e.as.object,...g.imports(e)}}))).then((e=>{a=e.instance,c=e.module,e.instance.exports.srand(.001*Date.now()&4294967295),s.c.log("The WebAssembly routines have been loaded!")})).catch((e=>{throw new o.IT(`Can't load the WebAssembly routines: ${e}`,e)}))}(l)},8007:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SpeedyMatrix:()=>A});var i=n(5137),o=n(4368),s=n(4500),r=n(5484);class A extends i.N{constructor(e,t,n,o,s){super(e,t,i.N.DEFAULT_DTYPE),r.c.assert(s.constructor===i.N.BUFFER_TYPE[this.dtype]),r.c.assert(n>0&&o>=n),r.c.assert(s.length+e*t===0||s.length===1+n*(e-1)+o*(t-1)),this._step0=0|n,this._step1=0|o,this._data=s}static Create(e,t,n,o=i.N.DEFAULT_DTYPE){return r.c.assert(e*t>0,"Can't create a matrix without a shape"),r.c.assert(e*t===n.length,`Can't create matrix: expected ${e*t} entries, but found ${n.length}`),r.c.assert(Object.prototype.hasOwnProperty.call(i.N.BUFFER_TYPE,o),`Invalid dtype: "${o}"`),new A(e,t,1,e,Reflect.construct(i.N.BUFFER_TYPE[o],[n]))}static Zeros(e,t=e,n=i.N.DEFAULT_DTYPE){return r.c.assert(e*t>0,"Can't create a matrix without a shape"),r.c.assert(Object.prototype.hasOwnProperty.call(i.N.BUFFER_TYPE,n),`Invalid dtype: "${n}"`),new A(e,t,1,e,Reflect.construct(i.N.BUFFER_TYPE[n],[e*t]))}static Ones(e,t=e,n=i.N.DEFAULT_DTYPE){return r.c.assert(e*t>0,"Can't create a matrix without a shape"),r.c.assert(Object.prototype.hasOwnProperty.call(i.N.BUFFER_TYPE,n),`Invalid dtype: "${n}"`),new A(e,t,1,e,Reflect.construct(i.N.BUFFER_TYPE[n],[e*t]).fill(1))}static Eye(e,t=e,n=i.N.DEFAULT_DTYPE){r.c.assert(e*t>0,"Can't create a matrix without a shape"),r.c.assert(Object.prototype.hasOwnProperty.call(i.N.BUFFER_TYPE,n),`Invalid dtype: "${n}"`);const o=Reflect.construct(i.N.BUFFER_TYPE[n],[e*t]);for(let n=Math.min(e,t)-1;n>=0;n--)o[n*e+n]=1;return new A(e,t,1,e,o)}static From(e){return A.Zeros(e.rows,e.columns,e.dtype).setToSync(e)}static ready(){return o.r.ready().then((e=>{}))}get data(){return this._data}get step0(){return this._step0}get step1(){return this._step1}block(e,t,n,i){r.c.assert(e<=t&&n<=i,`Invalid indices: [${e}:${t},${n}:${i}]`),e=Math.max(e,0),t=Math.min(t,this._rows-1),n=Math.max(n,0);const o=t-e+1,s=(i=Math.min(i,this._columns-1))-n+1,a=this._step0,c=this._step1,l=e*a+n*c,d=1+t*a+i*c;return new A(o,s,a,c,this._data.subarray(l,d))}row(e){return this.block(e,e,0,this._columns-1)}column(e){return this.block(0,this._rows-1,e,e)}diagonal(){const e=Math.min(this._rows,this._columns),t=e,n=this._step0+this._step1,i=1+(e-1)*n;return new A(t,1,n,n,this._data.subarray(0,i))}at(e,t){return e>=0&&e<this._rows&&t>=0&&t<this._columns?this._data[this._step0*e+this._step1*t]:Number.NaN}read(){const e=new Array(this._rows*this._columns),t=this._step0,n=this._step1;let i=0;for(let o=0;o<this._columns;o++)for(let s=0;s<this._rows;s++)e[i++]=this._data[s*t+o*n];return e}toString(){const e=this.rows,t=this.columns,n=this.read(),i=new Array(e);for(let o=0;o<e;o++){i[o]=new Array(t);for(let s=0;s<t;s++)i[o][s]=n[s*e+o]}const o=e=>e.toFixed(5);return`SpeedyMatrix(rows=${e}, columns=${t}, data=[\n${i.map((e=>"    "+e.map(o).join(", "))).join(",\n")}\n])`}setTo(e){return o.r.ready().then((t=>this.setToSync(e)))}setToSync(e){const{wasm:t,memory:n}=o.r.handle,i=e._evaluate(t,n);r.c.assert(this._rows===i._rows&&this._columns===i._columns&&this.dtype===i.dtype,`Can't set the values of a ${this.rows} x ${this.columns} ${this.dtype} matrix to those of a ${i.rows} x ${i.columns} ${i.dtype} matrix`);const s=this._step0,A=this._step1,a=i._step0,c=i._step1;if(s===a&&A===c&&this._data.length===i._data.length)this._data.set(i._data);else for(let e=this._columns-1;e>=0;e--)for(let t=this._rows-1;t>=0;t--)this._data[t*s+e*A]=i._data[t*a+e*c];return this}fill(e){return this.fillSync(e),s.s.resolve(this)}fillSync(e){if(e=+e,this._rows*this._columns===this._data.length)return this._data.fill(e),this;for(let t=0;t<this._columns;t++)for(let n=0;n<this._rows;n++)this._data[n*this._step0+t*this._step1]=e;return this}_evaluate(e,t){return this}}},2411:(e,t,n)=>{"use strict";n.d(t,{R:()=>o});var i=n(3841);class o{constructor(){throw new i.Mi("Namespaces can't be instantiated")}}},4500:(e,t,n)=>{"use strict";n.d(t,{s:()=>o});const i="undefined"!=typeof queueMicrotask&&queueMicrotask||"undefined"!=typeof process&&process.nextTick||(e=>Promise.resolve().then((()=>e())));class o{constructor(e){this._state=0,this._value=void 0,this._onFulfillment=null,this._onRejection=null,this._children=0,this[0]=this,this._parent=void 0,this._flags=0,this._fulfill=this._fulfill.bind(this),this._reject=this._reject.bind(this),this._resolve=this._resolve.bind(this),this._broadcastIfAsync=this._broadcastIfAsync.bind(this),e(this._fulfill,this._reject)}then(e,t=null){const n=new o(this._nop);return n._onFulfillment="function"==typeof e&&e,n._onRejection="function"==typeof t&&t,n._parent=this,this[this._children++]=n,this._flags&=-2,this._notify(),n}catch(e){return this.then(null,e)}finally(e){const t=t=>(e(),t);return this.then(t,t)}turbocharge(){let e=this;for(this._flags|=1;void 0!==e._parent;)e=e._parent,e._flags|=1;return e._notify(),this}toString(){switch(this._state){case 0:return"SpeedyPromise { <pending> }";case 1:return`SpeedyPromise { <fulfilled> ${this._value} }`;case 2:return`SpeedyPromise { <rejected> ${this._value} }`;default:return""}}get[Symbol.toStringTag](){return"SpeedyPromise"}static resolve(e){const t=new o(this._snop);return"object"==typeof e&&null!==e&&"then"in e||"function"==typeof e&&"then"in e?t._resolve(e):(t._value=e,t._state=1),t}static reject(e){const t=new o(this._snop);return t._value=e,t._state=2,t}static all(e){return new o(((t,n)=>{const i=[];for(const t of e)i.push(t);const s=i.length;if(0==s)return void t([]);let r=s;const A=new Array(s),a=e=>n=>{A[e]=n,0==--r&&t(A)};for(let e=0;e<s;e++){const t=i[e];t.__proto__===o.prototype||t.__proto__===Promise.prototype?t.then(a(e),n):o.resolve(t).then(a(e),n)}}))}static race(e){return new o(((t,n)=>{const i=[];for(const t of e)i.push(t);const s=i.length;for(let e=0;e<s;e++){const s=i[e];s.__proto__===o.prototype||s.__proto__===Promise.prototype?s.then(t,n):o.resolve(s).then(t,n)}}))}_fulfill(e){this._setState(1,e)}_reject(e){this._setState(2,e)}_setState(e,t){0==this._state&&(this._state=e,this._value=t,this._notify())}_notify(){0!=this._state&&(1&this._flags?this._broadcast():i(this._broadcastIfAsync))}_broadcastIfAsync(){1&this._flags||this._broadcast()}_broadcast(){const e=this._children,t=this._state;if(1===t)for(let t=0;t<e;t++){const e=this[t],n=e._onFulfillment;try{n?n!==e._nop&&(e._resolve(n(this._value)),e._onFulfillment=e._nop):e._fulfill(this._value)}catch(t){e._reject(t)}}else if(2===t)for(let t=0;t<e;t++){const e=this[t],n=e._onRejection;try{n?n!==e._nop&&(e._resolve(n(this._value)),e._onRejection=e._nop):e._reject(this._value)}catch(t){e._reject(t)}}}_resolve(e){if("object"!=typeof e&&"function"!=typeof e||null===e)this._fulfill(e);else{if(e===this)throw new TypeError;if(e.__proto__!==o.prototype&&e.__proto__!==Promise.prototype)try{const t=e.then;if("function"==typeof t){let n=this._resolve,i=this._reject;try{t.call(e,(e=>{n(e),n=i=this._nop}),(e=>{i(e),n=i=this._nop}))}catch(e){n!==this._nop&&i!==this._nop&&this._reject(e)}}else this._fulfill(e)}catch(e){this._reject(e)}else e.then(this._resolve,this._reject)}}_nop(){}static _snop(){}}},9759:(e,t,n)=>{"use strict";n.d(t,{ef:()=>P,Nt:()=>S});var i=n(5484),o=n(6731),s=n(3841);const r=n(3020),A=Object.keys(r).filter((e=>"number"==typeof r[e])).reduce(((e,t)=>(e[t]=r[t],e)),{}),a=Object.freeze({...A,FS_USE_CUSTOM_PRECISION:0,FS_OUTPUT_TYPE:0,PIXELCOMPONENT_RED:o.hE.RED,PIXELCOMPONENT_GREEN:o.hE.GREEN,PIXELCOMPONENT_BLUE:o.hE.BLUE,PIXELCOMPONENT_ALPHA:o.hE.ALPHA}),c=[/\/\*(.|\s)*?\*\//g,/\/\/.*$/gm],l=/^\s*@\s*include\s+"(.*?)"/gm,d=/@(\w+)@/g,g=[/@\s*unroll\s+?for\s*\(\s*(int|)\s*(?<counter>\w+)\s*=\s*(-?\d+|\w+)\s*;\s*\k<counter>\s*(<=?)\s*(-?\d+|\w+)\s*;\s*\k<counter>\s*\+\+()\s*\)\s*\{\s*([\s\S]+?)\s*\}/g,/@\s*unroll\s+?for\s*\(\s*(int|)\s*(?<counter>\w+)\s*=\s*(-?\d+|\w+)\s*;\s*\k<counter>\s*(<=?)\s*(-?\d+|\w+)\s*;\s*\k<counter>\s*\+=\s*(-?\d+)\s*\)\s*\{\s*([\s\S]+?)\s*\}/g];class h{static run(e,t=new Map){const n=[];return function(e,t){const n=u.bind(t),i=g.length;for(let t=0;t<i;t++)e=e.replace(g[t],n);return e}(String(e).replace(c[0],"").replace(c[1],"").replace(l,((e,n)=>h.run(p(n),t))).replace(d,((e,i)=>String(t.has(i)?Number(t.get(i)):void 0!==a[i]?Number(a[i]):(n.push(`Undefined constant: ${i}`),0)))),t)+(n.length>0?n.map((e=>`\n#error ${e}\n`)).join(""):"")}}function p(e){if(String(e).match(/^[a-zA-Z0-9_-]+\.glsl$/))return n(524)("./"+e);throw new s.Xg(`Shader preprocessor: can't read file "${e}"`)}function u(e,t,n,o,r,A,a,c){const l=this,d=Number.isFinite(+o)||l.has(o),g=Number.isFinite(+A)||l.has(A);if(!d||!g){if(l.size>0)throw new s.D3(`Can't unroll loop: unknown limits (start=${o}, end=${A}). Code:\n\n${e}`);return e}let h=l.has(o)?l.get(o):parseInt(o),p=l.has(A)?l.get(A):parseInt(A),u=0==a.length?1:parseInt(a);i.c.assert(h<=p&&u>0);let I=null!==c.match(/\bbreak\s*;/)?"switch(1) { default:\n":"{\n";I+=`${t} ${n};\n`,p+="<="==r?1:0;for(let e=h;e<p;e+=u)I+=`{\n${n} = ${e};\n${c}\n}\n`;return I+="}\n",I}const I=Object.freeze({position:"a_position",texCoord:"a_texCoord"}),f=Object.freeze({position:0,texCoord:1}),m=`#version 300 es\nprecision highp float;\nprecision highp int;\n\nlayout (location=${f.position}) in vec2 ${I.position};\nlayout (location=${f.texCoord}) in vec2 ${I.texCoord};\nout highp vec2 texCoord;\nuniform highp vec2 texSize;\n\n#define vsinit() gl_Position = vec4(${I.position}, 0.0f, 1.0f); texCoord = ${I.texCoord};\n\n\n`,C="#define vsmain() ;",E="\n\nvoid main() { vsinit(); vsmain(); }\n",x='#version 300 es\n\n#if @FS_USE_CUSTOM_PRECISION@ == 0\nprecision mediump float; // ~float16\nprecision mediump sampler2D;\nprecision highp int; // int32\n#endif\n\n#if @FS_OUTPUT_TYPE@ == 0\n#define OUT_TYPE mediump vec4\n#elif @FS_OUTPUT_TYPE@ == 1\n#define OUT_TYPE mediump ivec4\n#elif @FS_OUTPUT_TYPE@ == 2\n#define OUT_TYPE mediump uvec4\n#else\n#error Unknown FS_OUTPUT_TYPE\n#endif\n\nout OUT_TYPE color;\nin highp vec2 texCoord;\nuniform highp vec2 texSize;\n\n@include "global.glsl"\n\n',y=Symbol();class _{constructor(e,t){if(t!==y)throw new s.js;this._source=(()=>{switch(e.type){case"filepath":return n(2863)("./"+e.filepath);case"source":return e.source;default:return""}})(),this._vssource=(()=>{switch(e.type){case"filepath":return e.vsfilepath?n(2863)("./"+e.vsfilepath):C;case"source":return e.vssource?e.vssource:C;default:return""}})(),this._fragmentSource=h.run(x+this._source),this._vertexSource=h.run(m+this._vssource+E),this._filepath="filepath"===e.type?e.filepath:"<in-memory>",this._vsfilepath="filepath"===e.type&&e.vsfilepath?e.vsfilepath:"<in-memory>",this._arguments=[],this._uniforms=this._autodetectUniforms(this._fragmentSource+"\n"+this._vertexSource),this._defines=new Map}static create(e,t=null){return new _({type:"source",source:e,vssource:t},y)}static import(e,t=null){if(!String(e).match(/^[a-zA-Z0-9_\-/]+\.glsl$/))throw new s.Xg(`Can't import fragment shader at "${e}"`);if(null!=t&&!String(t).match(/^[a-zA-Z0-9_\-/]+\.vs\.glsl$/))throw new s.Xg(`Can't import vertex shader at "${t}"`);return new _({type:"filepath",filepath:e,vsfilepath:t},y)}withArguments(...e){if(this._arguments.length>0)throw new s.js("Redefinition of shader arguments");this._arguments=e.map((e=>String(e)));for(const e of this._arguments)if(!this._uniforms.has(e)&&!this._uniforms.has(e+"[0]"))throw new s.mG(`Argument "${e}" has not been declared in the shader`);return this}withDefines(e){if(this._defines.size>0)throw new s.js("Redefinition of externally defined constants of a shader");const t=[],n=Object.keys(e);for(const i of n){const n=Number(e[i]);this._defines.set(i,n),t.push(`#define ${i} ${n}\n`)}const i=x+t.join("")+this._source,o=m+t.join("")+this._vssource+E;return this._fragmentSource=h.run(i,this._defines),this._vertexSource=h.run(o,this._defines),this._uniforms=this._autodetectUniforms(this._fragmentSource+"\n"+this._vertexSource),this}get fragmentSource(){return this._fragmentSource}get vertexSource(){return this._vertexSource}get attributes(){return I}get locationOfAttributes(){return f}get arguments(){return this._arguments}get uniforms(){return Array.from(this._uniforms.keys())}uniformType(e){if(!this._uniforms.has(e))throw new s.mG(`Unrecognized uniform variable: "${e}"`);return this._uniforms.get(e)}definedConstant(e){if(!this._defines.has(e))throw new s.mG(`Unrecognized externally defined constant: "${e}"`);return this._defines.get(e)}_autodetectUniforms(e){const t=e,n=/^\s*uniform\s+(highp\s+|mediump\s+|lowp\s+)?(\w+)\s+([^;]+)/gm,i=new Map;let o;for(;null!==(o=n.exec(t));){const e=o[2],t=o[3].split(",").map((e=>e.trim())).filter((e=>e));for(const n of t)if(n.endsWith("]")){if(!(o=n.match(/(\w+)\s*\[\s*(\d+)\s*\]$/)))throw new s.D3(`Unspecified array length for uniform "${n}" in the shader`);const[t,r]=[o[1],Number(o[2])];for(let n=0;n<r;n++)i.set(`${t}[${n}]`,e)}else{if(i.has(n)&&i.get(n)!==e)throw new s.js(`Redefinition of uniform "${n}" in the shader`);i.set(n,e)}}return i}}function S(e,t=null){return _.import(e,t)}function P(e,t=null){return _.create(e,t)}},6776:(e,t,n)=>{"use strict";n.r(t),n.d(t,{conv2D:()=>r,convX:()=>A,convY:()=>a});var i=n(9759),o=n(5484),s=n(3841);function r(e,t=1){const n=new Float32Array(e.map((e=>+e*+t))),r=0|Math.sqrt(n.length),A=r>>1;if(r<1||r%2==0)throw new s.mG(`Can't perform a 2D convolution with an invalid kSize of ${r}`);if(r*r!=n.length)throw new s.mG(`Invalid 2D convolution kernel of ${n.length} elements (expected: square)`);const a=A<=7?"pixelAtShortOffset":"pixelAtLongOffset",c=`\n    uniform sampler2D image;\n\n    void main()\n    {\n        float alpha = threadPixel(image).a;\n        vec4 result = vec4(0.0f);\n\n        ${l=(e,t,n)=>`\n        result += ${a}(image, ivec2(${0|-n}, ${0|-t})) * float(${+e});\n    `,o.c.cartesian(o.c.symmetricRange(A),o.c.symmetricRange(A)).map((e=>l(n[(e[0]+A)*r+(e[1]+A)],e[0],e[1]))).join("\n")}\n\n        color = vec4(result.rgb, alpha);\n    }\n    `;var l;return(0,i.ef)(c).withArguments("image")}function A(e,t=1){return c("x",e,t)}function a(e,t=1){return c("y",e,t)}function c(e,t,n=1){const r=new Float32Array(t.map((e=>+e*+n))),A=r.length,a=A>>1;if(A<1||A%2==0)throw new s.mG(`Can't perform a 1D convolution with an invalid kSize of ${A}`);if("x"!=e&&"y"!=e)throw new s.mG(`Can't perform 1D convolution: invalid axis "${e}"`);const c=a<=7?"pixelAtShortOffset":"pixelAtLongOffset",l=`\n    uniform sampler2D image;\n\n    void main()\n    {\n        float alpha = threadPixel(image).a;\n        vec4 pixel = vec4(0.0f);\n\n        ${d=(t,n)=>"x"==e?`\n        pixel += ${c}(image, ivec2(${0|-n}, 0)) * float(${+t});\n    `:`\n        pixel += ${c}(image, ivec2(0, ${0|-n})) * float(${+t});\n    `,o.c.symmetricRange(a).reduce(((e,t)=>e+d(r[t+a],t)),"")}\n\n        color = vec4(pixel.rgb, alpha);\n    }\n    `;var d;return(0,i.ef)(l).withArguments("image")}},524:(e,t,n)=>{var i={"./colors.glsl":2545,"./filters.glsl":7373,"./fixed-point.glsl":2229,"./float16.glsl":919,"./global.glsl":3815,"./int32.glsl":1830,"./keypoint-descriptors.glsl":1364,"./keypoint-matches.glsl":4004,"./keypoints.glsl":8714,"./math.glsl":9010,"./pyramids.glsl":6433,"./subpixel.glsl":4697};function o(e){var t=s(e);return n(t)}function s(e){if(!n.o(i,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return i[e]}o.keys=function(){return Object.keys(i)},o.resolve=s,e.exports=o,o.id=524},2863:(e,t,n)=>{var i={"./filters/convolution":6776,"./filters/convolution.js":6776,"./filters/convolution1d.glsl":4645,"./filters/convolution2d.glsl":6942,"./filters/fast-median.glsl":7054,"./filters/nightvision.glsl":8961,"./filters/normalize-image.glsl":9571,"./filters/rgb2grey.glsl":8466,"./include/colors.glsl":2545,"./include/filters.glsl":7373,"./include/fixed-point.glsl":2229,"./include/float16.glsl":919,"./include/global.glsl":3815,"./include/int32.glsl":1830,"./include/keypoint-descriptors.glsl":1364,"./include/keypoint-matches.glsl":4004,"./include/keypoints.glsl":8714,"./include/math.glsl":9010,"./include/pyramids.glsl":6433,"./include/subpixel.glsl":4697,"./keypoints/allocate-descriptors.glsl":2289,"./keypoints/allocate-extra.glsl":5725,"./keypoints/apply-homography.glsl":3801,"./keypoints/bf-knn.glsl":2346,"./keypoints/clip-border.glsl":4180,"./keypoints/clip.glsl":7771,"./keypoints/distance-filter.glsl":8938,"./keypoints/encode-keypoint-long-offsets.glsl":4802,"./keypoints/encode-keypoint-offsets.glsl":6253,"./keypoints/encode-keypoint-positions.glsl":384,"./keypoints/encode-keypoint-properties.glsl":500,"./keypoints/encode-keypoints.glsl":3673,"./keypoints/encode-null-keypoints.glsl":1703,"./keypoints/fast.glsl":2633,"./keypoints/fast.vs.glsl":535,"./keypoints/hamming-distance-filter.glsl":3232,"./keypoints/harris-cutoff.glsl":8356,"./keypoints/harris.glsl":7339,"./keypoints/knn-init.glsl":3177,"./keypoints/knn-transfer.glsl":2769,"./keypoints/laplacian.glsl":2006,"./keypoints/lk.glsl":3329,"./keypoints/lookup-of-locations.glsl":4251,"./keypoints/lookup-of-locations.vs.glsl":4747,"./keypoints/lsh-knn.glsl":7421,"./keypoints/mix-keypoints.glsl":4523,"./keypoints/nonmax-scale.glsl":2277,"./keypoints/nonmax-space.glsl":8430,"./keypoints/nonmax-suppression.glsl":9743,"./keypoints/orb-descriptor.glsl":3464,"./keypoints/orb-orientation.glsl":7184,"./keypoints/refine-scale.glsl":7220,"./keypoints/score-findmax.glsl":805,"./keypoints/shuffle.glsl":8736,"./keypoints/sort-keypoints.glsl":9311,"./keypoints/subpixel-refinement.glsl":9423,"./keypoints/transfer-flow.glsl":2060,"./keypoints/transfer-orientation.glsl":5463,"./keypoints/transfer-to-extra.glsl":6986,"./keypoints/upload-keypoints.glsl":3179,"./pyramids/downsample2.glsl":8680,"./pyramids/upsample2.glsl":3384,"./transforms/additive-mix.glsl":1976,"./transforms/resize.glsl":4543,"./transforms/warp-perspective.glsl":6296,"./utils/copy-components.glsl":747,"./utils/copy-raster.glsl":9176,"./utils/copy.glsl":8960,"./utils/fill-components.glsl":3294,"./utils/fill.glsl":1959,"./utils/flip-y.vs.glsl":7290,"./utils/scan-minmax2d.glsl":7270,"./utils/sobel-derivatives.glsl":48,"./utils/sobel-derivatives.vs.glsl":3713};function o(e){var t=s(e);return n(t)}function s(e){if(!n.o(i,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return i[e]}o.keys=function(){return Object.keys(i)},o.resolve=s,e.exports=o,o.id=2863},7905:(e,t,n)=>{"use strict";n.d(t,{$:()=>l});var i=n(5484),o=n(9845),s=n(4500),r=n(3841);const A=Symbol();let a=null,c="default";class l extends o.y{constructor(e){i.c.assert(e===A),super(),this._reinitializeOnContextLoss=!0,this._canvas=this._createCanvas(this._reinitialize.bind(this)),this._gl=null,this._gl=this._createContext(this._canvas)}static get instance(){return a||(a=new l(A))}get gl(){return this._gl}get canvas(){return this._canvas}_createCanvas(e){const t=i.c.createCanvas(16,16);return t.addEventListener("webglcontextlost",(t=>{i.c.warning("Lost WebGL2 context"),setTimeout(e,0),t.preventDefault()}),!1),t}_createContext(e){if(i.c.log(`Creating a ${c} WebGL2 rendering context...`),"undefined"==typeof WebGL2RenderingContext)throw new r.B8("This application requires WebGL2. Please use a different browser.");const t=e.getContext("webgl2",{premultipliedAlpha:!1,preserveDrawingBuffer:!1,powerPreference:c,alpha:!0,antialias:!1,depth:!1,stencil:!1,desynchronized:!0});if(!t)throw new r.B8("Can't create a WebGL2 Rendering Context. Try a different browser!");return t}_reinitialize(){this._reinitializeOnContextLoss&&(i.c.warning("Reinitializing WebGL2..."),this._canvas.remove(),this._canvas=this._createCanvas(this._reinitialize.bind(this)),this._gl=this._createContext(this._canvas),this._notify())}loseContext(){const e=this._gl;if(e.isContextLost())return;const t=e.getExtension("WEBGL_lose_context");if(!t)throw new r.B8("WEBGL_lose_context extension is unavailable");return this._reinitializeOnContextLoss=!1,t.loseContext(),t}loseAndRestoreContext(e=1){const t=1e3*Math.max(e,0),n=this.loseContext();return new s.s((e=>{setTimeout((()=>{this._reinitializeOnContextLoss=!0,this._reinitialize(),setTimeout((()=>e(n)),0)}),t)}))}static get powerPreference(){return c}static set powerPreference(e){if("default"!==e&&"low-power"!==e&&"high-performance"!==e)throw new r.mG(`Invalid powerPreference: "${e}"`);null!=a&&c===e||(c=e,null!=a&&a.loseAndRestoreContext())}}},3841:(e,t,n)=>{"use strict";n.d(t,{B8:()=>o,Ql:()=>s,Mi:()=>r,mG:()=>A,js:()=>a,Cx:()=>c,Xg:()=>l,W5:()=>d,D3:()=>g,ps:()=>h,$y:()=>p,IT:()=>u});class i extends Error{constructor(e,t=null){super([e,t?t.toString():"[speedy-vision.js]"].join("\n-> ")),this._cause=t}get name(){return this.constructor.name}set name(e){}get cause(){return this._cause}}class o extends i{constructor(e="",t=null){super(`Unsupported operation. ${e}`,t)}}class s extends i{constructor(e="",t=null){super(`WebGL error. ${e}`,t)}static from(e){const t=e.getError(),n=["NO_ERROR","INVALID_ENUM","INVALID_VALUE","INVALID_OPERATION","INVALID_FRAMEBUFFER_OPERATION","OUT_OF_MEMORY","CONTEXT_LOST_WEBGL"].find((n=>e[n]==t))||"Unknown";return new s(n)}}class r extends i{constructor(e="",t=null){super(`Can't call abstract method. ${e}`,t)}}class A extends i{constructor(e="",t=null){super(`Illegal argument. ${e}`,t)}}class a extends i{constructor(e="",t=null){super(`Illegal operation. ${e}`,t)}}class c extends i{constructor(e="",t=null){super(`Out of memory. ${e}`,t)}}class l extends i{constructor(e="",t=null){super(`File not found. ${e}`,t)}}class d extends i{constructor(e="",t=null){super(`Timeout error. ${e}`,t)}}class g extends i{constructor(e="",t=null){super(`Parse error. ${e}`,t)}}class h extends i{constructor(e="",t=null){super(`Assertion failed. ${e}`,t)}}class p extends i{constructor(e="",t=null){super(`Access denied. ${e}`,t)}}class u extends i{constructor(e="",t=null){super(`WebAssembly error. ${e}`,t)}}},3020:(e,t,n)=>{"use strict";n.r(t),n.d(t,{PYRAMID_MAX_LEVELS:()=>i,LOG2_PYRAMID_MAX_SCALE:()=>o,PYRAMID_MAX_SCALE:()=>s,FIX_BITS:()=>r,FIX_RESOLUTION:()=>A,MAX_TEXTURE_LENGTH:()=>a,MIN_KEYPOINT_SIZE:()=>c,MIN_ENCODER_LENGTH:()=>l,MAX_ENCODER_CAPACITY:()=>d,DEFAULT_ENCODER_CAPACITY:()=>g,LOG2_MAX_DESCRIPTOR_SIZE:()=>h,MAX_DESCRIPTOR_SIZE:()=>p,MATCH_INDEX_BITS:()=>u,MATCH_INDEX_MASK:()=>I,MATCH_MAX_INDEX:()=>f,MATCH_MAX_DISTANCE:()=>m,LITTLE_ENDIAN:()=>C});const i=8,o=0,s=1<<o,r=3,A=1<<r,a=(1<<16-r)-1,c=8,l=2,d=8192,g=2048,h=6,p=1<<h,u=32-(h+3),I=(1<<u)-1,f=(1<<u)-1,m=(1<<32-u)-1,C=51966===new Uint16Array(new Uint8Array([254,202]).buffer)[0]},9845:(e,t,n)=>{"use strict";n.d(t,{y:()=>i});class i{constructor(){this._subscribers=[],this._thisptr=[],this._args=[]}subscribe(e,t,...n){this._subscribers.push(e),this._thisptr.push(t),this._args.push(n)}unsubscribe(e,t){for(let n=this._subscribers.length-1;n>=0;n--)if(this._subscribers[n]===e&&this._thisptr[n]===t){this._subscribers.splice(n,1),this._thisptr.splice(n,1),this._args.splice(n,1);break}}_notify(){for(let e=0;e<this._subscribers.length;e++)this._subscribers[e].call(this._thisptr[e],...this._args[e])}}},6731:(e,t,n)=>{"use strict";n.d(t,{DD:()=>i,D3:()=>o,hE:()=>s,rY:()=>r});const i=Object.freeze({Image:Symbol("Image"),Video:Symbol("Video"),Canvas:Symbol("Canvas"),Bitmap:Symbol("Bitmap")}),o=Object.freeze({RGBA:Symbol("RGBA"),GREY:Symbol("GREY")}),s=Object.freeze({RED:1,GREEN:2,BLUE:4,ALPHA:8,ALL:15}),r=Object.freeze({[s.RED]:0,[s.GREEN]:1,[s.BLUE]:2,[s.ALPHA]:3})},5484:(e,t,n)=>{"use strict";n.d(t,{c:()=>r});var i=n(3841),o=n(4500),s=n(3135);class r{static warning(e,...t){"default"===s.Z.logging&&console.warn("[speedy-vision]",e,...t)}static log(e,...t){"none"!==s.Z.logging&&console.log("[speedy-vision]",e,...t)}static assert(e,t=""){if(!e)throw new i.ps(t)}static functionArguments(e){const t=e.toString(),n=t.startsWith("function")?"function\\s.*\\(([^)]*)\\)":t.startsWith("(")?"\\(([^)]*)\\).*=>":"([^=]+).*=>",o=new RegExp(n).exec(t);if(null!==o){return o[1].replace(/\/\*.*?\*\//g,"").split(",").map((e=>e.replace(/=.*$/,"").trim())).filter((e=>e))}throw new i.D3(`Can't detect function arguments of ${t}`)}static getAllPropertyDescriptors(e){if(e){const t=Object.getPrototypeOf(e);return{...r.getAllPropertyDescriptors(t),...Object.getOwnPropertyDescriptors(e)}}return Object.create(null)}static createCanvas(e,t){const n=document.createElement("canvas");return n.width=e,n.height=t,n}static gaussianNoise(e=0,t=1){const n=2*Math.PI;let i,o=Math.random();do{i=Math.random()}while(i<=Number.EPSILON);return Math.sqrt(-2*Math.log(i))*Math.sin(n*o)*t+e}static gaussianKernel(e,t=0,n=!0){if(0==t&&(t=0|Math.ceil(5*e),t+=1-t%2),(t|=0)<1||t%2==0)throw new i.mG(`Invalid kernel size given to gaussianKernel: ${t} x 1`);if(e<=0)throw new i.mG(`Invalid sigma given to gaussianKernel: ${e}`);const o=new Array(t),s=t>>1,r=1.4142135623730951*+e,A=.3275911,a=.254829592,c=-.284496736,l=1.421413741,d=-1.453152027,g=1.061405429;let h=0;for(let e=0;e<t;e++){let t=(e-s+.5)/r,n=(e-s-.5)/r,i=1,p=1;t<0&&(i=-1,t=-t),n<0&&(p=-1,n=-n);const u=1/(1+A*t),I=1/(1+A*n),f=((((g*I+d)*I+l)*I+c)*I+a)*I,m=(i*(1-((((g*u+d)*u+l)*u+c)*u+a)*u*Math.exp(-t*t))-p*(1-f*Math.exp(-n*n)))/(2*r);o[e]=m,h+=m}if(n)for(let e=0;e<t;e++)o[e]/=h;return o}static kernel2d(e,t=e){const n=e.length;r.assert(e.length==e.length),r.assert(n>=1&&n%2==1);let i=new Array(n*n),o=0;for(let s=0;s<n;s++)for(let r=0;r<n;r++)i[o++]=e[r]*t[s];return i}static cartesian(e,t){return[].concat(...e.map((e=>t.map((t=>[e,t])))))}static symmetricRange(e){if((e|=0)<0)throw new i.mG("Expected a non-negative integer as input");return[...Array(2*e+1).keys()].map((t=>t-e))}static range(e){if((e|=0)<=0)throw new i.mG("Expected a positive integer as input");return[...Array(e).keys()]}static shuffle(e){const t=e.length,n=t-1;for(let i=0;i<n;i++){const n=i+(Math.random()*(t-i)|0);if(i!==n){const t=e[i];e[i]=e[n],e[n]=t}}return e}static flatten(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n];if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++)t.push(i[e]);else t.push(i)}return t}static decodeFloat16(e){const t=(32767&e)>>10,n=1023&e,i=1-2*((65535&e)>>15);if(0==t)return 0==n?0*i:i*n*5.960464477539063e-8;if(31==t)return 0==n?i*Number.POSITIVE_INFINITY:Number.NaN;return i*(t>=15?1<<t-15:1/(1<<15-t))*(1+.0009765625*n)}static requestCameraStream(e={audio:!1,video:!0}){if(r.log("Accessing the webcam..."),!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new i.B8("Unsupported browser: no mediaDevices.getUserMedia()");return new o.s(((t,n)=>{navigator.mediaDevices.getUserMedia(e).then((e=>{const n=document.createElement("video");n.onloadedmetadata=()=>{n.play(),r.log(`The camera is on! Resolution: ${n.videoWidth} x ${n.videoHeight}`),t(n)},n.srcObject=e})).catch((e=>{n(new i.$y("Please give access to the camera and reload the page",e))}))}))}}},4645:e=>{e.exports="#if !defined(KERNEL_SIZE) || !defined(AXIS) || (AXIS != 0 && AXIS != 1)\n#error Undefined KERNEL_SIZE / AXIS\n#endif\nuniform sampler2D image;\nuniform float kernel[@KERNEL_SIZE@];\nconst ivec2 axis = ivec2(1-AXIS, AXIS);\n#define S(x,k) result += pixelAtShortOffset(image, ivec2((x),(x)) * axis) * kernel[k]\nvoid main()\n{\nvec4 result = vec4(0.0f);\n#if KERNEL_SIZE == 3\nS(-1, 2);\nS( 0, 1);\nS( 1, 0);\n#elif KERNEL_SIZE == 5\nS(-2, 4);\nS(-1, 3);\nS( 0, 2);\nS( 1, 1);\nS( 2, 0);\n#elif KERNEL_SIZE == 7\nS(-3, 6);\nS(-2, 5);\nS(-1, 4);\nS( 0, 3);\nS( 1, 2);\nS( 2, 1);\nS( 3, 0);\n#elif KERNEL_SIZE == 9\nS(-4, 8);\nS(-3, 7);\nS(-2, 6);\nS(-1, 5);\nS( 0, 4);\nS( 1, 3);\nS( 2, 2);\nS( 3, 1);\nS( 4, 0);\n#elif KERNEL_SIZE == 11\nS(-5, 10);\nS(-4, 9);\nS(-3, 8);\nS(-2, 7);\nS(-1, 6);\nS( 0, 5);\nS( 1, 4);\nS( 2, 3);\nS( 3, 2);\nS( 4, 1);\nS( 5, 0);\n#elif KERNEL_SIZE == 13\nS(-6, 12);\nS(-5, 11);\nS(-4, 10);\nS(-3, 9);\nS(-2, 8);\nS(-1, 7);\nS( 0, 6);\nS( 1, 5);\nS( 2, 4);\nS( 3, 3);\nS( 4, 2);\nS( 5, 1);\nS( 6, 0);\n#elif KERNEL_SIZE == 15\nS(-7, 14);\nS(-6, 13);\nS(-5, 12);\nS(-4, 11);\nS(-3, 10);\nS(-2, 9);\nS(-1, 8);\nS( 0, 7);\nS( 1, 6);\nS( 2, 5);\nS( 3, 4);\nS( 4, 3);\nS( 5, 2);\nS( 6, 1);\nS( 7, 0);\n#else\n#error Invalid parameters\n#endif\ncolor = vec4(result.rgb, 1.0f);\n}"},6942:e=>{e.exports="#ifndef KERNEL_SIZE_SQUARED\n#define Must define KERNEL_SIZE_SQUARED\n#endif\nuniform sampler2D image;\nuniform float kernel[@KERNEL_SIZE_SQUARED@];\n#define S(x,y,k) result += pixelAtShortOffset(image, ivec2((x),(y))) * kernel[k]\nvoid main()\n{\nvec4 result = vec4(0.0f);\n#if KERNEL_SIZE_SQUARED == 9\nS(-1,-1, 8);\nS(-1, 0, 7);\nS(-1, 1, 6);\nS( 0,-1, 5);\nS( 0, 0, 4);\nS( 0, 1, 3);\nS( 1,-1, 2);\nS( 1, 0, 1);\nS( 1, 1, 0);\n#elif KERNEL_SIZE_SQUARED == 25\nS(-2,-2, 24);\nS(-2,-1, 23);\nS(-2, 0, 22);\nS(-2, 1, 21);\nS(-2, 2, 20);\nS(-1,-2, 19);\nS(-1,-1, 18);\nS(-1, 0, 17);\nS(-1, 1, 16);\nS(-1, 2, 15);\nS( 0,-2, 14);\nS( 0,-1, 13);\nS( 0, 0, 12);\nS( 0, 1, 11);\nS( 0, 2, 10);\nS( 1,-2, 9);\nS( 1,-1, 8);\nS( 1, 0, 7);\nS( 1, 1, 6);\nS( 1, 2, 5);\nS( 2,-2, 4);\nS( 2,-1, 3);\nS( 2, 0, 2);\nS( 2, 1, 1);\nS( 2, 2, 0);\n#elif KERNEL_SIZE_SQUARED == 49\nS(-3,-3, 48);\nS(-3,-2, 47);\nS(-3,-1, 46);\nS(-3, 0, 45);\nS(-3, 1, 44);\nS(-3, 2, 43);\nS(-3, 3, 42);\nS(-2,-3, 41);\nS(-2,-2, 40);\nS(-2,-1, 39);\nS(-2, 0, 38);\nS(-2, 1, 37);\nS(-2, 2, 36);\nS(-2, 3, 35);\nS(-1,-3, 34);\nS(-1,-2, 33);\nS(-1,-1, 32);\nS(-1, 0, 31);\nS(-1, 1, 30);\nS(-1, 2, 29);\nS(-1, 3, 28);\nS( 0,-3, 27);\nS( 0,-2, 26);\nS( 0,-1, 25);\nS( 0, 0, 24);\nS( 0, 1, 23);\nS( 0, 2, 22);\nS( 0, 3, 21);\nS( 1,-3, 20);\nS( 1,-2, 19);\nS( 1,-1, 18);\nS( 1, 0, 17);\nS( 1, 1, 16);\nS( 1, 2, 15);\nS( 1, 3, 14);\nS( 2,-3, 13);\nS( 2,-2, 12);\nS( 2,-1, 11);\nS( 2, 0, 10);\nS( 2, 1, 9);\nS( 2, 2, 8);\nS( 2, 3, 7);\nS( 3,-3, 6);\nS( 3,-2, 5);\nS( 3,-1, 4);\nS( 3, 0, 3);\nS( 3, 1, 2);\nS( 3, 2, 1);\nS( 3, 3, 0);\n#else\n#error Invalid KERNEL_SIZE_SQUARED\n#endif\ncolor = vec4(result.rgb, 1.0f);\n}"},7054:e=>{e.exports="uniform sampler2D image;\n#define X(i,j) t = vec2(min(p[i], p[j]), max(p[i], p[j])); p[i] = t.x; p[j] = t.y;\n#define S(i,x,y) p[i] = pixelAtShortOffset(image, ivec2((x),(y))).g\nvoid main()\n{\nfloat median;\nvec2 t;\n#if !defined(KERNEL_SIZE)\n#error Must define KERNEL_SIZE\n#elif KERNEL_SIZE == 3\nfloat p[9];\nS(0,-1,-1);\nS(1, 0,-1);\nS(2, 1,-1);\nS(3,-1, 0);\nS(4, 0, 0);\nS(5, 1, 0);\nS(6,-1, 1);\nS(7, 0, 1);\nS(8, 1, 1);\nX(1,2);X(4,5);X(7,8);X(0,1);X(3,4);X(6,7);X(1,2);X(4,5);X(7,8);X(0,3);X(5,8);X(4,7);X(3,6);X(1,4);X(2,5);X(4,7);X(4,2);X(6,4);X(4,2);\nmedian = p[4];\n#elif KERNEL_SIZE == 5\nfloat p[25];\nS( 0,-2,-2);\nS( 1,-1,-2);\nS( 2, 0,-2);\nS( 3, 1,-2);\nS( 4, 2,-2);\nS( 5,-2,-1);\nS( 6,-1,-1);\nS( 7, 0,-1);\nS( 8, 1,-1);\nS( 9, 2,-1);\nS(10,-2, 0);\nS(11,-1, 0);\nS(12, 0, 0);\nS(13, 1, 0);\nS(14, 2, 0);\nS(15,-2, 1);\nS(16,-1, 1);\nS(17, 0, 1);\nS(18, 1, 1);\nS(19, 2, 1);\nS(20,-2, 2);\nS(21,-1, 2);\nS(22, 0, 2);\nS(23, 1, 2);\nS(24, 2, 2);\nX(0,1);X(3,4);X(2,4);X(2,3);X(6,7);X(5,7);X(5,6);X(9,10);X(8,10);X(8,9);X(12,13);X(11,13);X(11,12);X(15,16);X(14,16);X(14,15);X(18,19);X(17,19);X(17,18);X(21,22);X(20,22);X(20,21);X(23,24);X(2,5);X(3,6);X(0,6);X(0,3);X(4,7);X(1,7);X(1,4);X(11,14);X(8,14);X(8,11);X(12,15);X(9,15);X(9,12);X(13,16);X(10,16);X(10,13);X(20,23);X(17,23);X(17,20);X(21,24);X(18,24);X(18,21);X(19,22);X(8,17);X(9,18);X(0,18);X(0,9);X(10,19);X(1,19);X(1,10);X(11,20);X(2,20);X(2,11);X(12,21);X(3,21);X(3,12);X(13,22);X(4,22);X(4,13);X(14,23);X(5,23);X(5,14);X(15,24);X(6,24);X(6,15);X(7,16);X(7,19);X(13,21);X(15,23);X(7,13);X(7,15);X(1,9);X(3,11);X(5,17);X(11,17);X(9,17);X(4,10);X(6,12);X(7,14);X(4,6);X(4,7);X(12,14);X(10,14);X(6,7);X(10,12);X(6,10);X(6,17);X(12,17);X(7,17);X(7,10);X(12,18);X(7,12);X(10,18);X(12,20);X(10,20);X(10,12);\nmedian = p[12];\n#elif KERNEL_SIZE == 7\nfloat p[49];\nS( 0,-3,-3);\nS( 1,-2,-3);\nS( 2,-1,-3);\nS( 3, 0,-3);\nS( 4, 1,-3);\nS( 5, 2,-3);\nS( 6, 3,-3);\nS( 7,-3,-2);\nS( 8,-2,-2);\nS( 9,-1,-2);\nS(10, 0,-2);\nS(11, 1,-2);\nS(12, 2,-2);\nS(13, 3,-2);\nS(14,-3,-1);\nS(15,-2,-1);\nS(16,-1,-1);\nS(17, 0,-1);\nS(18, 1,-1);\nS(19, 2,-1);\nS(20, 3,-1);\nS(21,-3, 0);\nS(22,-2, 0);\nS(23,-1, 0);\nS(24, 0, 0);\nS(25, 1, 0);\nS(26, 2, 0);\nS(27, 3, 0);\nS(28,-3, 1);\nS(29,-2, 1);\nS(30,-1, 1);\nS(31, 0, 1);\nS(32, 1, 1);\nS(33, 2, 1);\nS(34, 3, 1);\nS(35,-3, 2);\nS(36,-2, 2);\nS(37,-1, 2);\nS(38, 0, 2);\nS(39, 1, 2);\nS(40, 2, 2);\nS(41, 3, 2);\nS(42,-3, 3);\nS(43,-2, 3);\nS(44,-1, 3);\nS(45, 0, 3);\nS(46, 1, 3);\nS(47, 2, 3);\nS(48, 3, 3);\nX(0,1);X(2,3);X(0,2);X(1,3);X(1,2);X(4,5);X(6,7);X(4,6);X(5,7);X(5,6);X(0,4);X(2,6);X(2,4);X(1,5);X(3,7);X(3,5);X(1,2);X(3,4);X(5,6);X(8,9);X(10,11);X(8,10);X(9,11);X(9,10);X(12,13);X(14,15);X(12,14);X(13,15);X(13,14);X(8,12);X(10,14);X(10,12);X(9,13);X(11,15);X(11,13);X(9,10);X(11,12);X(13,14);X(0,8);X(4,12);X(4,8);X(2,10);X(6,14);X(6,10);X(2,4);X(6,8);X(10,12);X(1,9);X(5,13);X(5,9);X(3,11);X(7,15);X(7,11);X(3,5);X(7,9);X(11,13);X(1,2);X(3,4);X(5,6);X(7,8);X(9,10);X(11,12);X(13,14);X(16,17);X(18,19);X(16,18);X(17,19);X(17,18);X(20,21);X(22,23);X(20,22);X(21,23);X(21,22);X(16,20);X(18,22);X(18,20);X(17,21);X(19,23);X(19,21);X(17,18);X(19,20);X(21,22);X(24,25);X(26,27);X(24,26);X(25,27);X(25,26);X(28,29);X(30,31);X(28,30);X(29,31);X(29,30);X(24,28);X(26,30);X(26,28);X(25,29);X(27,31);X(27,29);X(25,26);X(27,28);X(29,30);X(16,24);X(20,28);X(20,24);X(18,26);X(22,30);X(22,26);X(18,20);X(22,24);X(26,28);X(17,25);X(21,29);X(21,25);X(19,27);X(23,31);X(23,27);X(19,21);X(23,25);X(27,29);X(17,18);X(19,20);X(21,22);X(23,24);X(25,26);X(27,28);X(29,30);X(0,16);X(8,24);X(8,16);X(4,20);X(12,28);X(12,20);X(4,8);X(12,16);X(20,24);X(2,18);X(10,26);X(10,18);X(6,22);X(14,30);X(14,22);X(6,10);X(14,18);X(22,26);X(2,4);X(6,8);X(10,12);X(14,16);X(18,20);X(22,24);X(26,28);X(1,17);X(9,25);X(9,17);X(5,21);X(13,29);X(13,21);X(5,9);X(13,17);X(21,25);X(3,19);X(11,27);X(11,19);X(7,23);X(15,31);X(15,23);X(7,11);X(15,19);X(23,27);X(3,5);X(7,9);X(11,13);X(15,17);X(19,21);X(23,25);X(27,29);X(1,2);X(3,4);X(5,6);X(7,8);X(9,10);X(11,12);X(13,14);X(15,16);X(17,18);X(19,20);X(21,22);X(23,24);X(25,26);X(27,28);X(29,30);X(32,33);X(34,35);X(32,34);X(33,35);X(33,34);X(36,37);X(38,39);X(36,38);X(37,39);X(37,38);X(32,36);X(34,38);X(34,36);X(33,37);X(35,39);X(35,37);X(33,34);X(35,36);X(37,38);X(40,41);X(42,43);X(40,42);X(41,43);X(41,42);X(44,45);X(46,47);X(44,46);X(45,47);X(45,46);X(40,44);X(42,46);X(42,44);X(41,45);X(43,47);X(43,45);X(41,42);X(43,44);X(45,46);X(32,40);X(36,44);X(36,40);X(34,42);X(38,46);X(38,42);X(34,36);X(38,40);X(42,44);X(33,41);X(37,45);X(37,41);X(35,43);X(39,47);X(39,43);X(35,37);X(39,41);X(43,45);X(33,34);X(35,36);X(37,38);X(39,40);X(41,42);X(43,44);X(45,46);X(32,48);X(40,48);X(36,40);X(44,48);X(38,42);X(34,36);X(38,40);X(42,44);X(46,48);X(37,41);X(39,43);X(35,37);X(39,41);X(43,45);X(33,34);X(35,36);X(37,38);X(39,40);X(41,42);X(43,44);X(45,46);X(47,48);X(0,32);X(16,48);X(16,32);X(8,40);X(24,40);X(8,16);X(24,32);X(40,48);X(4,36);X(20,36);X(12,44);X(28,44);X(12,20);X(28,36);X(4,8);X(12,16);X(20,24);X(28,32);X(36,40);X(44,48);X(2,34);X(18,34);X(10,42);X(26,42);X(10,18);X(26,34);X(6,38);X(22,38);X(14,46);X(30,46);X(14,22);X(30,38);X(6,10);X(14,18);X(22,26);X(30,34);X(38,42);X(2,4);X(6,8);X(10,12);X(14,16);X(18,20);X(22,24);X(26,28);X(30,32);X(34,36);X(38,40);X(42,44);X(46,48);X(1,33);X(17,33);X(9,41);X(25,41);X(9,17);X(25,33);X(5,37);X(21,37);X(13,45);X(29,45);X(13,21);X(29,37);X(5,9);X(13,17);X(21,25);X(29,33);X(37,41);X(3,35);X(19,35);X(11,43);X(27,43);X(11,19);X(27,35);X(7,39);X(23,39);X(15,47);X(31,47);X(15,23);X(31,39);X(7,11);X(15,19);X(23,27);X(31,35);X(39,43);X(3,5);X(7,9);X(11,13);X(15,17);X(19,21);X(23,25);X(27,29);X(31,33);X(35,37);X(39,41);X(43,45);X(1,2);X(3,4);X(5,6);X(7,8);X(9,10);X(11,12);X(13,14);X(15,16);X(17,18);X(19,20);X(21,22);X(23,24);\nmedian = p[24];\n#else\n#error Unsupported kernel size\n#endif\ncolor = vec4(median, median, median, 1.0f);\n}"},8961:e=>{e.exports="uniform sampler2D image;\nuniform sampler2D illuminationMap;\nuniform float gain;\nuniform float offset;\nuniform float decay;\n#ifndef GREYSCALE\n#error Must define GREYSCALE\n#endif\n#if GREYSCALE == 0\nconst mat3 rgb2yuv = mat3(\n0.299f, -0.14713f, 0.615f,\n0.587f, -0.28886f, -0.51499f,\n0.114f, 0.436f, -0.10001f\n);\nconst mat3 yuv2rgb = mat3(\n1.0f, 1.0f, 1.0f,\n0.0f, -0.39465f, 2.03211f,\n1.13983f, -0.58060f, 0.0f\n);\n#endif\nconst float eps = 0.0001f;\nconst float sqrt2 = 1.4142135623730951f;\nconst float magic = 20.0f;\nconst vec2 center = vec2(0.5f);\nvoid main()\n{\nvec4 pixel = threadPixel(image);\nvec4 imapPixel = threadPixel(illuminationMap);\nfloat lambda = -sqrt2 * log(max(1.0f - decay, eps));\nfloat dist = length(texCoord - center);\nfloat vgain = gain * exp(-lambda * dist);\nfloat normalizedGain = 2.0f * vgain;\nfloat normalizedOffset = 2.0f * offset - 1.0f;\n#if GREYSCALE != 0\nfloat luma = 1.0 / (1.0 + exp(-normalizedGain * magic * (pixel.g - imapPixel.g)));\nluma = clamp(luma + normalizedOffset, 0.0f, 1.0f);\ncolor = vec4(luma, luma, luma, 1.0f);\n#else\nvec3 yuvPixel = rgb2yuv * pixel.rgb;\nvec3 yuvImapPixel = rgb2yuv * imapPixel.rgb;\nfloat luma = 1.0 / (1.0 + exp(-normalizedGain * magic * (yuvPixel.r - yuvImapPixel.r)));\nluma += normalizedOffset;\nvec3 rgbCorrectedPixel = yuv2rgb * vec3(luma, yuvPixel.gb);\nrgbCorrectedPixel = clamp(rgbCorrectedPixel, 0.0f, 1.0f);\ncolor = vec4(rgbCorrectedPixel, 1.0f);\n#endif\n}"},9571:e=>{e.exports="#ifndef GREYSCALE\n#error Must define GREYSCALE\n#endif\n#if GREYSCALE != 0\nuniform sampler2D minmax2d;\n#else\nuniform sampler2D minmax2dRGB[3];\n#endif\nuniform float minValue;\nuniform float maxValue;\nconst float eps = 1.0f / 255.0f;\nvoid main()\n{\nvec2 minmax = clamp(vec2(minValue, maxValue), 0.0f, 255.0f) / 255.0f;\nvec4 newMin = vec4(minmax.x);\nvec4 newRange = vec4(minmax.y - minmax.x);\nvec4 alpha = vec4(1.0f, newMin.x, newRange.x, 1.0f);\n#if GREYSCALE != 0\nvec4 pixel = threadPixel(minmax2d);\nmat4 channel = mat4(pixel, pixel, pixel, alpha);\n#else\nmat4 channel = mat4(\nthreadPixel(minmax2dRGB[0]),\nthreadPixel(minmax2dRGB[1]),\nthreadPixel(minmax2dRGB[2]),\nalpha\n);\n#endif\nvec4 oldMin = vec4(channel[0].g, channel[1].g, channel[2].g, channel[3].g);\nvec4 oldRange = max(vec4(channel[0].b, channel[1].b, channel[2].b, channel[3].b), eps);\nvec4 oldIntensity = vec4(channel[0].a, channel[1].a, channel[2].a, channel[3].a);\nvec4 newIntensity = (oldIntensity - oldMin) * newRange / oldRange + newMin;\ncolor = newIntensity;\n}"},8466:e=>{e.exports="const vec4 grey = vec4(0.299f, 0.587f, 0.114f, 0.0f);\nuniform sampler2D image;\nvoid main()\n{\nvec4 pixel = threadPixel(image);\nfloat g = dot(pixel, grey);\ncolor = vec4(g, g, g, 1.0f);\n}"},2545:e=>{e.exports="#ifndef _COLORS_GLSL\n#define _COLORS_GLSL\n#define PIXELCOMPONENT_RED   @PIXELCOMPONENT_RED@\n#define PIXELCOMPONENT_GREEN @PIXELCOMPONENT_GREEN@\n#define PIXELCOMPONENT_BLUE  @PIXELCOMPONENT_BLUE@\n#define PIXELCOMPONENT_ALPHA @PIXELCOMPONENT_ALPHA@\n#endif"},7373:e=>{e.exports="#ifndef _FILTERS_GLSL\n#define _FILTERS_GLSL\nfloat laplacian(sampler2D pyramid, vec2 position, float lod)\n{\nfloat pot = exp2(lod);\nivec2 pyrBaseSize = textureSize(pyramid, 0);\nconst vec3 ones = vec3(1.0f);\nconst mat3 kernel = mat3(\n0,-1, 0,\n-1, 4,-1,\n0,-1, 0\n);\n#define LPC(x,y) pyrSubpixelAtExOffset(pyramid, position, lod, pot, ivec2((x),(y)), pyrBaseSize).g\nmat3 neighborhood = mat3(\n0.0f, LPC(0,-1), 0.0f,\nLPC(-1,0), LPC(0,0), LPC(1,0),\n0.0f, LPC(0,1), 0.0f\n);\nmat3 m = matrixCompMult(neighborhood, kernel);\nreturn dot(ones, vec3(\ndot(m[0], ones),\ndot(m[1], ones),\ndot(m[2], ones)\n)) * (1.0f + lod);\n}\n#endif"},2229:e=>{e.exports="#ifndef _FIXEDPOINT_GLSL\n#define _FIXEDPOINT_GLSL\n#define fixed_t int\n#define fixed2_t ivec2\nconst int FIX_BITS = int(@FIX_BITS@);\nconst float FIX_RESOLUTION = float(@FIX_RESOLUTION@);\n#define itofix(x) fixed_t((x) << FIX_BITS)\n#define fixtoi(f) int((x) >> FIX_BITS)\n#define ftofix(x) fixed_t((x) * FIX_RESOLUTION + 0.5f)\n#define fixtof(f) (float(f) / FIX_RESOLUTION)\n#define ivec2tofix(x) fixed2_t((x) << FIX_BITS)\n#define fixtoivec2(f) ivec2((f) >> FIX_BITS)\n#define vec2tofix(v) fixed2_t((v) * FIX_RESOLUTION + vec2(0.5f))\n#define fixtovec2(f) (vec2(f) / FIX_RESOLUTION)\n#endif"},919:e=>{e.exports="#ifndef _FLOAT16_GLSL\n#define _FLOAT16_GLSL\n#define encodeFloat16(f) (vec2(packf16(f)) / 255.0f)\n#define decodeFloat16(v) unpackf16(uvec2((v) * 255.0f))\n#define encodePairOfFloat16(f) vec4(encodeFloat16((f).x), encodeFloat16((f).y))\n#define decodePairOfFloat16(v) vec2(decodeFloat16((v).rg), decodeFloat16((v).ba))\n#define encodeNullPairOfFloat16() vec4(1.0f)\n#define isNullPairOfFloat16(v) all(equal((v), encodeNullPairOfFloat16()))\n#define encodeDiscardedPairOfFloat16() vec4(0.0f, 1.0f, 0.0f, 1.0f)\n#define isDiscardedPairOfFloat16(v) all(equal((v), encodeDiscardedPairOfFloat16()))\n#define encodeFloat16NaN() vec2(0.5f, 1.0f)\n#define isEncodedFloat16NaN(v) all(equal((v), encodeFloat16NaN()))\nuvec2 packf16( float f)\n{\nuint y = packHalf2x16(vec2(f, 0.0f));\nreturn uvec2(y, y >> 8u) & 0xFFu;\n}\nfloat unpackf16(uvec2 v)\n{\nv &= 0xFFu;\nreturn unpackHalf2x16(v.x | (v.y << 8u)).x;\n}\nbool isEncodedFloat16Zero(vec2 v)\n{\nuvec2 w = uvec2(v * 255.0f);\nreturn 0u == w.x + w.y * (0x80u - w.y);\n}\n#endif"},3815:e=>{e.exports="#ifndef _GLOBAL_GLSL\n#define _GLOBAL_GLSL\n#define threadLocation() ivec2(texCoord * texSize)\n#define outputSize() ivec2(texSize)\n#define threadPixel(img) textureLod((img), texCoord, 0.0f)\n#define pixelAt(img, pos) texelFetch((img), (pos), 0)\n#define pixelAtShortOffset(img, offset) textureLodOffset((img), texCoord, 0.0f, (offset))\n#define pixelAtLongOffset(img, offset) textureLod((img), texCoord + vec2(offset) / texSize, 0.0f)\n#endif"},1830:e=>{e.exports="#ifndef _INT32_GLSL\n#define _INT32_GLSL\nuint decodeUint32(vec4 rgba)\n{\nuvec4 v = uvec4(rgba * 255.0f) & 255u;\nreturn v.x | (v.y << 8u) | (v.z << 16u) | (v.w << 24u);\n}\nvec4 encodeUint32(uint value)\n{\nuvec4 v = uvec4(value, value >> 8u, value >> 16u, value >> 24u) & 255u;\nreturn vec4(v) / 255.0f;\n}\n#endif"},1364:e=>{e.exports="#ifndef _KEYPOINT_DESCRIPTORS_GLSL\n#define _KEYPOINT_DESCRIPTORS_GLSL\n#if !defined(DESCRIPTOR_SIZE)\n#error Must define DESCRIPTOR_SIZE\n#elif !defined(_KEYPOINTS_GLSL)\n#error Must include keypoints.glsl\n#endif\nuint[DESCRIPTOR_SIZE] readKeypointDescriptor(sampler2D encodedKeypoints, int descriptorSize, int extraSize, int encoderLength, KeypointAddress address)\n{\nint descriptorOffset = sizeofEncodedKeypoint(0, extraSize) / 4;\nKeypointAddress descriptorAddress = KeypointAddress(address.base, descriptorOffset);\nuint[DESCRIPTOR_SIZE] descriptor;\nvec4 pixel; uvec4 bytes;\n@unroll\nfor(int i = 0; i < DESCRIPTOR_SIZE; i += 4) {\npixel = readKeypointData(encodedKeypoints, encoderLength, descriptorAddress);\nbytes = uvec4(pixel * 255.0f);\ndescriptor[i]   = bytes.r;\ndescriptor[i+1] = bytes.g;\ndescriptor[i+2] = bytes.b;\ndescriptor[i+3] = bytes.a;\ndescriptorAddress.offset++;\n}\nreturn descriptor;\n}\nuint[DESCRIPTOR_SIZE] readKeypointDescriptorFromDB(sampler2D descriptorDB, int descriptorDBStride, int index)\n{\nuint[DESCRIPTOR_SIZE] descriptor;\nint rasterIndex = index * (DESCRIPTOR_SIZE / 4) * int(index >= 0);\nvec4 pixel; uvec4 bytes; ivec2 pos;\n@unroll\nfor(int i = 0; i < DESCRIPTOR_SIZE; i += 4) {\npos = ivec2(rasterIndex % descriptorDBStride, rasterIndex / descriptorDBStride);\npixel = (index >= 0) ? texelFetch(descriptorDB, pos, 0) : vec4(0.0f);\nbytes = uvec4(pixel * 255.0f);\ndescriptor[i]   = bytes.r;\ndescriptor[i+1] = bytes.g;\ndescriptor[i+2] = bytes.b;\ndescriptor[i+3] = bytes.a;\nrasterIndex++;\n}\nreturn descriptor;\n}\nint distanceBetweenKeypointDescriptors(uint[DESCRIPTOR_SIZE] a, uint[DESCRIPTOR_SIZE] b)\n{\nconst int[256] POPCNT = int[256](0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8);\nuvec4 xor, u, v;\nint dist = 0;\nivec4 bits;\n@unroll\nfor(int i = 0; i < DESCRIPTOR_SIZE; i += 4) {\nu = uvec4(a[i], a[i+1], a[i+2], a[i+3]);\nv = uvec4(b[i], b[i+1], b[i+2], b[i+3]);\nxor = (u ^ v) & 255u;\nbits = ivec4(POPCNT[xor.x], POPCNT[xor.y], POPCNT[xor.z], POPCNT[xor.w]);\ndist += bits.x + bits.y + bits.z + bits.w;\n}\nreturn dist;\n}\n#endif"},4004:e=>{e.exports='#ifndef _KEYPOINT_MATCHES_GLSL\n#define _KEYPOINT_MATCHES_GLSL\n@include "int32.glsl"\nconst int MATCH_INDEX_BITS = int(@MATCH_INDEX_BITS@);\nconst int MATCH_INDEX_MASK = int(@MATCH_INDEX_MASK@);\nconst int MATCH_MAX_INDEX = int(@MATCH_MAX_INDEX@);\nconst int MATCH_MAX_DISTANCE = int(@MATCH_MAX_DISTANCE@);\nstruct KeypointMatch\n{\nint index;\nint dist;\n};\nvec4 encodeKeypointMatch(KeypointMatch candidate)\n{\nuint index = uint(candidate.index) & uint(MATCH_INDEX_MASK);\nuint dist = uint(clamp(candidate.dist, 0, MATCH_MAX_DISTANCE));\nuint u32 = index | (dist << MATCH_INDEX_BITS);\nreturn encodeUint32(u32);\n}\nKeypointMatch decodeKeypointMatch(vec4 rgba)\n{\nuint u32 = decodeUint32(rgba);\nint dist = int(u32 >> MATCH_INDEX_BITS);\nint index = int(u32 & uint(MATCH_INDEX_MASK));\nreturn KeypointMatch(index, dist);\n}\nconst KeypointMatch MATCH_NOT_FOUND = KeypointMatch(MATCH_MAX_INDEX, MATCH_MAX_DISTANCE);\n#endif'},8714:e=>{e.exports='#ifndef _KEYPOINTS_GLSL\n#define _KEYPOINTS_GLSL\n@include "math.glsl"\n@include "fixed-point.glsl"\n@include "float16.glsl"\n@include "pyramids.glsl"\nstruct Keypoint\n{\nvec2 position;\nfloat lod;\nfloat orientation;\nfloat score;\nuint flags;\n};\nstruct KeypointAddress\n{\nint base;\nint offset;\n};\nconst int MIN_KEYPOINT_SIZE = int(@MIN_KEYPOINT_SIZE@);\nconst int MAX_DESCRIPTOR_SIZE = int(@MAX_DESCRIPTOR_SIZE@);\nconst uint KPF_NONE = 0u;\nconst uint KPF_NULL = 1u;\nconst uint KPF_DISCARDED = 2u;\n#define encodeKeypointScore(score) encodeFloat16(score)\n#define decodeKeypointScore(encodedScore) decodeFloat16(encodedScore)\n#define encodeKeypointOrientation(angle) ((angle) * INV_PI_OVER_2 + 0.5f)\n#define decodeKeypointOrientation(value) ((value) * TWO_PI - PI)\n#define encodeNullKeypoint() (vec4(1.0f))\n#define encodeDiscardedKeypoint() (vec4(0.0f))\n#define isNullKeypoint(keypoint) ((((keypoint).flags) & KPF_NULL) != 0u)\n#define isDiscardedKeypoint(keypoint) ((((keypoint).flags) & KPF_DISCARDED) != 0u)\n#define isBadKeypoint(keypoint) ((keypoint).score < 0.0f)\n#define sizeofEncodedKeypoint(descriptorSize, extraSize) (MIN_KEYPOINT_SIZE + (descriptorSize) + (extraSize))\n#define sizeofEncodedKeypointHeader() sizeofEncodedKeypoint(0,0)\n#define findKeypointIndex(address, descriptorSize, extraSize) ((address).base / ((sizeofEncodedKeypoint((descriptorSize), (extraSize))) / 4))\nvec4 readKeypointData(sampler2D encodedKeypoints, int encoderLength, KeypointAddress address)\n{\nint rasterIndex = address.base + address.offset;\nvec4 data = pixelAt(encodedKeypoints, ivec2(rasterIndex % encoderLength, rasterIndex / encoderLength));\nreturn rasterIndex < encoderLength * encoderLength ? data : encodeNullKeypoint();\n}\nKeypointAddress findKeypointAddress(ivec2 thread, int encoderLength, int descriptorSize, int extraSize)\n{\nint threadRaster = thread.y * encoderLength + thread.x;\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nint keypointIndex = int(threadRaster / pixelsPerKeypoint);\nKeypointAddress address = KeypointAddress(\nkeypointIndex * pixelsPerKeypoint,\nthreadRaster % pixelsPerKeypoint\n);\nreturn address;\n}\nKeypoint decodeKeypoint(sampler2D encodedKeypoints, int encoderLength, KeypointAddress address)\n{\nKeypoint keypoint;\nKeypointAddress positionAddress = KeypointAddress(address.base, 0);\nKeypointAddress propertiesAddress = KeypointAddress(address.base, 1);\nvec4 rawEncodedPosition = readKeypointData(encodedKeypoints, encoderLength, positionAddress);\nivec4 encodedPosition = ivec4(rawEncodedPosition * 255.0f);\nkeypoint.position = fixtovec2(fixed2_t(\nencodedPosition.r | (encodedPosition.g << 8),\nencodedPosition.b | (encodedPosition.a << 8)\n));\nvec4 rawEncodedProperties = readKeypointData(encodedKeypoints, encoderLength, propertiesAddress);\nkeypoint.lod = decodeLod(rawEncodedProperties.r);\nkeypoint.orientation = decodeKeypointOrientation(rawEncodedProperties.g);\nkeypoint.score = decodeKeypointScore(rawEncodedProperties.ba);\nbool isNull = all(equal(rawEncodedPosition, vec4(1)));\nbool isDiscarded = all(equal(rawEncodedPosition + rawEncodedProperties, vec4(0)));\nkeypoint.score = (isNull || isDiscarded) ? -1.0f : keypoint.score;\nkeypoint.flags = KPF_NONE;\nkeypoint.flags |= KPF_NULL * uint(isNull);\nkeypoint.flags |= KPF_DISCARDED * uint(isDiscarded);\nreturn keypoint;\n}\nvec4 encodeKeypointPosition(vec2 position)\n{\nconst vec2 zeros = vec2(0.0f);\nfixed2_t pos = vec2tofix(max(position, zeros));\nfixed2_t lo = pos & 255;\nfixed2_t hi = (pos >> 8) & 255;\nreturn vec4(lo.x, hi.x, lo.y, hi.y) / 255.0f;\n}\n#endif'},9010:e=>{e.exports="#ifndef _MATH_GLSL\n#define _MATH_GLSL\n#define TWO_PI          6.28318530718f\n#define PI              3.14159265359f\n#define PI_OVER_2       1.57079632679f\n#define PI_OVER_4       0.78539816339f\n#define INV_PI          0.3183098861837907f\n#define INV_PI_OVER_2   0.15915494309189535f\nconst highp float INFINITY = 1.0f / 0.0f;\nfloat fastAtan(float x)\n{\nfloat w = 1.0f - abs(x);\nreturn (w >= 0.0f) ? ((PI_OVER_4 + 0.273f * w) * x) :\n(sign(x) * PI_OVER_2 - (PI_OVER_4 + 0.273f * (1.0f - abs(1.0f / x))) / x);\n}\nfloat fastAtan2(float y, float x)\n{\nreturn (x == 0.0f) ? PI_OVER_2 * sign(y) : fastAtan(y / x) + float(x < 0.0f) * PI * sign(y);\n}\n#endif"},6433:e=>{e.exports="#ifndef _PYRAMIDS_GLSL\n#define _PYRAMIDS_GLSL\n#define pyrPixel(pyr, lod) textureLod((pyr), texCoord, (lod))\n#define pyrPixelAtOffset(pyr, lod, pot, offset) textureLod((pyr), texCoord + ((pot) * vec2(offset)) / texSize, (lod))\n#define pyrPixelAt(pyr, pos, lod) textureLod((pyr), (vec2(pos) + vec2(0.5f)) / texSize, (lod))\n#define pyrPixelAtEx(pyr, pos, lod, pyrBaseSize) textureLod((pyr), (vec2(pos) + vec2(0.5f)) / vec2(pyrBaseSize), (lod))\n#define pyrSubpixelAtEx(pyr, pos, lod, pyrBaseSize) textureLod((pyr), ((pos) + vec2(0.5f)) / vec2(pyrBaseSize), (lod))\n#define pyrSubpixelAtExOffset(pyr, pos, lod, pot, offset, pyrBaseSize) textureLod((pyr), (((pos) + vec2(0.5f)) + ((pot) * vec2(offset))) / vec2(pyrBaseSize), (lod))\nconst int PYRAMID_MAX_LEVELS = int(@PYRAMID_MAX_LEVELS@);\nconst float F_PYRAMID_MAX_LEVELS = float(@PYRAMID_MAX_LEVELS@);\nconst float LOG2_PYRAMID_MAX_SCALE = float(@LOG2_PYRAMID_MAX_SCALE@);\n#define encodeLod(lod) ((LOG2_PYRAMID_MAX_SCALE + (lod)) / (LOG2_PYRAMID_MAX_SCALE + F_PYRAMID_MAX_LEVELS))\nfloat decodeLod(float encodedLod)\n{\nfloat lod = encodedLod * (LOG2_PYRAMID_MAX_SCALE + F_PYRAMID_MAX_LEVELS) - LOG2_PYRAMID_MAX_SCALE;\nreturn lod - lod * step(1.0f, encodedLod);\n}\n#define LOD_EPS 0.0625f\nconst float ENCODED_LOD_EPS = (LOD_EPS / (LOG2_PYRAMID_MAX_SCALE + F_PYRAMID_MAX_LEVELS));\n#define isSameLod(lod1, lod2) (abs((lod1) - (lod2)) < LOD_EPS)\n#define isSameEncodedLod(alpha1, alpha2) (abs((alpha1) - (alpha2)) < ENCODED_LOD_EPS)\n#endif"},4697:e=>{e.exports="#ifndef _SUBPIXEL_GLSL\n#define _SUBPIXEL_GLSL\n#define subpixelAt(image, pos) textureLod((image), ((pos) + vec2(0.5f)) / texSize, 0.0f)\nvec4 subpixelAtBI(sampler2D image, vec2 pos)\n{\nvec2 frc = fract(pos);\nvec2 ifrc = vec2(1.0f) - frc;\nvec2 p = (floor(pos) + vec2(0.5f)) / vec2(textureSize(image, 0));\nvec4 pix00 = textureLod(image, p, 0.0f);\nvec4 pix10 = textureLodOffset(image, p, 0.0f, ivec2(1,0));\nvec4 pix01 = textureLodOffset(image, p, 0.0f, ivec2(0,1));\nvec4 pix11 = textureLodOffset(image, p, 0.0f, ivec2(1,1));\nmat4 pix = mat4(pix00, pix10, pix01, pix11);\nvec4 mul = vec4(ifrc.x * ifrc.y, frc.x * ifrc.y, ifrc.x * frc.y, frc.x * frc.y);\nreturn pix * mul;\n}\n#endif"},2289:e=>{e.exports='@include "keypoints.glsl"\nuniform sampler2D inputEncodedKeypoints;\nuniform int inputDescriptorSize;\nuniform int inputExtraSize;\nuniform int inputEncoderLength;\nuniform int outputDescriptorSize;\nuniform int outputExtraSize;\nuniform int outputEncoderLength;\nconst vec4 EMPTY_DESCRIPTOR = vec4(0.0f);\nvoid main()\n{\nivec2 thread = threadLocation();\nKeypointAddress myAddress = findKeypointAddress(thread, outputEncoderLength, outputDescriptorSize, outputExtraSize);\nint myIndex = findKeypointIndex(myAddress, outputDescriptorSize, outputExtraSize);\nint headerSize = sizeofEncodedKeypointHeader();\nbool isDescriptor = (myAddress.offset >= (headerSize + outputExtraSize) / 4);\nint addressOffset = myAddress.offset;\nint pixelsPerKeypoint = sizeofEncodedKeypoint(inputDescriptorSize, inputExtraSize) / 4;\nKeypointAddress otherAddress = KeypointAddress(myIndex * pixelsPerKeypoint, addressOffset);\ncolor = isDescriptor ? EMPTY_DESCRIPTOR : readKeypointData(inputEncodedKeypoints, inputEncoderLength, otherAddress);\n}'},5725:e=>{e.exports='@include "keypoints.glsl"\nuniform sampler2D inputEncodedKeypoints;\nuniform int inputDescriptorSize;\nuniform int inputExtraSize;\nuniform int inputEncoderLength;\nuniform int outputDescriptorSize;\nuniform int outputExtraSize;\nuniform int outputEncoderLength;\nvoid main()\n{\nivec2 thread = threadLocation();\nKeypointAddress myAddress = findKeypointAddress(thread, outputEncoderLength, outputDescriptorSize, outputExtraSize);\nint myIndex = findKeypointIndex(myAddress, outputDescriptorSize, outputExtraSize);\nint headerSize = sizeofEncodedKeypointHeader();\nbool isHead = (myAddress.offset < headerSize / 4);\nbool isDescriptor = (myAddress.offset >= (headerSize + outputExtraSize) / 4);\nbool isExtra = (!isHead && !isDescriptor);\nint numberOfExtraPixels = outputExtraSize / 4;\nint addressOffset = myAddress.offset - int(isDescriptor) * numberOfExtraPixels;\nint pixelsPerKeypoint = sizeofEncodedKeypoint(inputDescriptorSize, inputExtraSize) / 4;\nKeypointAddress otherAddress = KeypointAddress(myIndex * pixelsPerKeypoint, addressOffset);\ncolor = isExtra ? vec4(0.0f) : readKeypointData(inputEncodedKeypoints, inputEncoderLength, otherAddress);\n}'},3801:e=>{e.exports='@include "keypoints.glsl"\nuniform mat3 homography;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\nvoid main()\n{\nvec4 pixel = threadPixel(encodedKeypoints);\nivec2 thread = threadLocation();\nKeypointAddress address = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\ncolor = pixel;\nif(address.offset != 0)\nreturn;\nKeypoint keypoint = decodeKeypoint(encodedKeypoints, encoderLength, address);\nif(isBadKeypoint(keypoint))\nreturn;\nvec3 pos3 = homography * vec3(keypoint.position, 1.0f);\ncolor = encodeKeypointPosition(pos3.xy / pos3.z);\n}'},2346:e=>{e.exports='@include "keypoints.glsl"\n@include "keypoint-descriptors.glsl"\n@include "keypoint-matches.glsl"\nuniform sampler2D encodedMatches;\nuniform sampler2D encodedFilters;\nuniform int matcherLength;\nuniform sampler2D dbEncodedKeypoints;\nuniform int dbDescriptorSize;\nuniform int dbExtraSize;\nuniform int dbEncoderLength;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\nuniform int passId;\n#ifndef NUMBER_OF_KEYPOINTS_PER_PASS\n#error Undefined NUMBER_OF_KEYPOINTS_PER_PASS\n#endif\nconst int INFINITE_DISTANCE = MATCH_MAX_DISTANCE + 1;\nvoid main()\n{\nivec2 thread = threadLocation();\nint keypointIndex = thread.x + thread.y * matcherLength;\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nKeypointAddress address = KeypointAddress(keypointIndex * pixelsPerKeypoint, 0);\nKeypoint keypoint = decodeKeypoint(encodedKeypoints, encoderLength, address);\ncolor = encodeKeypointMatch(MATCH_NOT_FOUND);\nif(isBadKeypoint(keypoint))\nreturn;\nKeypointMatch bestMatch = decodeKeypointMatch(threadPixel(encodedMatches));\nKeypointMatch filterMatch = decodeKeypointMatch(threadPixel(encodedFilters));\nuint[DESCRIPTOR_SIZE] descriptor = readKeypointDescriptor(encodedKeypoints, descriptorSize, extraSize, encoderLength, address);\nuint[DESCRIPTOR_SIZE] dbDescriptor;\nint dbPixelsPerKeypoint = sizeofEncodedKeypoint(dbDescriptorSize, dbExtraSize) / 4;\nfor(int i = 0; i < NUMBER_OF_KEYPOINTS_PER_PASS; i++) {\nint dbKeypointIndex = passId * NUMBER_OF_KEYPOINTS_PER_PASS + i;\nKeypointAddress dbAddress = KeypointAddress(dbKeypointIndex * dbPixelsPerKeypoint, 0);\nKeypoint dbKeypoint = decodeKeypoint(dbEncodedKeypoints, dbEncoderLength, dbAddress);\ndbDescriptor = readKeypointDescriptor(dbEncodedKeypoints, dbDescriptorSize, dbExtraSize, dbEncoderLength, dbAddress);\nint dist = !isBadKeypoint(dbKeypoint) ? distanceBetweenKeypointDescriptors(descriptor, dbDescriptor) : INFINITE_DISTANCE;\nbestMatch.index = all(bvec2(\ndist < bestMatch.dist || (dist == bestMatch.dist && dbKeypointIndex > bestMatch.index),\ndist > filterMatch.dist || (dist == filterMatch.dist && dbKeypointIndex < filterMatch.index)\n)) ? dbKeypointIndex : bestMatch.index;\nbestMatch.dist = dbKeypointIndex == bestMatch.index ? dist : bestMatch.dist;\n}\ncolor = encodeKeypointMatch(bestMatch);\n}'},4180:e=>{e.exports='@include "keypoints.glsl"\nuniform int imageWidth;\nuniform int imageHeight;\nuniform int borderTop;\nuniform int borderRight;\nuniform int borderBottom;\nuniform int borderLeft;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\nvoid main()\n{\nivec2 thread = threadLocation();\nKeypointAddress addr = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nKeypoint keypoint = decodeKeypoint(encodedKeypoints, encoderLength, addr);\nvec2 p = keypoint.position;\nbool withinBorder = any(lessThan(\nvec4(p.x, p.y, -p.x, -p.y),\nvec4(borderLeft, borderTop, borderRight - (imageWidth - 1), borderBottom - (imageHeight - 1))\n));\nvec4 pixel = threadPixel(encodedKeypoints);\nvec4 nullPixel = encodeNullKeypoint();\ncolor = withinBorder ? nullPixel : pixel;\n}'},7771:e=>{e.exports='@include "keypoints.glsl"\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\nuniform int maxKeypoints;\nvoid main()\n{\nivec2 thread = threadLocation();\nint newEncoderLength = outputSize().x;\nKeypointAddress address = findKeypointAddress(thread, newEncoderLength, descriptorSize, extraSize);\nint index = findKeypointIndex(address, descriptorSize, extraSize);\nvec4 pixel = readKeypointData(encodedKeypoints, encoderLength, address);\ncolor = index < maxKeypoints ? pixel : encodeNullKeypoint();\n}'},8938:e=>{e.exports='@include "keypoints.glsl"\nuniform sampler2D encodedKeypointsA;\nuniform int encoderLengthA;\nuniform sampler2D encodedKeypointsB;\nuniform int encoderLengthB;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\nuniform float threshold;\nvoid main()\n{\nivec2 thread = threadLocation();\nKeypointAddress address = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nint index = findKeypointIndex(address, descriptorSize, extraSize);\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nvec4 data = readKeypointData(encodedKeypointsA, encoderLengthA, address);\ncolor = data;\nif(address.offset >= sizeofEncodedKeypointHeader() / 4)\nreturn;\nKeypoint keypointA = decodeKeypoint(encodedKeypointsA, encoderLengthA, address);\nKeypoint keypointB = decodeKeypoint(encodedKeypointsB, encoderLengthB, address);\ncolor = encodeNullKeypoint();\nif(isNullKeypoint(keypointA) && isNullKeypoint(keypointB))\nreturn;\ncolor = encodeDiscardedKeypoint();\nif(isDiscardedKeypoint(keypointA) || isDiscardedKeypoint(keypointB))\nreturn;\ncolor = encodeDiscardedKeypoint();\nif(isNullKeypoint(keypointA) || isNullKeypoint(keypointB))\nreturn;\nvec2 delta = keypointA.position - keypointB.position;\nbool shouldKeep = (dot(delta, delta) <= threshold * threshold);\ncolor = shouldKeep ? data : encodeDiscardedKeypoint();\n}'},4802:e=>{e.exports='@include "float16.glsl"\nuniform sampler2D offsetsImage;\nuniform ivec2 imageSize;\n#ifndef MAX_ITERATIONS\n#error Undefined MAX_ITERATIONS\n#endif\n#define decodeSkipOffset(pixel) (int((pixel).g * 255.0f) | (int((pixel).a * 255.0f) << 8))\n#define encodeSkipOffset(offset) (vec2((offset) & 255, (offset) >> 8) / 255.0f)\nvoid main()\n{\nvec4 pixel = threadPixel(offsetsImage);\nivec2 thread = threadLocation();\nint rasterIndex = thread.y * imageSize.x + thread.x;\nint offset = decodeSkipOffset(pixel);\nint totalOffset = offset;\nvec2 encodedScore = pixel.rb;\nivec2 pos = thread; int allow = 1;\n@unroll\nfor(int i = 0; i < MAX_ITERATIONS; i++) {\nallow *= int(pos.y < imageSize.y) * int(isEncodedFloat16Zero(pixel.rb));\nrasterIndex += allow * offset;\npos = ivec2(rasterIndex % imageSize.x, rasterIndex / imageSize.x);\npixel = pixelAt(offsetsImage, pos);\noffset = decodeSkipOffset(pixel);\ntotalOffset += allow * offset;\n}\ntotalOffset = min(totalOffset, 65535);\ncolor.rb = encodedScore;\ncolor.ga = encodeSkipOffset(totalOffset);\n}'},6253:e=>{e.exports='@include "float16.glsl"\nuniform sampler2D corners;\nuniform ivec2 imageSize;\nvoid main()\n{\nvec4 pixel = threadPixel(corners);\nivec2 pos = threadLocation();\nvec2 encodedScore = pixel.rb;\nint offset = 0, allow = 1, jumped = 0;\n#define READ(j) ; \\\nallow *= int(pos.y < imageSize.y) * int(isEncodedFloat16Zero(pixel.rb)); \\\noffset += allow; \\\npos.x = (pos.x + 1) % imageSize.x; \\\npos.y += int(pos.x == 0); \\\npixel = (0 != (jumped |= int(pos.x == 0))) ? pixelAtShortOffset(corners, ivec2((j),1)) : pixelAtShortOffset(corners, ivec2((j),0))\nREAD(1); READ(2); READ(3); READ(4); READ(5); READ(6); READ(7);\ncolor.rb = encodedScore;\ncolor.ga = vec2(offset, 0) / 255.0f;\n}'},384:e=>{e.exports='@include "keypoints.glsl"\nuniform sampler2D offsetsImage;\nuniform ivec2 imageSize;\nuniform int passId;\nuniform int numPasses;\nuniform int keypointLimit;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\n#define decodeSkipOffset(pixel) (int((pixel).g * 255.0f) | (int((pixel).a * 255.0f) << 8))\nbool findQthKeypoint(int q, int p, inout ivec2 position, out vec4 pixel)\n{\nint notFirstPass = int(passId > 0);\nposition *= notFirstPass;\np |= -(1 - notFirstPass);\np -= notFirstPass;\nint rasterIndex = position.y * imageSize.x + position.x;\nwhile(position.y < imageSize.y && p != q) {\nposition = ivec2(rasterIndex % imageSize.x, rasterIndex / imageSize.x);\npixel = texelFetch(offsetsImage, position, 0);\np += int(!isEncodedFloat16Zero(pixel.rb));\nrasterIndex += max(1, decodeSkipOffset(pixel));\n}\nreturn (p == q);\n}\nvoid main()\n{\nivec2 thread = threadLocation();\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nKeypointAddress address = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nint q = findKeypointIndex(address, descriptorSize, extraSize);\ncolor = vec4(0.0f);\nif(address.offset != 0)\nreturn;\ncolor = threadPixel(encodedKeypoints);\nint numPixels = encoderLength * encoderLength;\nint maxKeypoints = numPixels / pixelsPerKeypoint;\nint maxKeypointsPerPass = maxKeypoints / numPasses + int(maxKeypoints % numPasses != 0);\nint targetPassId = q / maxKeypointsPerPass;\nif(passId != targetPassId)\nreturn;\nint lastIndexFromPrevPass = passId * maxKeypointsPerPass - 1;\nKeypointAddress lastAddressFromPrevPass = KeypointAddress(max(0, lastIndexFromPrevPass) * pixelsPerKeypoint, 0);\nKeypoint lastKeypointFromPrevPass = decodeKeypoint(encodedKeypoints, encoderLength, lastAddressFromPrevPass);\nivec2 position = passId > 0 ? ivec2(lastKeypointFromPrevPass.position) : ivec2(0);\nvec4 pixel;\ncolor = encodeNullKeypoint();\nif(q >= min(maxKeypoints, keypointLimit) || !findQthKeypoint(q, lastIndexFromPrevPass, position, pixel))\nreturn;\ncolor = encodeKeypointPosition(vec2(position));\n}'},500:e=>{e.exports='@include "keypoints.glsl"\nuniform sampler2D corners;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\nvoid main()\n{\nivec2 thread = threadLocation();\nvec4 pixel = threadPixel(encodedKeypoints);\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nKeypointAddress address = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nint q = findKeypointIndex(address, descriptorSize, extraSize);\ncolor = pixel;\nif(address.offset != 1)\nreturn;\nKeypoint keypoint = decodeKeypoint(encodedKeypoints, encoderLength, address);\nvec4 kpix = pixelAt(corners, ivec2(keypoint.position));\nkeypoint.score = decodeFloat16(kpix.rb);\ncolor.r = kpix.a;\ncolor.g = encodeKeypointOrientation(0.0f);\ncolor.ba = encodeKeypointScore(keypoint.score);\n}'},3673:e=>{e.exports='@include "keypoints.glsl"\nuniform sampler2D corners;\nuniform mediump usampler2D lookupTable;\nuniform int stride;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\nuniform int encoderCapacity;\nconst uvec2 NULL_ELEMENT = uvec2(0xFFFFu);\nvoid main()\n{\nivec2 thread = threadLocation();\nKeypointAddress address = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nint index = findKeypointIndex(address, descriptorSize, extraSize);\nivec2 pos = ivec2(index % stride, index / stride);\nuvec4 entry = texelFetch(lookupTable, pos, 0);\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nint rasterIndex = address.base + address.offset;\nint numberOfPixels = encoderLength * encoderLength;\nint numberOfValidPixels = numberOfPixels - (numberOfPixels % pixelsPerKeypoint);\nint maxEncoderCapacity = numberOfValidPixels / pixelsPerKeypoint;\ncolor = encodeNullKeypoint();\nif(all(equal(entry.xy, NULL_ELEMENT)) || index >= min(encoderCapacity, maxEncoderCapacity))\nreturn;\ncolor = encodeKeypointPosition(vec2(entry.xy));\nif(address.offset == 0)\nreturn;\ncolor = vec4(0.0f);\nif(address.offset >= sizeofEncodedKeypointHeader() / 4)\nreturn;\nvec4 pixel = texelFetch(corners, ivec2(entry.xy), 0);\nvec2 encodedScore = encodeKeypointScore(decodeFloat16(pixel.rb));\nfloat encodedOrientation = encodeKeypointOrientation(0.0f);\nfloat encodedLod = pixel.a;\ncolor = vec4(encodedLod, encodedOrientation, encodedScore);\n}'},1703:e=>{e.exports='@include "keypoints.glsl"\nvoid main()\n{\ncolor = encodeNullKeypoint();\n}'},2633:e=>{e.exports='@include "pyramids.glsl"\n@include "float16.glsl"\nuniform sampler2D corners;\nuniform sampler2D pyramid;\nuniform float lod;\nuniform int threshold;\n#define USE_VARYINGS 1\n#if !defined(FAST_TYPE)\n#error Undefined FAST_TYPE\n#elif FAST_TYPE == 916\nin vec2 v_pix0, v_pix1, v_pix2, v_pix3, v_pix4, v_pix5, v_pix6, v_pix7,\nv_pix8, v_pix9, v_pix10,v_pix11,v_pix12,v_pix13,v_pix14,v_pix15;\n#else\n#error Invalid FAST_TYPE\n#endif\n#define PIX(x,y) pyrPixelAtOffset(pyramid, lod, pot, ivec2((x),(y))).g\n#define XIP(v) textureLod(pyramid, (v), lod).g\nvoid main()\n{\nfloat pixel = threadPixel(pyramid).g;\nvec4 prev = threadPixel(corners);\nivec2 thread = threadLocation();\nivec2 size = outputSize();\nfloat pot = exp2(lod);\nfloat t = float(clamp(threshold, 0, 255)) / 255.0f;\nfloat ct = pixel + t, c_t = pixel - t;\ncolor = vec4(prev.r, pixel, prev.ba);\n#if FAST_TYPE == 916\nconst ivec4 margin = ivec4(3, 3, 4, 4);\nif(any(lessThan(ivec4(thread, size - thread), margin)))\nreturn;\n#if USE_VARYINGS\nfloat p0 = XIP(v_pix0), p4 = XIP(v_pix4), p8 = XIP(v_pix8), p12 = XIP(v_pix12);\n#else\nfloat p0 = PIX(0,3), p4 = PIX(3,0), p8 = PIX(0,-3), p12 = PIX(-3,0);\n#endif\nbvec4 brighter = bvec4(p0 > ct, p4 > ct, p8 > ct, p12 > ct);\nbvec4 darker = bvec4(p0 < c_t, p4 < c_t, p8 < c_t, p12 < c_t);\nbvec4 bpairs = bvec4(all(brighter.xy), all(brighter.yz), all(brighter.zw), all(brighter.wx));\nbvec4 dpairs = bvec4(all(darker.xy), all(darker.yz), all(darker.zw), all(darker.wx));\nif(!(any(bpairs) || any(dpairs)))\nreturn;\n#if USE_VARYINGS\nfloat p1 = XIP(v_pix1), p2 = XIP(v_pix2), p3 = XIP(v_pix3),\np5 = XIP(v_pix5), p6 = XIP(v_pix6), p7 = XIP(v_pix7),\np9 = XIP(v_pix9), p10 = XIP(v_pix10), p11 = XIP(v_pix11),\np13 = XIP(v_pix13), p14 = XIP(v_pix14), p15 = XIP(v_pix15);\n#else\nfloat p1 = PIX(1,3), p2 = PIX(2,2), p3 = PIX(3,1),\np5 = PIX(3,-1), p6 = PIX(2,-2), p7 = PIX(1,-3),\np9 = PIX(-1,-3), p10 = PIX(-2,-2), p11 = PIX(-3,-1),\np13 = PIX(-3,1), p14 = PIX(-2,2), p15 = PIX(-1,3);\n#endif\nbool A=(p0>ct),B=(p1>ct),C=(p2>ct),D=(p3>ct),E=(p4>ct),F=(p5>ct),G=(p6>ct),H=(p7>ct),I=(p8>ct),J=(p9>ct),K=(p10>ct),L=(p11>ct),M=(p12>ct),N=(p13>ct),O=(p14>ct),P=(p15>ct),a=(p0<c_t),b=(p1<c_t),c=(p2<c_t),d=(p3<c_t),e=(p4<c_t),f=(p5<c_t),g=(p6<c_t),h=(p7<c_t),i=(p8<c_t),j=(p9<c_t),k=(p10<c_t),l=(p11<c_t),m=(p12<c_t),n=(p13<c_t),o=(p14<c_t),p=(p15<c_t);\nbool isCorner=A&&(B&&(K&&L&&J&&(M&&N&&O&&P||G&&H&&I&&(M&&N&&O||F&&(M&&N||E&&(M||D))))||C&&(K&&L&&M&&(N&&O&&P||G&&H&&I&&J&&(N&&O||F&&(N||E)))||D&&(N&&(L&&M&&(K&&G&&H&&I&&J&&(O||F)||O&&P)||k&&l&&m&&e&&f&&g&&h&&i&&j)||E&&(O&&(M&&N&&(K&&L&&G&&H&&I&&J||P)||k&&l&&m&&n&&f&&g&&h&&i&&j)||F&&(P&&(N&&O||k&&l&&m&&n&&o&&g&&h&&i&&j)||G&&(O&&P||H&&(P||I)||k&&l&&m&&n&&o&&p&&h&&i&&j)||k&&l&&m&&n&&o&&h&&i&&j&&(p||g))||k&&l&&m&&n&&h&&i&&j&&(o&&(p||g)||f&&(o&&p||g)))||k&&l&&m&&h&&i&&j&&(n&&(o&&p||g&&(o||f))||e&&(n&&o&&p||g&&(n&&o||f))))||k&&l&&h&&i&&j&&(m&&(n&&o&&p||g&&(n&&o||f&&(n||e)))||d&&(m&&n&&o&&p||g&&(m&&n&&o||f&&(m&&n||e)))))||k&&h&&i&&j&&(l&&(m&&n&&o&&p||g&&(m&&n&&o||f&&(m&&n||e&&(m||d))))||c&&(l&&m&&n&&o&&p||g&&(l&&m&&n&&o||f&&(l&&m&&n||e&&(l&&m||d))))))||K&&I&&J&&(L&&M&&N&&O&&P||G&&H&&(L&&M&&N&&O||F&&(L&&M&&N||E&&(L&&M||D&&(L||C)))))||h&&i&&j&&(b&&(k&&l&&m&&n&&o&&p||g&&(k&&l&&m&&n&&o||f&&(k&&l&&m&&n||e&&(k&&l&&m||d&&(k&&l||c)))))||k&&(l&&m&&n&&o&&p||g&&(l&&m&&n&&o||f&&(l&&m&&n||e&&(l&&m||d&&(l||c)))))))||B&&(H&&I&&J&&(K&&L&&M&&N&&O&&P&&a||G&&(K&&L&&M&&N&&O&&a||F&&(K&&L&&M&&N&&a||E&&(K&&L&&M&&a||D&&(K&&L&&a||C)))))||a&&k&&i&&j&&(l&&m&&n&&o&&p||g&&h&&(l&&m&&n&&o||f&&(l&&m&&n||e&&(l&&m||d&&(l||c))))))||C&&(K&&H&&I&&J&&(L&&M&&N&&O&&P&&a&&b||G&&(L&&M&&N&&O&&a&&b||F&&(L&&M&&N&&a&&b||E&&(L&&M&&a&&b||D))))||a&&b&&k&&l&&j&&(m&&n&&o&&p||g&&h&&i&&(m&&n&&o||f&&(m&&n||e&&(m||d)))))||D&&(K&&L&&H&&I&&J&&(M&&N&&O&&P&&a&&b&&c||G&&(M&&N&&O&&a&&b&&c||F&&(M&&N&&a&&b&&c||E)))||a&&b&&k&&l&&m&&c&&(n&&o&&p||g&&h&&i&&j&&(n&&o||f&&(n||e))))||E&&(K&&L&&M&&H&&I&&J&&(N&&O&&P&&a&&b&&c&&d||G&&(N&&O&&a&&b&&c&&d||F))||a&&b&&l&&m&&n&&c&&d&&(k&&g&&h&&i&&j&&(o||f)||o&&p))||F&&(K&&L&&M&&N&&H&&I&&J&&(O&&P&&a&&b&&c&&d&&e||G)||a&&b&&m&&n&&o&&c&&d&&e&&(k&&l&&g&&h&&i&&j||p))||G&&(K&&L&&M&&N&&O&&H&&I&&J||a&&b&&n&&o&&p&&c&&d&&e&&f)||H&&(K&&L&&M&&N&&O&&P&&I&&J||a&&b&&o&&p&&c&&d&&e&&f&&g)||a&&(b&&(k&&l&&j&&(m&&n&&o&&p||g&&h&&i&&(m&&n&&o||f&&(m&&n||e&&(m||d))))||c&&(k&&l&&m&&(n&&o&&p||g&&h&&i&&j&&(n&&o||f&&(n||e)))||d&&(l&&m&&n&&(k&&g&&h&&i&&j&&(o||f)||o&&p)||e&&(m&&n&&o&&(k&&l&&g&&h&&i&&j||p)||f&&(n&&o&&p||g&&(o&&p||h&&(p||i)))))))||k&&i&&j&&(l&&m&&n&&o&&p||g&&h&&(l&&m&&n&&o||f&&(l&&m&&n||e&&(l&&m||d&&(l||c))))))||h&&i&&j&&(k&&l&&m&&n&&o&&p||g&&(k&&l&&m&&n&&o||f&&(k&&l&&m&&n||e&&(k&&l&&m||d&&(k&&l||c&&(b||k))))));\nif(!isCorner)\nreturn;\nmat4 mp = mat4(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15);\nmat4 mct = mp - mat4(ct,ct,ct,ct,ct,ct,ct,ct,ct,ct,ct,ct,ct,ct,ct,ct);\nmat4 mc_t = mat4(c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t) - mp;\nconst vec4 zeros = vec4(0.0f), ones = vec4(1.0f);\nvec4 bs = max(mct[0], zeros), ds = max(mc_t[0], zeros);\nbs += max(mct[1], zeros);     ds += max(mc_t[1], zeros);\nbs += max(mct[2], zeros);     ds += max(mc_t[2], zeros);\nbs += max(mct[3], zeros);     ds += max(mc_t[3], zeros);\nfloat thisScore = max(dot(bs, ones), dot(ds, ones)) / 16.0f;\nfloat prevScore = decodeFloat16(prev.rb);\nvec3 thisResult = vec3(encodeFloat16(thisScore), encodeLod(lod));\ncolor.rba = thisScore > prevScore ? thisResult : color.rba;\n#endif\n}'},535:e=>{e.exports="uniform mediump float lod;\n#if !defined(FAST_TYPE)\n#error Undefined FAST_TYPE\n#elif FAST_TYPE == 916\nout vec2 v_pix0, v_pix1, v_pix2, v_pix3, v_pix4, v_pix5, v_pix6, v_pix7,\nv_pix8, v_pix9, v_pix10,v_pix11,v_pix12,v_pix13,v_pix14,v_pix15;\n#else\n#error Invalid FAST_TYPE\n#endif\n#define PIX(x,y) (texCoord + ((pot) * vec2((x),(y))) / texSize)\nvoid vsmain()\n{\nfloat pot = exp2(lod);\n#if FAST_TYPE == 916\nv_pix0 = PIX(0,3); v_pix1 = PIX(1,3), v_pix2 = PIX(2,2), v_pix3 = PIX(3,1);\nv_pix4 = PIX(3,0); v_pix5 = PIX(3,-1), v_pix6 = PIX(2,-2), v_pix7 = PIX(1,-3);\nv_pix8 = PIX(0,-3); v_pix9 = PIX(-1,-3), v_pix10 = PIX(-2,-2), v_pix11 = PIX(-3,-1);\nv_pix12 = PIX(-3,0); v_pix13 = PIX(-3,1), v_pix14 = PIX(-2,2), v_pix15 = PIX(-1,3);\n#endif\n}"},3232:e=>{e.exports='@include "keypoints.glsl"\n@include "keypoint-descriptors.glsl"\nuniform sampler2D encodedKeypointsA;\nuniform int encoderLengthA;\nuniform sampler2D encodedKeypointsB;\nuniform int encoderLengthB;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\nuniform int threshold;\nvoid main()\n{\nivec2 thread = threadLocation();\nKeypointAddress address = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nint index = findKeypointIndex(address, descriptorSize, extraSize);\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nvec4 data = readKeypointData(encodedKeypointsA, encoderLengthA, address);\ncolor = data;\nif(address.offset >= sizeofEncodedKeypointHeader() / 4)\nreturn;\nKeypoint keypointA = decodeKeypoint(encodedKeypointsA, encoderLengthA, address);\nKeypoint keypointB = decodeKeypoint(encodedKeypointsB, encoderLengthB, address);\ncolor = encodeNullKeypoint();\nif(isNullKeypoint(keypointA) && isNullKeypoint(keypointB))\nreturn;\ncolor = encodeDiscardedKeypoint();\nif(isDiscardedKeypoint(keypointA) || isDiscardedKeypoint(keypointB))\nreturn;\ncolor = encodeDiscardedKeypoint();\nif(isNullKeypoint(keypointA) || isNullKeypoint(keypointB))\nreturn;\nuint[DESCRIPTOR_SIZE] descriptorA, descriptorB;\ndescriptorA = readKeypointDescriptor(encodedKeypointsA, descriptorSize, extraSize, encoderLengthA, address);\ndescriptorB = readKeypointDescriptor(encodedKeypointsB, descriptorSize, extraSize, encoderLengthB, address);\nint dist = distanceBetweenKeypointDescriptors(descriptorA, descriptorB);\nbool shouldKeep = (dist <= threshold);\ncolor = shouldKeep ? data : encodeDiscardedKeypoint();\n}'},8356:e=>{e.exports='@include "float16.glsl"\nuniform sampler2D corners;\nuniform sampler2D maxScore;\nuniform float quality;\nvoid main()\n{\nvec4 pixel = threadPixel(corners);\nfloat score = decodeFloat16(pixel.rb);\nfloat maxval = decodeFloat16(threadPixel(maxScore).rb);\nfloat threshold = maxval * clamp(quality, 0.0f, 1.0f);\ncolor = pixel;\ncolor.rb = score >= threshold ? color.rb : encodeFloat16(0.0f);\n}'},7339:e=>{e.exports='@include "pyramids.glsl"\n@include "float16.glsl"\n@include "filters.glsl"\n#if !defined(WINDOW_SIZE)\n#error Undefined WINDOW_SIZE\n#endif\n#define WINDOW_RADIUS ((WINDOW_SIZE - 1) / 2)\nuniform sampler2D corners;\nuniform sampler2D pyramid;\nuniform sampler2D derivatives;\nuniform float lod;\nuniform float lodStep;\nuniform float gaussian[@WINDOW_SIZE@];\n#define G(x) gaussian[(x) + WINDOW_RADIUS]\n#define W(x,y) (G(x) * G(y))\n#define H(ox,oy) dpix = pixelAtShortOffset(derivatives, ivec2((ox),(oy))); \\\ndf = (1.0f + lod) * decodePairOfFloat16(dpix); \\\nh += vec3(df.x * df.x, df.x * df.y, df.y * df.y) * W((ox),(oy))\nvoid main()\n{\nfloat intensity = 0.0f;\nivec2 thread = threadLocation();\nvec4 pixel = threadPixel(corners);\nvec4 dpix = vec4(0.0f);\nvec2 df = vec2(0.0f);\nvec3 h = vec3(0.0f);\ncolor = pixel;\n#if WINDOW_SIZE == 1\nH(0,0);\n#elif WINDOW_SIZE == 3\nH(-1,-1); H(0,-1); H(1,-1);\nH(-1,0); H(0,0); H(1,0);\nH(-1,1); H(0,1); H(1,1);\n#elif WINDOW_SIZE == 5\nH(-2,-2); H(-1,-2); H(0,-2); H(1,-2); H(2,-2);\nH(-2,-1); H(-1,-1); H(0,-1); H(1,-1); H(2,-1);\nH(-2,0); H(-1,0); H(0,0); H(1,0); H(2,0);\nH(-2,1); H(-1,1); H(0,1); H(1,1); H(2,1);\nH(-2,2); H(-1,2); H(0,2); H(1,2); H(2,2);\n#elif WINDOW_SIZE == 7\nH(-3,-3); H(-2,-3); H(-1,-3); H(0,-3); H(1,-3); H(2,-3); H(3,-3);\nH(-3,-2); H(-2,-2); H(-1,-2); H(0,-2); H(1,-2); H(2,-2); H(3,-2);\nH(-3,-1); H(-2,-1); H(-1,-1); H(0,-1); H(1,-1); H(2,-1); H(3,-1);\nH(-3,0); H(-2,0); H(-1,0); H(0,0); H(1,0); H(2,0); H(3,0);\nH(-3,1); H(-2,1); H(-1,1); H(0,1); H(1,1); H(2,1); H(3,1);\nH(-3,2); H(-2,2); H(-1,2); H(0,2); H(1,2); H(2,2); H(3,2);\nH(-3,3); H(-2,3); H(-1,3); H(0,3); H(1,3); H(2,3); H(3,3);\n#else\n#error Invalid WINDOW_SIZE\n#endif\nfloat response = 0.5f * (h.x + h.z - sqrt((h.x - h.z) * (h.x - h.z) + 4.0f * h.y * h.y));\nresponse /= float(WINDOW_SIZE * WINDOW_SIZE);\nfloat lodPlus = min(float(PYRAMID_MAX_LEVELS - 1), lod + lodStep);\nfloat currentScaleStrength = abs(laplacian(pyramid, vec2(thread), lod));\nfloat previousScaleStrength = abs(laplacian(pyramid, vec2(thread), lodPlus));\nfloat previousResponse = decodeFloat16(pixel.rb);\nvec4 result = vec4(encodeFloat16(response), encodeLod(lod), intensity);\ncolor.rbag = (currentScaleStrength >= previousScaleStrength || previousResponse == 0.0f) ? result : pixel.rbag;\n}'},3177:e=>{e.exports='@include "keypoint-matches.glsl"\nvoid main()\n{\n#if ENCODE_FILTERS != 0\nKeypointMatch initial = KeypointMatch(MATCH_MAX_INDEX, 0);\n#else\nKeypointMatch initial = KeypointMatch(MATCH_MAX_INDEX, MATCH_MAX_DISTANCE);\n#endif\ncolor = encodeKeypointMatch(initial);\n}'},2769:e=>{e.exports='@include "keypoint-matches.glsl"\nuniform sampler2D encodedMatches;\nuniform sampler2D encodedKthMatches;\nuniform int numberOfMatchesPerKeypoint;\nuniform int kthMatch;\nvoid main()\n{\nivec2 thread = threadLocation();\nivec2 matcherSize = textureSize(encodedMatches, 0);\nivec2 kthMatcherSize = textureSize(encodedKthMatches, 0);\nint rasterIndex = thread.y * matcherSize.x + thread.x;\nint matchIndex = rasterIndex / numberOfMatchesPerKeypoint;\nint matchCell = rasterIndex % numberOfMatchesPerKeypoint;\ncolor = threadPixel(encodedMatches);\nif(matchCell != kthMatch)\nreturn;\ncolor = encodeKeypointMatch(MATCH_NOT_FOUND);\nif(matchIndex >= kthMatcherSize.x * kthMatcherSize.y)\nreturn;\nivec2 pos = ivec2(matchIndex % kthMatcherSize.x, matchIndex / kthMatcherSize.x);\ncolor = texelFetch(encodedKthMatches, pos, 0);\n}'},2006:e=>{e.exports='@include "pyramids.glsl"\n@include "float16.glsl"\n@include "filters.glsl"\nuniform sampler2D corners;\nuniform sampler2D pyramid;\nuniform float lodStep;\nuniform float lodOffset;\nvoid main()\n{\nivec2 thread = threadLocation();\nvec4 pixel = threadPixel(corners);\nfloat lod = decodeLod(pixel.a);\nfloat lodMinus = max(0.0f, lod - lodStep + lodOffset);\nfloat lodPlus = min(float(PYRAMID_MAX_LEVELS - 1), lod + lodStep + lodOffset);\nfloat lapMinus = laplacian(pyramid, vec2(thread), lodMinus);\nfloat lapPlus = abs(lodPlus - lodMinus) < 1e-5 ? lapMinus : laplacian(pyramid, vec2(thread), lodPlus);\ncolor = encodePairOfFloat16(vec2(lapMinus, lapPlus));\n}'},3329:e=>{e.exports='@include "keypoints.glsl"\n@include "float16.glsl"\nuniform sampler2D nextPyramid;\nuniform sampler2D prevPyramid;\nuniform sampler2D encodedFlow;\nuniform sampler2D prevKeypoints;\nuniform int level;\nuniform int depth;\nuniform int numberOfIterations;\nuniform float discardThreshold;\nuniform float epsilon;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\n#ifndef WINDOW_SIZE\n#error Undefined WINDOW_SIZE\n#endif\n#define NEXT_IMAGE 1\n#define PREV_IMAGE 0\nconst int WINDOW_RADIUS = (WINDOW_SIZE - 1) / 2;\nconst int WINDOW_SIZE_SQUARED = (WINDOW_SIZE) * (WINDOW_SIZE);\nconst int WINDOW_SIZE_PLUS = (WINDOW_SIZE) + 2;\nconst int WINDOW_SIZE_PLUS_SQUARED = WINDOW_SIZE_PLUS * WINDOW_SIZE_PLUS;\nconst int DBL_WINDOW_SIZE_PLUS_SQUARED = 2 * WINDOW_SIZE_PLUS_SQUARED;\nconst int WINDOW_RADIUS_PLUS = (WINDOW_SIZE_PLUS - 1) / 2;\nconst highp float FLT_SCALE = 9.5367431640625e-7;\nconst highp float FLT_EPSILON = 0.00000011920929f;\nint pixelBuffer[DBL_WINDOW_SIZE_PLUS_SQUARED];\n#define prevPixel(index) pixelBuffer[(index)]\n#define nextPixel(index) pixelBuffer[WINDOW_SIZE_PLUS_SQUARED + (index)]\n#define pixelIndex(i, j) (((j) + WINDOW_RADIUS_PLUS) * WINDOW_SIZE_PLUS + ((i) + WINDOW_RADIUS_PLUS))\nivec2 derivBuffer[WINDOW_SIZE_SQUARED];\n#define derivativesAt(x, y) derivBuffer[((y) + WINDOW_RADIUS) * WINDOW_SIZE + ((x) + WINDOW_RADIUS)]\nvoid readWindow(vec2 center, float lod)\n{\nconst int r = WINDOW_RADIUS;\nivec2 pyrBaseSize = textureSize(prevPyramid, 0);\nfloat pot = exp2(lod);\nivec2 offset; int idx;\n#define readPixelsAt(ox, oy) offset = ivec2((ox), (oy)); \\\nidx = pixelIndex(offset.x, offset.y); \\\nnextPixel(idx) = int(255.0f * pyrSubpixelAtExOffset(nextPyramid, center, lod, pot, offset, pyrBaseSize).g); \\\nprevPixel(idx) = int(255.0f * pyrSubpixelAtExOffset(prevPyramid, center, lod, pot, offset, pyrBaseSize).g)\nfor(int j = 0; j < WINDOW_SIZE; j++) {\nfor(int i = 0; i < WINDOW_SIZE; i++) {\nreadPixelsAt(i-r, j-r);\n}\n}\nint r1 = r+1;\nfor(int k = 0; k < WINDOW_SIZE; k++) {\nreadPixelsAt(-r1, k-r);\nreadPixelsAt( r1, k-r);\nreadPixelsAt(k-r,-r1);\nreadPixelsAt(k-r, r1);\n}\nreadPixelsAt(-r1,-r1);\nreadPixelsAt( r1,-r1);\nreadPixelsAt(-r1, r1);\nreadPixelsAt( r1, r1);\n}\nivec2 computeDerivatives(int imageCode, ivec2 offset)\n{\nconst mat3 dx = mat3(\n3, 0, -3,\n10, 0, -10,\n3, 0, -3\n);\nconst mat3 dy = mat3(\n3, 10, 3,\n0, 0, 0,\n-3, -10, -3\n);\nint indexOffset = imageCode * WINDOW_SIZE_PLUS_SQUARED;\nmat3 window = mat3(\npixelBuffer[indexOffset + pixelIndex(offset.x-1, offset.y-1)],\npixelBuffer[indexOffset + pixelIndex(offset.x+0, offset.y-1)],\npixelBuffer[indexOffset + pixelIndex(offset.x+1, offset.y-1)],\npixelBuffer[indexOffset + pixelIndex(offset.x-1, offset.y+0)],\n0.0f,\npixelBuffer[indexOffset + pixelIndex(offset.x+1, offset.y+0)],\npixelBuffer[indexOffset + pixelIndex(offset.x-1, offset.y+1)],\npixelBuffer[indexOffset + pixelIndex(offset.x+0, offset.y+1)],\npixelBuffer[indexOffset + pixelIndex(offset.x+1, offset.y+1)]\n);\nmat3 fx = matrixCompMult(dx, window);\nmat3 fy = matrixCompMult(dy, window);\nconst vec3 ones = vec3(1.0f);\nreturn ivec2(\ndot(fx[0], ones) + dot(fx[1], ones) + dot(fx[2], ones),\ndot(fy[0], ones) + dot(fy[1], ones) + dot(fy[2], ones)\n);\n}\nint readBufferedPixel(int imageCode, ivec2 offset)\n{\nconst int r = WINDOW_RADIUS;\noffset = clamp(offset, -r, r);\nint indexOffset = imageCode * WINDOW_SIZE_PLUS_SQUARED;\nreturn pixelBuffer[indexOffset + pixelIndex(offset.x, offset.y)];\n}\nint readBufferedSubpixel(int imageCode, vec2 offset)\n{\nivec2 p = ivec2(floor(offset));\nvec2 frc = fract(offset);\nvec2 ifrc = vec2(1.0f) - frc;\nvec4 pix = vec4(\nreadBufferedPixel(imageCode, p),\nreadBufferedPixel(imageCode, p + ivec2(1,0)),\nreadBufferedPixel(imageCode, p + ivec2(0,1)),\nreadBufferedPixel(imageCode, p + ivec2(1,1))\n);\nvec4 sub = vec4(\nifrc.x * ifrc.y,\nfrc.x * ifrc.y,\nifrc.x * frc.y,\nfrc.x * frc.y\n);\nreturn int(0.5f + dot(sub*pix, vec4(1.0f)));\n}\nvec2 computeMismatch(vec2 pyrGuess, vec2 localGuess)\n{\nconst int r = WINDOW_RADIUS;\nint timeDerivative;\nivec2 mismatch = ivec2(0);\nint x, y, _x, _y;\nvec2 d = pyrGuess + localGuess;\n#define innerLoop() \\\nfor(_x = 0; _x < WINDOW_SIZE; _x++) { \\\nx = _x - r; y = _y - r; \\\ntimeDerivative = ( \\\nreadBufferedSubpixel(NEXT_IMAGE, vec2(x, y) + d) - \\\nreadBufferedPixel(PREV_IMAGE, ivec2(x, y)) \\\n); \\\nmismatch += derivativesAt(x, y) * timeDerivative; \\\n}\n@unroll\nfor(_y = 0; _y < WINDOW_SIZE; _y++) {\ninnerLoop();\n}\nreturn vec2(mismatch) * FLT_SCALE;\n}\nbool isInsideImage(vec2 position)\n{\nvec2 imageSize = vec2(textureSize(nextPyramid, 0));\nvec2 border = vec2(WINDOW_SIZE);\nreturn all(bvec4(\ngreaterThanEqual(position, border),\nlessThan(position, imageSize - border)\n));\n}\nvoid main()\n{\nvec4 pixel = threadPixel(encodedFlow);\nivec2 thread = threadLocation();\nfloat windowArea = float(WINDOW_SIZE * WINDOW_SIZE);\nconst int r = WINDOW_RADIUS;\nint keypointIndex = thread.x + thread.y * outputSize().x;\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nKeypointAddress address = KeypointAddress(keypointIndex * pixelsPerKeypoint, 0);\nKeypoint keypoint = decodeKeypoint(prevKeypoints, encoderLength, address);\ncolor = encodeNullPairOfFloat16();\nif(isNullKeypoint(keypoint))\nreturn;\ncolor = encodeDiscardedPairOfFloat16();\nif(isBadKeypoint(keypoint))\nreturn;\nvec2 pyrGuess = (level < depth - 1) ? decodePairOfFloat16(pixel) : vec2(0.0f);\npyrGuess *= 2.0f;\nreadWindow(keypoint.position, float(level));\nivec2 derivatives;\nivec3 harris3i = ivec3(0);\nfor(int j = 0; j < WINDOW_SIZE; j++) {\nfor(int i = 0; i < WINDOW_SIZE; i++) {\nderivatives = computeDerivatives(PREV_IMAGE, ivec2(i-r, j-r));\nharris3i += ivec3(\nderivatives.x * derivatives.x,\nderivatives.x * derivatives.y,\nderivatives.y * derivatives.y\n);\nderivativesAt(i-r, j-r) = derivatives;\n}\n}\nhighp vec3 harris = vec3(harris3i) * FLT_SCALE;\nhighp mat2 invHarris = mat2(harris.z, -harris.y, -harris.y, harris.x);\nhighp float det = harris.x * harris.z - harris.y * harris.y;\nhighp float invDet = abs(det) >= FLT_EPSILON ? 1.0f / det : 0.0f;\nhighp float minEigenvalue = 0.5f * ((harris.x + harris.z) - sqrt(\n(harris.x - harris.z) * (harris.x - harris.z) + 4.0f * (harris.y * harris.y)\n));\nint niceNumbers = int(abs(det) >= FLT_EPSILON && minEigenvalue >= discardThreshold * windowArea);\nbool goodKeypoint = (level > 0) || (niceNumbers != 0);\nhighp float eps2 = epsilon * epsilon;\nhighp vec2 mismatch, delta, localGuess = vec2(0.0f);\nfor(int k = 0; k < numberOfIterations; k++) {\nmismatch = niceNumbers != 0 ? computeMismatch(pyrGuess, localGuess) : vec2(0.0f);\ndelta = mismatch * invHarris * invDet;\nniceNumbers *= int(eps2 <= dot(delta, delta));\nlocalGuess += float(niceNumbers) * delta;\n}\nvec2 opticalFlow = pyrGuess + localGuess;\nbool mustDiscard = (level == 0) && any(bvec2(\n!goodKeypoint,\n!isInsideImage(keypoint.position + opticalFlow)\n));\ncolor = !mustDiscard ? encodePairOfFloat16(opticalFlow) : encodeDiscardedPairOfFloat16();\n}'},4251:e=>{e.exports='#if @FS_USE_CUSTOM_PRECISION@\nprecision mediump int;\nprecision mediump float;\n#endif\n#if !defined(STAGE)\n#error Undefined STAGE\n#elif STAGE == 1\n@include "float16.glsl"\nuniform sampler2D corners;\n#elif STAGE < 1\nuniform mediump usampler2D lookupTable;\n#else\n#define SKIP_TEXTURE_READS 1\n#define DENSITY_FACTOR 0.10\nuniform mediump usampler2D lookupTable;\nuniform int blockSize;\nuniform int width;\nuniform int height;\nin vec2 v_topLeft, v_top, v_topRight,\nv_left, v_center, v_right,\nv_bottomLeft, v_bottom, v_bottomRight;\n#endif\nconst uvec2 NULL_ELEMENT = uvec2(0xFFFFu);\nvoid main()\n{\n#if STAGE == 1\nuvec2 outSize = uvec2(outputSize());\nuvec2 thread = uvec2(threadLocation());\nuvec2 size = uvec2(textureSize(corners, 0));\nuint location = thread.y * outSize.x + thread.x;\nivec2 pos = ivec2(location % size.x, location / size.x);\nvec4 pixel = location < size.x * size.y ? texelFetch(corners, pos, 0) : vec4(0.0f);\nbool isCorner = !isEncodedFloat16Zero(pixel.rb);\ncolor = isCorner ? uvec4(uvec2(pos), 1u, 0u) : uvec4(NULL_ELEMENT, 0u, 0u);\n#elif STAGE > 1\nint dblBlockSize = 2 * blockSize;\nivec2 thread = threadLocation();\nivec2 offset = thread % dblBlockSize;\nivec2 delta = thread - offset;\n#if SKIP_TEXTURE_READS\nif(blockSize >= 8) {\nuint sb = texture(lookupTable, texCoord).z;\nfloat p = max((float(sb) / float(blockSize)) / float(blockSize), DENSITY_FACTOR);\nfloat rowthr = float(dblBlockSize) * p + 3.0f * sqrt(p * (1.0f - p));\ncolor = uvec4(NULL_ELEMENT, 4u * sb, 0u);\nif(offset.y >= max(1, int(ceil(rowthr))))\nreturn;\n}\n#endif\n#define deltaCenter ivec2(0,0)\n#define deltaTop ivec2(0,-blockSize)\n#define deltaTopRight ivec2(blockSize,-blockSize)\n#define deltaRight ivec2(blockSize,0)\n#define deltaBottomRight ivec2(blockSize,blockSize)\n#define deltaBottom ivec2(0,blockSize)\n#define deltaBottomLeft ivec2(-blockSize,blockSize)\n#define deltaLeft ivec2(-blockSize,0)\n#define deltaTopLeft ivec2(-blockSize,-blockSize)\nivec2 boundary = ivec2(width - 1, height - 1) / blockSize;\nivec2 bottomRightPos = thread + deltaBottomRight;\nuvec2 valid = uvec2(\nbottomRightPos.x < width  || bottomRightPos.x / blockSize == boundary.x,\nbottomRightPos.y < height || bottomRightPos.y / blockSize == boundary.y\n);\nuvec4 mask[4] = uvec4[4](\nuvec4(1u, valid.x, valid.y, valid.x * valid.y),\nuvec4(1u, 1u, valid.y, valid.y),\nuvec4(1u, valid.x, 1u, valid.x),\nuvec4(1u)\n);\n#if SKIP_TEXTURE_READS\n#define calcSb(delta) texelFetch(lookupTable, blockSize * ((thread + (delta)) / blockSize), 0).z\nuint center = calcSb(deltaCenter);\nuint top = calcSb(deltaTop);\nuint topRight = calcSb(deltaTopRight);\nuint right = calcSb(deltaRight);\nuint bottomRight = calcSb(deltaBottomRight);\nuint bottom = calcSb(deltaBottom);\nuint bottomLeft = calcSb(deltaBottomLeft);\nuint left = calcSb(deltaLeft);\nuint topLeft = calcSb(deltaTopLeft);\n#else\n#define calcSb(pos) texture(lookupTable, (pos)).z\nuint center = calcSb(v_center);\nuint top = calcSb(v_top);\nuint topRight = calcSb(v_topRight);\nuint right = calcSb(v_right);\nuint bottomRight = calcSb(v_bottomRight);\nuint bottom = calcSb(v_bottom);\nuint bottomLeft = calcSb(v_bottomLeft);\nuint left = calcSb(v_left);\nuint topLeft = calcSb(v_topLeft);\n#endif\nuvec4 sums[4] = uvec4[4](\nuvec4(center, right, bottom, bottomRight),\nuvec4(left, center, bottomLeft, bottom),\nuvec4(top, topRight, center, right),\nuvec4(topLeft, top, left, center)\n);\nivec2 cmp = ivec2(greaterThanEqual(offset, ivec2(blockSize)));\nint option = 2 * cmp.y + cmp.x;\nuvec4 cdef = sums[option] * mask[option];\nuint c2b = cdef.x, d2b = cdef.y, e2b = cdef.z, f2b = cdef.w;\nuint sb = center;\nuint s2b = c2b + d2b + e2b + f2b;\ns2b = s2b < sb ? 0xFFFFu : min(0xFFFFu, s2b);\nuint w2b = uint(min(dblBlockSize, width - delta.x));\nuvec2 uoffset = uvec2(offset);\nuint ceiling = s2b >= uoffset.x ? (s2b - uoffset.x) / w2b + uint((s2b - uoffset.x) % w2b > 0u) : 0u;\ncolor = uvec4(NULL_ELEMENT, s2b, 0u);\nif(uoffset.y >= ceiling)\nreturn;\nuint i2b = uoffset.y * w2b + uoffset.x;\nuint j2b = i2b >= c2b ? i2b - c2b : 0u;\nuint k2b = j2b >= d2b ? j2b - d2b : 0u;\nuint l2b = k2b >= e2b ? k2b - e2b : 0u;\nuint wl = uint(min(blockSize, width - delta.x));\nuint wr = uint(min(blockSize, width - delta.x - blockSize));\nivec2 magicOffset = (\n(i2b < c2b) ? ivec2(i2b % wl, i2b / wl) : (\n(j2b < d2b) ? ivec2(j2b % wr, j2b / wr) + ivec2(blockSize, 0) : (\n(k2b < e2b) ? ivec2(k2b % wl, k2b / wl) + ivec2(0, blockSize) : (\n(l2b < f2b) ? ivec2(l2b % wr, l2b / wr) + ivec2(blockSize) : ivec2(0)\n))));\nuvec2 a2b = texelFetch(lookupTable, delta + magicOffset, 0).xy;\ncolor = uvec4(a2b, s2b, 0u);\n#else\nuvec4 pix = texture(lookupTable, texCoord);\ncolor = all(equal(pix.xy, NULL_ELEMENT)) ? vec4(0,1,1,1) : vec4(1,0,0,1);\n#endif\n}'},4747:e=>{e.exports="#if !defined(STAGE) || STAGE < 1\n#error Invalid STAGE\n#else\nuniform mediump int blockSize;\nout vec2 v_topLeft, v_top, v_topRight,\nv_left, v_center, v_right,\nv_bottomLeft, v_bottom, v_bottomRight;\nvoid vsmain()\n{\nfloat b = float(blockSize);\n#define V(x,y) (texCoord + (vec2((x),(y)) * b) / texSize)\nv_topLeft = V(-1,-1); v_top = V(0,-1); v_topRight = V(1,-1);\nv_left = V(-1,0); v_center = V(0,0); v_right = V(1,0);\nv_bottomLeft = V(-1,1); v_bottom = V(0,1); v_bottomRight = V(1,1);\n}\n#endif"},7421:e=>{e.exports='@include "keypoints.glsl"\n@include "keypoint-matches.glsl"\n@include "keypoint-descriptors.glsl"\nuniform sampler2D candidates;\nuniform sampler2D filters;\nuniform int matcherLength;\nuniform sampler2D tables;\nuniform sampler2D descriptorDB;\nuniform int tableIndex;\nuniform int bucketCapacity;\nuniform int bucketsPerTable;\nuniform int tablesStride;\nuniform int descriptorDBStride;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\n#if HASH_SIZE > SEQUENCE_MAXLEN\n#error LSH: invalid HASH_SIZE\n#elif SEQUENCE_COUNT * SEQUENCE_MAXLEN * 4 > 16384\n#error LSH: sequences are too large!\n#elif (SEQUENCE_COUNT * SEQUENCE_MAXLEN) % 4 > 0\n#error LSH: sequences of invalid size!\n#endif\nlayout(std140) uniform LSHSequences\n{\nuvec4 sequences[(SEQUENCE_COUNT * SEQUENCE_MAXLEN) / 4];\n};\n#if HASH_SIZE == 10\nconst int SWAP_COUNT[3] = int[3](1, 11, 56);\nconst int[56] SWAP = int[56](0,1,2,4,8,16,32,64,128,256,512,3,5,6,9,10,12,17,18,20,24,33,34,36,40,48,65,66,68,72,80,96,129,130,132,136,144,160,192,257,258,260,264,272,288,320,384,513,514,516,520,528,544,576,640,768);\n#elif HASH_SIZE == 11\nconst int SWAP_COUNT[3] = int[3](1, 12, 67);\nconst int[67] SWAP = int[67](0,1,2,4,8,16,32,64,128,256,512,1024,3,5,6,9,10,12,17,18,20,24,33,34,36,40,48,65,66,68,72,80,96,129,130,132,136,144,160,192,257,258,260,264,272,288,320,384,513,514,516,520,528,544,576,640,768,1025,1026,1028,1032,1040,1056,1088,1152,1280,1536);\n#elif HASH_SIZE == 12\nconst int SWAP_COUNT[3] = int[3](1, 13, 79);\nconst int[79] SWAP = int[79](0,1,2,4,8,16,32,64,128,256,512,1024,2048,3,5,6,9,10,12,17,18,20,24,33,34,36,40,48,65,66,68,72,80,96,129,130,132,136,144,160,192,257,258,260,264,272,288,320,384,513,514,516,520,528,544,576,640,768,1025,1026,1028,1032,1040,1056,1088,1152,1280,1536,2049,2050,2052,2056,2064,2080,2112,2176,2304,2560,3072);\n#elif HASH_SIZE == 13\nconst int SWAP_COUNT[3] = int[3](1, 14, 92);\nconst int[92] SWAP = int[92](0,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,3,5,6,9,10,12,17,18,20,24,33,34,36,40,48,65,66,68,72,80,96,129,130,132,136,144,160,192,257,258,260,264,272,288,320,384,513,514,516,520,528,544,576,640,768,1025,1026,1028,1032,1040,1056,1088,1152,1280,1536,2049,2050,2052,2056,2064,2080,2112,2176,2304,2560,3072,4097,4098,4100,4104,4112,4128,4160,4224,4352,4608,5120,6144);\n#elif HASH_SIZE == 14\nconst int SWAP_COUNT[3] = int[3](1, 15, 106);\nconst int[106] SWAP = int[106](0,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,3,5,6,9,10,12,17,18,20,24,33,34,36,40,48,65,66,68,72,80,96,129,130,132,136,144,160,192,257,258,260,264,272,288,320,384,513,514,516,520,528,544,576,640,768,1025,1026,1028,1032,1040,1056,1088,1152,1280,1536,2049,2050,2052,2056,2064,2080,2112,2176,2304,2560,3072,4097,4098,4100,4104,4112,4128,4160,4224,4352,4608,5120,6144,8193,8194,8196,8200,8208,8224,8256,8320,8448,8704,9216,10240,12288);\n#elif HASH_SIZE == 15\nconst int SWAP_COUNT[3] = int[3](1, 16, 121);\nconst int[121] SWAP = int[121](0,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,3,5,6,9,10,12,17,18,20,24,33,34,36,40,48,65,66,68,72,80,96,129,130,132,136,144,160,192,257,258,260,264,272,288,320,384,513,514,516,520,528,544,576,640,768,1025,1026,1028,1032,1040,1056,1088,1152,1280,1536,2049,2050,2052,2056,2064,2080,2112,2176,2304,2560,3072,4097,4098,4100,4104,4112,4128,4160,4224,4352,4608,5120,6144,8193,8194,8196,8200,8208,8224,8256,8320,8448,8704,9216,10240,12288,16385,16386,16388,16392,16400,16416,16448,16512,16640,16896,17408,18432,20480,24576);\n#elif HASH_SIZE == 16\nconst int SWAP_COUNT[3] = int[3](1, 17, 137);\nconst int[137] SWAP = int[137](0,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,3,5,6,9,10,12,17,18,20,24,33,34,36,40,48,65,66,68,72,80,96,129,130,132,136,144,160,192,257,258,260,264,272,288,320,384,513,514,516,520,528,544,576,640,768,1025,1026,1028,1032,1040,1056,1088,1152,1280,1536,2049,2050,2052,2056,2064,2080,2112,2176,2304,2560,3072,4097,4098,4100,4104,4112,4128,4160,4224,4352,4608,5120,6144,8193,8194,8196,8200,8208,8224,8256,8320,8448,8704,9216,10240,12288,16385,16386,16388,16392,16400,16416,16448,16512,16640,16896,17408,18432,20480,24576,32769,32770,32772,32776,32784,32800,32832,32896,33024,33280,33792,34816,36864,40960,49152);\n#elif HASH_SIZE == 17\nconst int SWAP_COUNT[3] = int[3](1, 18, 154);\nconst int[154] SWAP = int[154](0,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,3,5,6,9,10,12,17,18,20,24,33,34,36,40,48,65,66,68,72,80,96,129,130,132,136,144,160,192,257,258,260,264,272,288,320,384,513,514,516,520,528,544,576,640,768,1025,1026,1028,1032,1040,1056,1088,1152,1280,1536,2049,2050,2052,2056,2064,2080,2112,2176,2304,2560,3072,4097,4098,4100,4104,4112,4128,4160,4224,4352,4608,5120,6144,8193,8194,8196,8200,8208,8224,8256,8320,8448,8704,9216,10240,12288,16385,16386,16388,16392,16400,16416,16448,16512,16640,16896,17408,18432,20480,24576,32769,32770,32772,32776,32784,32800,32832,32896,33024,33280,33792,34816,36864,40960,49152,65537,65538,65540,65544,65552,65568,65600,65664,65792,66048,66560,67584,69632,73728,81920,98304);\n#elif HASH_SIZE == 18\nconst int SWAP_COUNT[3] = int[3](1, 19, 172);\nconst int[172] SWAP = int[172](0,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,3,5,6,9,10,12,17,18,20,24,33,34,36,40,48,65,66,68,72,80,96,129,130,132,136,144,160,192,257,258,260,264,272,288,320,384,513,514,516,520,528,544,576,640,768,1025,1026,1028,1032,1040,1056,1088,1152,1280,1536,2049,2050,2052,2056,2064,2080,2112,2176,2304,2560,3072,4097,4098,4100,4104,4112,4128,4160,4224,4352,4608,5120,6144,8193,8194,8196,8200,8208,8224,8256,8320,8448,8704,9216,10240,12288,16385,16386,16388,16392,16400,16416,16448,16512,16640,16896,17408,18432,20480,24576,32769,32770,32772,32776,32784,32800,32832,32896,33024,33280,33792,34816,36864,40960,49152,65537,65538,65540,65544,65552,65568,65600,65664,65792,66048,66560,67584,69632,73728,81920,98304,131073,131074,131076,131080,131088,131104,131136,131200,131328,131584,132096,133120,135168,139264,147456,163840,196608);\n#elif HASH_SIZE == 19\nconst int SWAP_COUNT[3] = int[3](1, 20, 191);\nconst int[191] SWAP = int[191](0,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,3,5,6,9,10,12,17,18,20,24,33,34,36,40,48,65,66,68,72,80,96,129,130,132,136,144,160,192,257,258,260,264,272,288,320,384,513,514,516,520,528,544,576,640,768,1025,1026,1028,1032,1040,1056,1088,1152,1280,1536,2049,2050,2052,2056,2064,2080,2112,2176,2304,2560,3072,4097,4098,4100,4104,4112,4128,4160,4224,4352,4608,5120,6144,8193,8194,8196,8200,8208,8224,8256,8320,8448,8704,9216,10240,12288,16385,16386,16388,16392,16400,16416,16448,16512,16640,16896,17408,18432,20480,24576,32769,32770,32772,32776,32784,32800,32832,32896,33024,33280,33792,34816,36864,40960,49152,65537,65538,65540,65544,65552,65568,65600,65664,65792,66048,66560,67584,69632,73728,81920,98304,131073,131074,131076,131080,131088,131104,131136,131200,131328,131584,132096,133120,135168,139264,147456,163840,196608,262145,262146,262148,262152,262160,262176,262208,262272,262400,262656,263168,264192,266240,270336,278528,294912,327680,393216);\n#elif HASH_SIZE == 20\nconst int SWAP_COUNT[3] = int[3](1, 21, 211);\nconst int[211] SWAP = int[211](0,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,3,5,6,9,10,12,17,18,20,24,33,34,36,40,48,65,66,68,72,80,96,129,130,132,136,144,160,192,257,258,260,264,272,288,320,384,513,514,516,520,528,544,576,640,768,1025,1026,1028,1032,1040,1056,1088,1152,1280,1536,2049,2050,2052,2056,2064,2080,2112,2176,2304,2560,3072,4097,4098,4100,4104,4112,4128,4160,4224,4352,4608,5120,6144,8193,8194,8196,8200,8208,8224,8256,8320,8448,8704,9216,10240,12288,16385,16386,16388,16392,16400,16416,16448,16512,16640,16896,17408,18432,20480,24576,32769,32770,32772,32776,32784,32800,32832,32896,33024,33280,33792,34816,36864,40960,49152,65537,65538,65540,65544,65552,65568,65600,65664,65792,66048,66560,67584,69632,73728,81920,98304,131073,131074,131076,131080,131088,131104,131136,131200,131328,131584,132096,133120,135168,139264,147456,163840,196608,262145,262146,262148,262152,262160,262176,262208,262272,262400,262656,263168,264192,266240,270336,278528,294912,327680,393216,524289,524290,524292,524296,524304,524320,524352,524416,524544,524800,525312,526336,528384,532480,540672,557056,589824,655360,786432);\n#else\n#error Invalid HASH_SIZE\n#endif\n#if LEVEL < 0 || LEVEL > 2\n#error Invalid LEVEL\n#endif\nconst uint END_OF_LIST = 0xFFFFFFFFu;\nconst int NUMBER_OF_HASHES = SWAP_COUNT[LEVEL];\nuint sequenceElement(int sequenceIndex, int elementIndex)\n{\nint offset = (SEQUENCE_MAXLEN) * sequenceIndex + elementIndex;\nuvec4 tuple = sequences[offset / 4];\nreturn tuple[offset & 3];\n}\nint descriptorHash(uint[DESCRIPTOR_SIZE] descriptor, int sequenceIndex)\n{\nuint bit, b, m;\nint hash = 0;\n@unroll\nfor(int i = 0; i < HASH_SIZE; i++) {\nbit = sequenceElement(sequenceIndex, i);\nb = bit >> 3u;\nm = 1u << (bit & 7u);\nhash = (hash << 1) | int((descriptor[b] & m) != 0u);\n}\nreturn hash;\n}\n#define readTableData(tables, tablesStride, rasterIndex) decodeUint32(texelFetch((tables), ivec2((rasterIndex) % (tablesStride), (rasterIndex) / (tablesStride)), 0))\nvoid main()\n{\nivec2 thread = threadLocation();\nint keypointIndex = thread.x + thread.y * matcherLength;\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nKeypointAddress address = KeypointAddress(keypointIndex * pixelsPerKeypoint, 0);\nKeypoint keypoint = decodeKeypoint(encodedKeypoints, encoderLength, address);\ncolor = encodeKeypointMatch(MATCH_NOT_FOUND);\nif(isBadKeypoint(keypoint))\nreturn;\nKeypointMatch candidate = decodeKeypointMatch(threadPixel(candidates));\nKeypointMatch mfilter = decodeKeypointMatch(threadPixel(filters));\nuint[DESCRIPTOR_SIZE] candidateDescriptor;\nuint[DESCRIPTOR_SIZE] descriptor = readKeypointDescriptor(encodedKeypoints, descriptorSize, extraSize, encoderLength, address);\nint hash0 = descriptorHash(descriptor, tableIndex);\nfor(int h = 0; h < NUMBER_OF_HASHES; h++) {\nint hash = hash0 ^ SWAP[h];\nint tableAddress = tableIndex * bucketsPerTable * bucketCapacity;\nint bucketAddress = tableAddress + hash * bucketCapacity;\nbool validEntry = true;\nfor(int b = 0; b < bucketCapacity; b++) {\nint entryAddress = bucketAddress + b;\nuint entry = validEntry ? readTableData(tables, tablesStride, entryAddress) : END_OF_LIST;\nvalidEntry = (validEntry && entry != END_OF_LIST);\nint candidateIndex = int(entry);\ncandidateDescriptor = readKeypointDescriptorFromDB(descriptorDB, descriptorDBStride, validEntry ? candidateIndex : -1);\nint descriptorDistance = distanceBetweenKeypointDescriptors(descriptor, candidateDescriptor);\nKeypointMatch match = KeypointMatch(candidateIndex, descriptorDistance);\nbool betterThanCandidate = (match.dist < candidate.dist) || (match.dist == candidate.dist && match.index > candidate.index);\nbool worseThanFilter = (match.dist > mfilter.dist) || (match.dist == mfilter.dist && match.index < mfilter.index);\nbool nicerMatch = (validEntry && betterThanCandidate && worseThanFilter);\nivec2 v = nicerMatch ? ivec2(match.index, match.dist) : ivec2(candidate.index, candidate.dist);\ncandidate = KeypointMatch(v.x, v.y);\n}\n}\ncolor = encodeKeypointMatch(candidate);\n}'},4523:e=>{e.exports='@include "keypoints.glsl"\n@include "int32.glsl"\n#if !defined(STAGE)\n#error Undefined STAGE\n#elif STAGE == 1\nuniform sampler2D encodedKeypointsA;\nuniform sampler2D encodedKeypointsB;\nuniform int encoderLengthA;\nuniform int encoderLengthB;\nuniform int encoderCapacityA;\nuniform int encoderCapacityB;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\n#elif STAGE == 2\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\nuniform int maxKeypoints;\n#elif STAGE == 3\nuniform sampler2D array;\nuniform int blockSize;\n#elif STAGE == 4\nuniform sampler2D array;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\n#elif STAGE == 5\nuniform sampler2D array;\n#else\n#error Invalid STAGE\n#endif\n#define NULL_KEYPOINT_INDEX 0xFFFF\nconst highp uint UNIT = 0x10000u;\nvoid main()\n{\n#if STAGE == 1\nivec2 thread = threadLocation();\nKeypointAddress addr = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nint keypointIndex = findKeypointIndex(addr, descriptorSize, extraSize);\nint newKeypointIndex = keypointIndex < encoderCapacityA ? keypointIndex : keypointIndex - encoderCapacityA;\ncolor = encodeNullKeypoint();\nif(newKeypointIndex >= max(encoderCapacityA, encoderCapacityB))\nreturn;\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\naddr = KeypointAddress(newKeypointIndex * pixelsPerKeypoint, addr.offset);\nvec4 dataA = readKeypointData(encodedKeypointsA, encoderLengthA, addr);\nvec4 dataB = readKeypointData(encodedKeypointsB, encoderLengthB, addr);\ncolor = keypointIndex < encoderCapacityA ? dataA : dataB;\n#elif STAGE == 2\nivec2 thread = threadLocation();\nint keypointIndex = thread.y * outputSize().x + thread.x;\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nKeypointAddress addr = KeypointAddress(keypointIndex * pixelsPerKeypoint, 0);\nKeypoint keypoint = decodeKeypoint(encodedKeypoints, encoderLength, addr);\nbool isValid = !isNullKeypoint(keypoint) && keypointIndex < maxKeypoints;\nkeypointIndex = isValid ? keypointIndex : NULL_KEYPOINT_INDEX;\ncolor = encodeUint32(uint(keypointIndex & 0xFFFF) | (isValid ? UNIT : 0u));\n#elif STAGE == 3\nivec2 thread = threadLocation();\nivec2 size = outputSize();\nint arrayLength = size.x * size.y;\nint arrayIndex = thread.y * size.x + thread.x;\nint arrayIndexLeft = arrayIndex - blockSize;\nint arrayIndexRight = arrayIndex + blockSize;\nint mask = int(arrayIndexRight < arrayLength || arrayIndexRight / blockSize == (arrayLength - 1) / blockSize);\narrayIndexLeft = max(0, arrayIndexLeft);\narrayIndexRight = min(arrayLength - 1, arrayIndexRight);\n#define raster2pos(k) ivec2((k) % size.x, (k) / size.x)\nuvec3 entries32 = uvec3(\ndecodeUint32(threadPixel(array)),\ndecodeUint32(texelFetch(array, raster2pos(arrayIndexLeft), 0)),\ndecodeUint32(texelFetch(array, raster2pos(arrayIndexRight), 0))\n);\nivec3 sb = ivec3((entries32 >> 16u) & 0xFFFFu);\nsb.z *= mask;\nint dblBlockSize = 2 * blockSize;\nint offset = arrayIndex % dblBlockSize;\nint s2b = sb.x + (offset < blockSize ? sb.z : sb.y);\nint l2b = offset < blockSize ? sb.x : sb.y;\nuint keypointIndex = entries32.x & 0xFFFFu;\nuint shiftedS2b = uint(s2b) << 16u;\ncolor = encodeUint32(uint(NULL_KEYPOINT_INDEX) | shiftedS2b);\nif(offset >= s2b)\nreturn;\ncolor = encodeUint32(keypointIndex | shiftedS2b);\nif(offset < l2b)\nreturn;\nvec4 entry = texelFetch(array, raster2pos(arrayIndex + blockSize - l2b), 0);\nkeypointIndex = decodeUint32(entry) & 0xFFFFu;\ncolor = encodeUint32(keypointIndex | shiftedS2b);\n#elif STAGE == 4\nivec2 thread = threadLocation();\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nKeypointAddress addr = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nint keypointIndex = findKeypointIndex(addr, descriptorSize, extraSize);\n#define raster2pos(k) ivec2((k) % size.x, (k) / size.x)\nivec2 size = textureSize(array, 0);\nuint sortedPair = decodeUint32(texelFetch(array, raster2pos(keypointIndex), 0));\nint newKeypointIndex = int(sortedPair & 0xFFFFu);\ncolor = encodeNullKeypoint();\nif(newKeypointIndex == NULL_KEYPOINT_INDEX || keypointIndex >= size.x * size.y)\nreturn;\nKeypointAddress newAddr = KeypointAddress(newKeypointIndex * pixelsPerKeypoint, addr.offset);\ncolor = readKeypointData(encodedKeypoints, encoderLength, newAddr);\n#elif STAGE == 5\nuint val = decodeUint32(threadPixel(array));\ncolor = (val & 0xFFFFu) == uint(NULL_KEYPOINT_INDEX) ? vec4(0,1,1,1) : vec4(1,0,0,1);\n#endif\n}'},2277:e=>{e.exports='@include "pyramids.glsl"\n@include "float16.glsl"\n@include "filters.glsl"\n#if !defined(USE_LAPLACIAN)\n#error Undefined USE_LAPLACIAN\n#endif\nuniform sampler2D corners;\nuniform sampler2D pyramid;\nuniform float lodStep;\n#if USE_LAPLACIAN\nuniform sampler2D pyrLaplacian;\n#endif\nvoid main()\n{\nivec2 thread = threadLocation();\nvec4 pixel = threadPixel(corners);\nfloat score = decodeFloat16(pixel.rb);\nfloat myEncodedLod = pixel.a;\nfloat lod = decodeLod(myEncodedLod);\nfloat lodPlus = lod + lodStep;\nfloat lodMinus = lod - lodStep;\nfloat pot = exp2(lod);\nfloat potPlus = exp2(lodPlus);\nfloat potMinus = exp2(lodMinus);\ncolor = pixel;\nif(score == 0.0f)\nreturn;\n#define P(p,u,v) textureLod(corners, texCoord + (p) * vec2((u),(v)) / texSize, 0.0f)\nvec4 pix[18] = vec4[18](\n#define D(u,v) P(potMinus,(u),(v))\nD(-1,-1), D(0,-1), D(1,-1),\nD(-1,0), D(0,0), D(1,0),\nD(-1,1), D(0,1), D(1,1)\n,\n#define U(u,v) P(potPlus,(u),(v))\nU(-1,-1), U(0,-1), U(1,-1),\nU(-1,0), U(0,0), U(1,0),\nU(-1,1), U(0,1), U(1,1)\n);\nfloat scores[18] = float[18](\n#define C(j) decodeFloat16(pix[j].rb)\nC(0), C(1), C(2),\nC(3), C(4), C(5),\nC(6), C(7), C(8)\n,\nC(9), C(10), C(11),\nC(12), C(13), C(14),\nC(15), C(16), C(17)\n);\nfloat lods[18] = float[18](\n#define E(j) decodeLod(pix[j].a)\nE(0), E(1), E(2),\nE(3), E(4), E(5),\nE(6), E(7), E(8)\n,\nE(9), E(10), E(11),\nE(12), E(13), E(14),\nE(15), E(16), E(17)\n);\n#if USE_LAPLACIAN\n#define L(p,u,v) textureLod(pyrLaplacian, texCoord + (p) * vec2((u),(v)) / texSize, 0.0f)\nmat3 strengths[2] = mat3[2](mat3(\n#define Lm(u,v) abs(decodeFloat16(L(potMinus,(u),(v)).xy))\nLm(-1,-1), Lm(0,-1), Lm(1,-1),\nLm(-1,0), Lm(0,0), Lm(1,0),\nLm(-1,1), Lm(0,1), Lm(1,1)\n), mat3(\n#define Lp(u,v) abs(decodeFloat16(L(potPlus,(u),(v)).zw))\nLp(-1,-1), Lp(0,-1), Lp(1,-1),\nLp(-1,0), Lp(0,0), Lp(1,0),\nLp(-1,1), Lp(0,1), Lp(1,1)\n));\nfloat myStrength = abs(laplacian(pyramid, vec2(thread), lod));\n#else\n#define L(u,v) (((v)+1)*3 + ((u)+1))\nmat3 strengths[2] = mat3[2](mat3(\n#define Lm(u,v) scores[L((u),(v))]\nLm(-1,-1), Lm(0,-1), Lm(1,-1),\nLm(-1,0), Lm(0,0), Lm(1,0),\nLm(-1,1), Lm(0,1), Lm(1,1)\n), mat3(\n#define Lp(u,v) scores[9 + L((u),(v))]\nLp(-1,-1), Lp(0,-1), Lp(1,-1),\nLp(-1,0), Lp(0,0), Lp(1,0),\nLp(-1,1), Lp(0,1), Lp(1,1)\n));\nfloat myStrength = score;\n#endif\n#define B(j,lod) float(isSameLod(lods[j], (lod))) * float(scores[j] > 0.0f)\nmat3 nearLod[2] = mat3[2](mat3(\n#define Bm(j) B((j), lodMinus)\nBm(0), Bm(1), Bm(2),\nBm(3), Bm(4), Bm(5),\nBm(6), Bm(7), Bm(8)\n), mat3(\n#define Bp(j) B((j), lodPlus)\nBp(9), Bp(10), Bp(11),\nBp(12), Bp(13), Bp(14),\nBp(15), Bp(16), Bp(17)\n));\nmat3 upStrengths = matrixCompMult(strengths[1], nearLod[1]);\nmat3 downStrengths = matrixCompMult(strengths[0], nearLod[0]);\nvec3 maxUpStrength3 = max(upStrengths[0], max(upStrengths[1], upStrengths[2]));\nvec3 maxDownStrength3 = max(downStrengths[0], max(downStrengths[1], downStrengths[2]));\nvec3 maxStrength3 = max(maxUpStrength3, maxDownStrength3);\nfloat maxStrength = max(maxStrength3.x, max(maxStrength3.y, maxStrength3.z));\ncolor.rb = encodeFloat16(score * step(maxStrength, myStrength));\n}'},8430:e=>{e.exports='@include "pyramids.glsl"\n@include "float16.glsl"\nuniform sampler2D corners;\nvoid main()\n{\nivec2 thread = threadLocation();\nvec4 pixel = threadPixel(corners);\nfloat encodedLod = pixel.a;\nfloat score = decodeFloat16(pixel.rb);\nfloat lod = decodeLod(encodedLod);\nfloat pot = exp2(lod);\ncolor = pixel;\nif(score == 0.0f)\nreturn;\n#if 1\nvec2 gridSize = vec2(pot);\nvec2 gridLocation = floor(mod(texCoord * texSize, gridSize));\nvec2 gridDelta = gridLocation / gridSize - vec2(0.5f);\nfloat gridStep = 1.0f / pot;\nconst float adjustment = 1.25f;\ncolor.rb = encodeFloat16(0.0f);\nif(max(abs(gridDelta.x), abs(gridDelta.y)) > adjustment * gridStep)\nreturn;\n#endif\n#define P(x,y) textureLod(corners, texCoord + pot * vec2((x), (y)) / texSize, 0.0f)\nvec4 pix[9] = vec4[9](\nP(-1,-1), P(0,-1), P(1,-1),\nP(-1,0), pixel, P(1,0),\nP(-1,1), P(0,1), P(1,1)\n);\n#define S(j) decodeFloat16(pix[j].rb)\nmat3 scores = mat3(\nS(0), S(1), S(2),\nS(3), S(4), S(5),\nS(6), S(7), S(8)\n);\n#define B(j) float(isSameLod(decodeLod(pix[j].a), lod))\nmat3 sameLod = mat3(\nB(0), B(1), B(2),\nB(3), B(4), B(5),\nB(6), B(7), B(8)\n);\nmat3 sameLodScores = matrixCompMult(scores, sameLod);\nvec3 maxScore3 = max(sameLodScores[0], max(sameLodScores[1], sameLodScores[2]));\nfloat maxScore = max(maxScore3.x, max(maxScore3.y, maxScore3.z));\ncolor.rb = encodeFloat16(score * step(maxScore, score));\n}'},9743:e=>{e.exports='@include "pyramids.glsl"\n@include "float16.glsl"\nuniform sampler2D image;\nuniform float lodStep;\n#if !defined(MULTISCALE)\n#error Must define MULTISCALE\n#elif MULTISCALE != 0\n#define LOD_STEP (lodStep)\n#define USE_MIDDLE_RING\n#else\n#define LOD_STEP (0.0f)\n#endif\n#define PIX(x,y) pixelAtShortOffset(image, ivec2((x),(y)))\n#define L2(v,i) bvec2(isSameEncodedLod(v[i].a, alphaMinus), isSameEncodedLod(v[i].a, alphaPlus))\n#define L3(v,i) bvec3(isSameEncodedLod(v[i].a, alpha), isSameEncodedLod(v[i].a, alphaMinus), isSameEncodedLod(v[i].a, alphaPlus))\n#define S3(v,i) decodeFloat16(v[i].rb) * float(any(L3(v,i)))\n#define S2(v,i) decodeFloat16(v[i].rb) * float(any(L2(v,i)))\n#define P(i) S3(p,i)\n#define Q(i) S2(q,i)\n#define R(i) S2(r,i)\nconst vec4 O = vec4(0.0f);\nvoid main()\n{\nvec4 pixel = threadPixel(image);\nfloat lod = decodeLod(pixel.a);\nfloat score = decodeFloat16(pixel.rb);\ncolor = pixel;\nif(score == 0.0f)\nreturn;\nvec4 p[8] = vec4[8](\nPIX(0,1), PIX(1,1), PIX(1,0), PIX(1,-1),\nPIX(0,-1), PIX(-1,-1), PIX(-1,0), PIX(-1,1)\n);\n#ifdef USE_MIDDLE_RING\nvec4 q[16] = vec4[16](\nPIX(0,2), PIX(1,2), PIX(2,2), PIX(2,1),\nPIX(2,0), PIX(2,-1), PIX(2,-2), PIX(1,-2),\nPIX(0,-2), PIX(-1,-2), PIX(-2,-2), PIX(-2,-1),\nPIX(-2,0), PIX(-2,1), PIX(-2,2), PIX(-1,2)\n);\n#else\nvec4 q[16] = vec4[16](O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O);\n#endif\n#ifdef USE_OUTER_RING\nvec4 r[16] = vec4[16](\nPIX(0,3), PIX(1,3), PIX(3,1), PIX(3,0),\nPIX(3,-1), PIX(1,-3), PIX(0,-3), PIX(-1,-3),\nPIX(-3,-1), PIX(-3,0), PIX(-3,1), PIX(-1,3),\nPIX(0,4), PIX(4,0), PIX(0,-4), PIX(-4,0)\n);\n#else\nvec4 r[16] = vec4[16](O,O,O,O,O,O,O,O,O,O,O,O,O,O,O,O);\n#endif\nfloat alphaPlus = encodeLod(lod + LOD_STEP);\nfloat alphaMinus = encodeLod(lod - LOD_STEP);\nfloat alpha = encodeLod(lod);\nmat3 innerScore = mat3(\nP(0), P(1), P(2), P(3),\nP(4), P(5), P(6), P(7),\n0.0f);\nmat4 middleScore = mat4(\nQ(0), Q(1), Q(2), Q(3),\nQ(4), Q(5), Q(6), Q(7),\nQ(8), Q(9), Q(10), Q(11),\nQ(12), Q(13), Q(14), Q(15)\n);\nmat4 outerScore = mat4(\nR(0), R(1), R(2), R(3),\nR(4), R(5), R(6), R(7),\nR(8), R(9), R(10), R(11),\nR(12), R(13), R(14), R(15)\n);\nvec3 maxInnerScore3 = max(innerScore[0], max(innerScore[1], innerScore[2]));\nvec4 maxMiddleScore4 = max(max(middleScore[0], middleScore[1]), max(middleScore[2], middleScore[3]));\nvec4 maxOuterScore4 = max(max(outerScore[0], outerScore[1]), max(outerScore[2], outerScore[3]));\nfloat maxInnerScore = max(maxInnerScore3.x, max(maxInnerScore3.y, maxInnerScore3.z));\nfloat maxMiddleScore = max(max(maxMiddleScore4.x, maxMiddleScore4.y), max(maxMiddleScore4.z, maxMiddleScore4.w));\nfloat maxOuterScore = max(max(maxOuterScore4.x, maxOuterScore4.y), max(maxOuterScore4.z, maxOuterScore4.w));\nfloat maxScore = max(maxInnerScore, max(maxMiddleScore, maxOuterScore));\nfloat finalScore = step(maxScore, score) * score;\ncolor.rb = encodeFloat16(finalScore);\n}'},3464:e=>{e.exports='@include "keypoints.glsl"\nuniform sampler2D encodedCorners;\nuniform int encoderLength;\nuniform sampler2D image;\nuniform int extraSize;\nconst int descriptorSize = 32;\n#define P(a,b,c,d) ivec4((a),(b),(c),(d))\nconst ivec4 pat31[256] = ivec4[256](\nP(8,-3,9,5),\nP(4,2,7,-12),\nP(-11,9,-8,2),\nP(7,-12,12,-13),\nP(2,-13,2,12),\nP(1,-7,1,6),\nP(-2,-10,-2,-4),\nP(-13,-13,-11,-8),\nP(-13,-3,-12,-9),\nP(10,4,11,9),\nP(-13,-8,-8,-9),\nP(-11,7,-9,12),\nP(7,7,12,6),\nP(-4,-5,-3,0),\nP(-13,2,-12,-3),\nP(-9,0,-7,5),\nP(12,-6,12,-1),\nP(-3,6,-2,12),\nP(-6,-13,-4,-8),\nP(11,-13,12,-8),\nP(4,7,5,1),\nP(5,-3,10,-3),\nP(3,-7,6,12),\nP(-8,-7,-6,-2),\nP(-2,11,-1,-10),\nP(-13,12,-8,10),\nP(-7,3,-5,-3),\nP(-4,2,-3,7),\nP(-10,-12,-6,11),\nP(5,-12,6,-7),\nP(5,-6,7,-1),\nP(1,0,4,-5),\nP(9,11,11,-13),\nP(4,7,4,12),\nP(2,-1,4,4),\nP(-4,-12,-2,7),\nP(-8,-5,-7,-10),\nP(4,11,9,12),\nP(0,-8,1,-13),\nP(-13,-2,-8,2),\nP(-3,-2,-2,3),\nP(-6,9,-4,-9),\nP(8,12,10,7),\nP(0,9,1,3),\nP(7,-5,11,-10),\nP(-13,-6,-11,0),\nP(10,7,12,1),\nP(-6,-3,-6,12),\nP(10,-9,12,-4),\nP(-13,8,-8,-12),\nP(-13,0,-8,-4),\nP(3,3,7,8),\nP(5,7,10,-7),\nP(-1,7,1,-12),\nP(3,-10,5,6),\nP(2,-4,3,-10),\nP(-13,0,-13,5),\nP(-13,-7,-12,12),\nP(-13,3,-11,8),\nP(-7,12,-4,7),\nP(6,-10,12,8),\nP(-9,-1,-7,-6),\nP(-2,-5,0,12),\nP(-12,5,-7,5),\nP(3,-10,8,-13),\nP(-7,-7,-4,5),\nP(-3,-2,-1,-7),\nP(2,9,5,-11),\nP(-11,-13,-5,-13),\nP(-1,6,0,-1),\nP(5,-3,5,2),\nP(-4,-13,-4,12),\nP(-9,-6,-9,6),\nP(-12,-10,-8,-4),\nP(10,2,12,-3),\nP(7,12,12,12),\nP(-7,-13,-6,5),\nP(-4,9,-3,4),\nP(7,-1,12,2),\nP(-7,6,-5,1),\nP(-13,11,-12,5),\nP(-3,7,-2,-6),\nP(7,-8,12,-7),\nP(-13,-7,-11,-12),\nP(1,-3,12,12),\nP(2,-6,3,0),\nP(-4,3,-2,-13),\nP(-1,-13,1,9),\nP(7,1,8,-6),\nP(1,-1,3,12),\nP(9,1,12,6),\nP(-1,-9,-1,3),\nP(-13,-13,-10,5),\nP(7,7,10,12),\nP(12,-5,12,9),\nP(6,3,7,11),\nP(5,-13,6,10),\nP(2,-12,2,3),\nP(3,8,4,-6),\nP(2,6,12,-13),\nP(9,-12,10,3),\nP(-8,4,-7,9),\nP(-11,12,-4,-6),\nP(1,12,2,-8),\nP(6,-9,7,-4),\nP(2,3,3,-2),\nP(6,3,11,0),\nP(3,-3,8,-8),\nP(7,8,9,3),\nP(-11,-5,-6,-4),\nP(-10,11,-5,10),\nP(-5,-8,-3,12),\nP(-10,5,-9,0),\nP(8,-1,12,-6),\nP(4,-6,6,-11),\nP(-10,12,-8,7),\nP(4,-2,6,7),\nP(-2,0,-2,12),\nP(-5,-8,-5,2),\nP(7,-6,10,12),\nP(-9,-13,-8,-8),\nP(-5,-13,-5,-2),\nP(8,-8,9,-13),\nP(-9,-11,-9,0),\nP(1,-8,1,-2),\nP(7,-4,9,1),\nP(-2,1,-1,-4),\nP(11,-6,12,-11),\nP(-12,-9,-6,4),\nP(3,7,7,12),\nP(5,5,10,8),\nP(0,-4,2,8),\nP(-9,12,-5,-13),\nP(0,7,2,12),\nP(-1,2,1,7),\nP(5,11,7,-9),\nP(3,5,6,-8),\nP(-13,-4,-8,9),\nP(-5,9,-3,-3),\nP(-4,-7,-3,-12),\nP(6,5,8,0),\nP(-7,6,-6,12),\nP(-13,6,-5,-2),\nP(1,-10,3,10),\nP(4,1,8,-4),\nP(-2,-2,2,-13),\nP(2,-12,12,12),\nP(-2,-13,0,-6),\nP(4,1,9,3),\nP(-6,-10,-3,-5),\nP(-3,-13,-1,1),\nP(7,5,12,-11),\nP(4,-2,5,-7),\nP(-13,9,-9,-5),\nP(7,1,8,6),\nP(7,-8,7,6),\nP(-7,-4,-7,1),\nP(-8,11,-7,-8),\nP(-13,6,-12,-8),\nP(2,4,3,9),\nP(10,-5,12,3),\nP(-6,-5,-6,7),\nP(8,-3,9,-8),\nP(2,-12,2,8),\nP(-11,-2,-10,3),\nP(-12,-13,-7,-9),\nP(-11,0,-10,-5),\nP(5,-3,11,8),\nP(-2,-13,-1,12),\nP(-1,-8,0,9),\nP(-13,-11,-12,-5),\nP(-10,-2,-10,11),\nP(-3,9,-2,-13),\nP(2,-3,3,2),\nP(-9,-13,-4,0),\nP(-4,6,-3,-10),\nP(-4,12,-2,-7),\nP(-6,-11,-4,9),\nP(6,-3,6,11),\nP(-13,11,-5,5),\nP(11,11,12,6),\nP(7,-5,12,-2),\nP(-1,12,0,7),\nP(-4,-8,-3,-2),\nP(-7,1,-6,7),\nP(-13,-12,-8,-13),\nP(-7,-2,-6,-8),\nP(-8,5,-6,-9),\nP(-5,-1,-4,5),\nP(-13,7,-8,10),\nP(1,5,5,-13),\nP(1,0,10,-13),\nP(9,12,10,-1),\nP(5,-8,10,-9),\nP(-1,11,1,-13),\nP(-9,-3,-6,2),\nP(-1,-10,1,12),\nP(-13,1,-8,-10),\nP(8,-11,10,-6),\nP(2,-13,3,-6),\nP(7,-13,12,-9),\nP(-10,-10,-5,-7),\nP(-10,-8,-8,-13),\nP(4,-6,8,5),\nP(3,12,8,-13),\nP(-4,2,-3,-3),\nP(5,-13,10,-12),\nP(4,-13,5,-1),\nP(-9,9,-4,3),\nP(0,3,3,-9),\nP(-12,1,-6,1),\nP(3,2,4,-8),\nP(-10,-10,-10,9),\nP(8,-13,12,12),\nP(-8,-12,-6,-5),\nP(2,2,3,7),\nP(10,6,11,-8),\nP(6,8,8,-12),\nP(-7,10,-6,5),\nP(-3,-9,-3,9),\nP(-1,-13,-1,5),\nP(-3,-7,-3,4),\nP(-8,-2,-8,3),\nP(4,2,12,12),\nP(2,-5,3,11),\nP(6,-9,11,-13),\nP(3,-1,7,12),\nP(11,-1,12,4),\nP(-3,0,-3,6),\nP(4,-11,4,12),\nP(2,-4,2,1),\nP(-10,-6,-8,1),\nP(-13,7,-11,1),\nP(-13,12,-11,-13),\nP(6,0,11,-13),\nP(0,-1,1,4),\nP(-13,3,-9,-2),\nP(-9,8,-6,-3),\nP(-13,-6,-8,-2),\nP(5,-9,8,10),\nP(2,7,3,-9),\nP(-1,-6,-1,-1),\nP(9,5,11,-2),\nP(11,-3,12,-8),\nP(3,0,3,5),\nP(-1,4,0,10),\nP(3,-6,4,5),\nP(-13,0,-10,5),\nP(5,8,12,11),\nP(8,9,9,-6),\nP(7,-4,8,-12),\nP(-10,4,-10,9),\nP(7,3,12,4),\nP(9,-7,10,-2),\nP(7,0,12,-2),\nP(-1,-6,0,-11)\n);\nvoid getPair(int index, mat2 rot, out vec2 p, out vec2 q)\n{\nivec4 data = pat31[index];\nvec2 op = vec2(data.xy);\nvec2 oq = vec2(data.zw);\np = rot * op;\nq = rot * oq;\n}\nvoid main()\n{\nvec4 pixel = threadPixel(encodedCorners);\nivec2 thread = threadLocation();\nKeypointAddress address = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nint descriptorCell = address.offset - sizeofEncodedKeypoint(0, extraSize) / 4;\ncolor = pixel;\nif(descriptorCell < 0)\nreturn;\nKeypoint keypoint = decodeKeypoint(encodedCorners, encoderLength, address);\nif(isBadKeypoint(keypoint))\nreturn;\nfloat degreesOrientation = round(360.0f + degrees(keypoint.orientation));\nfloat orientation = radians(degreesOrientation - mod(degreesOrientation, 12.0f));\nfloat kcos = cos(orientation);\nfloat ksin = sin(orientation);\nmat2 rot = mat2(kcos, ksin, -ksin, kcos);\nfloat pot = exp2(keypoint.lod);\nint patternStart = 32 * descriptorCell;\nuint test[4] = uint[4](0u, 0u, 0u, 0u);\nfor(int t = 0; t < 4; t++) {\nuint bits = 0u;\nvec2 p, q;\nvec4 a, b;\nint i = t * 8;\n@unroll\nfor(int j = 0; j < 8; j++) {\ngetPair(patternStart + i + j, rot, p, q);\na = texelFetch(image, ivec2(round(keypoint.position + pot * p)), 0);\nb = texelFetch(image, ivec2(round(keypoint.position + pot * q)), 0);\nbits |= uint(a.g < b.g) << j;\n}\ntest[t] = bits;\n}\ncolor = vec4(test[0], test[1], test[2], test[3]) / 255.0f;\n}'},7184:e=>{e.exports='@include "keypoints.glsl"\nuniform sampler2D image;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\n#define P(x,y) ivec2((x),(y))\nconst int diskPointCount[16] = int[16](0, 4, 12, 28, 48, 80, 112, 148, 196, 252, 316, 376, 440, 528, 612, 708);\nconst ivec2 diskPoint[708] = ivec2[708](\nP(0,-1),P(-1,0),P(1,0),P(0,1),\nP(-1,-1),P(1,-1),P(-1,1),P(1,1),P(0,-2),P(-2,0),P(2,0),P(0,2),\nP(-1,-2),P(1,-2),P(-2,-1),P(2,-1),P(-2,1),P(2,1),P(-1,2),P(1,2),P(-2,-2),P(2,-2),P(-2,2),P(2,2),P(0,-3),P(-3,0),P(3,0),P(0,3),\nP(-1,-3),P(1,-3),P(-3,-1),P(3,-1),P(-3,1),P(3,1),P(-1,3),P(1,3),P(-2,-3),P(2,-3),P(-3,-2),P(3,-2),P(-3,2),P(3,2),P(-2,3),P(2,3),P(0,-4),P(-4,0),P(4,0),P(0,4),\nP(-1,-4),P(1,-4),P(-4,-1),P(4,-1),P(-4,1),P(4,1),P(-1,4),P(1,4),P(-3,-3),P(3,-3),P(-3,3),P(3,3),P(-2,-4),P(2,-4),P(-4,-2),P(4,-2),P(-4,2),P(4,2),P(-2,4),P(2,4),P(0,-5),P(-3,-4),P(3,-4),P(-4,-3),P(4,-3),P(-5,0),P(5,0),P(-4,3),P(4,3),P(-3,4),P(3,4),P(0,5),\nP(-1,-5),P(1,-5),P(-5,-1),P(5,-1),P(-5,1),P(5,1),P(-1,5),P(1,5),P(-2,-5),P(2,-5),P(-5,-2),P(5,-2),P(-5,2),P(5,2),P(-2,5),P(2,5),P(-4,-4),P(4,-4),P(-4,4),P(4,4),P(-3,-5),P(3,-5),P(-5,-3),P(5,-3),P(-5,3),P(5,3),P(-3,5),P(3,5),P(0,-6),P(-6,0),P(6,0),P(0,6),\nP(-1,-6),P(1,-6),P(-6,-1),P(6,-1),P(-6,1),P(6,1),P(-1,6),P(1,6),P(-2,-6),P(2,-6),P(-6,-2),P(6,-2),P(-6,2),P(6,2),P(-2,6),P(2,6),P(-4,-5),P(4,-5),P(-5,-4),P(5,-4),P(-5,4),P(5,4),P(-4,5),P(4,5),P(-3,-6),P(3,-6),P(-6,-3),P(6,-3),P(-6,3),P(6,3),P(-3,6),P(3,6),P(0,-7),P(-7,0),P(7,0),P(0,7),\nP(-1,-7),P(1,-7),P(-5,-5),P(5,-5),P(-7,-1),P(7,-1),P(-7,1),P(7,1),P(-5,5),P(5,5),P(-1,7),P(1,7),P(-4,-6),P(4,-6),P(-6,-4),P(6,-4),P(-6,4),P(6,4),P(-4,6),P(4,6),P(-2,-7),P(2,-7),P(-7,-2),P(7,-2),P(-7,2),P(7,2),P(-2,7),P(2,7),P(-3,-7),P(3,-7),P(-7,-3),P(7,-3),P(-7,3),P(7,3),P(-3,7),P(3,7),P(-5,-6),P(5,-6),P(-6,-5),P(6,-5),P(-6,5),P(6,5),P(-5,6),P(5,6),P(0,-8),P(-8,0),P(8,0),P(0,8),\nP(-1,-8),P(1,-8),P(-4,-7),P(4,-7),P(-7,-4),P(7,-4),P(-8,-1),P(8,-1),P(-8,1),P(8,1),P(-7,4),P(7,4),P(-4,7),P(4,7),P(-1,8),P(1,8),P(-2,-8),P(2,-8),P(-8,-2),P(8,-2),P(-8,2),P(8,2),P(-2,8),P(2,8),P(-6,-6),P(6,-6),P(-6,6),P(6,6),P(-3,-8),P(3,-8),P(-8,-3),P(8,-3),P(-8,3),P(8,3),P(-3,8),P(3,8),P(-5,-7),P(5,-7),P(-7,-5),P(7,-5),P(-7,5),P(7,5),P(-5,7),P(5,7),P(-4,-8),P(4,-8),P(-8,-4),P(8,-4),P(-8,4),P(8,4),P(-4,8),P(4,8),P(0,-9),P(-9,0),P(9,0),P(0,9),\nP(-1,-9),P(1,-9),P(-9,-1),P(9,-1),P(-9,1),P(9,1),P(-1,9),P(1,9),P(-2,-9),P(2,-9),P(-6,-7),P(6,-7),P(-7,-6),P(7,-6),P(-9,-2),P(9,-2),P(-9,2),P(9,2),P(-7,6),P(7,6),P(-6,7),P(6,7),P(-2,9),P(2,9),P(-5,-8),P(5,-8),P(-8,-5),P(8,-5),P(-8,5),P(8,5),P(-5,8),P(5,8),P(-3,-9),P(3,-9),P(-9,-3),P(9,-3),P(-9,3),P(9,3),P(-3,9),P(3,9),P(-4,-9),P(4,-9),P(-9,-4),P(9,-4),P(-9,4),P(9,4),P(-4,9),P(4,9),P(-7,-7),P(7,-7),P(-7,7),P(7,7),P(0,-10),P(-6,-8),P(6,-8),P(-8,-6),P(8,-6),P(-10,0),P(10,0),P(-8,6),P(8,6),P(-6,8),P(6,8),P(0,10),\nP(-1,-10),P(1,-10),P(-10,-1),P(10,-1),P(-10,1),P(10,1),P(-1,10),P(1,10),P(-2,-10),P(2,-10),P(-10,-2),P(10,-2),P(-10,2),P(10,2),P(-2,10),P(2,10),P(-5,-9),P(5,-9),P(-9,-5),P(9,-5),P(-9,5),P(9,5),P(-5,9),P(5,9),P(-3,-10),P(3,-10),P(-10,-3),P(10,-3),P(-10,3),P(10,3),P(-3,10),P(3,10),P(-7,-8),P(7,-8),P(-8,-7),P(8,-7),P(-8,7),P(8,7),P(-7,8),P(7,8),P(-4,-10),P(4,-10),P(-10,-4),P(10,-4),P(-10,4),P(10,4),P(-4,10),P(4,10),P(-6,-9),P(6,-9),P(-9,-6),P(9,-6),P(-9,6),P(9,6),P(-6,9),P(6,9),P(0,-11),P(-11,0),P(11,0),P(0,11),\nP(-1,-11),P(1,-11),P(-11,-1),P(11,-1),P(-11,1),P(11,1),P(-1,11),P(1,11),P(-2,-11),P(2,-11),P(-5,-10),P(5,-10),P(-10,-5),P(10,-5),P(-11,-2),P(11,-2),P(-11,2),P(11,2),P(-10,5),P(10,5),P(-5,10),P(5,10),P(-2,11),P(2,11),P(-8,-8),P(8,-8),P(-8,8),P(8,8),P(-3,-11),P(3,-11),P(-7,-9),P(7,-9),P(-9,-7),P(9,-7),P(-11,-3),P(11,-3),P(-11,3),P(11,3),P(-9,7),P(9,7),P(-7,9),P(7,9),P(-3,11),P(3,11),P(-6,-10),P(6,-10),P(-10,-6),P(10,-6),P(-10,6),P(10,6),P(-6,10),P(6,10),P(-4,-11),P(4,-11),P(-11,-4),P(11,-4),P(-11,4),P(11,4),P(-4,11),P(4,11),P(0,-12),P(-12,0),P(12,0),P(0,12),\nP(-1,-12),P(1,-12),P(-8,-9),P(8,-9),P(-9,-8),P(9,-8),P(-12,-1),P(12,-1),P(-12,1),P(12,1),P(-9,8),P(9,8),P(-8,9),P(8,9),P(-1,12),P(1,12),P(-5,-11),P(5,-11),P(-11,-5),P(11,-5),P(-11,5),P(11,5),P(-5,11),P(5,11),P(-2,-12),P(2,-12),P(-12,-2),P(12,-2),P(-12,2),P(12,2),P(-2,12),P(2,12),P(-7,-10),P(7,-10),P(-10,-7),P(10,-7),P(-10,7),P(10,7),P(-7,10),P(7,10),P(-3,-12),P(3,-12),P(-12,-3),P(12,-3),P(-12,3),P(12,3),P(-3,12),P(3,12),P(-6,-11),P(6,-11),P(-11,-6),P(11,-6),P(-11,6),P(11,6),P(-6,11),P(6,11),P(-4,-12),P(4,-12),P(-12,-4),P(12,-4),P(-12,4),P(12,4),P(-4,12),P(4,12),P(-9,-9),P(9,-9),P(-9,9),P(9,9),P(-8,-10),P(8,-10),P(-10,-8),P(10,-8),P(-10,8),P(10,8),P(-8,10),P(8,10),P(0,-13),P(-5,-12),P(5,-12),P(-12,-5),P(12,-5),P(-13,0),P(13,0),P(-12,5),P(12,5),P(-5,12),P(5,12),P(0,13),\nP(-1,-13),P(1,-13),P(-7,-11),P(7,-11),P(-11,-7),P(11,-7),P(-13,-1),P(13,-1),P(-13,1),P(13,1),P(-11,7),P(11,7),P(-7,11),P(7,11),P(-1,13),P(1,13),P(-2,-13),P(2,-13),P(-13,-2),P(13,-2),P(-13,2),P(13,2),P(-2,13),P(2,13),P(-3,-13),P(3,-13),P(-13,-3),P(13,-3),P(-13,3),P(13,3),P(-3,13),P(3,13),P(-6,-12),P(6,-12),P(-12,-6),P(12,-6),P(-12,6),P(12,6),P(-6,12),P(6,12),P(-9,-10),P(9,-10),P(-10,-9),P(10,-9),P(-10,9),P(10,9),P(-9,10),P(9,10),P(-4,-13),P(4,-13),P(-8,-11),P(8,-11),P(-11,-8),P(11,-8),P(-13,-4),P(13,-4),P(-13,4),P(13,4),P(-11,8),P(11,8),P(-8,11),P(8,11),P(-4,13),P(4,13),P(-7,-12),P(7,-12),P(-12,-7),P(12,-7),P(-12,7),P(12,7),P(-7,12),P(7,12),P(-5,-13),P(5,-13),P(-13,-5),P(13,-5),P(-13,5),P(13,5),P(-5,13),P(5,13),P(0,-14),P(-14,0),P(14,0),P(0,14),\nP(-1,-14),P(1,-14),P(-14,-1),P(14,-1),P(-14,1),P(14,1),P(-1,14),P(1,14),P(-2,-14),P(2,-14),P(-10,-10),P(10,-10),P(-14,-2),P(14,-2),P(-14,2),P(14,2),P(-10,10),P(10,10),P(-2,14),P(2,14),P(-9,-11),P(9,-11),P(-11,-9),P(11,-9),P(-11,9),P(11,9),P(-9,11),P(9,11),P(-3,-14),P(3,-14),P(-6,-13),P(6,-13),P(-13,-6),P(13,-6),P(-14,-3),P(14,-3),P(-14,3),P(14,3),P(-13,6),P(13,6),P(-6,13),P(6,13),P(-3,14),P(3,14),P(-8,-12),P(8,-12),P(-12,-8),P(12,-8),P(-12,8),P(12,8),P(-8,12),P(8,12),P(-4,-14),P(4,-14),P(-14,-4),P(14,-4),P(-14,4),P(14,4),P(-4,14),P(4,14),P(-7,-13),P(7,-13),P(-13,-7),P(13,-7),P(-13,7),P(13,7),P(-7,13),P(7,13),P(-5,-14),P(5,-14),P(-10,-11),P(10,-11),P(-11,-10),P(11,-10),P(-14,-5),P(14,-5),P(-14,5),P(14,5),P(-11,10),P(11,10),P(-10,11),P(10,11),P(-5,14),P(5,14),P(0,-15),P(-9,-12),P(9,-12),P(-12,-9),P(12,-9),P(-15,0),P(15,0),P(-12,9),P(12,9),P(-9,12),P(9,12),P(0,15)\n);\nconst int DEFAULT_PATCH_RADIUS = 15;\nconst int MIN_PATCH_RADIUS = 2;\nvoid main()\n{\nvec4 pixel = threadPixel(encodedKeypoints);\nivec2 thread = threadLocation();\nint keypointIndex = thread.x + thread.y * outputSize().x;\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nKeypointAddress address = KeypointAddress(keypointIndex * pixelsPerKeypoint, 0);\nKeypoint keypoint = decodeKeypoint(encodedKeypoints, encoderLength, address);\nvec2 m = vec2(0.0f);\nfloat pot = exp2(keypoint.lod);\nvec2 imageSize = vec2(textureSize(image, 0));\nint scaledRadius = int(ceil(float(DEFAULT_PATCH_RADIUS) / pot));\nint radius = max(scaledRadius, MIN_PATCH_RADIUS);\nint count = diskPointCount[radius];\nfor(int j = 0; j < count; j++) {\nvec2 offset = vec2(diskPoint[j]);\nvec2 position = keypoint.position + round(pot * offset);\nvec4 patchPixel = texture(image, (position + vec2(0.5f)) / imageSize);\nm += offset * patchPixel.g;\n}\nfloat angle = fastAtan2(m.y, m.x);\nfloat encodedOrientation = encodeKeypointOrientation(angle);\ncolor = vec4(0.0f, encodedOrientation, 0.0f, 0.0f);\n}'},7220:e=>{e.exports='@include "keypoints.glsl"\n@include "filters.glsl"\n#if !defined(METHOD)\n#error Undefined METHOD\n#endif\nuniform sampler2D pyramid;\nuniform float lodStep;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\n#if METHOD == 1\nuniform int threshold;\n#endif\nconst float eps = 1e-6;\nfloat cornerStrength(vec2 position, float lod)\n{\n#if METHOD == 0\nreturn laplacian(pyramid, position, lod);\n#elif METHOD == 1\nfloat pot = exp2(lod);\nfloat t = float(clamp(threshold, 0, 255)) / 255.0f;\n#define P(x,y) pyrPixelAtOffset(pyramid, lod, pot, ivec2((x),(y))).g\nmat4 mp = mat4(\nP(0,3),P(3,0),P(0,-3),P(-3,0),\nP(1,3),P(2,2),P(3,1),P(3,-1),\nP(2,-2),P(1,-3),P(-1,-3),P(-2,-2),\nP(-3,-1),P(-3,1),P(-2,2),P(-1,3)\n);\nfloat c = P(0,0);\nfloat ct = c + t, c_t = c - t;\nmat4 mct = mp - mat4(ct,ct,ct,ct,ct,ct,ct,ct,ct,ct,ct,ct,ct,ct,ct,ct);\nmat4 mc_t = mat4(c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t,c_t) - mp;\nconst vec4 zeros = vec4(0.0f), ones = vec4(1.0f);\nvec4 bs = max(mct[0], zeros), ds = max(mc_t[0], zeros);\nbs += max(mct[1], zeros);     ds += max(mc_t[1], zeros);\nbs += max(mct[2], zeros);     ds += max(mc_t[2], zeros);\nbs += max(mct[3], zeros);     ds += max(mc_t[3], zeros);\nreturn max(dot(bs, ones), dot(ds, ones)) / 16.0f;\n#else\n#error Invalid method\n#endif\n}\nvoid main()\n{\nvec4 pixel = threadPixel(encodedKeypoints);\nivec2 thread = threadLocation();\nKeypointAddress address = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\ncolor = pixel;\nif(address.offset != 1)\nreturn;\nKeypoint keypoint = decodeKeypoint(encodedKeypoints, encoderLength, address);\nif(isBadKeypoint(keypoint))\nreturn;\nvec3 strength = vec3(\ncornerStrength(keypoint.position, max(0.0f, keypoint.lod - lodStep)),\ncornerStrength(keypoint.position, keypoint.lod),\ncornerStrength(keypoint.position, keypoint.lod + lodStep)\n);\nvec3 p = mat3(\n2, -3, 1,\n-4, 4, 0,\n2, -1, 0\n) * strength;\nfloat maxStrength = max(strength.x, max(strength.y, strength.z));\nvec3 diffStrength = abs(strength - vec3(maxStrength));\nvec3 strengthIndicators = vec3(lessThan(diffStrength, vec3(eps)));\nfloat maxPoint = min(1.0f, dot(vec3(0.0f, 0.5f, 1.0f), strengthIndicators));\nbool hasMax = p.x < -eps;\nfloat pmax = hasMax ? -0.5f * p.y / p.x : maxPoint;\nfloat alpha = abs(pmax - 0.5f) <= 0.5f ? pmax : maxPoint;\nfloat lodOffset = mix(-lodStep, lodStep, alpha);\nfloat lod = keypoint.lod + lodOffset;\ncolor.r = encodeLod(lod);\n}'},805:e=>{e.exports='@include "float16.glsl"\nuniform sampler2D corners;\nuniform int iterationNumber;\nvoid main()\n{\nivec2 thread = threadLocation();\nivec2 bounds = outputSize();\nint jump = (1 << iterationNumber);\nint clusterLength = jump << 1;\nint clusterMask = clusterLength - 1;\nivec2 clusterPos = ivec2(thread >> (1 + iterationNumber)) << (1 + iterationNumber);\nivec2 next1 = clusterPos + ((thread - clusterPos + ivec2(jump, 0)) & clusterMask);\nivec2 next2 = clusterPos + ((thread - clusterPos + ivec2(0, jump)) & clusterMask);\nivec2 next3 = clusterPos + ((thread - clusterPos + ivec2(jump, jump)) & clusterMask);\nvec4 p0 = threadPixel(corners);\nvec4 p1 = texelFetch(corners, next1 % bounds, 0);\nvec4 p2 = texelFetch(corners, next2 % bounds, 0);\nvec4 p3 = texelFetch(corners, next3 % bounds, 0);\nfloat s0 = decodeFloat16(p0.rb);\nfloat s1 = decodeFloat16(p1.rb);\nfloat s2 = decodeFloat16(p2.rb);\nfloat s3 = decodeFloat16(p3.rb);\nbool b0 = s0 >= s1 && s0 >= s2 && s0 >= s3;\nbool b1 = s1 >= s0 && s1 >= s2 && s1 >= s3;\nbool b2 = s2 >= s0 && s2 >= s1 && s2 >= s3;\ncolor = vec4(0.0f);\ncolor.rb = b0 ? p0.rb : (\nb1 ? p1.rb : (\nb2 ? p2.rb : p3.rb\n)\n);\n}'},8736:e=>{e.exports='@include "keypoints.glsl"\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\n#if PERMUTATION_MAXLEN % 4 > 0 || PERMUTATION_MAXLEN * 4 > 16384\n#error Invalid PERMUTATION_MAXLEN\n#endif\nlayout(std140) uniform Permutation\n{\nivec4 permutation[PERMUTATION_MAXLEN / 4];\n};\nint permutationElement(int index)\n{\nint base = index - (index % PERMUTATION_MAXLEN);\nint offset = index - base;\nivec4 tuple = permutation[offset / 4];\nint newOffset = tuple[offset & 3];\nreturn base + newOffset;\n}\nvoid main()\n{\nivec2 thread = threadLocation();\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nKeypointAddress myAddress = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nint myIndex = findKeypointIndex(myAddress, descriptorSize, extraSize);\nint otherIndex = permutationElement(myIndex);\nKeypointAddress otherAddress = KeypointAddress(otherIndex * pixelsPerKeypoint, myAddress.offset);\nKeypoint myKeypoint = decodeKeypoint(encodedKeypoints, encoderLength, myAddress);\nKeypoint otherKeypoint = decodeKeypoint(encodedKeypoints, encoderLength, otherAddress);\ncolor = readKeypointData(encodedKeypoints, encoderLength, otherAddress);\n}'},9311:e=>{e.exports='@include "keypoints.glsl"\n#if !defined(STAGE)\n#error Undefined STAGE\n#elif STAGE == 1\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\n#elif STAGE == 2\nuniform sampler2D permutation;\nuniform int blockSize;\nuniform int dblLog2BlockSize;\n#elif STAGE == 3\nuniform sampler2D permutation;\nuniform int maxKeypoints;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\n#else\n#error Invalid STAGE\n#endif\nstruct PermutationElement\n{\nint keypointIndex;\nfloat score;\nbool valid;\n};\nvec4 encodePermutationElement(PermutationElement element)\n{\nconst vec2 ONES = vec2(1.0f);\nvec2 encodedScore = element.valid ? encodeFloat16(element.score) : ONES;\nvec2 encodedIndex = vec2(element.keypointIndex & 255, (element.keypointIndex >> 8) & 255) / 255.0f;\nreturn vec4(encodedIndex, encodedScore);\n}\nPermutationElement decodePermutationElement(vec4 pixel)\n{\nconst vec2 ONES = vec2(1.0f);\nPermutationElement element;\nelement.keypointIndex = int(pixel.r * 255.0f) | (int(pixel.g * 255.0f) << 8);\nelement.valid = !all(equal(pixel.ba, ONES));\nelement.score = element.valid ? decodeFloat16(pixel.ba) : -1.0f;\nreturn element;\n}\nPermutationElement readPermutationElement(sampler2D permutation, int elementIndex, int stride, int height)\n{\nconst vec4 INVALID_PIXEL = vec4(1.0f);\nivec2 pos = ivec2(elementIndex % stride, elementIndex / stride);\nvec4 pixel = pos.y < height ? pixelAt(permutation, pos) : INVALID_PIXEL;\nreturn decodePermutationElement(pixel);\n}\n#if STAGE == 2\nPermutationElement selectKth(sampler2D permutation, int k, int la, int ra, int lb, int rb)\n{\nfloat scoreA, scoreB;\nint ha, hb, ma, mb;\nbool discard1stHalf, altb;\nbool locked = false;\nint tmp, result = 0;\nint stride = outputSize().x;\nint height = outputSize().y;\nfor(int i = 0; i < dblLog2BlockSize; i++) {\ntmp = (lb > rb && !locked) ? (la+k) : result;\nresult = (la > ra && !locked) ? (lb+k) : tmp;\nlocked = locked || (la > ra) || (lb > rb);\nha = (ra - la + 1) / 2;\nhb = (rb - lb + 1) / 2;\nma = la + ha;\nmb = lb + hb;\nscoreA = readPermutationElement(permutation, ma, stride, height).score;\nscoreB = readPermutationElement(permutation, mb, stride, height).score;\ndiscard1stHalf = (k > ha + hb);\naltb = (-scoreA < -scoreB);\nk -= int(discard1stHalf && altb) * (ha + 1);\nk -= int(discard1stHalf && !altb) * (hb + 1);\nla += int(discard1stHalf && altb) * (ma + 1 - la);\nlb += int(discard1stHalf && !altb) * (mb + 1 - lb);\nra += int(!discard1stHalf && !altb) * (ma - 1 - ra);\nrb += int(!discard1stHalf && altb) * (mb - 1 - rb);\n}\nreturn readPermutationElement(permutation, result, stride, height);\n}\n#endif\nvoid main()\n{\n#if STAGE == 1\nivec2 thread = threadLocation();\nint stride = outputSize().x;\nint keypointIndex = thread.y * stride + thread.x;\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nKeypointAddress address = KeypointAddress(keypointIndex * pixelsPerKeypoint, 0);\nKeypoint keypoint = decodeKeypoint(encodedKeypoints, encoderLength, address);\nPermutationElement element;\nelement.keypointIndex = keypointIndex;\nelement.score = keypoint.score;\nelement.valid = !isBadKeypoint(keypoint);\ncolor = encodePermutationElement(element);\n#elif STAGE == 2\nivec2 thread = threadLocation();\nint stride = outputSize().x;\nint elementIndex = thread.y * stride + thread.x;\nint blockIndex = elementIndex / blockSize;\nint blockOffset = elementIndex % blockSize;\nint la = blockIndex * blockSize;\nint lb = la + blockSize / 2;\nint ra = lb - 1;\nint rb = (blockIndex + 1) * blockSize - 1;\nint k = blockOffset;\nPermutationElement element = selectKth(permutation, k, la, ra, lb, rb);\ncolor = encodePermutationElement(element);\n#elif STAGE == 3\nivec2 thread = threadLocation();\nint newEncoderLength = outputSize().x;\nKeypointAddress myAddress = findKeypointAddress(thread, newEncoderLength, descriptorSize, extraSize);\nint myKeypointIndex = findKeypointIndex(myAddress, descriptorSize, extraSize);\nivec2 psize = textureSize(permutation, 0);\nPermutationElement element = readPermutationElement(permutation, myKeypointIndex, psize.x, psize.y);\nint oldEncoderLength = textureSize(encodedKeypoints, 0).x;\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nKeypointAddress address = KeypointAddress(element.keypointIndex * pixelsPerKeypoint, myAddress.offset);\nvec4 keypointData = readKeypointData(encodedKeypoints, oldEncoderLength, address);\ncolor = myKeypointIndex < maxKeypoints && element.valid ? keypointData : encodeNullKeypoint();\n#endif\n}'},9423:e=>{e.exports='@include "keypoints.glsl"\n@include "float16.glsl"\n#if !defined(METHOD)\n#error Must define METHOD\n#endif\nuniform sampler2D pyramid;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\nuniform int maxIterations;\nuniform float epsilon;\nconst int PATCH_RADIUS = 1;\nconst int PATCH_SIZE = 2 * PATCH_RADIUS + 1;\nconst int PATCH_SIZE_SQUARED = PATCH_SIZE * PATCH_SIZE;\nconst int LARGE_PATCH_RADIUS = PATCH_RADIUS + 1;\nconst int LARGE_PATCH_SIZE = 2 * LARGE_PATCH_RADIUS + 1;\nconst int LARGE_PATCH_SIZE_SQUARED = LARGE_PATCH_SIZE * LARGE_PATCH_SIZE;\nconst int LARGER_PATCH_RADIUS = LARGE_PATCH_RADIUS + 1;\nconst int LARGER_PATCH_SIZE = 2 * LARGER_PATCH_RADIUS + 1;\nconst int LARGER_PATCH_SIZE_SQUARED = LARGER_PATCH_SIZE * LARGER_PATCH_SIZE;\nconst float EPS = 1e-5;\nfloat smoothPixelBuffer[LARGER_PATCH_SIZE_SQUARED];\nvec2 derivativesBuffer[LARGE_PATCH_SIZE_SQUARED];\nfloat responseBuffer[PATCH_SIZE_SQUARED];\n#define patchPixelAt(u,v) smoothPixelBuffer[((v) + LARGER_PATCH_RADIUS) * LARGER_PATCH_SIZE + ((u) + LARGER_PATCH_RADIUS)]\n#define derivativesAt(u,v) derivativesBuffer[((v) + LARGE_PATCH_RADIUS) * LARGE_PATCH_SIZE + ((u) + LARGE_PATCH_RADIUS)]\n#define responseAt(u,v) responseBuffer[((v) + PATCH_RADIUS) * PATCH_SIZE + ((u) + PATCH_RADIUS)]\nvoid readPixels(vec2 center, float lod)\n{\nivec2 pyrBaseSize = textureSize(pyramid, 0);\nfloat pot = exp2(lod);\nint u, v;\nfor(int j = 0; j < LARGER_PATCH_SIZE; j++) {\nfor(int i = 0; i < LARGER_PATCH_SIZE; i++) {\nu = i - LARGER_PATCH_RADIUS;\nv = j - LARGER_PATCH_RADIUS;\npatchPixelAt(u,v) = pyrSubpixelAtExOffset(pyramid, center, lod, pot, ivec2(u,v), pyrBaseSize).g;\n}\n}\n}\nvoid computeDerivatives()\n{\nconst mat3 dx = mat3(\n-1, 0, 1,\n-2, 0, 2,\n-1, 0, 1\n);\nconst mat3 dy = mat3(\n1, 2, 1,\n0, 0, 0,\n-1,-2,-1\n);\nint u, v;\nmat3 pix, convX, convY;\nconst vec3 ones = vec3(1.0f);\nfor(int j = 0; j < LARGE_PATCH_SIZE; j++) {\nfor(int i = 0; i < LARGE_PATCH_SIZE; i++) {\nu = i - LARGE_PATCH_RADIUS;\nv = j - LARGE_PATCH_RADIUS;\npix = mat3(\npatchPixelAt(u+1,v+1), patchPixelAt(u+0,v+1), patchPixelAt(u-1,v+1),\npatchPixelAt(u+1,v+0), patchPixelAt(u+0,v+0), patchPixelAt(u-1,v+0),\npatchPixelAt(u+1,v-1), patchPixelAt(u+0,v-1), patchPixelAt(u-1,v-1)\n);\nconvX = matrixCompMult(dx, pix);\nconvY = matrixCompMult(dy, pix);\nderivativesAt(u,v) = vec2(\ndot(ones, vec3(\ndot(convX[0], ones),\ndot(convX[1], ones),\ndot(convX[2], ones)\n)),\ndot(ones, vec3(\ndot(convY[0], ones),\ndot(convY[1], ones),\ndot(convY[2], ones)\n))\n);\n}\n}\n}\nvec2 computeResponseMap()\n{\nfloat patchArea = float(PATCH_SIZE * PATCH_SIZE);\nvec3 h; vec2 d, c = vec2(0.0f);\nconst vec3 ones = vec3(1.0f);\nfloat response, sum = 0.0f;\nint u, v;\n#define H(r,s) d = derivativesAt((r),(s)); h += vec3(d.x * d.x, d.x * d.y, d.y * d.y)\nfor(int j = 0; j < PATCH_SIZE; j++) {\nfor(int i = 0; i < PATCH_SIZE; i++) {\nu = i - PATCH_RADIUS;\nv = j - PATCH_RADIUS;\nh = vec3(0.0f);\nH(u-1,v-1); H(u+0,v-1); H(u+1,v-1);\nH(u-1,v+0); H(u+0,v+0); H(u+1,v+0);\nH(u-1,v+1); H(u+0,v+1); H(u+1,v+1);\nresponse = 0.5f * (h.x + h.z - sqrt((h.x - h.z) * (h.x - h.z) + 4.0f * h.y * h.y));\nresponse /= patchArea;\nresponseAt(u,v) = response;\nc += vec2(u,v) * response;\nsum += response;\n}\n}\nreturn abs(sum) > EPS ? c / sum : vec2(0.0f);\n}\n#if METHOD == 0\nvec2 quadratic1d()\n{\nfloat a = 0.5f * (responseAt(-1,0) - 2.0f * responseAt(0,0) + responseAt(1,0));\nfloat b = 0.5f * (responseAt(1,0) - responseAt(-1,0));\nfloat c = responseAt(0,0);\nfloat d = 0.5f * (responseAt(0,-1) - 2.0f * responseAt(0,0) + responseAt(0,1));\nfloat e = 0.5f * (responseAt(0,1) - responseAt(0,-1));\nfloat f = responseAt(0,0);\nbool hasMax = a < -EPS && d < -EPS;\nreturn hasMax ? -0.5f * vec2(b / a, e / d) : vec2(0.0f);\n}\n#endif\n#if METHOD == 1\nvec2 taylor2d()\n{\nfloat dx = (-responseAt(-1,0) + responseAt(1,0)) * 0.5f;\nfloat dy = (-responseAt(0,-1) + responseAt(0,1)) * 0.5f;\nfloat dxx = responseAt(-1,0) - 2.0f * responseAt(0,0) + responseAt(1,0);\nfloat dyy = responseAt(0,-1) - 2.0f * responseAt(0,0) + responseAt(0,1);\nfloat dxy = (responseAt(-1,-1) + responseAt(1,1) - responseAt(1,-1) - responseAt(-1,1)) * 0.25f;\nfloat det = dxx * dyy - dxy * dxy;\nmat2 inv = mat2(dyy, -dxy, -dxy, dxx);\nbool hasMax = det > EPS && dxx < 0.0f;\nreturn hasMax ? inv * vec2(dx, dy) / (-det) : vec2(0.0f);\n}\n#endif\n#if METHOD == 2\nvoid bilinearUpsample(ivec2 patchOffset, vec4 pixelsOfPatch)\n{\nint u, v, i, j;\nvec2 frc, ifrc; vec4 sub;\nconst vec4 ones = vec4(1.0f);\nfloat s = 1.0f / float(PATCH_SIZE - 1);\nint xoff = 2 * patchOffset.x;\nint yoff = 2 * patchOffset.y;\nfor(j = 0; j < PATCH_SIZE; j++) {\nfor(i = 0; i < PATCH_SIZE; i++) {\nu = i - PATCH_RADIUS;\nv = j - PATCH_RADIUS;\nfrc = vec2(i, j) * s;\nifrc = vec2(1.0f) - frc;\nsub = vec4(\nifrc.x * ifrc.y,\nfrc.x * ifrc.y,\nifrc.x * frc.y,\nfrc.x * frc.y\n);\npatchPixelAt(u+xoff,v+yoff) = dot(sub*pixelsOfPatch, ones);\n}\n}\n}\n#endif\n#if METHOD == 3\nvoid bicubicUpsample(ivec2 patchOffset, vec4 pixelsOfPatch, vec4 dx, vec4 dy, vec4 dxy)\n{\nfloat x, y, s = 1.0f / float(PATCH_SIZE - 1);\nint u, v, i, j;\nfloat f00 = pixelsOfPatch.x;\nfloat f10 = pixelsOfPatch.y;\nfloat f01 = pixelsOfPatch.z;\nfloat f11 = pixelsOfPatch.w;\nfloat fx00 = dx.x;\nfloat fx10 = dx.y;\nfloat fx01 = dx.z;\nfloat fx11 = dx.w;\nfloat fy00 = dy.x;\nfloat fy10 = dy.y;\nfloat fy01 = dy.z;\nfloat fy11 = dy.w;\nfloat fxy00 = dxy.x;\nfloat fxy10 = dxy.y;\nfloat fxy01 = dxy.z;\nfloat fxy11 = dxy.w;\nmat4 bicubic = mat4(\n1, 0, -3, 2,\n0, 0, 3, -2,\n0, 1, -2, 1,\n0, 0, -1, 1\n) * mat4(\nf00, f10, fx00, fx10,\nf01, f11, fx01, fx11,\nfy00, fy10, fxy00, fxy10,\nfy01, fy11, fxy01, fxy11\n) * mat4(\n1, 0, 0, 0,\n0, 0, 1, 0,\n-3, 3, -2, -1,\n2, -2, 1, 1\n);\nint xoff = 2 * patchOffset.x;\nint yoff = 2 * patchOffset.y;\nfor(j = 0; j < PATCH_SIZE; j++) {\nfor(i = 0; i < PATCH_SIZE; i++) {\nu = i - PATCH_RADIUS;\nv = j - PATCH_RADIUS;\nx = float(i) * s;\ny = float(j) * s;\npatchPixelAt(u+xoff,v+yoff) = dot(\nvec4(1, x, x*x, x*x*x),\nbicubic * vec4(1, y, y*y, y*y*y)\n);\n}\n}\n}\n#endif\n#if METHOD == 2 || METHOD == 3\nvoid upsamplePatch(int left, int top, int right, int bottom)\n{\nint x, y, k;\nvec4 ptch[9];\nvec2 d00, d10, d01, d11;\nfor(k = 0; k < 9; k++) {\nx = -1 + (k % 3);\ny = -1 + (k / 3);\nptch[k] = vec4(\npatchPixelAt(left+x, top+y),\npatchPixelAt(right+x, top+y),\npatchPixelAt(left+x, bottom+y),\npatchPixelAt(right+x, bottom+y)\n);\n}\nfor(k = 0; k < 9; k++) {\nx = -1 + (k % 3);\ny = -1 + (k / 3);\n#if METHOD == 2\nbilinearUpsample(ivec2(x, y), ptch[k]);\n#elif METHOD == 3\nd00 = derivativesAt(left+x, top+y);\nd10 = derivativesAt(right+x, top+y);\nd01 = derivativesAt(left+x, bottom+y);\nd11 = derivativesAt(right+x, bottom+y);\nbicubicUpsample(ivec2(x, y), ptch[k],\nvec4(d00.x, d10.x, d01.x, d11.x),\nvec4(d00.y, d10.y, d01.y, d11.y),\n0.25f * vec4(\n(patchPixelAt(left+x + 1,top+y + 1) + patchPixelAt(left+x - 1, top+y - 1)) - (patchPixelAt(left+x + 1, top+y - 1) + patchPixelAt(left+x - 1, top+y + 1)),\n(patchPixelAt(right+x + 1,top+y + 1) + patchPixelAt(right+x - 1, top+y - 1)) - (patchPixelAt(right+x + 1, top+y - 1) + patchPixelAt(right+x - 1, top+y + 1)),\n(patchPixelAt(left+x + 1,bottom+y + 1) + patchPixelAt(left+x - 1, bottom+y - 1)) - (patchPixelAt(left+x + 1, bottom+y - 1) + patchPixelAt(left+x - 1, bottom+y + 1)),\n(patchPixelAt(right+x + 1,bottom+y + 1) + patchPixelAt(right+x - 1, bottom+y - 1)) - (patchPixelAt(right+x + 1, bottom+y - 1) + patchPixelAt(right+x - 1, bottom+y + 1))\n)\n);\n#endif\n}\n}\nvec2 upsampleResponseMap(int left, int top, int right, int bottom)\n{\nupsamplePatch(left, top, right, bottom);\ncomputeDerivatives();\nreturn computeResponseMap();\n}\nvec2 iterativeUpsample(vec2 initialGuess)\n{\nint refine = 1;\nfloat scale = 0.5f;\nfloat eps2 = epsilon * epsilon;\nvec2 guess = initialGuess, localGuess = initialGuess;\nfor(int k = 0; k < maxIterations; k++) {\nivec4 quad = ivec4(floor(localGuess.x), floor(localGuess.y), ceil(localGuess.x), ceil(localGuess.y));\nvec2 response = (refine != 0) ? upsampleResponseMap(quad.x, quad.y, quad.z, quad.w) : vec2(0.0f);\nlocalGuess = response * scale;\nguess += localGuess;\nscale *= 0.5f;\nrefine *= int(dot(localGuess, localGuess) >= eps2);\n}\nreturn guess;\n}\n#endif\nvoid main()\n{\nivec2 thread = threadLocation();\nint keypointIndex = thread.x + thread.y * outputSize().x;\nint pixelsPerKeypoint = sizeofEncodedKeypoint(descriptorSize, extraSize) / 4;\nKeypointAddress address = KeypointAddress(keypointIndex * pixelsPerKeypoint, 0);\nKeypoint keypoint = decodeKeypoint(encodedKeypoints, encoderLength, address);\ncolor = encodeNullPairOfFloat16();\nif(isNullKeypoint(keypoint))\nreturn;\ncolor = encodeDiscardedPairOfFloat16();\nif(isBadKeypoint(keypoint))\nreturn;\nreadPixels(keypoint.position, keypoint.lod);\ncomputeDerivatives();\nvec2 offset = computeResponseMap();\n#if METHOD == 0\noffset = quadratic1d();\n#elif METHOD == 1\noffset = taylor2d();\n#elif METHOD == 2 || METHOD == 3\noffset = iterativeUpsample(offset);\n#else\n#error Unknown METHOD\n#endif\nfloat pot = exp2(keypoint.lod);\ncolor = encodePairOfFloat16(offset * pot);\n}'},2060:e=>{e.exports='@include "keypoints.glsl"\n@include "float16.glsl"\nuniform sampler2D encodedFlow;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\nvoid main()\n{\nvec4 pixel = threadPixel(encodedKeypoints);\nivec2 thread = threadLocation();\nint len = textureSize(encodedFlow, 0).x;\nKeypointAddress myAddress = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nKeypoint keypoint = decodeKeypoint(encodedKeypoints, encoderLength, myAddress);\nint myIndex = findKeypointIndex(myAddress, descriptorSize, extraSize);\ncolor = pixel;\nif(isBadKeypoint(keypoint))\nreturn;\nivec2 location = ivec2(myIndex % len, myIndex / len);\nvec4 encodedFlow = myIndex < len * len ? pixelAt(encodedFlow, location) : encodeDiscardedKeypoint();\nbool discardFlow = isDiscardedPairOfFloat16(encodedFlow);\nvec2 flow = !discardFlow ? decodePairOfFloat16(encodedFlow) : vec2(0.0f);\nvec4 newPosition = encodeKeypointPosition(keypoint.position + flow);\nvec4 newPixel = myAddress.offset == 0 ? newPosition : pixel;\ncolor = !discardFlow ? newPixel : encodeDiscardedKeypoint();\n}'},5463:e=>{e.exports='@include "keypoints.glsl"\nuniform sampler2D encodedOrientations;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\nvoid main()\n{\nvec4 pixel = threadPixel(encodedKeypoints);\nivec2 thread = threadLocation();\nKeypointAddress myAddress = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nint myIndex = findKeypointIndex(myAddress, descriptorSize, extraSize);\nint orientationEncoderLength = textureSize(encodedOrientations, 0).x;\nivec2 location = ivec2(myIndex % orientationEncoderLength, myIndex / orientationEncoderLength);\nvec4 targetPixel = pixelAt(encodedOrientations, location);\nKeypoint keypoint = decodeKeypoint(encodedKeypoints, encoderLength, myAddress);\nbool isValid = !isBadKeypoint(keypoint);\nfloat encodedOrientation = targetPixel.g;\ncolor = isValid && myAddress.offset == 1 ? vec4(pixel.r, encodedOrientation, pixel.ba) : pixel;\n}'},6986:e=>{e.exports='@include "keypoints.glsl"\nuniform sampler2D encodedData;\nuniform int strideOfEncodedData;\nuniform sampler2D encodedKeypoints;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\nvec4 readEncodedData(sampler2D encodedData, int strideOfEncodedData, int elementId, int pixelsPerElement, int pixelOffset)\n{\nint rasterIndex = elementId * pixelsPerElement + pixelOffset;\nivec2 pos = ivec2(rasterIndex % strideOfEncodedData, rasterIndex / strideOfEncodedData);\nreturn texelFetch(encodedData, pos, 0);\n}\nvoid main()\n{\nivec2 thread = threadLocation();\nKeypointAddress myAddress = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nint myIndex = findKeypointIndex(myAddress, descriptorSize, extraSize);\nint headerSize = sizeofEncodedKeypointHeader();\nint extraCell = myAddress.offset - headerSize / 4;\nint numberOfExtraCells = extraSize / 4;\ncolor = threadPixel(encodedKeypoints);\nif(extraCell < 0 || extraCell >= numberOfExtraCells)\nreturn;\nKeypoint keypoint = decodeKeypoint(encodedKeypoints, encoderLength, myAddress);\nif(isBadKeypoint(keypoint))\nreturn;\ncolor = readEncodedData(encodedData, strideOfEncodedData, myIndex, numberOfExtraCells, extraCell);\n}'},3179:e=>{e.exports='@include "keypoints.glsl"\nuniform sampler2D encodedKeypoints;\nuniform int startIndex;\nuniform int endIndex;\nuniform int descriptorSize;\nuniform int extraSize;\nuniform int encoderLength;\n#ifndef BUFFER_SIZE\n#error Undefined BUFFER_SIZE\n#endif\nlayout(std140) uniform KeypointBuffer\n{\nvec4 keypointBuffer[BUFFER_SIZE];\n};\nvoid main()\n{\nvec4 pixel = threadPixel(encodedKeypoints);\nivec2 thread = threadLocation();\nKeypointAddress address = findKeypointAddress(thread, encoderLength, descriptorSize, extraSize);\nint index = findKeypointIndex(address, descriptorSize, extraSize);\ncolor = pixel;\nif(index < startIndex)\nreturn;\ncolor = encodeNullKeypoint();\nif(index >= endIndex)\nreturn;\nvec4 data = keypointBuffer[index - startIndex];\nswitch(address.offset) {\ncase 0: {\ncolor = encodeKeypointPosition(data.xy);\nbreak;\n}\ncase 1: {\nvec2 score = encodeKeypointScore(max(data.w, 0.0f));\nfloat scale = encodeLod(data.z);\nfloat rotation = encodeKeypointOrientation(0.0f);\ncolor = vec4(scale, rotation, score);\nbreak;\n}\ndefault: {\ncolor = vec4(0.0f);\nbreak;\n}\n}\n}'},8680:e=>{e.exports="uniform sampler2D image;\nvoid main()\n{\n#if 1\ncolor = texture(image, texCoord);\n#else\nivec2 thread = threadLocation();\nivec2 pos = min(thread * 2, textureSize(image, 0) - ivec2(1));\ncolor = pixelAt(image, pos);\n#endif\n}"},3384:e=>{e.exports="uniform sampler2D image;\nvoid main()\n{\nivec2 thread = threadLocation();\nvec4 pixel = pixelAt(image, thread / 2);\ncolor = (((thread.x + thread.y) & 1) == 0) ? pixel : vec4(0.0f, 0.0f, 0.0f, pixel.a);\n}"},1976:e=>{e.exports='@include "subpixel.glsl"\nuniform sampler2D image0;\nuniform sampler2D image1;\nuniform float alpha;\nuniform float beta;\nuniform float gamma;\nconst vec4 BACKGROUND = vec4(0.0f);\nvoid main()\n{\nivec2 location = threadLocation();\nivec2 size0 = textureSize(image0, 0);\nivec2 size1 = textureSize(image1, 0);\nvec4 pix0 = all(lessThan(location, size0)) ? pixelAt(image0, location) : BACKGROUND;\nvec4 pix1 = all(lessThan(location, size1)) ? pixelAt(image1, location) : BACKGROUND;\nvec4 pix = clamp(alpha * pix0 + beta * pix1 + vec4(gamma), 0.0f, 1.0f);\ncolor = vec4(pix.rgb, 1.0f);\n}'},4543:e=>{e.exports='@include "subpixel.glsl"\nuniform sampler2D image;\nvoid main()\n{\nvec2 imageSize = vec2(textureSize(image, 0));\n#if !defined(INTERPOLATION_METHOD)\n#error Must define INTERPOLATION_METHOD\n#elif INTERPOLATION_METHOD == 0\nvec2 pos = texCoord * imageSize;\ncolor = textureLod(image, (round(pos) + vec2(0.5f)) / imageSize, 0.0f);\n#elif INTERPOLATION_METHOD == 1\ncolor = subpixelAtBI(image, texCoord * imageSize);\n#else\n#error Invalid INTERPOLATION_METHOD\n#endif\n}'},6296:e=>{e.exports='@include "subpixel.glsl"\nuniform sampler2D image;\nuniform mat3 inverseHomography;\nconst vec4 emptyColor = vec4(0.0f, 0.0f, 0.0f, 1.0f);\nvec2 perspectiveWarp(mat3 homography, vec2 p)\n{\nvec3 q = homography * vec3(p, 1.0f);\nreturn q.xy / q.z;\n}\nvoid main()\n{\nivec2 location = threadLocation();\nivec2 size = outputSize();\nconst vec2 zero = vec2(0.0f);\nvec2 target = perspectiveWarp(inverseHomography, vec2(location));\nbool withinBounds = all(bvec4(greaterThanEqual(target, zero), lessThan(target, vec2(size))));\ncolor = withinBounds ? subpixelAtBI(image, target) : emptyColor;\n}'},747:e=>{e.exports='@include "colors.glsl"\nuniform sampler2D dest, src;\nuniform int destComponents;\nuniform int srcComponentId;\nvoid main()\n{\nvec4 destPixel = threadPixel(dest);\nvec4 srcPixel = threadPixel(src);\nbvec4 flags = bvec4(\n(destComponents & PIXELCOMPONENT_RED) != 0,\n(destComponents & PIXELCOMPONENT_GREEN) != 0,\n(destComponents & PIXELCOMPONENT_BLUE) != 0,\n(destComponents & PIXELCOMPONENT_ALPHA) != 0\n);\ncolor = mix(destPixel, vec4(srcPixel[srcComponentId]), flags);\n}'},9176:e=>{e.exports='#if !defined(TYPE)\n#error Undefined TYPE\n#elif TYPE == 1\n@include "keypoints.glsl"\n#define nullPixel() encodeNullKeypoint()\n#elif TYPE == 2\n@include "float16.glsl"\n#define nullPixel() encodeNullPairOfFloat16()\n#else\n#error Invalid TYPE\n#endif\nuniform sampler2D image;\nvoid main()\n{\nivec2 thread = threadLocation();\nivec2 imageSize = textureSize(image, 0);\nint rasterIndex = thread.y * outputSize().x + thread.x;\nbool isValidPixel = rasterIndex < imageSize.x * imageSize.y;\nivec2 pos = ivec2(rasterIndex % imageSize.x, rasterIndex / imageSize.x);\nvec4 nullpix = nullPixel();\ncolor = isValidPixel ? texelFetch(image, pos, 0) : nullpix;\n}'},8960:e=>{e.exports="uniform sampler2D image;\nvoid main()\n{\ncolor = threadPixel(image);\n}"},3294:e=>{e.exports='@include "colors.glsl"\nuniform sampler2D image;\nuniform int pixelComponents;\nuniform float value;\nvoid main()\n{\nvec4 pixel = threadPixel(image);\nbvec4 flags = bvec4(\n(pixelComponents & PIXELCOMPONENT_RED) != 0,\n(pixelComponents & PIXELCOMPONENT_GREEN) != 0,\n(pixelComponents & PIXELCOMPONENT_BLUE) != 0,\n(pixelComponents & PIXELCOMPONENT_ALPHA) != 0\n);\ncolor = mix(pixel, vec4(value), flags);\n}'},1959:e=>{e.exports="uniform float value;\nvoid main()\n{\ncolor = vec4(value);\n}"},7290:e=>{e.exports="void vsmain()\n{\ngl_Position *= vec4(1,-1,1,1);\n}"},7270:e=>{e.exports="uniform sampler2D image;\nuniform int iterationNumber;\nvoid main()\n{\nivec2 thread = threadLocation();\nivec2 last = outputSize() - ivec2(1);\nint jump = (1 << iterationNumber);\nint clusterLength = jump << 1;\nint clusterMask = clusterLength - 1;\nivec2 clusterPos = ivec2(thread >> (1 + iterationNumber)) << (1 + iterationNumber);\nivec2 next1 = clusterPos + ((thread - clusterPos + ivec2(jump, 0)) & clusterMask);\nivec2 next2 = clusterPos + ((thread - clusterPos + ivec2(0, jump)) & clusterMask);\nivec2 next3 = clusterPos + ((thread - clusterPos + ivec2(jump, jump)) & clusterMask);\nvec4 p0 = texelFetch(image, thread, 0);\nvec4 p1 = texelFetch(image, min(next1, last), 0);\nvec4 p2 = texelFetch(image, min(next2, last), 0);\nvec4 p3 = texelFetch(image, min(next3, last), 0);\nvec4 pmax = max(max(p0, p1), max(p2, p3));\nvec4 pmin = min(min(p0, p1), min(p2, p3));\ncolor = vec4(pmax.r, pmin.g, pmax.r - pmin.g, p0.a);\n}"},48:e=>{e.exports='@include "pyramids.glsl"\n@include "float16.glsl"\nuniform sampler2D pyramid;\nuniform float lod;\n#define USE_VARYINGS 1\nin vec2 v_pix0, v_pix1, v_pix2,\nv_pix3, v_pix4, v_pix5,\nv_pix6, v_pix7, v_pix8;\nconst mat3 hkern = mat3(\n1.0f, 0.0f,-1.0f,\n2.0f, 0.0f,-2.0f,\n1.0f, 0.0f,-1.0f\n), vkern = mat3(\n1.0f, 2.0f, 1.0f,\n0.0f, 0.0f, 0.0f,\n-1.0f,-2.0f,-1.0f\n);\n#define PIX(x,y) pyrPixelAtOffset(pyramid, lod, pot, ivec2((x),(y))).g\n#define XIP(v) textureLod(pyramid, (v), lod).g\nvoid main()\n{\nconst vec3 ones = vec3(1.0f);\nfloat pot = exp2(lod);\nmat3 win = mat3(\n#if USE_VARYINGS\nXIP(v_pix0), XIP(v_pix1), XIP(v_pix2),\nXIP(v_pix3), XIP(v_pix4), XIP(v_pix5),\nXIP(v_pix6), XIP(v_pix7), XIP(v_pix8)\n#else\nPIX(-1,-1), PIX(0,-1), PIX(1,-1),\nPIX(-1,0), PIX(0,0), PIX(1,0),\nPIX(-1,1), PIX(0,1), PIX(1,1)\n#endif\n);\nmat3 dx = matrixCompMult(hkern, win);\nmat3 dy = matrixCompMult(vkern, win);\nvec2 df = vec2(\ndot(dx[0] + dx[1] + dx[2], ones),\ndot(dy[0] + dy[1] + dy[2], ones)\n);\ncolor = encodePairOfFloat16(df);\n}'},3713:e=>{e.exports="uniform mediump float lod;\nout vec2 v_pix0, v_pix1, v_pix2,\nv_pix3, v_pix4, v_pix5,\nv_pix6, v_pix7, v_pix8;\n#define PIX(x,y) (texCoord + ((pot) * vec2((x),(y))) / texSize)\nvoid vsmain()\n{\nfloat pot = exp2(lod);\nv_pix0 = PIX(-1,-1); v_pix1 = PIX(0,-1); v_pix2 = PIX(1,-1);\nv_pix3 = PIX(-1,0); v_pix4 = PIX(0,0); v_pix5 = PIX(1,0);\nv_pix6 = PIX(-1,1); v_pix7 = PIX(0,1); v_pix8 = PIX(1,1);\n}"},4209:e=>{e.exports="AGFzbQEAAAABiwETYAABfmADf39/AX9gAX8AYAN/f38AYAF9AX9gAX8Bf2ACf38Bf2AFf39/f38B\nf2AFf39/f38AYAZ/f39/f38Bf2AAAX9gAn99AX9gA39/fQF/YAJ/fwF9YAF/AX1gBH9/f38AYAR/\nf39/AX9gEX98fHx8fHx8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mxlIGZyZWUgYXQgcmFuc2FjMzIu\nYzoyNDYARG91YmxlIGZyZWUgYXQgcmFuc2FjMzIuYzoyNDkAQXNzZXJ0aW9uIGZhaWxlZCBhdCBy\nYW5zYWMzMi5jOjI3NQBPdXQgb2YgbWVtb3J5IGF0IHJhbnNhYzMyLmM6Mjg4AE91dCBvZiBtZW1v\ncnkgYXQgcmFuc2FjMzIuYzoyOTIAT3V0IG9mIG1lbW9yeSBhdCByYW5zYWMzMi5jOjI5NwBPdXQg\nb2YgbWVtb3J5IGF0IHJhbnNhYzMyLmM6MzExAERvdWJsZSBmcmVlIGF0IHJhbnNhYzMyLmM6NDM2\nAERvdWJsZSBmcmVlIGF0IHJhbnNhYzMyLmM6NDQzAERvdWJsZSBmcmVlIGF0IHJhbnNhYzMyLmM6\nNDQ2AERvdWJsZSBmcmVlIGF0IHJhbnNhYzMyLmM6NDQ5AEFzc2VydGlvbiBmYWlsZWQgYXQgdHJh\nbnNmb3JtMzIuYzozOQBBc3NlcnRpb24gZmFpbGVkIGF0IHRyYW5zZm9ybTMyLmM6NzcAQXNzZXJ0\naW9uIGZhaWxlZCBhdCB0cmFuc2Zvcm0zMi5jOjExNAAAQbQaCwwIAAAAUA0AAAEAAAAAQcAaCyQA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\n"}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";n.d(i,{default:()=>Zi});var e=n(7905),t=n(5484),o=n(3841),s=n(3020);class r{constructor(e,t,n,i=e.RGBA,o=e.RGBA8,s=e.UNSIGNED_BYTE,A=e.NEAREST,a=e.MIRRORED_REPEAT){this._gl=e,this._width=Math.max(1,0|t),this._height=Math.max(1,0|n),this._hasMipmaps=!1,this._format=i,this._internalFormat=o,this._dataType=s,this._filter=A,this._wrap=a,this._glTexture=r._createTexture(this._gl,this._width,this._height,this._format,this._internalFormat,this._dataType,this._filter,this._wrap)}release(){const e=this._gl;if(null==this._glTexture)throw new o.js("The SpeedyTexture has already been released");return this.discardMipmaps(),e.deleteTexture(this._glTexture),this._glTexture=null,this._width=this._height=0,null}upload(e,n=this._width,i=this._height){const o=this._gl;return t.c.assert(n>0&&i>0),this.discardMipmaps(),this._width=n,this._height=i,this._internalFormat=o.RGBA8,this._format=o.RGBA,this._dataType=o.UNSIGNED_BYTE,r._upload(o,this._glTexture,this._width,this._height,e,0,this._format,this._internalFormat,this._dataType),this}clear(){const e=this._gl;return e.isContextLost()||(e.bindTexture(e.TEXTURE_2D,this._glTexture),e.texImage2D(e.TEXTURE_2D,0,this._internalFormat,this._width,this._height,0,this._format,this._dataType,null),e.bindTexture(e.TEXTURE_2D,null),this.discardMipmaps()),this}resize(e,t){const n=this._gl;if(this._width===e&&this._height===t)return this;if(t|=0,(e|=0)>s.MAX_TEXTURE_LENGTH||t>s.MAX_TEXTURE_LENGTH)throw new o.B8(`Maximum texture size exceeded. Using ${e} x ${t}, expected up to ${s.MAX_TEXTURE_LENGTH} x ${s.MAX_TEXTURE_LENGTH}.`);if(e<1||t<1)throw new o.mG(`Invalid texture size: ${e} x ${t}`);return n.isContextLost()||(this._width=e,this._height=t,n.bindTexture(n.TEXTURE_2D,this._glTexture),n.texImage2D(n.TEXTURE_2D,0,this._internalFormat,this._width,this._height,0,this._format,this._dataType,null),n.bindTexture(n.TEXTURE_2D,null),this.discardMipmaps()),this}generateMipmaps(e=[]){const n=this._gl;if(this._hasMipmaps)return this;if(n.bindTexture(n.TEXTURE_2D,this._glTexture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST_MIPMAP_LINEAR),n.generateMipmap(n.TEXTURE_2D),n.bindTexture(n.TEXTURE_2D,null),e.length>0){const n=this.width,i=this.height,o=1+Math.floor(Math.log2(Math.max(n,i)));t.c.assert(e.length<=o);for(let o=1;o<e.length;o++){const s=Math.max(1,n>>>o),r=Math.max(1,i>>>o);t.c.assert(e[o].width===s&&e[o].height===r),e[o].copyTo(this,o)}}return this._hasMipmaps=!0,this}discardMipmaps(){const e=this._gl;this._hasMipmaps&&(e.bindTexture(e.TEXTURE_2D,this._glTexture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,this._filter),e.bindTexture(e.TEXTURE_2D,null),this._hasMipmaps=!1)}hasMipmaps(){return this._hasMipmaps}isReleased(){return null==this._glTexture}get glTexture(){return this._glTexture}get width(){return this._width}get height(){return this._height}get gl(){return this._gl}static _createTexture(e,n,i,o,s,r,A,a){t.c.assert(n>0&&i>0);const c=e.createTexture();return e.bindTexture(e.TEXTURE_2D,c),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,A),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,A),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,a),e.texImage2D(e.TEXTURE_2D,0,s,n,i,0,o,r,null),e.bindTexture(e.TEXTURE_2D,null),c}static _upload(e,t,n,i,o,s,r,A,a){return e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,s,A,n,i,0,r,a,o),e.bindTexture(e.TEXTURE_2D,null),t}}class A extends r{constructor(e,t,n,i,o,s,r,a){super(e,t,n,i,o,s,r,a),this._glFbo=A._createFramebuffer(e,this._glTexture)}release(){const e=this._gl;if(null==this._glFbo)throw new o.js("The SpeedyDrawableTexture has already been released");return e.deleteFramebuffer(this._glFbo),this._glFbo=null,super.release()}get glFbo(){return this._glFbo}copyTo(e,n=0){const i=this._gl;if(i.isContextLost())return;const o=1<<(n|=0),s=Math.max(1,Math.floor(e.width/o)),r=Math.max(1,Math.floor(e.height/o));t.c.assert(this._width===s&&this._height===r),A._copyToTexture(i,this._glFbo,e.glTexture,0,0,this._width,this._height,n)}clear(){return this.clearToColor(0,0,0,0)}clearToColor(e,t,n,i){const o=this._gl;return o.isContextLost()||(e=Math.max(0,Math.min(+e,1)),t=Math.max(0,Math.min(+t,1)),n=Math.max(0,Math.min(+n,1)),i=Math.max(0,Math.min(+i,1)),this.discardMipmaps(),o.bindFramebuffer(o.FRAMEBUFFER,this._glFbo),o.viewport(0,0,this._width,this._height),o.clearColor(e,t,n,i),o.clear(o.COLOR_BUFFER_BIT),o.bindFramebuffer(o.FRAMEBUFFER,null)),this}static _createFramebuffer(e,t){const n=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,n),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0);const i=e.checkFramebufferStatus(e.FRAMEBUFFER);if(i!=e.FRAMEBUFFER_COMPLETE){const t=["FRAMEBUFFER_UNSUPPORTED","FRAMEBUFFER_INCOMPLETE_ATTACHMENT","FRAMEBUFFER_INCOMPLETE_DIMENSIONS","FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT","FRAMEBUFFER_INCOMPLETE_MULTISAMPLE"].filter((t=>e[t]===i))[0]||"unknown error";throw new o.Ql(`Can't create framebuffer: ${t} (${i})`)}return e.bindFramebuffer(e.FRAMEBUFFER,null),n}static _copyToTexture(e,t,n,i,o,s,r,A=0){return e.bindTexture(e.TEXTURE_2D,n),e.bindFramebuffer(e.FRAMEBUFFER,t),e.copyTexSubImage2D(e.TEXTURE_2D,A,0,0,i,o,s,r),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null),n}}var a=n(9759),c=n(4500);const l=Object.freeze({sampler2D:"uniform1i",isampler2D:"uniform1i",usampler2D:"uniform1i",float:"uniform1f",int:"uniform1i",uint:"uniform1ui",bool:"uniform1i",vec2:"uniform2f",vec3:"uniform3f",vec4:"uniform4f",ivec2:"uniform2i",ivec3:"uniform3i",ivec4:"uniform4i",uvec2:"uniform2ui",uvec3:"uniform3ui",uvec4:"uniform4ui",bvec2:"uniform2i",bvec3:"uniform3i",bvec4:"uniform4i",mat2:"uniformMatrix2fv",mat3:"uniformMatrix3fv",mat4:"uniformMatrix4fv"});class d extends Function{constructor(e,t,n={}){return super("...args","return this._self._call(...args)"),this._self=this.bind(this),this._self._init(e,t,n),this._self}_init(e,t,n){if(e.isContextLost())throw new o.js("Can't initialize SpeedyProgram: lost context");n=Object.assign({renderToTexture:!0,pingpong:!1},n),this._gl=e,this._program=d._compile(e,t.vertexSource,t.fragmentSource),this._geometry=new g(e,{position:t.locationOfAttributes.position,texCoord:t.locationOfAttributes.texCoord}),this._argnames=t.arguments,this._argIsArray=new Array(this._argnames.length).fill(!1),this._ubo=null,this._renderToTexture=Boolean(n.renderToTexture),this._width=1,this._height=1,this._texture=new Array(n.pingpong?2:1).fill(null),this._textureIndex=0,this._uniform=new Map,this._shaderdecl=t,e.useProgram(this._program);for(const n of t.uniforms){const i=t.uniformType(n),o=e.getUniformLocation(this._program,n);this._uniform.set(n,new h(i,o))}for(let e=0;e<this._argnames.length;e++){const t=this._argnames[e];if(!this._uniform.has(t)&&(this._argIsArray[e]=this._uniform.has(t+"[0]"),!this._argIsArray[e]))throw new o.js(`Expected uniform "${t}", as declared in the argument list`)}}_call(...e){const n=this._gl,i=this._argnames;if(e.length!=i.length)throw new o.mG(`Can't run shader: incorrect number of arguments (expected ${i.length}, got ${e.length})`);const s=t.c.flatten(e);for(let e=s.length-1;e>=0;e--)if(s[e]===this._texture[this._textureIndex])throw new o.B8("Can't run shader: don't use its output texture as an input to itself. Consider using pingpong rendering!");if(n.isContextLost())return this._texture[this._textureIndex];n.useProgram(this._program),n.bindVertexArray(this._geometry.vao);const r=this._texture[this._textureIndex],A=this._renderToTexture?r.glFbo:null,a=this._width,c=this._height;this._uniform.get("texSize").setValue(n,[a,c]);for(let t=0,s=0;t<e.length;t++){const r=i[t];if(this._argIsArray[t]){const i=e[t];if(!Array.isArray(i))throw new o.mG(`Can't run shader: expected an array for "${r}"`);if(this._uniform.has(`${r}[${i.length}]`))throw new o.mG(`Can't run shader: too few elements in the "${r}" array`);for(let e,t=0;void 0!==(e=this._uniform.get(`${r}[${t}]`));t++)s=e.setValue(n,i[t],s)}else{s=this._uniform.get(r).setValue(n,e[t],s)}}return null!==this._ubo&&this._ubo.update(),n.bindFramebuffer(n.FRAMEBUFFER,A),n.viewport(0,0,a,c),n.drawArrays(n.TRIANGLES,0,6),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindVertexArray(null),null!=r&&r.discardMipmaps(),this._pingpong(),r}outputs(e,t,...n){return this._setOutputTexture(...n),this._setOutputSize(e,t),this}_setOutputSize(e,n){t.c.assert(e>0&&n>0),this._width=0|e,this._height=0|n;for(let e=0;e<this._texture.length;e++)null!=this._texture[e]&&this._texture[e].resize(this._width,this._height);return this}_setOutputTexture(...e){t.c.assert(e.length===this._texture.length,`Incorrect number of textures (expected ${this._texture.length})`);for(let t=0;t<this._texture.length;t++)this._texture[t]=e[t];return this._textureIndex=0,this}clear(){const e=this._texture[this._textureIndex];for(let e=0;e<this._texture.length;e++)this._texture[e].clear();return this._pingpong(),e}setUBO(e,t){return null===this._ubo&&(this._ubo=new p(this._gl,this._program)),this._ubo.set(e,t),this}release(){const e=this._gl;return null!=this._ubo&&(this._ubo=this._ubo.release()),this._texture.fill(null),this._geometry=this._geometry.release(),e.deleteProgram(this._program),this._program=null,null}definedConstant(e){return this._shaderdecl.definedConstant(e)}_pingpong(){this._texture.length>1&&(this._textureIndex=1-this._textureIndex)}static _compile(e,t,n){const i=e.createProgram(),s=e.createShader(e.VERTEX_SHADER),r=e.createShader(e.FRAGMENT_SHADER);if(e.shaderSource(s,t),e.compileShader(s),e.attachShader(i,s),e.shaderSource(r,n),e.compileShader(r),e.attachShader(i,r),e.linkProgram(i),e.validateProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;const A=[e.getShaderInfoLog(r),e.getShaderInfoLog(s),e.getProgramInfoLog(i)];e.deleteProgram(i),e.deleteShader(r),e.deleteShader(s);const a=e=>{return new Array((t=e,Math.max(0,2-Math.floor(Math.log10(t))))).fill(" ").join("")+e+". ";var t},c=(A[0]?n:t).split("\n").map(((e,t)=>a(1+t)+e)).join("\n");throw new o.Ql("\n\n---------- ERROR ----------\n\n"+A.filter((e=>e)).join("\n")+"\n\n---------- SOURCE CODE ----------\n\n"+c+"\n")}}function g(e,t){return this.vao=e.createVertexArray(),this.vbo=Object.freeze({position:e.createBuffer(),texCoord:e.createBuffer()}),this._gl=e,e.bindVertexArray(this.vao),e.bindBuffer(e.ARRAY_BUFFER,this.vbo.position),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW),e.enableVertexAttribArray(t.position),e.vertexAttribPointer(t.position,2,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,this.vbo.texCoord),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.STATIC_DRAW),e.enableVertexAttribArray(t.texCoord),e.vertexAttribPointer(t.texCoord,2,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,null),e.bindVertexArray(null),Object.freeze(this)}function h(e,t){if(this.type=String(e),!Object.prototype.hasOwnProperty.call(l,this.type))throw new o.B8(`Unsupported uniform type: ${this.type}`);this.location=t,this.setter=l[this.type];const n=0|Number(this.setter.match(/^uniform(Matrix)?(\d)/)[2]);this.dim=this.type.startsWith("mat")?2:this.type.indexOf("vec")>=0?1:0,this.length=2==this.dim?n*n:n,this._value=null}function p(e,t){this._gl=e,this._program=t,this._nextIndex=0,this._ubo=Object.create(null)}g.prototype.release=function(){const e=this._gl;return e.deleteVertexArray(this.vao),e.deleteBuffer(this.vbo.position),e.deleteBuffer(this.vbo.texCoord),null},h.prototype.setValue=function(e,t,n=-1){const i=e[this.setter];if("object"==typeof t&&this.type.endsWith("sampler2D")){if(n>=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS)throw new o.B8(`Can't activate texture unit ${n}: max is ${e.MAX_COMBINED_TEXTURE_IMAGE_UNITS}`);if(Array.isArray(t))throw new o.B8("Can't pass arrays of textures to shaders");if(null==t)throw new o.mG(`Can't run shader: cannot use ${t} as an input texture`);if(n<0)throw new o.mG("Missing texNo");const i=t;e.activeTexture(e.TEXTURE0+n),e.bindTexture(e.TEXTURE_2D,i.glTexture),e.uniform1i(this.location,n),n++}else if(t===this._value);else if("number"==typeof t||"boolean"==typeof t)i.call(e,this.location,t);else{if(!Array.isArray(t))throw new o.mG(`Can't run shader: unrecognized argument "${t}"`);if(t.length!==this.length)throw new o.mG(`Can't run shader: incorrect number of values for ${this.type}: "${t}"`);2==this.dim?i.call(e,this.location,!1,t):i.call(e,this.location,...t)}return this._value=t,n},p.prototype.set=function(e,t){const n=this._gl;void 0===this._ubo[e]&&(this._ubo[e]={buffer:n.createBuffer(),blockBindingIndex:this._nextIndex++,blockIndex:-1,data:null});const i=this._ubo[e];if(i.blockIndex<0){const t=n.getUniformBlockIndex(this._program,e);n.uniformBlockBinding(this._program,t,i.blockBindingIndex),i.blockIndex=t}i.data=t},p.prototype.update=function(){const e=this._gl;for(const t in this._ubo){const n=this._ubo[t];e.bindBuffer(e.UNIFORM_BUFFER,n.buffer),e.bufferData(e.UNIFORM_BUFFER,n.data,e.DYNAMIC_DRAW),e.bindBufferBase(e.UNIFORM_BUFFER,n.blockBindingIndex,n.buffer),e.bindBuffer(e.UNIFORM_BUFFER,null)}},p.prototype.release=function(){const e=this._gl;for(const t in this._ubo){const n=this._ubo[t];e.deleteBuffer(n.buffer),n.data=null}return null};const u=Object.freeze({usesPingpongRendering:()=>({pingpong:!0}),rendersToCanvas:()=>({renderToTexture:!1})});class I{constructor(e){this._gpu=e,this._programs=[]}declare(e,t,n={}){return Object.defineProperty(this,e,{get:(()=>{const i=Symbol(e);return()=>this[i]||(this[i]=this._createProgram(t,n))})()}),this}get program(){return u}release(){for(let e=0;e<this._programs.length;e++)this._programs[e].release();return null}_createProgram(e,t={}){const n=new d(this._gpu.gl,e,t);return this._programs.push(n),n}}const f=(0,a.Nt)("utils/copy.glsl").withArguments("image"),m=(0,a.Nt)("utils/copy-raster.glsl").withDefines({TYPE:1}).withArguments("image"),C=(0,a.Nt)("utils/copy-raster.glsl").withDefines({TYPE:2}).withArguments("image"),E=(0,a.Nt)("utils/copy.glsl","utils/flip-y.vs.glsl").withArguments("image"),x=(0,a.Nt)("utils/fill.glsl").withArguments("value"),y=(0,a.Nt)("utils/fill-components.glsl").withArguments("image","pixelComponents","value"),_=(0,a.Nt)("utils/copy-components.glsl").withArguments("dest","src","destComponents","srcComponentId"),S=(0,a.Nt)("utils/scan-minmax2d.glsl").withArguments("image","iterationNumber"),P=(0,a.Nt)("utils/sobel-derivatives.glsl","utils/sobel-derivatives.vs.glsl").withArguments("pyramid","lod");class B extends I{constructor(e){super(e),this.declare("renderToCanvas",E,{...this.program.rendersToCanvas()}).declare("copy",f).declare("copyKeypoints",m).declare("copy2DVectors",C).declare("fill",x).declare("fillComponents",y).declare("copyComponents",_).declare("scanMinMax2D",S,{...this.program.usesPingpongRendering()}).declare("sobelDerivatives",P)}}var v=n(6776);const Q=(0,a.Nt)("filters/rgb2grey.glsl").withArguments("image"),w=[3,5,7].reduce(((e,t)=>(e[t]=(0,a.Nt)("filters/convolution2d.glsl").withDefines({KERNEL_SIZE_SQUARED:t*t}).withArguments("image","kernel"),e)),{}),D=[3,5,7,9,11,13,15].reduce(((e,t)=>(e[t]=(0,a.Nt)("filters/convolution1d.glsl").withDefines({KERNEL_SIZE:t,AXIS:0}).withArguments("image","kernel"),e)),{}),b=[3,5,7,9,11,13,15].reduce(((e,t)=>(e[t]=(0,a.Nt)("filters/convolution1d.glsl").withDefines({KERNEL_SIZE:t,AXIS:1}).withArguments("image","kernel"),e)),{}),M=[3,5,7].reduce(((e,t)=>(e[t]=(0,a.Nt)("filters/fast-median.glsl").withDefines({KERNEL_SIZE:t}).withArguments("image"),e)),{}),K=(0,a.Nt)("filters/normalize-image.glsl").withDefines({GREYSCALE:1}).withArguments("minmax2d","minValue","maxValue"),L=(0,a.Nt)("filters/normalize-image.glsl").withDefines({GREYSCALE:0}).withArguments("minmax2dRGB","minValue","maxValue"),k=(0,a.Nt)("filters/nightvision.glsl").withDefines({GREYSCALE:0}).withArguments("image","illuminationMap","gain","offset","decay"),N=(0,a.Nt)("filters/nightvision.glsl").withDefines({GREYSCALE:1}).withArguments("image","illuminationMap","gain","offset","decay"),R=e=>t.c.gaussianKernel((e=>Math.max(1,e/6))(e),e),z=e=>new Array(e).fill(1/e);class X extends I{constructor(e){super(e),this.declare("rgb2grey",Q).declare("median3",M[3]).declare("median5",M[5]).declare("median7",M[7]).declare("convolution3",w[3]).declare("convolution5",w[5]).declare("convolution7",w[7]).declare("convolution3x",D[3]).declare("convolution3y",b[3]).declare("convolution5x",D[5]).declare("convolution5y",b[5]).declare("convolution7x",D[7]).declare("convolution7y",b[7]).declare("convolution9x",D[9]).declare("convolution9y",b[9]).declare("convolution11x",D[11]).declare("convolution11y",b[11]).declare("convolution13x",D[13]).declare("convolution13y",b[13]).declare("convolution15x",D[15]).declare("convolution15y",b[15]).declare("normalizeGreyscale",K).declare("normalizeColored",L).declare("nightvision",k).declare("nightvisionGreyscale",N).declare("illuminationMapLoX",(0,v.convX)(t.c.gaussianKernel(80,31))).declare("illuminationMapLoY",(0,v.convY)(t.c.gaussianKernel(80,31))).declare("illuminationMapX",(0,v.convX)(t.c.gaussianKernel(80,63))).declare("illuminationMapY",(0,v.convY)(t.c.gaussianKernel(80,63))).declare("illuminationMapHiX",(0,v.convX)(t.c.gaussianKernel(80,255))).declare("illuminationMapHiY",(0,v.convY)(t.c.gaussianKernel(80,255))).declare("gaussian3x",(0,v.convX)([.25,.5,.25])).declare("gaussian3y",(0,v.convY)([.25,.5,.25])).declare("gaussian5x",(0,v.convX)([.05,.25,.4,.25,.05])).declare("gaussian5y",(0,v.convY)([.05,.25,.4,.25,.05])).declare("gaussian7x",(0,v.convX)(R(7))).declare("gaussian7y",(0,v.convY)(R(7))).declare("gaussian9x",(0,v.convX)(R(9))).declare("gaussian9y",(0,v.convY)(R(9))).declare("gaussian11x",(0,v.convX)(R(11))).declare("gaussian11y",(0,v.convY)(R(11))).declare("box3x",(0,v.convX)(z(3))).declare("box3y",(0,v.convY)(z(3))).declare("box5x",(0,v.convX)(z(5))).declare("box5y",(0,v.convY)(z(5))).declare("box7x",(0,v.convX)(z(7))).declare("box7y",(0,v.convY)(z(7))).declare("box9x",(0,v.convX)(z(9))).declare("box9y",(0,v.convY)(z(9))).declare("box11x",(0,v.convX)(z(11))).declare("box11y",(0,v.convY)(z(11)))}}var T=n(2411);class F extends T.R{static create(e,n,i){t.c.assert(i%4==0,`Invalid descriptorSize: ${i}`);const s=n.length,r=i/4,A=Math.log2(r*Math.max(s,1))/2,a=1<<Math.min(11,Math.ceil(A)),c=a,l=a,d=c*l/r;if(s>d)throw new o.B8(`The capacity of the descriptorDB (${d} for ${8*i}-bit descriptors) has been exceeded`);const g=new Uint8Array(c*l*4);for(let e=0;e<s;e++){const o=e*i,s=n[e];t.c.assert(s.byteLength===i),t.c.assert(o+i<=g.byteLength),g.set(s,o)}const h=s*i;return t.c.log(`Creating a ${c}x${l} database of ${s} `+8*i+"-bit descriptors "+`(total size: ${(h/1048576).toFixed(2)} MB)`),e.resize(c,l),e.upload(g),e}}const G=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],O=[10,11,12,13,14,15,16,17,18,19,20],U=[32,64],H=Math.max(...O),q=Math.max(...G),Y=e=>(t.c.range(q).forEach((t=>e.subarray(t*H,(t+1)*H).sort())),e),J=(e,n)=>(t.c.range(q).forEach((t=>n.subarray((t+1)*H-e,(t+1)*H).fill(195939070))),n),W=O.reduce(((e,n)=>{return e[n]={32:Y(J(H-(i=n),new Uint32Array([...t.c.shuffle(t.c.range(256)),...t.c.shuffle(t.c.range(256)),...t.c.shuffle(t.c.range(256))].slice(0,q*H)))),64:Y(J(H-i,new Uint32Array([...t.c.shuffle(t.c.range(512)),...t.c.shuffle(t.c.range(512))].slice(0,q*H))))},e;var i}),{});class Z{constructor(e,n,i,o=8,r=15,A=.95){const a=i.length,c=a>0?i[0].byteLength:0,l=(d=o,g=r,h=A,O.includes(g)&&G.includes(d)?[{name:"x-small",bucketCapacity:1,tableCount:d,hashSize:g,capacity:$(g,1,h)},{name:"small",bucketCapacity:2,tableCount:d,hashSize:g,capacity:$(g,2,h)},{name:"small-plus",bucketCapacity:3,tableCount:d,hashSize:g,capacity:$(g,3,h)},{name:"medium",bucketCapacity:4,tableCount:d,hashSize:g,capacity:$(g,4,h)},{name:"medium-plus",bucketCapacity:5,tableCount:d,hashSize:g,capacity:$(g,5,h)},{name:"large",bucketCapacity:6,tableCount:d,hashSize:g,capacity:$(g,6,h)},{name:"x-large",bucketCapacity:8,tableCount:d,hashSize:g,capacity:$(g,8,h)}]:null);var d,g,h;t.c.assert(a>0,"Can't build LSH tables without descriptors!"),t.c.assert(U.includes(c),`Can't build LSH tables: unacceptable descriptor size of ${c} bytes`),t.c.assert(i.findIndex((e=>e.byteLength!==c))<0,`Can't build LSH tables: incorrectly sized descriptors. Expected ${c} bytes for each`),t.c.assert(a<s.MATCH_MAX_INDEX,`Can't build LSH tables: too many descriptors (${i.length})`),t.c.assert(null!=l,`Can't build LSH tables: unacceptable number of tables (${o}) x hash size (${r})`),this._profile=l.find((e=>a<=e.capacity))||l[l.length-1],this._descriptorSize=c,this._descriptorCount=a,this._sequences=this._pickSequences(this._descriptorSize),this._tables=this._createStaticTables(e,this._sequences,i,c),this._descriptorDB=F.create(n,i,c)}get descriptorSize(){return this._descriptorSize}get descriptorCount(){return this._descriptorCount}get sequences(){return this._sequences}get hashSize(){return this._profile.hashSize}get bucketCapacity(){return this._profile.bucketCapacity}get bucketsPerTable(){return 1<<this._profile.hashSize}get tableCount(){return this._profile.tableCount}get tableSize(){return this.bucketsPerTable*this.bucketCapacity*4}get totalSize(){return this.tableCount*this.tableSize}get tables(){return this._tables}get descriptorDB(){return this._descriptorDB}_pickSequences(e){return t.c.assert(Object.prototype.hasOwnProperty.call(W,this.hashSize)),t.c.assert(Object.prototype.hasOwnProperty.call(W[this.hashSize],e)),W[this.hashSize][e]}_createStaticTables(e,n,i,o){const s=4294967295,r=this._profile.name,A=this._profile.capacity,a=this.tableCount,c=this.bucketsPerTable,l=4*this.bucketCapacity,d=this.hashSize,g=this.tableCount*this.bucketsPerTable*this.bucketCapacity,h=Math.min((p=Math.sqrt(g))>1?1<<Math.ceil(Math.log2(p)):1,4096);var p;const u=Math.ceil(g/h),I=i.length;t.c.assert(d<=H),t.c.assert(a<=q),t.c.assert(g<=h*u);const f=1048576;if(t.c.log(`Building ${a} ${r} LSH tables with ${I} ${8*o}-bit descriptors each and hashSize = ${d} bits (${h}x${u}, with ${(this.tableSize/f).toFixed(2)} MB per table and total size = ${(this.totalSize/f).toFixed(2)} MB), `),I>A){const e=100*I/A;t.c.warning(`There are too many descriptors (${I}) for a ${r} LSH table. That's ${e.toFixed(2)}% of its theoretical capacity. Consider increasing the hashSize (currently set to ${d}) or reducing the number of descriptors to avoid degradation.`)}const m=new ArrayBuffer(h*u*4),C=new Uint8Array(m).fill(255),E=new DataView(m),x=t.c.shuffle(t.c.range(I)),y=new Array(a).fill(0);for(let e=0;e<I;e++){const t=x[e],o=this._hashCodes(i[t],n);for(let e=0;e<a;e++){const n=e*c*l+o[e]*l;let i=s;for(let e=0;e<l;e+=4){const o=n+e;if(i=E.getUint32(o,!0),i==s){E.setUint32(o,t,!0);break}}i!=s&&y[e]++}}const _=y.reduce(((e,t)=>e+t),0),S=y.map((e=>100*e/I));return t.c.log(`When building ${a} ${r} LSH tables with ${I} ${8*o}-bit descriptors each and hashSize = ${d} bits, I got the following discard profile: `+S.map((e=>e.toFixed(2)+"%")).join(", ")+". "+`Average: ${(100*_/(a*I)).toFixed(2)}%. `+`Minimum: ${Math.min(...S).toFixed(2)}%. `+`Table capacity: ${A}.`),e.resize(h,u),e.upload(C),e}_hashCodes(e,n){const i=this.tableCount,o=this.hashSize,s=this.bucketsPerTable,r=new Array(i);t.c.assert(o<=H&&n.length>=H*i);for(let A=0;A<i;A++){const i=H*A;let a=0;for(let t=0;t<o;t++){let o=n[i+t],s=1<<(7&o);a=a<<1|0!=(e[o>>>3]&s)}t.c.assert(a>=0&&a<s),r[A]=a}return r}}function j(e,t){const n=Math.exp(-e);let i=1,o=1,s=1;for(let n=1;n<=t;n++)i+=(s*=e)/(o*=n);return i*n}function $(e,t,n=.99){const i=1<<e,o=t,s=n;let r=1,A=i*o,a=0,c=0;for(;r<A;)a=Math.floor((r+A)/2),c=j(a/i,o),c>s?r=a+1:A=a;return a}const V=(0,a.Nt)("keypoints/fast.glsl","keypoints/fast.vs.glsl").withDefines({FAST_TYPE:916}).withArguments("corners","pyramid","lod","threshold"),ee=[1,3,5,7].reduce(((e,t)=>(e[t]=(0,a.Nt)("keypoints/harris.glsl").withDefines({WINDOW_SIZE:t}).withArguments("corners","pyramid","derivatives","lod","lodStep","gaussian"),e)),{}),te=(0,a.Nt)("keypoints/score-findmax.glsl").withArguments("corners","iterationNumber"),ne=(0,a.Nt)("keypoints/harris-cutoff.glsl").withArguments("corners","maxScore","quality"),ie=(0,a.Nt)("keypoints/subpixel-refinement.glsl").withDefines({METHOD:0}).withArguments("pyramid","encodedKeypoints","descriptorSize","extraSize","encoderLength","maxIterations","epsilon"),oe=(0,a.Nt)("keypoints/subpixel-refinement.glsl").withDefines({METHOD:1}).withArguments("pyramid","encodedKeypoints","descriptorSize","extraSize","encoderLength","maxIterations","epsilon"),se=(0,a.Nt)("keypoints/subpixel-refinement.glsl").withDefines({METHOD:2}).withArguments("pyramid","encodedKeypoints","descriptorSize","extraSize","encoderLength","maxIterations","epsilon"),re=(0,a.Nt)("keypoints/subpixel-refinement.glsl").withDefines({METHOD:3}).withArguments("pyramid","encodedKeypoints","descriptorSize","extraSize","encoderLength","maxIterations","epsilon"),Ae=(0,a.Nt)("keypoints/refine-scale.glsl").withDefines({METHOD:0}).withArguments("pyramid","lodStep","encodedKeypoints","descriptorSize","extraSize","encoderLength"),ae=(0,a.Nt)("keypoints/refine-scale.glsl").withDefines({METHOD:1}).withArguments("pyramid","lodStep","encodedKeypoints","descriptorSize","extraSize","encoderLength","threshold"),ce=(0,a.Nt)("keypoints/allocate-descriptors.glsl").withArguments("inputEncodedKeypoints","inputDescriptorSize","inputExtraSize","inputEncoderLength","outputDescriptorSize","outputExtraSize","outputEncoderLength"),le=(0,a.Nt)("keypoints/allocate-extra.glsl").withArguments("inputEncodedKeypoints","inputDescriptorSize","inputExtraSize","inputEncoderLength","outputDescriptorSize","outputExtraSize","outputEncoderLength"),de=(0,a.Nt)("keypoints/transfer-to-extra.glsl").withArguments("encodedData","strideOfEncodedData","encodedKeypoints","descriptorSize","extraSize","encoderLength"),ge=(0,a.Nt)("keypoints/orb-descriptor.glsl").withArguments("image","encodedCorners","extraSize","encoderLength"),he=(0,a.Nt)("keypoints/orb-orientation.glsl").withArguments("image","encodedKeypoints","descriptorSize","extraSize","encoderLength"),pe=(0,a.Nt)("keypoints/nonmax-suppression.glsl").withDefines({MULTISCALE:0}).withArguments("image","lodStep"),ue=(0,a.Nt)("keypoints/nonmax-suppression.glsl").withDefines({MULTISCALE:1}).withArguments("image","lodStep"),Ie=(0,a.Nt)("keypoints/nonmax-space.glsl").withArguments("corners"),fe=(0,a.Nt)("keypoints/nonmax-scale.glsl").withDefines({USE_LAPLACIAN:1}).withArguments("corners","pyramid","pyrLaplacian","lodStep"),me=(0,a.Nt)("keypoints/nonmax-scale.glsl").withDefines({USE_LAPLACIAN:0}).withArguments("corners","pyramid","lodStep"),Ce=(0,a.Nt)("keypoints/laplacian.glsl").withArguments("corners","pyramid","lodStep","lodOffset"),Ee=[3,5,7,9,11,13,15,17,19,21].reduce(((e,t)=>(e[t]=(0,a.Nt)("keypoints/lk.glsl").withDefines({WINDOW_SIZE:t}).withArguments("encodedFlow","prevKeypoints","nextPyramid","prevPyramid","level","depth","numberOfIterations","discardThreshold","epsilon","descriptorSize","extraSize","encoderLength"),e)),{}),xe=(0,a.Nt)("keypoints/transfer-flow.glsl").withArguments("encodedFlow","encodedKeypoints","descriptorSize","extraSize","encoderLength"),ye=(0,a.Nt)("keypoints/knn-init.glsl").withDefines({ENCODE_FILTERS:0}),_e=(0,a.Nt)("keypoints/knn-init.glsl").withDefines({ENCODE_FILTERS:1}),Se=(0,a.Nt)("keypoints/knn-transfer.glsl").withArguments("encodedMatches","encodedKthMatches","numberOfMatchesPerKeypoint","kthMatch"),Pe=(0,a.Nt)("keypoints/bf-knn.glsl").withDefines({DESCRIPTOR_SIZE:32,NUMBER_OF_KEYPOINTS_PER_PASS:16}).withArguments("encodedMatches","encodedFilters","matcherLength","dbEncodedKeypoints","dbDescriptorSize","dbExtraSize","dbEncoderLength","encodedKeypoints","descriptorSize","extraSize","encoderLength","passId"),Be=(0,a.Nt)("keypoints/bf-knn.glsl").withDefines({DESCRIPTOR_SIZE:64,NUMBER_OF_KEYPOINTS_PER_PASS:8}).withArguments("encodedMatches","encodedFilters","matcherLength","dbEncodedKeypoints","dbDescriptorSize","dbExtraSize","dbEncoderLength","encodedKeypoints","descriptorSize","extraSize","encoderLength","passId"),ve=(0,a.Nt)("keypoints/knn-init.glsl").withDefines({ENCODE_FILTERS:0}),Qe=(0,a.Nt)("keypoints/knn-init.glsl").withDefines({ENCODE_FILTERS:1}),we=U.reduce(((e,t)=>(e[t]=O.reduce(((e,n)=>(e[n]=[0,1,2].reduce(((e,i)=>(e[i]=(0,a.Nt)("keypoints/lsh-knn.glsl").withDefines({DESCRIPTOR_SIZE:t,HASH_SIZE:n,LEVEL:i,SEQUENCE_MAXLEN:H,SEQUENCE_COUNT:q}).withArguments("candidates","filters","matcherLength","tables","descriptorDB","tableIndex","bucketCapacity","bucketsPerTable","tablesStride","descriptorDBStride","encodedKeypoints","descriptorSize","extraSize","encoderLength"),e)),{}),e)),{}),e)),{}),De=(0,a.Nt)("keypoints/knn-transfer.glsl").withArguments("encodedMatches","encodedKthMatches","numberOfMatchesPerKeypoint","kthMatch"),be=(0,a.Nt)("keypoints/sort-keypoints.glsl").withDefines({STAGE:1}).withArguments("encodedKeypoints","descriptorSize","extraSize","encoderLength"),Me=(0,a.Nt)("keypoints/sort-keypoints.glsl").withDefines({STAGE:2}).withArguments("permutation","blockSize","dblLog2BlockSize"),Ke=(0,a.Nt)("keypoints/sort-keypoints.glsl").withDefines({STAGE:3}).withArguments("permutation","maxKeypoints","encodedKeypoints","descriptorSize","extraSize"),Le=(0,a.Nt)("keypoints/mix-keypoints.glsl").withDefines({STAGE:1}).withArguments("encodedKeypointsA","encodedKeypointsB","encoderLengthA","encoderLengthB","encoderCapacityA","encoderCapacityB","descriptorSize","extraSize","encoderLength"),ke=(0,a.Nt)("keypoints/mix-keypoints.glsl").withDefines({STAGE:2}).withArguments("encodedKeypoints","descriptorSize","extraSize","encoderLength","maxKeypoints"),Ne=(0,a.Nt)("keypoints/mix-keypoints.glsl").withDefines({STAGE:3}).withArguments("array","blockSize"),Re=(0,a.Nt)("keypoints/mix-keypoints.glsl").withDefines({STAGE:5}).withArguments("array"),ze=(0,a.Nt)("keypoints/mix-keypoints.glsl").withDefines({STAGE:4}).withArguments("array","encodedKeypoints","descriptorSize","extraSize","encoderLength"),Xe=(0,a.Nt)("keypoints/lookup-of-locations.glsl").withDefines({FS_OUTPUT_TYPE:2,STAGE:1}).withArguments("corners"),Te=(0,a.Nt)("keypoints/lookup-of-locations.glsl","keypoints/lookup-of-locations.vs.glsl").withDefines({FS_OUTPUT_TYPE:2,FS_USE_CUSTOM_PRECISION:1,STAGE:2}).withArguments("lookupTable","blockSize","width","height"),Fe=(0,a.Nt)("keypoints/lookup-of-locations.glsl").withDefines({STAGE:-1}).withArguments("lookupTable"),Ge=(0,a.Nt)("keypoints/encode-keypoints.glsl").withArguments("corners","lookupTable","stride","descriptorSize","extraSize","encoderLength","encoderCapacity"),Oe=(0,a.Nt)("keypoints/encode-keypoint-offsets.glsl").withArguments("corners","imageSize"),Ue=(0,a.Nt)("keypoints/encode-keypoint-long-offsets.glsl").withDefines({MAX_ITERATIONS:6}).withArguments("offsetsImage","imageSize"),He=(0,a.Nt)("keypoints/encode-keypoint-positions.glsl").withArguments("offsetsImage","imageSize","passId","numPasses","keypointLimit","encodedKeypoints","descriptorSize","extraSize","encoderLength"),qe=(0,a.Nt)("keypoints/encode-keypoint-properties.glsl").withArguments("corners","encodedKeypoints","descriptorSize","extraSize","encoderLength"),Ye=(0,a.Nt)("keypoints/encode-null-keypoints.glsl").withArguments(),Je=(0,a.Nt)("keypoints/transfer-orientation.glsl").withArguments("encodedOrientations","encodedKeypoints","descriptorSize","extraSize","encoderLength"),We=(0,a.Nt)("keypoints/upload-keypoints.glsl").withDefines({BUFFER_SIZE:1024}).withArguments("encodedKeypoints","startIndex","endIndex","descriptorSize","extraSize","encoderLength"),Ze=(0,a.Nt)("keypoints/apply-homography.glsl").withArguments("homography","encodedKeypoints","descriptorSize","extraSize","encoderLength"),je=(0,a.Nt)("keypoints/clip-border.glsl").withArguments("imageWidth","imageHeight","borderTop","borderRight","borderBottom","borderLeft","encodedKeypoints","descriptorSize","extraSize","encoderLength"),$e=(0,a.Nt)("keypoints/distance-filter.glsl").withArguments("encodedKeypointsA","encoderLengthA","encodedKeypointsB","encoderLengthB","descriptorSize","extraSize","encoderLength","threshold"),Ve=(0,a.Nt)("keypoints/hamming-distance-filter.glsl").withDefines({DESCRIPTOR_SIZE:32}).withArguments("encodedKeypointsA","encoderLengthA","encodedKeypointsB","encoderLengthB","descriptorSize","extraSize","encoderLength","threshold"),et=(0,a.Nt)("keypoints/hamming-distance-filter.glsl").withDefines({DESCRIPTOR_SIZE:64}).withArguments("encodedKeypointsA","encoderLengthA","encodedKeypointsB","encoderLengthB","descriptorSize","extraSize","encoderLength","threshold"),tt=(0,a.Nt)("keypoints/shuffle.glsl").withDefines({PERMUTATION_MAXLEN:2048}).withArguments("encodedKeypoints","descriptorSize","extraSize","encoderLength"),nt=(0,a.Nt)("keypoints/clip.glsl").withArguments("encodedKeypoints","descriptorSize","extraSize","encoderLength","maxKeypoints");class it extends I{constructor(e){super(e),this.declare("fast9_16",V,{...this.program.usesPingpongRendering()}).declare("harris1",ee[1],{...this.program.usesPingpongRendering()}).declare("harris3",ee[3],{...this.program.usesPingpongRendering()}).declare("harris5",ee[5],{...this.program.usesPingpongRendering()}).declare("harris7",ee[7],{...this.program.usesPingpongRendering()}).declare("harrisScoreFindMax",te,{...this.program.usesPingpongRendering()}).declare("harrisScoreCutoff",ne).declare("subpixelQuadratic1d",ie).declare("subpixelTaylor2d",oe).declare("subpixelBicubic",re).declare("subpixelBilinear",se).declare("refineScaleLoG",Ae).declare("refineScaleFAST916",ae).declare("allocateDescriptors",ce).declare("allocateExtra",le).declare("transferToExtra",de).declare("orbDescriptor",ge).declare("orbOrientation",he).declare("nonmax",pe).declare("pyrnonmax",ue).declare("nonmaxSpace",Ie).declare("nonmaxScale",fe).declare("nonmaxScaleSimple",me).declare("laplacian",Ce).declare("lk21",Ee[21],{...this.program.usesPingpongRendering()}).declare("lk19",Ee[19],{...this.program.usesPingpongRendering()}).declare("lk17",Ee[17],{...this.program.usesPingpongRendering()}).declare("lk15",Ee[15],{...this.program.usesPingpongRendering()}).declare("lk13",Ee[13],{...this.program.usesPingpongRendering()}).declare("lk11",Ee[11],{...this.program.usesPingpongRendering()}).declare("lk9",Ee[9],{...this.program.usesPingpongRendering()}).declare("lk7",Ee[7],{...this.program.usesPingpongRendering()}).declare("lk5",Ee[5],{...this.program.usesPingpongRendering()}).declare("lk3",Ee[3],{...this.program.usesPingpongRendering()}).declare("transferFlow",xe).declare("bfMatcherInitCandidates",ye).declare("bfMatcherInitFilters",_e).declare("bfMatcherTransfer",Se,{...this.program.usesPingpongRendering()}).declare("bfMatcher32",Pe,{...this.program.usesPingpongRendering()}).declare("bfMatcher64",Be,{...this.program.usesPingpongRendering()}).declare("lshKnnInitCandidates",ve).declare("lshKnnInitFilters",Qe).declare("lshKnnTransfer",De,{...this.program.usesPingpongRendering()}).declare("sortCreatePermutation",be).declare("sortMergePermutation",Me,{...this.program.usesPingpongRendering()}).declare("sortApplyPermutation",Ke).declare("mixKeypointsPreInit",Le).declare("mixKeypointsInit",ke).declare("mixKeypointsSort",Ne,{...this.program.usesPingpongRendering()}).declare("mixKeypointsView",Re).declare("mixKeypointsApply",ze).declare("encodeNullKeypoints",Ye).declare("encodeKeypoints",Ge).declare("initLookupTable",Xe).declare("sortLookupTable",Te,{...this.program.usesPingpongRendering()}).declare("viewLookupTable",Fe).declare("encodeKeypointSkipOffsets",Oe).declare("encodeKeypointLongSkipOffsets",Ue,{...this.program.usesPingpongRendering()}).declare("encodeKeypointPositions",He,{...this.program.usesPingpongRendering()}).declare("encodeKeypointProperties",qe).declare("transferOrientation",Je).declare("uploadKeypoints",We,{...this.program.usesPingpongRendering()}).declare("applyHomography",Ze).declare("clipBorder",je).declare("distanceFilter",$e).declare("hammingDistanceFilter32",Ve).declare("hammingDistanceFilter64",et).declare("shuffle",tt).declare("clip",nt);for(const e of Object.keys(we))for(const t of Object.keys(we[e]))for(const n of Object.keys(we[e][t])){const i=`lshKnn${e}h${t}lv${n}`;this.declare(i,we[e][t][n],{...this.program.usesPingpongRendering()})}}}const ot=(0,a.Nt)("pyramids/upsample2.glsl").withArguments("image"),st=(0,a.Nt)("pyramids/downsample2.glsl").withArguments("image");class rt extends I{constructor(e){super(e),this.declare("upsample2",ot).declare("downsample2",st).declare("smoothX",(0,v.convX)([.05,.25,.4,.25,.05])).declare("smoothY",(0,v.convY)([.05,.25,.4,.25,.05])).declare("smoothX2",(0,v.convX)([.1,.5,.8,.5,.1])).declare("smoothY2",(0,v.convY)([.1,.5,.8,.5,.1],.5))}}const At=(0,a.Nt)("transforms/warp-perspective.glsl").withArguments("image","inverseHomography"),at=(0,a.Nt)("transforms/resize.glsl").withDefines({INTERPOLATION_METHOD:0}).withArguments("image"),ct=(0,a.Nt)("transforms/resize.glsl").withDefines({INTERPOLATION_METHOD:1}).withArguments("image"),lt=(0,a.Nt)("transforms/additive-mix.glsl").withArguments("image0","image1","alpha","beta","gamma");class dt extends I{constructor(e){super(e),this.declare("warpPerspective",At).declare("resizeNearest",at).declare("resizeBilinear",ct).declare("additiveMix",lt)}}class gt{constructor(e){this._gpu=e,this._filters=null,this._transforms=null,this._pyramids=null,this._keypoints=null,this._utils=null}get filters(){return this._filters||(this._filters=new X(this._gpu))}get transforms(){return this._transforms||(this._transforms=new dt(this._gpu))}get pyramids(){return this._pyramids||(this._pyramids=new rt(this._gpu))}get keypoints(){return this._keypoints||(this._keypoints=new it(this._gpu))}get utils(){return this._utils||(this._utils=new B(this._gpu))}release(){for(const e in this)if(Object.prototype.hasOwnProperty.call(this,e)&&null!=this[e]){const t=this[e];t instanceof I&&t.release()}return null}}const ht=Symbol("Bucket");class pt{constructor(e,t,n){this.texture=e,this.index=t,this.next=n,this.free=!0}}class ut{constructor(e,n=1024){t.c.assert(n>0),this._bucket=Array.from({length:n},((e,t)=>new pt(null,t,t-1))),this._head=n-1,this._gpu=e}allocate(){if(this._head<0)throw new o.Cx(`Exhausted pool (capacity: ${this._bucket.length})`);const e=this._bucket[this._head];return e.free=!1,this._head=e.next,null==e.texture&&(e.texture=ut._createManagedTexture(this._gpu.gl,e)),e.texture}free(e){const n=e[ht];return t.c.assert(void 0!==n&&!n.free,"Unmanaged texture or double free"),n.next=this._head,n.free=!0,this._head=n.index,null}release(){for(let e=0;e<this._bucket.length;e++)null!=this._bucket[e].texture&&(this._bucket[e].texture=this._bucket[e].texture.release());return null}static _createManagedTexture(e,t){const n=new A(e,1,1);return Object.defineProperty(n,ht,{configurable:!1,enumerable:!1,writable:!1,value:t})}}var It=n(6731);const ft=Symbol();class mt{constructor(e){if(e!==ft)throw new o.js;this._data=null}static load(e){if(e instanceof HTMLImageElement)return Ct.load(e);if(e instanceof HTMLVideoElement)return Et.load(e);if(e instanceof HTMLCanvasElement)return xt.load(e);if(e instanceof ImageBitmap)return yt.load(e);throw new o.mG(`Unsupported media type: ${e}`)}get data(){return this._data}isLoaded(){return null!==this._data}get type(){throw new o.Mi}get width(){throw new o.Mi}get height(){throw new o.Mi}clone(){throw new o.Mi}release(){return this._data=null}_load(e){throw new o.Mi}static _waitUntil(e,n,i=3e4){return new c.s(((s,r)=>{t.c.log(`Waiting for ${n} to be triggered in ${e}...`);const A=setTimeout((()=>{r(new o.W5(`${n} has not been triggered in ${e}: timeout (${i}ms)`))}),i);e.addEventListener(n,(()=>{clearTimeout(A),s(e)}),!1)}))}}class Ct extends mt{constructor(e){super(e),this._data=null}get data(){return this._data}get type(){return It.DD.Image}get width(){return this._data?this._data.naturalWidth:0}get height(){return this._data?this._data.naturalHeight:0}clone(){if(null==this._data)throw new o.js("Media not loaded");const e=this._data.cloneNode(!0);return Ct.load(e)}_load(e){return this.isLoaded()&&this.release(),e.complete&&0!==e.naturalWidth?new c.s((t=>{this._data=e,t(this)})):mt._waitUntil(e,"load").then((()=>(this._data=e,this)))}static load(e){return new Ct(ft)._load(e)}}class Et extends mt{constructor(e){super(e),this._data=null}get data(){return this._data}get type(){return It.DD.Video}get width(){return this._data?this._data.videoWidth:0}get height(){return this._data?this._data.videoHeight:0}clone(){if(null==this._data)throw new o.js("Media not loaded");const e=this._data.cloneNode(!0);return Et.load(e)}_load(e){return this.isLoaded()&&this.release(),e.readyState>=4?new c.s((t=>{this._data=e,t(this)})):mt._waitUntil(e,"canplaythrough").then((()=>(this._data=e,this)))}static load(e){return new Et(ft)._load(e)}}class xt extends mt{constructor(e){super(e),this._data=null}get data(){return this._data}get type(){return It.DD.Canvas}get width(){return this._data?this._data.width:0}get height(){return this._data?this._data.height:0}clone(){if(null==this._data)throw new o.js("Media not loaded");const e=t.c.createCanvas(this.width,this.height);return e.getContext("2d").drawImage(this._data,0,0),xt.load(e)}_load(e){return this.isLoaded()&&this.release(),new c.s((t=>{this._data=e,t(this)}))}static load(e){return new xt(ft)._load(e)}}class yt extends mt{constructor(e){super(e),this._data=null}get data(){return this._data}get type(){return It.DD.Bitmap}get width(){return this._data?this._data.width:0}get height(){return this._data?this._data.height:0}clone(){if(null==this._data)throw new o.js("Media not loaded");return new c.s(((e,t)=>{createImageBitmap(this._data).then((n=>{new yt(ft)._load(n).then(e,t)}),t)}))}release(){return null!=this._data&&this._data.close(),super.release()}_load(e){return this.isLoaded()&&this.release(),new c.s((t=>{this._data=e,t(this)}))}static load(e){return new yt(ft)._load(e)}}class _t{constructor(e){this._gpu=e}upload(e,t){const n=e.data;return n instanceof HTMLVideoElement&&n.readyState<2?t:t.upload(n,e.width,e.height)}release(){return null}}var St=n(9845);class Pt extends St.y{constructor(){super(),this._speedyGL=e.$.instance,this._programs=new gt(this),this._texturePool=new ut(this),this._textureUploader=new _t(this),this._speedyGL.subscribe(this._reset,this)}get programs(){return this._programs}get gl(){return this._speedyGL.gl}get canvas(){return this._speedyGL.canvas}get texturePool(){return this._texturePool}renderToCanvas(e){const n=e.width,i=e.height,o=this.canvas;return(n>o.width||i>o.height)&&(t.c.warning(`Resizing the canvas to ${n} x ${i}`),o.width=n,o.height=i),this.programs.utils.renderToCanvas.outputs(n,i,null),this.programs.utils.renderToCanvas(e),o}upload(e,t){return this._textureUploader.upload(e,t)}release(){return t.c.assert(!this.isReleased()),this._programs=this._programs.release(),this._texturePool=this._texturePool.release(),this._textureUploader=this._textureUploader.release(),this._speedyGL.unsubscribe(this._reset),null}isReleased(){return null==this._programs}loseAndRestoreWebGLContext(){return this._speedyGL.loseAndRestoreContext().then((()=>{}))}_reset(){this.isReleased()||(this._programs=new gt(this),this._texturePool=new ut(this),this._textureUploader=new _t(this),this._notify())}}class Bt{constructor(e,t){this._width=Math.max(0,+e),this._height=Math.max(0,+t)}get width(){return this._width}set width(e){this._width=Math.max(0,+e)}get height(){return this._height}set height(e){this._height=Math.max(0,+e)}toString(){return`SpeedySize(${this.width}, ${this.height})`}equals(e){return this.width===e.width&&this.height===e.height}area(){return this.width*this.height}}const vt=Symbol();class Qt{constructor(e,t,n={}){if(e!==vt)throw new o.js;if(this._source=t,this._format=void 0!==n.format?n.format:It.D3.RGBA,this._options=Object.freeze({...n,format:this._format}),!t.isLoaded())throw new o.js(`Source not loaded: ${t}`);if(this._format!==It.D3.RGBA&&this._format!==It.D3.GREY)throw new o.mG(`Invalid format: ${this._format}`)}static load(e,n={},i=!0){return mt.load(e).then((o=>{t.c.assert(0!==o.width&&0!==o.height);const s=new Qt(vt,o,n);return i&&t.c.log(`Loaded SpeedyMedia with a ${e}.`),s}))}get source(){return this._source?this._source.data:null}get type(){if(this.isReleased())return"unknown";switch(this._source.type){case It.DD.Image:return"image";case It.DD.Video:return"video";case It.DD.Canvas:return"canvas";case It.DD.Bitmap:return"bitmap";default:return"unknown"}}get width(){return this._source?this._source.width:0}get height(){return this._source?this._source.height:0}get size(){return this._source?new Bt(this._source.width,this._source.height):new Bt(0,0)}get options(){return this._options}release(){return this.isReleased()||(t.c.log("Releasing SpeedyMedia object..."),this._source=this._source.release()),null}isReleased(){return null==this._source}clone(){if(this.isReleased())throw new o.js("Can't clone a SpeedyMedia that has been released");const e=new Qt(vt,this._source,this._options);return c.s.resolve(e)}toBitmap(){if(this.isReleased())throw new o.js("Can't convert SpeedyMedia to ImageBitmap: the media has been released");if(this._source.isLoaded())return this._source.type==It.DD.Bitmap?c.s.resolve(this._source.data):new c.s(((e,t)=>createImageBitmap(this._source.data).then(e,t)));throw new o.js("Can't convert SpeedyMedia to bitmap: the media hasn't been loaded")}}var wt=n(3135);let Dt=null;class bt{constructor(){if(this._fps=60,this._frames=0,this._updateInterval=500,this._lastUpdate=performance.now(),this._boundUpdate=this._update.bind(this),null!==Dt)throw new o.js("Can't have multiple instances of FPSCounter");this._boundUpdate()}static get instance(){return null===Dt&&(Dt=new bt),Dt}get fps(){return this._fps}_update(){const e=performance.now(),t=e-this._lastUpdate;t>=this._updateInterval&&(this._fps=Math.round(this._frames/(.001*t)),this._frames=0,this._lastUpdate=e),this._frames++,requestAnimationFrame(this._boundUpdate)}}class Mt{constructor(e,t){this._x=+e,this._y=+t}get x(){return this._x}set x(e){this._x=+e}get y(){return this._y}set y(e){this._y=+e}toString(){return`SpeedyVector2(${this.x.toFixed(5)}, ${this.y.toFixed(5)})`}equals(e){return this.x===e.x&&this.y===e.y}dot(e){return this.x*e.x+this.y*e.y}distanceTo(e){const t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}normalized(){const e=this.length();return e>0?new Mt(this.x/e,this.y/e):new Mt(0,0)}plus(e){return new Mt(this.x+e.x,this.y+e.y)}minus(e){return new Mt(this.x-e.x,this.y-e.y)}times(e){return new Mt(this.x*e,this.y*e)}}class Kt{constructor(e,t){this._x=+e,this._y=+t}get x(){return this._x}set x(e){this._x=+e}get y(){return this._y}set y(e){this._y=+e}toString(){return`SpeedyPoint2(${this.x.toFixed(5)}, ${this.y.toFixed(5)})`}plus(e){return new Kt(this.x+e.x,this.y+e.y)}minus(e){return new Mt(this.x-e.x,this.y-e.y)}equals(e){return this.x===e.x&&this.y===e.y}}n(5137);var Lt=n(4368),kt=n(8007);const Nt=Object.freeze({Nothing:Symbol("Nothing"),Image:Symbol("Image"),Keypoints:Symbol("Keypoints"),Vector2:Symbol("Vector2"),LSHTables:Symbol("LSHTables"),KeypointMatches:Symbol("KeypointMatches")});class Rt{constructor(e){this._type=e}get type(){return this._type}hasType(e){return this._type===e}isEmpty(){return this.hasType(Nt.Nothing)}toString(){return`message of type ${Object.keys(Nt).find((e=>Nt[e]===this.type))}`}set(...e){throw new o.Mi}static create(e){return function(e){return new Xt[e]}(e)}}class zt extends Rt{constructor(){super(Nt.Nothing)}set(){return this}}const Xt=Object.freeze({[Nt.Nothing]:zt,[Nt.Image]:class extends Rt{constructor(){super(Nt.Image),this._image=null,this._format=It.D3.RGBA}set(e,t=It.D3.RGBA){return this._image=e,this._format=t,this}get image(){return this._image}get format(){return this._format}},[Nt.Keypoints]:class extends Rt{constructor(){super(Nt.Keypoints),this._encodedKeypoints=null,this._descriptorSize=0,this._extraSize=0,this._encoderLength=1}set(e,n,i,o){return this._encodedKeypoints=e,this._descriptorSize=0|n,this._extraSize=0|i,this._encoderLength=0|o,t.c.assert(this._descriptorSize>=0&&this._extraSize>=0),t.c.assert(this._encoderLength===this._encodedKeypoints.width,"Invalid encoderLength"),t.c.assert(this._encodedKeypoints.width===this._encodedKeypoints.height,"Invalid encodedKeypoints texture"),this}get encodedKeypoints(){return this._encodedKeypoints}get descriptorSize(){return this._descriptorSize}get extraSize(){return this._extraSize}get encoderLength(){return this._encoderLength}},[Nt.Vector2]:class extends Rt{constructor(){super(Nt.Vector2),this._vectors=null}set(e){return this._vectors=e,this}get vectors(){return this._vectors}},[Nt.LSHTables]:class extends Rt{constructor(){super(Nt.LSHTables),this._lsh=null}set(e){return this._lsh=e,this}get lsh(){return this._lsh}},[Nt.KeypointMatches]:class extends Rt{constructor(){super(Nt.KeypointMatches),this._encodedMatches=null,this._matchesPerKeypoint=1}set(e,n){return this._encodedMatches=e,this._matchesPerKeypoint=0|n,t.c.assert(this._matchesPerKeypoint>0),this}get encodedMatches(){return this._encodedMatches}get matchesPerKeypoint(){return this._matchesPerKeypoint}}});const Tt=e=>!0;class Ft{constructor(e,n=Tt){this._expectedMessageType=e,this._isValidMessage="function"==typeof n?n:Tt,t.c.assert(this._expectedMessageType!=Nt.Nothing)}isCompatibleWith(e){return this._expectedMessageType==e._expectedMessageType}accepts(e){return e.hasType(this._expectedMessageType)&&this._isValidMessage(e)}toString(){return`Port expects ${Object.keys(Nt).find((e=>Nt[e]===this._expectedMessageType))} satisfying ${this._isValidMessage}`}get expectedMessageType(){return this._expectedMessageType}}const Gt=/^[a-z][a-zA-Z0-9]*$/,Ot=new zt;class Ut{constructor(e,n,i){this._name=String(e),this._spec=n,this._node=i,this._message=Ot,t.c.assert(Gt.test(this._name),`Port name "${this._name}" is not acceptable`)}get name(){return this._name}get node(){return this._node}connectTo(e){throw new o.Mi}isInputPort(){throw new o.Mi}isOutputPort(){return!this.isInputPort()}clearMessage(){this._message=Ot}hasMessage(){return!this._message.isEmpty()}read(){if(this._message.isEmpty())throw new o.js(`Can't read from port ${this.name}: nothing to read`);return this._message}write(e){throw new o.B8(`Can't write ${e} to port ${this.name}: unsupported operation`)}static get DEFAULT_NAME(){throw new o.Mi}}class Ht extends Ut{constructor(e,t,n){super(e,t,n),this._cachedMessage=null}connectTo(e){if(!e.isInputPort())throw new o.mG(`Can't connect output port ${this.name} to port ${e.name}: expected an input port`);e.connectTo(this)}isInputPort(){return!1}write(e){if(!this._spec.accepts(e))throw new o.mG(`Can't write ${e} to port ${this.name}. ${this._spec}`);this._message=e}swrite(...e){null==this._cachedMessage&&(this._cachedMessage=Rt.create(this._spec.expectedMessageType)),this.write(this._cachedMessage.set(...e))}static get DEFAULT_NAME(){return"out"}}class qt extends Ut{constructor(e,t,n){super(e,t,n),this._incomingLink=null}get incomingLink(){return this._incomingLink}connectTo(e){if(!e.isOutputPort())throw new o.mG(`Can't connect input port ${this.name} of "${this.node.fullName}" to input port ${e.name} of "${e.node.fullName}": expected an output port`);if(!this._spec.isCompatibleWith(e._spec))throw new o.mG(`Can't connect port ${this.name} of "${this.node.fullName}" to port ${e.name} of "${e.node.fullName}": incompatible types`);this._incomingLink=e}disconnect(){this._incomingLink=null}isInputPort(){return!0}pullMessage(e=""){const t=e.length>0?`${this.name} of ${e}`:this.name;if(null==this._incomingLink)throw new o.js(`No incoming link for input port ${t}`);const n=this._incomingLink.read();if(!this._spec.accepts(n))throw new o.mG(`Can't receive ${n} at port ${t}: ${this._spec}`);return this._message=n}static get DEFAULT_NAME(){return"in"}}class Yt{constructor(e,t){this._class=e,this._name=String(t),this._type=Nt.Nothing,this._messageConstraint=void 0}expects(e){return t.c.assert(this._type==Nt.Nothing),t.c.assert(e!=Nt.Nothing),this._type=e,this}satisfying(e){return t.c.assert(this._type!=Nt.Nothing,"You must first declare what type of message this port expects"),t.c.assert(void 0===this._messageConstraint),t.c.assert("function"==typeof e),this._messageConstraint=e,this}build(e){const t=new Ft(this._type,this._messageConstraint);return Reflect.construct(this._class,[this._name,t,e])}}function Jt(e=qt.DEFAULT_NAME){return new Yt(qt,e)}function Wt(e=Ht.DEFAULT_NAME){return new Yt(Ht,e)}const Zt=[],jt=[],$t="asap"+Math.random().toString(36).substr(1);function Vt(e,...t){Zt.unshift(e),jt.unshift(t),window.postMessage($t,"*")}window.addEventListener("message",(e=>{if(e.source!==window||e.data!==$t)return;if(e.stopPropagation(),0==Zt.length)return;const t=Zt.pop(),n=jt.pop();t.apply(void 0,n)}),!0);const en=navigator.userAgent.includes("Firefox")?(e,...t)=>setTimeout(e,10,...t):(e,...t)=>requestAnimationFrame((()=>e.apply(void 0,t)));class tn{constructor(e=2){t.c.assert(e>0),this._initialized=!1,this._pixelBuffer=new Array(e).fill(null).map((()=>new Uint8Array(0))),this._pbo=new Array(e).fill(null),this._consumerIndex=0,this._producerIndex=e-1,this._promise=Array.from({length:e},(()=>c.s.resolve())),this._busy=new Array(e).fill(!1),this._ready=new Array(e).fill(!0)}init(e){this._allocatePBOs(e),e.subscribe(this._allocatePBOs,this,e),this._initialized=!0}release(e){return e.unsubscribe(this._allocatePBOs,this),this._deallocatePBOs(e),this._initialized=!1,null}readPixelsSync(e,n=0,i=0,o=e.width,s=e.height){t.c.assert(this._initialized);const r=e.gl,A=e.glFbo;o=Math.max(0,Math.min(o,e.width)),s=Math.max(0,Math.min(s,e.height)),n=Math.max(0,Math.min(n,e.width-o)),i=Math.max(0,Math.min(i,e.height-s));const a=o*s*4;return this._reallocate(a),r.isContextLost()||(r.bindFramebuffer(r.FRAMEBUFFER,A),r.readPixels(n,i,o,s,r.RGBA,r.UNSIGNED_BYTE,this._pixelBuffer[0]),r.bindFramebuffer(r.FRAMEBUFFER,null)),this._pixelBuffer[0].subarray(0,a)}readPixelsAsync(e,n=0,i=0,o=e.width,s=e.height,r=!1){t.c.assert(this._initialized);const A=e.gl,a=e.glFbo;o=Math.max(0,Math.min(o,e.width)),s=Math.max(0,Math.min(s,e.height)),n=Math.max(0,Math.min(n,e.width-o)),i=Math.max(0,Math.min(i,e.height-s));const l=o*s*4;if(this._reallocate(l),A.isContextLost())return c.s.resolve(this._pixelBuffer[0].subarray(0,l));if(!r){const e=this._pixelBuffer[0].subarray(0,l);return tn._readPixelsViaPBO(A,this._pbo[0],e,a,n,i,o,s).then((()=>e))}const d=this._pixelBuffer.length,g=this._producerIndex;if(!this._busy[g]){const e=this._pbo[g],t=this._pixelBuffer[g].subarray(0,l);this._producerIndex=(g+1)%d,this._ready[g]=!1,this._busy[g]=!0,this._promise[g]=tn._readPixelsViaPBO(A,e,t,a,n,i,o,s).then((()=>{this._busy[g]=!1,this._ready[g]=!0}))}const h=this._consumerIndex;return this._consumerIndex=(h+1)%d,this._ready[h]?(this._ready[h]=!1,c.s.resolve(this._pixelBuffer[h])):this._promise[h].then((()=>(this._ready[h]=!1,this._pixelBuffer[h])))}_reallocate(e){if(!(e<=this._pixelBuffer[0].byteLength))for(let t=0;t<this._pixelBuffer.length;t++){const n=new Uint8Array(e);this._pixelBuffer[t]=n}}_allocatePBOs(e){const t=e.gl;for(let e=0;e<this._pbo.length;e++)this._pbo[e]=t.createBuffer()}_deallocatePBOs(e){const t=e.gl;for(let e=this._pbo.length-1;e>=0;e--)t.deleteBuffer(this._pbo[e]),this._pbo[e]=null}static _readPixelsViaPBO(e,n,i,s,r,A,a,l){const d=a*l*4;t.c.assert(i.byteLength>=d,"Invalid buffer size"),e.bindBuffer(e.PIXEL_PACK_BUFFER,n),e.bufferData(e.PIXEL_PACK_BUFFER,d,e.DYNAMIC_READ),e.bindFramebuffer(e.FRAMEBUFFER,s),e.readPixels(r,A,a,l,e.RGBA,e.UNSIGNED_BYTE,0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindBuffer(e.PIXEL_PACK_BUFFER,null);const g=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new c.s(((t,n)=>{"asap"!=wt.Z.gpuPollingMode?en(tn._clientWaitAsync,e,g,0,t,n):Vt(tn._clientWaitAsync,e,g,0,t,n)})).then((()=>{e.bindBuffer(e.PIXEL_PACK_BUFFER,n),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,i),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)})).catch((e=>{throw new o.js("Can't getBufferSubDataAsync(): error in clientWaitAsync()",e)})).finally((()=>{e.deleteSync(g)}))}static _clientWaitAsync(e,t,n,i,s,r=10,A=1e3){!function r(){const a=e.clientWaitSync(t,n,0);A--<=0?s(new o.W5("GPU polling timeout",o.Ql.from(e))):a===e.CONDITION_SATISFIED||a===e.ALREADY_SIGNALED?i():"asap"!=wt.Z.gpuPollingMode?requestAnimationFrame(r):Vt(r)}()}}function nn(e){return e.reduce(((e,t)=>(e[t.name]=t,e)),Object.create(null))}function on(e){return e.reduce(((e,t)=>(e[t.name]=t,e)),Object.create(null))}let sn=!1;class rn{constructor(e=(()=>Math.random().toString(16).substr(2))(),t=0,n=[]){this._name=String(e),this._tex=new Array(t).fill(null);const i=n.map((e=>e.build(this))),s=i.filter((e=>e.isInputPort())),r=i.filter((e=>e.isOutputPort()));if(this._inputPorts=nn(s),this._outputPorts=on(r),0==this._name.length)throw new o.mG(`Invalid name "${this._name}" for node ${this.fullName}`);if(0==n.length)throw new o.mG(`No ports have been found in node ${this.fullName}`)}get name(){return this._name}get fullName(){return`${this.constructor.name}[${this.name}]`}input(e=qt.DEFAULT_NAME){if(e in this._inputPorts)return this._inputPorts[e];throw new o.mG(`Can't find input port ${e} in node ${this.fullName}`)}output(e=Ht.DEFAULT_NAME){if(e in this._outputPorts)return this._outputPorts[e];throw new o.mG(`Can't find output port ${e} in node ${this.fullName}`)}execute(e){let n;for(n in this._outputPorts)this._outputPorts[n].clearMessage();for(n in this._inputPorts)this._inputPorts[n].pullMessage(this.fullName);const i=this._run(e);if(void 0!==i)return i.then((()=>{for(n in this._outputPorts)t.c.assert(this._outputPorts[n].hasMessage(),`Did you forget to write data to the output port ${n} of ${this.fullName}?`)}));for(n in this._outputPorts)t.c.assert(this._outputPorts[n].hasMessage(),`Did you forget to write data to the output port ${n} of ${this.fullName}?`)}_run(e){throw new o.Mi}init(e){e.subscribe(this._allocateWorkTextures,this,e),this._allocateWorkTextures(e)}release(e){this._deallocateWorkTextures(e),e.unsubscribe(this._allocateWorkTextures,this)}clearPorts(){let e;for(e in this._inputPorts)this._inputPorts[e].clearMessage();for(e in this._outputPorts)this._outputPorts[e].clearMessage()}inputNodes(){const e=[];for(const t in this._inputPorts){const n=this._inputPorts[t];null!=n.incomingLink&&e.push(n.incomingLink.node)}return e}isSource(){return!1}isSink(){return!1}_allocateWorkTextures(e){for(let t=0;t<this._tex.length;t++)this._tex[t]=e.texturePool.allocate()}_deallocateWorkTextures(e){for(let t=this._tex.length-1;t>=0;t--)this._tex[t]=e.texturePool.free(this._tex[t])}_inspect(e,t){const n=new tn;n.init(e);const i=n.readPixelsSync(t);return n.release(e),new Uint8Array(i)}_inspect32(e,n){return t.c.assert(s.LITTLE_ENDIAN),new Uint32Array(this._inspect(e,n).buffer)}_visualize(e,t){const n=e.renderToCanvas(t);sn||(document.body.appendChild(n),sn=!0)}}class An extends rn{constructor(e,n,i){super(e,n,i),t.c.assert(0==Object.keys(this._inputPorts).length)}isSource(){return!0}}class an extends rn{constructor(e,n,i){super(e,n,i),t.c.assert(0==Object.keys(this._outputPorts).length)}export(){throw new o.Mi}isSink(){return!0}}class cn{constructor(e,t){const n=t<s.MATCH_MAX_DISTANCE;return this._index=n?0|e:-1,this._distance=n?+t:Number.POSITIVE_INFINITY,Object.freeze(this)}get index(){return this._index}get distance(){return this._distance}toString(){return`SpeedyKeypointMatch(${this.index},${this.distance})`}}class ln{constructor(e,t,n=0,i=0,o=0,s=null){this._position=new Kt(+e,+t),this._lod=+n,this._rotation=+i,this._score=+o,this._descriptor=s}toString(){return`SpeedyKeypoint(${this.x},${this.y})`}get position(){return this._position}get x(){return this._position.x}set x(e){this._position.x=+e}get y(){return this._position.y}set y(e){this._position.y=+e}get lod(){return this._lod}get scale(){return Math.pow(2,this._lod)}get rotation(){return this._rotation}get score(){return this._score}get descriptor(){return this._descriptor}}class dn extends ln{constructor(e,t,n=0,i=0,o=0,s=null,r=new Mt(0,0)){super(e,t,n,i,o,s),this._flow=r}get flow(){return this._flow}}class gn extends ln{constructor(e,t,n=0,i=0,o=0,s=null,r=[]){super(e,t,n,i,o,s),this._matches=r}get matches(){return this._matches}}let hn=null,pn=0;class un{constructor(){this._nodes=[],this._sequence=[],this._busy=!1}node(e){for(let t=0,n=this._nodes.length;t<n;t++)if(this._nodes[t].name===e)return this._nodes[t];return null}init(...e){if(this._nodes.length>0)throw new o.js("The pipeline has already been initialized");if(0==e.length)throw new o.mG("Can't initialize the pipeline. Please specify its nodes");0==pn++&&(t.c.assert(!hn,"Duplicate SpeedyGPU instance"),hn=new Pt);for(let t=0;t<e.length;t++){const n=e[t];this._nodes.includes(n)||this._nodes.push(n)}this._sequence=un._tsort(this._nodes),un._validateSequence(this._sequence);for(let e=0;e<this._sequence.length;e++)this._sequence[e].init(hn);return this}release(){if(0==this._nodes.length)throw new o.js("The pipeline has already been released or has never been initialized");for(let e=this._sequence.length-1;e>=0;e--)this._sequence[e].release(hn);return this._sequence.length=0,this._nodes.length=0,0==--pn&&(hn=hn.release()),null}run(){if(t.c.assert(this._sequence.length>0,"The pipeline has not been initialized or has been released"),this._busy)return new c.s(((e,t)=>{setTimeout((()=>this.run().then(e,t)),0)}));this._busy=!0;const e=this._sequence.filter((e=>e.isSink())),n=un._createOutputTemplate(e);return un._runSequence(this._sequence).then((()=>c.s.all(e.map((e=>e.export().turbocharge()))).then((t=>t.reduce(((t,n,i)=>(t[e[i].name]=n,t)),n))))).finally((()=>{for(let e=this._sequence.length-1;e>=0;e--)this._sequence[e].clearPorts();this._busy=!1})).turbocharge()}get _gpu(){return hn}static _runSequence(e,t=0,n=e.length){for(;t<n;t++){const i=e[t].execute(hn);if(hn.gl.flush(),void 0!==i)return i.then((()=>un._runSequence(e,t+1,n)))}return c.s.resolve()}static _tsort(e){const t=un._outlinks(e),n=e.map((e=>[e,!1])),i=new Set,s=new Array(e.length);let r=s.length;for(;n.length>0;){const[e,A]=n.pop();if(A)s[--r]=e;else if(!i.has(e)){const r=t.get(e);if(i.add(e),n.push([e,!0]),n.push(...r.map((e=>[e,!1]))),r.some((e=>i.has(e)&&!s.includes(e))))throw new o.js("Pipeline networks cannot have cycles!")}}return s}static _outlinks(e){const t=new Map;for(let n=0;n<e.length;n++)t.set(e[n],[]);for(let n=0;n<e.length;n++){const i=e[n],s=i.inputNodes();for(let e=0;e<s.length;e++){const n=s[e],r=t.get(n);if(!r)throw new o.js(`Can't initialize the pipeline. Missing node: ${n.fullName}. Did you forget to add it to the initialization list?`);r.includes(i)||r.push(i)}}return t}static _createOutputTemplate(e=[]){const t=Object.create(null);for(let n=e.length-1;n>=0;n--)t[e[n].name]=null;return t}static _validateSequence(e){if(0==e.length)throw new o.js("Pipeline doesn't have nodes");if(!e[0].isSource())throw new o.js("Pipeline doesn't have a source");if(!e.find((e=>e.isSink())))throw new o.js("Pipeline doesn't have a sink")}}class In extends An{constructor(e){super(e,2,[Wt().expects(Nt.Image)]),this._media=null,this._textureIndex=0}get media(){return this._media}set media(e){if(null!==e&&!(e instanceof Qt))throw new o.mG(`Not a SpeedyMedia: ${e}`);this._media=e}_run(e){if(null==this._media)throw new o.js(`Did you forget to set the media of ${this.fullName}?`);this._textureIndex=(this._textureIndex+1)%this._tex.length;const t=this._tex[this._textureIndex];e.upload(this._media._source,t),this.output().swrite(t,this._media._format)}}class fn extends an{constructor(e="image"){super(e,0,[Jt().expects(Nt.Image)]),this._bitmap=null,this._format=It.D3.RGBA}export(){return t.c.assert(null!=this._bitmap),Qt.load(this._bitmap,{format:this._format},!1)}_run(e){const{image:t,format:n}=this.input().read();return new c.s((i=>{const o=e.renderToCanvas(t);createImageBitmap(o,0,o.height-t.height,t.width,t.height).then((e=>{this._bitmap=e,this._format=n,i()}))}))}}const mn=["in0","in1"];class Cn extends rn{constructor(e){super(e,0,[...mn.map((e=>Jt(e).expects(Nt.Image))),Wt().expects(Nt.Image)]),this._port=0}get port(){return this._port}set port(e){if(e<0||e>=mn.length)throw new o.mG(`Invalid port: ${e}`);this._port=0|e}_run(e){const t=this.input(mn[this._port]).read();this.output().write(t)}}class En extends rn{constructor(e){super(e,2,[Jt().expects(Nt.Image),Wt().expects(Nt.Image)]),this._pageIndex=0,this._initialized=!1,this._previousFormat=It.D3.RGBA,this._frozen=!1}get frozen(){return this._frozen}set frozen(e){this._frozen=Boolean(e)}release(e){this._initialized=!1,super.release(e)}_run(e){const{image:t,format:n}=this.input().read(),i=this._previousFormat,s=this._tex,r=s[1-this._pageIndex],A=s[this._pageIndex];if(t.hasMipmaps())throw new o.B8(`${this.fullName} can't bufferize a pyramid`);if(this._frozen&&this._initialized||(this._previousFormat=n,r.resize(t.width,t.height),t.copyTo(r),this._pageIndex=1-this._pageIndex),!this._initialized)return this._initialized=!0,void this.output().swrite(r,n);this.output().swrite(A,i)}}const xn=s.PYRAMID_MAX_LEVELS,yn=2*xn;class _n extends rn{constructor(e){super(e,yn+1,[Jt().expects(Nt.Image),Wt().expects(Nt.Image)])}_run(e){const{image:t,format:n}=this.input().read(),i=this._tex[0],o=e.programs.pyramids;let s=t.width,r=t.height;const A=1+Math.floor(Math.log2(Math.max(s,r))),a=new Array(yn+1);for(let e=yn;e>=1;e--)a[e-1]=this._tex[e];a[0].resize(s,r),t.copyTo(a[0]);const c=Math.min(A,xn);for(let t=1;t<c;t++){const n=Math.max(1,s>>>1),i=Math.max(1,r>>>1),A=t-1+xn;o.smoothX.outputs(s,r,a[A])(a[t-1]),o.smoothY.outputs(s,r,a[t-1])(a[A]),o.downsample2.outputs(n,i,a[t])(a[t-1]),e.gl.flush(),s=n,r=i}i.resize(t.width,t.height),i.clear(),t.copyTo(i),i.generateMipmaps(a.slice(0,c)),this.output().swrite(i,n)}}class Sn extends rn{constructor(e){super(e,1,[Jt("in0").expects(Nt.Image),Jt("in1").expects(Nt.Image),Wt().expects(Nt.Image)]),this._alpha=.5,this._beta=.5,this._gamma=0}get alpha(){return this._alpha}set alpha(e){this._alpha=+e}get beta(){return this._beta}set beta(e){this._beta=+e}get gamma(){return this._gamma}set gamma(e){this._gamma=+e}_run(e){const t=this.input("in0").read(),n=this.input("in1").read(),i=t.image,s=n.image,r=t.format,A=n.format,a=Math.max(i.width,s.width),c=Math.max(i.height,s.height),l=this._alpha,d=this._beta,g=this._gamma,h=this._tex[0];if(r!=A)throw new o.B8("Can't mix images of different formats");e.programs.transforms.additiveMix.outputs(a,c,h),e.programs.transforms.additiveMix(i,s,l,d,g),this.output().swrite(h,r)}}class Pn extends rn{constructor(e){super(e,1,[Jt().expects(Nt.Image)]),this._format=It.D3.RGBA,this._initialized=!1}get image(){if(!this._initialized)throw new o.js(`Portal error: ${this.fullName} holds no data`);return this._tex[0]}get format(){if(!this._initialized)throw new o.js(`Portal error: ${this.fullName} holds no data`);return this._format}init(e){super.init(e),this._tex[0].resize(1,1).clear(),this._format=It.D3.RGBA,this._initialized=!0}release(e){this._initialized=!1,super.release(e)}_run(e){const{image:t,format:n}=this.input().read(),i=this._tex[0];if(t.hasMipmaps())throw new o.B8(`${this.fullName} can't store a pyramid`);this._format=n,i.resize(t.width,t.height),t.copyTo(i)}}class Bn extends An{constructor(e){super(e,0,[Wt().expects(Nt.Image)]),this._source=null}get source(){return this._source}set source(e){if(null!==e&&!(e instanceof Pn))throw new o.mG(`Incompatible source for ${this.fullName}`);this._source=e}_run(e){if(null==this._source)throw new o.js(`${this.fullName} has no source`);this.output().swrite(this._source.image,this._source.format)}}class vn extends T.R{static Source(e){return new Bn(e)}static Sink(e){return new Pn(e)}}class Qn extends T.R{static Source(e){return new In(e)}static Sink(e){return new fn(e)}static Multiplexer(e){return new Cn(e)}static Buffer(e){return new En(e)}static Pyramid(e){return new _n(e)}static Mixer(e){return new Sn(e)}static get Portal(){return vn}}class wn extends rn{constructor(e){super(e,1,[Jt().expects(Nt.Image),Wt().expects(Nt.Image)])}_run(e){const{image:t,format:n}=this.input().read(),i=t.width,o=t.height,s=this._tex[0],r=e.programs.filters;r.rgb2grey.outputs(i,o,s),r.rgb2grey(t),this.output().swrite(s,It.D3.GREY)}}const Dn=Object.freeze({3:[.27901008925473514,.44197982149052983,.27901008925473514],5:[.06135959781344021,.2447701955296099,.3877404133138998,.2447701955296099,.06135959781344021],7:[.03873542500847274,.11308485700794121,.2150068609928349,.26634571398150225,.2150068609928349,.11308485700794121,.03873542500847274],9:[.028532262603370988,.067234535494912,.12400932997922749,.17904386461741617,.20236001461014655,.17904386461741617,.12400932997922749,.067234535494912,.028532262603370988],11:[.022656882730580346,.04610857898527292,.08012661469398517,.11890414969751599,.15067709325491124,.16305336127546846,.15067709325491124,.11890414969751599,.08012661469398517,.04610857898527292,.022656882730580346],13:[.018815730430644363,.03447396964662016,.05657737457255748,.08317258170844948,.10952340502389682,.12918787500405662,.13649812722755,.12918787500405662,.10952340502389682,.08317258170844948,.05657737457255748,.03447396964662016,.018815730430644363],15:[.016100340991695383,.027272329212157102,.042598338587449644,.06135478775568558,.08148767614129326,.09979838342934616,.11270444144735056,.11736740487004466,.11270444144735056,.09979838342934616,.08148767614129326,.06135478775568558,.042598338587449644,.027272329212157102,.016100340991695383]}),bn=new Mt(0,0),Mn=Object.freeze({3:"convolution3x",5:"convolution5x",7:"convolution7x",9:"convolution9x",11:"convolution11x",13:"convolution13x",15:"convolution15x"}),Kn=Object.freeze({3:"convolution3y",5:"convolution5y",7:"convolution7y",9:"convolution9y",11:"convolution11y",13:"convolution13y",15:"convolution15y"});class Ln extends rn{constructor(e){super(e,2,[Jt().expects(Nt.Image),Wt().expects(Nt.Image)]),this._kernelSize=new Bt(5,5),this._sigma=bn,this._kernel={x:Dn[this._kernelSize.width],y:Dn[this._kernelSize.height]}}get kernelSize(){return this._kernelSize}set kernelSize(e){t.c.assert(e instanceof Bt);const n=e.width,i=e.height;if(n<3||i<3||n>15||i>15||n%2==0||i%2==0)throw new o.B8(`Unsupported kernel size: ${n}x${i}`);this._kernelSize=e,this._updateKernel()}get sigma(){return this._sigma}set sigma(e){t.c.assert(e instanceof Mt,"Sigma must be a SpeedyVector2"),t.c.assert(e.x>=0&&e.y>=0),this._sigma=e,this._updateKernel()}_run(e){const{image:t,format:n}=this.input().read(),i=t.width,o=t.height,s=this._kernel.x,r=this._kernel.y,A=Mn[this._kernelSize.width],a=Kn[this._kernelSize.height],c=this._tex[0],l=this._tex[1];e.programs.filters[A].outputs(i,o,c)(t,s),e.programs.filters[a].outputs(i,o,l)(c,r),this.output().swrite(l,n)}_updateKernel(){this._sigma.x==bn.x?this._kernel.x=Dn[this._kernelSize.width]:this._kernel.x=t.c.gaussianKernel(this._sigma.x,this._kernelSize.width,!0),this._sigma.y==bn.y?this._kernel.y=Dn[this._kernelSize.height]:this._kernel.y=t.c.gaussianKernel(this._sigma.y,this._kernelSize.height,!0)}}const kn=Object.freeze({3:new Array(3).fill(1/3),5:new Array(5).fill(.2),7:new Array(7).fill(1/7),9:new Array(9).fill(1/9),11:new Array(11).fill(1/11),13:new Array(13).fill(1/13),15:new Array(15).fill(1/15)}),Nn=Object.freeze({3:"convolution3x",5:"convolution5x",7:"convolution7x",9:"convolution9x",11:"convolution11x",13:"convolution13x",15:"convolution15x"}),Rn=Object.freeze({3:"convolution3y",5:"convolution5y",7:"convolution7y",9:"convolution9y",11:"convolution11y",13:"convolution13y",15:"convolution15y"});class zn extends rn{constructor(e){super(e,2,[Jt().expects(Nt.Image),Wt().expects(Nt.Image)]),this._kernelSize=new Bt(5,5),this._kernel={x:kn[this._kernelSize.width],y:kn[this._kernelSize.height]}}get kernelSize(){return this._kernelSize}set kernelSize(e){t.c.assert(e instanceof Bt);const n=e.width,i=e.height;if(n<3||i<3||n>15||i>15||n%2==0||i%2==0)throw new o.B8(`Unsupported kernel size: ${n}x${i}`);this._kernelSize=e,this._kernel.x=kn[this._kernelSize.width],this._kernel.y=kn[this._kernelSize.height]}_run(e){const{image:t,format:n}=this.input().read(),i=t.width,o=t.height,s=this._kernel.x,r=this._kernel.y,A=Nn[this._kernelSize.width],a=Rn[this._kernelSize.height],c=this._tex[0],l=this._tex[1];e.programs.filters[A].outputs(i,o,c)(t,s),e.programs.filters[a].outputs(i,o,l)(c,r),this.output().swrite(l,n)}}const Xn={3:"median3",5:"median5",7:"median7"};class Tn extends rn{constructor(e){super(e,1,[Jt().expects(Nt.Image).satisfying((e=>e.format===It.D3.GREY)),Wt().expects(Nt.Image)]),this._kernelSize=new Bt(5,5)}get kernelSize(){return this._kernelSize}set kernelSize(e){t.c.assert(e instanceof Bt);const n=e.width;if(3!=n&&5!=n&&7!=n)throw new o.B8("Supported kernel sizes: 3x3, 5x5, 7x7");if(e.width!=e.height)throw new o.B8("Use a square kernel");this._kernelSize=e}_run(e){const{image:t,format:n}=this.input().read(),i=t.width,o=t.height,s=this._kernelSize.width,r=Xn[s],A=this._tex[0];e.programs.filters[r].outputs(i,o,A)(t),this.output().swrite(A,n)}}const Fn={3:"convolution3",5:"convolution5",7:"convolution7"};class Gn extends rn{constructor(e){super(e,1,[Jt().expects(Nt.Image),Wt().expects(Nt.Image)]),this._kernel=kt.SpeedyMatrix.Create(3,3,[0,0,0,0,1,0,0,0,0])}get kernel(){return this._kernel}set kernel(e){if(e.rows!=e.columns)throw new o.B8("Use a square kernel");if(3!=e.rows&&5!=e.rows&&7!=e.rows)throw new o.B8("Invalid kernel size. Supported sizes: 3x3, 5x5, 7x7");this._kernel=e}_run(e){const{image:t,format:n}=this.input().read(),i=t.width,o=t.height,s=this._tex[0],r=this._kernel.rows,A=Fn[r],a=this._kernel.read();e.programs.filters[A].outputs(i,o,s)(t,a),this.output().swrite(s,n)}}class On extends rn{constructor(e){super(e,3,[Jt().expects(Nt.Image).satisfying((e=>e.format===It.D3.RGBA||e.format===It.D3.GREY)),Wt().expects(Nt.Image)]),this._gain=.5,this._offset=.5,this._decay=0,this._quality="medium"}get gain(){return this._gain}set gain(e){this._gain=+e}get offset(){return this._offset}set offset(e){this._offset=+e}get decay(){return this._decay}set decay(e){this._decay=Math.max(0,Math.min(+e,1))}get quality(){return this._quality}set quality(e){if("high"!==e&&"medium"!==e&&"low"!==e)throw new o.mG(`Invalid quality level for the Nightvision filter: "${e}"`);this._quality=e}_run(e){const{image:t,format:n}=this.input().read(),i=t.width,o=t.height,s=this._gain,r=this._offset,A=this._decay,a=this._quality,c=e.programs.filters,l=this._tex[0],d=this._tex[1],g=this._tex[2];"medium"==a?(c.illuminationMapX.outputs(i,o,l),c.illuminationMapY.outputs(i,o,d),c.illuminationMapX(t),c.illuminationMapY(l)):"high"==a?(c.illuminationMapHiX.outputs(i,o,l),c.illuminationMapHiY.outputs(i,o,d),c.illuminationMapHiX(t),c.illuminationMapHiY(l)):"low"==a&&(c.illuminationMapLoX.outputs(i,o,l),c.illuminationMapLoY.outputs(i,o,d),c.illuminationMapLoX(t),c.illuminationMapLoY(l)),n===It.D3.GREY?(c.nightvisionGreyscale.outputs(i,o,g),c.nightvisionGreyscale(t,d,s,r,A)):n===It.D3.RGBA&&(c.nightvision.outputs(i,o,g),c.nightvision(t,d,s,r,A)),this.output().swrite(g,n)}}class Un extends rn{constructor(e){super(e,4,[Jt().expects(Nt.Image).satisfying((e=>e.format===It.D3.GREY)),Wt().expects(Nt.Image)]),this._minValue=0,this._maxValue=255}get minValue(){return this._minValue}set minValue(e){this._minValue=Math.max(0,Math.min(+e,255))}get maxValue(){return this._maxValue}set maxValue(e){this._maxValue=Math.max(0,Math.min(+e,255))}_run(e){const{image:t,format:n}=this.input().read(),i=t.width,o=t.height,s=this._tex[3];let r=this._minValue,A=this._maxValue;r>A&&(r=A=(r+A)/2);const a=this._scanMinMax(e,t,It.hE.GREEN);e.programs.filters.normalizeGreyscale.outputs(i,o,s),e.programs.filters.normalizeGreyscale(a,r,A),this.output().swrite(s,n)}_scanMinMax(e,n,i){const o=this._tex,s=e.programs.utils,r=n.width,A=n.height,a=0|Math.ceil(Math.log2(Math.max(r,A)));t.c.assert(void 0!==It.rY[i]),s.copyComponents.outputs(r,A,o[2]),s.scanMinMax2D.outputs(r,A,o[0],o[1]);let c=s.copyComponents(n,n,It.hE.ALL,It.rY[i]);for(let e=0;e<a;e++)c=s.scanMinMax2D(c,e);return c}}class Hn extends T.R{static Greyscale(e){return new wn(e)}static GaussianBlur(e){return new Ln(e)}static SimpleBlur(e){return new zn(e)}static MedianBlur(e){return new Tn(e)}static Convolution(e){return new Gn(e)}static Nightvision(e){return new On(e)}static Normalize(e){return new Un(e)}}const qn=[0,0,0,0,0,0,0,0,1];class Yn extends rn{constructor(e){super(e,1,[Jt().expects(Nt.Image),Wt().expects(Nt.Image)]),this._transform=kt.SpeedyMatrix.Create(3,3,[1,0,0,0,1,0,0,0,1])}get transform(){return this._transform}set transform(e){if(3!=e.rows||3!=e.columns)throw new o.mG(`Not a 3x3 transformation matrix: ${e}`);this._transform=e}_run(e){const{image:t,format:n}=this.input().read(),i=t.width,o=t.height,s=this._tex[0],r=this._transform.read(),A=this._inverse3(r),a=!Number.isNaN(A[0]);e.programs.transforms.warpPerspective.outputs(i,o,s),e.programs.transforms.warpPerspective(t,a?A:qn),this.output().swrite(s,n)}_inverse3(e,t=1e-6){const n=e[0],i=e[1],o=e[2],s=e[3],r=e[4],A=e[5],a=e[6],c=e[7],l=e[8],d=l*r-A*c,g=l*s-A*a,h=c*s-r*a,p=n*d-i*g+o*h;if(Math.abs(p)<t)e.fill(Number.NaN,0,9);else{const t=1/p;e[0]=d*t,e[1]=-(l*i-o*c)*t,e[2]=(A*i-o*r)*t,e[3]=-g*t,e[4]=(l*n-o*a)*t,e[5]=-(A*n-o*s)*t,e[6]=h*t,e[7]=-(c*n-i*a)*t,e[8]=(r*n-i*s)*t}return e}}class Jn extends rn{constructor(e){super(e,1,[Jt().expects(Nt.Image),Wt().expects(Nt.Image)]),this._size=new Bt(0,0),this._scale=new Mt(1,1),this._method="bilinear"}get size(){return this._size}set size(e){this._size=e}get scale(){return this._scale}set scale(e){this._scale=e}get method(){return this._method}set method(e){if("nearest"!==e&&"bilinear"!==e)throw new o.mG(`Invalid method method: "${e}"`);this._method=e}_run(e){const{image:t,format:n}=this.input().read(),i=t.width,o=t.height,s=this._tex[0],r=this._method,A=this._size.width||Math.max(1,this._scale.x*i),a=this._size.height||Math.max(1,this._scale.y*o);"bilinear"==r?e.programs.transforms.resizeBilinear.outputs(A,a,s)(t):"nearest"==r&&e.programs.transforms.resizeNearest.outputs(A,a,s)(t),this.output().swrite(s,n)}}class Wn extends T.R{static Resize(e){return new Jn(e)}static PerspectiveWarp(e){return new Yn(e)}}const Zn=s.MAX_ENCODER_CAPACITY,jn=s.DEFAULT_ENCODER_CAPACITY;class $n extends rn{constructor(e,t=0,n){super(e,t+0,n),this._capacity=jn,this._oldWrapS=0,this._tex16=new Array(2).fill(null)}init(e){super.init(e),this._oldWrapS=this._setupSpecialTexture(e.gl.TEXTURE_WRAP_S,e.gl.REPEAT),this._allocateTex16(e),e.subscribe(this._allocateTex16,this,e)}release(e){e.unsubscribe(this._allocateTex16,this),this._deallocateTex16(e),this._setupSpecialTexture(e.gl.TEXTURE_WRAP_S,this._oldWrapS),super.release(e)}_setupSpecialTexture(e,t){}get capacity(){return this._capacity}set capacity(e){this._capacity=Math.min(Math.max(0,0|e),Zn)}_encodeKeypoints(e,t,n,i=0,o=0){const s=this._capacity,r=$n.encoderLength(s,i,o),A=1<<(Math.ceil(Math.log2(t.width*t.height))>>>1),a=Math.ceil(t.width*t.height/A),c=Math.max(A,a),l=e.programs.keypoints;l.initLookupTable.outputs(A,a,this._tex16[1]),l.sortLookupTable.outputs(A,a,this._tex16[0],this._tex16[1]),l.encodeKeypoints.outputs(r,r,n);let d=l.initLookupTable(t);for(let e=1;e<c;e*=2)d=l.sortLookupTable(d,e,A,a);return l.encodeKeypoints(t,d,A,i,o,r,s)}_encodeKeypointsOLD(e,t,n,i=0,o=0){const s=this._capacity,r=$n.encoderLength(s,i,o),A=t.width,a=t.height,c=[A,a],l=this._tex.slice(this._tex.length-0),d=e.programs.keypoints,g=l.pop();d.encodeKeypointSkipOffsets.outputs(A,a,l[0]),d.encodeKeypointLongSkipOffsets.outputs(A,a,l[1],l[0]),d.encodeKeypointPositions.outputs(r,r,l[2],l[3]),d.encodeKeypointProperties.outputs(r,r,n),t=e.programs.utils.copy.outputs(A,a,g)(t);let h=d.encodeKeypointSkipOffsets(t,c);for(let e=0;e<2;e++)h=d.encodeKeypointLongSkipOffsets(h,c);let p=l[3].clear();for(let e=0;e<4;e++)p=d.encodeKeypointPositions(h,c,e,4,s,p,i,o,r);return d.encodeKeypointProperties(t,p,i,o,r)}_encodeZeroKeypoints(e,t,n=0,i=0){const o=$n.encoderLength(0,n,i),s=e.programs.keypoints;return s.encodeNullKeypoints.outputs(o,o,t),s.encodeNullKeypoints()}_allocateTex16(e){const t=e.gl;for(let e=0;e<this._tex16.length;e++)this._tex16[e]=new A(t,1,1,t.RGBA_INTEGER,t.RGBA16UI,t.UNSIGNED_SHORT,t.NEAREST,t.CLAMP_TO_EDGE)}_deallocateTex16(e){for(let e=0;e<this._tex16.length;e++)this._tex16[e]=this._tex16[e].release()}static encoderLength(e,t,n){const i=e*Math.ceil((s.MIN_KEYPOINT_SIZE+t+n)/4);return Math.max(s.MIN_ENCODER_LENGTH,Math.ceil(Math.sqrt(i)))}static encoderCapacity(e,t,n){const i=Math.ceil((s.MIN_KEYPOINT_SIZE+e+t)/4),o=n*n;return Math.floor(o/i)}}class Vn extends $n{constructor(e,t,n){super(e,t,n),this._levels=1,this._scaleFactor=1.4142135623730951}get levels(){return this._levels}set levels(e){this._levels=Math.max(1,0|e)}get scaleFactor(){return this._scaleFactor}set scaleFactor(e){this._scaleFactor=Math.max(1,Math.min(+e,2))}}const ei=1024,ti=4*Float32Array.BYTES_PER_ELEMENT;class ni extends An{constructor(e){super(e,2,[Wt().expects(Nt.Keypoints)]),this._keypoints=[],this._buffer=ni._createUploadBuffer(ei),this._capacity=s.DEFAULT_ENCODER_CAPACITY}get keypoints(){return this._keypoints}set keypoints(e){if(!Array.isArray(e))throw new o.mG("Not an array of keypoints");this._keypoints=e}get capacity(){return this._capacity}set capacity(e){this._capacity=Math.min(Math.max(0,0|e),s.MAX_ENCODER_CAPACITY)}_run(e){const t=this._keypoints,n=this._capacity,i=Math.min(t.length,n),o=Math.max(1,Math.ceil(i/ei)),s=this._buffer,r=e.programs.keypoints.uploadKeypoints,A=$n.encoderLength(n,0,0);r.outputs(A,A,this._tex[0],this._tex[1]);let a=0,c=r.clear();for(let e=0;e<o;e++){const e=a+Math.min(ei,i-a);r.setUBO("KeypointBuffer",ni._fillUploadBuffer(s,t,a,e)),c=r(c,a,e,0,0,A),a=e}this.output().swrite(c,0,0,A)}static _createUploadBuffer(e){const n=new ArrayBuffer(ti*e);return t.c.assert(n.byteLength<=16384),new Float32Array(n)}static _fillUploadBuffer(e,t,n,i){const o=i-n;for(let i=0;i<o;i++){const o=t[n+i],s=void 0!==o.position,r=4*i;e[r]=+(s?o.position.x:o.x)||0,e[r+1]=+(s?o.position.y:o.y)||0,e[r+2]=+o.lod||0,e[r+3]=+o.score||0}return e}}class ii{constructor(e){return this._data=e,Object.freeze(this)}get data(){return this._data}get size(){return this._data.byteLength}toString(){return`SpeedyKeypointDescriptor(${this._data.join(",")})`}}const oi=new Uint8Array([]);class si extends an{constructor(e="keypoints",t=0,n=[]){super(e,t+2,n),this._keypoints=[],this._textureReader=new tn,this._page=0,this._turbo=!1,this._includeDiscarded=!1}get turbo(){return this._turbo}set turbo(e){this._turbo=Boolean(e)}get includeDiscarded(){return this._includeDiscarded}set includeDiscarded(e){this._includeDiscarded=Boolean(e)}init(e){super.init(e),this._textureReader.init(e)}release(e){this._textureReader.release(e),super.release(e)}export(){return c.s.resolve(this._keypoints)}_run(e){const{encodedKeypoints:t,descriptorSize:n,extraSize:i,encoderLength:o}=this.input().read();return this._download(e,t,n,i,o)}_download(e,t,n,i,o){const s=this._turbo,r=(A=o)>1?1<<Math.ceil(Math.log2(A)):1;var A;const a=Math.ceil(o*o/r),c=this._tex[this._tex.length-1-this._page];return e.programs.utils.copyKeypoints.outputs(r,a,c)(t),this._page=1-this._page,this._textureReader.readPixelsAsync(c,0,0,c.width,c.height,s).then((e=>{this._keypoints=this._decode(e,n,i,r,a)}))}_decode(e,n,i,r,A){const a=s.MIN_KEYPOINT_SIZE+n+i,c=s.LOG2_PYRAMID_MAX_SCALE,l=s.PYRAMID_MAX_LEVELS,d=Math.PI/255,g=[],h=this._includeDiscarded;let p,u,I,f,m,C,E,x,y=oi,_=oi;if(n%4!=0||i%4!=0)throw new o.mG(`Invalid descriptorSize (${n}) / extraSize (${i})`);const S=r*A*4,P=e.byteLength;P!=S&&t.c.warning(`Expected ${S} bytes when decoding a set of keypoints, found ${P}`),n+i>0&&(e=new Uint8Array(e));for(let o=0;o<P&&(p=e[o+1]<<8|e[o],u=e[o+3]<<8|e[o+2],I=e[o+5]<<8|e[o+4],f=e[o+7]<<8|e[o+6],65535!=p||65535!=u);o+=a)p+u+I+f!=0?i>0&&(_=e.subarray(8+o,8+o+i),_.byteLength<i)?t.c.warning(`KeypointSink: expected ${i} extra bytes when decoding the ${o/a}-th keypoint, found ${_.byteLength} instead`):n>0&&(y=e.subarray(8+o+i,8+o+i+n),y.byteLength<n)?t.c.warning(`KeypointSink: expected ${n} descriptor bytes when decoding the ${o/a}-th keypoint, found ${y.byteLength} instead`):(p/=s.FIX_RESOLUTION,u/=s.FIX_RESOLUTION,m=e[o+4]<255?-c+(c+l)*e[o+4]/255:0,C=(2*e[o+5]-255)*d,E=t.c.decodeFloat16(f),x=this._createKeypoint(p,u,m,C,E,y,_),g.push(x)):h&&g.push(null);return g}_createKeypoint(e,t,n,i,s,r,A){throw new o.Mi}_allocateExtra(e,n,i,o,s,r,A){t.c.assert(0===s),t.c.assert(r===o&&A>0&&A%4==0);const a=i.width,c=$n.encoderCapacity(o,s,a),l=$n.encoderLength(c,r,A);return e.programs.keypoints.allocateExtra.outputs(l,l,n)(i,o,s,a,r,A,l)}}class ri extends si{constructor(e="keypoints"){super(e,0,[Jt().expects(Nt.Keypoints)])}_createKeypoint(e,t,n,i,o,s,r){const A=s.byteLength>0?new ii(s):null;return new ln(e,t,n,i,o,A)}}class Ai extends si{constructor(e="keypoints"){super(e,2,[Jt().expects(Nt.Keypoints).satisfying((e=>0==e.extraSize)),Jt("flow").expects(Nt.Vector2)])}_run(e){const{encodedKeypoints:t,descriptorSize:n,extraSize:i,encoderLength:o}=this.input().read(),{vectors:s}=this.input("flow").read(),r=n,A=this._allocateExtra(e,this._tex[0],t,n,i,r,4),a=A.width,c=e.programs.keypoints.transferToExtra.outputs(a,a,this._tex[1])(s,s.width,A,r,4,a);return this._download(e,c,r,4,a)}_createKeypoint(e,n,i,o,s,r,A){const a=r.byteLength,c=(A.byteLength,a>0?new ii(r):null),l=t.c.decodeFloat16(A[1]<<8|A[0]),d=t.c.decodeFloat16(A[3]<<8|A[2]),g=new Mt(l,d);return new dn(e,n,i,o,s,c,g)}}class ai extends si{constructor(e="keypoints"){super(e,2,[Jt().expects(Nt.Keypoints).satisfying((e=>0==e.extraSize)),Jt("matches").expects(Nt.KeypointMatches)])}_run(e){const{encodedKeypoints:t,descriptorSize:n,extraSize:i,encoderLength:o}=this.input().read(),{encodedMatches:s,matchesPerKeypoint:r}=this.input("matches").read(),A=n,a=4*r,c=this._allocateExtra(e,this._tex[0],t,n,i,A,a),l=c.width,d=e.programs.keypoints.transferToExtra.outputs(l,l,this._tex[1])(s,s.width,c,A,a,l);return this._download(e,d,A,a,l)}_createKeypoint(e,t,n,i,o,r,A){const a=r.byteLength,c=A.byteLength,l=a>0?new ii(r):null,d=c/4,g=new Array(d);for(let e=0;e<d;e++){const t=4*e,n=A[t]|A[t+1]<<8|A[t+2]<<16|A[t+3]<<24,i=new cn(n&s.MATCH_INDEX_MASK,n>>>s.MATCH_INDEX_BITS);g[e]=i}return new gn(e,t,n,i,o,l,g)}}const ci=s.MAX_ENCODER_CAPACITY;class li extends rn{constructor(e){super(e,4,[Jt().expects(Nt.Keypoints),Wt().expects(Nt.Keypoints)]),this._size=ci}get size(){return this._size}set size(e){this._size=Math.max(0,Math.min(0|e,ci))}_run(e){const{encodedKeypoints:t,descriptorSize:n,extraSize:i,encoderLength:o}=this.input().read(),s=e.programs.keypoints,r=this._size,A=this._tex,a=this._tex[3],c=$n.encoderCapacity(n,i,o),l=Math.ceil(c/32),d=32*l,g=Math.min(c,r),h=$n.encoderLength(g,n,i);s.sortCreatePermutation.outputs(32,l,A[0]);let p=s.sortCreatePermutation(t,n,i,o);const u=Math.ceil(Math.log2(d));s.sortMergePermutation.outputs(32,l,A[1],A[2]);for(let e=1;e<=u;e++){const t=1<<e,n=e<<1;p=s.sortMergePermutation(p,t,n)}s.sortApplyPermutation.outputs(h,h,a),s.sortApplyPermutation(p,g,t,n,i),this.output().swrite(a,n,i,h)}}class di extends rn{constructor(e){super(e,5,[Jt().expects(Nt.Keypoints),Wt().expects(Nt.Keypoints)]),this._imageSize=new Bt(0,0),this._borderSize=new Mt(0,0)}get imageSize(){return this._imageSize}set imageSize(e){this._imageSize=e}get borderSize(){return this._borderSize}set borderSize(e){this._borderSize=e}_run(e){const{encodedKeypoints:t,descriptorSize:n,extraSize:i,encoderLength:s}=this.input().read(),r=e.programs.keypoints,A=this._imageSize,a=this._borderSize,c=A.width,l=A.height,d=a.x,g=a.x,h=a.y,p=a.y,u=this._tex;if(0==c||0==l)throw new o.js("BorderClipper: did you forget to set the image size?");const I=$n.encoderCapacity(n,i,s),f=Math.max(1,Math.ceil(Math.sqrt(I)));r.clipBorder.outputs(s,s,u[0]),r.mixKeypointsInit.outputs(f,f,u[1]),r.mixKeypointsSort.outputs(f,f,u[2],u[3]),r.mixKeypointsApply.outputs(s,s,u[4]);let m=r.clipBorder(c,l,h,g,p,d,t,n,i,s),C=r.mixKeypointsInit(m,n,i,s,I);for(let e=1;e<I;e*=2)C=r.mixKeypointsSort(C,e);m=r.mixKeypointsApply(C,m,n,i,s),this.output().swrite(m,n,i,s)}}class gi extends rn{constructor(e){super(e,2,[Jt().expects(Nt.Keypoints),Wt().expects(Nt.Keypoints)]),this._pageIndex=0,this._initialized=!1,this._previousDescriptorSize=0,this._previousExtraSize=0,this._previousEncoderLength=0,this._frozen=!1}get frozen(){return this._frozen}set frozen(e){this._frozen=Boolean(e)}release(e){this._initialized=!1,super.release(e)}_run(e){const{encodedKeypoints:t,descriptorSize:n,extraSize:i,encoderLength:o}=this.input().read(),s=this._previousDescriptorSize,r=this._previousExtraSize,A=this._previousEncoderLength,a=this._tex,c=a[1-this._pageIndex],l=a[this._pageIndex];if(this._frozen&&this._initialized||(this._previousDescriptorSize=n,this._previousExtraSize=i,this._previousEncoderLength=o,c.resize(o,o),t.copyTo(c),this._pageIndex=1-this._pageIndex),!this._initialized)return this._initialized=!0,void this.output().swrite(c,n,i,o);this.output().swrite(l,s,r,A)}}class hi extends rn{constructor(e){super(e,5,[Jt("in0").expects(Nt.Keypoints),Jt("in1").expects(Nt.Keypoints),Wt().expects(Nt.Keypoints)])}_run(e){const t=this.input("in0").read(),n=this.input("in1").read(),i=t.descriptorSize,s=t.extraSize,r=e.programs.keypoints,A=this._tex;if(t.descriptorSize!==n.descriptorSize||t.extraSize!=t.extraSize)throw new o.js("Can't merge two sets of keypoints that have different formats");const a=$n.encoderCapacity(t.descriptorSize,t.extraSize,t.encoderLength),c=$n.encoderCapacity(n.descriptorSize,n.extraSize,n.encoderLength),l=a+c,d=$n.encoderLength(l,i,s),g=Math.max(1,Math.ceil(Math.sqrt(l)));r.mixKeypointsPreInit.outputs(d,d,A[0]),r.mixKeypointsInit.outputs(g,g,A[1]),r.mixKeypointsSort.outputs(g,g,A[2],A[3]),r.mixKeypointsApply.outputs(d,d,A[4]);let h=r.mixKeypointsPreInit(t.encodedKeypoints,n.encodedKeypoints,t.encoderLength,n.encoderLength,a,c,i,s,d),p=r.mixKeypointsInit(h,i,s,d,l);for(let e=1;e<l;e*=2)p=r.mixKeypointsSort(p,e);h=r.mixKeypointsApply(p,h,i,s,d),this.output().swrite(h,i,s,d)}}class pi extends rn{constructor(e){super(e,6,[Jt().expects(Nt.Keypoints),Wt().expects(Nt.Keypoints)]),this._maxKeypoints=Number.NaN}get maxKeypoints(){return this._maxKeypoints}set maxKeypoints(e){Number.isNaN(e)?this._maxKeypoints=Number.NaN:this._maxKeypoints=Math.max(0,0|e)}_run(e){let{encodedKeypoints:t,descriptorSize:n,extraSize:i,encoderLength:o}=this.input().read();const s=$n.encoderCapacity(n,i,o),r=this._maxKeypoints,A=e.programs.keypoints.shuffle.definedConstant("PERMUTATION_MAXLEN"),a=Math.min(A,s),c=this._generatePermutation(a,A);t=e.programs.keypoints.shuffle.setUBO("Permutation",c).outputs(o,o,this._tex[0])(t,n,i,o),e.programs.keypoints.mixKeypointsInit.outputs(o,o,this._tex[1]),e.programs.keypoints.mixKeypointsSort.outputs(o,o,this._tex[2],this._tex[3]),e.programs.keypoints.mixKeypointsApply.outputs(o,o,this._tex[4]);let l=e.programs.keypoints.mixKeypointsInit(t,n,i,o,s);for(let t=1;t<s;t*=2)l=e.programs.keypoints.mixKeypointsSort(l,t);if(t=e.programs.keypoints.mixKeypointsApply(l,t,n,i,o),!Number.isNaN(r)&&r<s){const s=$n.encoderLength(r,n,i);t=e.programs.keypoints.clip.outputs(s,s,this._tex[5])(t,n,i,o,r),o=s}this.output().swrite(t,n,i,o)}_generatePermutation(e,n=e){const i=new Int32Array(n),o=i.subarray(0,e).fill(-1),s=t.c.shuffle(t.c.range(e));for(let t=0,n=0;t<e;t++)if(o[t]<0){do{o[t]=s[n++]}while(o[t]<t);o[o[t]]=t}return i}}const ui=["in0","in1"];class Ii extends rn{constructor(e){super(e,0,[...ui.map((e=>Jt(e).expects(Nt.Keypoints))),Wt().expects(Nt.Keypoints)]),this._port=0}get port(){return this._port}set port(e){if(e<0||e>=ui.length)throw new o.mG(`Invalid port: ${e}`);this._port=0|e}_run(e){const t=this.input(ui[this._port]).read();this.output().write(t)}}class fi extends rn{constructor(e){super(e,1,[Jt().expects(Nt.Keypoints),Wt().expects(Nt.Keypoints)]),this._transform=kt.SpeedyMatrix.Create(3,3,[1,0,0,0,1,0,0,0,1])}get transform(){return this._transform}set transform(e){if(3!=e.rows||3!=e.columns)throw new o.mG(`Not a 3x3 transformation matrix: ${e}`);this._transform=e}_run(e){const{encodedKeypoints:t,descriptorSize:n,extraSize:i,encoderLength:o}=this.input().read(),s=this._tex[0],r=this._transform.read();e.programs.keypoints.applyHomography.outputs(t.width,t.height,s)(r,t,n,i,o),this.output().swrite(s,n,i,o)}}const mi=Object.freeze({quadratic1d:"subpixelQuadratic1d",taylor2d:"subpixelTaylor2d","bicubic-upsample":"subpixelBicubic","bilinear-upsample":"subpixelBilinear"});class Ci extends rn{constructor(e){super(e,2,[Jt("image").expects(Nt.Image).satisfying((e=>e.format===It.D3.GREY)),Jt("keypoints").expects(Nt.Keypoints),Wt().expects(Nt.Keypoints),Wt("displacements").expects(Nt.Vector2)]),this._method="quadratic1d",this._maxIterations=6,this._epsilon=.1}get method(){return this._method}set method(e){if(!Object.prototype.hasOwnProperty.call(mi,e))throw new o.mG(`Invalid method: "${e}"`);this._method=e}get maxIterations(){return this._maxIterations}set maxIterations(e){this._maxIterations=Math.max(0,+e)}get epsilon(){return this._epsilon}set epsilon(e){this._epsilon=Math.max(0,+e)}_run(e){const{encodedKeypoints:t,descriptorSize:n,extraSize:i,encoderLength:o}=this.input("keypoints").read(),{image:s,format:r}=this.input("image").read(),A=this._tex,a=mi[this._method],c=this._maxIterations,l=this._epsilon,d=$n.encoderCapacity(n,i,o),g=Math.max(1,Math.ceil(Math.sqrt(d))),h=e.programs.keypoints[a].outputs(g,g,A[0])(s,t,n,i,o,c,l),p=e.programs.keypoints.transferFlow.outputs(o,o,A[1])(h,t,n,i,o);this.output().swrite(p,n,i,o),this.output("displacements").swrite(h)}}class Ei extends Vn{constructor(e){super(e,5,[Jt().expects(Nt.Image).satisfying((e=>e.format===It.D3.GREY)),Wt().expects(Nt.Keypoints)]),this._threshold=20}get threshold(){return this._threshold}set threshold(e){this._threshold=Math.max(0,Math.min(0|e,255))}_run(e){const{image:t,format:n}=this.input().read(),i=t.width,r=t.height,A=this._tex,a=this._capacity,c=this._threshold,l=Math.log2(this.scaleFactor),d=this.levels;if(1!=d&&!t.hasMipmaps())throw new o.js(`Expected a pyramid in ${this.fullName}`);if(0==a){const t=this._encodeZeroKeypoints(e,A[4]),n=t.width;return void this.output().swrite(t,0,0,n)}e.programs.keypoints.fast9_16.outputs(i,r,A[0],A[1]),e.programs.keypoints.nonmaxSpace.outputs(i,r,A[2]);let g=A[1].clear(),h=Math.max(1,Math.min(d,s.PYRAMID_MAX_LEVELS/l|0));for(let n=l*(h-1);h-- >0;n-=l)g=e.programs.keypoints.fast9_16(g,t,n,c);g=e.programs.keypoints.nonmaxSpace(g),d>1&&(g=e.programs.keypoints.nonmaxScaleSimple.outputs(i,r,A[1])(g,t,l));let p=this._encodeKeypoints(e,g,A[3]);const u=p.width;d>1&&(p=e.programs.keypoints.refineScaleFAST916.outputs(u,u,A[4])(t,l,p,0,0,u,c)),this.output().swrite(p,0,0,u)}}const xi=Object.freeze({1:"harris1",3:"harris3",5:"harris5",7:"harris7"});class yi extends Vn{constructor(e){super(e,6,[Jt().expects(Nt.Image).satisfying((e=>e.format===It.D3.GREY)),Wt().expects(Nt.Keypoints)]),this._windowSize=new Bt(3,3),this._quality=.1}get quality(){return this._quality}set quality(e){this._quality=Math.max(0,Math.min(+e,1))}get windowSize(){return this._windowSize}set windowSize(e){const t=e.width;if(t!=e.height||1!=t&&3!=t&&5!=t&&7!=t)throw new o.mG(`Invalid window: ${e}. Acceptable sizes: 1x1, 3x3, 5x5, 7x7`);this._windowSize=e}_run(e){const{image:n,format:i}=this.input().read(),r=n.width,A=n.height,a=this._capacity,c=this._quality,l=this._windowSize.width,d=this.levels,g=Math.log2(this.scaleFactor),h=d>1?this.scaleFactor:1,p=e.programs.keypoints[xi[l]],u=this._tex;if(1!=d&&!n.hasMipmaps())throw new o.js(`Expected a pyramid in ${this.fullName}`);if(0==a){const t=this._encodeZeroKeypoints(e,u[5]),n=t.width;return void this.output().swrite(t,0,0,n)}p.outputs(r,A,u[0],u[1]),e.programs.utils.sobelDerivatives.outputs(r,A,u[2]),e.programs.keypoints.nonmaxSpace.outputs(r,A,u[3]);let I=u[1].clear(),f=Math.max(1,Math.min(d,s.PYRAMID_MAX_LEVELS/g|0));for(let i=g*(f-1);f-- >0;i-=g){const o=t.c.gaussianKernel(h*(1+i),l);I=p(I,n,e.programs.utils.sobelDerivatives(n,i),i,g,o),I=e.programs.keypoints.nonmaxSpace(I)}if(d>1){const t=e.programs.keypoints.laplacian.outputs(r,A,u[0])(I,n,g,0);I=e.programs.keypoints.nonmaxScale.outputs(r,A,u[2])(I,n,t,g)}e.programs.keypoints.harrisScoreFindMax.outputs(r,A,u[0],u[1]),f=Math.ceil(Math.log2(Math.max(r,A)));let m=I;for(let t=0;t<f;t++)m=e.programs.keypoints.harrisScoreFindMax(m,t);I=e.programs.keypoints.harrisScoreCutoff.outputs(r,A,m==u[0]?u[1]:u[0])(I,m,c);let C=this._encodeKeypoints(e,I,u[4]);const E=C.width;d>1&&(C=e.programs.keypoints.refineScaleLoG.outputs(E,E,u[5])(n,g,C,0,0,E)),this.output().swrite(C,0,0,E)}}class _i extends rn{constructor(e,t=0,n){super(e,t+1,n)}_allocateDescriptors(e,n,i,o,s,r){t.c.assert(n>=0&&i>=0),t.c.assert(o>=0&&o%4==0&&s===i);const A=r.width,a=$n.encoderCapacity(n,i,A),c=$n.encoderLength(a,o,s),l=this._tex[this._tex.length-1];return e.programs.keypoints.allocateDescriptors.outputs(c,c,l)(r,n,i,A,o,s,c)}}class Si extends _i{constructor(e){super(e,3,[Jt("image").expects(Nt.Image).satisfying((e=>e.format===It.D3.GREY)),Jt("keypoints").expects(Nt.Keypoints),Wt().expects(Nt.Keypoints)])}_run(e){const{encodedKeypoints:t,descriptorSize:n,extraSize:i,encoderLength:o}=this.input("keypoints").read(),s=this.input("image").read().image,r=this._tex,A=this._tex[2],a=$n.encoderCapacity(n,i,o),c=Math.max(1,Math.ceil(Math.sqrt(a))),l=e.programs.keypoints.orbOrientation.outputs(c,c,r[0])(s,t,n,i,o),d=e.programs.keypoints.transferOrientation.outputs(o,o,r[1])(l,t,n,i,o),g=this._allocateDescriptors(e,n,i,32,i,d),h=g.width,p=e.programs.keypoints.orbDescriptor.outputs(h,h,A)(s,g,i,h);this.output().swrite(p,32,i,h)}}const Pi=new Bt(11,11),Bi=Math.min(3,s.PYRAMID_MAX_LEVELS),vi={3:"lk3",5:"lk5",7:"lk7",9:"lk9",11:"lk11",13:"lk13",15:"lk15",17:"lk17",19:"lk19",21:"lk21"};class Qi extends rn{constructor(e){super(e,3,[Jt("previousImage").expects(Nt.Image).satisfying((e=>e.format===It.D3.GREY)),Jt("nextImage").expects(Nt.Image).satisfying((e=>e.format===It.D3.GREY)),Jt("previousKeypoints").expects(Nt.Keypoints),Wt().expects(Nt.Keypoints),Wt("flow").expects(Nt.Vector2)]),this._windowSize=Pi,this._levels=Bi,this._discardThreshold=1e-4,this._numberOfIterations=30,this._epsilon=.01}get windowSize(){return this._windowSize}set windowSize(e){if(e.width!=e.height)throw new o.B8(`LK: window ${this._windowSize.toString()} is not square!`);if(!Object.prototype.hasOwnProperty.call(vi,e.width)){const e=Object.keys(vi).sort(((e,t)=>e-t)).map((e=>e+"x"+e)).join(", ");throw new o.B8(`LK: window of size ${this._windowSize.toString()} is not supported! Supported sizes: ${e}`)}this._windowSize=e}get levels(){return this._levels}set levels(e){t.c.assert(e>=1&&e<=s.PYRAMID_MAX_LEVELS),this._levels=0|e}get discardThreshold(){return this._discardThreshold}set discardThreshold(e){t.c.assert(e>=0),this._discardThreshold=+e}get numberOfIterations(){return this._numberOfIterations}set numberOfIterations(e){t.c.assert(e>=1),this._numberOfIterations=0|e}get epsilon(){return this._epsilon}set epsilon(e){t.c.assert(e>=0),this._epsilon=+e}_run(e){const{encodedKeypoints:t,descriptorSize:n,extraSize:i,encoderLength:s}=this.input("previousKeypoints").read(),r=this.input("previousImage").read().image,A=this.input("nextImage").read().image,a=t,c=this._levels,l=this._windowSize.width,d=this._numberOfIterations,g=this._discardThreshold,h=this._epsilon,p=e.programs.keypoints,u=this._tex;if(!(1==c||r.hasMipmaps()&&A.hasMipmaps()))throw new o.js("LK: a pyramid is required if levels > 1");if(r.width!==A.width||r.height!==A.height)throw new o.js("LK: can't use input images of different size");const I=p[vi[l]],f=$n.encoderCapacity(n,i,s),m=Math.max(1,Math.ceil(Math.sqrt(f)));I.outputs(m,m,u[0],u[1]);let C=I.clear();for(let e=c-1;e>=0;e--)C=I(C,a,A,r,e,c,d,g,h,n,i,s);p.transferFlow.outputs(s,s,u[2]);const E=p.transferFlow(C,a,n,i,s);this.output().swrite(E,n,i,s),this.output("flow").swrite(C)}}class wi extends An{constructor(e){super(e,2,[Wt().expects(Nt.LSHTables)]),this._keypoints=[],this._keypointsCopy=[],this._numberOfTables=8,this._hashSize=15,this._lsh=null}get keypoints(){return this._keypoints}set keypoints(e){if(!Array.isArray(e)||e.find((e=>!(e instanceof ln))))throw new o.mG("Static LSH tables: an invalid set of keypoints has been provided");this._keypoints!==e&&(this._keypoints=e,this._keypointsCopy=e.slice(0),this._lsh=null)}get numberOfTables(){return this._numberOfTables}set numberOfTables(e){if(!G.includes(e))throw new o.mG(`Invalid number of tables: ${e}. Acceptable values: ${G.join(", ")}`);e!==this._numberOfTables&&(this._numberOfTables=0|e,this._lsh=null)}get hashSize(){return this._hashSize}set hashSize(e){if(!O.includes(e))throw new o.mG(`Invalid hash size: ${e}. Acceptable values: ${O.join(", ")}`);e!==this._hashSize&&(this._hashSize=0|e,this._lsh=null)}_run(e){null==this._lsh&&(this._lsh=this._train()),this.output().swrite(this._lsh)}_train(){const e=this._keypointsCopy,t=this._numberOfTables,n=this._hashSize;if(e.find((e=>null==e.descriptor)))throw new o.js("Static LSH tables: can't train the model with no keypoint descriptors!");const i=e.map((e=>e.descriptor.data)),s=this._tex[0],r=this._tex[1];return new Z(s,r,i,t,n)}}const Di={fastest:0,default:1,demanding:2},bi=U.reduce(((e,t)=>(e[t]=(e=>{return t=t=>{return n=n=>`lshKnn${e}h${t}lv${n}`,[0,1,2].reduce(((e,t)=>(e[t]=n(t),e)),{});var n},O.reduce(((e,n)=>(e[n]=t(n),e)),{});var t})(t),e)),{});class Mi extends rn{constructor(e){super(e,6,[Jt("keypoints").expects(Nt.Keypoints).satisfying((e=>e.descriptorSize>0)),Jt("lsh").expects(Nt.LSHTables),Wt().expects(Nt.KeypointMatches)]),this._k=1,this._quality="default"}get k(){return this._k}set k(e){this._k=Math.max(1,0|e)}get quality(){return this._quality}set quality(e){if(!Object.prototype.hasOwnProperty.call(Di,e))throw new o.mG(`Invalid quality level: "${e}"`);this._quality=e}_run(e){const{encodedKeypoints:n,descriptorSize:i,extraSize:s,encoderLength:r}=this.input("keypoints").read(),A=this.input("lsh").read().lsh,a=e.programs.keypoints,c=A.tables,l=A.descriptorDB,d=c.width,g=l.width,h=A.tableCount,p=A.hashSize,u=A.bucketCapacity,I=A.bucketsPerTable,f=A.sequences,m=this._tex[0],C=this._tex[1],E=this._tex[2],x=this._tex[3],y=this._tex[4],_=this._tex[5],S=Di[this._quality],P=this._k;if(i!==A.descriptorSize)throw new o.mG(`Can't match different types of descriptors in ${this.fullName}`);t.c.assert(null!=bi[i]),t.c.assert(null!=bi[i][p]),t.c.assert(null!=bi[i][p][S]);const B=$n.encoderCapacity(i,s,r),v=Math.max(1,Math.ceil(Math.sqrt(B*P)));let Q=_;a.lshKnnTransfer.outputs(v,v,y,_);const w=Math.max(1,Math.ceil(Math.sqrt(B)));a.lshKnnInitCandidates.outputs(w,w,m),a.lshKnnInitFilters.outputs(w,w,x);const D=a[bi[i][p][S]];D.outputs(w,w,C,E),D.setUBO("LSHSequences",f),Q.clear(),a.lshKnnInitFilters();for(let t=0;t<P;t++){let o=a.lshKnnInitCandidates();for(let t=0;t<h;t++)o=D(o,x,w,c,l,t,u,I,d,g,n,i,s,r),e.gl.flush();o.copyTo(x),Q=a.lshKnnTransfer(Q,o,P,t)}this.output().swrite(Q,P)}}const Ki={32:"bfMatcher32",64:"bfMatcher64"};class Li extends rn{constructor(e){super(e,6,[Jt("keypoints").expects(Nt.Keypoints).satisfying((e=>e.descriptorSize>0)),Jt("database").expects(Nt.Keypoints).satisfying((e=>e.descriptorSize>0)),Wt().expects(Nt.KeypointMatches)]),this._matchesPerKeypoint=1}get k(){return this._matchesPerKeypoint}set k(e){this._matchesPerKeypoint=Math.max(1,0|e)}_run(e){const{encodedKeypoints:t,descriptorSize:n,extraSize:i,encoderLength:s}=this.input("keypoints").read(),r=this.input("database").read(),A=this._tex[0],a=this._tex[1],c=this._tex[2],l=this._tex[3],d=this._tex[4],g=this._tex[5],h=this._matchesPerKeypoint,p=e.programs.keypoints;if(n!==r.descriptorSize)throw new o.mG(`Incompatible descriptors in ${this.fullName}`);if(!Object.prototype.hasOwnProperty.call(Ki,n))throw new o.B8(`Unsupported descriptor size (${n}) in ${this.fullName}`);const u=p[Ki[n]],I=$n.encoderCapacity(n,i,s),f=$n.encoderCapacity(r.descriptorSize,r.extraSize,r.encoderLength),m=u.definedConstant("NUMBER_OF_KEYPOINTS_PER_PASS"),C=Math.ceil(f/m),E=Math.max(1,Math.ceil(Math.sqrt(I))),x=Math.max(1,Math.ceil(Math.sqrt(I*h)));p.bfMatcherTransfer.outputs(x,x,d,g),p.bfMatcherInitCandidates.outputs(E,E,c),p.bfMatcherInitFilters.outputs(E,E,l),u.outputs(E,E,A,a);let y=g.clear(),_=p.bfMatcherInitFilters();for(let o=0;o<h;o++){let A=p.bfMatcherInitCandidates();for(let o=0;o<C;o++)A=u(A,_,E,r.encodedKeypoints,r.descriptorSize,r.extraSize,r.encoderLength,t,n,i,s,o),e.gl.flush();h>1&&A.copyTo(_),y=p.bfMatcherTransfer(y,A,h,o)}this.output().swrite(y,h)}}class ki extends rn{constructor(e){super(e,1,[Jt("in").expects(Nt.Keypoints),Jt("reference").expects(Nt.Keypoints),Wt().expects(Nt.Keypoints)]),this._threshold=s.MAX_TEXTURE_LENGTH+1}get threshold(){return this._threshold}set threshold(e){this._threshold=Math.max(0,+e)}_run(e){const t=this.input("in").read(),n=this.input("reference").read(),i=this._threshold;if(t.descriptorSize!=n.descriptorSize||t.extraSize!=n.extraSize)throw new o.js("The distance filter requires two compatible shapes of keypoint streams");const s=this._tex[0],r=Math.max(t.encoderLength,n.encoderLength),A=t.descriptorSize,a=t.extraSize;e.programs.keypoints.distanceFilter.outputs(r,r,s)(t.encodedKeypoints,t.encoderLength,n.encodedKeypoints,n.encoderLength,A,a,r,i),this.output().swrite(s,A,a,r)}}const Ni={32:"hammingDistanceFilter32",64:"hammingDistanceFilter64"};class Ri extends rn{constructor(e){super(e,1,[Jt("in").expects(Nt.Keypoints).satisfying((e=>e.descriptorSize>0)),Jt("reference").expects(Nt.Keypoints).satisfying((e=>e.descriptorSize>0)),Wt().expects(Nt.Keypoints)]),this._threshold=8*s.MAX_DESCRIPTOR_SIZE}get threshold(){return this._threshold}set threshold(e){this._threshold=Math.max(0,0|e)}_run(e){const t=this.input("in").read(),n=this.input("reference").read(),i=this._threshold;if(t.descriptorSize!=n.descriptorSize||t.extraSize!=n.extraSize)throw new o.js("The Hamming distance filter requires two compatible shapes of keypoint streams");if(!Object.prototype.hasOwnProperty.call(Ni,t.descriptorSize))throw new o.B8(`Hamming distance filter - invalid descriptor size: ${t.descriptorSize}`);const s=this._tex[0],r=Math.max(t.encoderLength,n.encoderLength),A=t.descriptorSize,a=t.extraSize,c=Ni[t.descriptorSize];e.programs.keypoints[c].outputs(r,r,s)(t.encodedKeypoints,t.encoderLength,n.encodedKeypoints,n.encoderLength,A,a,r,i),this.output().swrite(s,A,a,r)}}class zi extends rn{constructor(e){super(e,1,[Jt().expects(Nt.Keypoints)]),this._descriptorSize=0,this._extraSize=0,this._encoderLength=0,this._initialized=!1}get encodedKeypoints(){if(!this._initialized)throw new o.js(`Portal error: ${this.fullName} holds no data`);return this._tex[0]}get descriptorSize(){if(!this._initialized)throw new o.js(`Portal error: ${this.fullName} holds no data`);return this._descriptorSize}get extraSize(){if(!this._initialized)throw new o.js(`Portal error: ${this.fullName} holds no data`);return this._extraSize}get encoderLength(){if(!this._initialized)throw new o.js(`Portal error: ${this.fullName} holds no data`);return this._encoderLength}init(e){super.init(e);const t=$n.encoderLength(0,0,0);this._tex[0].resize(t,t).clearToColor(1,1,1,1),this._descriptorSize=this._extraSize=0,this._encoderLength=t,this._initialized=!0}release(e){this._initialized=!1,super.release(e)}_run(e){const{encodedKeypoints:t,descriptorSize:n,extraSize:i,encoderLength:o}=this.input().read(),s=this._tex[0];s.resize(t.width,t.height),t.copyTo(s),this._descriptorSize=n,this._extraSize=i,this._encoderLength=o}}class Xi extends An{constructor(e){super(e,0,[Wt().expects(Nt.Keypoints)]),this._source=null}get source(){return this._source}set source(e){if(null!==e&&!(e instanceof zi))throw new o.mG(`Incompatible source for ${this.fullName}`);this._source=e}_run(e){if(null==this._source)throw new o.js(`${this.fullName} has no source`);this.output().swrite(this._source.encodedKeypoints,this._source.descriptorSize,this._source.extraSize,this._source.encoderLength)}}class Ti extends T.R{static FAST(e){return new Ei(e)}static Harris(e){return new yi(e)}}class Fi extends T.R{static ORB(e){return new Si(e)}}class Gi extends T.R{static LK(e){return new Qi(e)}}class Oi extends T.R{static StaticLSHTables(e){return new wi(e)}static LSHKNN(e){return new Mi(e)}static BFKNN(e){return new Li(e)}}class Ui extends T.R{static Source(e){return new Xi(e)}static Sink(e){return new zi(e)}}class Hi extends T.R{static get Detector(){return Ti}static get Descriptor(){return Fi}static get Tracker(){return Gi}static get Matcher(){return Oi}static get Portal(){return Ui}static Source(e){return new ni(e)}static Sink(e){return new ri(e)}static SinkOfTrackedKeypoints(e){return new Ai(e)}static SinkOfMatchedKeypoints(e){return new ai(e)}static Clipper(e){return new li(e)}static BorderClipper(e){return new di(e)}static Buffer(e){return new gi(e)}static Mixer(e){return new hi(e)}static Shuffler(e){return new pi(e)}static Multiplexer(e){return new Ii(e)}static Transformer(e){return new fi(e)}static SubpixelRefiner(e){return new Ci(e)}static DistanceFilter(e){return new ki(e)}static HammingDistanceFilter(e){return new Ri(e)}}const qi=e=>e>1?1<<Math.ceil(Math.log2(e)):1;class Yi extends an{constructor(e="vec2"){super(e,2,[Jt().expects(Nt.Vector2)]),this._vectors=[],this._textureReader=new tn,this._page=0,this._turbo=!1}get turbo(){return this._turbo}set turbo(e){this._turbo=Boolean(e)}init(e){super.init(e),this._textureReader.init(e)}release(e){this._textureReader.release(e),super.release(e)}export(){return c.s.resolve(this._vectors)}_run(e){const{vectors:t}=this.input().read(),n=this._turbo,i=t.width,o=qi(i),s=qi(Math.ceil(i*i/o)),r=this._tex[this._page];return e.programs.utils.copy2DVectors.outputs(o,s,r)(t),this._page=1-this._page,this._textureReader.readPixelsAsync(r,0,0,r.width,r.height,n).then((e=>{this._vectors=Yi._decode(e,o,s)}))}static _decode(e,n,i){const o=[];let s=0,r=0,A=0,a=0;const c=n*i*4,l=Math.min(e.length,c);for(let n=0;n<l&&(r=e[n+1]<<8|e[n],s=e[n+3]<<8|e[n+2],65535!=r||65535!=s);n+=4)65280==r&&65280==s||(A=t.c.decodeFloat16(r),a=t.c.decodeFloat16(s),o.push(new Mt(A,a)));return o}}const Ji=new class extends Function{constructor(){return super("...args","return args.length > 1 ? this._create(...args) : this._from(args[0])"),this.bind(this)}_create(e,t=e,n=[]){return kt.SpeedyMatrix.Create(e,t,n)}_from(e){return kt.SpeedyMatrix.From(e)}Zeros(e,t=e){return kt.SpeedyMatrix.Zeros(e,t)}Ones(e,t=e){return kt.SpeedyMatrix.Ones(e,t)}Eye(e,t=e){return kt.SpeedyMatrix.Eye(e,t)}ready(){return kt.SpeedyMatrix.ready()}qr(e,t,n,{mode:i="reduced"}={}){const s=n,r=n.rows,A=n.columns;if("reduced"==i){if(e.rows!=r||e.columns!=A||t.rows!=A||t.columns!=A)throw new o.mG("Invalid shape for reduced QR")}else{if("full"!=i)throw new o.mG(`Invalid mode for QR: "${i}"`);if(e.rows!=r||e.columns!=r||t.rows!=r||t.columns!=A)throw new o.mG("Invalid shape for full QR")}return Lt.r.ready().then((({wasm:n,memory:o})=>{const r=Lt.r.allocateMat32(n,o,e),A=Lt.r.allocateMat32(n,o,t),a=Lt.r.allocateMat32(n,o,s);return Lt.r.copyToMat32(n,o,a,s),"reduced"==i?n.exports.Mat32_qr_reduced(r,A,a):n.exports.Mat32_qr_full(r,A,a),Lt.r.copyFromMat32(n,o,r,e),Lt.r.copyFromMat32(n,o,A,t),Lt.r.deallocateMat32(n,o,a),Lt.r.deallocateMat32(n,o,A),Lt.r.deallocateMat32(n,o,r),[e,t]}))}ols(e,t,n,{method:i="qr"}={}){const s=t.rows,r=t.columns,A=e;if(s<r||0==r)throw new o.mG("Can't solve an underdetermined system of equations");if(n.rows!=s||1!=n.columns||A.rows!=r||1!=A.columns)throw new o.mG("Invalid shapes");return Lt.r.ready().then((({wasm:s,memory:r})=>{const a=Lt.r.allocateMat32(s,r,t),c=Lt.r.allocateMat32(s,r,n),l=Lt.r.allocateMat32(s,r,A);if(Lt.r.copyToMat32(s,r,a,t),Lt.r.copyToMat32(s,r,c,n),"qr"!==i)throw new o.mG(`Invalid method: "${i}"`);return s.exports.Mat32_qr_ols(l,a,c,2),Lt.r.copyFromMat32(s,r,l,A),Lt.r.deallocateMat32(s,r,l),Lt.r.deallocateMat32(s,r,c),Lt.r.deallocateMat32(s,r,a),e}))}solve(e,t,n,{method:i="qr"}={}){const s=t.rows,r=t.columns,A=e;if(s!=r)throw new o.mG("Can't solve an over or underdetermined system of equations");if(n.rows!=s||1!=n.columns||A.rows!=s||1!=A.columns)throw new o.mG("Invalid shapes");return Lt.r.ready().then((({wasm:e,memory:s})=>{if("qr"===i)return this.ols(A,t,n,{method:i});throw new o.mG(`Invalid method: "${i}"`)}))}perspective(e,t,n){if(2!=t.rows||4!=t.columns||2!=n.rows||4!=n.columns)throw new o.mG("You need two 2x4 input matrices to compute a perspective transformation");if(3!=e.rows||3!=e.columns)throw new o.mG("The output of perspective() is a 3x3 homography");return Lt.r.ready().then((({wasm:i,memory:o})=>{const s=Lt.r.allocateMat32(i,o,e),r=Lt.r.allocateMat32(i,o,t),A=Lt.r.allocateMat32(i,o,n);return Lt.r.copyToMat32(i,o,r,t),Lt.r.copyToMat32(i,o,A,n),i.exports.Mat32_homography_ndlt4(s,r,A),Lt.r.copyFromMat32(i,o,s,e),Lt.r.deallocateMat32(i,o,A),Lt.r.deallocateMat32(i,o,r),Lt.r.deallocateMat32(i,o,s),e}))}findHomography(e,n,i,{method:s="default",mask:r=null,reprojectionError:A=3,numberOfHypotheses:a=512,bundleSize:c=128}={}){if(2!=n.rows||n.columns<4||2!=i.rows||i.columns!=n.columns)throw new o.mG("You need two 2 x n (n >= 4) input matrices to compute a homography");if(3!=e.rows||3!=e.columns)throw new o.mG("The output of findHomography() is a 3x3 homography");if(null!=r&&(1!=r.rows||r.columns!=n.columns))throw new o.mG("Invalid shape of the inliers mask");return Lt.r.ready().then((({wasm:l,memory:d})=>{const g=Lt.r.allocateMat32(l,d,e),h=Lt.r.allocateMat32(l,d,n),p=Lt.r.allocateMat32(l,d,i),u=null!=r?Lt.r.allocateMat32(l,d,r):0;switch(Lt.r.copyToMat32(l,d,h,n),Lt.r.copyToMat32(l,d,p,i),s){case"pransac":t.c.assert(A>=0&&a>0&&c>0),l.exports.Mat32_pransac_homography(g,u,h,p,a,c,A);break;case"default":case"dlt":l.exports.Mat32_homography_ndlt(g,h,p);break;default:throw new o.mG(`Illegal method for findHomography(): "${s}"`)}return Lt.r.copyFromMat32(l,d,g,e),null!=r&&Lt.r.copyFromMat32(l,d,u,r),null!=r&&Lt.r.deallocateMat32(l,d,u),Lt.r.deallocateMat32(l,d,p),Lt.r.deallocateMat32(l,d,h),Lt.r.deallocateMat32(l,d,g),e}))}applyPerspectiveTransform(e,t,n){if(2!=t.rows||2!=e.rows||t.columns!=e.columns)throw new o.mG("Invalid shapes");if(3!=n.rows||3!=n.columns)throw new o.mG("The perspective transformation must be a 3x3 matrix");return Lt.r.ready().then((({wasm:i,memory:o})=>{const s=Lt.r.allocateMat32(i,o,n),r=Lt.r.allocateMat32(i,o,t),A=Lt.r.allocateMat32(i,o,e);return Lt.r.copyToMat32(i,o,r,t),Lt.r.copyToMat32(i,o,s,n),i.exports.Mat32_transform_perspective(A,r,s),Lt.r.copyFromMat32(i,o,A,e),Lt.r.deallocateMat32(i,o,A),Lt.r.deallocateMat32(i,o,r),Lt.r.deallocateMat32(i,o,s),e}))}affine(e,t,n){if(2!=t.rows||3!=t.columns||2!=n.rows||3!=n.columns)throw new o.mG("You need two 2x3 input matrices to compute an affine transform");if(2!=e.rows||3!=e.columns)throw new o.mG("The output of affine() is a 2x3 matrix");return Lt.r.ready().then((({wasm:i,memory:o})=>{const s=Lt.r.allocateMat32(i,o,e),r=Lt.r.allocateMat32(i,o,t),A=Lt.r.allocateMat32(i,o,n);return Lt.r.copyToMat32(i,o,r,t),Lt.r.copyToMat32(i,o,A,n),i.exports.Mat32_affine_direct3(s,r,A),Lt.r.copyFromMat32(i,o,s,e),Lt.r.deallocateMat32(i,o,A),Lt.r.deallocateMat32(i,o,r),Lt.r.deallocateMat32(i,o,s),e}))}findAffineTransform(e,n,i,{method:s="default",mask:r=null,reprojectionError:A=3,numberOfHypotheses:a=512,bundleSize:c=128}={}){if(2!=n.rows||n.columns<3||2!=i.rows||i.columns!=n.columns)throw new o.mG("You need two 2 x n (n >= 3) input matrices to compute an affine transform");if(2!=e.rows||3!=e.columns)throw new o.mG("The output of findAffineTransform() is a 2x3 matrix");if(null!=r&&(1!=r.rows||r.columns!=n.columns))throw new o.mG("Invalid shape of the inliers mask");return Lt.r.ready().then((({wasm:l,memory:d})=>{const g=Lt.r.allocateMat32(l,d,e),h=Lt.r.allocateMat32(l,d,n),p=Lt.r.allocateMat32(l,d,i),u=null!=r?Lt.r.allocateMat32(l,d,r):0;switch(Lt.r.copyToMat32(l,d,h,n),Lt.r.copyToMat32(l,d,p,i),s){case"pransac":t.c.assert(A>=0&&a>0&&c>0),l.exports.Mat32_pransac_affine(g,u,h,p,a,c,A);break;case"default":l.exports.Mat32_affine_direct(g,h,p);break;default:throw new o.mG(`Illegal method for findAffineTransform(): "${s}"`)}return Lt.r.copyFromMat32(l,d,g,e),null!=r&&Lt.r.copyFromMat32(l,d,u,r),null!=r&&Lt.r.deallocateMat32(l,d,u),Lt.r.deallocateMat32(l,d,p),Lt.r.deallocateMat32(l,d,h),Lt.r.deallocateMat32(l,d,g),e}))}applyAffineTransform(e,t,n){if(2!=t.rows||2!=e.rows||t.columns!=e.columns)throw new o.mG("Invalid shapes");if(2!=n.rows||3!=n.columns)throw new o.mG("The affine transformation must be a 2x3 matrix");return Lt.r.ready().then((({wasm:i,memory:o})=>{const s=Lt.r.allocateMat32(i,o,n),r=Lt.r.allocateMat32(i,o,t),A=Lt.r.allocateMat32(i,o,e);return Lt.r.copyToMat32(i,o,r,t),Lt.r.copyToMat32(i,o,s,n),i.exports.Mat32_transform_affine(A,r,s),Lt.r.copyFromMat32(i,o,A,e),Lt.r.deallocateMat32(i,o,A),Lt.r.deallocateMat32(i,o,r),Lt.r.deallocateMat32(i,o,s),e}))}},Wi=new class extends Function{constructor(){return super("...args","return this._create(...args)"),this.bind(this)}_create(e,t){return new Mt(e,t)}Sink(e){return new Yi(e)}};class Zi{static load(e,t={}){return Qt.load(e,t)}static camera(e=640,n=360){const i="object"==typeof e?e:{audio:!1,video:{width:0|e,height:0|n}};return t.c.requestCameraStream(i).then((e=>Qt.load(e)))}static isSupported(){return"undefined"!=typeof WebAssembly&&"undefined"!=typeof WebGL2RenderingContext&&null!=e.$.instance.gl}static get Vector2(){return Wi}static Point2(e,t){return new Kt(e,t)}static Size(e,t){return new Bt(e,t)}static get Matrix(){return Ji}static get Promise(){return c.s}static Pipeline(){return new un}static get Image(){return Qn}static get Filter(){return Hn}static get Transform(){return Wn}static get Keypoint(){return Hi}static get version(){return"0.9.1"}static get fps(){return bt.instance.fps}static get Settings(){return wt.Z}}Object.freeze(Zi),t.c.log(`Speedy Vision version ${Zi.version}. GPU-accelerated Computer Vision for JavaScript by Alexandre Martins. https://github.com/alemart/speedy-vision`),s.LITTLE_ENDIAN||t.c.warning("Running on a big-endian machine")})(),i=i.default})()}));