OLD | NEW |
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 ## |
(...skipping 23 matching lines...) Expand all Loading... |
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 # Echo vpxenc command line parameters allowing use of |
| 45 # hantro_collage_w352h288.yuv as input. |
| 46 yuv_input_hantro_collage() { |
| 47 echo ""${YUV_RAW_INPUT}" |
| 48 --width="${YUV_RAW_INPUT_WIDTH}" |
| 49 --height="${YUV_RAW_INPUT_HEIGHT}"" |
| 50 } |
| 51 |
| 52 # Echo default vpxenc real time encoding params. $1 is the codec, which defaults |
| 53 # to vp8 if unspecified. |
| 54 vpxenc_rt_params() { |
| 55 local readonly codec="${1:-vp8}" |
| 56 echo "--codec=${codec} |
| 57 --buf-initial-sz=500 |
| 58 --buf-optimal-sz=600 |
| 59 --buf-sz=1000 |
| 60 --cpu-used=-5 |
| 61 --end-usage=cbr |
| 62 --error-resilient=1 |
| 63 --kf-max-dist=90000 |
| 64 --lag-in-frames=0 |
| 65 --max-intra-rate=300 |
| 66 --max-q=56 |
| 67 --min-q=2 |
| 68 --noise-sensitivity=0 |
| 69 --overshoot-pct=50 |
| 70 --passes=1 |
| 71 --profile=0 |
| 72 --resize-allowed=0 |
| 73 --rt |
| 74 --static-thresh=0 |
| 75 --undershoot-pct=50" |
| 76 } |
| 77 |
44 # Wrapper function for running vpxenc with pipe input. Requires that | 78 # 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 | 79 # 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 | 80 # input file path and shifted away. All remaining parameters are passed through |
47 # to vpxenc. | 81 # to vpxenc. |
48 vpxenc_pipe() { | 82 vpxenc_pipe() { |
49 local readonly encoder="$(vpx_tool_path vpxenc)" | 83 local readonly encoder="$(vpx_tool_path vpxenc)" |
50 local readonly input="$1" | 84 local readonly input="$1" |
51 shift | 85 shift |
52 cat "${input}" | eval "${VPX_TEST_PREFIX}" "${encoder}" - \ | 86 cat "${input}" | eval "${VPX_TEST_PREFIX}" "${encoder}" - \ |
53 --test-decode=fatal \ | 87 --test-decode=fatal \ |
54 "$@" ${devnull} | 88 "$@" ${devnull} |
55 } | 89 } |
56 | 90 |
57 # Wrapper function for running vpxenc. Requires that LIBVPX_BIN_PATH points to | 91 # 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 | 92 # 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. | 93 # shifted away. All remaining parameters are passed through to vpxenc. |
60 vpxenc() { | 94 vpxenc() { |
61 local readonly encoder="$(vpx_tool_path vpxenc)" | 95 local readonly encoder="$(vpx_tool_path vpxenc)" |
62 local readonly input="${1}" | 96 local readonly input="$1" |
63 shift | 97 shift |
64 eval "${VPX_TEST_PREFIX}" "${encoder}" "$input" \ | 98 eval "${VPX_TEST_PREFIX}" "${encoder}" "${input}" \ |
65 --test-decode=fatal \ | 99 --test-decode=fatal \ |
66 "$@" ${devnull} | 100 "$@" ${devnull} |
67 } | 101 } |
68 | 102 |
69 vpxenc_vp8_ivf() { | 103 vpxenc_vp8_ivf() { |
70 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then | 104 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then |
71 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.ivf" | 105 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.ivf" |
72 vpxenc --codec=vp8 \ | 106 vpxenc $(yuv_input_hantro_collage) \ |
73 --width="${YUV_RAW_INPUT_WIDTH}" \ | 107 --codec=vp8 \ |
74 --height="${YUV_RAW_INPUT_HEIGHT}" \ | |
75 --limit="${TEST_FRAMES}" \ | 108 --limit="${TEST_FRAMES}" \ |
76 --ivf \ | 109 --ivf \ |
77 --output="${output}" \ | 110 --output="${output}" |
78 "${YUV_RAW_INPUT}" | |
79 | 111 |
80 if [ ! -e "${output}" ]; then | 112 if [ ! -e "${output}" ]; then |
81 elog "Output file does not exist." | 113 elog "Output file does not exist." |
82 return 1 | 114 return 1 |
83 fi | 115 fi |
84 fi | 116 fi |
85 } | 117 } |
86 | 118 |
87 vpxenc_vp8_webm() { | 119 vpxenc_vp8_webm() { |
88 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \ | 120 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \ |
89 [ "$(webm_io_available)" = "yes" ]; then | 121 [ "$(webm_io_available)" = "yes" ]; then |
90 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.webm" | 122 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.webm" |
91 vpxenc --codec=vp8 \ | 123 vpxenc $(yuv_input_hantro_collage) \ |
92 --width="${YUV_RAW_INPUT_WIDTH}" \ | 124 --codec=vp8 \ |
93 --height="${YUV_RAW_INPUT_HEIGHT}" \ | |
94 --limit="${TEST_FRAMES}" \ | 125 --limit="${TEST_FRAMES}" \ |
95 --output="${output}" \ | 126 --output="${output}" |
96 "${YUV_RAW_INPUT}" | |
97 | 127 |
98 if [ ! -e "${output}" ]; then | 128 if [ ! -e "${output}" ]; then |
99 elog "Output file does not exist." | 129 elog "Output file does not exist." |
100 return 1 | 130 return 1 |
101 fi | 131 fi |
102 fi | 132 fi |
103 } | 133 } |
104 | 134 |
| 135 vpxenc_vp8_webm_rt() { |
| 136 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \ |
| 137 [ "$(webm_io_available)" = "yes" ]; then |
| 138 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8_rt.webm" |
| 139 vpxenc $(yuv_input_hantro_collage) \ |
| 140 $(vpxenc_rt_params vp8) \ |
| 141 --output="${output}" |
| 142 if [ ! -e "${output}" ]; then |
| 143 elog "Output file does not exist." |
| 144 return 1 |
| 145 fi |
| 146 fi |
| 147 } |
| 148 |
105 vpxenc_vp8_webm_2pass() { | 149 vpxenc_vp8_webm_2pass() { |
106 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \ | 150 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \ |
107 [ "$(webm_io_available)" = "yes" ]; then | 151 [ "$(webm_io_available)" = "yes" ]; then |
108 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.webm" | 152 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.webm" |
109 vpxenc --codec=vp8 \ | 153 vpxenc $(yuv_input_hantro_collage) \ |
110 --width="${YUV_RAW_INPUT_WIDTH}" \ | 154 --codec=vp8 \ |
111 --height="${YUV_RAW_INPUT_HEIGHT}" \ | |
112 --limit="${TEST_FRAMES}" \ | 155 --limit="${TEST_FRAMES}" \ |
113 --output="${output}" \ | 156 --output="${output}" \ |
114 --passes=2 \ | 157 --passes=2 |
115 "${YUV_RAW_INPUT}" | |
116 | 158 |
117 if [ ! -e "${output}" ]; then | 159 if [ ! -e "${output}" ]; then |
118 elog "Output file does not exist." | 160 elog "Output file does not exist." |
119 return 1 | 161 return 1 |
120 fi | 162 fi |
121 fi | 163 fi |
122 } | 164 } |
123 | 165 |
124 vpxenc_vp8_webm_lag10_frames20() { | 166 vpxenc_vp8_webm_lag10_frames20() { |
125 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \ | 167 if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \ |
126 [ "$(webm_io_available)" = "yes" ]; then | 168 [ "$(webm_io_available)" = "yes" ]; then |
127 local readonly lag_total_frames=20 | 169 local readonly lag_total_frames=20 |
128 local readonly lag_frames=10 | 170 local readonly lag_frames=10 |
129 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8_lag10_frames20.webm" | 171 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8_lag10_frames20.webm" |
130 vpxenc --codec=vp8 \ | 172 vpxenc $(yuv_input_hantro_collage) \ |
131 --width="${YUV_RAW_INPUT_WIDTH}" \ | 173 --codec=vp8 \ |
132 --height="${YUV_RAW_INPUT_HEIGHT}" \ | |
133 --limit="${lag_total_frames}" \ | 174 --limit="${lag_total_frames}" \ |
134 --lag-in-frames="${lag_frames}" \ | 175 --lag-in-frames="${lag_frames}" \ |
135 --output="${output}" \ | 176 --output="${output}" \ |
136 --auto-alt-ref=1 \ | 177 --auto-alt-ref=1 \ |
137 --passes=2 \ | 178 --passes=2 |
138 "${YUV_RAW_INPUT}" | |
139 | 179 |
140 if [ ! -e "${output}" ]; then | 180 if [ ! -e "${output}" ]; then |
141 elog "Output file does not exist." | 181 elog "Output file does not exist." |
142 return 1 | 182 return 1 |
143 fi | 183 fi |
144 fi | 184 fi |
145 } | 185 } |
146 | 186 |
147 vpxenc_vp8_ivf_piped_input() { | 187 vpxenc_vp8_ivf_piped_input() { |
148 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then | 188 if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then |
149 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8_piped_input.ivf" | 189 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8_piped_input.ivf" |
150 cat "${YUV_RAW_INPUT}" \ | 190 vpxenc_pipe $(yuv_input_hantro_collage) \ |
151 | vpxenc --codec=vp8 \ | 191 --codec=vp8 \ |
152 --width="${YUV_RAW_INPUT_WIDTH}" \ | 192 --limit="${TEST_FRAMES}" \ |
153 --height="${YUV_RAW_INPUT_HEIGHT}" \ | 193 --ivf \ |
154 --limit="${TEST_FRAMES}" \ | 194 --output="${output}" |
155 --ivf \ | |
156 --output="${output}" \ | |
157 - | |
158 | 195 |
159 if [ ! -e "${output}" ]; then | 196 if [ ! -e "${output}" ]; then |
160 elog "Output file does not exist." | 197 elog "Output file does not exist." |
161 return 1 | 198 return 1 |
162 fi | 199 fi |
163 fi | 200 fi |
164 } | 201 } |
165 | 202 |
166 vpxenc_vp9_ivf() { | 203 vpxenc_vp9_ivf() { |
167 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then | 204 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then |
168 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.ivf" | 205 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.ivf" |
169 vpxenc --codec=vp9 \ | 206 vpxenc $(yuv_input_hantro_collage) \ |
170 --width="${YUV_RAW_INPUT_WIDTH}" \ | 207 --codec=vp9 \ |
171 --height="${YUV_RAW_INPUT_HEIGHT}" \ | |
172 --limit="${TEST_FRAMES}" \ | 208 --limit="${TEST_FRAMES}" \ |
173 --ivf \ | 209 --ivf \ |
174 --output="${output}" \ | 210 --output="${output}" |
175 "${YUV_RAW_INPUT}" | |
176 | 211 |
177 if [ ! -e "${output}" ]; then | 212 if [ ! -e "${output}" ]; then |
178 elog "Output file does not exist." | 213 elog "Output file does not exist." |
179 return 1 | 214 return 1 |
180 fi | 215 fi |
181 fi | 216 fi |
182 } | 217 } |
183 | 218 |
184 vpxenc_vp9_webm() { | 219 vpxenc_vp9_webm() { |
185 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \ | 220 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \ |
186 [ "$(webm_io_available)" = "yes" ]; then | 221 [ "$(webm_io_available)" = "yes" ]; then |
187 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.webm" | 222 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.webm" |
188 vpxenc --codec=vp9 \ | 223 vpxenc $(yuv_input_hantro_collage) \ |
189 --width="${YUV_RAW_INPUT_WIDTH}" \ | 224 --codec=vp9 \ |
190 --height="${YUV_RAW_INPUT_HEIGHT}" \ | |
191 --limit="${TEST_FRAMES}" \ | 225 --limit="${TEST_FRAMES}" \ |
192 --output="${output}" \ | 226 --output="${output}" |
193 "${YUV_RAW_INPUT}" | |
194 | 227 |
195 if [ ! -e "${output}" ]; then | 228 if [ ! -e "${output}" ]; then |
196 elog "Output file does not exist." | 229 elog "Output file does not exist." |
197 return 1 | 230 return 1 |
198 fi | 231 fi |
199 fi | 232 fi |
200 } | 233 } |
201 | 234 |
| 235 vpxenc_vp9_webm_rt() { |
| 236 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \ |
| 237 [ "$(webm_io_available)" = "yes" ]; then |
| 238 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_rt.webm" |
| 239 vpxenc $(yuv_input_hantro_collage) \ |
| 240 $(vpxenc_rt_params vp9) \ |
| 241 --output="${output}" |
| 242 |
| 243 if [ ! -e "${output}" ]; then |
| 244 elog "Output file does not exist." |
| 245 return 1 |
| 246 fi |
| 247 fi |
| 248 } |
| 249 |
202 vpxenc_vp9_webm_2pass() { | 250 vpxenc_vp9_webm_2pass() { |
203 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \ | 251 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \ |
204 [ "$(webm_io_available)" = "yes" ]; then | 252 [ "$(webm_io_available)" = "yes" ]; then |
205 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.webm" | 253 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.webm" |
206 vpxenc --codec=vp9 \ | 254 vpxenc $(yuv_input_hantro_collage) \ |
207 --width="${YUV_RAW_INPUT_WIDTH}" \ | 255 --codec=vp9 \ |
208 --height="${YUV_RAW_INPUT_HEIGHT}" \ | |
209 --limit="${TEST_FRAMES}" \ | 256 --limit="${TEST_FRAMES}" \ |
210 --test-decode=fatal \ | |
211 --output="${output}" \ | 257 --output="${output}" \ |
212 --passes=2 \ | 258 --passes=2 |
213 "${YUV_RAW_INPUT}" | |
214 | 259 |
215 if [ ! -e "${output}" ]; then | 260 if [ ! -e "${output}" ]; then |
216 elog "Output file does not exist." | 261 elog "Output file does not exist." |
217 return 1 | 262 return 1 |
218 fi | 263 fi |
219 fi | 264 fi |
220 } | 265 } |
221 | 266 |
222 vpxenc_vp9_ivf_lossless() { | 267 vpxenc_vp9_ivf_lossless() { |
223 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then | 268 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then |
224 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lossless.ivf" | 269 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lossless.ivf" |
225 vpxenc --codec=vp9 \ | 270 vpxenc $(yuv_input_hantro_collage) \ |
226 --width="${YUV_RAW_INPUT_WIDTH}" \ | 271 --codec=vp9 \ |
227 --height="${YUV_RAW_INPUT_HEIGHT}" \ | |
228 --limit="${TEST_FRAMES}" \ | 272 --limit="${TEST_FRAMES}" \ |
229 --ivf \ | 273 --ivf \ |
230 --output="${output}" \ | 274 --output="${output}" \ |
231 --lossless=1 \ | 275 --lossless=1 |
232 "${YUV_RAW_INPUT}" | |
233 | 276 |
234 if [ ! -e "${output}" ]; then | 277 if [ ! -e "${output}" ]; then |
235 elog "Output file does not exist." | 278 elog "Output file does not exist." |
236 return 1 | 279 return 1 |
237 fi | 280 fi |
238 fi | 281 fi |
239 } | 282 } |
240 | 283 |
241 vpxenc_vp9_ivf_minq0_maxq0() { | 284 vpxenc_vp9_ivf_minq0_maxq0() { |
242 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then | 285 if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then |
243 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lossless_minq0_maxq0.ivf" | 286 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lossless_minq0_maxq0.ivf" |
244 vpxenc --codec=vp9 \ | 287 vpxenc $(yuv_input_hantro_collage) \ |
245 --width="${YUV_RAW_INPUT_WIDTH}" \ | 288 --codec=vp9 \ |
246 --height="${YUV_RAW_INPUT_HEIGHT}" \ | |
247 --limit="${TEST_FRAMES}" \ | 289 --limit="${TEST_FRAMES}" \ |
248 --ivf \ | 290 --ivf \ |
249 --output="${output}" \ | 291 --output="${output}" \ |
250 --min-q=0 \ | 292 --min-q=0 \ |
251 --max-q=0 \ | 293 --max-q=0 |
252 "${YUV_RAW_INPUT}" | |
253 | 294 |
254 if [ ! -e "${output}" ]; then | 295 if [ ! -e "${output}" ]; then |
255 elog "Output file does not exist." | 296 elog "Output file does not exist." |
256 return 1 | 297 return 1 |
257 fi | 298 fi |
258 fi | 299 fi |
259 } | 300 } |
260 | 301 |
261 vpxenc_vp9_webm_lag10_frames20() { | 302 vpxenc_vp9_webm_lag10_frames20() { |
262 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \ | 303 if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \ |
263 [ "$(webm_io_available)" = "yes" ]; then | 304 [ "$(webm_io_available)" = "yes" ]; then |
264 local readonly lag_total_frames=20 | 305 local readonly lag_total_frames=20 |
265 local readonly lag_frames=10 | 306 local readonly lag_frames=10 |
266 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lag10_frames20.webm" | 307 local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lag10_frames20.webm" |
267 vpxenc --codec=vp9 \ | 308 vpxenc $(yuv_input_hantro_collage) \ |
268 --width="${YUV_RAW_INPUT_WIDTH}" \ | 309 --codec=vp9 \ |
269 --height="${YUV_RAW_INPUT_HEIGHT}" \ | |
270 --limit="${lag_total_frames}" \ | 310 --limit="${lag_total_frames}" \ |
271 --lag-in-frames="${lag_frames}" \ | 311 --lag-in-frames="${lag_frames}" \ |
272 --output="${output}" \ | 312 --output="${output}" \ |
273 --test-decode=fatal \ | |
274 --passes=2 \ | 313 --passes=2 \ |
275 --auto-alt-ref=1 \ | 314 --auto-alt-ref=1 |
276 "${YUV_RAW_INPUT}" | |
277 | 315 |
278 if [ ! -e "${output}" ]; then | 316 if [ ! -e "${output}" ]; then |
279 elog "Output file does not exist." | 317 elog "Output file does not exist." |
280 return 1 | 318 return 1 |
281 fi | 319 fi |
282 fi | 320 fi |
283 } | 321 } |
284 | 322 |
285 vpxenc_tests="vpxenc_vp8_ivf | 323 vpxenc_tests="vpxenc_vp8_ivf |
286 vpxenc_vp8_webm | 324 vpxenc_vp8_webm |
| 325 vpxenc_vp8_webm_rt |
287 vpxenc_vp8_webm_2pass | 326 vpxenc_vp8_webm_2pass |
288 vpxenc_vp8_webm_lag10_frames20 | 327 vpxenc_vp8_webm_lag10_frames20 |
289 vpxenc_vp8_ivf_piped_input | 328 vpxenc_vp8_ivf_piped_input |
290 vpxenc_vp9_ivf | 329 vpxenc_vp9_ivf |
291 vpxenc_vp9_webm | 330 vpxenc_vp9_webm |
| 331 vpxenc_vp9_webm_rt |
292 vpxenc_vp9_webm_2pass | 332 vpxenc_vp9_webm_2pass |
293 vpxenc_vp9_ivf_lossless | 333 vpxenc_vp9_ivf_lossless |
294 vpxenc_vp9_ivf_minq0_maxq0 | 334 vpxenc_vp9_ivf_minq0_maxq0 |
295 vpxenc_vp9_webm_lag10_frames20" | 335 vpxenc_vp9_webm_lag10_frames20" |
296 | 336 |
297 run_tests vpxenc_verify_environment "${vpxenc_tests}" | 337 run_tests vpxenc_verify_environment "${vpxenc_tests}" |
OLD | NEW |