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 vp9_spatial_svc_encoder example. To add new |
| 12 ## tests to to this file, do the following: |
| 13 ## 1. Write a shell function (this is your test). |
| 14 ## 2. Add the function to vp9_spatial_svc_tests (on a new line). |
| 15 ## |
| 16 . $(dirname $0)/tools_common.sh |
| 17 |
| 18 # Environment check: $YUV_RAW_INPUT is required. |
| 19 vp9_spatial_svc_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 vp9_spatial_svc_encoder. $1 is the test name. |
| 27 vp9_spatial_svc_encoder() { |
| 28 local encoder="${LIBVPX_BIN_PATH}/vp9_spatial_svc_encoder" |
| 29 encoder="${encoder}${VPX_TEST_EXE_SUFFIX}" |
| 30 local test_name="$1" |
| 31 local output_file="${VPX_TEST_OUTPUT_DIR}/vp9_ssvc_encoder${test_name}.ivf" |
| 32 local frames_to_encode="10" |
| 33 local max_kf="9999" |
| 34 |
| 35 shift |
| 36 |
| 37 if [ ! -x "${encoder}" ]; then |
| 38 elog "${encoder} does not exist or is not executable." |
| 39 return 1 |
| 40 fi |
| 41 |
| 42 eval "${encoder}" -w "${YUV_RAW_INPUT_WIDTH}" -h "${YUV_RAW_INPUT_HEIGHT}" \ |
| 43 -k "${max_kf}" -f "${frames_to_encode}" "$@" "${YUV_RAW_INPUT}" \ |
| 44 "${output_file}" \ |
| 45 ${devnull} |
| 46 |
| 47 [ -e "${output_file}" ] || return 1 |
| 48 } |
| 49 |
| 50 # Each mode is run with layer count 1-$vp9_ssvc_test_layers. |
| 51 vp9_ssvc_test_layers=5 |
| 52 |
| 53 vp9_spatial_svc_mode_i() { |
| 54 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 55 local test_name="${FUNCNAME}" |
| 56 for layers in $(seq 1 ${vp9_ssvc_test_layers}); do |
| 57 vp9_spatial_svc_encoder "${test_name}" -m i -l ${layers} |
| 58 done |
| 59 fi |
| 60 } |
| 61 |
| 62 vp9_spatial_svc_mode_altip() { |
| 63 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 64 local test_name="${FUNCNAME}" |
| 65 for layers in $(seq 1 ${vp9_ssvc_test_layers}); do |
| 66 vp9_spatial_svc_encoder "${test_name}" -m "alt-ip" -l ${layers} |
| 67 done |
| 68 fi |
| 69 } |
| 70 |
| 71 vp9_spatial_svc_mode_ip() { |
| 72 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 73 local test_name="${FUNCNAME}" |
| 74 vp9_spatial_svc_encoder "${test_name}" -m ip -l 1 |
| 75 fi |
| 76 } |
| 77 |
| 78 vp9_spatial_svc_mode_gf() { |
| 79 if [ "$(vp9_encode_available)" = "yes" ]; then |
| 80 local test_name="${FUNCNAME}" |
| 81 for layers in $(seq 1 ${vp9_ssvc_test_layers}); do |
| 82 vp9_spatial_svc_encoder "${test_name}" -m gf -l ${layers} |
| 83 done |
| 84 fi |
| 85 } |
| 86 |
| 87 vp9_spatial_svc_tests="vp9_spatial_svc_mode_i |
| 88 vp9_spatial_svc_mode_altip |
| 89 vp9_spatial_svc_mode_ip |
| 90 vp9_spatial_svc_mode_gf" |
| 91 |
| 92 run_tests vp9_spatial_svc_encoder_verify_environment "${vp9_spatial_svc_tests}" |
OLD | NEW |