2 ## Copyright (c) 2016, Alliance for Open Media. All rights reserved
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_WEBM_FILE}" ] || \
21 [ ! -e "${AV1_FPM_WEBM_FILE}" ] || \
22 [ ! -e "${AV1_LT_50_FRAMES_WEBM_FILE}" ] ; then
23 elog
"Libaom test data must exist in LIBAOM_TEST_DATA_PATH."
27 if [ -z "$(aom_tool_path aomdec)" ]; then
28 elog
"aomdec not found. It must exist in LIBAOM_BIN_PATH or its parent."
33 # Wrapper function for running aomdec with pipe input. Requires that
34 # LIBAOM_BIN_PATH points to the directory containing aomdec. $1 is used as the
35 # input file path and shifted away. All remaining parameters are passed through
38 local readonly input
="$1"
40 if [ ! -e "${input}" ]; then
41 local file="${AOM_TEST_OUTPUT_DIR}/test_encode.ivf"
42 encode_yuv_raw_input_av1
"${file}" --ivf
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.
54 local readonly decoder
="$(aom_tool_path aomdec)"
55 local readonly input
="$1"
57 eval "${AOM_TEST_PREFIX}" "${decoder}" "$input" "$@" ${devnull}
60 aomdec_can_decode_av1() {
61 if [ "$
(av1_decode_available
)" = "yes" ]; then
66 aomdec_aom_ivf_pipe_input() {
67 if [ "$
(aomdec_can_decode_av1
)" = "yes" ]; then
68 aomdec_pipe "${AOM_IVF_FILE}" --summary --noblit
73 if [ "$
(aomdec_can_decode_av1
)" = "yes" ] && \
74 [ "$
(webm_io_available
)" = "yes" ]; then
75 if [ ! -e "${AV1_WEBM_FILE}" ]; then
76 local file="${AOM_TEST_OUTPUT_DIR}/test_encode.webm
"
77 encode_yuv_raw_input_av1 "${file}"
79 aomdec "${AV1_WEBM_FILE}" --summary --noblit
84 aomdec_av1_webm_frame_parallel() {
85 if [ "$
(aomdec_can_decode_av1
)" = "yes" ] && \
86 [ "$
(webm_io_available
)" = "yes" ]; then
88 if [ ! -e "${AV1_WEBM_FILE}" ]; then
89 file="${AOM_TEST_OUTPUT_DIR}/test_encode.webm
"
90 encode_yuv_raw_input_av1 "${file}" "--ivf --error-resilient=1 "
92 file="${AV1_FPM_WEBM_FILE}"
94 for threads in 2 3 4 5 6 7 8; do
95 aomdec "${file}" --summary --noblit --threads=$threads \
101 # TODO(vigneshv): Enable or remove this test and associated code.
102 DISABLED_aomdec_av1_webm_less_than_50_frames() {
103 # ensure that reaching eof in webm_guess_framerate doesn't result in invalid
104 # frames in actual webm_read_frame calls.
105 if [ "$
(aomdec_can_decode_av1
)" = "yes" ] && \
106 [ "$
(webm_io_available
)" = "yes" ]; then
107 local readonly decoder="$
(aom_tool_path aomdec
)"
108 local readonly expected=10
109 local readonly num_frames=$(${AOM_TEST_PREFIX} "${decoder}" \
110 "${AV1_LT_50_FRAMES_WEBM_FILE}" --summary --noblit 2>&1 \
111 | awk '/^[0-9]+ decoded frames/ { print $1 }')
112 if [ "$num_frames" -ne "$expected" ]; then
113 elog "Output frames
($num_frames) != expected
($expected)"
119 aomdec_tests="aomdec_av1_webm
120 aomdec_av1_webm_frame_parallel
121 aomdec_aom_ivf_pipe_input
122 DISABLED_aomdec_av1_webm_less_than_50_frames
"
124 run_tests aomdec_verify_environment "${aomdec_tests}"