blob: 19b6934a3bd80a66ce8fadf6defd1e267dde1474 [file] [log] [blame]
Yunqing Wangc067adc2018-06-29 15:17:56 -07001#!/bin/sh
2## Copyright (c) 2018, Alliance for Open Media. All rights reserved
3##
4## This source code is subject to the terms of the BSD 2 Clause License and
5## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6## was not distributed with this source code in the LICENSE file, you can
7## obtain it at www.aomedia.org/license/software. If the Alliance for Open
8## Media Patent License 1.0 was not distributed with this source code in the
9## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10##
11## This file tests the lightfield example.
12##
13. $(dirname $0)/tools_common.sh
14
15# Environment check: $infile is required.
16lightfield_test_verify_environment() {
17 local infile="${LIBAOM_TEST_DATA_PATH}/vase10x10.yuv"
18 if [ ! -e "${infile}" ]; then
19 echo "Libaom test data must exist in LIBAOM_TEST_DATA_PATH."
20 return 1
21 fi
22}
23
24# Run the lightfield example
25lightfield_test() {
26 local img_width=1024
27 local img_height=1024
28 local lf_width=10
29 local lf_height=10
30 local lf_blocksize=5
31 local num_references=4
32 local num_tile_lists=2
33
34 # Encode the lightfield.
35 local encoder="${LIBAOM_BIN_PATH}/lightfield_encoder${AOM_TEST_EXE_SUFFIX}"
36 local yuv_file="${LIBAOM_TEST_DATA_PATH}/vase10x10.yuv"
37 local lf_file="${AOM_TEST_OUTPUT_DIR}/vase10x10.ivf"
38 if [ ! -x "${encoder}" ]; then
39 elog "${encoder} does not exist or is not executable."
40 return 1
41 fi
42
43 eval "${AOM_TEST_PREFIX}" "${encoder}" "${img_width}" "${img_height}" \
44 "${yuv_file}" "${lf_file}" "${lf_width}" \
45 "${lf_height}" "${lf_blocksize}" ${devnull}
46
47 [ -e "${lf_file}" ] || return 1
48
49 # Parse lightfield bitstream to construct and output a new bitstream that can
50 # be decoded by an AV1 decoder.
51 local bs_decoder="${LIBAOM_BIN_PATH}/lightfield_bitstream_parsing${AOM_TEST_EXE_SUFFIX}"
52 local tl_file="${AOM_TEST_OUTPUT_DIR}/vase_tile_list.ivf"
Ryan Overbeck18521392018-09-21 09:43:24 -070053 local tl_text_file="${LIBAOM_TEST_DATA_PATH}/vase10x10_tiles.txt"
Yunqing Wangc067adc2018-06-29 15:17:56 -070054 if [ ! -x "${bs_decoder}" ]; then
55 elog "${bs_decoder} does not exist or is not executable."
56 return 1
57 fi
58
59 eval "${AOM_TEST_PREFIX}" "${bs_decoder}" "${lf_file}" "${tl_file}" \
Ryan Overbeck18521392018-09-21 09:43:24 -070060 "${num_references}" "${tl_text_file}" ${devnull}
Yunqing Wangc067adc2018-06-29 15:17:56 -070061
62 [ -e "${tl_file}" ] || return 1
63
64 # Run lightfield tile list decoder
65 local tl_decoder="${LIBAOM_BIN_PATH}/lightfield_tile_list_decoder${AOM_TEST_EXE_SUFFIX}"
66 local tl_outfile="${AOM_TEST_OUTPUT_DIR}/vase_tile_list.yuv"
67 if [ ! -x "${tl_decoder}" ]; then
68 elog "${tl_decoder} does not exist or is not executable."
69 return 1
70 fi
71
72 eval "${AOM_TEST_PREFIX}" "${tl_decoder}" "${tl_file}" "${tl_outfile}" \
73 "${num_references}" "${num_tile_lists}" ${devnull}
74
75 [ -e "${tl_outfile}" ] || return 1
76
77 # Run reference lightfield decoder
78 local ref_decoder="${LIBAOM_BIN_PATH}/lightfield_decoder${AOM_TEST_EXE_SUFFIX}"
79 local tl_reffile="${AOM_TEST_OUTPUT_DIR}/vase_reference.yuv"
80 if [ ! -x "${ref_decoder}" ]; then
81 elog "${ref_decoder} does not exist or is not executable."
82 return 1
83 fi
84
85 eval "${AOM_TEST_PREFIX}" "${ref_decoder}" "${lf_file}" "${tl_reffile}" \
Ryan Overbeck18521392018-09-21 09:43:24 -070086 "${num_references}" "${tl_text_file}" ${devnull}
Yunqing Wangc067adc2018-06-29 15:17:56 -070087
88 [ -e "${tl_reffile}" ] || return 1
89
90 # Check if tl_outfile and tl_reffile are identical. If not identical, this test fails.
91 diff ${tl_outfile} ${tl_reffile} > /dev/null
92 if [ $? -eq 1 ]; then
93 return 1
94 fi
95}
96
97lightfield_test_tests="lightfield_test"
98
99run_tests lightfield_test_verify_environment "${lightfield_test_tests}"