1*77c1e3ccSAndroid Build Coastguard Worker#!/bin/sh 2*77c1e3ccSAndroid Build Coastguard Worker## Copyright (c) 2018, Alliance for Open Media. All rights reserved. 3*77c1e3ccSAndroid Build Coastguard Worker## 4*77c1e3ccSAndroid Build Coastguard Worker## This source code is subject to the terms of the BSD 2 Clause License and 5*77c1e3ccSAndroid Build Coastguard Worker## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6*77c1e3ccSAndroid Build Coastguard Worker## was not distributed with this source code in the LICENSE file, you can 7*77c1e3ccSAndroid Build Coastguard Worker## obtain it at www.aomedia.org/license/software. If the Alliance for Open 8*77c1e3ccSAndroid Build Coastguard Worker## Media Patent License 1.0 was not distributed with this source code in the 9*77c1e3ccSAndroid Build Coastguard Worker## PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10*77c1e3ccSAndroid Build Coastguard Worker## 11*77c1e3ccSAndroid Build Coastguard Worker## This file tests the libaom dump_obu tool. To add new tests to this 12*77c1e3ccSAndroid Build Coastguard Worker## file, do the following: 13*77c1e3ccSAndroid Build Coastguard Worker## 1. Write a shell function (this is your test). 14*77c1e3ccSAndroid Build Coastguard Worker## 2. Add the function to dump_obu_tests (on a new line). 15*77c1e3ccSAndroid Build Coastguard Worker## 16*77c1e3ccSAndroid Build Coastguard Worker. $(dirname $0)/tools_common.sh 17*77c1e3ccSAndroid Build Coastguard Worker 18*77c1e3ccSAndroid Build Coastguard Workerreadonly dump_obu_test_file="${AOM_TEST_OUTPUT_DIR}/av1_obu_test.ivf" 19*77c1e3ccSAndroid Build Coastguard Worker 20*77c1e3ccSAndroid Build Coastguard Workerdump_obu_verify_environment() { 21*77c1e3ccSAndroid Build Coastguard Worker if [ ! -e "${YUV_RAW_INPUT}" ]; then 22*77c1e3ccSAndroid Build Coastguard Worker elog "The file ${YUV_RAW_INPUT##*/} must exist in LIBAOM_TEST_DATA_PATH." 23*77c1e3ccSAndroid Build Coastguard Worker return 1 24*77c1e3ccSAndroid Build Coastguard Worker fi 25*77c1e3ccSAndroid Build Coastguard Worker if [ "$(dump_obu_available)" = "yes" ]; then 26*77c1e3ccSAndroid Build Coastguard Worker if [ -z "$(aom_tool_path dump_obu)" ]; then 27*77c1e3ccSAndroid Build Coastguard Worker elog "dump_obu not found in LIBAOM_BIN_PATH, its parent, or child tools/." 28*77c1e3ccSAndroid Build Coastguard Worker fi 29*77c1e3ccSAndroid Build Coastguard Worker fi 30*77c1e3ccSAndroid Build Coastguard Worker} 31*77c1e3ccSAndroid Build Coastguard Worker 32*77c1e3ccSAndroid Build Coastguard Workerdump_obu_available() { 33*77c1e3ccSAndroid Build Coastguard Worker if [ "$(av1_decode_available)" = "yes" ] && \ 34*77c1e3ccSAndroid Build Coastguard Worker [ "$(av1_encode_available)" = "yes" ]; then 35*77c1e3ccSAndroid Build Coastguard Worker echo yes 36*77c1e3ccSAndroid Build Coastguard Worker fi 37*77c1e3ccSAndroid Build Coastguard Worker} 38*77c1e3ccSAndroid Build Coastguard Worker 39*77c1e3ccSAndroid Build Coastguard Workeraomenc_available() { 40*77c1e3ccSAndroid Build Coastguard Worker if [ -x "$(aom_tool_path aomenc)" ]; then 41*77c1e3ccSAndroid Build Coastguard Worker echo yes 42*77c1e3ccSAndroid Build Coastguard Worker fi 43*77c1e3ccSAndroid Build Coastguard Worker} 44*77c1e3ccSAndroid Build Coastguard Worker 45*77c1e3ccSAndroid Build Coastguard Workerencode_test_file() { 46*77c1e3ccSAndroid Build Coastguard Worker if [ "$(aomenc_available)" = "yes" ]; then 47*77c1e3ccSAndroid Build Coastguard Worker local encoder="$(aom_tool_path aomenc)" 48*77c1e3ccSAndroid Build Coastguard Worker if [ "$(realtime_only_build)" = "yes" ]; then 49*77c1e3ccSAndroid Build Coastguard Worker eval "${encoder}" \ 50*77c1e3ccSAndroid Build Coastguard Worker $(aomenc_encode_test_rt_params) \ 51*77c1e3ccSAndroid Build Coastguard Worker $(yuv_raw_input) \ 52*77c1e3ccSAndroid Build Coastguard Worker --ivf \ 53*77c1e3ccSAndroid Build Coastguard Worker --output=${dump_obu_test_file} \ 54*77c1e3ccSAndroid Build Coastguard Worker ${devnull} || return 1 55*77c1e3ccSAndroid Build Coastguard Worker else 56*77c1e3ccSAndroid Build Coastguard Worker eval "${encoder}" \ 57*77c1e3ccSAndroid Build Coastguard Worker $(aomenc_encode_test_fast_params) \ 58*77c1e3ccSAndroid Build Coastguard Worker $(yuv_raw_input) \ 59*77c1e3ccSAndroid Build Coastguard Worker --ivf \ 60*77c1e3ccSAndroid Build Coastguard Worker --output=${dump_obu_test_file} \ 61*77c1e3ccSAndroid Build Coastguard Worker ${devnull} || return 1 62*77c1e3ccSAndroid Build Coastguard Worker fi 63*77c1e3ccSAndroid Build Coastguard Worker if [ ! -e "${dump_obu_test_file}" ]; then 64*77c1e3ccSAndroid Build Coastguard Worker elog "dump_obu test input encode failed." 65*77c1e3ccSAndroid Build Coastguard Worker return 1 66*77c1e3ccSAndroid Build Coastguard Worker fi 67*77c1e3ccSAndroid Build Coastguard Worker fi 68*77c1e3ccSAndroid Build Coastguard Worker} 69*77c1e3ccSAndroid Build Coastguard Worker 70*77c1e3ccSAndroid Build Coastguard Workerdump_obu() { 71*77c1e3ccSAndroid Build Coastguard Worker encode_test_file || return 1 72*77c1e3ccSAndroid Build Coastguard Worker eval $(aom_tool_path dump_obu) "${dump_obu_test_file}" ${devnull} 73*77c1e3ccSAndroid Build Coastguard Worker} 74*77c1e3ccSAndroid Build Coastguard Worker 75*77c1e3ccSAndroid Build Coastguard Workerdump_obu_tests="dump_obu" 76*77c1e3ccSAndroid Build Coastguard Worker 77*77c1e3ccSAndroid Build Coastguard Workerrun_tests dump_obu_verify_environment "${dump_obu_tests}" 78