Statistics
| Branch: | Revision:

ffmpeg / tests / lavfi-regression.sh @ 2a569799

History | View | Annotate | Download (2.69 KB)

1 77f66963 Stefano Sabatini
#!/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 f4b1e21a Mans Rullgard
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 77f66963 Stefano Sabatini
do_lavfi() {
27 1400bd5a Stefano Sabatini
    vfilters="slicify=random,$2"
28 77f66963 Stefano Sabatini
29 e6e3069b Måns Rullgård
    if [ $test = $1 ] ; then
30 f4b1e21a Mans Rullgard
        do_video_filter $test "$vfilters"
31 77f66963 Stefano Sabatini
    fi
32
}
33
34 75b67a8a Stefano Sabatini
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 cec96e8d Stefano Sabatini
do_lavfi "null"               "null"
39
do_lavfi "scale200"           "scale=200:200"
40
do_lavfi "scale500"           "scale=500:500"
41
do_lavfi "vflip"              "vflip"
42 75b67a8a Stefano Sabatini
do_lavfi "vflip_crop"         "vflip,crop=iw-100:ih-100:100:100"
43 cec96e8d Stefano Sabatini
do_lavfi "vflip_vflip"        "vflip,vflip"
44 77f66963 Stefano Sabatini
45 73177b6c Stefano Sabatini
do_lavfi_pixfmts(){
46
    test ${test%_[bl]e} = pixfmts_$1 || return 0
47
    filter=$1
48
    filter_args=$2
49 e34d5db5 Stefano Sabatini
50 43d2c6a5 Stefano Sabatini
    showfiltfmts="$target_exec $target_path/tools/lavfi-showfiltfmts"
51 9c87c037 Måns Rullgård
    exclude_fmts=${outfile}${1}_exclude_fmts
52
    out_fmts=${outfile}${1}_out_fmts
53 8456d947 Stefano Sabatini
54 7e7fc4e9 Måns Rullgård
    # 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 42907c6a Måns Rullgård
    $showfiltfmts scale | awk -F '[ \r]' '/^OUTPUT/{ print $3 }' | sort | comm -23 - $exclude_fmts >$out_fmts
57 e34d5db5 Stefano Sabatini
58 42907c6a Måns Rullgård
    pix_fmts=$($showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ print $3 }' | sort | comm -12 - $out_fmts)
59 04307697 Stefano Sabatini
    for pix_fmt in $pix_fmts; do
60 f4b1e21a Mans Rullgard
        do_video_filter $pix_fmt "slicify=random,format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt
61 04307697 Stefano Sabatini
    done
62 7e7fc4e9 Måns Rullgård
63
    rm $exclude_fmts $out_fmts
64 73177b6c Stefano Sabatini
}
65
66
# all these filters have exactly one input and exactly one output
67 b5670209 Stefano Sabatini
do_lavfi_pixfmts "copy"    ""
68 73177b6c Stefano Sabatini
do_lavfi_pixfmts "crop"    "100:100:100:100"
69 a1e171df Stefano Sabatini
do_lavfi_pixfmts "hflip"   ""
70 73177b6c Stefano Sabatini
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 e34d5db5 Stefano Sabatini
75 7c1bb914 Måns Rullgård
if [ -n "$do_pixdesc_be" ] || [ -n "$do_pixdesc_le" ]; then
76 546017fc Stefano Sabatini
    pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2 | sort)"
77 ce2e4ae3 Stefano Sabatini
    for pix_fmt in $pix_fmts; do
78 f4b1e21a Mans Rullgard
        do_video_filter $pix_fmt "slicify=random,format=$pix_fmt,pixdesctest" -pix_fmt $pix_fmt
79 ce2e4ae3 Stefano Sabatini
    done
80
fi
81
82 77f66963 Stefano Sabatini
# TODO: add tests for
83
# direct rendering,
84
# chains with feedback loops