Commit f4f27feb authored by Michael Bebenita's avatar Michael Bebenita

Add inspect CLI tool and Emscripten build tools.

Change-Id: Id9159456084582b393c66c1b2c0bbb0a783350b0
parent 6d2f3c2a
......@@ -229,6 +229,14 @@ add_executable(simple_decoder
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
if (CONFIG_INSPECTION)
add_executable(inspect
"${AOM_ROOT}/examples/inspect.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
set(AOM_APP_TARGETS ${AOM_APP_TARGETS} inspect)
endif ()
add_executable(simple_encoder
"${AOM_ROOT}/examples/simple_encoder.c"
$<TARGET_OBJECTS:aom_common_app_util>
......
......@@ -456,7 +456,7 @@ NM=${NM}
CFLAGS = ${CFLAGS}
CXXFLAGS = ${CXXFLAGS}
ARFLAGS = -crs\$(if \$(quiet),,v)
ARFLAGS = crs\$(if \$(quiet),,v)
LDFLAGS = ${LDFLAGS}
ASFLAGS = ${ASFLAGS}
extralibs = ${extralibs}
......
......@@ -111,6 +111,20 @@ endif
aomenc.GUID = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1
aomenc.DESCRIPTION = Full featured encoder
ifeq ($(CONFIG_INSPECTION),yes)
EXAMPLES-$(CONFIG_DECODERS) += inspect.c
inspect.GUID = FA46A420-3356-441F-B0FD-60AA1345C181
inspect.SRCS += ivfdec.h ivfdec.c
inspect.SRCS += args.c args.h
inspect.SRCS += tools_common.h tools_common.c
inspect.SRCS += video_common.h
inspect.SRCS += video_reader.h video_reader.c
inspect.SRCS += aom_ports/mem_ops.h
inspect.SRCS += aom_ports/mem_ops_aligned.h
inspect.SRCS += aom_ports/msvc.h
inspect.DESCRIPTION = Dump inspection data
endif
EXAMPLES-$(CONFIG_DECODERS) += simple_decoder.c
simple_decoder.GUID = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
simple_decoder.SRCS += ivfdec.h ivfdec.c
......
This diff is collapsed.
if ! [ -x "$(command -v emcc)" ] || ! [ -x "$(command -v emconfigure)" ] || ! [ -x "$(command -v emmake)" ]; then
echo 'Emscripten SDK is not available (emcc, emconfigure or emmake is missing). Install it from https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html and try again.' >&2
exit 1
fi
echo 'Building JS Inspector'
if [ ! -d ".inspect" ]; then
mkdir .inspect
cd .inspect && emconfigure ../../configure --disable-multithread --disable-runtime-cpu-detect --target=generic-gnu --enable-accounting --enable-inspection --enable-aom_highbitdepth --extra-cflags="-D_POSIX_SOURCE"
fi
cd .inspect
emmake make -j 8
cp examples/inspect inspect.bc
emcc -O3 inspect.bc -o inspect.js -s TOTAL_MEMORY=134217728 -s MODULARIZE=1 -s EXPORT_NAME="'DecoderModule'" --post-js "../inspect-post.js" --memory-init-file 0
cp inspect.js ../inspect.js
/**
* 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;
}
}
Module["FS"] = FS;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment