summaryrefslogtreecommitdiffstats
path: root/media/libaom/src/test/lightfield_test.sh
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-07 23:30:51 -0400
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 13:26:42 +0200
commit277f2116b6660e9bbe7f5d67524be57eceb49b8b (patch)
tree4595f7cc71418f71b9a97dfaeb03a30aa60f336a /media/libaom/src/test/lightfield_test.sh
parentd270404436f6e84ffa3b92af537ac721bf10d66e (diff)
downloadUXP-277f2116b6660e9bbe7f5d67524be57eceb49b8b.tar
UXP-277f2116b6660e9bbe7f5d67524be57eceb49b8b.tar.gz
UXP-277f2116b6660e9bbe7f5d67524be57eceb49b8b.tar.lz
UXP-277f2116b6660e9bbe7f5d67524be57eceb49b8b.tar.xz
UXP-277f2116b6660e9bbe7f5d67524be57eceb49b8b.zip
Move aom source to a sub-directory under media/libaom
There is no damned reason to treat this differently than any other media lib given its license and there never was.
Diffstat (limited to 'media/libaom/src/test/lightfield_test.sh')
-rw-r--r--media/libaom/src/test/lightfield_test.sh98
1 files changed, 98 insertions, 0 deletions
diff --git a/media/libaom/src/test/lightfield_test.sh b/media/libaom/src/test/lightfield_test.sh
new file mode 100644
index 000000000..b957a6b79
--- /dev/null
+++ b/media/libaom/src/test/lightfield_test.sh
@@ -0,0 +1,98 @@
+#!/bin/sh
+## Copyright (c) 2018, Alliance for Open Media. All rights reserved
+##
+## This source code is subject to the terms of the BSD 2 Clause License and
+## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+## was not distributed with this source code in the LICENSE file, you can
+## obtain it at www.aomedia.org/license/software. If the Alliance for Open
+## Media Patent License 1.0 was not distributed with this source code in the
+## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+##
+## This file tests the lightfield example.
+##
+. $(dirname $0)/tools_common.sh
+
+# Environment check: $infile is required.
+lightfield_test_verify_environment() {
+ local infile="${LIBAOM_TEST_DATA_PATH}/vase10x10.yuv"
+ if [ ! -e "${infile}" ]; then
+ echo "Libaom test data must exist in LIBAOM_TEST_DATA_PATH."
+ return 1
+ fi
+}
+
+# Run the lightfield example
+lightfield_test() {
+ local img_width=1024
+ local img_height=1024
+ local lf_width=10
+ local lf_height=10
+ local lf_blocksize=5
+ local num_references=4
+ local num_tile_lists=2
+
+ # Encode the lightfield.
+ local encoder="${LIBAOM_BIN_PATH}/lightfield_encoder${AOM_TEST_EXE_SUFFIX}"
+ local yuv_file="${LIBAOM_TEST_DATA_PATH}/vase10x10.yuv"
+ local lf_file="${AOM_TEST_OUTPUT_DIR}/vase10x10.ivf"
+ if [ ! -x "${encoder}" ]; then
+ elog "${encoder} does not exist or is not executable."
+ return 1
+ fi
+
+ eval "${AOM_TEST_PREFIX}" "${encoder}" "${img_width}" "${img_height}" \
+ "${yuv_file}" "${lf_file}" "${lf_width}" \
+ "${lf_height}" "${lf_blocksize}" ${devnull}
+
+ [ -e "${lf_file}" ] || return 1
+
+ # Parse lightfield bitstream to construct and output a new bitstream that can
+ # be decoded by an AV1 decoder.
+ local bs_decoder="${LIBAOM_BIN_PATH}/lightfield_bitstream_parsing${AOM_TEST_EXE_SUFFIX}"
+ local tl_file="${AOM_TEST_OUTPUT_DIR}/vase_tile_list.ivf"
+ if [ ! -x "${bs_decoder}" ]; then
+ elog "${bs_decoder} does not exist or is not executable."
+ return 1
+ fi
+
+ eval "${AOM_TEST_PREFIX}" "${bs_decoder}" "${lf_file}" "${tl_file}" \
+ "${num_references}" ${devnull}
+
+ [ -e "${tl_file}" ] || return 1
+
+ # Run lightfield tile list decoder
+ local tl_decoder="${LIBAOM_BIN_PATH}/lightfield_tile_list_decoder${AOM_TEST_EXE_SUFFIX}"
+ local tl_outfile="${AOM_TEST_OUTPUT_DIR}/vase_tile_list.yuv"
+ if [ ! -x "${tl_decoder}" ]; then
+ elog "${tl_decoder} does not exist or is not executable."
+ return 1
+ fi
+
+ eval "${AOM_TEST_PREFIX}" "${tl_decoder}" "${tl_file}" "${tl_outfile}" \
+ "${num_references}" "${num_tile_lists}" ${devnull}
+
+ [ -e "${tl_outfile}" ] || return 1
+
+ # Run reference lightfield decoder
+ local ref_decoder="${LIBAOM_BIN_PATH}/lightfield_decoder${AOM_TEST_EXE_SUFFIX}"
+ local tl_reffile="${AOM_TEST_OUTPUT_DIR}/vase_reference.yuv"
+ if [ ! -x "${ref_decoder}" ]; then
+ elog "${ref_decoder} does not exist or is not executable."
+ return 1
+ fi
+
+ eval "${AOM_TEST_PREFIX}" "${ref_decoder}" "${lf_file}" "${tl_reffile}" \
+ "${num_references}" ${devnull}
+
+ [ -e "${tl_reffile}" ] || return 1
+
+ # Check if tl_outfile and tl_reffile are identical. If not identical, this test fails.
+ diff ${tl_outfile} ${tl_reffile} > /dev/null
+ if [ $? -eq 1 ]; then
+ return 1
+ fi
+}
+
+lightfield_test_tests="lightfield_test"
+
+run_tests lightfield_test_verify_environment "${lightfield_test_tests}"