vp8_multi_resolution_encoder.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 vp8_multi_resolution_encoder example. To add new
  12. ## tests to this file, do the following:
  13. ## 1. Write a shell function (this is your test).
  14. ## 2. Add the function to vp8_mre_tests (on a new line).
  15. ##
  16. . $(dirname $0)/tools_common.sh
  17. # Environment check: $YUV_RAW_INPUT is required.
  18. vp8_multi_resolution_encoder_verify_environment() {
  19. if [ "$(vpx_config_option_enabled CONFIG_MULTI_RES_ENCODING)" = "yes" ]; then
  20. if [ ! -e "${YUV_RAW_INPUT}" ]; then
  21. elog "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
  22. return 1
  23. fi
  24. local app="vp8_multi_resolution_encoder"
  25. if [ -z "$(vpx_tool_path "${app}")" ]; then
  26. elog "${app} not found. It must exist in LIBVPX_BIN_PATH or its parent."
  27. return 1
  28. fi
  29. fi
  30. }
  31. # Runs vp8_multi_resolution_encoder. Simply forwards all arguments to
  32. # vp8_multi_resolution_encoder after building path to the executable.
  33. vp8_mre() {
  34. local encoder="$(vpx_tool_path vp8_multi_resolution_encoder)"
  35. if [ ! -x "${encoder}" ]; then
  36. elog "${encoder} does not exist or is not executable."
  37. return 1
  38. fi
  39. eval "${VPX_TEST_PREFIX}" "${encoder}" "$@" ${devnull}
  40. }
  41. vp8_multi_resolution_encoder_three_formats() {
  42. local output_files="${VPX_TEST_OUTPUT_DIR}/vp8_mre_0.ivf
  43. ${VPX_TEST_OUTPUT_DIR}/vp8_mre_1.ivf
  44. ${VPX_TEST_OUTPUT_DIR}/vp8_mre_2.ivf"
  45. local layer_bitrates="150 80 50"
  46. local keyframe_insert="200"
  47. local temporal_layers="3 3 3"
  48. local framerate="30"
  49. if [ "$(vpx_config_option_enabled CONFIG_MULTI_RES_ENCODING)" = "yes" ]; then
  50. if [ "$(vp8_encode_available)" = "yes" ]; then
  51. # Param order:
  52. # Input width
  53. # Input height
  54. # Framerate
  55. # Input file path
  56. # Output file names
  57. # Layer bitrates
  58. # Temporal layers
  59. # Keyframe insert
  60. # Output PSNR
  61. vp8_mre "${YUV_RAW_INPUT_WIDTH}" \
  62. "${YUV_RAW_INPUT_HEIGHT}" \
  63. "${framerate}" \
  64. "${YUV_RAW_INPUT}" \
  65. ${output_files} \
  66. ${layer_bitrates} \
  67. ${temporal_layers} \
  68. "${keyframe_insert}" \
  69. 0
  70. for output_file in ${output_files}; do
  71. if [ ! -e "${output_file}" ]; then
  72. elog "Missing output file: ${output_file}"
  73. return 1
  74. fi
  75. done
  76. fi
  77. fi
  78. }
  79. vp8_mre_tests="vp8_multi_resolution_encoder_three_formats"
  80. run_tests vp8_multi_resolution_encoder_verify_environment "${vp8_mre_tests}"