3 ## Copyright (c) 2014 The WebM project authors. All Rights Reserved.
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.
11 ## This file tests the libvpx decode_with_drops example. To add new tests to
12 ## this file, do the following:
13 ## 1. Write a shell function (this is your test).
14 ## 2. Add the function to decode_with_drops_tests (on a new line).
16 . $(dirname $0)/tools_common.sh
18 # Environment check: Make sure input is available:
19 # $VP8_IVF_FILE and $VP9_IVF_FILE are required.
20 decode_with_drops_verify_environment() {
21 if [ ! -e "${VP8_IVF_FILE}" ] || [ ! -e "${VP9_IVF_FILE}" ]; then
22 echo "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
27 # Runs decode_with_drops on $1, $2 is interpreted as codec name and used solely
28 # to name the output file. $3 is the drop mode, and is passed directly to
31 local decoder="${LIBVPX_BIN_PATH}/decode_with_drops${VPX_TEST_EXE_SUFFIX}"
34 local output_file="${VPX_TEST_OUTPUT_DIR}/decode_with_drops_${codec}"
37 [ -x "${decoder}" ] || return 1
39 eval "${decoder}" "${input_file}" "${output_file}" "${drop_mode}" ${devnull}
41 [ -e "${output_file}" ] || return 1
44 # Decodes $VP8_IVF_FILE while dropping frames, twice: once in sequence mode,
45 # and once in pattern mode.
46 # Note: This test assumes that $VP8_IVF_FILE has exactly 29 frames, and could
47 # break if the file is modified.
48 decode_with_drops_vp8() {
49 if [ "$(vp8_decode_available)" = "yes" ]; then
50 # Test sequence mode: Drop frames 2-28.
51 decode_with_drops "${VP8_IVF_FILE}" "vp8" "2-28"
53 # Test pattern mode: Drop 3 of every 4 frames.
54 decode_with_drops "${VP8_IVF_FILE}" "vp8" "3/4"
58 # Decodes $VP9_IVF_FILE while dropping frames, twice: once in sequence mode,
59 # and once in pattern mode.
60 # Note: This test assumes that $VP9_IVF_FILE has exactly 20 frames, and could
61 # break if the file is modified.
62 decode_with_drops_vp9() {
63 if [ "$(vp9_decode_available)" = "yes" ]; then
64 # Test sequence mode: Drop frames 2-28.
65 decode_with_drops "${VP9_IVF_FILE}" "vp9" "2-19"
67 # Test pattern mode: Drop 3 of every 4 frames.
68 decode_with_drops "${VP9_IVF_FILE}" "vp9" "3/4"
72 decode_with_drops_tests="decode_with_drops_vp8
73 decode_with_drops_vp9"
75 run_tests decode_with_drops_verify_environment "${decode_with_drops_tests}"