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 aomenc using hantro_collage_w352h288.yuv as input. To add
12 ## new tests to this file, do the following:
13 ## 1. Write a shell function (this is your test).
14 ## 2. Add the function to aomenc_tests (on a new line).
16 . $
(dirname $0)/tools_common.sh
18 # Environment check: Make sure input is available.
19 aomenc_verify_environment
() {
20 if [ ! -e "${YUV_RAW_INPUT}" ]; then
21 elog
"The file ${YUV_RAW_INPUT##*/} must exist in LIBAOM_TEST_DATA_PATH."
24 if [ "$(aomenc_can_encode_av1)" = "yes" ]; then
25 if [ ! -e "${Y4M_NOSQ_PAR_INPUT}" ]; then
26 elog
"The file ${Y4M_NOSQ_PAR_INPUT##*/} must exist in"
27 elog
"LIBAOM_TEST_DATA_PATH."
31 if [ -z "$(aom_tool_path aomenc)" ]; then
32 elog
"aomenc not found. It must exist in LIBAOM_BIN_PATH or its parent."
37 aomenc_can_encode_av1
() {
38 if [ "$(av1_encode_available)" = "yes" ]; then
43 aomenc_can_encode_av1
() {
44 if [ "$(av1_encode_available)" = "yes" ]; then
49 # Utilities that echo aomenc input file parameters.
50 y4m_input_non_square_par
() {
51 echo ""${Y4M_NOSQ_PAR_INPUT}""
55 echo ""${Y4M_720P_INPUT}""
58 # Wrapper function for running aomenc with pipe input. Requires that
59 # LIBAOM_BIN_PATH points to the directory containing aomenc. $1 is used as the
60 # input file path and shifted away. All remaining parameters are passed through
63 local readonly encoder
="$(aom_tool_path aomenc)"
64 local readonly input
="$1"
66 cat "${input}" | eval "${AOM_TEST_PREFIX}" "${encoder}" - \
71 # Wrapper function for running aomenc. Requires that LIBAOM_BIN_PATH points to
72 # the directory containing aomenc. $1 one is used as the input file path and
73 # shifted away. All remaining parameters are passed through to aomenc.
75 local readonly encoder
="$(aom_tool_path aomenc)"
76 local readonly input
="$1"
78 eval "${AOM_TEST_PREFIX}" "${encoder}" "${input}" \
84 if [ "$(aomenc_can_encode_av1)" = "yes" ]; then
85 local output
="${AV1_IVF_FILE}"
86 if [ -e "${AV1_IVF_FILE}" ]; then
87 output
="${AOM_TEST_OUTPUT_DIR}/av1_test.ivf"
89 aomenc $
(yuv_raw_input
) \
90 $
(aomenc_encode_test_fast_params
) \
94 if [ ! -e "${output}" ]; then
95 elog
"Output file does not exist."
101 aomenc_av1_obu_annexb
() {
102 if [ "$(aomenc_can_encode_av1)" = "yes" ]; then
103 local output
="${AV1_OBU_ANNEXB_FILE}"
104 if [ -e "${AV1_OBU_ANNEXB_FILE}" ]; then
105 output
="${AOM_TEST_OUTPUT_DIR}/av1_test.annexb.obu"
107 aomenc $
(yuv_raw_input
) \
108 $
(aomenc_encode_test_fast_params
) \
113 if [ ! -e "${output}" ]; then
114 elog
"Output file does not exist."
120 aomenc_av1_obu_section5
() {
121 if [ "$(aomenc_can_encode_av1)" = "yes" ]; then
122 local output
="${AV1_OBU_SEC5_FILE}"
123 if [ -e "${AV1_OBU_SEC5_FILE}" ]; then
124 output
="${AOM_TEST_OUTPUT_DIR}/av1_test.section5.obu"
126 aomenc $
(yuv_raw_input
) \
127 $
(aomenc_encode_test_fast_params
) \
131 if [ ! -e "${output}" ]; then
132 elog
"Output file does not exist."
139 if [ "$(aomenc_can_encode_av1)" = "yes" ] && \
140 [ "$(webm_io_available)" = "yes" ]; then
141 local output
="${AV1_WEBM_FILE}"
142 if [ -e "${AV1_WEBM_FILE}" ]; then
143 output
="${AOM_TEST_OUTPUT_DIR}/av1_test.webm"
145 aomenc $
(yuv_raw_input
) \
146 $
(aomenc_encode_test_fast_params
) \
149 if [ ! -e "${output}" ]; then
150 elog
"Output file does not exist."
156 aomenc_av1_webm_1pass
() {
157 if [ "$(aomenc_can_encode_av1)" = "yes" ] && \
158 [ "$(webm_io_available)" = "yes" ]; then
159 local readonly output
="${AOM_TEST_OUTPUT_DIR}/av1_test.webm"
160 aomenc $
(yuv_raw_input
) \
161 $
(aomenc_encode_test_fast_params
) \
165 if [ ! -e "${output}" ]; then
166 elog
"Output file does not exist."
172 aomenc_av1_ivf_lossless
() {
173 if [ "$(aomenc_can_encode_av1)" = "yes" ]; then
174 local readonly output
="${AOM_TEST_OUTPUT_DIR}/av1_lossless.ivf"
175 aomenc $
(yuv_raw_input
) \
176 $
(aomenc_encode_test_fast_params
) \
178 --output="${output}" \
181 if [ ! -e "${output}" ]; then
182 elog
"Output file does not exist."
188 aomenc_av1_ivf_minq0_maxq0
() {
189 if [ "$(aomenc_can_encode_av1)" = "yes" ]; then
190 local readonly output
="${AOM_TEST_OUTPUT_DIR}/av1_lossless_minq0_maxq0.ivf"
191 aomenc $
(yuv_raw_input
) \
192 $
(aomenc_encode_test_fast_params
) \
194 --output="${output}" \
198 if [ ! -e "${output}" ]; then
199 elog
"Output file does not exist."
205 aomenc_av1_webm_lag5_frames10
() {
206 if [ "$(aomenc_can_encode_av1)" = "yes" ] && \
207 [ "$(webm_io_available)" = "yes" ]; then
208 local readonly lag_total_frames
=10
209 local readonly lag_frames
=5
210 local readonly output
="${AOM_TEST_OUTPUT_DIR}/av1_lag5_frames10.webm"
211 aomenc $
(yuv_raw_input
) \
212 $
(aomenc_encode_test_fast_params
) \
213 --limit=${lag_total_frames} \
214 --lag-in-frames=${lag_frames} \
217 if [ ! -e "${output}" ]; then
218 elog
"Output file does not exist."
224 # TODO(fgalligan): Test that DisplayWidth is different than video width.
225 aomenc_av1_webm_non_square_par
() {
226 if [ "$(aomenc_can_encode_av1)" = "yes" ] && \
227 [ "$(webm_io_available)" = "yes" ]; then
228 local readonly output
="${AOM_TEST_OUTPUT_DIR}/av1_non_square_par.webm"
229 aomenc $
(y4m_input_non_square_par
) \
230 $
(aomenc_encode_test_fast_params
) \
233 if [ ! -e "${output}" ]; then
234 elog
"Output file does not exist."
240 aomenc_av1_webm_cdf_update_mode
() {
241 if [ "$(aomenc_can_encode_av1)" = "yes" ] && \
242 [ "$(webm_io_available)" = "yes" ]; then
243 for mode
in 0 1 2; do
244 local readonly output
="${AOM_TEST_OUTPUT_DIR}/cdf_mode_${mode}.webm"
245 aomenc $
(yuv_raw_input
) \
246 $
(aomenc_encode_test_fast_params
) \
247 --cdf-update-mode=${mode} \
250 if [ ! -e "${output}" ]; then
251 elog
"Output file does not exist."
258 aomenc_tests
="aomenc_av1_ivf
259 aomenc_av1_obu_annexb
260 aomenc_av1_obu_section5
262 aomenc_av1_webm_1pass
263 aomenc_av1_ivf_lossless
264 aomenc_av1_ivf_minq0_maxq0
265 aomenc_av1_webm_lag5_frames10
266 aomenc_av1_webm_non_square_par
267 aomenc_av1_webm_cdf_update_mode"
269 run_tests aomenc_verify_environment
"${aomenc_tests}"