• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2## Copyright (c) 2023, Alliance for Open Media. All rights reserved.
3##
4## 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.
10##
11
12. $(dirname $0)/tools_common.sh
13
14# Environment check: $YUV_RAW_INPUT is required.
15svc_encoder_verify_environment() {
16  if [ ! -e "${YUV_RAW_INPUT}" ]; then
17    echo "Libaom test data must exist in LIBAOM_TEST_DATA_PATH."
18    return 1
19  fi
20}
21
22common_flags="-k 10000"
23common_flags="${common_flags} --max-q=63"
24common_flags="${common_flags} --error-resilient=0"
25
26# Runs svc_encoder_rtc with 1 spatial layer 3 temporal layers.
27svc_encoder_s1_t3() {
28  local encoder="${LIBAOM_BIN_PATH}/svc_encoder_rtc${AOM_TEST_EXE_SUFFIX}"
29  local output_file="${AOM_TEST_OUTPUT_DIR}/svc_encoder_rtc"
30
31  if [ ! -x "${encoder}" ]; then
32    elog "${encoder} does not exist or is not executable."
33    return 1
34  fi
35
36  eval "${AOM_TEST_PREFIX}" "${encoder}" "${common_flags}" \
37      "--width=${YUV_RAW_INPUT_WIDTH}" \
38      "--height=${YUV_RAW_INPUT_HEIGHT}" \
39      "-lm 2" \
40      "--speed=8" \
41      "--target-bitrate=400" \
42      "--bitrates=220,300,400" \
43      "--spatial-layers=1" \
44      "--temporal-layers=3" \
45      "--timebase=1/30" \
46      "${YUV_RAW_INPUT}" \
47      "-o ${output_file}" \
48      ${devnull} || return 1
49
50  [ -e "${output_file}" ] || return 1
51}
52
53# Runs svc_encoder_rtc with 1 spatial layer 2 temporal layers with
54# speed 10.
55svc_encoder_s1_t2() {
56  local encoder="${LIBAOM_BIN_PATH}/svc_encoder_rtc${AOM_TEST_EXE_SUFFIX}"
57  local output_file="${AOM_TEST_OUTPUT_DIR}/svc_encoder_rtc"
58
59  if [ ! -x "${encoder}" ]; then
60    elog "${encoder} does not exist or is not executable."
61    return 1
62  fi
63
64  eval "${AOM_TEST_PREFIX}" "${encoder}" "${common_flags}" \
65      "--width=${YUV_RAW_INPUT_WIDTH}" \
66      "--height=${YUV_RAW_INPUT_HEIGHT}" \
67      "-lm 1" \
68      "--speed=10" \
69      "--target-bitrate=400" \
70      "--bitrates=220,400" \
71      "--spatial-layers=1" \
72      "--temporal-layers=2" \
73      "--timebase=1/30" \
74      "${YUV_RAW_INPUT}" \
75      "-o ${output_file}" \
76      ${devnull} || return 1
77
78  [ -e "${output_file}" ] || return 1
79}
80
81# Runs svc_encoder_rtc with 2 spatial layers 1 temporal layer, specifying
82# one input file per layer (although it's the same file twice).
83svc_encoder_s2_t1() {
84  local encoder="${LIBAOM_BIN_PATH}/svc_encoder_rtc${AOM_TEST_EXE_SUFFIX}"
85  local output_file="${AOM_TEST_OUTPUT_DIR}/svc_encoder_rtc"
86
87  if [ ! -x "${encoder}" ]; then
88    elog "${encoder} does not exist or is not executable."
89    return 1
90  fi
91
92  eval "${AOM_TEST_PREFIX}" "${encoder}" "${common_flags}" \
93      "--width=${YUV_RAW_INPUT_WIDTH}" \
94      "--height=${YUV_RAW_INPUT_HEIGHT}" \
95      "-lm 5" \
96      "--speed=8" \
97      "--target-bitrate=400" \
98      "--bitrates=100,300" \
99      "--spatial-layers=2" \
100      "--temporal-layers=1" \
101      "--timebase=1/30" \
102      "${YUV_RAW_INPUT}" \
103      "${YUV_RAW_INPUT}" \
104      "-o ${output_file}" \
105      ${devnull} || return 1
106
107  [ -e "${output_file}" ] || return 1
108}
109
110if [ "$(av1_encode_available)" = "yes" ]; then
111  svc_encoder_rtc_tests="svc_encoder_s1_t3
112                         svc_encoder_s1_t2
113                         svc_encoder_s2_t1"
114  run_tests svc_encoder_verify_environment "${svc_encoder_rtc_tests}"
115fi
116