Tom Finegan | 5086934 | 2014-04-28 16:48:46 -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 | 5086934 | 2014-04-28 16:48:46 -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 | 5086934 | 2014-04-28 16:48:46 -0700 | [diff] [blame] | 10 | ## |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 11 | ## This file tests the libaom decode_with_drops example. 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 decode_with_drops_tests (on a new line). |
Tom Finegan | 5086934 | 2014-04-28 16:48:46 -0700 | [diff] [blame] | 15 | ## |
| 16 | . $(dirname $0)/tools_common.sh |
| 17 | |
| 18 | # Environment check: Make sure input is available: |
Tom Finegan | 8ab4414 | 2018-04-27 14:57:52 -0700 | [diff] [blame] | 19 | # $AV1_IVF_FILE is required. |
Tom Finegan | 5086934 | 2014-04-28 16:48:46 -0700 | [diff] [blame] | 20 | decode_with_drops_verify_environment() { |
Jim Bankoski | ddb90bb | 2016-06-14 06:58:30 -0700 | [diff] [blame] | 21 | if [ "$(av1_encode_available)" != "yes" ] && [ ! -e "${AV1_IVF_FILE}" ]; then |
Tom Finegan | 5086934 | 2014-04-28 16:48:46 -0700 | [diff] [blame] | 22 | return 1 |
| 23 | fi |
| 24 | } |
| 25 | |
| 26 | # Runs decode_with_drops on $1, $2 is interpreted as codec name and used solely |
| 27 | # to name the output file. $3 is the drop mode, and is passed directly to |
| 28 | # decode_with_drops. |
| 29 | decode_with_drops() { |
Tom Finegan | 8ab4414 | 2018-04-27 14:57:52 -0700 | [diff] [blame] | 30 | local decoder="$(aom_tool_path decode_with_drops)" |
Tom Finegan | 5086934 | 2014-04-28 16:48:46 -0700 | [diff] [blame] | 31 | local input_file="$1" |
| 32 | local codec="$2" |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 33 | local output_file="${AOM_TEST_OUTPUT_DIR}/decode_with_drops_${codec}" |
Tom Finegan | 5086934 | 2014-04-28 16:48:46 -0700 | [diff] [blame] | 34 | local drop_mode="$3" |
| 35 | |
Tom Finegan | 12672c2 | 2014-06-16 10:57:00 -0700 | [diff] [blame] | 36 | if [ ! -x "${decoder}" ]; then |
| 37 | elog "${decoder} does not exist or is not executable." |
| 38 | return 1 |
| 39 | fi |
Tom Finegan | 5086934 | 2014-04-28 16:48:46 -0700 | [diff] [blame] | 40 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 41 | eval "${AOM_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \ |
Tom Finegan | 926a6f6 | 2014-07-10 15:17:05 -0700 | [diff] [blame] | 42 | "${drop_mode}" ${devnull} |
Tom Finegan | 5086934 | 2014-04-28 16:48:46 -0700 | [diff] [blame] | 43 | |
| 44 | [ -e "${output_file}" ] || return 1 |
| 45 | } |
| 46 | |
Tom Finegan | 5086934 | 2014-04-28 16:48:46 -0700 | [diff] [blame] | 47 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 48 | # Decodes $AV1_IVF_FILE while dropping frames, twice: once in sequence mode, |
Tom Finegan | 5086934 | 2014-04-28 16:48:46 -0700 | [diff] [blame] | 49 | # and once in pattern mode. |
Tom Finegan | 8ab4414 | 2018-04-27 14:57:52 -0700 | [diff] [blame] | 50 | DISABLED_decode_with_drops_av1() { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 51 | if [ "$(av1_decode_available)" = "yes" ]; then |
Jim Bankoski | ddb90bb | 2016-06-14 06:58:30 -0700 | [diff] [blame] | 52 | local file="${AV1_IVF_FILE}" |
| 53 | if [ ! -e "${AV1_IVF_FILE}" ]; then |
| 54 | file="${AOM_TEST_OUTPUT_DIR}/test_encode.ivf" |
| 55 | encode_yuv_raw_input_av1 "${file}" --ivf |
| 56 | fi |
Frank Bossen | f9db0e0 | 2018-03-21 16:27:13 -0400 | [diff] [blame] | 57 | # Drop frames 3 and 4. |
| 58 | decode_with_drops "${file}" "av1" "3-4" |
Tom Finegan | 5086934 | 2014-04-28 16:48:46 -0700 | [diff] [blame] | 59 | |
| 60 | # Test pattern mode: Drop 3 of every 4 frames. |
Jim Bankoski | ddb90bb | 2016-06-14 06:58:30 -0700 | [diff] [blame] | 61 | decode_with_drops "${file}" "av1" "3/4" |
Tom Finegan | 5086934 | 2014-04-28 16:48:46 -0700 | [diff] [blame] | 62 | fi |
| 63 | } |
| 64 | |
Yaowu Xu | c407123 | 2018-03-30 12:53:22 -0700 | [diff] [blame] | 65 | # TODO(yaowu): Disable this test as trailing_bit check is expected to fail |
Tom Finegan | 8ab4414 | 2018-04-27 14:57:52 -0700 | [diff] [blame] | 66 | decode_with_drops_tests="DISABLED_decode_with_drops_av1" |
| 67 | |
| 68 | run_tests decode_with_drops_verify_environment "${decode_with_drops_tests}" |