177496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org#!/bin/sh 277496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## 377496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## Copyright (c) 2014 The WebM project authors. All Rights Reserved. 477496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## 577496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## Use of this source code is governed by a BSD-style license 677496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## that can be found in the LICENSE file in the root of the source 777496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## tree. An additional intellectual property rights grant can be found 877496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## in the file PATENTS. All contributing project authors may 977496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## be found in the AUTHORS file in the root of the source tree. 1077496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## 1177496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## This file tests the libvpx simple_decoder example code. To add new tests to 1277496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## this file, do the following: 1377496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## 1. Write a shell function (this is your test). 1477496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## 2. Add the function to simple_decoder_tests (on a new line). 1577496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org## 1677496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org. $(dirname $0)/tools_common.sh 1777496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org 1877496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org# Environment check: Make sure input is available: 1977496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org# $VP8_IVF_FILE and $VP9_IVF_FILE are required. 2077496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.orgsimple_decoder_verify_environment() { 2177496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org if [ ! -e "${VP8_IVF_FILE}" ] || [ ! -e "${VP9_IVF_FILE}" ]; then 2277496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org echo "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH." 2377496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org return 1 2477496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org fi 2577496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org} 2677496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org 2777496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org# Runs simple_decoder using $1 as input file. $2 is the codec name, and is used 2877496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org# solely to name the output file. 2977496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.orgsimple_decoder() { 3077496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org local decoder="${LIBVPX_BIN_PATH}/simple_decoder${VPX_TEST_EXE_SUFFIX}" 3177496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org local input_file="$1" 3277496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org local codec="$2" 3377496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org local output_file="${VPX_TEST_OUTPUT_DIR}/simple_decoder_${codec}.raw" 3477496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org 3588b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org if [ ! -x "${decoder}" ]; then 3688b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org elog "${decoder} does not exist or is not executable." 3788b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org return 1 3888b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org fi 3977496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org 4095aa45d73048f952dcaad0037429cc6751b34f2fjohannkoenig@google.com eval "${VPX_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \ 4195aa45d73048f952dcaad0037429cc6751b34f2fjohannkoenig@google.com ${devnull} 4277496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org 4377496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org [ -e "${output_file}" ] || return 1 4477496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org} 4577496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org 4677496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.orgsimple_decoder_vp8() { 4777496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org if [ "$(vp8_decode_available)" = "yes" ]; then 4877496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org simple_decoder "${VP8_IVF_FILE}" vp8 || return 1 4977496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org fi 5077496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org} 5177496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org 5277496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.orgsimple_decoder_vp9() { 5377496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org if [ "$(vp9_decode_available)" = "yes" ]; then 5477496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org simple_decoder "${VP9_IVF_FILE}" vp9 || return 1 5577496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org fi 5677496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org} 5777496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org 5877496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.orgsimple_decoder_tests="simple_decoder_vp8 5977496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org simple_decoder_vp9" 6077496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.org 6177496404dc182c2f4a5f86ebabffe1d1ceb81e7ejohannkoenig@chromium.orgrun_tests simple_decoder_verify_environment "${simple_decoder_tests}" 62