1#!/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" 53 if [ ! -x "${bs_decoder}" ]; then 54 elog "${bs_decoder} does not exist or is not executable." 55 return 1 56 fi 57 58 eval "${AOM_TEST_PREFIX}" "${bs_decoder}" "${lf_file}" "${tl_file}" \ 59 "${num_references}" ${devnull} 60 61 [ -e "${tl_file}" ] || return 1 62 63 # Run lightfield tile list decoder 64 local tl_decoder="${LIBAOM_BIN_PATH}/lightfield_tile_list_decoder${AOM_TEST_EXE_SUFFIX}" 65 local tl_outfile="${AOM_TEST_OUTPUT_DIR}/vase_tile_list.yuv" 66 if [ ! -x "${tl_decoder}" ]; then 67 elog "${tl_decoder} does not exist or is not executable." 68 return 1 69 fi 70 71 eval "${AOM_TEST_PREFIX}" "${tl_decoder}" "${tl_file}" "${tl_outfile}" \ 72 "${num_references}" "${num_tile_lists}" ${devnull} 73 74 [ -e "${tl_outfile}" ] || return 1 75 76 # Run reference lightfield decoder 77 local ref_decoder="${LIBAOM_BIN_PATH}/lightfield_decoder${AOM_TEST_EXE_SUFFIX}" 78 local tl_reffile="${AOM_TEST_OUTPUT_DIR}/vase_reference.yuv" 79 if [ ! -x "${ref_decoder}" ]; then 80 elog "${ref_decoder} does not exist or is not executable." 81 return 1 82 fi 83 84 eval "${AOM_TEST_PREFIX}" "${ref_decoder}" "${lf_file}" "${tl_reffile}" \ 85 "${num_references}" ${devnull} 86 87 [ -e "${tl_reffile}" ] || return 1 88 89 # Check if tl_outfile and tl_reffile are identical. If not identical, this test fails. 90 diff ${tl_outfile} ${tl_reffile} > /dev/null 91 if [ $? -eq 1 ]; then 92 return 1 93 fi 94} 95 96lightfield_test_tests="lightfield_test" 97 98run_tests lightfield_test_verify_environment "${lightfield_test_tests}" 99