Statistics
| Branch: | Revision:

ffmpeg / tests / fate-run.sh @ cdaf4b79

History | View | Annotate | Download (1.29 KB)

1
#! /bin/sh
2

    
3
base=$(dirname $0)
4
. "${base}/md5.sh"
5

    
6
test="${1#fate-}"
7
samples=$2
8
target_exec=$3
9
target_path=$4
10
command=$5
11
cmp=${6:-diff}
12
ref=${7:-"${base}/ref/fate/${test}"}
13
fuzz=$8
14

    
15
outdir="tests/data/fate"
16
outfile="${outdir}/${test}"
17

    
18
do_tiny_psnr(){
19
    psnr=$(tests/tiny_psnr "$1" "$2" 2 0 0)
20
    val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
21
    size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
22
    size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
23
    res=$(echo "$val $4 $5" | bc)
24
    if [ "$res" != 1 ] || [ $size1 != $size2 ]; then
25
        echo "$psnr"
26
        return 1
27
    fi
28
}
29

    
30
oneoff(){
31
    do_tiny_psnr "$1" "$2" MAXDIFF '<=' ${fuzz:-1}
32
}
33

    
34
stddev(){
35
    do_tiny_psnr "$1" "$2" stddev  '<=' ${fuzz:-1}
36
}
37

    
38
ffmpeg(){
39
    $target_exec $target_path/ffmpeg "$@"
40
}
41

    
42
framecrc(){
43
    ffmpeg "$@" -f framecrc -
44
}
45

    
46
framemd5(){
47
    ffmpeg "$@" -f framemd5 -
48
}
49

    
50
crc(){
51
    ffmpeg "$@" -f crc -
52
}
53

    
54
md5(){
55
    ffmpeg "$@" md5:
56
}
57

    
58
pcm(){
59
    ffmpeg "$@" -vn -f s16le -
60
}
61

    
62
if ! test -e "$ref"; then
63
    echo "reference file '$ref' not found"
64
    exit 1
65
fi
66

    
67
mkdir -p "$outdir"
68

    
69
$command > "$outfile" 2>/dev/null || exit
70

    
71
case $cmp in
72
    diff)   diff -u -w "$ref" "$outfile"            ;;
73
    oneoff) oneoff     "$ref" "$outfile" "$fuzz"    ;;
74
    stddev) stddev     "$ref" "$outfile" "$fuzz"    ;;
75
esac
76

    
77
test $? = 0 && rm $outfile