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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 # Echoes yes when output of test_configuration_target() contains win32 or win64. | 139 # Echoes yes when output of test_configuration_target() contains win32 or win64. |
140 is_windows_target() { | 140 is_windows_target() { |
141 if test_configuration_target \ | 141 if test_configuration_target \ |
142 | grep -q -e win32 -e win64 > /dev/null 2>&1; then | 142 | grep -q -e win32 -e win64 > /dev/null 2>&1; then |
143 echo yes | 143 echo yes |
144 fi | 144 fi |
145 } | 145 } |
146 | 146 |
| 147 # Echoes path to $1 when it's executable and exists in ${LIBVPX_BIN_PATH}, or an |
| 148 # empty string. Caller is responsible for testing the string once the function |
| 149 # returns. |
| 150 vpx_tool_path() { |
| 151 local readonly tool_name="$1" |
| 152 local tool_path="${LIBVPX_BIN_PATH}/${tool_name}${VPX_TEST_EXE_SUFFIX}" |
| 153 if [ ! -x "${tool_path}" ]; then |
| 154 # Try one directory up: when running via examples.sh the tool could be in |
| 155 # the parent directory of $LIBVPX_BIN_PATH. |
| 156 tool_path="${LIBVPX_BIN_PATH}/../${tool_name}${VPX_TEST_EXE_SUFFIX}" |
| 157 fi |
| 158 |
| 159 if [ ! -x "${tool_path}" ]; then |
| 160 tool_path="" |
| 161 fi |
| 162 echo "${tool_path}" |
| 163 } |
| 164 |
147 # Echoes yes to stdout when the file named by positional parameter one exists | 165 # Echoes yes to stdout when the file named by positional parameter one exists |
148 # in LIBVPX_BIN_PATH, and is executable. | 166 # in LIBVPX_BIN_PATH, and is executable. |
149 vpx_tool_available() { | 167 vpx_tool_available() { |
150 local tool_name="$1" | 168 local tool_name="$1" |
151 local tool="${LIBVPX_BIN_PATH}/${tool_name}${VPX_TEST_EXE_SUFFIX}" | 169 local tool="${LIBVPX_BIN_PATH}/${tool_name}${VPX_TEST_EXE_SUFFIX}" |
152 [ -x "${tool}" ] && echo yes | 170 [ -x "${tool}" ] && echo yes |
153 } | 171 } |
154 | 172 |
155 # Echoes yes to stdout when vpx_config_option_enabled() reports yes for | 173 # Echoes yes to stdout when vpx_config_option_enabled() reports yes for |
156 # CONFIG_VP8_DECODER. | 174 # CONFIG_VP8_DECODER. |
(...skipping 18 matching lines...) Expand all Loading... |
175 vp9_encode_available() { | 193 vp9_encode_available() { |
176 [ "$(vpx_config_option_enabled CONFIG_VP9_ENCODER)" = "yes" ] && echo yes | 194 [ "$(vpx_config_option_enabled CONFIG_VP9_ENCODER)" = "yes" ] && echo yes |
177 } | 195 } |
178 | 196 |
179 # Echoes yes to stdout when vpx_config_option_enabled() reports yes for | 197 # Echoes yes to stdout when vpx_config_option_enabled() reports yes for |
180 # CONFIG_WEBM_IO. | 198 # CONFIG_WEBM_IO. |
181 webm_io_available() { | 199 webm_io_available() { |
182 [ "$(vpx_config_option_enabled CONFIG_WEBM_IO)" = "yes" ] && echo yes | 200 [ "$(vpx_config_option_enabled CONFIG_WEBM_IO)" = "yes" ] && echo yes |
183 } | 201 } |
184 | 202 |
185 # Echoes yes to stdout when vpxdec exists according to vpx_tool_available(). | |
186 vpxdec_available() { | |
187 [ -n $(vpx_tool_available vpxdec) ] && echo yes | |
188 } | |
189 | |
190 # Wrapper function for running vpxdec in noblit mode. Requires that | |
191 # LIBVPX_BIN_PATH points to the directory containing vpxdec. Positional | |
192 # parameter one is used as the input file path. Positional parameter two, when | |
193 # present, is interpreted as a boolean flag that means the input should be sent | |
194 # to vpxdec via pipe from cat instead of directly. | |
195 vpxdec() { | |
196 local input="${1}" | |
197 local pipe_input=${2} | |
198 | |
199 if [ $# -gt 2 ]; then | |
200 # shift away $1 and $2 so the remaining arguments can be passed to vpxdec | |
201 # via $@. | |
202 shift 2 | |
203 fi | |
204 | |
205 local decoder="${LIBVPX_BIN_PATH}/vpxdec${VPX_TEST_EXE_SUFFIX}" | |
206 | |
207 if [ -z "${pipe_input}" ]; then | |
208 eval "${VPX_TEST_PREFIX}" "${decoder}" "$input" --summary --noblit "$@" \ | |
209 ${devnull} | |
210 else | |
211 cat "${input}" \ | |
212 | eval "${VPX_TEST_PREFIX}" "${decoder}" - --summary --noblit "$@" \ | |
213 ${devnull} | |
214 fi | |
215 } | |
216 | |
217 # Echoes yes to stdout when vpxenc exists according to vpx_tool_available(). | |
218 vpxenc_available() { | |
219 [ -n $(vpx_tool_available vpxenc) ] && echo yes | |
220 } | |
221 | |
222 # Wrapper function for running vpxenc. Positional parameters are interpreted as | |
223 # follows: | |
224 # 1 - codec name | |
225 # 2 - input width | |
226 # 3 - input height | |
227 # 4 - number of frames to encode | |
228 # 5 - path to input file | |
229 # 6 - path to output file | |
230 # Note: The output file path must end in .ivf to output an IVF file. | |
231 # 7 - extra flags | |
232 # Note: Extra flags currently supports a special case: when set to "-" | |
233 # input is piped to vpxenc via cat. | |
234 vpxenc() { | |
235 local encoder="${LIBVPX_BIN_PATH}/vpxenc${VPX_TEST_EXE_SUFFIX}" | |
236 local codec="${1}" | |
237 local width=${2} | |
238 local height=${3} | |
239 local frames=${4} | |
240 local input=${5} | |
241 local output="${VPX_TEST_OUTPUT_DIR}/${6}" | |
242 local extra_flags=${7} | |
243 | |
244 # Because --ivf must be within the command line to get IVF from vpxenc. | |
245 if echo "${output}" | egrep -q 'ivf$'; then | |
246 use_ivf=--ivf | |
247 else | |
248 unset use_ivf | |
249 fi | |
250 | |
251 if [ "${extra_flags}" = "-" ]; then | |
252 pipe_input=yes | |
253 extra_flags=${8} | |
254 else | |
255 unset pipe_input | |
256 fi | |
257 | |
258 if [ -z "${pipe_input}" ]; then | |
259 eval "${VPX_TEST_PREFIX}" "${encoder}" --codec=${codec} --width=${width} \ | |
260 --height=${height} --limit=${frames} ${use_ivf} ${extra_flags} \ | |
261 --output="${output}" "${input}" ${devnull} | |
262 else | |
263 cat "${input}" \ | |
264 | eval "${VPX_TEST_PREFIX}" "${encoder}" --codec=${codec} \ | |
265 --width=${width} --height=${height} --limit=${frames} ${use_ivf} \ | |
266 ${extra_flags} --output="${output}" - ${devnull} | |
267 fi | |
268 | |
269 if [ ! -e "${output}" ]; then | |
270 # Return non-zero exit status: output file doesn't exist, so something | |
271 # definitely went wrong. | |
272 return 1 | |
273 fi | |
274 } | |
275 | |
276 # Filters strings from positional parameter one using the filter specified by | 203 # Filters strings from positional parameter one using the filter specified by |
277 # positional parameter two. Filter behavior depends on the presence of a third | 204 # positional parameter two. Filter behavior depends on the presence of a third |
278 # positional parameter. When parameter three is present, strings that match the | 205 # positional parameter. When parameter three is present, strings that match the |
279 # filter are excluded. When omitted, strings matching the filter are included. | 206 # filter are excluded. When omitted, strings matching the filter are included. |
280 # The filtered string is echoed to stdout. | 207 # The filtered string is echoed to stdout. |
281 filter_strings() { | 208 filter_strings() { |
282 strings=${1} | 209 strings=${1} |
283 filter=${2} | 210 filter=${2} |
284 exclude=${3} | 211 exclude=${3} |
285 | 212 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 VPX_TEST_RAND=${VPX_TEST_RAND} | 406 VPX_TEST_RAND=${VPX_TEST_RAND} |
480 VPX_TEST_RUN_DISABLED_TESTS=${VPX_TEST_RUN_DISABLED_TESTS} | 407 VPX_TEST_RUN_DISABLED_TESTS=${VPX_TEST_RUN_DISABLED_TESTS} |
481 VPX_TEST_SHOW_PROGRAM_OUTPUT=${VPX_TEST_SHOW_PROGRAM_OUTPUT} | 408 VPX_TEST_SHOW_PROGRAM_OUTPUT=${VPX_TEST_SHOW_PROGRAM_OUTPUT} |
482 VPX_TEST_TEMP_ROOT=${VPX_TEST_TEMP_ROOT} | 409 VPX_TEST_TEMP_ROOT=${VPX_TEST_TEMP_ROOT} |
483 VPX_TEST_VERBOSE_OUTPUT=${VPX_TEST_VERBOSE_OUTPUT} | 410 VPX_TEST_VERBOSE_OUTPUT=${VPX_TEST_VERBOSE_OUTPUT} |
484 YUV_RAW_INPUT=${YUV_RAW_INPUT} | 411 YUV_RAW_INPUT=${YUV_RAW_INPUT} |
485 YUV_RAW_INPUT_WIDTH=${YUV_RAW_INPUT_WIDTH} | 412 YUV_RAW_INPUT_WIDTH=${YUV_RAW_INPUT_WIDTH} |
486 YUV_RAW_INPUT_HEIGHT=${YUV_RAW_INPUT_HEIGHT}" | 413 YUV_RAW_INPUT_HEIGHT=${YUV_RAW_INPUT_HEIGHT}" |
487 | 414 |
488 fi # End $VPX_TEST_TOOLS_COMMON_SH pseudo include guard. | 415 fi # End $VPX_TEST_TOOLS_COMMON_SH pseudo include guard. |
OLD | NEW |