1#!/bin/sh 2## Copyright (c) 2016, Alliance for Open Media. All rights reserved 3## 4## This source code is subject to the terms of the BSD 2 Clause License and 5## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6## was not distributed with this source code in the LICENSE file, you can 7## obtain it at www.aomedia.org/license/software. If the Alliance for Open 8## Media Patent License 1.0 was not distributed with this source code in the 9## PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10## 11## This file tests the libaom 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). 15## 16. $(dirname $0)/tools_common.sh 17 18# Environment check: Make sure input is available: 19# $AV1_IVF_FILE is required. 20decode_with_drops_verify_environment() { 21 if [ "$(av1_encode_available)" != "yes" ] && [ ! -e "${AV1_IVF_FILE}" ]; then 22 return 1 23 fi 24} 25 26# Runs decode_with_drops on $1, $2 is interpreted as codec name and used solely 27# to name the output file. $3 is the drop mode, and is passed directly to 28# decode_with_drops. 29decode_with_drops() { 30 local decoder="$(aom_tool_path decode_with_drops)" 31 local input_file="$1" 32 local codec="$2" 33 local output_file="${AOM_TEST_OUTPUT_DIR}/decode_with_drops_${codec}" 34 local drop_mode="$3" 35 36 if [ ! -x "${decoder}" ]; then 37 elog "${decoder} does not exist or is not executable." 38 return 1 39 fi 40 41 eval "${AOM_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \ 42 "${drop_mode}" ${devnull} 43 44 [ -e "${output_file}" ] || return 1 45} 46 47 48# Decodes $AV1_IVF_FILE while dropping frames, twice: once in sequence mode, 49# and once in pattern mode. 50DISABLED_decode_with_drops_av1() { 51 if [ "$(av1_decode_available)" = "yes" ]; then 52 local file="${AV1_IVF_FILE}" 53 if [ ! -e "${AV1_IVF_FILE}" ]; then 54 file="${AOM_TEST_OUTPUT_DIR}/test_encode.ivf" 55 encode_yuv_raw_input_av1 "${file}" --ivf 56 fi 57 # Drop frames 3 and 4. 58 decode_with_drops "${file}" "av1" "3-4" 59 60 # Test pattern mode: Drop 3 of every 4 frames. 61 decode_with_drops "${file}" "av1" "3/4" 62 fi 63} 64 65# TODO(yaowu): Disable this test as trailing_bit check is expected to fail 66decode_with_drops_tests="DISABLED_decode_with_drops_av1" 67 68run_tests decode_with_drops_verify_environment "${decode_with_drops_tests}" 69