From: Jim Bankoski Date: Wed, 25 May 2016 14:02:19 +0000 (-0700) Subject: simple_decoder.sh: Support encoding in decode test scripts. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e78a964e29f5c7c718e5f4e54e4c3d314de545fc;p=libvpx simple_decoder.sh: Support encoding in decode test scripts. Adding AV1 input files to the test set is not feasible because the bitstream is in constant flux. Add test input encoding and hook it up in simple_decoder.sh to start. cherry-picked #b591df89 from aom/master Change-Id: Ie4c06a7c458cdc2ab003d27fb92418c77c87fc88 --- diff --git a/test/aomenc.sh b/test/aomenc.sh index 2eb4ad973..2b137ca38 100755 --- a/test/aomenc.sh +++ b/test/aomenc.sh @@ -48,14 +48,7 @@ aomenc_can_encode_av1() { fi } -# Echo aomenc command line parameters allowing use of -# hantro_collage_w352h288.yuv as input. -yuv_input_hantro_collage() { - echo ""${YUV_RAW_INPUT}" - --width="${YUV_RAW_INPUT_WIDTH}" - --height="${YUV_RAW_INPUT_HEIGHT}"" -} - +# Utilities that echo aomenc input file parameters. y4m_input_non_square_par() { echo ""${Y4M_NOSQ_PAR_INPUT}"" } @@ -118,7 +111,7 @@ aomenc() { aomenc_av1_ivf() { if [ "$(aomenc_can_encode_av1)" = "yes" ]; then local readonly output="${AOM_TEST_OUTPUT_DIR}/av1.ivf" - aomenc $(yuv_input_hantro_collage) \ + aomenc $(yuv_raw_input) \ --codec=av1 \ --limit="${TEST_FRAMES}" \ --ivf \ @@ -135,7 +128,7 @@ aomenc_av1_webm() { if [ "$(aomenc_can_encode_av1)" = "yes" ] && \ [ "$(webm_io_available)" = "yes" ]; then local readonly output="${AOM_TEST_OUTPUT_DIR}/av1.webm" - aomenc $(yuv_input_hantro_collage) \ + aomenc $(yuv_raw_input) \ --codec=av1 \ --limit="${TEST_FRAMES}" \ --output="${output}" @@ -151,7 +144,7 @@ aomenc_av1_webm_2pass() { if [ "$(aomenc_can_encode_av1)" = "yes" ] && \ [ "$(webm_io_available)" = "yes" ]; then local readonly output="${AOM_TEST_OUTPUT_DIR}/av1.webm" - aomenc $(yuv_input_hantro_collage) \ + aomenc $(yuv_raw_input) \ --codec=av1 \ --limit="${TEST_FRAMES}" \ --output="${output}" \ @@ -167,7 +160,7 @@ aomenc_av1_webm_2pass() { aomenc_av1_ivf_lossless() { if [ "$(aomenc_can_encode_av1)" = "yes" ]; then local readonly output="${AOM_TEST_OUTPUT_DIR}/av1_lossless.ivf" - aomenc $(yuv_input_hantro_collage) \ + aomenc $(yuv_raw_input) \ --codec=av1 \ --limit="${TEST_FRAMES}" \ --ivf \ @@ -184,7 +177,7 @@ aomenc_av1_ivf_lossless() { aomenc_av1_ivf_minq0_maxq0() { if [ "$(aomenc_can_encode_av1)" = "yes" ]; then local readonly output="${AOM_TEST_OUTPUT_DIR}/av1_lossless_minq0_maxq0.ivf" - aomenc $(yuv_input_hantro_collage) \ + aomenc $(yuv_raw_input) \ --codec=av1 \ --limit="${TEST_FRAMES}" \ --ivf \ @@ -205,7 +198,7 @@ aomenc_av1_webm_lag10_frames20() { local readonly lag_total_frames=20 local readonly lag_frames=10 local readonly output="${AOM_TEST_OUTPUT_DIR}/av1_lag10_frames20.webm" - aomenc $(yuv_input_hantro_collage) \ + aomenc $(yuv_raw_input) \ --codec=av1 \ --limit="${lag_total_frames}" \ --lag-in-frames="${lag_frames}" \ diff --git a/test/simple_decoder.sh b/test/simple_decoder.sh index 4aa55da5b..27b3a0e9d 100755 --- a/test/simple_decoder.sh +++ b/test/simple_decoder.sh @@ -16,10 +16,8 @@ . $(dirname $0)/tools_common.sh # Environment check: Make sure input is available: -# $AOM_IVF_FILE and $AV1_IVF_FILE are required. simple_decoder_verify_environment() { - if [ ! -e "${AOM_IVF_FILE}" ] || [ ! -e "${AV1_IVF_FILE}" ]; then - echo "Libaom test data must exist in LIBVPX_TEST_DATA_PATH." + if [ ! "$(av1_encode_available)" = "yes" ] && [ ! -e "${AV1_IVF_FILE}" ]; then return 1 fi } @@ -43,19 +41,18 @@ simple_decoder() { [ -e "${output_file}" ] || return 1 } -simple_decoder_aom() { - if [ "$(aom_decode_available)" = "yes" ]; then - simple_decoder "${AOM_IVF_FILE}" aom || return 1 - fi -} - simple_decoder_av1() { if [ "$(av1_decode_available)" = "yes" ]; then - simple_decoder "${AV1_IVF_FILE}" av1 || return 1 + if [ ! -e "${AV1_IVF_FILE}" ]; then + local file="${AOM_TEST_OUTPUT_DIR}/test_encode.ivf" + encode_yuv_raw_input_av1 "${file}" + simple_decoder "${file}" av1 || return 1 + else + simple_decoder "${AV1_IVF_FILE}" av1 || return 1 + fi fi } -simple_decoder_tests="simple_decoder_aom - simple_decoder_av1" +simple_decoder_tests="simple_decoder_av1" run_tests simple_decoder_verify_environment "${simple_decoder_tests}" diff --git a/test/tools_common.sh b/test/tools_common.sh index 1d0cac316..97cf2720b 100755 --- a/test/tools_common.sh +++ b/test/tools_common.sh @@ -309,6 +309,34 @@ aom_test_check_environment() { fi } +# Echo aomenc command line parameters allowing use of a raw yuv file as +# input to aomenc. +yuv_raw_input() { + echo ""${YUV_RAW_INPUT}" + --width="${YUV_RAW_INPUT_WIDTH}" + --height="${YUV_RAW_INPUT_HEIGHT}"" +} + +# Do a small encode for testing decoders. +encode_yuv_raw_input_av1() { + if [ "$(av1_encode_available)" = "yes" ]; then + local readonly output="$1" + local readonly encoder="$(aom_tool_path aomenc)" + + eval "${encoder}" $(yuv_raw_input) \ + --codec=av1 \ + --ivf \ + --limit=5 \ + --output="${output}" \ + ${devnull} + + if [ ! -e "${output}" ]; then + elog "Output file does not exist." + return 1 + fi + fi +} + # Parse the command line. while [ -n "$1" ]; do case "$1" in