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 [ -z "$(vpx_tool_path vpxenc)" ]; then
27 elog "vpxenc not found. It must exist in LIBVPX_BIN_PATH or its parent."
32 vpxenc_can_encode_vp8() {
33 if [ "$(vp8_encode_available)" = "yes" ]; then
38 vpxenc_can_encode_vp9() {
39 if [ "$(vp9_encode_available)" = "yes" ]; then
44 # Wrapper function for running vpxenc with pipe input. Requires that
45 # LIBVPX_BIN_PATH points to the directory containing vpxenc. $1 is used as the
46 # input file path and shifted away. All remaining parameters are passed through
49 local readonly encoder="$(vpx_tool_path vpxenc)"
50 local readonly input="$1"
52 cat "${input}" | eval "${VPX_TEST_PREFIX}" "${encoder}" - \
57 # Wrapper function for running vpxenc. Requires that LIBVPX_BIN_PATH points to
58 # the directory containing vpxenc. $1 one is used as the input file path and
59 # shifted away. All remaining parameters are passed through to vpxenc.
61 local readonly encoder="$(vpx_tool_path vpxenc)"
62 local readonly input="$1"
64 eval "${VPX_TEST_PREFIX}" "${encoder}" "${input}" \
70 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then
71 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.ivf"
72 vpxenc "${YUV_RAW_INPUT}" \
74 --width="${YUV_RAW_INPUT_WIDTH}" \
75 --height="${YUV_RAW_INPUT_HEIGHT}" \
76 --limit="${TEST_FRAMES}" \
80 if [ ! -e "${output}" ]; then
81 elog "Output file does not exist."
88 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \
89 [ "$(webm_io_available)" = "yes" ]; then
90 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.webm"
91 vpxenc "${YUV_RAW_INPUT}" \
93 --width="${YUV_RAW_INPUT_WIDTH}" \
94 --height="${YUV_RAW_INPUT_HEIGHT}" \
95 --limit="${TEST_FRAMES}" \
98 if [ ! -e "${output}" ]; then
99 elog "Output file does not exist."
105 vpxenc_vp8_webm_rt() {
106 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \
107 [ "$(webm_io_available)" = "yes" ]; then
108 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8_rt.webm"
109 vpxenc "${YUV_RAW_INPUT}" \
111 --width="${YUV_RAW_INPUT_WIDTH}" \
112 --height="${YUV_RAW_INPUT_HEIGHT}" \
113 --output="${output}" \
114 --buf-initial-sz=500 \
115 --buf-optimal-sz=600 \
119 --error-resilient=1 \
120 --kf-max-dist=90000 \
122 --max-intra-rate=300 \
125 --noise-sensitivity=0 \
134 if [ ! -e "${output}" ]; then
135 elog "Output file does not exist."
141 vpxenc_vp8_webm_2pass() {
142 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \
143 [ "$(webm_io_available)" = "yes" ]; then
144 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.webm"
145 vpxenc "${YUV_RAW_INPUT}" \
147 --width="${YUV_RAW_INPUT_WIDTH}" \
148 --height="${YUV_RAW_INPUT_HEIGHT}" \
149 --limit="${TEST_FRAMES}" \
150 --output="${output}" \
153 if [ ! -e "${output}" ]; then
154 elog "Output file does not exist."
160 vpxenc_vp8_webm_lag10_frames20() {
161 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \
162 [ "$(webm_io_available)" = "yes" ]; then
163 local readonly lag_total_frames=20
164 local readonly lag_frames=10
165 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8_lag10_frames20.webm"
166 vpxenc "${YUV_RAW_INPUT}" \
168 --width="${YUV_RAW_INPUT_WIDTH}" \
169 --height="${YUV_RAW_INPUT_HEIGHT}" \
170 --limit="${lag_total_frames}" \
171 --lag-in-frames="${lag_frames}" \
172 --output="${output}" \
176 if [ ! -e "${output}" ]; then
177 elog "Output file does not exist."
183 vpxenc_vp8_ivf_piped_input() {
184 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then
185 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8_piped_input.ivf"
186 vpxenc_pipe "${YUV_RAW_INPUT}" \
188 --width="${YUV_RAW_INPUT_WIDTH}" \
189 --height="${YUV_RAW_INPUT_HEIGHT}" \
190 --limit="${TEST_FRAMES}" \
194 if [ ! -e "${output}" ]; then
195 elog "Output file does not exist."
202 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
203 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.ivf"
204 vpxenc "${YUV_RAW_INPUT}" \
206 --width="${YUV_RAW_INPUT_WIDTH}" \
207 --height="${YUV_RAW_INPUT_HEIGHT}" \
208 --limit="${TEST_FRAMES}" \
212 if [ ! -e "${output}" ]; then
213 elog "Output file does not exist."
220 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
221 [ "$(webm_io_available)" = "yes" ]; then
222 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.webm"
223 vpxenc "${YUV_RAW_INPUT}" \
225 --width="${YUV_RAW_INPUT_WIDTH}" \
226 --height="${YUV_RAW_INPUT_HEIGHT}" \
227 --limit="${TEST_FRAMES}" \
230 if [ ! -e "${output}" ]; then
231 elog "Output file does not exist."
237 vpxenc_vp9_webm_rt() {
238 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
239 [ "$(webm_io_available)" = "yes" ]; then
240 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_rt.webm"
241 vpxenc "${YUV_RAW_INPUT}" \
243 --width="${YUV_RAW_INPUT_WIDTH}" \
244 --height="${YUV_RAW_INPUT_HEIGHT}" \
245 --output="${output}" \
246 --buf-initial-sz=500 \
247 --buf-optimal-sz=600 \
251 --error-resilient=1 \
252 --kf-max-dist=90000 \
254 --max-intra-rate=300 \
257 --noise-sensitivity=0 \
266 if [ ! -e "${output}" ]; then
267 elog "Output file does not exist."
273 vpxenc_vp9_webm_2pass() {
274 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
275 [ "$(webm_io_available)" = "yes" ]; then
276 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.webm"
277 vpxenc "${YUV_RAW_INPUT}" \
279 --width="${YUV_RAW_INPUT_WIDTH}" \
280 --height="${YUV_RAW_INPUT_HEIGHT}" \
281 --limit="${TEST_FRAMES}" \
282 --output="${output}" \
285 if [ ! -e "${output}" ]; then
286 elog "Output file does not exist."
292 vpxenc_vp9_ivf_lossless() {
293 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
294 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lossless.ivf"
295 vpxenc "${YUV_RAW_INPUT}" \
297 --width="${YUV_RAW_INPUT_WIDTH}" \
298 --height="${YUV_RAW_INPUT_HEIGHT}" \
299 --limit="${TEST_FRAMES}" \
301 --output="${output}" \
304 if [ ! -e "${output}" ]; then
305 elog "Output file does not exist."
311 vpxenc_vp9_ivf_minq0_maxq0() {
312 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
313 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lossless_minq0_maxq0.ivf"
314 vpxenc "${YUV_RAW_INPUT}" \
316 --width="${YUV_RAW_INPUT_WIDTH}" \
317 --height="${YUV_RAW_INPUT_HEIGHT}" \
318 --limit="${TEST_FRAMES}" \
320 --output="${output}" \
324 if [ ! -e "${output}" ]; then
325 elog "Output file does not exist."
331 vpxenc_vp9_webm_lag10_frames20() {
332 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
333 [ "$(webm_io_available)" = "yes" ]; then
334 local readonly lag_total_frames=20
335 local readonly lag_frames=10
336 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lag10_frames20.webm"
337 vpxenc "${YUV_RAW_INPUT}" \
339 --width="${YUV_RAW_INPUT_WIDTH}" \
340 --height="${YUV_RAW_INPUT_HEIGHT}" \
341 --limit="${lag_total_frames}" \
342 --lag-in-frames="${lag_frames}" \
343 --output="${output}" \
347 if [ ! -e "${output}" ]; then
348 elog "Output file does not exist."
354 vpxenc_tests="vpxenc_vp8_ivf
357 vpxenc_vp8_webm_2pass
358 vpxenc_vp8_webm_lag10_frames20
359 vpxenc_vp8_ivf_piped_input
363 vpxenc_vp9_webm_2pass
364 vpxenc_vp9_ivf_lossless
365 vpxenc_vp9_ivf_minq0_maxq0
366 vpxenc_vp9_webm_lag10_frames20"
368 run_tests vpxenc_verify_environment "${vpxenc_tests}"