1const z={};z.unpack_cascade=function(n){const o=new DataView(new ArrayBuffer(4));let t=8;o.setUint8(0,n[t+0]),o.setUint8(1,n[t+1]),o.setUint8(2,n[t+2]),o.setUint8(3,n[t+3]);const p=o.getInt32(0,!0);t=t+4,o.setUint8(0,n[t+0]),o.setUint8(1,n[t+1]),o.setUint8(2,n[t+2]),o.setUint8(3,n[t+3]);const r=o.getInt32(0,!0);t=t+4;const c=[],l=[],U=[];for(let s=0;s<r;++s){Array.prototype.push.apply(c,[0,0,0,0]),Array.prototype.push.apply(c,n.slice(t,t+4*Math.pow(2,p)-4)),t=t+4*Math.pow(2,p)-4;for(let h=0;h<Math.pow(2,p);++h)o.setUint8(0,n[t+0]),o.setUint8(1,n[t+1]),o.setUint8(2,n[t+2]),o.setUint8(3,n[t+3]),l.push(o.getFloat32(0,!0)),t=t+4;o.setUint8(0,n[t+0]),o.setUint8(1,n[t+1]),o.setUint8(2,n[t+2]),o.setUint8(3,n[t+3]),U.push(o.getFloat32(0,!0)),t=t+4}const u=new Int8Array(c),a=new Float32Array(l),f=new Float32Array(U);function e(s,h,w,M,_){s=256*s,h=256*h;let m=0,g=0;const F=Math.pow(2,p)>>0;for(let A=0;A<r;++A){let x=1;for(let v=0;v<p;++v)x=2*x+(M[(s+u[m+4*x+0]*w>>8)*_+(h+u[m+4*x+1]*w>>8)]<=M[(s+u[m+4*x+2]*w>>8)*_+(h+u[m+4*x+3]*w>>8)]);if(g=g+a[F*A+x-F],g<=f[A])return-1;m+=4*F}return g-f[r-1]}return e};z.run_cascade=function(n,o,t){const p=n.pixels,r=n.nrows,c=n.ncols,l=n.ldim,U=t.shiftfactor,u=t.minsize,a=t.maxsize,f=t.scalefactor;let e=u;const s=[];for(;e<=a;){const h=Math.max(U*e,1)>>0,w=e/2+1>>0;for(let M=w;M<=r-w;M+=h)for(let _=w;_<=c-w;_+=h){const m=o(M,_,e,p,l);m>0&&s.push([M,_,e,m])}e=e*f}return s};z.cluster_detections=function(n,o){n=n.sort(function(c,l){return l[3]-c[3]});function t(c,l){const U=c[0],u=c[1],a=c[2],f=l[0],e=l[1],s=l[2],h=Math.max(0,Math.min(U+a/2,f+s/2)-Math.max(U-a/2,f-s/2)),w=Math.max(0,Math.min(u+a/2,e+s/2)-Math.max(u-a/2,e-s/2));return h*w/(a*a+s*s-h*w)}const p=new Array(n.length).fill(0),r=[];for(let c=0;c<n.length;++c)if(p[c]==0){let l=0,U=0,u=0,a=0,f=0;for(let e=c;e<n.length;++e)t(n[c],n[e])>o&&(p[e]=1,l=l+n[e][0],U=U+n[e][1],u=u+n[e][2],a=a+n[e][3],f=f+1);r.push([l/f,U/f,u/f,a])}return r};z.instantiate_detection_memory=function(n){let o=0;const t=[];for(let r=0;r<n;++r)t.push([]);function p(r){for(t[o]=r,o=(o+1)%t.length,r=[],i=0;i<t.length;++i)r=r.concat(t[i]);return r}return p};export{z as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.