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 vpxdec. To add new tests to this file, do the following:
12##    1. Write a shell function (this is your test).
13##    2. Add the function to vpxdec_tests (on a new line).
14##
15. $(dirname $0)/tools_common.sh
16
17VP8_IVF_FILE="${LIBVPX_TEST_DATA_PATH}/vp80-00-comprehensive-001.ivf"
18VP9_WEBM_FILE="${LIBVPX_TEST_DATA_PATH}/vp90-2-00-quantizer-00.webm"
19
20# Environment check: Make sure input is available.
21vpxdec_verify_environment() {
22  if [ ! -e "${VP8_IVF_FILE}" ] || [ ! -e "${VP9_WEBM_FILE}" ]; then
23    echo "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
24    return 1
25  fi
26}
27
28vpxdec_can_decode_vp8() {
29  if [ "$(vpxdec_available)" = "yes" ] && \
30     [ "$(vp8_decode_available)" = "yes" ]; then
31    echo yes
32  fi
33}
34
35vpxdec_can_decode_vp9() {
36  if [ "$(vpxdec_available)" = "yes" ] && \
37     [ "$(vp9_decode_available)" = "yes" ]; then
38    echo yes
39  fi
40}
41
42vpxdec_vp8_ivf() {
43  if [ "$(vpxdec_can_decode_vp8)" = "yes" ]; then
44    vpxdec "${VP8_IVF_FILE}"
45  fi
46}
47
48vpxdec_vp8_ivf_pipe_input() {
49  if [ "$(vpxdec_can_decode_vp8)" = "yes" ]; then
50    vpxdec "${VP8_IVF_FILE}" -
51  fi
52}
53
54vpxdec_vp9_webm() {
55  if [ "$(vpxdec_can_decode_vp9)" = "yes" ] && \
56     [ "$(webm_io_available)" = "yes" ]; then
57    vpxdec "${VP9_WEBM_FILE}"
58  fi
59}
60
61vpxdec_tests="vpxdec_vp8_ivf
62              vpxdec_vp8_ivf_pipe_input
63              vpxdec_vp9_webm"
64
65run_tests vpxdec_verify_environment "${vpxdec_tests}"
66