]> granicus.if.org Git - libvpx/commitdiff
simple_decoder.sh: Support encoding in decode test scripts.
authorJim Bankoski <jimbankoski@google.com>
Wed, 25 May 2016 14:02:19 +0000 (07:02 -0700)
committerYaowu Xu <yaowu@google.com>
Fri, 9 Sep 2016 22:49:56 +0000 (15:49 -0700)
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

test/aomenc.sh
test/simple_decoder.sh
test/tools_common.sh

index 2eb4ad973231a65a3c12128b20d9ecef2299f3ee..2b137ca389acf4d117c44d06a9e55daf83853484 100755 (executable)
@@ -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}" \
index 4aa55da5b04ae9b59cf1590ba496dffc0b5b405d..27b3a0e9d25cb36591c57853f88e8f43df29a18a 100755 (executable)
 . $(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}"
index 1d0cac316953fedb344c235dbc2acca78aa23147..97cf2720bf6ecd95832429fef7991d2c9afabe7c 100755 (executable)
@@ -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