Remove useless variables in get_common_elements().
[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
e34d5db5 17get_common_elements() (
e34d5db5
SS
18 for elt1 in $1; do
19 for elt2 in $2; do
20 [ $elt1 = $elt2 ] && res="$res $elt1 "
21 done
22 done
23
24 echo $res
25)
26
77f66963
SS
27do_lavfi() {
28 test_name=$1
29 eval test=\$do_$test_name
1400bd5a 30 vfilters="slicify=random,$2"
77f66963
SS
31
32 if [ -n "$test" ] ; then
e904c51f 33 do_video_encoding ${test_name}.nut "" "-vcodec rawvideo -vf $vfilters"
77f66963
SS
34 fi
35}
36
cec96e8d
SS
37do_lavfi "crop" "crop=100:100"
38do_lavfi "crop_scale" "crop=100:100,scale=400:-1"
39do_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"
40do_lavfi "crop_vflip" "crop=100:100,vflip"
41do_lavfi "null" "null"
42do_lavfi "scale200" "scale=200:200"
43do_lavfi "scale500" "scale=500:500"
44do_lavfi "vflip" "vflip"
45do_lavfi "vflip_crop" "vflip,crop=100:100"
46do_lavfi "vflip_vflip" "vflip,vflip"
77f66963 47
e34d5db5
SS
48# all these filters have exactly one input and exactly one output
49filters_args="
50crop=100:100:100:100
51null
52pad=500:400:20:20
53scale=200:100
54vflip
55"
56
57if [ -n "$do_lavfi_pix_fmts" ]; then
58 scale_out_pix_fmts=$(tools/lavfi-showfiltfmts scale | grep "^OUTPUT" | cut -d: -f2)
59
60 for filter_args in $filters_args; do
61 filter=$(echo $filter_args | sed -e 's/\([^=]\+\)=.*/\1/')
62 in_pix_fmts=$(tools/lavfi-showfiltfmts $filter | grep "^INPUT" | cut -d: -f2)
63 pix_fmts=$(get_common_elements "$in_pix_fmts" "$scale_out_pix_fmts")
64
65 for pix_fmt in $pix_fmts; do
66 do_video_encoding "${pix_fmt}-${filter}.nut" "" \
67 "-vf slicify=random,format=$pix_fmt,$filter_args -vcodec rawvideo -pix_fmt $pix_fmt"
68 done
69 done
70fi
71
77f66963
SS
72# TODO: add tests for
73# direct rendering,
77f66963
SS
74# chains with feedback loops
75
76rm -f "$bench" "$bench2"