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
20 # Environment check: Make sure input is available.
21 vpxenc_verify_environment() {
22 if [ ! -e "${YUV_RAW_INPUT}" ]; then
23 echo "The file ${YUV_RAW_INPUT##*/} must exist in LIBVPX_TEST_DATA_PATH."
28 vpxenc_can_encode_vp8() {
29 if [ "$(vpxenc_available)" = "yes" ] && \
30 [ "$(vp8_encode_available)" = "yes" ]; then
35 vpxenc_can_encode_vp9() {
36 if [ "$(vpxenc_available)" = "yes" ] && \
37 [ "$(vp9_encode_available)" = "yes" ]; then
42 # Echoes yes to stdout when vpxenc exists according to vpx_tool_available().
44 [ -n $(vpx_tool_available vpxenc) ] && echo yes
47 # Wrapper function for running vpxenc. Positional parameters are interpreted as
52 # 4 - number of frames to encode
53 # 5 - path to input file
54 # 6 - path to output file
55 # Note: The output file path must end in .ivf to output an IVF file.
57 # Note: Extra flags currently supports a special case: when set to "-"
58 # input is piped to vpxenc via cat.
60 local encoder="${LIBVPX_BIN_PATH}/vpxenc${VPX_TEST_EXE_SUFFIX}"
66 local output="${VPX_TEST_OUTPUT_DIR}/${6}"
67 local extra_flags=${7}
69 # Because --ivf must be within the command line to get IVF from vpxenc.
70 if echo "${output}" | egrep -q 'ivf$'; then
76 if [ "${extra_flags}" = "-" ]; then
83 if [ -z "${pipe_input}" ]; then
84 eval "${VPX_TEST_PREFIX}" "${encoder}" --codec=${codec} --width=${width} \
85 --height=${height} --limit=${frames} ${use_ivf} ${extra_flags} \
86 --output="${output}" "${input}" ${devnull}
89 | eval "${VPX_TEST_PREFIX}" "${encoder}" --codec=${codec} \
90 --width=${width} --height=${height} --limit=${frames} ${use_ivf} \
91 ${extra_flags} --output="${output}" - ${devnull}
94 if [ ! -e "${output}" ]; then
95 # Return non-zero exit status: output file doesn't exist, so something
96 # definitely went wrong.
102 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then
103 vpxenc vp8 ${YUV_RAW_INPUT_WIDTH} ${YUV_RAW_INPUT_HEIGHT} ${TEST_FRAMES} \
104 "${YUV_RAW_INPUT}" vp8.ivf
108 vpxenc_vp8_ivf_pipe_input() {
109 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then
110 vpxenc vp8 ${YUV_RAW_INPUT_WIDTH} ${YUV_RAW_INPUT_HEIGHT} ${TEST_FRAMES} \
111 "${YUV_RAW_INPUT}" vp8.ivf -
116 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] &&
117 [ "$(webm_io_available)" = "yes" ] ; then
118 vpxenc vp8 ${YUV_RAW_INPUT_WIDTH} ${YUV_RAW_INPUT_HEIGHT} ${TEST_FRAMES} \
119 "${YUV_RAW_INPUT}" vp8.webm
124 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
125 vpxenc vp9 ${YUV_RAW_INPUT_WIDTH} ${YUV_RAW_INPUT_HEIGHT} ${TEST_FRAMES} \
126 "${YUV_RAW_INPUT}" vp9.ivf
131 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] &&
132 [ "$(webm_io_available)" = "yes" ] ; then
133 vpxenc vp9 ${YUV_RAW_INPUT_WIDTH} ${YUV_RAW_INPUT_HEIGHT} ${TEST_FRAMES} \
134 "${YUV_RAW_INPUT}" vp9.webm
138 DISABLED_vpxenc_vp9_ivf_lossless() {
139 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
140 vpxenc vp9 ${YUV_RAW_INPUT_WIDTH} ${YUV_RAW_INPUT_HEIGHT} ${TEST_FRAMES} \
141 "${YUV_RAW_INPUT}" vp9_lossless.ivf --lossless
145 vpxenc_tests="vpxenc_vp8_ivf
147 vpxenc_vp8_ivf_pipe_input
150 DISABLED_vpxenc_vp9_ivf_lossless"
152 run_tests vpxenc_verify_environment "${vpxenc_tests}"