blob: b03c42a48f42f3da2ab30082825f496fac31d12d [file] [log] [blame]
Yaowu Xuf883b422016-08-30 14:01:10 -07001#!/bin/sh
Yaowu Xu9c01aa12016-09-01 14:32:49 -07002## Copyright (c) 2016, Alliance for Open Media. All rights reserved
Yaowu Xuf883b422016-08-30 14:01:10 -07003##
Yaowu Xu9c01aa12016-09-01 14:32:49 -07004## 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.
Yaowu Xuf883b422016-08-30 14:01:10 -070010##
Yaowu Xu9c01aa12016-09-01 14:32:49 -070011## 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).
Yaowu Xuf883b422016-08-30 14:01:10 -070014##
15. $(dirname $0)/tools_common.sh
16
17# Environment check: Make sure input is available.
18aomdec_verify_environment() {
Jim Bankoskif7f04372016-05-27 14:31:29 -070019 if [ "$(av1_encode_available)" != "yes" ] ; then
Tom Finegan8ab44142018-04-27 14:57:52 -070020 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. "
Jim Bankoskif7f04372016-05-27 14:31:29 -070026 return 1
27 fi
Yaowu Xuf883b422016-08-30 14:01:10 -070028 fi
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
32 fi
33}
34
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.
39aomdec_pipe() {
Tom Fineganef64ee82018-07-10 11:35:40 -070040 local input="$1"
Yaowu Xuf883b422016-08-30 14:01:10 -070041 shift
Jim Bankoskif7f04372016-05-27 14:31:29 -070042 if [ ! -e "${input}" ]; then
Tom Finegan8ab44142018-04-27 14:57:52 -070043 elog "Input file ($input) missing in aomdec_pipe()"
44 return 1
Jim Bankoskif7f04372016-05-27 14:31:29 -070045 fi
46 cat "${file}" | aomdec - "$@" ${devnull}
Yaowu Xuf883b422016-08-30 14:01:10 -070047}
48
Jim Bankoskif7f04372016-05-27 14:31:29 -070049
Yaowu Xuf883b422016-08-30 14:01:10 -070050# 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.
53aomdec() {
Tom Fineganef64ee82018-07-10 11:35:40 -070054 local decoder="$(aom_tool_path aomdec)"
55 local input="$1"
Yaowu Xuf883b422016-08-30 14:01:10 -070056 shift
57 eval "${AOM_TEST_PREFIX}" "${decoder}" "$input" "$@" ${devnull}
58}
59
Yaowu Xuf883b422016-08-30 14:01:10 -070060aomdec_can_decode_av1() {
61 if [ "$(av1_decode_available)" = "yes" ]; then
62 echo yes
63 fi
64}
65
Tom Finegan8ab44142018-04-27 14:57:52 -070066aomdec_av1_ivf() {
Jim Bankoskif7f04372016-05-27 14:31:29 -070067 if [ "$(aomdec_can_decode_av1)" = "yes" ]; then
Tom Fineganef64ee82018-07-10 11:35:40 -070068 local file="${AV1_IVF_FILE}"
Tom Finegan8ab44142018-04-27 14:57:52 -070069 if [ ! -e "${file}" ]; then
James Zernbb987892020-04-28 18:33:02 -070070 encode_yuv_raw_input_av1 "${file}" --ivf || return 1
Jim Bankoskif7f04372016-05-27 14:31:29 -070071 fi
Tom Finegan8ab44142018-04-27 14:57:52 -070072 aomdec "${AV1_IVF_FILE}" --summary --noblit
Yaowu Xuf883b422016-08-30 14:01:10 -070073 fi
74}
75
Tom Finegan8ab44142018-04-27 14:57:52 -070076aomdec_av1_ivf_error_resilient() {
77 if [ "$(aomdec_can_decode_av1)" = "yes" ]; then
Tom Fineganef64ee82018-07-10 11:35:40 -070078 local file="av1.error-resilient.ivf"
Tom Finegan8ab44142018-04-27 14:57:52 -070079 if [ ! -e "${file}" ]; then
James Zernbb987892020-04-28 18:33:02 -070080 encode_yuv_raw_input_av1 "${file}" --ivf --error-resilient=1 || return 1
Tom Finegan8ab44142018-04-27 14:57:52 -070081 fi
82 aomdec "${file}" --summary --noblit
83 fi
84}
85
James Zerneda52bb2020-11-06 14:57:11 -080086ivf_multithread() {
87 local row_mt="$1"
Tom Finegan8ab44142018-04-27 14:57:52 -070088 if [ "$(aomdec_can_decode_av1)" = "yes" ]; then
Tom Fineganef64ee82018-07-10 11:35:40 -070089 local file="${AV1_IVF_FILE}"
Tom Finegan8ab44142018-04-27 14:57:52 -070090 if [ ! -e "${file}" ]; then
James Zernbb987892020-04-28 18:33:02 -070091 encode_yuv_raw_input_av1 "${file}" --ivf || return 1
Jim Bankoskif7f04372016-05-27 14:31:29 -070092 fi
Yaowu Xuf883b422016-08-30 14:01:10 -070093 for threads in 2 3 4 5 6 7 8; do
James Zerneda52bb2020-11-06 14:57:11 -080094 aomdec "${file}" --summary --noblit --threads=$threads --row-mt=$row_mt \
95 || return 1
Yaowu Xuf883b422016-08-30 14:01:10 -070096 done
97 fi
98}
99
James Zerneda52bb2020-11-06 14:57:11 -0800100aomdec_av1_ivf_multithread() {
101 ivf_multithread 0 # --row-mt=0
102}
103
104aomdec_av1_ivf_multithread_row_mt() {
105 ivf_multithread 1 # --row-mt=1
106}
107
Tom Finegan8ab44142018-04-27 14:57:52 -0700108aomdec_aom_ivf_pipe_input() {
109 if [ "$(aomdec_can_decode_av1)" = "yes" ]; then
Tom Fineganef64ee82018-07-10 11:35:40 -0700110 local file="${AV1_IVF_FILE}"
Tom Finegan8ab44142018-04-27 14:57:52 -0700111 if [ ! -e "${file}" ]; then
James Zernbb987892020-04-28 18:33:02 -0700112 encode_yuv_raw_input_av1 "${file}" --ivf || return 1
Yaowu Xuf883b422016-08-30 14:01:10 -0700113 fi
Tom Finegan8ab44142018-04-27 14:57:52 -0700114 aomdec_pipe "${AV1_IVF_FILE}" --summary --noblit
Yaowu Xuf883b422016-08-30 14:01:10 -0700115 fi
116}
117
Tom Finegan8ab44142018-04-27 14:57:52 -0700118aomdec_av1_obu_annexb() {
119 if [ "$(aomdec_can_decode_av1)" = "yes" ]; then
Tom Fineganef64ee82018-07-10 11:35:40 -0700120 local file="${AV1_OBU_ANNEXB_FILE}"
Tom Finegan8ab44142018-04-27 14:57:52 -0700121 if [ ! -e "${file}" ]; then
James Zernbb987892020-04-28 18:33:02 -0700122 encode_yuv_raw_input_av1 "${file}" --obu --annexb=1 || return 1
Tom Finegan8ab44142018-04-27 14:57:52 -0700123 fi
124 aomdec "${file}" --summary --noblit --annexb
125 fi
126}
127
128aomdec_av1_obu_section5() {
129 if [ "$(aomdec_can_decode_av1)" = "yes" ]; then
Tom Fineganef64ee82018-07-10 11:35:40 -0700130 local file="${AV1_OBU_SEC5_FILE}"
Tom Finegan8ab44142018-04-27 14:57:52 -0700131 if [ ! -e "${file}" ]; then
James Zernbb987892020-04-28 18:33:02 -0700132 encode_yuv_raw_input_av1 "${file}" --obu || return 1
Tom Finegan8ab44142018-04-27 14:57:52 -0700133 fi
134 aomdec "${file}" --summary --noblit
135 fi
136}
137
138aomdec_av1_webm() {
139 if [ "$(aomdec_can_decode_av1)" = "yes" ] && \
140 [ "$(webm_io_available)" = "yes" ]; then
Tom Fineganef64ee82018-07-10 11:35:40 -0700141 local file="${AV1_WEBM_FILE}"
Tom Finegan8ab44142018-04-27 14:57:52 -0700142 if [ ! -e "${file}" ]; then
James Zernbb987892020-04-28 18:33:02 -0700143 encode_yuv_raw_input_av1 "${file}" || return 1
Tom Finegan8ab44142018-04-27 14:57:52 -0700144 fi
145 aomdec "${AV1_WEBM_FILE}" --summary --noblit
146 fi
147}
148
149aomdec_tests="aomdec_av1_ivf
Tom Finegan8ab44142018-04-27 14:57:52 -0700150 aomdec_av1_ivf_multithread
James Zerneda52bb2020-11-06 14:57:11 -0800151 aomdec_av1_ivf_multithread_row_mt
Jerome Jiang0438f482021-04-15 17:41:59 -0700152 aomdec_aom_ivf_pipe_input"
153
154if [ ! "$(realtime_only_build)" = "yes" ]; then
155 aomdec_tests="${aomdec_tests}
156 aomdec_av1_ivf_error_resilient
157 aomdec_av1_obu_annexb
158 aomdec_av1_obu_section5
159 aomdec_av1_webm"
160fi
Yaowu Xuf883b422016-08-30 14:01:10 -0700161
162run_tests aomdec_verify_environment "${aomdec_tests}"