2 * This tool lets you test if the compiled Javascript decoder is functioning properly. You'll
3 * need to download a SpiderMonkey js-shell to run this script.
4 * https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/
7 * js-shell inspect-cli.js video.ivf
10 var buffer = read(scriptArgs[0], "binary");
16 postRun: [function () {
17 printErr(`Loaded Javascript Decoder OK`);
19 memoryInitializerPrefixURL: "bin/",
20 arguments: ['input.ivf', 'output.raw'],
21 on_frame_decoded_json: function (jsonString) {
22 let json = JSON.parse("[" + Module.UTF8ToString(jsonString) + "null]");
23 json.forEach(frame => {
30 DecoderModule(Module);
31 Module.FS.writeFile("/tmp/input.ivf", buffer, { encoding: "binary" });
33 Module._set_layers(0xFFFFFFFF); // Set this to zero if you want to benchmark decoding.
35 printErr("Decoding Frame ...");
36 if (Module._read_frame()) {