OLD | NEW |
(Empty) | |
| 1 #!/bin/sh |
| 2 ## |
| 3 ## Copyright (c) 2014 The WebM project authors. All Rights Reserved. |
| 4 ## |
| 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. |
| 10 ## |
| 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). |
| 15 ## |
| 16 . $(dirname $0)/tools_common.sh |
| 17 |
| 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." |
| 22 return 1 |
| 23 fi |
| 24 } |
| 25 |
| 26 # Runs vpx_temporal_svc_encoder using the codec specified by $1 and output file |
| 27 # name by $2. Additional positional parameters are passed directly to |
| 28 # vpx_temporal_svc_encoder. |
| 29 vpx_tsvc_encoder() { |
| 30 local encoder="${LIBVPX_BIN_PATH}/vpx_temporal_svc_encoder" |
| 31 encoder="${encoder}${VPX_TEST_EXE_SUFFIX}" |
| 32 local codec="$1" |
| 33 local output_file_base="$2" |
| 34 local output_file="${VPX_TEST_OUTPUT_DIR}/${output_file_base}" |
| 35 local timebase_num="1" |
| 36 local timebase_den="1000" |
| 37 local speed="6" |
| 38 local frame_drop_thresh="30" |
| 39 |
| 40 shift 2 |
| 41 |
| 42 if [ ! -x "${encoder}" ]; then |
| 43 elog "${encoder} does not exist or is not executable." |
| 44 return 1 |
| 45 fi |
| 46 |
| 47 eval "${encoder}" "${YUV_RAW_INPUT}" "${output_file}" "${codec}" \ |
| 48 "${YUV_RAW_INPUT_WIDTH}" "${YUV_RAW_INPUT_HEIGHT}" \ |
| 49 "${timebase_num}" "${timebase_den}" "${speed}" "${frame_drop_thresh}" \ |
| 50 "$@" \ |
| 51 ${devnull} |
| 52 } |
| 53 |
| 54 # Confirms that all expected output files exist given the output file name |
| 55 # passed to vpx_temporal_svc_encoder. |
| 56 # The file name passed to vpx_temporal_svc_encoder is joined with the stream |
| 57 # number and the extension .ivf to produce per stream output files. Here $1 is |
| 58 # file name, and $2 is expected number of files. |
| 59 files_exist() { |
| 60 local file_name="${VPX_TEST_OUTPUT_DIR}/$1" |
| 61 local num_files="$(($2 - 1))" |
| 62 for stream_num in $(seq 0 ${num_files}); do |
| 63 [ -e "${file_name}_${stream_num}.ivf" ] || return 1 |
| 64 done |
| 65 } |
| 66 |
| 67 # Run vpx_temporal_svc_encoder in all supported modes for vp8 and vp9. |
| 68 |
| 69 vpx_tsvc_encoder_vp8_mode_0() { |
| 70 if [ "$(vp8_encode_available)" = "yes" ]; then |
| 71 vpx_tsvc_encoder vp8 "${FUNCNAME}" 0 200 || return 1 |
| 72 # Mode 0 produces 1 stream |
| 73 files_exist "${FUNCNAME}" 1 || return 1 |
| 74 fi |
| 75 } |
| 76 |
| 77 vpx_tsvc_encoder_vp8_mode_1() { |
| 78 if [ "$(vp8_encode_available)" = "yes" ]; then |
| 79 vpx_tsvc_encoder vp8 "${FUNCNAME}" 1 200 400 || return 1 |
| 80 # Mode 1 produces 2 streams |
| 81 files_exist "${FUNCNAME}" 2 || return 1 |
| 82 fi |
| 83 } |
| 84 |
| 85 vpx_tsvc_encoder_vp8_mode_2() { |
| 86 if [ "$(vp8_encode_available)" = "yes" ]; then |
| 87 vpx_tsvc_encoder vp8 "${FUNCNAME}" 2 200 400 || return 1 |
| 88 # Mode 2 produces 2 streams |
| 89 files_exist "${FUNCNAME}" 2 || return 1 |
| 90 fi |
| 91 } |
| 92 |
| 93 vpx_tsvc_encoder_vp8_mode_3() { |
| 94 if [ "$(vp8_encode_available)" = "yes" ]; then |
| 95 vpx_tsvc_encoder vp8 "${FUNCNAME}" 3 200 400 600 || return 1 |
| 96 # Mode 3 produces 3 streams |
| 97 files_exist "${FUNCNAME}" 3 || return 1 |
| 98 fi |
| 99 } |
| 100 |
| 101 vpx_tsvc_encoder_vp8_mode_4() { |
| 102 if [ "$(vp8_encode_available)" = "yes" ]; then |
| 103 vpx_tsvc_encoder vp8 "${FUNCNAME}" 4 200 400 600 || return 1 |
| 104 # Mode 4 produces 3 streams |
| 105 files_exist "${FUNCNAME}" 3 || return 1 |
| 106 fi |
| 107 } |
| 108 |
| 109 vpx_tsvc_encoder_vp8_mode_5() { |
| 110 if [ "$(vp8_encode_available)" = "yes" ]; then |
| 111 vpx_tsvc_encoder vp8 "${FUNCNAME}" 5 200 400 600 || return 1 |
| 112 # Mode 5 produces 3 streams |
| 113 files_exist "${FUNCNAME}" 3 || return 1 |
| 114 fi |
| 115 } |
| 116 |
| 117 vpx_tsvc_encoder_vp8_mode_6() { |
| 118 if [ "$(vp8_encode_available)" = "yes" ]; then |
| 119 vpx_tsvc_encoder vp8 "${FUNCNAME}" 6 200 400 600 || return 1 |
| 120 # Mode 6 produces 3 streams |
| 121 files_exist "${FUNCNAME}" 3 || return 1 |
| 122 fi |
| 123 } |
| 124 |
| 125 vpx_tsvc_encoder_vp8_mode_7() { |
| 126 if [ "$(vp8_encode_available)" = "yes" ]; then |
| 127 vpx_tsvc_encoder vp8 "${FUNCNAME}" 7 200 400 600 800 1000 || return 1 |
| 128 # Mode 7 produces 5 streams |
| 129 files_exist "${FUNCNAME}" 5 || return 1 |
| 130 fi |
| 131 } |
| 132 |
| 133 vpx_tsvc_encoder_vp8_mode_8() { |
| 134 if [ "$(vp8_encode_available)" = "yes" ]; then |
| 135 vpx_tsvc_encoder vp8 "${FUNCNAME}" 8 200 400 || return 1 |
| 136 # Mode 8 produces 2 streams |
| 137 files_exist "${FUNCNAME}" 2 || return 1 |
| 138 fi |
| 139 } |
| 140 |
| 141 vpx_tsvc_encoder_vp8_mode_9() { |
| 142 if [ "$(vp8_encode_available)" = "yes" ]; then |
| 143 vpx_tsvc_encoder vp8 "${FUNCNAME}" 9 200 400 600 || return 1 |
| 144 # Mode 9 produces 3 streams |
| 145 files_exist "${FUNCNAME}" 3 || return 1 |
| 146 fi |
| 147 } |
| 148 |
| 149 vpx_tsvc_encoder_vp8_mode_10() { |
| 150 if [ "$(vp8_encode_available)" = "yes" ]; then |
| 151 vpx_tsvc_encoder vp8 "${FUNCNAME}" 10 200 400 600 || return 1 |
| 152 # Mode 10 produces 3 streams |
| 153 files_exist "${FUNCNAME}" 3 || return 1 |
| 154 fi |
| 155 } |
| 156 |
| 157 vpx_tsvc_encoder_vp8_mode_11() { |
| 158 if [ "$(vp8_encode_available)" = "yes" ]; then |
| 159 vpx_tsvc_encoder vp8 "${FUNCNAME}" 11 200 400 600 || return 1 |
| 160 # Mode 11 produces 3 streams |
| 161 files_exist "${FUNCNAME}" 3 || return 1 |
| 162 fi |
| 163 } |
| 164 |
| 165 vpx_tsvc_encoder_vp9_mode_0() { |
| 166 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 167 vpx_tsvc_encoder vp9 "${FUNCNAME}" 0 200 || return 1 |
| 168 # Mode 0 produces 1 stream |
| 169 files_exist "${FUNCNAME}" 1 || return 1 |
| 170 fi |
| 171 } |
| 172 |
| 173 vpx_tsvc_encoder_vp9_mode_1() { |
| 174 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 175 vpx_tsvc_encoder vp9 "${FUNCNAME}" 1 200 400 || return 1 |
| 176 # Mode 1 produces 2 streams |
| 177 files_exist "${FUNCNAME}" 2 || return 1 |
| 178 fi |
| 179 } |
| 180 |
| 181 vpx_tsvc_encoder_vp9_mode_2() { |
| 182 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 183 vpx_tsvc_encoder vp9 "${FUNCNAME}" 2 200 400 || return 1 |
| 184 # Mode 2 produces 2 streams |
| 185 files_exist "${FUNCNAME}" 2 || return 1 |
| 186 fi |
| 187 } |
| 188 |
| 189 vpx_tsvc_encoder_vp9_mode_3() { |
| 190 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 191 vpx_tsvc_encoder vp9 "${FUNCNAME}" 3 200 400 600 || return 1 |
| 192 # Mode 3 produces 3 streams |
| 193 files_exist "${FUNCNAME}" 3 || return 1 |
| 194 fi |
| 195 } |
| 196 |
| 197 vpx_tsvc_encoder_vp9_mode_4() { |
| 198 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 199 vpx_tsvc_encoder vp9 "${FUNCNAME}" 4 200 400 600 || return 1 |
| 200 # Mode 4 produces 3 streams |
| 201 files_exist "${FUNCNAME}" 3 || return 1 |
| 202 fi |
| 203 } |
| 204 |
| 205 vpx_tsvc_encoder_vp9_mode_5() { |
| 206 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 207 vpx_tsvc_encoder vp9 "${FUNCNAME}" 5 200 400 600 || return 1 |
| 208 # Mode 5 produces 3 streams |
| 209 files_exist "${FUNCNAME}" 3 || return 1 |
| 210 fi |
| 211 } |
| 212 |
| 213 vpx_tsvc_encoder_vp9_mode_6() { |
| 214 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 215 vpx_tsvc_encoder vp9 "${FUNCNAME}" 6 200 400 600 || return 1 |
| 216 # Mode 6 produces 3 streams |
| 217 files_exist "${FUNCNAME}" 3 || return 1 |
| 218 fi |
| 219 } |
| 220 |
| 221 vpx_tsvc_encoder_vp9_mode_7() { |
| 222 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 223 vpx_tsvc_encoder vp9 "${FUNCNAME}" 7 200 400 600 800 1000 || return 1 |
| 224 # Mode 7 produces 5 streams |
| 225 files_exist "${FUNCNAME}" 5 || return 1 |
| 226 fi |
| 227 } |
| 228 |
| 229 vpx_tsvc_encoder_vp9_mode_8() { |
| 230 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 231 vpx_tsvc_encoder vp9 "${FUNCNAME}" 8 200 400 || return 1 |
| 232 # Mode 8 produces 2 streams |
| 233 files_exist "${FUNCNAME}" 2 || return 1 |
| 234 fi |
| 235 } |
| 236 |
| 237 vpx_tsvc_encoder_vp9_mode_9() { |
| 238 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 239 vpx_tsvc_encoder vp9 "${FUNCNAME}" 9 200 400 600 || return 1 |
| 240 # Mode 9 produces 3 streams |
| 241 files_exist "${FUNCNAME}" 3 || return 1 |
| 242 fi |
| 243 } |
| 244 |
| 245 vpx_tsvc_encoder_vp9_mode_10() { |
| 246 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 247 vpx_tsvc_encoder vp9 "${FUNCNAME}" 10 200 400 600 || return 1 |
| 248 # Mode 10 produces 3 streams |
| 249 files_exist "${FUNCNAME}" 3 || return 1 |
| 250 fi |
| 251 } |
| 252 |
| 253 vpx_tsvc_encoder_vp9_mode_11() { |
| 254 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 255 vpx_tsvc_encoder vp9 "${FUNCNAME}" 11 200 400 600 || return 1 |
| 256 # Mode 11 produces 3 streams |
| 257 files_exist "${FUNCNAME}" 3 || return 1 |
| 258 fi |
| 259 } |
| 260 |
| 261 vpx_tsvc_encoder_tests="vpx_tsvc_encoder_vp8_mode_0 |
| 262 vpx_tsvc_encoder_vp8_mode_1 |
| 263 vpx_tsvc_encoder_vp8_mode_2 |
| 264 vpx_tsvc_encoder_vp8_mode_3 |
| 265 vpx_tsvc_encoder_vp8_mode_4 |
| 266 vpx_tsvc_encoder_vp8_mode_5 |
| 267 vpx_tsvc_encoder_vp8_mode_6 |
| 268 vpx_tsvc_encoder_vp8_mode_7 |
| 269 vpx_tsvc_encoder_vp8_mode_8 |
| 270 vpx_tsvc_encoder_vp8_mode_9 |
| 271 vpx_tsvc_encoder_vp8_mode_10 |
| 272 vpx_tsvc_encoder_vp8_mode_11 |
| 273 vpx_tsvc_encoder_vp9_mode_0 |
| 274 vpx_tsvc_encoder_vp9_mode_1 |
| 275 vpx_tsvc_encoder_vp9_mode_2 |
| 276 vpx_tsvc_encoder_vp9_mode_3 |
| 277 vpx_tsvc_encoder_vp9_mode_4 |
| 278 vpx_tsvc_encoder_vp9_mode_5 |
| 279 vpx_tsvc_encoder_vp9_mode_6 |
| 280 vpx_tsvc_encoder_vp9_mode_7 |
| 281 vpx_tsvc_encoder_vp9_mode_8 |
| 282 vpx_tsvc_encoder_vp9_mode_9 |
| 283 vpx_tsvc_encoder_vp9_mode_10 |
| 284 vpx_tsvc_encoder_vp9_mode_11" |
| 285 |
| 286 run_tests vpx_tsvc_encoder_verify_environment "${vpx_tsvc_encoder_tests}" |
OLD | NEW |