Revision 7e7fc4e9

View differences:

tests/lavfi-regression.sh
14 14
rm -f "$logfile"
15 15
rm -f "$benchfile"
16 16

  
17
get_common_elements() (
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

  
27
# Returns the elements present in $1 but not in $2.
28
get_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

  
40 17
do_lavfi() {
41 18
    vfilters="slicify=random,$2"
42 19

  
......
67 44

  
68 45
if [ -n "$do_pixfmts_be" ] || [ -n "$do_pixfmts_le" ]; then
69 46
    showfiltfmts="$target_exec $target_path/tools/lavfi-showfiltfmts"
70
    # exclude pixel formats which are not supported as input
71
    excluded_pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^\..\.' | cut -d' ' -f2)"
47
    exclude_fmts=${outfile}exclude_fmts
48
    out_fmts=${outfile}out_fmts
72 49

  
73
    scale_out_pix_fmts=$($showfiltfmts scale | grep "^OUTPUT" | cut -d: -f2)
74
    scale_out_pix_fmts=$(get_exclusive_elements "$scale_out_pix_fmts" "$excluded_pix_fmts")
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
75 53

  
76 54
    for filter_args in $filters_args; do
77
        filter=$(echo $filter_args | sed -e 's/\([^=]\+\)=.*/\1/')
78
        in_pix_fmts=$($showfiltfmts $filter | grep "^INPUT" | cut -d: -f2)
79
        pix_fmts=$(get_common_elements "$in_pix_fmts" "$scale_out_pix_fmts")
55
        filter=${filter_args%=*}
56
        pix_fmts=$($showfiltfmts $filter | awk '/^INPUT/{ print $3 }' | sort | comm -12 - $out_fmts)
80 57

  
81 58
        for pix_fmt in $pix_fmts; do
82 59
            output=pixfmts-${filter}-${pix_fmt}.nut
......
85 62
            rm ${outfile}${output}
86 63
        done
87 64
    done
65

  
66
    rm $exclude_fmts $out_fmts
88 67
fi
89 68

  
90 69
if [ -n "$do_pixdesc_be" ] || [ -n "$do_pixdesc_le" ]; then

Also available in: Unified diff