Tom Finegan | cd41a51 | 2018-02-16 15:58:48 -0800 | [diff] [blame] | 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 libaom dump_obu tool. To add new tests to this |
| 12 | ## file, do the following: |
| 13 | ## 1. Write a shell function (this is your test). |
| 14 | ## 2. Add the function to dump_obu_tests (on a new line). |
| 15 | ## |
| 16 | . $(dirname $0)/tools_common.sh |
| 17 | |
| 18 | readonly dump_obu_test_file="${AOM_TEST_OUTPUT_DIR}/av1_obu_test.ivf" |
| 19 | |
| 20 | dump_obu_verify_environment() { |
| 21 | if [ ! -e "${YUV_RAW_INPUT}" ]; then |
| 22 | elog "The file ${YUV_RAW_INPUT##*/} must exist in LIBAOM_TEST_DATA_PATH." |
| 23 | return 1 |
| 24 | fi |
| 25 | if [ "$(dump_obu_available)" = "yes" ]; then |
| 26 | if [ -z "$(aom_tool_path dump_obu)" ]; then |
| 27 | elog "dump_obu not found in LIBAOM_BIN_PATH, its parent, or child tools/." |
| 28 | fi |
| 29 | fi |
| 30 | } |
| 31 | |
| 32 | dump_obu_available() { |
| 33 | if [ "$(av1_decode_available)" = "yes" ] && \ |
| 34 | [ "$(av1_encode_available)" = "yes" ]; then |
| 35 | echo yes |
| 36 | fi |
| 37 | } |
| 38 | |
| 39 | aomenc_available() { |
| 40 | if [ -x "$(aom_tool_path aomenc)" ]; then |
| 41 | echo yes |
| 42 | fi |
| 43 | } |
| 44 | |
| 45 | encode_test_file() { |
| 46 | if [ "$(aomenc_available)" = "yes" ]; then |
| 47 | local readonly encoder="$(aom_tool_path aomenc)" |
| 48 | |
| 49 | eval "${encoder}" \ |
| 50 | $(aomenc_encode_test_fast_params) \ |
| 51 | $(yuv_raw_input) \ |
| 52 | --ivf \ |
| 53 | --output=${dump_obu_test_file} \ |
| 54 | ${devnull} |
| 55 | |
| 56 | if [ ! -e "${dump_obu_test_file}" ]; then |
| 57 | elog "dump_obu test input encode failed." |
| 58 | return 1 |
| 59 | fi |
| 60 | fi |
| 61 | } |
| 62 | |
Tom Finegan | 04450b1 | 2018-03-19 18:12:28 -0700 | [diff] [blame] | 63 | dump_obu() { |
Tom Finegan | cd41a51 | 2018-02-16 15:58:48 -0800 | [diff] [blame] | 64 | encode_test_file |
| 65 | eval $(aom_tool_path dump_obu) "${dump_obu_test_file}" ${devnull} |
| 66 | } |
| 67 | |
Tom Finegan | 04450b1 | 2018-03-19 18:12:28 -0700 | [diff] [blame] | 68 | dump_obu_tests="dump_obu" |
Tom Finegan | cd41a51 | 2018-02-16 15:58:48 -0800 | [diff] [blame] | 69 | |
| 70 | run_tests dump_obu_verify_environment "${dump_obu_tests}" |