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 the libvpx vpx_temporal_svc_encoder example. To add new
12 ## tests to this file, do the following:
13 ## 1. Write a shell function (this is your test).
14 ## 2. Add the function to vpx_tsvc_encoder_tests (on a new line).
16 . $
(dirname $0)/tools_common.sh
18 # Environment check: $YUV_RAW_INPUT is required.
19 vpx_tsvc_encoder_verify_environment
() {
20 if [ ! -e "${YUV_RAW_INPUT}" ]; then
21 echo "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
24 if [ "$(vpx_config_option_enabled CONFIG_TEMPORAL_DENOISING)" != "yes" ]; then
25 elog
"Warning: Temporal denoising is disabled! Spatial denoising will be " \
26 "used instead, which is probably not what you want for this test."
30 # Runs vpx_temporal_svc_encoder using the codec specified by $1 and output file
31 # name by $2. Additional positional parameters are passed directly to
32 # vpx_temporal_svc_encoder.
34 local encoder
="${LIBVPX_BIN_PATH}/vpx_temporal_svc_encoder"
35 encoder
="${encoder}${VPX_TEST_EXE_SUFFIX}"
37 local output_file_base
="$2"
38 local output_file
="${VPX_TEST_OUTPUT_DIR}/${output_file_base}"
39 local timebase_num
="1"
40 local timebase_den
="1000"
42 local frame_drop_thresh
="30"
46 if [ ! -x "${encoder}" ]; then
47 elog
"${encoder} does not exist or is not executable."
51 eval "${VPX_TEST_PREFIX}" "${encoder}" "${YUV_RAW_INPUT}" "${output_file}" \
52 "${codec}" "${YUV_RAW_INPUT_WIDTH}" "${YUV_RAW_INPUT_HEIGHT}" \
53 "${timebase_num}" "${timebase_den}" "${speed}" "${frame_drop_thresh}" \
58 # Confirms that all expected output files exist given the output file name
59 # passed to vpx_temporal_svc_encoder.
60 # The file name passed to vpx_temporal_svc_encoder is joined with the stream
61 # number and the extension .ivf to produce per stream output files. Here $1 is
62 # file name, and $2 is expected number of files.
64 local file_name
="${VPX_TEST_OUTPUT_DIR}/$1"
65 local num_files
="$(($2 - 1))"
66 for stream_num
in $
(seq 0 ${num_files}); do
67 [ -e "${file_name}_${stream_num}.ivf" ] ||
return 1
71 # Run vpx_temporal_svc_encoder in all supported modes for vp8 and vp9.
73 vpx_tsvc_encoder_vp8_mode_0
() {
74 if [ "$(vp8_encode_available)" = "yes" ]; then
75 vpx_tsvc_encoder vp8
"${FUNCNAME}" 0 200 ||
return 1
76 # Mode 0 produces 1 stream
77 files_exist
"${FUNCNAME}" 1 ||
return 1
81 vpx_tsvc_encoder_vp8_mode_1
() {
82 if [ "$(vp8_encode_available)" = "yes" ]; then
83 vpx_tsvc_encoder vp8
"${FUNCNAME}" 1 200 400 ||
return 1
84 # Mode 1 produces 2 streams
85 files_exist
"${FUNCNAME}" 2 ||
return 1
89 vpx_tsvc_encoder_vp8_mode_2
() {
90 if [ "$(vp8_encode_available)" = "yes" ]; then
91 vpx_tsvc_encoder vp8
"${FUNCNAME}" 2 200 400 ||
return 1
92 # Mode 2 produces 2 streams
93 files_exist
"${FUNCNAME}" 2 ||
return 1
97 vpx_tsvc_encoder_vp8_mode_3
() {
98 if [ "$(vp8_encode_available)" = "yes" ]; then
99 vpx_tsvc_encoder vp8
"${FUNCNAME}" 3 200 400 600 ||
return 1
100 # Mode 3 produces 3 streams
101 files_exist
"${FUNCNAME}" 3 ||
return 1
105 vpx_tsvc_encoder_vp8_mode_4
() {
106 if [ "$(vp8_encode_available)" = "yes" ]; then
107 vpx_tsvc_encoder vp8
"${FUNCNAME}" 4 200 400 600 ||
return 1
108 # Mode 4 produces 3 streams
109 files_exist
"${FUNCNAME}" 3 ||
return 1
113 vpx_tsvc_encoder_vp8_mode_5
() {
114 if [ "$(vp8_encode_available)" = "yes" ]; then
115 vpx_tsvc_encoder vp8
"${FUNCNAME}" 5 200 400 600 ||
return 1
116 # Mode 5 produces 3 streams
117 files_exist
"${FUNCNAME}" 3 ||
return 1
121 vpx_tsvc_encoder_vp8_mode_6
() {
122 if [ "$(vp8_encode_available)" = "yes" ]; then
123 vpx_tsvc_encoder vp8
"${FUNCNAME}" 6 200 400 600 ||
return 1
124 # Mode 6 produces 3 streams
125 files_exist
"${FUNCNAME}" 3 ||
return 1
129 vpx_tsvc_encoder_vp8_mode_7
() {
130 if [ "$(vp8_encode_available)" = "yes" ]; then
131 vpx_tsvc_encoder vp8
"${FUNCNAME}" 7 200 400 600 800 1000 ||
return 1
132 # Mode 7 produces 5 streams
133 files_exist
"${FUNCNAME}" 5 ||
return 1
137 vpx_tsvc_encoder_vp8_mode_8
() {
138 if [ "$(vp8_encode_available)" = "yes" ]; then
139 vpx_tsvc_encoder vp8
"${FUNCNAME}" 8 200 400 ||
return 1
140 # Mode 8 produces 2 streams
141 files_exist
"${FUNCNAME}" 2 ||
return 1
145 vpx_tsvc_encoder_vp8_mode_9
() {
146 if [ "$(vp8_encode_available)" = "yes" ]; then
147 vpx_tsvc_encoder vp8
"${FUNCNAME}" 9 200 400 600 ||
return 1
148 # Mode 9 produces 3 streams
149 files_exist
"${FUNCNAME}" 3 ||
return 1
153 vpx_tsvc_encoder_vp8_mode_10
() {
154 if [ "$(vp8_encode_available)" = "yes" ]; then
155 vpx_tsvc_encoder vp8
"${FUNCNAME}" 10 200 400 600 ||
return 1
156 # Mode 10 produces 3 streams
157 files_exist
"${FUNCNAME}" 3 ||
return 1
161 vpx_tsvc_encoder_vp8_mode_11
() {
162 if [ "$(vp8_encode_available)" = "yes" ]; then
163 vpx_tsvc_encoder vp8
"${FUNCNAME}" 11 200 400 600 ||
return 1
164 # Mode 11 produces 3 streams
165 files_exist
"${FUNCNAME}" 3 ||
return 1
169 vpx_tsvc_encoder_vp9_mode_0
() {
170 if [ "$(vp9_encode_available)" = "yes" ]; then
171 vpx_tsvc_encoder vp9
"${FUNCNAME}" 0 200 ||
return 1
172 # Mode 0 produces 1 stream
173 files_exist
"${FUNCNAME}" 1 ||
return 1
177 vpx_tsvc_encoder_vp9_mode_1
() {
178 if [ "$(vp9_encode_available)" = "yes" ]; then
179 vpx_tsvc_encoder vp9
"${FUNCNAME}" 1 200 400 ||
return 1
180 # Mode 1 produces 2 streams
181 files_exist
"${FUNCNAME}" 2 ||
return 1
185 vpx_tsvc_encoder_vp9_mode_2
() {
186 if [ "$(vp9_encode_available)" = "yes" ]; then
187 vpx_tsvc_encoder vp9
"${FUNCNAME}" 2 200 400 ||
return 1
188 # Mode 2 produces 2 streams
189 files_exist
"${FUNCNAME}" 2 ||
return 1
193 vpx_tsvc_encoder_vp9_mode_3
() {
194 if [ "$(vp9_encode_available)" = "yes" ]; then
195 vpx_tsvc_encoder vp9
"${FUNCNAME}" 3 200 400 600 ||
return 1
196 # Mode 3 produces 3 streams
197 files_exist
"${FUNCNAME}" 3 ||
return 1
201 vpx_tsvc_encoder_vp9_mode_4
() {
202 if [ "$(vp9_encode_available)" = "yes" ]; then
203 vpx_tsvc_encoder vp9
"${FUNCNAME}" 4 200 400 600 ||
return 1
204 # Mode 4 produces 3 streams
205 files_exist
"${FUNCNAME}" 3 ||
return 1
209 vpx_tsvc_encoder_vp9_mode_5
() {
210 if [ "$(vp9_encode_available)" = "yes" ]; then
211 vpx_tsvc_encoder vp9
"${FUNCNAME}" 5 200 400 600 ||
return 1
212 # Mode 5 produces 3 streams
213 files_exist
"${FUNCNAME}" 3 ||
return 1
217 vpx_tsvc_encoder_vp9_mode_6
() {
218 if [ "$(vp9_encode_available)" = "yes" ]; then
219 vpx_tsvc_encoder vp9
"${FUNCNAME}" 6 200 400 600 ||
return 1
220 # Mode 6 produces 3 streams
221 files_exist
"${FUNCNAME}" 3 ||
return 1
225 vpx_tsvc_encoder_vp9_mode_7
() {
226 if [ "$(vp9_encode_available)" = "yes" ]; then
227 vpx_tsvc_encoder vp9
"${FUNCNAME}" 7 200 400 600 800 1000 ||
return 1
228 # Mode 7 produces 5 streams
229 files_exist
"${FUNCNAME}" 5 ||
return 1
233 vpx_tsvc_encoder_vp9_mode_8
() {
234 if [ "$(vp9_encode_available)" = "yes" ]; then
235 vpx_tsvc_encoder vp9
"${FUNCNAME}" 8 200 400 ||
return 1
236 # Mode 8 produces 2 streams
237 files_exist
"${FUNCNAME}" 2 ||
return 1
241 vpx_tsvc_encoder_vp9_mode_9
() {
242 if [ "$(vp9_encode_available)" = "yes" ]; then
243 vpx_tsvc_encoder vp9
"${FUNCNAME}" 9 200 400 600 ||
return 1
244 # Mode 9 produces 3 streams
245 files_exist
"${FUNCNAME}" 3 ||
return 1
249 vpx_tsvc_encoder_vp9_mode_10
() {
250 if [ "$(vp9_encode_available)" = "yes" ]; then
251 vpx_tsvc_encoder vp9
"${FUNCNAME}" 10 200 400 600 ||
return 1
252 # Mode 10 produces 3 streams
253 files_exist
"${FUNCNAME}" 3 ||
return 1
257 vpx_tsvc_encoder_vp9_mode_11
() {
258 if [ "$(vp9_encode_available)" = "yes" ]; then
259 vpx_tsvc_encoder vp9
"${FUNCNAME}" 11 200 400 600 ||
return 1
260 # Mode 11 produces 3 streams
261 files_exist
"${FUNCNAME}" 3 ||
return 1
265 vpx_tsvc_encoder_tests
="vpx_tsvc_encoder_vp8_mode_0
266 vpx_tsvc_encoder_vp8_mode_1
267 vpx_tsvc_encoder_vp8_mode_2
268 vpx_tsvc_encoder_vp8_mode_3
269 vpx_tsvc_encoder_vp8_mode_4
270 vpx_tsvc_encoder_vp8_mode_5
271 vpx_tsvc_encoder_vp8_mode_6
272 vpx_tsvc_encoder_vp8_mode_7
273 vpx_tsvc_encoder_vp8_mode_8
274 vpx_tsvc_encoder_vp8_mode_9
275 vpx_tsvc_encoder_vp8_mode_10
276 vpx_tsvc_encoder_vp8_mode_11
277 vpx_tsvc_encoder_vp9_mode_0
278 vpx_tsvc_encoder_vp9_mode_1
279 vpx_tsvc_encoder_vp9_mode_2
280 vpx_tsvc_encoder_vp9_mode_3
281 vpx_tsvc_encoder_vp9_mode_4
282 vpx_tsvc_encoder_vp9_mode_5
283 vpx_tsvc_encoder_vp9_mode_6
284 vpx_tsvc_encoder_vp9_mode_7
285 vpx_tsvc_encoder_vp9_mode_8
286 vpx_tsvc_encoder_vp9_mode_9
287 vpx_tsvc_encoder_vp9_mode_10
288 vpx_tsvc_encoder_vp9_mode_11"
290 run_tests vpx_tsvc_encoder_verify_environment
"${vpx_tsvc_encoder_tests}"