Backed out 3 changesets (bug 1790375) for causing wd failures on fetch_error.py....
[gecko.git] / third_party / aom / test / simple_decoder.sh
blob5f39ad206ed7c6ef8fc2f1c1d4f4761c4150fc5e
1 #!/bin/sh
2 ## Copyright (c) 2016, 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.
11 ## This file tests the libaom simple_decoder example code. To add new tests to
12 ## this file, do the following:
13 ## 1. Write a shell function (this is your test).
14 ## 2. Add the function to simple_decoder_tests (on a new line).
16 . $(dirname $0)/tools_common.sh
18 # Environment check: Make sure input is available:
19 simple_decoder_verify_environment() {
20 if [ ! "$(av1_encode_available)" = "yes" ] && [ ! -e "${AV1_IVF_FILE}" ]; then
21 return 1
25 # Runs simple_decoder using $1 as input file. $2 is the codec name, and is used
26 # solely to name the output file.
27 simple_decoder() {
28 local decoder="$(aom_tool_path simple_decoder)"
29 local input_file="$1"
30 local codec="$2"
31 local output_file="${AOM_TEST_OUTPUT_DIR}/simple_decoder_${codec}.raw"
33 if [ ! -x "${decoder}" ]; then
34 elog "${decoder} does not exist or is not executable."
35 return 1
38 eval "${AOM_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \
39 ${devnull}
41 [ -e "${output_file}" ] || return 1
44 simple_decoder_av1() {
45 if [ "$(av1_decode_available)" = "yes" ]; then
46 if [ ! -e "${AV1_IVF_FILE}" ]; then
47 local file="${AOM_TEST_OUTPUT_DIR}/test_encode.ivf"
48 encode_yuv_raw_input_av1 "${file}" --ivf
49 simple_decoder "${file}" av1 || return 1
50 else
51 simple_decoder "${AV1_IVF_FILE}" av1 || return 1
56 simple_decoder_tests="simple_decoder_av1"
58 run_tests simple_decoder_verify_environment "${simple_decoder_tests}"