You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.8KB

  1. #!/bin/sh
  2. #
  3. # automatic regression test for libavfilter
  4. #
  5. #
  6. #set -x
  7. set -e
  8. . $(dirname $0)/regression-funcs.sh
  9. eval do_$test=y
  10. rm -f "$logfile"
  11. rm -f "$benchfile"
  12. get_common_elements() (
  13. for elt1 in $1; do
  14. for elt2 in $2; do
  15. [ $elt1 = $elt2 ] && res="$res $elt1 "
  16. done
  17. done
  18. echo $res
  19. )
  20. # Returns the elements present in $1 but not in $2.
  21. get_exclusive_elements() (
  22. for elt1 in $1; do
  23. common=""
  24. for elt2 in $2; do
  25. [ $elt1 = $elt2 ] && common="true" && break;
  26. done
  27. [ -z "$common" ] && res="$res $elt1"
  28. done
  29. echo $res
  30. )
  31. do_lavfi() {
  32. vfilters="slicify=random,$2"
  33. if [ $test = $1 ] ; then
  34. do_video_encoding ${test}.nut "" "-vcodec rawvideo -vf $vfilters"
  35. fi
  36. }
  37. do_lavfi "crop" "crop=100:100"
  38. do_lavfi "crop_scale" "crop=100:100,scale=400:-1"
  39. do_lavfi "crop_scale_vflip" "null,null,crop=200:200,crop=20:20,scale=200:200,scale=250:250,vflip,vflip,null,scale=200:200,crop=100:100,vflip,scale=200:200,null,vflip,crop=100:100,null"
  40. do_lavfi "crop_vflip" "crop=100:100,vflip"
  41. do_lavfi "null" "null"
  42. do_lavfi "scale200" "scale=200:200"
  43. do_lavfi "scale500" "scale=500:500"
  44. do_lavfi "vflip" "vflip"
  45. do_lavfi "vflip_crop" "vflip,crop=100:100"
  46. do_lavfi "vflip_vflip" "vflip,vflip"
  47. # all these filters have exactly one input and exactly one output
  48. filters_args="
  49. crop=100:100:100:100
  50. null
  51. pad=500:400:20:20
  52. scale=200:100
  53. vflip
  54. "
  55. if [ -n "$do_lavfi_pix_fmts" ]; then
  56. # exclude pixel formats which are not supported as input
  57. excluded_pix_fmts="$(ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^\..\.' | cut -d' ' -f2)"
  58. scale_out_pix_fmts=$(tools/lavfi-showfiltfmts scale | grep "^OUTPUT" | cut -d: -f2)
  59. scale_out_pix_fmts=$(get_exclusive_elements "$scale_out_pix_fmts" "$excluded_pix_fmts")
  60. for filter_args in $filters_args; do
  61. filter=$(echo $filter_args | sed -e 's/\([^=]\+\)=.*/\1/')
  62. in_pix_fmts=$(tools/lavfi-showfiltfmts $filter | grep "^INPUT" | cut -d: -f2)
  63. pix_fmts=$(get_common_elements "$in_pix_fmts" "$scale_out_pix_fmts")
  64. for pix_fmt in $pix_fmts; do
  65. do_video_encoding "${pix_fmt}-${filter}.nut" "" \
  66. "-vf slicify=random,format=$pix_fmt,$filter_args -vcodec rawvideo -pix_fmt $pix_fmt"
  67. done
  68. done
  69. fi
  70. if [ -n "$do_pixdesc_be" ] || [ -n "$do_pixdesc_le" ]; then
  71. pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2)"
  72. for pix_fmt in $pix_fmts; do
  73. output=lavfi_pixdesc-${pix_fmt}.nut
  74. do_video_encoding $output "" \
  75. "-vf slicify=random,format=$pix_fmt,pixdesctest -vcodec rawvideo -pix_fmt $pix_fmt"
  76. rm ${outfile}${output}
  77. done
  78. fi
  79. # TODO: add tests for
  80. # direct rendering,
  81. # chains with feedback loops