File: svc_encoder_rtc.sh

package info (click to toggle)
aom 3.13.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 38,340 kB
  • sloc: ansic: 415,031; cpp: 210,937; asm: 9,453; python: 4,479; perl: 2,339; sh: 1,878; pascal: 345; makefile: 57; javascript: 32
file content (115 lines) | stat: -rw-r--r-- 3,625 bytes parent folder | download | duplicates (20)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/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 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 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
}

# Runs svc_encoder_rtc with 2 spatial layers 1 temporal layer, specifying
# one input file per layer (although it's the same file twice).
svc_encoder_s2_t1() {
  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 5" \
      "--speed=8" \
      "--target-bitrate=400" \
      "--bitrates=100,300" \
      "--spatial-layers=2" \
      "--temporal-layers=1" \
      "--timebase=1/30" \
      "${YUV_RAW_INPUT}" \
      "${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
                         svc_encoder_s2_t1"
  run_tests svc_encoder_verify_environment "${svc_encoder_rtc_tests}"
fi