summaryrefslogtreecommitdiffstats
path: root/third_party/aom/test/svc_encoder_rtc.sh
blob: 735166d6f68a3914fc55451fd2295e0019201f38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
## Copyright (c) 2023, Alliance for Open Media. All rights reserved
##
## This source code is subject to the terms of the BSD 2 Clause License and
## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
## was not distributed with this source code in the LICENSE file, you can
## obtain it at www.aomedia.org/license/software. If the Alliance for Open
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##

. $(dirname $0)/tools_common.sh

# Environment check: $YUV_RAW_INPUT is required.
svc_encoder_verify_environment() {
  if [ ! -e "${YUV_RAW_INPUT}" ]; then
    echo "Libaom test data must exist in LIBAOM_TEST_DATA_PATH."
    return 1
  fi
}

common_flags="-k 10000"
common_flags="${common_flags} --max-q=63"
common_flags="${common_flags} --error-resilient=0"

# Runs svc_encoder_rtc using with 1 spatial layer 3 temporal layers.
svc_encoder_s1_t3() {
  local encoder="${LIBAOM_BIN_PATH}/svc_encoder_rtc${AOM_TEST_EXE_SUFFIX}"
  local output_file="${AOM_TEST_OUTPUT_DIR}/svc_encoder_rtc"

  if [ ! -x "${encoder}" ]; then
    elog "${encoder} does not exist or is not executable."
    return 1
  fi

  eval "${AOM_TEST_PREFIX}" "${encoder}" "${common_flags}" \
      "--width=${YUV_RAW_INPUT_WIDTH}" \
      "--height=${YUV_RAW_INPUT_HEIGHT}" \
      "-lm 2" \
      "--speed=8" \
      "--target-bitrate=400" \
      "--bitrates=220,300,400" \
      "--spatial-layers=1" \
      "--temporal-layers=3" \
      "--timebase=1/30" \
      "${YUV_RAW_INPUT}" \
      "-o ${output_file}" \
      ${devnull} || return 1

  [ -e "${output_file}" ] || return 1
}

# Runs svc_encoder_rtc using with 1 spatial layer 2 temporal layers with
# speed 10.
svc_encoder_s1_t2() {
  local encoder="${LIBAOM_BIN_PATH}/svc_encoder_rtc${AOM_TEST_EXE_SUFFIX}"
  local output_file="${AOM_TEST_OUTPUT_DIR}/svc_encoder_rtc"

  if [ ! -x "${encoder}" ]; then
    elog "${encoder} does not exist or is not executable."
    return 1
  fi

  eval "${AOM_TEST_PREFIX}" "${encoder}" "${common_flags}" \
      "--width=${YUV_RAW_INPUT_WIDTH}" \
      "--height=${YUV_RAW_INPUT_HEIGHT}" \
      "-lm 1" \
      "--speed=10" \
      "--target-bitrate=400" \
      "--bitrates=220,400" \
      "--spatial-layers=1" \
      "--temporal-layers=2" \
      "--timebase=1/30" \
      "${YUV_RAW_INPUT}" \
      "-o ${output_file}" \
      ${devnull} || return 1

  [ -e "${output_file}" ] || return 1
}

if [ "$(av1_encode_available)" = "yes" ]; then
  svc_encoder_rtc_tests="svc_encoder_s1_t3
                         svc_encoder_s1_t2"
  run_tests svc_encoder_verify_environment "${svc_encoder_rtc_tests}"
fi