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.

103 lines
3.5KB

  1. #!/bin/sh
  2. #
  3. # automatic regression test for libavfilter
  4. #
  5. #
  6. #set -x
  7. #FIXME the whole file should be removed
  8. set -e
  9. . $(dirname $0)/regression-funcs.sh
  10. eval do_$test=y
  11. do_video_filter() {
  12. label=$1
  13. filters="$2"
  14. shift 2
  15. printf '%-20s' $label
  16. run_avconv $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src \
  17. $ENC_OPTS -vf "$filters" -vcodec rawvideo $* -f nut md5:
  18. }
  19. do_lavfi_plain() {
  20. vfilters="$2"
  21. if [ $test = $1 ] ; then
  22. do_video_filter $test "$2"
  23. fi
  24. }
  25. do_lavfi() {
  26. do_lavfi_plain $1 "$2"
  27. }
  28. do_lavfi_colormatrix() {
  29. do_lavfi "${1}1" "$1=$4:$5,$1=$5:$3,$1=$3:$4,$1=$4:$3,$1=$3:$5,$1=$5:$2"
  30. do_lavfi "${1}2" "$1=$2:$3,$1=$3:$2,$1=$2:$4,$1=$4:$2,$1=$2:$5,$1=$5:$4"
  31. }
  32. do_lavfi_plain "alphamerge_rgb" "[in]format=bgra,split,alphamerge[out]"
  33. do_lavfi_plain "alphamerge_yuv" "[in]format=yuv420p,split,alphamerge[out]"
  34. do_lavfi_plain "alphaextract_rgb" "[in]format=bgra,split,alphamerge,split[o3][o4];[o4]alphaextract[alpha];[o3][alpha]alphamerge[out]"
  35. do_lavfi_plain "alphaextract_yuv" "[in]format=yuv420p,split,alphamerge,split[o3][o4];[o4]alphaextract[alpha];[o3][alpha]alphamerge[out]"
  36. do_lavfi_colormatrix "colormatrix" bt709 fcc bt601 smpte240m
  37. do_lavfi_pixfmts(){
  38. testname=$1;
  39. test ${test%_[bl]e} = $testname || return 0
  40. filter=$2
  41. filter_args=$3
  42. prefilter_chain=$4
  43. showfiltfmts="$target_exec $target_path/libavfilter/filtfmts-test"
  44. scale_exclude_fmts=${outfile}${testname}_scale_exclude_fmts
  45. scale_in_fmts=${outfile}${testname}_scale_in_fmts
  46. scale_out_fmts=${outfile}${testname}_scale_out_fmts
  47. in_fmts=${outfile}${testname}_in_fmts
  48. # exclude pixel formats which are not supported as input
  49. $showfiltfmts scale | awk -F '[ \r]' '/^INPUT/{ fmt=substr($3, 5); print fmt }' | sort >$scale_in_fmts
  50. $showfiltfmts scale | awk -F '[ \r]' '/^OUTPUT/{ fmt=substr($3, 5); print fmt }' | sort >$scale_out_fmts
  51. comm -12 $scale_in_fmts $scale_out_fmts >$scale_exclude_fmts
  52. $showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ fmt=substr($3, 5); print fmt }' | sort >$in_fmts
  53. pix_fmts=$(comm -12 $scale_exclude_fmts $in_fmts)
  54. for pix_fmt in $pix_fmts; do
  55. do_video_filter $pix_fmt "${prefilter_chain}format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt
  56. done
  57. rm $in_fmts $scale_in_fmts $scale_out_fmts $scale_exclude_fmts
  58. }
  59. # all these filters have exactly one input and exactly one output
  60. do_lavfi_pixfmts "field" "field" "bottom"
  61. do_lavfi_pixfmts "histeq" "histeq" "antibanding=strong"
  62. do_lavfi_pixfmts "il" "il" "luma_mode=d:chroma_mode=d:alpha_mode=d"
  63. do_lavfi_pixfmts "kerndeint" "kerndeint" "" "tinterlace=interleave_top,"
  64. do_lavfi_pixfmts "pixfmts_super2xsai" "super2xsai"
  65. do_lavfi_pixfmts "tinterlace_merge" "tinterlace" "merge"
  66. do_lavfi_pixfmts "tinterlace_pad" "tinterlace" "pad"
  67. do_lavfi_lavd() {
  68. label=$1
  69. graph=$2
  70. shift 2
  71. [ $test = $label ] || return 0
  72. printf '%-20s' $label
  73. run_avconv $DEC_OPTS -f lavfi -i $graph \
  74. $ENC_OPTS -vcodec rawvideo $* -f nut md5:
  75. }
  76. do_lavfi_lavd "life" "life=s=40x40:r=5:seed=42:mold=64" -t 2
  77. do_lavfi_lavd "testsrc" "testsrc=r=7:n=2:d=10"
  78. do_lavfi_lavd "scalenorm" "sws_flags=+accurate_rnd+bitexact;testsrc=s=128x96:d=1:r=5,format=yuv420p[a];testsrc=s=160x120:d=1:r=5[b];[a][b]concat=unsafe=1,scale=flags=+accurate_rnd+bitexact"
  79. # TODO: add tests for
  80. # direct rendering,
  81. # chains with feedback loops