simple_decoder.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/sh
  2. ##
  3. ## Copyright (c) 2014 The WebM project authors. All Rights Reserved.
  4. ##
  5. ## Use of this source code is governed by a BSD-style license
  6. ## that can be found in the LICENSE file in the root of the source
  7. ## tree. An additional intellectual property rights grant can be found
  8. ## in the file PATENTS. All contributing project authors may
  9. ## be found in the AUTHORS file in the root of the source tree.
  10. ##
  11. ## This file tests the libvpx simple_decoder example code. To add new tests to
  12. ## this file, do the following:
  13. ## 1. Write a shell function (this is your test).
  14. ## 2. Add the function to simple_decoder_tests (on a new line).
  15. ##
  16. . $(dirname $0)/tools_common.sh
  17. # Environment check: Make sure input is available:
  18. # $VP8_IVF_FILE and $VP9_IVF_FILE are required.
  19. simple_decoder_verify_environment() {
  20. if [ ! -e "${VP8_IVF_FILE}" ] || [ ! -e "${VP9_IVF_FILE}" ]; then
  21. echo "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
  22. return 1
  23. fi
  24. }
  25. # Runs simple_decoder using $1 as input file. $2 is the codec name, and is used
  26. # solely to name the output file.
  27. simple_decoder() {
  28. local decoder="${LIBVPX_BIN_PATH}/simple_decoder${VPX_TEST_EXE_SUFFIX}"
  29. local input_file="$1"
  30. local codec="$2"
  31. local output_file="${VPX_TEST_OUTPUT_DIR}/simple_decoder_${codec}.raw"
  32. if [ ! -x "${decoder}" ]; then
  33. elog "${decoder} does not exist or is not executable."
  34. return 1
  35. fi
  36. eval "${VPX_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \
  37. ${devnull}
  38. [ -e "${output_file}" ] || return 1
  39. }
  40. simple_decoder_vp8() {
  41. if [ "$(vp8_decode_available)" = "yes" ]; then
  42. simple_decoder "${VP8_IVF_FILE}" vp8 || return 1
  43. fi
  44. }
  45. simple_decoder_vp9() {
  46. if [ "$(vp9_decode_available)" = "yes" ]; then
  47. simple_decoder "${VP9_IVF_FILE}" vp9 || return 1
  48. fi
  49. }
  50. simple_decoder_tests="simple_decoder_vp8
  51. simple_decoder_vp9"
  52. run_tests simple_decoder_verify_environment "${simple_decoder_tests}"