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/tools_common.sh b/test/tools_common.sh
index 1d0cac3..97cf272 100755
--- a/test/tools_common.sh
+++ b/test/tools_common.sh
@@ -309,6 +309,34 @@
   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