Implement set_ne_test_deps() and use if for the lavfi pixdesc test.
[libav.git] / tests / lavfi-regression.sh
CommitLineData
77f66963
SS
1#!/bin/sh
2#
3# automatic regression test for libavfilter
4#
5#
6#set -x
7
8set -e
9
10. $(dirname $0)/regression-funcs.sh
11
12eval do_$test=y
13
14rm -f "$logfile"
15rm -f "$benchfile"
16
17do_lavfi() {
1400bd5a 18 vfilters="slicify=random,$2"
77f66963 19
e6e3069b
MR
20 if [ $test = $1 ] ; then
21 do_video_encoding ${test}.nut "" "-vcodec rawvideo -vf $vfilters"
77f66963
SS
22 fi
23}
24
cec96e8d
SS
25do_lavfi "crop" "crop=100:100"
26do_lavfi "crop_scale" "crop=100:100,scale=400:-1"
27do_lavfi "crop_scale_vflip" "null,null,crop=200:200,crop=20:20,scale=200:200,scale=250:250,vflip,vflip,null,scale=200:200,crop=100:100,vflip,scale=200:200,null,vflip,crop=100:100,null"
28do_lavfi "crop_vflip" "crop=100:100,vflip"
29do_lavfi "null" "null"
30do_lavfi "scale200" "scale=200:200"
31do_lavfi "scale500" "scale=500:500"
32do_lavfi "vflip" "vflip"
33do_lavfi "vflip_crop" "vflip,crop=100:100"
34do_lavfi "vflip_vflip" "vflip,vflip"
77f66963 35
e34d5db5
SS
36# all these filters have exactly one input and exactly one output
37filters_args="
38crop=100:100:100:100
39null
40pad=500:400:20:20
41scale=200:100
42vflip
43"
44
fc25373b 45if [ -n "$do_pixfmts_be" ] || [ -n "$do_pixfmts_le" ]; then
43d2c6a5 46 showfiltfmts="$target_exec $target_path/tools/lavfi-showfiltfmts"
7e7fc4e9
MR
47 exclude_fmts=${outfile}exclude_fmts
48 out_fmts=${outfile}out_fmts
8456d947 49
7e7fc4e9
MR
50 # exclude pixel formats which are not supported as input
51 $ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^\..\.' | cut -d' ' -f2 | sort >$exclude_fmts
52 $showfiltfmts scale | awk '/^OUTPUT/{ print $3 }' | sort | comm -23 - $exclude_fmts >$out_fmts
e34d5db5
SS
53
54 for filter_args in $filters_args; do
7e7fc4e9
MR
55 filter=${filter_args%=*}
56 pix_fmts=$($showfiltfmts $filter | awk '/^INPUT/{ print $3 }' | sort | comm -12 - $out_fmts)
e34d5db5
SS
57
58 for pix_fmt in $pix_fmts; do
0a87d541 59 output=pixfmts-${filter}-${pix_fmt}.nut
65e17eae 60 do_video_encoding $output "" \
e34d5db5 61 "-vf slicify=random,format=$pix_fmt,$filter_args -vcodec rawvideo -pix_fmt $pix_fmt"
79ec38d1 62 rm ${outfile}${output}
e34d5db5
SS
63 done
64 done
7e7fc4e9
MR
65
66 rm $exclude_fmts $out_fmts
e34d5db5
SS
67fi
68
7c1bb914 69if [ -n "$do_pixdesc_be" ] || [ -n "$do_pixdesc_le" ]; then
ce2e4ae3 70 pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2)"
ce2e4ae3 71 for pix_fmt in $pix_fmts; do
8fae6e7c
MR
72 output=lavfi_pixdesc-${pix_fmt}.nut
73 do_video_encoding $output "" \
ce2e4ae3 74 "-vf slicify=random,format=$pix_fmt,pixdesctest -vcodec rawvideo -pix_fmt $pix_fmt"
8fae6e7c 75 rm ${outfile}${output}
ce2e4ae3
SS
76 done
77fi
78
77f66963
SS
79# TODO: add tests for
80# direct rendering,
77f66963 81# chains with feedback loops