
var OGVDecoderVideoVP8W = (function() {
  var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
  if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
  return (
function(OGVDecoderVideoVP8W) {
  OGVDecoderVideoVP8W = OGVDecoderVideoVP8W || {};


var a;a||(a=typeof OGVDecoderVideoVP8W !== 'undefined' ? OGVDecoderVideoVP8W : {});var aa,n;a.ready=new Promise(function(b,c){aa=b;n=c});var ba=a,p={},r;for(r in a)a.hasOwnProperty(r)&&(p[r]=a[r]);var ca="object"===typeof window,w="function"===typeof importScripts,x="",da,A,B,C,D;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)x=w?require("path").dirname(x)+"/":__dirname+"/",da=function(b,c){C||(C=require("fs"));D||(D=require("path"));b=D.normalize(b);return C.readFileSync(b,c?null:"utf8")},B=function(b){b=da(b,!0);b.buffer||(b=new Uint8Array(b));b.buffer||E("Assertion failed: undefined");return b},A=function(b,c,e){C||(C=require("fs"));D||(D=require("path"));b=D.normalize(b);C.readFile(b,function(d,f){d?e(d):c(f.buffer)})},
1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("unhandledRejection",E),a.inspect=function(){return"[Emscripten Module object]"};else if(ca||w)w?x=self.location.href:"undefined"!==typeof document&&document.currentScript&&(x=document.currentScript.src),_scriptDir&&(x=_scriptDir),0!==x.indexOf("blob:")?x=x.substr(0,x.lastIndexOf("/")+1):x="",da=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},w&&(B=function(b){var c=
new XMLHttpRequest;c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),A=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var F=a.printErr||console.warn.bind(console);for(r in p)p.hasOwnProperty(r)&&(a[r]=p[r]);p=null;var ja=0,G;a.wasmBinary&&(G=a.wasmBinary);
var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&E("no native wasm support detected");var H,ka=!1,la,ma;function na(){var b=H.buffer;la=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=ma=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var I,oa=[],pa=[],qa=[];function ra(){var b=a.preRun.shift();oa.unshift(b)}var J=0,sa=null,K=null;
a.preloadedImages={};a.preloadedAudios={};function E(b){if(a.onAbort)a.onAbort(b);F(b);ka=!0;b=new WebAssembly.RuntimeError("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");n(b);throw b;}function ta(){return L.startsWith("data:application/octet-stream;base64,")}var L;L="ogv-decoder-video-vp8-wasm.wasm";if(!ta()){var ua=L;L=a.locateFile?a.locateFile(ua,x):x+ua}
function va(){var b=L;try{if(b==L&&G)return new Uint8Array(G);if(B)return B(b);throw"both async and sync fetching of the wasm failed";}catch(c){E(c)}}
function wa(){if(!G&&(ca||w)){if("function"===typeof fetch&&!L.startsWith("file://"))return fetch(L,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+L+"'";return b.arrayBuffer()}).catch(function(){return va()});if(A)return new Promise(function(b,c){A(L,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return va()})}
function xa(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.C;"number"===typeof e?void 0===c.A?I.get(e)():I.get(e)(c.A):e(void 0===c.A?null:c.A)}}}
var Pa={g:function(){throw"longjmp";},e:function(b,c,e){ma.copyWithin(b,c,c+e)},f:function(b){var c=ma.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{H.grow(Math.min(2147483648,d)-la.byteLength+65535>>>16);na();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},a:function(){return ja},d:Ja,i:Ka,j:La,h:Ma,c:Na,k:function(b,c,e,d,f,g,l,m,S,t,M,N,T,U,ea,fa){function ha(y,q,u,ia,ya,za,
Ra,Sa,V){if(Oa){var h=new Float64Array(y.buffer);q=new Float64Array(Aa,q,u*ia>>3);h.set(q)}else y.set(new Uint8Array(Aa,q,u*ia));var v;for(q=v=0;q<za;q++,v+=u)for(h=0;h<u;h++)y[v+h]=V;for(;q<za+Sa;q++,v+=u){for(h=0;h<ya;h++)y[v+h]=V;for(h=ya+Ra;h<u;h++)y[v+h]=V}for(;q<ia;q++,v+=u)for(h=0;h<u;h++)y[v+h]=V;return y}var Aa=H.buffer,k=a.videoFormat,Ba=(T&-2)*S/l,Ca=(U&-2)*t/m,Da=M*S/l,Ea=N*t/m;M===k.cropWidth&&N===k.cropHeight&&(ea=k.displayWidth,fa=k.displayHeight);for(var Fa=a.recycledFrames,z,Ga=m*
c,Ha=t*d,Ia=t*g;0<Fa.length;){var O=Fa.shift();k=O.format;if(k.width===l&&k.height===m&&k.chromaWidth===S&&k.chromaHeight===t&&k.cropLeft===T&&k.cropTop===U&&k.cropWidth===M&&k.cropHeight===N&&k.displayWidth===ea&&k.displayHeight===fa&&O.y.bytes.length===Ga&&O.u.bytes.length===Ha&&O.v.bytes.length===Ia){z=O;break}}z||(z={format:{width:l,height:m,chromaWidth:S,chromaHeight:t,cropLeft:T,cropTop:U,cropWidth:M,cropHeight:N,displayWidth:ea,displayHeight:fa},y:{bytes:new Uint8Array(Ga),stride:c},u:{bytes:new Uint8Array(Ha),
stride:d},v:{bytes:new Uint8Array(Ia),stride:g}});ha(z.y.bytes,b,c,m,T,U,M,N,0);ha(z.u.bytes,e,d,t,Ba,Ca,Da,Ea,128);ha(z.v.bytes,f,g,t,Ba,Ca,Da,Ea,128);a.frameBuffer=z},b:function(b){ja=b}};
(function(){function b(f){a.asm=f.exports;H=a.asm.l;na();I=a.asm.s;pa.unshift(a.asm.m);J--;a.monitorRunDependencies&&a.monitorRunDependencies(J);0==J&&(null!==sa&&(clearInterval(sa),sa=null),K&&(f=K,K=null,f()))}function c(f){b(f.instance)}function e(f){return wa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){F("failed to asynchronously prepare wasm: "+g);E(g)})}var d={a:Pa};J++;a.monitorRunDependencies&&a.monitorRunDependencies(J);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return F("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return G||"function"!==typeof WebAssembly.instantiateStreaming||ta()||L.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(L,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){F("wasm streaming compile failed: "+g);F("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(n);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.m).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.n).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.o).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.p).apply(null,arguments)};
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.q).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.r).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.t).apply(null,arguments)};a._free=function(){return(a._free=a.asm.u).apply(null,arguments)};
var P=a.stackSave=function(){return(P=a.stackSave=a.asm.v).apply(null,arguments)},Q=a.stackRestore=function(){return(Q=a.stackRestore=a.asm.w).apply(null,arguments)},R=a._setThrew=function(){return(R=a._setThrew=a.asm.x).apply(null,arguments)},Qa=a.dynCall_iiiij=function(){return(Qa=a.dynCall_iiiij=a.asm.y).apply(null,arguments)};function Na(b,c,e,d,f){var g=P();try{I.get(b)(c,e,d,f)}catch(l){Q(g);if(l!==l+0&&"longjmp"!==l)throw l;R(1,0)}}
function Ja(b,c,e){var d=P();try{return I.get(b)(c,e)}catch(f){Q(d);if(f!==f+0&&"longjmp"!==f)throw f;R(1,0)}}function Ka(b,c,e,d){var f=P();try{return I.get(b)(c,e,d)}catch(g){Q(f);if(g!==g+0&&"longjmp"!==g)throw g;R(1,0)}}function Ma(b,c){var e=P();try{I.get(b)(c)}catch(d){Q(e);if(d!==d+0&&"longjmp"!==d)throw d;R(1,0)}}function La(b,c,e,d,f,g){var l=P();try{return Qa(b,c,e,d,f,g)}catch(m){Q(l);if(m!==m+0&&"longjmp"!==m)throw m;R(1,0)}}var W;K=function Ta(){W||Ua();W||(K=Ta)};
function Ua(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ka)){xa(pa);aa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();qa.unshift(c)}xa(qa)}}if(!(0<J)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)ra();xa(oa);0<J||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Ua;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Ua();var X,Va,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!ba.videoFormat;a.videoFormat=ba.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&Va>=d||(X&&a._free(X),Va=d,X=a._malloc(Va));var f=X;(new Uint8Array(H.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.B=[];
a.processFrame=function(b,c){function e(m){a._free(g);c(m)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.B.push(e);var l=Z(function(){(new Uint8Array(H.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(l)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.B.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};var Oa="object"===typeof navigator&&navigator.userAgent.match(/Trident/);


  return OGVDecoderVideoVP8W.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
  module.exports = OGVDecoderVideoVP8W;
else if (typeof define === 'function' && define['amd'])
  define([], function() { return OGVDecoderVideoVP8W; });
else if (typeof exports === 'object')
  exports["OGVDecoderVideoVP8W"] = OGVDecoderVideoVP8W;
