Tom Finegan | 0c358d6 | 2014-04-24 13:31:43 -0700 | [diff] [blame] | 1 | #!/bin/sh |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 2 | ## Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Tom Finegan | 0c358d6 | 2014-04-24 13:31:43 -0700 | [diff] [blame] | 3 | ## |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 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. |
Tom Finegan | 0c358d6 | 2014-04-24 13:31:43 -0700 | [diff] [blame] | 10 | ## |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 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). |
Tom Finegan | 0c358d6 | 2014-04-24 13:31:43 -0700 | [diff] [blame] | 15 | ## |
| 16 | . $(dirname $0)/tools_common.sh |
| 17 | |
| 18 | # Environment check: Make sure input is available: |
Tom Finegan | 0c358d6 | 2014-04-24 13:31:43 -0700 | [diff] [blame] | 19 | simple_decoder_verify_environment() { |
Jim Bankoski | e78a964 | 2016-05-25 07:02:19 -0700 | [diff] [blame] | 20 | if [ ! "$(av1_encode_available)" = "yes" ] && [ ! -e "${AV1_IVF_FILE}" ]; then |
Tom Finegan | 0c358d6 | 2014-04-24 13:31:43 -0700 | [diff] [blame] | 21 | return 1 |
| 22 | fi |
| 23 | } |
| 24 | |
| 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() { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 28 | local decoder="${LIBAOM_BIN_PATH}/simple_decoder${AOM_TEST_EXE_SUFFIX}" |
Tom Finegan | 0c358d6 | 2014-04-24 13:31:43 -0700 | [diff] [blame] | 29 | local input_file="$1" |
| 30 | local codec="$2" |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 31 | local output_file="${AOM_TEST_OUTPUT_DIR}/simple_decoder_${codec}.raw" |
Tom Finegan | 0c358d6 | 2014-04-24 13:31:43 -0700 | [diff] [blame] | 32 | |
Tom Finegan | 12672c2 | 2014-06-16 10:57:00 -0700 | [diff] [blame] | 33 | if [ ! -x "${decoder}" ]; then |
| 34 | elog "${decoder} does not exist or is not executable." |
| 35 | return 1 |
| 36 | fi |
Tom Finegan | 0c358d6 | 2014-04-24 13:31:43 -0700 | [diff] [blame] | 37 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 38 | eval "${AOM_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \ |
Tom Finegan | 926a6f6 | 2014-07-10 15:17:05 -0700 | [diff] [blame] | 39 | ${devnull} |
Tom Finegan | 0c358d6 | 2014-04-24 13:31:43 -0700 | [diff] [blame] | 40 | |
| 41 | [ -e "${output_file}" ] || return 1 |
| 42 | } |
| 43 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 44 | simple_decoder_av1() { |
| 45 | if [ "$(av1_decode_available)" = "yes" ]; then |
Jim Bankoski | e78a964 | 2016-05-25 07:02:19 -0700 | [diff] [blame] | 46 | if [ ! -e "${AV1_IVF_FILE}" ]; then |
| 47 | local file="${AOM_TEST_OUTPUT_DIR}/test_encode.ivf" |
Jim Bankoski | f7f0437 | 2016-05-27 14:31:29 -0700 | [diff] [blame] | 48 | encode_yuv_raw_input_av1 "${file}" --ivf |
Jim Bankoski | e78a964 | 2016-05-25 07:02:19 -0700 | [diff] [blame] | 49 | simple_decoder "${file}" av1 || return 1 |
| 50 | else |
| 51 | simple_decoder "${AV1_IVF_FILE}" av1 || return 1 |
| 52 | fi |
Tom Finegan | 0c358d6 | 2014-04-24 13:31:43 -0700 | [diff] [blame] | 53 | fi |
| 54 | } |
| 55 | |
Jim Bankoski | e78a964 | 2016-05-25 07:02:19 -0700 | [diff] [blame] | 56 | simple_decoder_tests="simple_decoder_av1" |
Tom Finegan | 0c358d6 | 2014-04-24 13:31:43 -0700 | [diff] [blame] | 57 | |
| 58 | run_tests simple_decoder_verify_environment "${simple_decoder_tests}" |