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"
73 --width="${YUV_RAW_INPUT_WIDTH}" \
74 --height="${YUV_RAW_INPUT_HEIGHT}" \
75 --limit="${TEST_FRAMES}" \
77 --output="${output}" \
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"
92 --width="${YUV_RAW_INPUT_WIDTH}" \
93 --height="${YUV_RAW_INPUT_HEIGHT}" \
94 --limit="${TEST_FRAMES}" \
95 --output="${output}" \
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"
146 --width="${YUV_RAW_INPUT_WIDTH}" \
147 --height="${YUV_RAW_INPUT_HEIGHT}" \
148 --limit="${TEST_FRAMES}" \
149 --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"
167 --width="${YUV_RAW_INPUT_WIDTH}" \
168 --height="${YUV_RAW_INPUT_HEIGHT}" \
169 --limit="${lag_total_frames}" \
170 --lag-in-frames="${lag_frames}" \
171 --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 cat "${YUV_RAW_INPUT}" \
187 | vpxenc --codec=vp8 \
188 --width="${YUV_RAW_INPUT_WIDTH}" \
189 --height="${YUV_RAW_INPUT_HEIGHT}" \
190 --limit="${TEST_FRAMES}" \
192 --output="${output}" \
195 if [ ! -e "${output}" ]; then
196 elog "Output file does not exist."
203 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
204 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.ivf"
206 --width="${YUV_RAW_INPUT_WIDTH}" \
207 --height="${YUV_RAW_INPUT_HEIGHT}" \
208 --limit="${TEST_FRAMES}" \
210 --output="${output}" \
213 if [ ! -e "${output}" ]; then
214 elog "Output file does not exist."
221 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
222 [ "$(webm_io_available)" = "yes" ]; then
223 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.webm"
225 --width="${YUV_RAW_INPUT_WIDTH}" \
226 --height="${YUV_RAW_INPUT_HEIGHT}" \
227 --limit="${TEST_FRAMES}" \
228 --output="${output}" \
231 if [ ! -e "${output}" ]; then
232 elog "Output file does not exist."
238 vpxenc_vp9_webm_rt() {
239 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
240 [ "$(webm_io_available)" = "yes" ]; then
241 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_rt.webm"
242 vpxenc "${YUV_RAW_INPUT}" \
244 --width="${YUV_RAW_INPUT_WIDTH}" \
245 --height="${YUV_RAW_INPUT_HEIGHT}" \
246 --output="${output}" \
247 --buf-initial-sz=500 \
248 --buf-optimal-sz=600 \
252 --error-resilient=1 \
253 --kf-max-dist=90000 \
255 --max-intra-rate=300 \
258 --noise-sensitivity=0 \
267 if [ ! -e "${output}" ]; then
268 elog "Output file does not exist."
274 vpxenc_vp9_webm_2pass() {
275 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
276 [ "$(webm_io_available)" = "yes" ]; then
277 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.webm"
279 --width="${YUV_RAW_INPUT_WIDTH}" \
280 --height="${YUV_RAW_INPUT_HEIGHT}" \
281 --limit="${TEST_FRAMES}" \
282 --output="${output}" \
286 if [ ! -e "${output}" ]; then
287 elog "Output file does not exist."
293 vpxenc_vp9_ivf_lossless() {
294 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
295 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lossless.ivf"
297 --width="${YUV_RAW_INPUT_WIDTH}" \
298 --height="${YUV_RAW_INPUT_HEIGHT}" \
299 --limit="${TEST_FRAMES}" \
301 --output="${output}" \
305 if [ ! -e "${output}" ]; then
306 elog "Output file does not exist."
312 vpxenc_vp9_ivf_minq0_maxq0() {
313 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
314 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lossless_minq0_maxq0.ivf"
316 --width="${YUV_RAW_INPUT_WIDTH}" \
317 --height="${YUV_RAW_INPUT_HEIGHT}" \
318 --limit="${TEST_FRAMES}" \
320 --output="${output}" \
325 if [ ! -e "${output}" ]; then
326 elog "Output file does not exist."
332 vpxenc_vp9_webm_lag10_frames20() {
333 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
334 [ "$(webm_io_available)" = "yes" ]; then
335 local readonly lag_total_frames=20
336 local readonly lag_frames=10
337 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lag10_frames20.webm"
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}" \
348 if [ ! -e "${output}" ]; then
349 elog "Output file does not exist."
355 vpxenc_tests="vpxenc_vp8_ivf
358 vpxenc_vp8_webm_2pass
359 vpxenc_vp8_webm_lag10_frames20
360 vpxenc_vp8_ivf_piped_input
364 vpxenc_vp9_webm_2pass
365 vpxenc_vp9_ivf_lossless
366 vpxenc_vp9_ivf_minq0_maxq0
367 vpxenc_vp9_webm_lag10_frames20"
369 run_tests vpxenc_verify_environment "${vpxenc_tests}"