set_maps.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 set_maps example. To add new tests to this file,
  12. ## do the following:
  13. ## 1. Write a shell function (this is your test).
  14. ## 2. Add the function to set_maps_tests (on a new line).
  15. ##
  16. . $(dirname $0)/tools_common.sh
  17. # Environment check: $YUV_RAW_INPUT is required, and set_maps must exist in
  18. # $LIBVPX_BIN_PATH.
  19. set_maps_verify_environment() {
  20. if [ ! -e "${YUV_RAW_INPUT}" ]; then
  21. echo "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
  22. return 1
  23. fi
  24. if [ -z "$(vpx_tool_path set_maps)" ]; then
  25. elog "set_maps not found. It must exist in LIBVPX_BIN_PATH or its parent."
  26. return 1
  27. fi
  28. }
  29. # Runs set_maps using the codec specified by $1.
  30. set_maps() {
  31. local encoder="$(vpx_tool_path set_maps)"
  32. local codec="$1"
  33. local output_file="${VPX_TEST_OUTPUT_DIR}/set_maps_${codec}.ivf"
  34. eval "${VPX_TEST_PREFIX}" "${encoder}" "${codec}" "${YUV_RAW_INPUT_WIDTH}" \
  35. "${YUV_RAW_INPUT_HEIGHT}" "${YUV_RAW_INPUT}" "${output_file}" \
  36. ${devnull}
  37. [ -e "${output_file}" ] || return 1
  38. }
  39. set_maps_vp8() {
  40. if [ "$(vp8_encode_available)" = "yes" ]; then
  41. set_maps vp8 || return 1
  42. fi
  43. }
  44. set_maps_vp9() {
  45. if [ "$(vp9_encode_available)" = "yes" ]; then
  46. set_maps vp9 || return 1
  47. fi
  48. }
  49. set_maps_tests="set_maps_vp8
  50. set_maps_vp9"
  51. run_tests set_maps_verify_environment "${set_maps_tests}"