3 ## Copyright (c) 2014 The WebM project authors. All Rights Reserved.
5 ## Use of this source code is governed by a BSD-style license
6 ## that can be found in the LICENSE file in the root of the source
7 ## tree. An additional intellectual property rights grant can be found
8 ## in the file PATENTS. All contributing project authors may
9 ## be found in the AUTHORS file in the root of the source tree.
11 ## This file tests vpxenc 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 vpxenc_tests (on a new line).
16 . $
(dirname $0)/tools_common.sh
18 readonly TEST_FRAMES
=10
20 # Environment check: Make sure input is available.
21 vpxenc_verify_environment
() {
22 if [ ! -e "${YUV_RAW_INPUT}" ]; then
23 elog
"The file ${YUV_RAW_INPUT##*/} must exist in LIBVPX_TEST_DATA_PATH."
26 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
27 if [ ! -e "${Y4M_NOSQ_PAR_INPUT}" ]; then
28 elog
"The file ${Y4M_NOSQ_PAR_INPUT##*/} must exist in"
29 elog
"LIBVPX_TEST_DATA_PATH."
33 if [ -z "$(vpx_tool_path vpxenc)" ]; then
34 elog
"vpxenc not found. It must exist in LIBVPX_BIN_PATH or its parent."
39 vpxenc_can_encode_vp8
() {
40 if [ "$(vp8_encode_available)" = "yes" ]; then
45 vpxenc_can_encode_vp9
() {
46 if [ "$(vp9_encode_available)" = "yes" ]; then
51 # Echo vpxenc command line parameters allowing use of
52 # hantro_collage_w352h288.yuv as input.
53 yuv_input_hantro_collage
() {
54 echo ""${YUV_RAW_INPUT}"
55 --width="${YUV_RAW_INPUT_WIDTH}"
56 --height="${YUV_RAW_INPUT_HEIGHT}""
59 y4m_input_non_square_par
() {
60 echo ""${Y4M_NOSQ_PAR_INPUT}""
64 echo ""${Y4M_720P_INPUT}""
67 # Echo default vpxenc real time encoding params. $1 is the codec, which defaults
68 # to vp8 if unspecified.
70 local readonly codec
="${1:-vp8}"
71 echo "--codec=${codec}
93 # Wrapper function for running vpxenc with pipe input. Requires that
94 # LIBVPX_BIN_PATH points to the directory containing vpxenc. $1 is used as the
95 # input file path and shifted away. All remaining parameters are passed through
98 local readonly encoder
="$(vpx_tool_path vpxenc)"
99 local readonly input
="$1"
101 cat "${input}" | eval "${VPX_TEST_PREFIX}" "${encoder}" - \
102 --test-decode=fatal \
106 # Wrapper function for running vpxenc. Requires that LIBVPX_BIN_PATH points to
107 # the directory containing vpxenc. $1 one is used as the input file path and
108 # shifted away. All remaining parameters are passed through to vpxenc.
110 local readonly encoder
="$(vpx_tool_path vpxenc)"
111 local readonly input
="$1"
113 eval "${VPX_TEST_PREFIX}" "${encoder}" "${input}" \
114 --test-decode=fatal \
119 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then
120 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp8.ivf"
121 vpxenc $
(yuv_input_hantro_collage
) \
123 --limit="${TEST_FRAMES}" \
127 if [ ! -e "${output}" ]; then
128 elog
"Output file does not exist."
135 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \
136 [ "$(webm_io_available)" = "yes" ]; then
137 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp8.webm"
138 vpxenc $
(yuv_input_hantro_collage
) \
140 --limit="${TEST_FRAMES}" \
143 if [ ! -e "${output}" ]; then
144 elog
"Output file does not exist."
150 vpxenc_vp8_webm_rt
() {
151 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \
152 [ "$(webm_io_available)" = "yes" ]; then
153 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp8_rt.webm"
154 vpxenc $
(yuv_input_hantro_collage
) \
155 $
(vpxenc_rt_params vp8
) \
157 if [ ! -e "${output}" ]; then
158 elog
"Output file does not exist."
164 vpxenc_vp8_webm_2pass
() {
165 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \
166 [ "$(webm_io_available)" = "yes" ]; then
167 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp8.webm"
168 vpxenc $
(yuv_input_hantro_collage
) \
170 --limit="${TEST_FRAMES}" \
171 --output="${output}" \
174 if [ ! -e "${output}" ]; then
175 elog
"Output file does not exist."
181 vpxenc_vp8_webm_lag10_frames20
() {
182 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \
183 [ "$(webm_io_available)" = "yes" ]; then
184 local readonly lag_total_frames
=20
185 local readonly lag_frames
=10
186 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp8_lag10_frames20.webm"
187 vpxenc $
(yuv_input_hantro_collage
) \
189 --limit="${lag_total_frames}" \
190 --lag-in-frames="${lag_frames}" \
191 --output="${output}" \
195 if [ ! -e "${output}" ]; then
196 elog
"Output file does not exist."
202 vpxenc_vp8_ivf_piped_input
() {
203 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then
204 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp8_piped_input.ivf"
205 vpxenc_pipe $
(yuv_input_hantro_collage
) \
207 --limit="${TEST_FRAMES}" \
211 if [ ! -e "${output}" ]; then
212 elog
"Output file does not exist."
219 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
220 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp9.ivf"
221 vpxenc $
(yuv_input_hantro_collage
) \
223 --limit="${TEST_FRAMES}" \
227 if [ ! -e "${output}" ]; then
228 elog
"Output file does not exist."
235 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
236 [ "$(webm_io_available)" = "yes" ]; then
237 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp9.webm"
238 vpxenc $
(yuv_input_hantro_collage
) \
240 --limit="${TEST_FRAMES}" \
243 if [ ! -e "${output}" ]; then
244 elog
"Output file does not exist."
250 vpxenc_vp9_webm_rt
() {
251 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
252 [ "$(webm_io_available)" = "yes" ]; then
253 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp9_rt.webm"
254 vpxenc $
(yuv_input_hantro_collage
) \
255 $
(vpxenc_rt_params vp9
) \
258 if [ ! -e "${output}" ]; then
259 elog
"Output file does not exist."
265 vpxenc_vp9_webm_rt_multithread_tiled
() {
266 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
267 [ "$(webm_io_available)" = "yes" ]; then
268 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp9_rt_multithread_tiled.webm"
269 local readonly tilethread_min
=2
270 local readonly tilethread_max
=4
271 local readonly num_threads
="$(seq ${tilethread_min} ${tilethread_max})"
272 local readonly num_tile_cols
="$(seq ${tilethread_min} ${tilethread_max})"
274 for threads
in ${num_threads}; do
275 for tile_cols
in ${num_tile_cols}; do
276 vpxenc $
(y4m_input_720p
) \
277 $
(vpxenc_rt_params vp9
) \
278 --threads=${threads} \
279 --tile-columns=${tile_cols} \
284 if [ ! -e "${output}" ]; then
285 elog
"Output file does not exist."
293 vpxenc_vp9_webm_rt_multithread_tiled_frameparallel
() {
294 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
295 [ "$(webm_io_available)" = "yes" ]; then
296 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp9_rt_mt_t_fp.webm"
297 local readonly tilethread_min
=2
298 local readonly tilethread_max
=4
299 local readonly num_threads
="$(seq ${tilethread_min} ${tilethread_max})"
300 local readonly num_tile_cols
="$(seq ${tilethread_min} ${tilethread_max})"
302 for threads
in ${num_threads}; do
303 for tile_cols
in ${num_tile_cols}; do
304 vpxenc $
(y4m_input_720p
) \
305 $
(vpxenc_rt_params vp9
) \
306 --threads=${threads} \
307 --tile-columns=${tile_cols} \
313 if [ ! -e "${output}" ]; then
314 elog
"Output file does not exist."
322 vpxenc_vp9_webm_2pass
() {
323 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
324 [ "$(webm_io_available)" = "yes" ]; then
325 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp9.webm"
326 vpxenc $
(yuv_input_hantro_collage
) \
328 --limit="${TEST_FRAMES}" \
329 --output="${output}" \
332 if [ ! -e "${output}" ]; then
333 elog
"Output file does not exist."
339 vpxenc_vp9_ivf_lossless
() {
340 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
341 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp9_lossless.ivf"
342 vpxenc $
(yuv_input_hantro_collage
) \
344 --limit="${TEST_FRAMES}" \
346 --output="${output}" \
349 if [ ! -e "${output}" ]; then
350 elog
"Output file does not exist."
356 vpxenc_vp9_ivf_minq0_maxq0
() {
357 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
358 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp9_lossless_minq0_maxq0.ivf"
359 vpxenc $
(yuv_input_hantro_collage
) \
361 --limit="${TEST_FRAMES}" \
363 --output="${output}" \
367 if [ ! -e "${output}" ]; then
368 elog
"Output file does not exist."
374 vpxenc_vp9_webm_lag10_frames20
() {
375 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
376 [ "$(webm_io_available)" = "yes" ]; then
377 local readonly lag_total_frames
=20
378 local readonly lag_frames
=10
379 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp9_lag10_frames20.webm"
380 vpxenc $
(yuv_input_hantro_collage
) \
382 --limit="${lag_total_frames}" \
383 --lag-in-frames="${lag_frames}" \
384 --output="${output}" \
388 if [ ! -e "${output}" ]; then
389 elog
"Output file does not exist."
395 # TODO(fgalligan): Test that DisplayWidth is different than video width.
396 vpxenc_vp9_webm_non_square_par
() {
397 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
398 [ "$(webm_io_available)" = "yes" ]; then
399 local readonly output
="${VPX_TEST_OUTPUT_DIR}/vp9_non_square_par.webm"
400 vpxenc $
(y4m_input_non_square_par
) \
402 --limit="${TEST_FRAMES}" \
405 if [ ! -e "${output}" ]; then
406 elog
"Output file does not exist."
412 vpxenc_tests
="vpxenc_vp8_ivf
415 vpxenc_vp8_webm_2pass
416 vpxenc_vp8_webm_lag10_frames20
417 vpxenc_vp8_ivf_piped_input
421 vpxenc_vp9_webm_rt_multithread_tiled
422 vpxenc_vp9_webm_rt_multithread_tiled_frameparallel
423 vpxenc_vp9_webm_2pass
424 vpxenc_vp9_ivf_lossless
425 vpxenc_vp9_ivf_minq0_maxq0
426 vpxenc_vp9_webm_lag10_frames20
427 vpxenc_vp9_webm_non_square_par"
429 run_tests vpxenc_verify_environment
"${vpxenc_tests}"