blob: 155ee92077847b63e455a672124e06c52130447d [file] [log] [blame]
Tom Finegan50869342014-04-28 16:48:46 -07001#!/bin/sh
Yaowu Xu2ab7ff02016-09-02 12:04:54 -07002## Copyright (c) 2016, Alliance for Open Media. All rights reserved
Tom Finegan50869342014-04-28 16:48:46 -07003##
Yaowu Xu2ab7ff02016-09-02 12:04:54 -07004## 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.
Tom Finegan50869342014-04-28 16:48:46 -070010##
Yaowu Xu2ab7ff02016-09-02 12:04:54 -070011## 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).
Tom Finegan50869342014-04-28 16:48:46 -070015##
16. $(dirname $0)/tools_common.sh
17
18# Environment check: Make sure input is available:
Tom Finegan8ab44142018-04-27 14:57:52 -070019# $AV1_IVF_FILE is required.
Tom Finegan50869342014-04-28 16:48:46 -070020decode_with_drops_verify_environment() {
Jim Bankoskiddb90bb2016-06-14 06:58:30 -070021 if [ "$(av1_encode_available)" != "yes" ] && [ ! -e "${AV1_IVF_FILE}" ]; then
Tom Finegan50869342014-04-28 16:48:46 -070022 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() {
Tom Finegan8ab44142018-04-27 14:57:52 -070030 local decoder="$(aom_tool_path decode_with_drops)"
Tom Finegan50869342014-04-28 16:48:46 -070031 local input_file="$1"
32 local codec="$2"
Yaowu Xuf883b422016-08-30 14:01:10 -070033 local output_file="${AOM_TEST_OUTPUT_DIR}/decode_with_drops_${codec}"
Tom Finegan50869342014-04-28 16:48:46 -070034 local drop_mode="$3"
35
Tom Finegan12672c22014-06-16 10:57:00 -070036 if [ ! -x "${decoder}" ]; then
37 elog "${decoder} does not exist or is not executable."
38 return 1
39 fi
Tom Finegan50869342014-04-28 16:48:46 -070040
Yaowu Xuf883b422016-08-30 14:01:10 -070041 eval "${AOM_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \
Tom Finegan926a6f62014-07-10 15:17:05 -070042 "${drop_mode}" ${devnull}
Tom Finegan50869342014-04-28 16:48:46 -070043
44 [ -e "${output_file}" ] || return 1
45}
46
Tom Finegan50869342014-04-28 16:48:46 -070047
Yaowu Xuf883b422016-08-30 14:01:10 -070048# Decodes $AV1_IVF_FILE while dropping frames, twice: once in sequence mode,
Tom Finegan50869342014-04-28 16:48:46 -070049# and once in pattern mode.
Tom Finegan8ab44142018-04-27 14:57:52 -070050DISABLED_decode_with_drops_av1() {
Yaowu Xuf883b422016-08-30 14:01:10 -070051 if [ "$(av1_decode_available)" = "yes" ]; then
Jim Bankoskiddb90bb2016-06-14 06:58:30 -070052 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
Frank Bossenf9db0e02018-03-21 16:27:13 -040057 # Drop frames 3 and 4.
58 decode_with_drops "${file}" "av1" "3-4"
Tom Finegan50869342014-04-28 16:48:46 -070059
60 # Test pattern mode: Drop 3 of every 4 frames.
Jim Bankoskiddb90bb2016-06-14 06:58:30 -070061 decode_with_drops "${file}" "av1" "3/4"
Tom Finegan50869342014-04-28 16:48:46 -070062 fi
63}
64
Yaowu Xuc4071232018-03-30 12:53:22 -070065# TODO(yaowu): Disable this test as trailing_bit check is expected to fail
Tom Finegan8ab44142018-04-27 14:57:52 -070066decode_with_drops_tests="DISABLED_decode_with_drops_av1"
67
68run_tests decode_with_drops_verify_environment "${decode_with_drops_tests}"