blob: 174dc4afaff885d1be8d1fe2d9f8edff4793a87a [file] [log] [blame]
Tom Finegan9598aae2014-08-18 15:40:46 -07001#!/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##
Yaowu Xuc27fc142016-08-22 16:08:15 -070011## This file tests the libaom set_maps example. To add new tests to this file,
Tom Finegan9598aae2014-08-18 15:40:46 -070012## do the following:
13## 1. Write a shell function (this is your test).
14## 2. Add the function to set_maps_tests (on a new line).
15##
16. $(dirname $0)/tools_common.sh
17
18# Environment check: $YUV_RAW_INPUT is required, and set_maps must exist in
Yaowu Xuc27fc142016-08-22 16:08:15 -070019# $LIBAOM_BIN_PATH.
Tom Finegan9598aae2014-08-18 15:40:46 -070020set_maps_verify_environment() {
21 if [ ! -e "${YUV_RAW_INPUT}" ]; then
Yaowu Xuf883b422016-08-30 14:01:10 -070022 echo "Libaom test data must exist in LIBVPX_TEST_DATA_PATH."
Tom Finegan9598aae2014-08-18 15:40:46 -070023 return 1
24 fi
Yaowu Xuf883b422016-08-30 14:01:10 -070025 if [ -z "$(aom_tool_path set_maps)" ]; then
Yaowu Xuc27fc142016-08-22 16:08:15 -070026 elog "set_maps not found. It must exist in LIBAOM_BIN_PATH or its parent."
Tom Finegan9598aae2014-08-18 15:40:46 -070027 return 1
28 fi
29}
30
31# Runs set_maps using the codec specified by $1.
32set_maps() {
Yaowu Xuf883b422016-08-30 14:01:10 -070033 local encoder="$(aom_tool_path set_maps)"
Tom Finegan9598aae2014-08-18 15:40:46 -070034 local codec="$1"
Yaowu Xuf883b422016-08-30 14:01:10 -070035 local output_file="${AOM_TEST_OUTPUT_DIR}/set_maps_${codec}.ivf"
Tom Finegan9598aae2014-08-18 15:40:46 -070036
Yaowu Xuf883b422016-08-30 14:01:10 -070037 eval "${AOM_TEST_PREFIX}" "${encoder}" "${codec}" "${YUV_RAW_INPUT_WIDTH}" \
Tom Finegan9598aae2014-08-18 15:40:46 -070038 "${YUV_RAW_INPUT_HEIGHT}" "${YUV_RAW_INPUT}" "${output_file}" \
39 ${devnull}
40
41 [ -e "${output_file}" ] || return 1
42}
43
Yaowu Xuf883b422016-08-30 14:01:10 -070044set_maps_aom() {
45 if [ "$(aom_encode_available)" = "yes" ]; then
46 set_maps aom || return 1
Tom Finegan9598aae2014-08-18 15:40:46 -070047 fi
48}
49
Yaowu Xuf883b422016-08-30 14:01:10 -070050set_maps_av1() {
51 if [ "$(av1_encode_available)" = "yes" ]; then
52 set_maps av1 || return 1
Tom Finegan9598aae2014-08-18 15:40:46 -070053 fi
54}
55
Yaowu Xuf883b422016-08-30 14:01:10 -070056set_maps_tests="set_maps_aom
57 set_maps_av1"
Tom Finegan9598aae2014-08-18 15:40:46 -070058
59run_tests set_maps_verify_environment "${set_maps_tests}"