From a04db185db5cf8c9e692a87e194dda4811c6b1d9 Mon Sep 17 00:00:00 2001 From: Tom Finegan Date: Fri, 15 Aug 2014 15:56:58 -0700 Subject: [PATCH] vpxenc.sh: Add 2-pass and lagged encode tests for VP8 and VP9. - Fix nit: make test function definitions match test order. - Fix nit: use elog instead of echo for env verification error. Change-Id: I0eec078fc056a5bb2bd88d5833e43de48d77ec08 --- test/vpxenc.sh | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 102 insertions(+), 12 deletions(-) diff --git a/test/vpxenc.sh b/test/vpxenc.sh index 83818aa..2659f07 100755 --- a/test/vpxenc.sh +++ b/test/vpxenc.sh @@ -20,7 +20,7 @@ readonly TEST_FRAMES=10 # Environment check: Make sure input is available. vpxenc_verify_environment() { if [ ! -e "${YUV_RAW_INPUT}" ]; then - echo "The file ${YUV_RAW_INPUT##*/} must exist in LIBVPX_TEST_DATA_PATH." + elog "The file ${YUV_RAW_INPUT##*/} must exist in LIBVPX_TEST_DATA_PATH." return 1 fi if [ -z "$(vpx_tool_path vpxenc)" ]; then @@ -80,6 +80,66 @@ vpxenc_vp8_ivf() { fi } +vpxenc_vp8_webm() { + if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \ + [ "$(webm_io_available)" = "yes" ]; then + local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.webm" + vpxenc --codec=vp8 \ + --width="${YUV_RAW_INPUT_WIDTH}" \ + --height="${YUV_RAW_INPUT_HEIGHT}" \ + --limit="${TEST_FRAMES}" \ + --output="${output}" \ + "${YUV_RAW_INPUT}" + + if [ ! -e "${output}" ]; then + elog "Output file does not exist." + return 1 + fi + fi +} + +vpxenc_vp8_webm_2pass() { + if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \ + [ "$(webm_io_available)" = "yes" ]; then + local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.webm" + vpxenc --codec=vp8 \ + --width="${YUV_RAW_INPUT_WIDTH}" \ + --height="${YUV_RAW_INPUT_HEIGHT}" \ + --limit="${TEST_FRAMES}" \ + --output="${output}" \ + --passes=2 \ + "${YUV_RAW_INPUT}" + + if [ ! -e "${output}" ]; then + elog "Output file does not exist." + return 1 + fi + fi +} + +vpxenc_vp8_webm_lag10_frames20() { + if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \ + [ "$(webm_io_available)" = "yes" ]; then + local readonly lag_total_frames=20 + local readonly lag_frames=10 + local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8_lag10_frames20.webm" + vpxenc --codec=vp8 \ + --width="${YUV_RAW_INPUT_WIDTH}" \ + --height="${YUV_RAW_INPUT_HEIGHT}" \ + --limit="${lag_total_frames}" \ + --lag-in-frames="${lag_frames}" \ + --output="${output}" \ + --auto-alt-ref=1 \ + --passes=2 \ + "${YUV_RAW_INPUT}" + + if [ ! -e "${output}" ]; then + elog "Output file does not exist." + return 1 + fi + fi +} + vpxenc_vp8_ivf_piped_input() { if [ "$(vpxenc_can_encode_vp8)" = "yes" ]; then local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8_piped_input.ivf" @@ -99,14 +159,15 @@ vpxenc_vp8_ivf_piped_input() { fi } -vpxenc_vp8_webm() { - if [ "$(vpxenc_can_encode_vp8)" = "yes" ] && \ - [ "$(webm_io_available)" = "yes" ]; then - local readonly output="${VPX_TEST_OUTPUT_DIR}/vp8.webm" - vpxenc --codec=vp8 \ +vpxenc_vp9_ivf() { + if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then + local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.ivf" + vpxenc --codec=vp9 \ --width="${YUV_RAW_INPUT_WIDTH}" \ --height="${YUV_RAW_INPUT_HEIGHT}" \ --limit="${TEST_FRAMES}" \ + --ivf \ + --test-decode=fatal \ --output="${output}" \ "${YUV_RAW_INPUT}" @@ -117,14 +178,14 @@ vpxenc_vp8_webm() { fi } -vpxenc_vp9_ivf() { - if [ "$(vpxenc_can_encode_vp9)" = "yes" ]; then - local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.ivf" +vpxenc_vp9_webm() { + if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \ + [ "$(webm_io_available)" = "yes" ]; then + local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.webm" vpxenc --codec=vp9 \ --width="${YUV_RAW_INPUT_WIDTH}" \ --height="${YUV_RAW_INPUT_HEIGHT}" \ --limit="${TEST_FRAMES}" \ - --ivf \ --test-decode=fatal \ --output="${output}" \ "${YUV_RAW_INPUT}" @@ -136,7 +197,7 @@ vpxenc_vp9_ivf() { fi } -vpxenc_vp9_webm() { +vpxenc_vp9_webm_2pass() { if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \ [ "$(webm_io_available)" = "yes" ]; then local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9.webm" @@ -146,6 +207,7 @@ vpxenc_vp9_webm() { --limit="${TEST_FRAMES}" \ --test-decode=fatal \ --output="${output}" \ + --passes=2 \ "${YUV_RAW_INPUT}" if [ ! -e "${output}" ]; then @@ -196,12 +258,40 @@ vpxenc_vp9_ivf_minq0_maxq0() { fi } +vpxenc_vp9_webm_lag10_frames20() { + if [ "$(vpxenc_can_encode_vp9)" = "yes" ] && \ + [ "$(webm_io_available)" = "yes" ]; then + local readonly lag_total_frames=20 + local readonly lag_frames=10 + local readonly output="${VPX_TEST_OUTPUT_DIR}/vp9_lag10_frames20.webm" + vpxenc --codec=vp9 \ + --width="${YUV_RAW_INPUT_WIDTH}" \ + --height="${YUV_RAW_INPUT_HEIGHT}" \ + --limit="${lag_total_frames}" \ + --lag-in-frames="${lag_frames}" \ + --output="${output}" \ + --test-decode=fatal \ + --passes=2 \ + --auto-alt-ref=1 \ + "${YUV_RAW_INPUT}" + + if [ ! -e "${output}" ]; then + elog "Output file does not exist." + return 1 + fi + fi +} + vpxenc_tests="vpxenc_vp8_ivf vpxenc_vp8_webm + vpxenc_vp8_webm_2pass + vpxenc_vp8_webm_lag10_frames20 vpxenc_vp8_ivf_piped_input vpxenc_vp9_ivf vpxenc_vp9_webm + vpxenc_vp9_webm_2pass vpxenc_vp9_ivf_lossless - vpxenc_vp9_ivf_minq0_maxq0" + vpxenc_vp9_ivf_minq0_maxq0 + vpxenc_vp9_webm_lag10_frames20" run_tests vpxenc_verify_environment "${vpxenc_tests}" -- 2.7.4