588a53f69e11aca8cc1da5860441ca7554fef0f2
[libav.git] / 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 do_video_filter() {
15 label=$1
16 filters=$2
17 shift 2
18 printf '%-20s' $label
19 run_avconv $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src \
20 $ENC_OPTS -vf "$filters" -vcodec rawvideo $* -f nut md5:
21 }
22
23 do_lavfi_pixfmts(){
24 test ${test%_[bl]e} = pixfmts_$1 || return 0
25 filter=$1
26 filter_args=$2
27
28 showfiltfmts="$target_exec $target_path/libavfilter/filtfmts-test"
29 exclude_fmts=${outfile}${1}_exclude_fmts
30 out_fmts=${outfile}${1}_out_fmts
31
32 # exclude pixel formats which are not supported as input
33 $avconv -pix_fmts list 2>/dev/null | awk 'NR > 8 && /^\..\./ { print $2 }' | sort >$exclude_fmts
34 $showfiltfmts scale | awk -F '[ \r]' '/^OUTPUT/{ print $3 }' | sort | comm -23 - $exclude_fmts >$out_fmts
35
36 pix_fmts=$($showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ print $3 }' | sort | comm -12 - $out_fmts)
37 for pix_fmt in $pix_fmts; do
38 do_video_filter $pix_fmt "format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt
39 done
40
41 rm $exclude_fmts $out_fmts
42 }
43
44 # all these filters have exactly one input and exactly one output
45 do_lavfi_pixfmts "copy" ""
46 do_lavfi_pixfmts "crop" "100:100:100:100"
47 do_lavfi_pixfmts "hflip" ""
48 do_lavfi_pixfmts "null" ""
49 do_lavfi_pixfmts "pad" "500:400:20:20"
50 do_lavfi_pixfmts "scale" "200:100"
51 do_lavfi_pixfmts "vflip" ""
52
53 # TODO: add tests for
54 # direct rendering,
55 # chains with feedback loops