summaryrefslogtreecommitdiffstats
path: root/third_party/aom/tools/inspect-cli.js
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-10-15 21:45:30 -0500
committertrav90 <travawine@palemoon.org>2018-10-15 21:45:30 -0500
commit68569dee1416593955c1570d638b3d9250b33012 (patch)
treed960f017cd7eba3f125b7e8a813789ee2e076310 /third_party/aom/tools/inspect-cli.js
parent07c17b6b98ed32fcecff15c083ab0fd878de3cf0 (diff)
downloadUXP-68569dee1416593955c1570d638b3d9250b33012.tar
UXP-68569dee1416593955c1570d638b3d9250b33012.tar.gz
UXP-68569dee1416593955c1570d638b3d9250b33012.tar.lz
UXP-68569dee1416593955c1570d638b3d9250b33012.tar.xz
UXP-68569dee1416593955c1570d638b3d9250b33012.zip
Import aom library
This is the reference implementation for the Alliance for Open Media's av1 video code. The commit used was 4d668d7feb1f8abd809d1bca0418570a7f142a36.
Diffstat (limited to 'third_party/aom/tools/inspect-cli.js')
-rw-r--r--third_party/aom/tools/inspect-cli.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/third_party/aom/tools/inspect-cli.js b/third_party/aom/tools/inspect-cli.js
new file mode 100644
index 000000000..a14c08111
--- /dev/null
+++ b/third_party/aom/tools/inspect-cli.js
@@ -0,0 +1,39 @@
+/**
+ * This tool lets you test if the compiled Javascript decoder is functioning properly. You'll
+ * need to download a SpiderMonkey js-shell to run this script.
+ * https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/
+ *
+ * Example:
+ * js-shell inspect-cli.js video.ivf
+ */
+load("inspect.js");
+var buffer = read(scriptArgs[0], "binary");
+var Module = {
+ noExitRuntime: true,
+ noInitialRun: true,
+ preInit: [],
+ preRun: [],
+ postRun: [function () {
+ printErr(`Loaded Javascript Decoder OK`);
+ }],
+ memoryInitializerPrefixURL: "bin/",
+ arguments: ['input.ivf', 'output.raw'],
+ on_frame_decoded_json: function (jsonString) {
+ let json = JSON.parse("[" + Module.UTF8ToString(jsonString) + "null]");
+ json.forEach(frame => {
+ if (frame) {
+ print(frame.frame);
+ }
+ });
+ }
+};
+DecoderModule(Module);
+Module.FS.writeFile("/tmp/input.ivf", buffer, { encoding: "binary" });
+Module._open_file();
+Module._set_layers(0xFFFFFFFF); // Set this to zero if you want to benchmark decoding.
+while(true) {
+ printErr("Decoding Frame ...");
+ if (Module._read_frame()) {
+ break;
+ }
+}