Fix fate-lavfi-pixfmts test cross-compilation.
[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
8456d947
SS
27# Returns the elements present in $1 but not in $2.
28get_exclusive_elements() (
29 for elt1 in $1; do
30 common=""
31 for elt2 in $2; do
32 [ $elt1 = $elt2 ] && common="true" && break;
33 done
34 [ -z "$common" ] && res="$res $elt1"
35 done
36
37 echo $res
38)
39
77f66963 40do_lavfi() {
1400bd5a 41 vfilters="slicify=random,$2"
77f66963 42
e6e3069b
MR
43 if [ $test = $1 ] ; then
44 do_video_encoding ${test}.nut "" "-vcodec rawvideo -vf $vfilters"
77f66963
SS
45 fi
46}
47
cec96e8d
SS
48do_lavfi "crop" "crop=100:100"
49do_lavfi "crop_scale" "crop=100:100,scale=400:-1"
50do_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"
51do_lavfi "crop_vflip" "crop=100:100,vflip"
52do_lavfi "null" "null"
53do_lavfi "scale200" "scale=200:200"
54do_lavfi "scale500" "scale=500:500"
55do_lavfi "vflip" "vflip"
56do_lavfi "vflip_crop" "vflip,crop=100:100"
57do_lavfi "vflip_vflip" "vflip,vflip"
77f66963 58
e34d5db5
SS
59# all these filters have exactly one input and exactly one output
60filters_args="
61crop=100:100:100:100
62null
63pad=500:400:20:20
64scale=200:100
65vflip
66"
67
fc25373b 68if [ -n "$do_pixfmts_be" ] || [ -n "$do_pixfmts_le" ]; then
43d2c6a5 69 showfiltfmts="$target_exec $target_path/tools/lavfi-showfiltfmts"
e59cfd78 70 # exclude pixel formats which are not supported as input
2b346e04 71 excluded_pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^\..\.' | cut -d' ' -f2)"
8456d947 72
43d2c6a5 73 scale_out_pix_fmts=$($showfiltfmts scale | grep "^OUTPUT" | cut -d: -f2)
8456d947 74 scale_out_pix_fmts=$(get_exclusive_elements "$scale_out_pix_fmts" "$excluded_pix_fmts")
e34d5db5
SS
75
76 for filter_args in $filters_args; do
77 filter=$(echo $filter_args | sed -e 's/\([^=]\+\)=.*/\1/')
43d2c6a5 78 in_pix_fmts=$($showfiltfmts $filter | grep "^INPUT" | cut -d: -f2)
e34d5db5
SS
79 pix_fmts=$(get_common_elements "$in_pix_fmts" "$scale_out_pix_fmts")
80
81 for pix_fmt in $pix_fmts; do
0a87d541 82 output=pixfmts-${filter}-${pix_fmt}.nut
65e17eae 83 do_video_encoding $output "" \
e34d5db5
SS
84 "-vf slicify=random,format=$pix_fmt,$filter_args -vcodec rawvideo -pix_fmt $pix_fmt"
85 done
86 done
87fi
88
7c1bb914 89if [ -n "$do_pixdesc_be" ] || [ -n "$do_pixdesc_le" ]; then
ce2e4ae3 90 pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2)"
ce2e4ae3 91 for pix_fmt in $pix_fmts; do
8fae6e7c
MR
92 output=lavfi_pixdesc-${pix_fmt}.nut
93 do_video_encoding $output "" \
ce2e4ae3 94 "-vf slicify=random,format=$pix_fmt,pixdesctest -vcodec rawvideo -pix_fmt $pix_fmt"
8fae6e7c 95 rm ${outfile}${output}
ce2e4ae3
SS
96 done
97fi
98
77f66963
SS
99# TODO: add tests for
100# direct rendering,
77f66963 101# chains with feedback loops