diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/convolve_test.cc | 14 | ||||
-rw-r--r-- | test/test.mk | 5 | ||||
-rwxr-xr-x | test/tools_common.sh | 15 | ||||
-rwxr-xr-x | test/vp9_spatial_svc_encoder.sh | 89 | ||||
-rwxr-xr-x | test/vpx_temporal_svc_encoder.sh | 283 |
5 files changed, 396 insertions, 10 deletions
diff --git a/test/convolve_test.cc b/test/convolve_test.cc index cbb403677..a6dcc9875 100644 --- a/test/convolve_test.cc +++ b/test/convolve_test.cc @@ -341,6 +341,9 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) { for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) { const InterpKernel *filters = vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank)); + const InterpKernel *const eighttap_smooth = + vp9_get_interp_kernel(EIGHTTAP_SMOOTH); + for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) { for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) { filter_block2d_8_c(in, kInputStride, @@ -348,7 +351,7 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) { ref, kOutputStride, Width(), Height()); - if (filters == vp9_sub_pel_filters_8lp || (filter_x && filter_y)) + if (filters == eighttap_smooth || (filter_x && filter_y)) REGISTER_STATE_CHECK( UUT_->hv8_(in, kInputStride, out, kOutputStride, filters[filter_x], 16, filters[filter_y], 16, @@ -396,6 +399,8 @@ TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) { for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) { const InterpKernel *filters = vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank)); + const InterpKernel *const eighttap_smooth = + vp9_get_interp_kernel(EIGHTTAP_SMOOTH); for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) { for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) { @@ -404,7 +409,7 @@ TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) { ref, kOutputStride, Width(), Height()); - if (filters == vp9_sub_pel_filters_8lp || (filter_x && filter_y)) + if (filters == eighttap_smooth || (filter_x && filter_y)) REGISTER_STATE_CHECK( UUT_->hv8_avg_(in, kInputStride, out, kOutputStride, filters[filter_x], 16, filters[filter_y], 16, @@ -544,6 +549,7 @@ TEST_P(ConvolveTest, ChangeFilterWorks) { TEST_P(ConvolveTest, CheckScalingFiltering) { uint8_t* const in = input(); uint8_t* const out = output(); + const InterpKernel *const eighttap = vp9_get_interp_kernel(EIGHTTAP); SetConstantInput(127); @@ -551,8 +557,8 @@ TEST_P(ConvolveTest, CheckScalingFiltering) { for (int step = 1; step <= 32; ++step) { /* Test the horizontal and vertical filters in combination. */ REGISTER_STATE_CHECK(UUT_->hv8_(in, kInputStride, out, kOutputStride, - vp9_sub_pel_filters_8[frac], step, - vp9_sub_pel_filters_8[frac], step, + eighttap[frac], step, + eighttap[frac], step, Width(), Height())); CheckGuardBlocks(); diff --git a/test/test.mk b/test/test.mk index 44d2f9ca8..f0a27c70c 100644 --- a/test/test.mk +++ b/test/test.mk @@ -113,10 +113,13 @@ LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += dct16x16_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += dct32x32_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct4x4_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct8x8_test.cc -LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += svc_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += variance_test.cc LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_subtract_test.cc +ifeq ($(CONFIG_VP9_ENCODER),yes) +LIBVPX_TEST_SRCS-$(CONFIG_SPATIAL_SVC) += svc_test.cc +endif + endif # VP9 LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += sad_test.cc diff --git a/test/tools_common.sh b/test/tools_common.sh index 9c10d48f0..472111c23 100755 --- a/test/tools_common.sh +++ b/test/tools_common.sh @@ -302,8 +302,13 @@ filter_strings() { # functions and are run unconditionally. Functions in positional parameter two # are run according to the rules specified in vpx_test_usage(). run_tests() { - env_tests="verify_vpx_test_environment ${1}" - tests_to_filter="${2}" + local env_tests="verify_vpx_test_environment $1" + local tests_to_filter="$2" + local test_name="${VPX_TEST_NAME}" + + if [ -z "${test_name}" ]; then + test_name="$(basename \"${0%.*}\")" + fi if [ "${VPX_TEST_RUN_DISABLED_TESTS}" != "yes" ]; then # Filter out DISABLED tests. @@ -315,7 +320,7 @@ run_tests() { tests_to_filter=$(filter_strings "${tests_to_filter}" ${VPX_TEST_FILTER}) fi - tests_to_run="${env_tests} ${tests_to_filter}" + local tests_to_run="${env_tests} ${tests_to_filter}" check_git_hashes @@ -328,8 +333,8 @@ run_tests() { test_end "${test}" done - tested_config="$(test_configuration_target) @ $(current_hash)" - echo $(basename "${0%.*}"): Done, all tests pass for ${tested_config}. + local tested_config="$(test_configuration_target) @ $(current_hash)" + echo "${test_name}: Done, all tests pass for ${tested_config}." } vpx_test_usage() { diff --git a/test/vp9_spatial_svc_encoder.sh b/test/vp9_spatial_svc_encoder.sh new file mode 100755 index 000000000..635cfa245 --- /dev/null +++ b/test/vp9_spatial_svc_encoder.sh @@ -0,0 +1,89 @@ +#!/bin/sh +## +## Copyright (c) 2014 The WebM project authors. All Rights Reserved. +## +## 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. +## +## This file tests the libvpx vp9_spatial_svc_encoder example. To add new +## tests to to this file, do the following: +## 1. Write a shell function (this is your test). +## 2. Add the function to vp9_spatial_svc_tests (on a new line). +## +. $(dirname $0)/tools_common.sh + +# Environment check: $YUV_RAW_INPUT is required. +vp9_spatial_svc_encoder_verify_environment() { + if [ ! -e "${YUV_RAW_INPUT}" ]; then + echo "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH." + return 1 + fi +} + +# Runs vp9_spatial_svc_encoder. $1 is the test name. +vp9_spatial_svc_encoder() { + local encoder="${LIBVPX_BIN_PATH}/vp9_spatial_svc_encoder" + encoder="${encoder}${VPX_TEST_EXE_SUFFIX}" + local test_name="$1" + local output_file="${VPX_TEST_OUTPUT_DIR}/vp9_ssvc_encoder${test_name}.ivf" + local frames_to_encode="10" + local max_kf="9999" + + shift + + [ -x "${encoder}" ] || return 1 + + eval "${encoder}" -w "${YUV_RAW_INPUT_WIDTH}" -h "${YUV_RAW_INPUT_HEIGHT}" \ + -k "${max_kf}" -f "${frames_to_encode}" "$@" "${YUV_RAW_INPUT}" \ + "${output_file}" \ + ${devnull} + + [ -e "${output_file}" ] || return 1 +} + +# Each mode is run with layer count 1-$vp9_ssvc_test_layers. +vp9_ssvc_test_layers=5 + +vp9_spatial_svc_mode_i() { + if [ "$(vp9_encode_available)" = "yes" ]; then + local test_name="${FUNCNAME}" + for layers in $(seq 1 ${vp9_ssvc_test_layers}); do + vp9_spatial_svc_encoder "${test_name}" -m i -l ${layers} + done + fi +} + +vp9_spatial_svc_mode_altip() { + if [ "$(vp9_encode_available)" = "yes" ]; then + local test_name="${FUNCNAME}" + for layers in $(seq 1 ${vp9_ssvc_test_layers}); do + vp9_spatial_svc_encoder "${test_name}" -m "alt-ip" -l ${layers} + done + fi +} + +vp9_spatial_svc_mode_ip() { + if [ "$(vp9_encode_available)" = "yes" ]; then + local test_name="${FUNCNAME}" + vp9_spatial_svc_encoder "${test_name}" -m ip -l 1 + fi +} + +vp9_spatial_svc_mode_gf() { + if [ "$(vp9_encode_available)" = "yes" ]; then + local test_name="${FUNCNAME}" + for layers in $(seq 1 ${vp9_ssvc_test_layers}); do + vp9_spatial_svc_encoder "${test_name}" -m gf -l ${layers} + done + fi +} + +vp9_spatial_svc_tests="vp9_spatial_svc_mode_i + vp9_spatial_svc_mode_altip + vp9_spatial_svc_mode_ip + vp9_spatial_svc_mode_gf" + +run_tests vp9_spatial_svc_encoder_verify_environment "${vp9_spatial_svc_tests}" diff --git a/test/vpx_temporal_svc_encoder.sh b/test/vpx_temporal_svc_encoder.sh new file mode 100755 index 000000000..ff64740a6 --- /dev/null +++ b/test/vpx_temporal_svc_encoder.sh @@ -0,0 +1,283 @@ +#!/bin/sh +## +## Copyright (c) 2014 The WebM project authors. All Rights Reserved. +## +## 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. +## +## This file tests the libvpx vpx_temporal_svc_encoder example. To add new +## tests to this file, do the following: +## 1. Write a shell function (this is your test). +## 2. Add the function to vpx_tsvc_encoder_tests (on a new line). +## +. $(dirname $0)/tools_common.sh + +# Environment check: $YUV_RAW_INPUT is required. +vpx_tsvc_encoder_verify_environment() { + if [ ! -e "${YUV_RAW_INPUT}" ]; then + echo "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH." + return 1 + fi +} + +# Runs vpx_temporal_svc_encoder using the codec specified by $1 and output file +# name by $2. Additional positional parameters are passed directly to +# vpx_temporal_svc_encoder. +vpx_tsvc_encoder() { + local encoder="${LIBVPX_BIN_PATH}/vpx_temporal_svc_encoder" + encoder="${encoder}${VPX_TEST_EXE_SUFFIX}" + local codec="$1" + local output_file_base="$2" + local output_file="${VPX_TEST_OUTPUT_DIR}/${output_file_base}" + local timebase_num="1" + local timebase_den="1000" + local speed="6" + local frame_drop_thresh="30" + + shift 2 + + [ -x "${encoder}" ] || return 1 + + eval "${encoder}" "${YUV_RAW_INPUT}" "${output_file}" "${codec}" \ + "${YUV_RAW_INPUT_WIDTH}" "${YUV_RAW_INPUT_HEIGHT}" \ + "${timebase_num}" "${timebase_den}" "${speed}" "${frame_drop_thresh}" \ + "$@" \ + ${devnull} +} + +# Confirms that all expected output files exist given the output file name +# passed to vpx_temporal_svc_encoder. +# The file name passed to vpx_temporal_svc_encoder is joined with the stream +# number and the extension .ivf to produce per stream output files. Here $1 is +# file name, and $2 is expected number of files. +files_exist() { + local file_name="${VPX_TEST_OUTPUT_DIR}/$1" + local num_files="$(($2 - 1))" + for stream_num in $(seq 0 ${num_files}); do + [ -e "${file_name}_${stream_num}.ivf" ] || return 1 + done +} + +# Run vpx_temporal_svc_encoder in all supported modes for vp8 and vp9. + +vpx_tsvc_encoder_vp8_mode_0() { + if [ "$(vp8_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp8 "${FUNCNAME}" 0 200 || return 1 + # Mode 0 produces 1 stream + files_exist "${FUNCNAME}" 1 || return 1 + fi +} + +vpx_tsvc_encoder_vp8_mode_1() { + if [ "$(vp8_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp8 "${FUNCNAME}" 1 200 400 || return 1 + # Mode 1 produces 2 streams + files_exist "${FUNCNAME}" 2 || return 1 + fi +} + +vpx_tsvc_encoder_vp8_mode_2() { + if [ "$(vp8_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp8 "${FUNCNAME}" 2 200 400 || return 1 + # Mode 2 produces 2 streams + files_exist "${FUNCNAME}" 2 || return 1 + fi +} + +vpx_tsvc_encoder_vp8_mode_3() { + if [ "$(vp8_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp8 "${FUNCNAME}" 3 200 400 600 || return 1 + # Mode 3 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_vp8_mode_4() { + if [ "$(vp8_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp8 "${FUNCNAME}" 4 200 400 600 || return 1 + # Mode 4 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_vp8_mode_5() { + if [ "$(vp8_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp8 "${FUNCNAME}" 5 200 400 600 || return 1 + # Mode 5 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_vp8_mode_6() { + if [ "$(vp8_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp8 "${FUNCNAME}" 6 200 400 600 || return 1 + # Mode 6 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_vp8_mode_7() { + if [ "$(vp8_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp8 "${FUNCNAME}" 7 200 400 600 800 1000 || return 1 + # Mode 7 produces 5 streams + files_exist "${FUNCNAME}" 5 || return 1 + fi +} + +vpx_tsvc_encoder_vp8_mode_8() { + if [ "$(vp8_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp8 "${FUNCNAME}" 8 200 400 || return 1 + # Mode 8 produces 2 streams + files_exist "${FUNCNAME}" 2 || return 1 + fi +} + +vpx_tsvc_encoder_vp8_mode_9() { + if [ "$(vp8_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp8 "${FUNCNAME}" 9 200 400 600 || return 1 + # Mode 9 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_vp8_mode_10() { + if [ "$(vp8_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp8 "${FUNCNAME}" 10 200 400 600 || return 1 + # Mode 10 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_vp8_mode_11() { + if [ "$(vp8_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp8 "${FUNCNAME}" 11 200 400 600 || return 1 + # Mode 11 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_vp9_mode_0() { + if [ "$(vp9_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp9 "${FUNCNAME}" 0 200 || return 1 + # Mode 0 produces 1 stream + files_exist "${FUNCNAME}" 1 || return 1 + fi +} + +vpx_tsvc_encoder_vp9_mode_1() { + if [ "$(vp9_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp9 "${FUNCNAME}" 1 200 400 || return 1 + # Mode 1 produces 2 streams + files_exist "${FUNCNAME}" 2 || return 1 + fi +} + +vpx_tsvc_encoder_vp9_mode_2() { + if [ "$(vp9_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp9 "${FUNCNAME}" 2 200 400 || return 1 + # Mode 2 produces 2 streams + files_exist "${FUNCNAME}" 2 || return 1 + fi +} + +vpx_tsvc_encoder_vp9_mode_3() { + if [ "$(vp9_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp9 "${FUNCNAME}" 3 200 400 600 || return 1 + # Mode 3 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_vp9_mode_4() { + if [ "$(vp9_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp9 "${FUNCNAME}" 4 200 400 600 || return 1 + # Mode 4 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_vp9_mode_5() { + if [ "$(vp9_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp9 "${FUNCNAME}" 5 200 400 600 || return 1 + # Mode 5 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_vp9_mode_6() { + if [ "$(vp9_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp9 "${FUNCNAME}" 6 200 400 600 || return 1 + # Mode 6 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_vp9_mode_7() { + if [ "$(vp9_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp9 "${FUNCNAME}" 7 200 400 600 800 1000 || return 1 + # Mode 7 produces 5 streams + files_exist "${FUNCNAME}" 5 || return 1 + fi +} + +vpx_tsvc_encoder_vp9_mode_8() { + if [ "$(vp9_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp9 "${FUNCNAME}" 8 200 400 || return 1 + # Mode 8 produces 2 streams + files_exist "${FUNCNAME}" 2 || return 1 + fi +} + +vpx_tsvc_encoder_vp9_mode_9() { + if [ "$(vp9_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp9 "${FUNCNAME}" 9 200 400 600 || return 1 + # Mode 9 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_vp9_mode_10() { + if [ "$(vp9_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp9 "${FUNCNAME}" 10 200 400 600 || return 1 + # Mode 10 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_vp9_mode_11() { + if [ "$(vp9_encode_available)" = "yes" ]; then + vpx_tsvc_encoder vp9 "${FUNCNAME}" 11 200 400 600 || return 1 + # Mode 11 produces 3 streams + files_exist "${FUNCNAME}" 3 || return 1 + fi +} + +vpx_tsvc_encoder_tests="vpx_tsvc_encoder_vp8_mode_0 + vpx_tsvc_encoder_vp8_mode_1 + vpx_tsvc_encoder_vp8_mode_2 + vpx_tsvc_encoder_vp8_mode_3 + vpx_tsvc_encoder_vp8_mode_4 + vpx_tsvc_encoder_vp8_mode_5 + vpx_tsvc_encoder_vp8_mode_6 + vpx_tsvc_encoder_vp8_mode_7 + vpx_tsvc_encoder_vp8_mode_8 + vpx_tsvc_encoder_vp8_mode_9 + vpx_tsvc_encoder_vp8_mode_10 + vpx_tsvc_encoder_vp8_mode_11 + vpx_tsvc_encoder_vp9_mode_0 + vpx_tsvc_encoder_vp9_mode_1 + vpx_tsvc_encoder_vp9_mode_2 + vpx_tsvc_encoder_vp9_mode_3 + vpx_tsvc_encoder_vp9_mode_4 + vpx_tsvc_encoder_vp9_mode_5 + vpx_tsvc_encoder_vp9_mode_6 + vpx_tsvc_encoder_vp9_mode_7 + vpx_tsvc_encoder_vp9_mode_8 + vpx_tsvc_encoder_vp9_mode_9 + vpx_tsvc_encoder_vp9_mode_10 + vpx_tsvc_encoder_vp9_mode_11" + +run_tests vpx_tsvc_encoder_verify_environment "${vpx_tsvc_encoder_tests}" |