]> git.sesse.net Git - ffmpeg/blob - tests/lavfi-regression.sh
cosmetics: K&R coding style and more whitespace for Flash Screen Video
[ffmpeg] / tests / lavfi-regression.sh
1 #!/bin/sh
2 #
3 # automatic regression test for libavfilter
4 #
5 #
6 #set -x
7
8 set -e
9
10 . $(dirname $0)/regression-funcs.sh
11
12 eval do_$test=y
13
14 rm -f "$logfile"
15 rm -f "$benchfile"
16
17 do_video_filter() {
18     label=$1
19     filters=$2
20     shift 2
21     printf '%-20s' $label >>$logfile
22     run_ffmpeg -f image2 -vcodec pgmyuv -i $raw_src    \
23         -vf "$filters" -vcodec rawvideo $* -f nut md5: >>$logfile
24 }
25
26 do_lavfi() {
27     vfilters="slicify=random,$2"
28
29     if [ $test = $1 ] ; then
30         do_video_filter $test "$vfilters"
31     fi
32 }
33
34 do_lavfi "crop"               "crop=iw-100:ih-100:100:100"
35 do_lavfi "crop_scale"         "crop=iw-100:ih-100:100:100,scale=400:-1"
36 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"
37 do_lavfi "crop_vflip"         "crop=iw-100:ih-100:100:100,vflip"
38 do_lavfi "null"               "null"
39 do_lavfi "scale200"           "scale=200:200"
40 do_lavfi "scale500"           "scale=500:500"
41 do_lavfi "vflip"              "vflip"
42 do_lavfi "vflip_crop"         "vflip,crop=iw-100:ih-100:100:100"
43 do_lavfi "vflip_vflip"        "vflip,vflip"
44
45 do_lavfi_pixfmts(){
46     test ${test%_[bl]e} = pixfmts_$1 || return 0
47     filter=$1
48     filter_args=$2
49
50     showfiltfmts="$target_exec $target_path/tools/lavfi-showfiltfmts"
51     exclude_fmts=${outfile}${1}_exclude_fmts
52     out_fmts=${outfile}${1}_out_fmts
53
54     # exclude pixel formats which are not supported as input
55     $ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^\..\.' | cut -d' ' -f2 | sort >$exclude_fmts
56     $showfiltfmts scale | awk -F '[ \r]' '/^OUTPUT/{ print $3 }' | sort | comm -23 - $exclude_fmts >$out_fmts
57
58     pix_fmts=$($showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ print $3 }' | sort | comm -12 - $out_fmts)
59     for pix_fmt in $pix_fmts; do
60         do_video_filter $pix_fmt "slicify=random,format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt
61     done
62
63     rm $exclude_fmts $out_fmts
64 }
65
66 # all these filters have exactly one input and exactly one output
67 do_lavfi_pixfmts "copy"    ""
68 do_lavfi_pixfmts "crop"    "100:100:100:100"
69 do_lavfi_pixfmts "hflip"   ""
70 do_lavfi_pixfmts "null"    ""
71 do_lavfi_pixfmts "pad"     "500:400:20:20"
72 do_lavfi_pixfmts "scale"   "200:100"
73 do_lavfi_pixfmts "vflip"   ""
74
75 if [ -n "$do_pixdesc_be" ] || [ -n "$do_pixdesc_le" ]; then
76     pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2 | sort)"
77     for pix_fmt in $pix_fmts; do
78         do_video_filter $pix_fmt "slicify=random,format=$pix_fmt,pixdesctest" -pix_fmt $pix_fmt
79     done
80 fi
81
82 # TODO: add tests for
83 # direct rendering,
84 # chains with feedback loops