lavfi-regression.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. do_lavfi() {
  13. vfilters="slicify=random,$2"
  14. if [ $test = $1 ] ; then
  15. do_video_encoding ${test}.nut "" "-vcodec rawvideo -vf $vfilters"
  16. fi
  17. }
  18. do_lavfi "crop" "crop=iw-100:ih-100:100:100"
  19. do_lavfi "crop_scale" "crop=iw-100:ih-100:100:100,scale=400:-1"
  20. do_lavfi "crop_scale_vflip" "null,null,crop=iw-200:ih-200:200:200,crop=iw-20:ih-20:20:20,scale=200:200,scale=250:250,vflip,vflip,null,scale=200:200,crop=iw-100:ih-100:100:100,vflip,scale=200:200,null,vflip,crop=iw-100:ih-100:100:100,null"
  21. do_lavfi "crop_vflip" "crop=iw-100:ih-100:100:100,vflip"
  22. do_lavfi "null" "null"
  23. do_lavfi "scale200" "scale=200:200"
  24. do_lavfi "scale500" "scale=500:500"
  25. do_lavfi "vflip" "vflip"
  26. do_lavfi "vflip_crop" "vflip,crop=iw-100:ih-100:100:100"
  27. do_lavfi "vflip_vflip" "vflip,vflip"
  28. do_lavfi_pixfmts(){
  29. test ${test%_[bl]e} = pixfmts_$1 || return 0
  30. filter=$1
  31. filter_args=$2
  32. showfiltfmts="$target_exec $target_path/tools/lavfi-showfiltfmts"
  33. exclude_fmts=${outfile}${1}_exclude_fmts
  34. out_fmts=${outfile}${1}_out_fmts
  35. # exclude pixel formats which are not supported as input
  36. $ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^\..\.' | cut -d' ' -f2 | sort >$exclude_fmts
  37. $showfiltfmts scale | awk -F '[ \r]' '/^OUTPUT/{ print $3 }' | sort | comm -23 - $exclude_fmts >$out_fmts
  38. pix_fmts=$($showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ print $3 }' | sort | comm -12 - $out_fmts)
  39. for pix_fmt in $pix_fmts; do
  40. output=${test}-${pix_fmt}.nut
  41. do_video_encoding $output "" \
  42. "-vf slicify=random,format=$pix_fmt,$filter=$filter_args -vcodec rawvideo -pix_fmt $pix_fmt"
  43. rm ${outfile}${output}
  44. done
  45. rm $exclude_fmts $out_fmts
  46. }
  47. # all these filters have exactly one input and exactly one output
  48. do_lavfi_pixfmts "copy" ""
  49. do_lavfi_pixfmts "crop" "100:100:100:100"
  50. do_lavfi_pixfmts "hflip" ""
  51. do_lavfi_pixfmts "null" ""
  52. do_lavfi_pixfmts "pad" "500:400:20:20"
  53. do_lavfi_pixfmts "scale" "200:100"
  54. do_lavfi_pixfmts "vflip" ""
  55. if [ -n "$do_pixdesc_be" ] || [ -n "$do_pixdesc_le" ]; then
  56. pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2 | sort)"
  57. for pix_fmt in $pix_fmts; do
  58. output=lavfi_pixdesc-${pix_fmt}.nut
  59. do_video_encoding $output "" \
  60. "-vf slicify=random,format=$pix_fmt,pixdesctest -vcodec rawvideo -pix_fmt $pix_fmt"
  61. rm ${outfile}${output}
  62. done
  63. fi
  64. # TODO: add tests for
  65. # direct rendering,
  66. # chains with feedback loops