Backed out 3 changesets (bug 1790375) for causing wd failures on fetch_error.py....
[gecko.git] / third_party / aom / test / aomdec.sh
blob927142287c38f8230ddc43189646702fae96a0ac
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 aomdec. To add new tests to this file, do the following:
12 ## 1. Write a shell function (this is your test).
13 ## 2. Add the function to aomdec_tests (on a new line).
15 . $(dirname $0)/tools_common.sh
17 # Environment check: Make sure input is available.
18 aomdec_verify_environment() {
19 if [ "$(av1_encode_available)" != "yes" ] ; then
20 if [ ! -e "${AV1_IVF_FILE}" ] || \
21 [ ! -e "${AV1_OBU_ANNEXB_FILE}" ] || \
22 [ ! -e "${AV1_OBU_SEC5_FILE}" ] || \
23 [ ! -e "${AV1_WEBM_FILE}" ]; then
24 elog "Libaom test data must exist before running this test script when " \
25 " encoding is disabled. "
26 return 1
29 if [ -z "$(aom_tool_path aomdec)" ]; then
30 elog "aomdec not found. It must exist in LIBAOM_BIN_PATH or its parent."
31 return 1
35 # Wrapper function for running aomdec with pipe input. Requires that
36 # LIBAOM_BIN_PATH points to the directory containing aomdec. $1 is used as the
37 # input file path and shifted away. All remaining parameters are passed through
38 # to aomdec.
39 aomdec_pipe() {
40 local input="$1"
41 shift
42 if [ ! -e "${input}" ]; then
43 elog "Input file ($input) missing in aomdec_pipe()"
44 return 1
46 cat "${file}" | aomdec - "$@" ${devnull}
50 # Wrapper function for running aomdec. Requires that LIBAOM_BIN_PATH points to
51 # the directory containing aomdec. $1 one is used as the input file path and
52 # shifted away. All remaining parameters are passed through to aomdec.
53 aomdec() {
54 local decoder="$(aom_tool_path aomdec)"
55 local input="$1"
56 shift
57 eval "${AOM_TEST_PREFIX}" "${decoder}" "$input" "$@" ${devnull}
60 aomdec_can_decode_av1() {
61 if [ "$(av1_decode_available)" = "yes" ]; then
62 echo yes
66 aomdec_av1_ivf() {
67 if [ "$(aomdec_can_decode_av1)" = "yes" ]; then
68 local file="${AV1_IVF_FILE}"
69 if [ ! -e "${file}" ]; then
70 encode_yuv_raw_input_av1 "${file}" --ivf
72 aomdec "${AV1_IVF_FILE}" --summary --noblit
76 aomdec_av1_ivf_error_resilient() {
77 if [ "$(aomdec_can_decode_av1)" = "yes" ]; then
78 local file="av1.error-resilient.ivf"
79 if [ ! -e "${file}" ]; then
80 encode_yuv_raw_input_av1 "${file}" --ivf --error-resilient=1
82 aomdec "${file}" --summary --noblit
86 aomdec_av1_ivf_multithread() {
87 if [ "$(aomdec_can_decode_av1)" = "yes" ]; then
88 local file="${AV1_IVF_FILE}"
89 if [ ! -e "${file}" ]; then
90 encode_yuv_raw_input_av1 "${file}" --ivf
92 for threads in 2 3 4 5 6 7 8; do
93 aomdec "${file}" --summary --noblit --threads=$threads
94 done
98 aomdec_aom_ivf_pipe_input() {
99 if [ "$(aomdec_can_decode_av1)" = "yes" ]; then
100 local file="${AV1_IVF_FILE}"
101 if [ ! -e "${file}" ]; then
102 encode_yuv_raw_input_av1 "${file}" --ivf
104 aomdec_pipe "${AV1_IVF_FILE}" --summary --noblit
108 aomdec_av1_obu_annexb() {
109 if [ "$(aomdec_can_decode_av1)" = "yes" ]; then
110 local file="${AV1_OBU_ANNEXB_FILE}"
111 if [ ! -e "${file}" ]; then
112 encode_yuv_raw_input_av1 "${file}" --obu --annexb=1
114 aomdec "${file}" --summary --noblit --annexb
118 aomdec_av1_obu_section5() {
119 if [ "$(aomdec_can_decode_av1)" = "yes" ]; then
120 local file="${AV1_OBU_SEC5_FILE}"
121 if [ ! -e "${file}" ]; then
122 encode_yuv_raw_input_av1 "${file}" --obu
124 aomdec "${file}" --summary --noblit
128 aomdec_av1_webm() {
129 if [ "$(aomdec_can_decode_av1)" = "yes" ] && \
130 [ "$(webm_io_available)" = "yes" ]; then
131 local file="${AV1_WEBM_FILE}"
132 if [ ! -e "${file}" ]; then
133 encode_yuv_raw_input_av1 "${file}"
135 aomdec "${AV1_WEBM_FILE}" --summary --noblit
139 aomdec_tests="aomdec_av1_ivf
140 aomdec_av1_ivf_error_resilient
141 aomdec_av1_ivf_multithread
142 aomdec_aom_ivf_pipe_input
143 aomdec_av1_obu_annexb
144 aomdec_av1_obu_section5
145 aomdec_av1_webm"
147 run_tests aomdec_verify_environment "${aomdec_tests}"