Comparing version 0.0.5 to 0.0.6
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("canvas"),require("fs"),require("https")):"function"==typeof define&&define.amd?define(["canvas","fs","https"],e):"object"==typeof exports?exports.main=e(require("canvas"),require("fs"),require("https")):t.main=e(t.canvas,t.fs,t.https)}(this,function(t,e,i){return function(t){function e(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,e,i){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=27)}([function(t,e){"use strict";function i(t){return r(t)/t.length}function r(t){for(var e=0,i=0;i<t.length;i++)e+=t[i];return e}function n(t){for(var e=[],i=0;i<t.length;i++)e[i]=Math.floor(t[i]);return e}function s(t){for(var e=0,i=0;i<t.length;i++)for(var r=0;r<t[0].length;r++)e+=t[i][r];return e}function o(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n]+e[r][n]}return i}function a(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n]+e}return i}function h(t,e){return"number"==typeof e?a(t,e):o(t,e)}function f(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n]/e}return i}function u(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n]/e[r][n]}return i}function p(t,e){return"number"==typeof e?f(t,e):u(t,e)}function l(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n]*e}return i}function c(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n]*e[r][n]}return i}function d(t,e){return"number"==typeof e?l(t,e):c(t,e)}function m(t){return d(t,t)}function v(t){return s(t)/(t.length*t[0].length)}t.exports={average:i,sum2d:s,add2d:h,divide2d:p,multiply2d:d,square2d:m,mean2d:v,floor:n}},function(t,e,i){"use strict";function r(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return s(t,e,0)}var n=i(5),s=n.numbers;t.exports={zeros:r}},function(t,e,i){"use strict";var r=i(3),n=r.conv2,s=i(21),o=s.rgb2gray,a=i(20),h=a.ones,f=i(1),u=f.zeros,p=i(7),l=p.padarray,c=i(4),d=c.filter2,m=i(18),v=m.fspecial,g=i(19),b=g.imfilter,x=i(22),w=x.skip2d;t.exports={conv2:n,fspecial:v,filter2:d,zeros:u,ones:h,padarray:l,imfilter:b,skip2d:w,rgb2gray:o}},function(t,e,i){"use strict";function r(t,e){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"full",r=t.length,n=t[0].length,o=e.length,h=e[0].length,f=a(r+o-1,n+h-1),u=0;u<o;u++)for(var p=0;p<h;p++)for(var l=e[u][p],c=0;c<r;c++)for(var d=0;d<n;d++)f[c+u][d+p]+=t[c][d]*l;if("full"===i)return f;if("same"===i){var m=Math.ceil((f.length-r)/2),v=Math.ceil((f[0].length-n)/2);return s(f,m,r,v,n)}return s(f,o-1,r-o+1,h-1,n-h+1)}var n=i(23),s=n.sub,o=i(1),a=o.zeros;t.exports={conv2:r}},function(t,e,i){"use strict";function r(t){for(var e=[],i=t.length,r=t[0].length,n=0;n<i;n++){e[n]=[];for(var s=0;s<r;s++)e[n][s]=t[i-1-n][r-1-s]}return e}function n(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"same";return o(e,r(t),i)}var s=i(3),o=s.conv2;t.exports={filter2:n}},function(t,e){"use strict";function i(t,e,i){for(var r=[],n=0;n<t;n++){r[n]=[];for(var s=0;s<e;s++)r[n][s]=i}return r}t.exports={numbers:i}},function(t,e){"use strict";function i(t,e){return t-e*Math.floor(t/e)}t.exports={mod:i}},function(t,e,i){"use strict";function r(t){for(var e=[],i=t.length,r=t[0].length,n=0;n<i;n++){e[n]=[];for(var s=0;s<r;s++)e[n][s]=t[n][r-1-s]}return e}function n(t){for(var e=[],i=t.length,r=t[0].length,n=0;n<i;n++){e[n]=[];for(var s=0;s<r;s++)e[n][s]=t[i-1-n][s]}return e}function s(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n];for(var s=0;s<e[0].length;s++)i[r][s+t[0].length]=e[r][s]}return i}function o(t,e){for(var i=c(t.length+e.length,t[0].length),r=0;r<t[0].length;r++){for(var n=0;n<t.length;n++)i[n][r]=t[n][r];for(var s=0;s<e.length;s++)i[s+t.length][r]=e[s][r]}return i}function a(t,e){for(var i=[],n=s(t,r(t)),o=n[0].length,a=t[0].length,h=0;h<t.length;h++){i[h]=[];for(var f=-e;f<a+e;f++)i[h][f+e]=n[h][m(f,o)]}return i}function h(t,e){for(var i=[],r=o(t,n(t)),s=r.length,a=t.length,h=-e;h<a+e;h++){i[h+e]=[];for(var f=0;f<t[0].length;f++)i[h+e][f]=r[m(h,s)][f]}return i}function f(t,e,i){for(var r=p(i,2),n=r[0],s=r[1],o=-n;o<0;o++){for(var a=-s;a<0;a++)t[o+n][a+s]=e[Math.abs(o)-1][Math.abs(a)-1];for(var h=0;h<e[0].length;h++)t[o+n][h+s]=e[Math.abs(o)-1][h];for(var f=e[0].length;f<e[0].length+s;f++)t[o+n][f+s]=e[Math.abs(o)-1][2*e[0].length-f-1]}for(var u=0;u<e.length;u++){for(var l=-s;l<0;l++)t[u+n][l+s]=e[u][Math.abs(l)-1];for(var c=0;c<e[0].length;c++)t[u+n][c+s]=e[u][c];for(var d=e[0].length;d<e[0].length+s;d++)t[u+n][d+s]=e[u][2*e[0].length-d-1]}for(var m=e.length;m<e.length+n;m++){for(var v=-s;v<0;v++)t[m+n][v+s]=e[2*e.length-m-1][Math.abs(v)-1];for(var g=0;g<e[0].length;g++)t[m+n][g+s]=e[2*e.length-m-1][g];for(var b=e[0].length;b<e[0].length+s;b++)t[m+n][b+s]=e[2*e.length-m-1][2*e[0].length-b-1]}return t}function u(t,e){var i=p(e,2),r=i[0],n=i[1];if(t.length>=r&&t[0].length>=n){for(var s=[],o=0;o<t.length+2*r;o++)s[o]=[];return f(s,t,[r,n])}return h(a(t,n),r)}var p=function(){function t(t,e){var i=[],r=!0,n=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(i.push(o.value),!e||i.length!==e);r=!0);}catch(t){n=!0,s=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw s}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=i(1),c=l.zeros,d=i(6),m=d.mod;t.exports={padarray:u}},function(t,e,i){"use strict";function r(t){for(var e=[],i=t.data,r=0;r<t.width;r++){e[r]=[];for(var n=0;n<t.height;n++){var s=4*(r+n*t.width);e[r][n]=[i[s],i[s+1],i[s+2],i[s+3]]}}return e}function n(t,e,i){if(i&&t>=i&&e>=i){var r=t/e;return r>1?{height:i,width:Math.round(i/r)}:{height:Math.round(i*r),width:i}}return{width:t,height:e}}function s(t,e){var i=l(t),s=i.ext,o=void 0;if("bmp"===s)o=c.decode(t);else{var a=new p.Image;a.src=t;var h=n(a.width,a.height,e),f=h.width,u=h.height,d=new p(f,u),m=d.getContext("2d");m.drawImage(a,0,0,a.width,a.height,0,0,f,u),o=m.getImageData(0,0,f,u)}return new Promise(function(t){t(r(o))})}function o(t){return new Promise(function(e,i){u.get(t).on("response",function(t){var i=[];t.on("data",function(t){return i.push(t)}),t.on("end",function(){return e(Buffer.concat(i))})}).on("error",i)})}function a(t){return new Promise(function(e,i){f.readFile(t,function(t,r){return t?void i(t):void e(r)})})}function h(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=void 0;return i=Buffer.isBuffer(t)?Promise.resolve(t):0===t.indexOf("http://")||0===t.indexOf("https://")?o(t):a(t),i.then(function(t){return s(t,e)})}var f=i(25),u=i(26),p=i(24),l=i(17),c=i(13);t.exports={readpixels:h}},function(t,e,i){"use strict";function r(t,e,i){var r=c("gaussian",i.windowSize,1.5),o=Math.pow(2,i.bitDepth)-1,l=Math.pow(i.k1*o,2),m=Math.pow(i.k2*o,2);if(r=f(r,p(r)),"original"===i.downsample){var v=n(t,e,i.maxSize),g=s(v,2);t=g[0],e=g[1]}var b=d(r,t,"valid"),x=d(r,e,"valid"),w=u(b),y=u(x),I=a(b,x),E=u(t),U=u(e),M=a(w,-1),z=a(y,-1),j=a(I,-1),S=h(d(r,E,"valid"),M),k=h(d(r,U,"valid"),z),L=h(d(r,a(t,e),"valid"),j);if(l>0&&m>0){var P=h(a(I,2),l),B=h(a(L,2),m),q=h(h(w,y),l),O=h(h(S,k),m);return f(a(P,B),a(q,O))}var A=a(I,2),_=a(L,2),D=h(w,y),T=h(S,k);return f(a(A,_),a(D,T))}function n(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:256,r=Math.min(t[0].length,e.length)/i,n=Math.round(r),s=Math.max(1,n);if(s>1){var o=g(s);o=f(o,p(o)),t=m(t,o,"symmetric","same"),e=m(e,o,"symmetric","same");var a=t.length,h=t[0].length;t=v(t,[0,s,a],[0,s,h]),e=v(e,[0,s,a],[0,s,h])}return[t,e]}var s=function(){function t(t,e){var i=[],r=!0,n=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(i.push(o.value),!e||i.length!==e);r=!0);}catch(t){n=!0,s=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw s}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=i(0),a=o.multiply2d,h=o.add2d,f=o.divide2d,u=o.square2d,p=o.sum2d,l=i(2),c=l.fspecial,d=l.filter2,m=l.imfilter,v=l.skip2d,g=l.ones;t.exports={ssim:r}},function(t,e){"use strict";function i(t){throw new Error("Missing "+t+" parameter")}t.exports={force:i}},function(t,e){t.exports={name:"ssim.js",version:"0.0.5",description:"JS MSSIM computation",main:"dist/ssim.js",scripts:{cover:"node_modules/.bin/istanbul cover blue-tape spec/unit/{*,**/*}.spec.js",test:"blue-tape spec/unit/{*,**/*}.spec.js | tap-dot","test:e2e":"blue-tape spec/e2e_dist/{*,**/*}.spec.js | tap-dot","test:watch":"nodemon node_modules/.bin/blue-tape spec/unit/{*,**/*}.spec.js",docs:" jsdoc --pedantic -c .jsdoc . --readme README.md",fixme:"ci/fixme.js",lint:"eslint .",build:"webpack && babel spec/helpers --out-dir spec/helpers_dist/ && babel spec/e2e --out-dir spec/e2e_dist/",watch:"webpack --watch",update:"ci/update.sh",codeclimate:"npm run cover && cat ./coverage/lcov.info | ./node_modules/.bin/codeclimate-test-reporter"},repository:{type:"git",url:"git+https://github.com/obartra/notes.git"},keywords:["ssim","image","structural","similarity","image","processing"],author:"Oscar Bartra",license:"MIT",bugs:{url:"https://github.com/obartra/notes/issues"},files:["README.md","dist/ssim.js","dist/ssim.js.map"],homepage:"https://github.com/obartra/notes#readme",dependencies:{"bmp-js":"0.0.2",canvas:"1.5.0","image-type":"2.1.0"},devDependencies:{"babel-cli":"6.16.0","babel-core":"6.17.0","babel-loader":"6.2.5","babel-preset-es2015":"6.16.0","blue-tape":"1.0.0","codeclimate-test-reporter":"0.4.0",eslint:"3.7.1","eslint-config-airbnb":"12.0.0","eslint-config-standard":"6.2.0","eslint-plugin-import":"1.16.0","eslint-plugin-jsx-a11y":"2.2.3","eslint-plugin-promise":"3.0.0","eslint-plugin-react":"6.4.1","eslint-plugin-standard":"2.0.1",fixme:"0.4.0",istanbul:"0.4.5",jsdoc:"3.4.2","json-loader":"0.5.4",nodemon:"1.11.0","npm-check-updates":"2.8.5","tap-dot":"1.0.5",webpack:"2.1.0-beta.24"}}},function(t,e){t.exports={windowSize:11,k1:.01,k2:.03,bitDepth:8,downsample:"original",maxSize:256}},function(t,e,i){"use strict";var r=i(15),n=i(14);t.exports={encode:r,decode:n}},function(t,e){"use strict";function i(t,e){if(this.pos=0,this.buffer=t,this.is_with_alpha=!!e,this.flag=this.buffer.toString("utf-8",0,this.pos+=2),"BM"!=this.flag)throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}i.prototype.parseHeader=function(){if(this.fileSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.reserved=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.offset=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.headerSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.width=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.height=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.planes=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.bitPP=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.compress=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.rawSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.hr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.vr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.colors=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.importantColors=this.buffer.readUInt32LE(this.pos),this.pos+=4,16===this.bitPP&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var t=0===this.colors?1<<this.bitPP:this.colors;this.palette=new Array(t);for(var e=0;e<t;e++){var i=this.buffer.readUInt8(this.pos++),r=this.buffer.readUInt8(this.pos++),n=this.buffer.readUInt8(this.pos++),s=this.buffer.readUInt8(this.pos++);this.palette[e]={red:n,green:r,blue:i,quad:s}}}},i.prototype.parseBGR=function(){this.pos=this.offset;try{var t="bit"+this.bitPP,e=this.width*this.height*4;this.data=new Buffer(e),this[t]()}catch(t){console.log("bit decode error:"+t)}},i.prototype.bit1=function(){for(var t=Math.ceil(this.width/8),e=t%4,i=this.height-1;i>=0;i--){for(var r=0;r<t;r++)for(var n=this.buffer.readUInt8(this.pos++),s=i*this.width*4+8*r*4,o=0;o<8&&8*r+o<this.width;o++){var a=this.palette[n>>7-o&1];this.data[s+4*o]=a.blue,this.data[s+4*o+1]=a.green,this.data[s+4*o+2]=a.red,this.data[s+4*o+3]=255}0!=e&&(this.pos+=4-e)}},i.prototype.bit4=function(){for(var t=Math.ceil(this.width/2),e=t%4,i=this.height-1;i>=0;i--){for(var r=0;r<t;r++){var n=this.buffer.readUInt8(this.pos++),s=i*this.width*4+2*r*4,o=n>>4,a=15&n,h=this.palette[o];if(this.data[s]=h.blue,this.data[s+1]=h.green,this.data[s+2]=h.red,this.data[s+3]=255,2*r+1>=this.width)break;h=this.palette[a],this.data[s+4]=h.blue,this.data[s+4+1]=h.green,this.data[s+4+2]=h.red,this.data[s+4+3]=255}0!=e&&(this.pos+=4-e)}},i.prototype.bit8=function(){for(var t=this.width%4,e=this.height-1;e>=0;e--){for(var i=0;i<this.width;i++){var r=this.buffer.readUInt8(this.pos++),n=e*this.width*4+4*i;if(r<this.palette.length){var s=this.palette[r];this.data[n]=s.blue,this.data[n+1]=s.green,this.data[n+2]=s.red,this.data[n+3]=255}else this.data[n]=255,this.data[n+1]=255,this.data[n+2]=255,this.data[n+3]=255}0!=t&&(this.pos+=4-t)}},i.prototype.bit15=function(){for(var t=this.width%3,e=parseInt("11111",2),i=e,r=this.height-1;r>=0;r--){for(var n=0;n<this.width;n++){var s=this.buffer.readUInt16LE(this.pos);this.pos+=2;var o=(s&i)/i*255|0,a=(s>>5&i)/i*255|0,h=(s>>10&i)/i*255|0,f=s>>15?255:0,u=r*this.width*4+4*n;this.data[u]=h,this.data[u+1]=a,this.data[u+2]=o,this.data[u+3]=f}this.pos+=t}},i.prototype.bit16=function(){for(var t=this.width%3,e=parseInt("11111",2),i=e,r=parseInt("111111",2),n=r,s=this.height-1;s>=0;s--){for(var o=0;o<this.width;o++){var a=this.buffer.readUInt16LE(this.pos);this.pos+=2;var h=255,f=(a&i)/i*255|0,u=(a>>5&n)/n*255|0,p=(a>>11)/i*255|0,l=s*this.width*4+4*o;this.data[l]=p,this.data[l+1]=u,this.data[l+2]=f,this.data[l+3]=h}this.pos+=t}},i.prototype.bit24=function(){for(var t=this.height-1;t>=0;t--){for(var e=0;e<this.width;e++){var i=this.buffer.readUInt8(this.pos++),r=this.buffer.readUInt8(this.pos++),n=this.buffer.readUInt8(this.pos++),s=t*this.width*4+4*e;this.data[s]=n,this.data[s+1]=r,this.data[s+2]=i,this.data[s+3]=255}this.pos+=this.width%4}},i.prototype.bit32=function(){for(var t=this.height-1;t>=0;t--){for(var e=0;e<this.width;e++){var i=this.buffer.readUInt8(this.pos++),r=this.buffer.readUInt8(this.pos++),n=this.buffer.readUInt8(this.pos++),s=this.buffer.readUInt8(this.pos++),o=t*this.width*4+4*e;this.data[o]=n,this.data[o+1]=r,this.data[o+2]=i,this.data[o+3]=s}this.pos+=this.width%4}},i.prototype.getData=function(){return this.data},t.exports=function(t){var e=new i(t);return{data:e.getData(),width:e.width,height:e.height}}},function(t,e){"use strict";function i(t){this.buffer=t.data,this.width=t.width,this.height=t.height,this.extraBytes=this.width%4,this.rgbSize=this.height*(3*this.width+this.extraBytes),this.headerInfoSize=40,this.data=[],this.flag="BM",this.reserved=0,this.offset=54,this.fileSize=this.rgbSize+this.offset,this.planes=1,this.bitPP=24,this.compress=0,this.hr=0,this.vr=0,this.colors=0,this.importantColors=0}i.prototype.encode=function(){var t=new Buffer(this.offset+this.rgbSize);this.pos=0,t.write(this.flag,this.pos,2),this.pos+=2,t.writeUInt32LE(this.fileSize,this.pos),this.pos+=4,t.writeUInt32LE(this.reserved,this.pos),this.pos+=4,t.writeUInt32LE(this.offset,this.pos),this.pos+=4,t.writeUInt32LE(this.headerInfoSize,this.pos),this.pos+=4,t.writeUInt32LE(this.width,this.pos),this.pos+=4,t.writeUInt32LE(this.height,this.pos),this.pos+=4,t.writeUInt16LE(this.planes,this.pos),this.pos+=2,t.writeUInt16LE(this.bitPP,this.pos),this.pos+=2,t.writeUInt32LE(this.compress,this.pos),this.pos+=4,t.writeUInt32LE(this.rgbSize,this.pos),this.pos+=4,t.writeUInt32LE(this.hr,this.pos),this.pos+=4,t.writeUInt32LE(this.vr,this.pos),this.pos+=4,t.writeUInt32LE(this.colors,this.pos),this.pos+=4,t.writeUInt32LE(this.importantColors,this.pos),this.pos+=4;for(var e=0,i=3*this.width+this.extraBytes,r=this.height-1;r>=0;r--){for(var n=0;n<this.width;n++){var s=this.pos+r*i+3*n;t[s+2]=this.buffer[e++],t[s+1]=this.buffer[e++],t[s]=this.buffer[e++],e++}if(this.extraBytes>0){var o=this.pos+r*i+3*this.width;t.fill(0,o,o+this.extraBytes)}}return t},t.exports=function(t,e){"undefined"==typeof e&&(e=100);var r=new i(t),n=r.encode();return{data:n,width:t.width,height:t.height}}},function(t,e){"use strict";t.exports=function(t){return t&&t.length>1?255===t[0]&&216===t[1]&&255===t[2]?{ext:"jpg",mime:"image/jpeg"}:137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]?{ext:"png",mime:"image/png"}:71===t[0]&&73===t[1]&&70===t[2]?{ext:"gif",mime:"image/gif"}:87===t[8]&&69===t[9]&&66===t[10]&&80===t[11]?{ext:"webp",mime:"image/webp"}:(73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3])&&67===t[8]&&82===t[9]?{ext:"cr2",mime:"image/x-canon-cr2"}:73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3]?{ext:"tif",mime:"image/tiff"}:66===t[0]&&77===t[1]?{ext:"bmp",mime:"image/bmp"}:73===t[0]&&73===t[1]&&188===t[2]?{ext:"jxr",mime:"image/vnd.ms-photo"}:56===t[0]&&66===t[1]&&80===t[2]&&83===t[3]?{ext:"psd",mime:"image/vnd.adobe.photoshop"}:80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]&&109===t[30]&&105===t[31]&&109===t[32]&&101===t[33]&&116===t[34]&&121===t[35]&&112===t[36]&&101===t[37]&&97===t[38]&&112===t[39]&&112===t[40]&&108===t[41]&&105===t[42]&&99===t[43]&&97===t[44]&&116===t[45]&&105===t[46]&&111===t[47]&&110===t[48]&&47===t[49]&&101===t[50]&&112===t[51]&&117===t[52]&&98===t[53]&&43===t[54]&&122===t[55]&&105===t[56]&&112===t[57]?{ext:"epub",mime:"application/epub+zip"}:80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]&&77===t[30]&&69===t[31]&&84===t[32]&&65===t[33]&&45===t[34]&&73===t[35]&&78===t[36]&&70===t[37]&&47===t[38]&&109===t[39]&&111===t[40]&&122===t[41]&&105===t[42]&&108===t[43]&&108===t[44]&&97===t[45]&&46===t[46]&&114===t[47]&&115===t[48]&&97===t[49]?{ext:"xpi",mime:"application/x-xpinstall"}:80!==t[0]||75!==t[1]||3!==t[2]&&5!==t[2]&&7!==t[2]||4!==t[3]&&6!==t[3]&&8!==t[3]?117===t[257]&&115===t[258]&&116===t[259]&&97===t[260]&&114===t[261]?{ext:"tar",mime:"application/x-tar"}:82!==t[0]||97!==t[1]||114!==t[2]||33!==t[3]||26!==t[4]||7!==t[5]||0!==t[6]&&1!==t[6]?31===t[0]&&139===t[1]&&8===t[2]?{ext:"gz",mime:"application/gzip"}:66===t[0]&&90===t[1]&&104===t[2]?{ext:"bz2",mime:"application/x-bzip2"}:55===t[0]&&122===t[1]&&188===t[2]&&175===t[3]&&39===t[4]&&28===t[5]?{ext:"7z",mime:"application/x-7z-compressed"}:120===t[0]&&1===t[1]?{ext:"dmg",mime:"application/x-apple-diskimage"}:0===t[0]&&0===t[1]&&0===t[2]&&(24===t[3]||32===t[3])&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]||51===t[0]&&103===t[1]&&112===t[2]&&53===t[3]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&109===t[8]&&112===t[9]&&52===t[10]&&50===t[11]&&109===t[16]&&112===t[17]&&52===t[18]&&49===t[19]&&109===t[20]&&112===t[21]&&52===t[22]&&50===t[23]&&105===t[24]&&115===t[25]&&111===t[26]&&109===t[27]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&105===t[8]&&115===t[9]&&111===t[10]&&109===t[11]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&109===t[8]&&112===t[9]&&52===t[10]&&50===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&0===t[15]?{ext:"mp4",mime:"video/mp4"}:0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&77===t[8]&&52===t[9]&&86===t[10]?{ext:"m4v",mime:"video/x-m4v"}:77===t[0]&&84===t[1]&&104===t[2]&&100===t[3]?{ext:"mid",mime:"audio/midi"}:109===t[31]&&97===t[32]&&116===t[33]&&114===t[34]&&111===t[35]&&115===t[36]&&107===t[37]&&97===t[38]?{ext:"mkv",mime:"video/x-matroska"}:26===t[0]&&69===t[1]&&223===t[2]&&163===t[3]?{ext:"webm",mime:"video/webm"}:0===t[0]&&0===t[1]&&0===t[2]&&20===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]?{ext:"mov",mime:"video/quicktime"}:82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&65===t[8]&&86===t[9]&&73===t[10]?{ext:"avi",mime:"video/x-msvideo"}:48===t[0]&&38===t[1]&&178===t[2]&&117===t[3]&&142===t[4]&&102===t[5]&&207===t[6]&&17===t[7]&&166===t[8]&&217===t[9]?{ext:"wmv",mime:"video/x-ms-wmv"}:0===t[0]&&0===t[1]&&1===t[2]&&"b"===t[3].toString(16)[0]?{ext:"mpg",mime:"video/mpeg"}:73===t[0]&&68===t[1]&&51===t[2]||255===t[0]&&251===t[1]?{ext:"mp3",mime:"audio/mpeg"}:102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&77===t[8]&&52===t[9]&&65===t[10]||77===t[0]&&52===t[1]&&65===t[2]&&32===t[3]?{ext:"m4a",mime:"audio/m4a"}:79===t[28]&&112===t[29]&&117===t[30]&&115===t[31]&&72===t[32]&&101===t[33]&&97===t[34]&&100===t[35]?{ext:"opus",mime:"audio/opus"}:79===t[0]&&103===t[1]&&103===t[2]&&83===t[3]?{ext:"ogg",mime:"audio/ogg"}:102===t[0]&&76===t[1]&&97===t[2]&&67===t[3]?{ext:"flac",mime:"audio/x-flac"}:82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&87===t[8]&&65===t[9]&&86===t[10]&&69===t[11]?{ext:"wav",mime:"audio/x-wav"}:35===t[0]&&33===t[1]&&65===t[2]&&77===t[3]&&82===t[4]&&10===t[5]?{ext:"amr",mime:"audio/amr"}:37===t[0]&&80===t[1]&&68===t[2]&&70===t[3]?{ext:"pdf",mime:"application/pdf"}:77===t[0]&&90===t[1]?{ext:"exe",mime:"application/x-msdownload"}:67!==t[0]&&70!==t[0]||87!==t[1]||83!==t[2]?123===t[0]&&92===t[1]&&114===t[2]&&116===t[3]&&102===t[4]?{ext:"rtf",mime:"application/rtf"}:119===t[0]&&79===t[1]&&70===t[2]&&70===t[3]&&(0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]||79===t[4]&&84===t[5]&&84===t[6]&&79===t[7])?{ext:"woff",mime:"application/font-woff"}:119===t[0]&&79===t[1]&&70===t[2]&&50===t[3]&&(0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]||79===t[4]&&84===t[5]&&84===t[6]&&79===t[7])?{ext:"woff2",mime:"application/font-woff"}:76===t[34]&&80===t[35]&&(0===t[8]&&0===t[9]&&1===t[10]||1===t[8]&&0===t[9]&&2===t[10]||2===t[8]&&0===t[9]&&2===t[10])?{ext:"eot",mime:"application/octet-stream"}:0===t[0]&&1===t[1]&&0===t[2]&&0===t[3]&&0===t[4]?{ext:"ttf",mime:"application/font-sfnt"}:79===t[0]&&84===t[1]&&84===t[2]&&79===t[3]&&0===t[4]?{ext:"otf",mime:"application/font-sfnt"}:0===t[0]&&0===t[1]&&1===t[2]&&0===t[3]?{ext:"ico",mime:"image/x-icon"}:70===t[0]&&76===t[1]&&86===t[2]&&1===t[3]?{ext:"flv",mime:"video/x-flv"}:37===t[0]&&33===t[1]?{ext:"ps",mime:"application/postscript"}:253===t[0]&&55===t[1]&&122===t[2]&&88===t[3]&&90===t[4]&&0===t[5]?{ext:"xz",mime:"application/x-xz"}:83===t[0]&&81===t[1]&&76===t[2]&&105===t[3]?{ext:"sqlite",mime:"application/x-sqlite3"}:78===t[0]&&69===t[1]&&83===t[2]&&26===t[3]?{ext:"nes",mime:"application/x-nintendo-nes-rom"}:67===t[0]&&114===t[1]&&50===t[2]&&52===t[3]?{ext:"crx",mime:"application/x-google-chrome-extension"}:77===t[0]&&83===t[1]&&67===t[2]&&70===t[3]||73===t[0]&&83===t[1]&&99===t[2]&&40===t[3]?{ext:"cab",mime:"application/vnd.ms-cab-compressed"}:33===t[0]&&60===t[1]&&97===t[2]&&114===t[3]&&99===t[4]&&104===t[5]&&62===t[6]&&10===t[7]&&100===t[8]&&101===t[9]&&98===t[10]&&105===t[11]&&97===t[12]&&110===t[13]&&45===t[14]&&98===t[15]&&105===t[16]&&110===t[17]&&97===t[18]&&114===t[19]&&121===t[20]?{ext:"deb",mime:"application/x-deb"}:33===t[0]&&60===t[1]&&97===t[2]&&114===t[3]&&99===t[4]&&104===t[5]&&62===t[6]?{ext:"ar",mime:"application/x-unix-archive"}:237===t[0]&&171===t[1]&&238===t[2]&&219===t[3]?{ext:"rpm",mime:"application/x-rpm"}:31===t[0]&&160===t[1]||31===t[0]&&157===t[1]?{ext:"Z",mime:"application/x-compress"}:76===t[0]&&90===t[1]&&73===t[2]&&80===t[3]?{ext:"lz",mime:"application/x-lzip"}:208===t[0]&&207===t[1]&&17===t[2]&&224===t[3]&&161===t[4]&&177===t[5]&&26===t[6]&&225===t[7]?{ext:"msi",mime:"application/x-msi"}:null:{ext:"swf",mime:"application/x-shockwave-flash"}:{ext:"rar",mime:"application/x-rar-compressed"}:{ext:"zip",mime:"application/zip"}:null}},function(t,e,i){"use strict";var r=i(16);t.exports=function(t){var e=["jpg","png","gif","webp","tif","bmp","jxr","psd"],i=r(t);return e.indexOf(i&&i.ext)!==-1?i:null}},function(t,e,i){"use strict";function r(t){for(var e=[],i=0;i<=2*t;i++){e[i]=[];for(var r=0;r<=2*t;r++)e[i][r]=Math.pow(i-t,2)+Math.pow(r-t,2)}return e}function n(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[r].length;n++)i[r][n]=Math.exp(-t[r][n]/(2*Math.pow(e,2)))}return i}function s(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"gaussian",arguments.length>1&&void 0!==arguments[1]?arguments[1]:3),e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1.5;t=(t-1)/2;var i=r(t),s=n(i,e),o=a(s);return h(s,o)}var o=i(0),a=o.sum2d,h=o.divide2d;t.exports={fspecial:s}},function(t,e,i){"use strict";function r(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"symmetric",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"same",n=e.length,o=e[0].length;if(t=a(t,f([o/2,n/2]),i),0===s(o,2)&&t.pop(),0===s(n,2))for(var h=0;h<t.length;h++)t[h].pop();return"same"===r&&(r="valid"),p(e,t,r)}var n=i(6),s=n.mod,o=i(7),a=o.padarray,h=i(0),f=h.floor,u=i(4),p=u.filter2;t.exports={imfilter:r}},function(t,e,i){"use strict";function r(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return s(t,e,1)}var n=i(5),s=n.numbers;t.exports={ones:r}},function(t,e){"use strict";function i(t){var e=n(t,3),i=e[0],r=e[1],s=e[2];return Math.round(.29894*i+.58704*r+.11402*s)}function r(t){for(var e=[],r=0;r<t.length;r++){e[r]=[];for(var n=0;n<t[r].length;n++)e[r][n]=i(t[r][n])}return e}var n=function(){function t(t,e){var i=[],r=!0,n=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(i.push(o.value),!e||i.length!==e);r=!0);}catch(t){n=!0,s=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw s}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.exports={rgb2gray:r}},function(t,e){"use strict";function i(t,e,i){for(var n=r(e,3),s=n[0],o=n[1],a=n[2],h=r(i,3),f=h[0],u=h[1],p=h[2],l=[],c=0;c<(a-s)/o;c++){l[c]=[];for(var d=0;d<(p-f)/u;d++)l[c][d]=t[s+c*o][f+d*u]}return l}var r=function(){function t(t,e){var i=[],r=!0,n=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(i.push(o.value),!e||i.length!==e);r=!0);}catch(t){n=!0,s=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw s}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.exports={skip2d:i}},function(t,e){"use strict";function i(t,e,i,r,n){for(var s=[],o=0;o<i;o++){s[o]=[];for(var a=0;a<n;a++)s[o][a]=t[o+r][a+e]}return s}t.exports={sub:i}},function(e,i){e.exports=t},function(t,e){t.exports=require("fs")},function(t,e){t.exports=require("https")},function(t,e,i){"use strict";function r(t){if(Object.keys(t).forEach(function(t){if(!(t in w))throw new Error('"'+t+'" is not a valid option')}),"k1"in t&&("number"!=typeof t.k1||t.k1<0))throw new Error("Invalid k1 value. Default is "+w.k1);if("k2"in t&&("number"!=typeof t.k2||t.k2<0))throw new Error("Invalid k2 value. Default is "+w.k2)}function n(t){return r(t),Object.assign({},w,t)}function s(t){var e=f(t,2),i=e[0],r=e[1];if(i.length!==r.length||i[0].length!==r[0].length)throw new Error("Image dimensions do not match");return[i,r]}function o(t){var e=f(t,2),i=e[0],r=e[1];return i=c(i),r=c(r),[i,r]}function a(t,e){return"fast"===e.downsample?p(t,e.maxSize):p(t)}function h(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x("image1"),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:x("image2"),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(new Date).getTime();return i=n(i),Promise.all([a(t,i),a(e,i)]).then(s).then(o).then(function(t){var e=f(t,2),r=e[0],n=e[1];return g(r,n,i)}).then(function(t){return{ssim_map:t,mssim:m(t),performance:(new Date).getTime()-r}})}var f=function(){function t(t,e){var i=[],r=!0,n=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(i.push(o.value),!e||i.length!==e);r=!0);}catch(t){n=!0,s=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw s}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=i(8),p=u.readpixels,l=i(2),c=l.rgb2gray,d=i(0),m=d.mean2d,v=i(9),g=v.ssim,b=i(10),x=b.force,w=i(12),y=i(11),I=y.version;h.ssim=g,h.version=I,t.exports=h}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("canvas"),require("fs"),require("https")):"function"==typeof define&&define.amd?define(["canvas","fs","https"],e):"object"==typeof exports?exports.main=e(require("canvas"),require("fs"),require("https")):t.main=e(t.canvas,t.fs,t.https)}(this,function(t,e,i){return function(t){function e(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,e,i){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=27)}([function(t,e){"use strict";function i(t){return r(t)/t.length}function r(t){for(var e=0,i=0;i<t.length;i++)e+=t[i];return e}function n(t){for(var e=[],i=0;i<t.length;i++)e[i]=Math.floor(t[i]);return e}function s(t){for(var e=0,i=0;i<t.length;i++)for(var r=0;r<t[0].length;r++)e+=t[i][r];return e}function o(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n]+e[r][n]}return i}function a(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n]+e}return i}function h(t,e){return"number"==typeof e?a(t,e):o(t,e)}function f(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n]/e}return i}function u(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n]/e[r][n]}return i}function p(t,e){return"number"==typeof e?f(t,e):u(t,e)}function l(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n]*e}return i}function c(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n]*e[r][n]}return i}function d(t,e){return"number"==typeof e?l(t,e):c(t,e)}function m(t){return d(t,t)}function v(t){return s(t)/(t.length*t[0].length)}t.exports={average:i,sum2d:s,add2d:h,divide2d:p,multiply2d:d,square2d:m,mean2d:v,floor:n}},function(t,e,i){"use strict";function r(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return s(t,e,0)}var n=i(5),s=n.numbers;t.exports={zeros:r}},function(t,e,i){"use strict";var r=i(3),n=r.conv2,s=i(21),o=s.rgb2gray,a=i(20),h=a.ones,f=i(1),u=f.zeros,p=i(7),l=p.padarray,c=i(4),d=c.filter2,m=i(18),v=m.fspecial,g=i(19),b=g.imfilter,x=i(22),w=x.skip2d;t.exports={conv2:n,fspecial:v,filter2:d,zeros:u,ones:h,padarray:l,imfilter:b,skip2d:w,rgb2gray:o}},function(t,e,i){"use strict";function r(t,e){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"full",r=t.length,n=t[0].length,o=e.length,h=e[0].length,f=a(r+o-1,n+h-1),u=0;u<o;u++)for(var p=0;p<h;p++)for(var l=e[u][p],c=0;c<r;c++)for(var d=0;d<n;d++)f[c+u][d+p]+=t[c][d]*l;if("full"===i)return f;if("same"===i){var m=Math.ceil((f.length-r)/2),v=Math.ceil((f[0].length-n)/2);return s(f,m,r,v,n)}return s(f,o-1,r-o+1,h-1,n-h+1)}var n=i(23),s=n.sub,o=i(1),a=o.zeros;t.exports={conv2:r}},function(t,e,i){"use strict";function r(t){for(var e=[],i=t.length,r=t[0].length,n=0;n<i;n++){e[n]=[];for(var s=0;s<r;s++)e[n][s]=t[i-1-n][r-1-s]}return e}function n(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"same";return o(e,r(t),i)}var s=i(3),o=s.conv2;t.exports={filter2:n}},function(t,e){"use strict";function i(t,e,i){for(var r=[],n=0;n<t;n++){r[n]=[];for(var s=0;s<e;s++)r[n][s]=i}return r}t.exports={numbers:i}},function(t,e){"use strict";function i(t,e){return t-e*Math.floor(t/e)}t.exports={mod:i}},function(t,e,i){"use strict";function r(t){for(var e=[],i=t.length,r=t[0].length,n=0;n<i;n++){e[n]=[];for(var s=0;s<r;s++)e[n][s]=t[n][r-1-s]}return e}function n(t){for(var e=[],i=t.length,r=t[0].length,n=0;n<i;n++){e[n]=[];for(var s=0;s<r;s++)e[n][s]=t[i-1-n][s]}return e}function s(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[0].length;n++)i[r][n]=t[r][n];for(var s=0;s<e[0].length;s++)i[r][s+t[0].length]=e[r][s]}return i}function o(t,e){for(var i=c(t.length+e.length,t[0].length),r=0;r<t[0].length;r++){for(var n=0;n<t.length;n++)i[n][r]=t[n][r];for(var s=0;s<e.length;s++)i[s+t.length][r]=e[s][r]}return i}function a(t,e){for(var i=[],n=s(t,r(t)),o=n[0].length,a=t[0].length,h=0;h<t.length;h++){i[h]=[];for(var f=-e;f<a+e;f++)i[h][f+e]=n[h][m(f,o)]}return i}function h(t,e){for(var i=[],r=o(t,n(t)),s=r.length,a=t.length,h=-e;h<a+e;h++){i[h+e]=[];for(var f=0;f<t[0].length;f++)i[h+e][f]=r[m(h,s)][f]}return i}function f(t,e,i){for(var r=p(i,2),n=r[0],s=r[1],o=-n;o<0;o++){for(var a=-s;a<0;a++)t[o+n][a+s]=e[Math.abs(o)-1][Math.abs(a)-1];for(var h=0;h<e[0].length;h++)t[o+n][h+s]=e[Math.abs(o)-1][h];for(var f=e[0].length;f<e[0].length+s;f++)t[o+n][f+s]=e[Math.abs(o)-1][2*e[0].length-f-1]}for(var u=0;u<e.length;u++){for(var l=-s;l<0;l++)t[u+n][l+s]=e[u][Math.abs(l)-1];for(var c=0;c<e[0].length;c++)t[u+n][c+s]=e[u][c];for(var d=e[0].length;d<e[0].length+s;d++)t[u+n][d+s]=e[u][2*e[0].length-d-1]}for(var m=e.length;m<e.length+n;m++){for(var v=-s;v<0;v++)t[m+n][v+s]=e[2*e.length-m-1][Math.abs(v)-1];for(var g=0;g<e[0].length;g++)t[m+n][g+s]=e[2*e.length-m-1][g];for(var b=e[0].length;b<e[0].length+s;b++)t[m+n][b+s]=e[2*e.length-m-1][2*e[0].length-b-1]}return t}function u(t,e){var i=p(e,2),r=i[0],n=i[1];if(t.length>=r&&t[0].length>=n){for(var s=[],o=0;o<t.length+2*r;o++)s[o]=[];return f(s,t,[r,n])}return h(a(t,n),r)}var p=function(){function t(t,e){var i=[],r=!0,n=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(i.push(o.value),!e||i.length!==e);r=!0);}catch(t){n=!0,s=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw s}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=i(1),c=l.zeros,d=i(6),m=d.mod;t.exports={padarray:u}},function(t,e,i){"use strict";function r(t){for(var e=[],i=t.data,r=0;r<t.width;r++){e[r]=[];for(var n=0;n<t.height;n++){var s=4*(r+n*t.width);e[r][n]=[i[s],i[s+1],i[s+2],i[s+3]]}}return e}function n(t,e,i){if(i&&t>=i&&e>=i){var r=t/e;return r>1?{height:i,width:Math.round(i/r)}:{height:Math.round(i*r),width:i}}return{width:t,height:e}}function s(t,e){var i=l(t),s=i.ext,o=void 0;if("bmp"===s)o=c.decode(t);else{var a=new p.Image;a.src=t;var h=n(a.width,a.height,e),f=h.width,u=h.height,d=new p(f,u),m=d.getContext("2d");m.drawImage(a,0,0,a.width,a.height,0,0,f,u),o=m.getImageData(0,0,f,u)}return new Promise(function(t){t(r(o))})}function o(t){return new Promise(function(e,i){u.get(t).on("response",function(t){var i=[];t.on("data",function(t){return i.push(t)}),t.on("end",function(){return e(Buffer.concat(i))})}).on("error",i)})}function a(t){return new Promise(function(e,i){f.readFile(t,function(t,r){return t?void i(t):void e(r)})})}function h(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=void 0;return i=Buffer.isBuffer(t)?Promise.resolve(t):0===t.indexOf("http://")||0===t.indexOf("https://")?o(t):a(t),i.then(function(t){return s(t,e)})}var f=i(25),u=i(26),p=i(24),l=i(17),c=i(13);t.exports={readpixels:h}},function(t,e,i){"use strict";function r(t,e,i){var r=c("gaussian",i.windowSize,1.5),o=Math.pow(2,i.bitDepth)-1,l=Math.pow(i.k1*o,2),m=Math.pow(i.k2*o,2);if(r=f(r,p(r)),"original"===i.downsample){var v=n(t,e,i.maxSize),g=s(v,2);t=g[0],e=g[1]}var b=d(r,t,"valid"),x=d(r,e,"valid"),w=u(b),y=u(x),I=a(b,x),E=u(t),U=u(e),M=a(w,-1),z=a(y,-1),j=a(I,-1),S=h(d(r,E,"valid"),M),k=h(d(r,U,"valid"),z),L=h(d(r,a(t,e),"valid"),j);if(l>0&&m>0){var P=h(a(I,2),l),B=h(a(L,2),m),q=h(h(w,y),l),O=h(h(S,k),m);return f(a(P,B),a(q,O))}var A=a(I,2),_=a(L,2),D=h(w,y),T=h(S,k);return f(a(A,_),a(D,T))}function n(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:256,r=Math.min(t[0].length,e.length)/i,n=Math.round(r),s=Math.max(1,n);if(s>1){var o=g(s);o=f(o,p(o)),t=m(t,o,"symmetric","same"),e=m(e,o,"symmetric","same");var a=t.length,h=t[0].length;t=v(t,[0,s,a],[0,s,h]),e=v(e,[0,s,a],[0,s,h])}return[t,e]}var s=function(){function t(t,e){var i=[],r=!0,n=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(i.push(o.value),!e||i.length!==e);r=!0);}catch(t){n=!0,s=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw s}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=i(0),a=o.multiply2d,h=o.add2d,f=o.divide2d,u=o.square2d,p=o.sum2d,l=i(2),c=l.fspecial,d=l.filter2,m=l.imfilter,v=l.skip2d,g=l.ones;t.exports={ssim:r}},function(t,e){"use strict";function i(t){throw new Error("Missing "+t+" parameter")}t.exports={force:i}},function(t,e){t.exports={name:"ssim.js",version:"0.0.6",description:"JS MSSIM computation",main:"dist/ssim.js",scripts:{cover:"node_modules/.bin/istanbul cover blue-tape spec/unit/{*,**/*}.spec.js",test:"blue-tape spec/unit/{*,**/*}.spec.js | tap-dot","test:e2e":"blue-tape spec/e2e_dist/{*,**/*}.spec.js | tap-dot","test:watch":"nodemon node_modules/.bin/blue-tape spec/unit/{*,**/*}.spec.js",docs:" jsdoc --pedantic -c .jsdoc . --readme README.md",fixme:"ci/fixme.js",lint:"eslint .",build:"webpack && babel spec/helpers --out-dir spec/helpers_dist/ && babel spec/e2e --out-dir spec/e2e_dist/",watch:"webpack --watch",update:"ci/update.sh",codeclimate:"npm run cover && cat ./coverage/lcov.info | ./node_modules/.bin/codeclimate-test-reporter"},repository:{type:"git",url:"git+https://github.com/obartra/notes.git"},keywords:["ssim","image","structural","similarity","image","processing"],author:"Oscar Bartra",license:"MIT",bugs:{url:"https://github.com/obartra/notes/issues"},files:["README.md","dist/ssim.js","dist/ssim.js.map"],homepage:"https://github.com/obartra/notes#readme",dependencies:{"bmp-js":"0.0.2",canvas:"1.5.0","image-type":"2.1.0"},devDependencies:{"babel-cli":"6.16.0","babel-core":"6.17.0","babel-loader":"6.2.5","babel-preset-es2015":"6.16.0","blue-tape":"1.0.0","codeclimate-test-reporter":"0.4.0","core-js":"2.4.1",eslint:"3.7.1","eslint-config-airbnb":"12.0.0","eslint-config-standard":"6.2.0","eslint-plugin-import":"1.16.0","eslint-plugin-jsx-a11y":"2.2.3","eslint-plugin-promise":"3.0.0","eslint-plugin-react":"6.4.1","eslint-plugin-standard":"2.0.1",fixme:"0.4.0",istanbul:"0.4.5",jsdoc:"3.4.2","json-loader":"0.5.4",nodemon:"1.11.0","npm-check-updates":"2.8.5","tap-dot":"1.0.5",webpack:"2.1.0-beta.24"}}},function(t,e){t.exports={windowSize:11,k1:.01,k2:.03,bitDepth:8,downsample:"original",maxSize:256}},function(t,e,i){"use strict";var r=i(15),n=i(14);t.exports={encode:r,decode:n}},function(t,e){"use strict";function i(t,e){if(this.pos=0,this.buffer=t,this.is_with_alpha=!!e,this.flag=this.buffer.toString("utf-8",0,this.pos+=2),"BM"!=this.flag)throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}i.prototype.parseHeader=function(){if(this.fileSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.reserved=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.offset=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.headerSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.width=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.height=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.planes=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.bitPP=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.compress=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.rawSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.hr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.vr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.colors=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.importantColors=this.buffer.readUInt32LE(this.pos),this.pos+=4,16===this.bitPP&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var t=0===this.colors?1<<this.bitPP:this.colors;this.palette=new Array(t);for(var e=0;e<t;e++){var i=this.buffer.readUInt8(this.pos++),r=this.buffer.readUInt8(this.pos++),n=this.buffer.readUInt8(this.pos++),s=this.buffer.readUInt8(this.pos++);this.palette[e]={red:n,green:r,blue:i,quad:s}}}},i.prototype.parseBGR=function(){this.pos=this.offset;try{var t="bit"+this.bitPP,e=this.width*this.height*4;this.data=new Buffer(e),this[t]()}catch(t){console.log("bit decode error:"+t)}},i.prototype.bit1=function(){for(var t=Math.ceil(this.width/8),e=t%4,i=this.height-1;i>=0;i--){for(var r=0;r<t;r++)for(var n=this.buffer.readUInt8(this.pos++),s=i*this.width*4+8*r*4,o=0;o<8&&8*r+o<this.width;o++){var a=this.palette[n>>7-o&1];this.data[s+4*o]=a.blue,this.data[s+4*o+1]=a.green,this.data[s+4*o+2]=a.red,this.data[s+4*o+3]=255}0!=e&&(this.pos+=4-e)}},i.prototype.bit4=function(){for(var t=Math.ceil(this.width/2),e=t%4,i=this.height-1;i>=0;i--){for(var r=0;r<t;r++){var n=this.buffer.readUInt8(this.pos++),s=i*this.width*4+2*r*4,o=n>>4,a=15&n,h=this.palette[o];if(this.data[s]=h.blue,this.data[s+1]=h.green,this.data[s+2]=h.red,this.data[s+3]=255,2*r+1>=this.width)break;h=this.palette[a],this.data[s+4]=h.blue,this.data[s+4+1]=h.green,this.data[s+4+2]=h.red,this.data[s+4+3]=255}0!=e&&(this.pos+=4-e)}},i.prototype.bit8=function(){for(var t=this.width%4,e=this.height-1;e>=0;e--){for(var i=0;i<this.width;i++){var r=this.buffer.readUInt8(this.pos++),n=e*this.width*4+4*i;if(r<this.palette.length){var s=this.palette[r];this.data[n]=s.blue,this.data[n+1]=s.green,this.data[n+2]=s.red,this.data[n+3]=255}else this.data[n]=255,this.data[n+1]=255,this.data[n+2]=255,this.data[n+3]=255}0!=t&&(this.pos+=4-t)}},i.prototype.bit15=function(){for(var t=this.width%3,e=parseInt("11111",2),i=e,r=this.height-1;r>=0;r--){for(var n=0;n<this.width;n++){var s=this.buffer.readUInt16LE(this.pos);this.pos+=2;var o=(s&i)/i*255|0,a=(s>>5&i)/i*255|0,h=(s>>10&i)/i*255|0,f=s>>15?255:0,u=r*this.width*4+4*n;this.data[u]=h,this.data[u+1]=a,this.data[u+2]=o,this.data[u+3]=f}this.pos+=t}},i.prototype.bit16=function(){for(var t=this.width%3,e=parseInt("11111",2),i=e,r=parseInt("111111",2),n=r,s=this.height-1;s>=0;s--){for(var o=0;o<this.width;o++){var a=this.buffer.readUInt16LE(this.pos);this.pos+=2;var h=255,f=(a&i)/i*255|0,u=(a>>5&n)/n*255|0,p=(a>>11)/i*255|0,l=s*this.width*4+4*o;this.data[l]=p,this.data[l+1]=u,this.data[l+2]=f,this.data[l+3]=h}this.pos+=t}},i.prototype.bit24=function(){for(var t=this.height-1;t>=0;t--){for(var e=0;e<this.width;e++){var i=this.buffer.readUInt8(this.pos++),r=this.buffer.readUInt8(this.pos++),n=this.buffer.readUInt8(this.pos++),s=t*this.width*4+4*e;this.data[s]=n,this.data[s+1]=r,this.data[s+2]=i,this.data[s+3]=255}this.pos+=this.width%4}},i.prototype.bit32=function(){for(var t=this.height-1;t>=0;t--){for(var e=0;e<this.width;e++){var i=this.buffer.readUInt8(this.pos++),r=this.buffer.readUInt8(this.pos++),n=this.buffer.readUInt8(this.pos++),s=this.buffer.readUInt8(this.pos++),o=t*this.width*4+4*e;this.data[o]=n,this.data[o+1]=r,this.data[o+2]=i,this.data[o+3]=s}this.pos+=this.width%4}},i.prototype.getData=function(){return this.data},t.exports=function(t){var e=new i(t);return{data:e.getData(),width:e.width,height:e.height}}},function(t,e){"use strict";function i(t){this.buffer=t.data,this.width=t.width,this.height=t.height,this.extraBytes=this.width%4,this.rgbSize=this.height*(3*this.width+this.extraBytes),this.headerInfoSize=40,this.data=[],this.flag="BM",this.reserved=0,this.offset=54,this.fileSize=this.rgbSize+this.offset,this.planes=1,this.bitPP=24,this.compress=0,this.hr=0,this.vr=0,this.colors=0,this.importantColors=0}i.prototype.encode=function(){var t=new Buffer(this.offset+this.rgbSize);this.pos=0,t.write(this.flag,this.pos,2),this.pos+=2,t.writeUInt32LE(this.fileSize,this.pos),this.pos+=4,t.writeUInt32LE(this.reserved,this.pos),this.pos+=4,t.writeUInt32LE(this.offset,this.pos),this.pos+=4,t.writeUInt32LE(this.headerInfoSize,this.pos),this.pos+=4,t.writeUInt32LE(this.width,this.pos),this.pos+=4,t.writeUInt32LE(this.height,this.pos),this.pos+=4,t.writeUInt16LE(this.planes,this.pos),this.pos+=2,t.writeUInt16LE(this.bitPP,this.pos),this.pos+=2,t.writeUInt32LE(this.compress,this.pos),this.pos+=4,t.writeUInt32LE(this.rgbSize,this.pos),this.pos+=4,t.writeUInt32LE(this.hr,this.pos),this.pos+=4,t.writeUInt32LE(this.vr,this.pos),this.pos+=4,t.writeUInt32LE(this.colors,this.pos),this.pos+=4,t.writeUInt32LE(this.importantColors,this.pos),this.pos+=4;for(var e=0,i=3*this.width+this.extraBytes,r=this.height-1;r>=0;r--){for(var n=0;n<this.width;n++){var s=this.pos+r*i+3*n;t[s+2]=this.buffer[e++],t[s+1]=this.buffer[e++],t[s]=this.buffer[e++],e++}if(this.extraBytes>0){var o=this.pos+r*i+3*this.width;t.fill(0,o,o+this.extraBytes)}}return t},t.exports=function(t,e){"undefined"==typeof e&&(e=100);var r=new i(t),n=r.encode();return{data:n,width:t.width,height:t.height}}},function(t,e){"use strict";t.exports=function(t){return t&&t.length>1?255===t[0]&&216===t[1]&&255===t[2]?{ext:"jpg",mime:"image/jpeg"}:137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]?{ext:"png",mime:"image/png"}:71===t[0]&&73===t[1]&&70===t[2]?{ext:"gif",mime:"image/gif"}:87===t[8]&&69===t[9]&&66===t[10]&&80===t[11]?{ext:"webp",mime:"image/webp"}:(73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3])&&67===t[8]&&82===t[9]?{ext:"cr2",mime:"image/x-canon-cr2"}:73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3]?{ext:"tif",mime:"image/tiff"}:66===t[0]&&77===t[1]?{ext:"bmp",mime:"image/bmp"}:73===t[0]&&73===t[1]&&188===t[2]?{ext:"jxr",mime:"image/vnd.ms-photo"}:56===t[0]&&66===t[1]&&80===t[2]&&83===t[3]?{ext:"psd",mime:"image/vnd.adobe.photoshop"}:80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]&&109===t[30]&&105===t[31]&&109===t[32]&&101===t[33]&&116===t[34]&&121===t[35]&&112===t[36]&&101===t[37]&&97===t[38]&&112===t[39]&&112===t[40]&&108===t[41]&&105===t[42]&&99===t[43]&&97===t[44]&&116===t[45]&&105===t[46]&&111===t[47]&&110===t[48]&&47===t[49]&&101===t[50]&&112===t[51]&&117===t[52]&&98===t[53]&&43===t[54]&&122===t[55]&&105===t[56]&&112===t[57]?{ext:"epub",mime:"application/epub+zip"}:80===t[0]&&75===t[1]&&3===t[2]&&4===t[3]&&77===t[30]&&69===t[31]&&84===t[32]&&65===t[33]&&45===t[34]&&73===t[35]&&78===t[36]&&70===t[37]&&47===t[38]&&109===t[39]&&111===t[40]&&122===t[41]&&105===t[42]&&108===t[43]&&108===t[44]&&97===t[45]&&46===t[46]&&114===t[47]&&115===t[48]&&97===t[49]?{ext:"xpi",mime:"application/x-xpinstall"}:80!==t[0]||75!==t[1]||3!==t[2]&&5!==t[2]&&7!==t[2]||4!==t[3]&&6!==t[3]&&8!==t[3]?117===t[257]&&115===t[258]&&116===t[259]&&97===t[260]&&114===t[261]?{ext:"tar",mime:"application/x-tar"}:82!==t[0]||97!==t[1]||114!==t[2]||33!==t[3]||26!==t[4]||7!==t[5]||0!==t[6]&&1!==t[6]?31===t[0]&&139===t[1]&&8===t[2]?{ext:"gz",mime:"application/gzip"}:66===t[0]&&90===t[1]&&104===t[2]?{ext:"bz2",mime:"application/x-bzip2"}:55===t[0]&&122===t[1]&&188===t[2]&&175===t[3]&&39===t[4]&&28===t[5]?{ext:"7z",mime:"application/x-7z-compressed"}:120===t[0]&&1===t[1]?{ext:"dmg",mime:"application/x-apple-diskimage"}:0===t[0]&&0===t[1]&&0===t[2]&&(24===t[3]||32===t[3])&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]||51===t[0]&&103===t[1]&&112===t[2]&&53===t[3]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&109===t[8]&&112===t[9]&&52===t[10]&&50===t[11]&&109===t[16]&&112===t[17]&&52===t[18]&&49===t[19]&&109===t[20]&&112===t[21]&&52===t[22]&&50===t[23]&&105===t[24]&&115===t[25]&&111===t[26]&&109===t[27]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&105===t[8]&&115===t[9]&&111===t[10]&&109===t[11]||0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&109===t[8]&&112===t[9]&&52===t[10]&&50===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&0===t[15]?{ext:"mp4",mime:"video/mp4"}:0===t[0]&&0===t[1]&&0===t[2]&&28===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&77===t[8]&&52===t[9]&&86===t[10]?{ext:"m4v",mime:"video/x-m4v"}:77===t[0]&&84===t[1]&&104===t[2]&&100===t[3]?{ext:"mid",mime:"audio/midi"}:109===t[31]&&97===t[32]&&116===t[33]&&114===t[34]&&111===t[35]&&115===t[36]&&107===t[37]&&97===t[38]?{ext:"mkv",mime:"video/x-matroska"}:26===t[0]&&69===t[1]&&223===t[2]&&163===t[3]?{ext:"webm",mime:"video/webm"}:0===t[0]&&0===t[1]&&0===t[2]&&20===t[3]&&102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]?{ext:"mov",mime:"video/quicktime"}:82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&65===t[8]&&86===t[9]&&73===t[10]?{ext:"avi",mime:"video/x-msvideo"}:48===t[0]&&38===t[1]&&178===t[2]&&117===t[3]&&142===t[4]&&102===t[5]&&207===t[6]&&17===t[7]&&166===t[8]&&217===t[9]?{ext:"wmv",mime:"video/x-ms-wmv"}:0===t[0]&&0===t[1]&&1===t[2]&&"b"===t[3].toString(16)[0]?{ext:"mpg",mime:"video/mpeg"}:73===t[0]&&68===t[1]&&51===t[2]||255===t[0]&&251===t[1]?{ext:"mp3",mime:"audio/mpeg"}:102===t[4]&&116===t[5]&&121===t[6]&&112===t[7]&&77===t[8]&&52===t[9]&&65===t[10]||77===t[0]&&52===t[1]&&65===t[2]&&32===t[3]?{ext:"m4a",mime:"audio/m4a"}:79===t[28]&&112===t[29]&&117===t[30]&&115===t[31]&&72===t[32]&&101===t[33]&&97===t[34]&&100===t[35]?{ext:"opus",mime:"audio/opus"}:79===t[0]&&103===t[1]&&103===t[2]&&83===t[3]?{ext:"ogg",mime:"audio/ogg"}:102===t[0]&&76===t[1]&&97===t[2]&&67===t[3]?{ext:"flac",mime:"audio/x-flac"}:82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&87===t[8]&&65===t[9]&&86===t[10]&&69===t[11]?{ext:"wav",mime:"audio/x-wav"}:35===t[0]&&33===t[1]&&65===t[2]&&77===t[3]&&82===t[4]&&10===t[5]?{ext:"amr",mime:"audio/amr"}:37===t[0]&&80===t[1]&&68===t[2]&&70===t[3]?{ext:"pdf",mime:"application/pdf"}:77===t[0]&&90===t[1]?{ext:"exe",mime:"application/x-msdownload"}:67!==t[0]&&70!==t[0]||87!==t[1]||83!==t[2]?123===t[0]&&92===t[1]&&114===t[2]&&116===t[3]&&102===t[4]?{ext:"rtf",mime:"application/rtf"}:119===t[0]&&79===t[1]&&70===t[2]&&70===t[3]&&(0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]||79===t[4]&&84===t[5]&&84===t[6]&&79===t[7])?{ext:"woff",mime:"application/font-woff"}:119===t[0]&&79===t[1]&&70===t[2]&&50===t[3]&&(0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]||79===t[4]&&84===t[5]&&84===t[6]&&79===t[7])?{ext:"woff2",mime:"application/font-woff"}:76===t[34]&&80===t[35]&&(0===t[8]&&0===t[9]&&1===t[10]||1===t[8]&&0===t[9]&&2===t[10]||2===t[8]&&0===t[9]&&2===t[10])?{ext:"eot",mime:"application/octet-stream"}:0===t[0]&&1===t[1]&&0===t[2]&&0===t[3]&&0===t[4]?{ext:"ttf",mime:"application/font-sfnt"}:79===t[0]&&84===t[1]&&84===t[2]&&79===t[3]&&0===t[4]?{ext:"otf",mime:"application/font-sfnt"}:0===t[0]&&0===t[1]&&1===t[2]&&0===t[3]?{ext:"ico",mime:"image/x-icon"}:70===t[0]&&76===t[1]&&86===t[2]&&1===t[3]?{ext:"flv",mime:"video/x-flv"}:37===t[0]&&33===t[1]?{ext:"ps",mime:"application/postscript"}:253===t[0]&&55===t[1]&&122===t[2]&&88===t[3]&&90===t[4]&&0===t[5]?{ext:"xz",mime:"application/x-xz"}:83===t[0]&&81===t[1]&&76===t[2]&&105===t[3]?{ext:"sqlite",mime:"application/x-sqlite3"}:78===t[0]&&69===t[1]&&83===t[2]&&26===t[3]?{ext:"nes",mime:"application/x-nintendo-nes-rom"}:67===t[0]&&114===t[1]&&50===t[2]&&52===t[3]?{ext:"crx",mime:"application/x-google-chrome-extension"}:77===t[0]&&83===t[1]&&67===t[2]&&70===t[3]||73===t[0]&&83===t[1]&&99===t[2]&&40===t[3]?{ext:"cab",mime:"application/vnd.ms-cab-compressed"}:33===t[0]&&60===t[1]&&97===t[2]&&114===t[3]&&99===t[4]&&104===t[5]&&62===t[6]&&10===t[7]&&100===t[8]&&101===t[9]&&98===t[10]&&105===t[11]&&97===t[12]&&110===t[13]&&45===t[14]&&98===t[15]&&105===t[16]&&110===t[17]&&97===t[18]&&114===t[19]&&121===t[20]?{ext:"deb",mime:"application/x-deb"}:33===t[0]&&60===t[1]&&97===t[2]&&114===t[3]&&99===t[4]&&104===t[5]&&62===t[6]?{ext:"ar",mime:"application/x-unix-archive"}:237===t[0]&&171===t[1]&&238===t[2]&&219===t[3]?{ext:"rpm",mime:"application/x-rpm"}:31===t[0]&&160===t[1]||31===t[0]&&157===t[1]?{ext:"Z",mime:"application/x-compress"}:76===t[0]&&90===t[1]&&73===t[2]&&80===t[3]?{ext:"lz",mime:"application/x-lzip"}:208===t[0]&&207===t[1]&&17===t[2]&&224===t[3]&&161===t[4]&&177===t[5]&&26===t[6]&&225===t[7]?{ext:"msi",mime:"application/x-msi"}:null:{ext:"swf",mime:"application/x-shockwave-flash"}:{ext:"rar",mime:"application/x-rar-compressed"}:{ext:"zip",mime:"application/zip"}:null}},function(t,e,i){"use strict";var r=i(16);t.exports=function(t){var e=["jpg","png","gif","webp","tif","bmp","jxr","psd"],i=r(t);return e.indexOf(i&&i.ext)!==-1?i:null}},function(t,e,i){"use strict";function r(t){for(var e=[],i=0;i<=2*t;i++){e[i]=[];for(var r=0;r<=2*t;r++)e[i][r]=Math.pow(i-t,2)+Math.pow(r-t,2)}return e}function n(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<t[r].length;n++)i[r][n]=Math.exp(-t[r][n]/(2*Math.pow(e,2)))}return i}function s(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"gaussian",arguments.length>1&&void 0!==arguments[1]?arguments[1]:3),e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1.5;t=(t-1)/2;var i=r(t),s=n(i,e),o=a(s);return h(s,o)}var o=i(0),a=o.sum2d,h=o.divide2d;t.exports={fspecial:s}},function(t,e,i){"use strict";function r(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"symmetric",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"same",n=e.length,o=e[0].length;if(t=a(t,f([o/2,n/2]),i),0===s(o,2)&&t.pop(),0===s(n,2))for(var h=0;h<t.length;h++)t[h].pop();return"same"===r&&(r="valid"),p(e,t,r)}var n=i(6),s=n.mod,o=i(7),a=o.padarray,h=i(0),f=h.floor,u=i(4),p=u.filter2;t.exports={imfilter:r}},function(t,e,i){"use strict";function r(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return s(t,e,1)}var n=i(5),s=n.numbers;t.exports={ones:r}},function(t,e){"use strict";function i(t){var e=n(t,3),i=e[0],r=e[1],s=e[2];return Math.round(.29894*i+.58704*r+.11402*s)}function r(t){for(var e=[],r=0;r<t.length;r++){e[r]=[];for(var n=0;n<t[r].length;n++)e[r][n]=i(t[r][n])}return e}var n=function(){function t(t,e){var i=[],r=!0,n=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(i.push(o.value),!e||i.length!==e);r=!0);}catch(t){n=!0,s=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw s}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.exports={rgb2gray:r}},function(t,e){"use strict";function i(t,e,i){for(var n=r(e,3),s=n[0],o=n[1],a=n[2],h=r(i,3),f=h[0],u=h[1],p=h[2],l=[],c=0;c<(a-s)/o;c++){l[c]=[];for(var d=0;d<(p-f)/u;d++)l[c][d]=t[s+c*o][f+d*u]}return l}var r=function(){function t(t,e){var i=[],r=!0,n=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(i.push(o.value),!e||i.length!==e);r=!0);}catch(t){n=!0,s=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw s}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.exports={skip2d:i}},function(t,e){"use strict";function i(t,e,i,r,n){for(var s=[],o=0;o<i;o++){s[o]=[];for(var a=0;a<n;a++)s[o][a]=t[o+r][a+e]}return s}t.exports={sub:i}},function(e,i){e.exports=t},function(t,e){t.exports=require("fs")},function(t,e){t.exports=require("https")},function(t,e,i){"use strict";function r(t){if(Object.keys(t).forEach(function(t){if(!(t in w))throw new Error('"'+t+'" is not a valid option')}),"k1"in t&&("number"!=typeof t.k1||t.k1<0))throw new Error("Invalid k1 value. Default is "+w.k1);if("k2"in t&&("number"!=typeof t.k2||t.k2<0))throw new Error("Invalid k2 value. Default is "+w.k2)}function n(t){return r(t),Object.assign({},w,t)}function s(t){var e=f(t,2),i=e[0],r=e[1];if(i.length!==r.length||i[0].length!==r[0].length)throw new Error("Image dimensions do not match");return[i,r]}function o(t){var e=f(t,2),i=e[0],r=e[1];return i=c(i),r=c(r),[i,r]}function a(t,e){return"fast"===e.downsample?p(t,e.maxSize):p(t)}function h(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x("image1"),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:x("image2"),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(new Date).getTime();return i=n(i),Promise.all([a(t,i),a(e,i)]).then(s).then(o).then(function(t){var e=f(t,2),r=e[0],n=e[1];return g(r,n,i)}).then(function(t){return{ssim_map:t,mssim:m(t),performance:(new Date).getTime()-r}})}var f=function(){function t(t,e){var i=[],r=!0,n=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(i.push(o.value),!e||i.length!==e);r=!0);}catch(t){n=!0,s=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw s}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=i(8),p=u.readpixels,l=i(2),c=l.rgb2gray,d=i(0),m=d.mean2d,v=i(9),g=v.ssim,b=i(10),x=b.force,w=i(12),y=i(11),I=y.version;h.ssim=g,h.version=I,t.exports=h}])}); | ||
//# sourceMappingURL=ssim.js.map |
{ | ||
"name": "ssim.js", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "JS MSSIM computation", | ||
@@ -54,2 +54,3 @@ "main": "dist/ssim.js", | ||
"codeclimate-test-reporter": "0.4.0", | ||
"core-js": "2.4.1", | ||
"eslint": "3.7.1", | ||
@@ -56,0 +57,0 @@ "eslint-config-airbnb": "12.0.0", |
@@ -8,3 +8,3 @@ | Process | Status | | ||
| Dependencies | [](https://snyk.io/test/github/obartra/ssim) [](https://david-dm.org/obartra/ssim) | | ||
| Environments |     | | ||
| Environments |     | | ||
| Documentation | [](https://inch-ci.org/github/obartra/ssim) [](https://doclets.io/obartra/ssim/master) | | ||
@@ -67,2 +67,23 @@ | ||
### Node < 4.0.0 | ||
If you are running an old version of Node without [Promise support](http://node.green/#Promise) you will need to polyfill it. Integration tests use [babel](https://babeljs.io) + [core-js](https://github.com/zloirock/core-js) for that purpose. An example usage could be: | ||
```javascript | ||
require('core-js/es6/promise'); | ||
var ssim = require('ssim.js'); | ||
function successSSIM(out) { | ||
console.log('SSIM: ' + out.mssim + ' (generated in: ' + out.performance + 'ms)'); | ||
} | ||
function errorSSIM(msg) { | ||
console.error('Error generating SSIM' + err); | ||
} | ||
ssim('./img1.jpg', './img2.jpg') | ||
.then(successSSIM) | ||
.catch(errorSSIM); | ||
``` | ||
## SSIM | ||
@@ -69,0 +90,0 @@ |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
251887
139
23