Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: source/libvpx/test/vpxenc.sh

Issue 484923003: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/test/svc_test.cc ('k') | source/libvpx/vp8/common/rtcd_defs.pl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 ## 2 ##
3 ## Copyright (c) 2014 The WebM project authors. All Rights Reserved. 3 ## Copyright (c) 2014 The WebM project authors. All Rights Reserved.
4 ## 4 ##
5 ## Use of this source code is governed by a BSD-style license 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 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 7 ## tree. An additional intellectual property rights grant can be found
8 ## in the file PATENTS. All contributing project authors may 8 ## in the file PATENTS. All contributing project authors may
9 ## be found in the AUTHORS file in the root of the source tree. 9 ## be found in the AUTHORS file in the root of the source tree.
10 ## 10 ##
11 ## This file tests vpxenc using hantro_collage_w352h288.yuv as input. To add 11 ## This file tests vpxenc using hantro_collage_w352h288.yuv as input. To add
12 ## new tests to this file, do the following: 12 ## new tests to this file, do the following:
13 ## 1. Write a shell function (this is your test). 13 ## 1. Write a shell function (this is your test).
14 ## 2. Add the function to vpxenc_tests (on a new line). 14 ## 2. Add the function to vpxenc_tests (on a new line).
15 ## 15 ##
16 . $(dirname $0)/tools_common.sh 16 . $(dirname $0)/tools_common.sh
17 17
18 readonly TEST_FRAMES=10 18 readonly TEST_FRAMES=10
19 19
20 # Environment check: Make sure input is available. 20 # Environment check: Make sure input is available.
21 vpxenc_verify_environment() { 21 vpxenc_verify_environment() {
22 if [ ! -e "${YUV_RAW_INPUT}" ]; then 22 if [ ! -e "${YUV_RAW_INPUT}" ]; then
23 echo "The file ${YUV_RAW_INPUT##*/} must exist in LIBVPX_TEST_DATA_PATH." 23 elog "The file ${YUV_RAW_INPUT##*/} must exist in LIBVPX_TEST_DATA_PATH."
24 return 1 24 return 1
25 fi 25 fi
26 if [ -z "$(vpx_tool_path vpxenc)" ]; then 26 if [ -z "$(vpx_tool_path vpxenc)" ]; then
27 elog "vpxenc not found. It must exist in LIBVPX_BIN_PATH or its parent." 27 elog "vpxenc not found. It must exist in LIBVPX_BIN_PATH or its parent."
28 return 1 28 return 1
29 fi 29 fi
30 } 30 }
31 31
32 vpxenc_can_encode_vp8() { 32 vpxenc_can_encode_vp8() {
33 if [ "$(vp8_encode_available)" = "yes" ]; then 33 if [ "$(vp8_encode_available)" = "yes" ]; then
34 echo yes 34 echo yes
35 fi 35 fi
36 } 36 }
37 37
38 vpxenc_can_encode_vp9() { 38 vpxenc_can_encode_vp9() {
39 if [ "$(vp9_encode_available)" = "yes" ]; then 39 if [ "$(vp9_encode_available)" = "yes" ]; then
40 echo yes 40 echo yes
41 fi 41 fi
42 } 42 }
43 43
44 # Wrapper function for running vpxenc with pipe input. Requires that 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 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 46 # input file path and shifted away. All remaining parameters are passed through
47 # to vpxenc. 47 # to vpxenc.
48 vpxenc_pipe() { 48 vpxenc_pipe() {
49 local readonly encoder="$(vpx_tool_path vpxenc)" 49 local readonly encoder="$(vpx_tool_path vpxenc)"
50 local readonly input="$1" 50 local readonly input="$1"
51 shift 51 shift
52 cat "${input}" | eval "${VPX_TEST_PREFIX}" "${encoder}" - "$@" ${devnull} 52 cat "${input}" | eval "${VPX_TEST_PREFIX}" "${encoder}" - \
53 --test-decode=fatal \
54 "$@" ${devnull}
53 } 55 }
54 56
55 # Wrapper function for running vpxenc. Requires that LIBVPX_BIN_PATH points to 57 # Wrapper function for running vpxenc. Requires that LIBVPX_BIN_PATH points to
56 # the directory containing vpxenc. $1 one is used as the input file path and 58 # the directory containing vpxenc. $1 one is used as the input file path and
57 # shifted away. All remaining parameters are passed through to vpxenc. 59 # shifted away. All remaining parameters are passed through to vpxenc.
58 vpxenc() { 60 vpxenc() {
59 local readonly encoder="$(vpx_tool_path vpxenc)" 61 local readonly encoder="$(vpx_tool_path vpxenc)"
60 local readonly input="${1}" 62 local readonly input="${1}"
61 shift 63 shift
62 eval "${VPX_TEST_PREFIX}" "${encoder}" "$input" "$@" ${devnull} 64 eval "${VPX_TEST_PREFIX}" "${encoder}" "$input" \
65 --test-decode=fatal \
66 "$@" ${devnull}
63 } 67 }
64 68
65 vpxenc_vp8_ivf() { 69 vpxenc_vp8_ivf() {
66 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then 70 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then
67 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.ivf" 71 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.ivf"
68 vpxenc --codec=vp8 \ 72 vpxenc --codec=vp8 \
69 --width="${YUV_RAW_INPUT_WIDTH}" \ 73 --width="${YUV_RAW_INPUT_WIDTH}" \
70 --height="${YUV_RAW_INPUT_HEIGHT}" \ 74 --height="${YUV_RAW_INPUT_HEIGHT}" \
71 --limit="${TEST_FRAMES}" \ 75 --limit="${TEST_FRAMES}" \
72 --ivf \ 76 --ivf \
73 --output="${output}" \ 77 --output="${output}" \
74 "${YUV_RAW_INPUT}" 78 "${YUV_RAW_INPUT}"
75 79
76 if [ ! -e "${output}" ]; then 80 if [ ! -e "${output}" ]; then
77 elog "Output file does not exist." 81 elog "Output file does not exist."
78 return 1 82 return 1
79 fi 83 fi
80 fi 84 fi
81 } 85 }
82 86
87 vpxenc_vp8_webm() {
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 --codec=vp8 \
92 --width="${YUV_RAW_INPUT_WIDTH}" \
93 --height="${YUV_RAW_INPUT_HEIGHT}" \
94 --limit="${TEST_FRAMES}" \
95 --output="${output}" \
96 "${YUV_RAW_INPUT}"
97
98 if [ ! -e "${output}" ]; then
99 elog "Output file does not exist."
100 return 1
101 fi
102 fi
103 }
104
105 vpxenc_vp8_webm_2pass() {
106 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \
107 [ "$(webm_io_available)" = "yes" ]; then
108 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.webm"
109 vpxenc --codec=vp8 \
110 --width="${YUV_RAW_INPUT_WIDTH}" \
111 --height="${YUV_RAW_INPUT_HEIGHT}" \
112 --limit="${TEST_FRAMES}" \
113 --output="${output}" \
114 --passes=2 \
115 "${YUV_RAW_INPUT}"
116
117 if [ ! -e "${output}" ]; then
118 elog "Output file does not exist."
119 return 1
120 fi
121 fi
122 }
123
124 vpxenc_vp8_webm_lag10_frames20() {
125 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \
126 [ "$(webm_io_available)" = "yes" ]; then
127 local readonly lag_total_frames=20
128 local readonly lag_frames=10
129 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8_lag10_frames20.webm"
130 vpxenc --codec=vp8 \
131 --width="${YUV_RAW_INPUT_WIDTH}" \
132 --height="${YUV_RAW_INPUT_HEIGHT}" \
133 --limit="${lag_total_frames}" \
134 --lag-in-frames="${lag_frames}" \
135 --output="${output}" \
136 --auto-alt-ref=1 \
137 --passes=2 \
138 "${YUV_RAW_INPUT}"
139
140 if [ ! -e "${output}" ]; then
141 elog "Output file does not exist."
142 return 1
143 fi
144 fi
145 }
146
83 vpxenc_vp8_ivf_piped_input() { 147 vpxenc_vp8_ivf_piped_input() {
84 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then 148 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then
85 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8_piped_input.ivf" 149 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8_piped_input.ivf"
86 cat "${YUV_RAW_INPUT}" \ 150 cat "${YUV_RAW_INPUT}" \
87 | vpxenc --codec=vp8 \ 151 | vpxenc --codec=vp8 \
88 --width="${YUV_RAW_INPUT_WIDTH}" \ 152 --width="${YUV_RAW_INPUT_WIDTH}" \
89 --height="${YUV_RAW_INPUT_HEIGHT}" \ 153 --height="${YUV_RAW_INPUT_HEIGHT}" \
90 --limit="${TEST_FRAMES}" \ 154 --limit="${TEST_FRAMES}" \
91 --ivf \ 155 --ivf \
92 --output="${output}" \ 156 --output="${output}" \
93 - 157 -
94 158
95 if [ ! -e "${output}" ]; then 159 if [ ! -e "${output}" ]; then
96 elog "Output file does not exist." 160 elog "Output file does not exist."
97 return 1 161 return 1
98 fi 162 fi
99 fi 163 fi
100 } 164 }
101 165
102 vpxenc_vp8_webm() { 166 vpxenc_vp9_ivf() {
103 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \ 167 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
104 [ "$(webm_io_available)" = "yes" ]; then 168 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.ivf"
105 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.webm" 169 vpxenc --codec=vp9 \
106 vpxenc --codec=vp8 \
107 --width="${YUV_RAW_INPUT_WIDTH}" \ 170 --width="${YUV_RAW_INPUT_WIDTH}" \
108 --height="${YUV_RAW_INPUT_HEIGHT}" \ 171 --height="${YUV_RAW_INPUT_HEIGHT}" \
109 --limit="${TEST_FRAMES}" \ 172 --limit="${TEST_FRAMES}" \
173 --ivf \
110 --output="${output}" \ 174 --output="${output}" \
111 "${YUV_RAW_INPUT}" 175 "${YUV_RAW_INPUT}"
112 176
113 if [ ! -e "${output}" ]; then 177 if [ ! -e "${output}" ]; then
114 elog "Output file does not exist." 178 elog "Output file does not exist."
115 return 1 179 return 1
116 fi 180 fi
117 fi 181 fi
118 } 182 }
119 183
120 vpxenc_vp9_ivf() { 184 vpxenc_vp9_webm() {
121 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then 185 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
122 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.ivf" 186 [ "$(webm_io_available)" = "yes" ]; then
187 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.webm"
123 vpxenc --codec=vp9 \ 188 vpxenc --codec=vp9 \
124 --width="${YUV_RAW_INPUT_WIDTH}" \ 189 --width="${YUV_RAW_INPUT_WIDTH}" \
125 --height="${YUV_RAW_INPUT_HEIGHT}" \ 190 --height="${YUV_RAW_INPUT_HEIGHT}" \
126 --limit="${TEST_FRAMES}" \ 191 --limit="${TEST_FRAMES}" \
127 --ivf \
128 --test-decode=fatal \
129 --output="${output}" \ 192 --output="${output}" \
130 "${YUV_RAW_INPUT}" 193 "${YUV_RAW_INPUT}"
131 194
132 if [ ! -e "${output}" ]; then 195 if [ ! -e "${output}" ]; then
133 elog "Output file does not exist." 196 elog "Output file does not exist."
134 return 1 197 return 1
135 fi 198 fi
136 fi 199 fi
137 } 200 }
138 201
139 vpxenc_vp9_webm() { 202 vpxenc_vp9_webm_2pass() {
140 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \ 203 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
141 [ "$(webm_io_available)" = "yes" ]; then 204 [ "$(webm_io_available)" = "yes" ]; then
142 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.webm" 205 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.webm"
143 vpxenc --codec=vp9 \ 206 vpxenc --codec=vp9 \
144 --width="${YUV_RAW_INPUT_WIDTH}" \ 207 --width="${YUV_RAW_INPUT_WIDTH}" \
145 --height="${YUV_RAW_INPUT_HEIGHT}" \ 208 --height="${YUV_RAW_INPUT_HEIGHT}" \
146 --limit="${TEST_FRAMES}" \ 209 --limit="${TEST_FRAMES}" \
147 --test-decode=fatal \ 210 --test-decode=fatal \
148 --output="${output}" \ 211 --output="${output}" \
212 --passes=2 \
149 "${YUV_RAW_INPUT}" 213 "${YUV_RAW_INPUT}"
150 214
151 if [ ! -e "${output}" ]; then 215 if [ ! -e "${output}" ]; then
152 elog "Output file does not exist." 216 elog "Output file does not exist."
153 return 1 217 return 1
154 fi 218 fi
155 fi 219 fi
156 } 220 }
157 221
158 vpxenc_vp9_ivf_lossless() { 222 vpxenc_vp9_ivf_lossless() {
159 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then 223 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
160 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lossless.ivf" 224 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lossless.ivf"
161 vpxenc --codec=vp9 \ 225 vpxenc --codec=vp9 \
162 --width="${YUV_RAW_INPUT_WIDTH}" \ 226 --width="${YUV_RAW_INPUT_WIDTH}" \
163 --height="${YUV_RAW_INPUT_HEIGHT}" \ 227 --height="${YUV_RAW_INPUT_HEIGHT}" \
164 --limit="${TEST_FRAMES}" \ 228 --limit="${TEST_FRAMES}" \
165 --ivf \ 229 --ivf \
166 --output="${output}" \ 230 --output="${output}" \
167 --lossless=1 \ 231 --lossless=1 \
168 --test-decode=fatal \
169 "${YUV_RAW_INPUT}" 232 "${YUV_RAW_INPUT}"
170 233
171 if [ ! -e "${output}" ]; then 234 if [ ! -e "${output}" ]; then
172 elog "Output file does not exist." 235 elog "Output file does not exist."
173 return 1 236 return 1
174 fi 237 fi
175 fi 238 fi
176 } 239 }
177 240
178 vpxenc_vp9_ivf_minq0_maxq0() { 241 vpxenc_vp9_ivf_minq0_maxq0() {
179 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then 242 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then
180 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lossless_minq0_maxq0.ivf" 243 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lossless_minq0_maxq0.ivf"
181 vpxenc --codec=vp9 \ 244 vpxenc --codec=vp9 \
182 --width="${YUV_RAW_INPUT_WIDTH}" \ 245 --width="${YUV_RAW_INPUT_WIDTH}" \
183 --height="${YUV_RAW_INPUT_HEIGHT}" \ 246 --height="${YUV_RAW_INPUT_HEIGHT}" \
184 --limit="${TEST_FRAMES}" \ 247 --limit="${TEST_FRAMES}" \
185 --ivf \ 248 --ivf \
186 --output="${output}" \ 249 --output="${output}" \
187 --min-q=0 \ 250 --min-q=0 \
188 --max-q=0 \ 251 --max-q=0 \
189 --test-decode=fatal \
190 "${YUV_RAW_INPUT}" 252 "${YUV_RAW_INPUT}"
191 253
192 if [ ! -e "${output}" ]; then 254 if [ ! -e "${output}" ]; then
255 elog "Output file does not exist."
256 return 1
257 fi
258 fi
259 }
260
261 vpxenc_vp9_webm_lag10_frames20() {
262 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \
263 [ "$(webm_io_available)" = "yes" ]; then
264 local readonly lag_total_frames=20
265 local readonly lag_frames=10
266 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lag10_frames20.webm"
267 vpxenc --codec=vp9 \
268 --width="${YUV_RAW_INPUT_WIDTH}" \
269 --height="${YUV_RAW_INPUT_HEIGHT}" \
270 --limit="${lag_total_frames}" \
271 --lag-in-frames="${lag_frames}" \
272 --output="${output}" \
273 --test-decode=fatal \
274 --passes=2 \
275 --auto-alt-ref=1 \
276 "${YUV_RAW_INPUT}"
277
278 if [ ! -e "${output}" ]; then
193 elog "Output file does not exist." 279 elog "Output file does not exist."
194 return 1 280 return 1
195 fi 281 fi
196 fi 282 fi
197 } 283 }
198 284
199 vpxenc_tests="vpxenc_vp8_ivf 285 vpxenc_tests="vpxenc_vp8_ivf
200 vpxenc_vp8_webm 286 vpxenc_vp8_webm
287 vpxenc_vp8_webm_2pass
288 vpxenc_vp8_webm_lag10_frames20
201 vpxenc_vp8_ivf_piped_input 289 vpxenc_vp8_ivf_piped_input
202 vpxenc_vp9_ivf 290 vpxenc_vp9_ivf
203 vpxenc_vp9_webm 291 vpxenc_vp9_webm
292 vpxenc_vp9_webm_2pass
204 vpxenc_vp9_ivf_lossless 293 vpxenc_vp9_ivf_lossless
205 vpxenc_vp9_ivf_minq0_maxq0" 294 vpxenc_vp9_ivf_minq0_maxq0
295 vpxenc_vp9_webm_lag10_frames20"
206 296
207 run_tests vpxenc_verify_environment "${vpxenc_tests}" 297 run_tests vpxenc_verify_environment "${vpxenc_tests}"
OLDNEW
« no previous file with comments | « source/libvpx/test/svc_test.cc ('k') | source/libvpx/vp8/common/rtcd_defs.pl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698