cx_set_ref.sh 1.92 KB
Newer Older
1
2
#!/bin/sh
##
3
##  Copyright (c) 2016 The WebM project authors. All Rights Reserved.
4
5
6
7
8
9
10
##
##  Use of this source code is governed by a BSD-style license
##  that can be found in the LICENSE file in the root of the source
##  tree. An additional intellectual property rights grant can be found
##  in the file PATENTS.  All contributing project authors may
##  be found in the AUTHORS file in the root of the source tree.
##
11
##  This file tests the libaom cx_set_ref example. To add new tests to this
12
13
##  file, do the following:
##    1. Write a shell function (this is your test).
14
##    2. Add the function to cx_set_ref_tests (on a new line).
15
16
17
18
##
. $(dirname $0)/tools_common.sh

# Environment check: $YUV_RAW_INPUT is required.
19
cx_set_ref_verify_environment() {
20
  if [ ! -e "${YUV_RAW_INPUT}" ]; then
Yaowu Xu's avatar
Yaowu Xu committed
21
    echo "Libaom test data must exist in LIBVPX_TEST_DATA_PATH."
22
23
24
25
    return 1
  fi
}

26
27
# Runs cx_set_ref and updates the reference frame before encoding frame 90.
# $1 is the codec name.
Yaowu Xu's avatar
Yaowu Xu committed
28
aom_set_ref() {
29
  local codec="$1"
Yaowu Xu's avatar
Yaowu Xu committed
30
  local encoder="${LIBAOM_BIN_PATH}/aom_cx_set_ref${AOM_TEST_EXE_SUFFIX}"
31

Yaowu Xu's avatar
Yaowu Xu committed
32
  local output_file="${AOM_TEST_OUTPUT_DIR}/${codec}cx_set_ref_${codec}.ivf"
33
34
  local ref_frame_num=90

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

40
  if [ "$codec" = "vp8" ]; then
Yaowu Xu's avatar
Yaowu Xu committed
41
    eval "${AOM_TEST_PREFIX}" "${encoder}" "${YUV_RAW_INPUT_WIDTH}" \
42
43
44
        "${YUV_RAW_INPUT_HEIGHT}" "${YUV_RAW_INPUT}" "${output_file}" \
        "${ref_frame_num}" ${devnull}
  else
Yaowu Xu's avatar
Yaowu Xu committed
45
    eval "${AOM_TEST_PREFIX}" "${encoder}" "${codec}" "${YUV_RAW_INPUT_WIDTH}" \
46
47
48
        "${YUV_RAW_INPUT_HEIGHT}" "${YUV_RAW_INPUT}" "${output_file}" \
        "${ref_frame_num}" ${devnull}
  fi
49
50
51
52

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

Yaowu Xu's avatar
Yaowu Xu committed
53
54
55
cx_set_ref_av1() {
  if [ "$(av1_encode_available)" = "yes" ]; then
    aom_set_ref av1 || return 1
56
57
58
  fi
}

Yaowu Xu's avatar
Yaowu Xu committed
59
cx_set_ref_tests="cx_set_ref_av1"
60

61
run_tests cx_set_ref_verify_environment "${cx_set_ref_tests}"