]> git.sesse.net Git - ffmpeg/blobdiff - tests/fate-run.sh
rtpdec: Calculate and report packet reception jitter
[ffmpeg] / tests / fate-run.sh
index 636fc2d59916a6218b1ee6f60e261f6e3dc53841..d1633e8be4c367c793cb01dbf3e79250c1b9e8c2 100755 (executable)
@@ -21,6 +21,7 @@ cpuflags=${11:-all}
 cmp_shift=${12:-0}
 cmp_target=${13:-0}
 size_tolerance=${14:-0}
+cmp_unit=${15:-2}
 
 outdir="tests/data/fate"
 outfile="${outdir}/${test}"
@@ -40,7 +41,7 @@ compare(){
 }
 
 do_tiny_psnr(){
-    psnr=$(tests/tiny_psnr "$1" "$2" 2 $cmp_shift 0)
+    psnr=$(tests/tiny_psnr "$1" "$2" $cmp_unit $cmp_shift 0)
     val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
     size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
     size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
@@ -74,7 +75,13 @@ probefmt(){
 }
 
 avconv(){
-    run avconv -nostats -threads $threads -thread_type $thread_type -cpuflags $cpuflags "$@"
+    dec_opts="-threads $threads -thread_type $thread_type"
+    avconv_args="-nostats -cpuflags $cpuflags"
+    for arg in $@; do
+        [ x${arg} = x-i ] && avconv_args="${avconv_args} ${dec_opts}"
+        avconv_args="${avconv_args} ${arg}"
+    done
+    run avconv ${avconv_args}
 }
 
 framecrc(){
@@ -110,16 +117,40 @@ enc_dec_pcm(){
     avconv -f $out_fmt -i ${encfile} -c:a pcm_${pcm_fmt} -f ${dec_fmt} -
 }
 
+FLAGS="-flags +bitexact -sws_flags +accurate_rnd+bitexact"
+DEC_OPTS="-threads $threads -idct simple $FLAGS"
+ENC_OPTS="-threads 1        -idct simple -dct fastint"
+
+enc_dec(){
+    src_fmt=$1
+    srcfile=$2
+    enc_fmt=$3
+    enc_opt=$4
+    dec_fmt=$5
+    dec_opt=$6
+    encfile="${outdir}/${test}.${enc_fmt}"
+    decfile="${outdir}/${test}.out.${dec_fmt}"
+    cleanfiles="$cleanfiles $decfile"
+    test "$7" = -keep || cleanfiles="$cleanfiles $encfile"
+    tsrcfile=$(target_path $srcfile)
+    tencfile=$(target_path $encfile)
+    tdecfile=$(target_path $decfile)
+    avconv -f $src_fmt $DEC_OPTS -i $tsrcfile $ENC_OPTS $enc_opt $FLAGS \
+        -f $enc_fmt -y $tencfile || return
+    do_md5sum $encfile
+    echo $(wc -c $encfile)
+    avconv $DEC_OPTS -i $tencfile $ENC_OPTS $dec_opt $FLAGS \
+        -f $dec_fmt -y $tdecfile || return
+    do_md5sum $decfile
+    tests/tiny_psnr $srcfile $decfile $cmp_unit $cmp_shift
+}
+
 regtest(){
     t="${test#$2-}"
     ref=${base}/ref/$2/$t
     ${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path" "$threads" "$thread_type" "$cpuflags"
 }
 
-codectest(){
-    regtest codec $1 tests/$1
-}
-
 lavftest(){
     regtest lavf lavf tests/vsynth1
 }
@@ -129,25 +160,10 @@ lavfitest(){
     regtest lavfi lavfi tests/vsynth1
 }
 
-seektest(){
-    t="${test#seek-}"
-    ref=${base}/ref/seek/$t
-    case $t in
-        image_*) file="tests/data/images/${t#image_}/%02d.${t#image_}" ;;
-        *)       file=$(echo $t | tr _ '?')
-                 for d in acodec vsynth2 lavf; do
-                     test -f tests/data/$d/$file && break
-                 done
-                 file=$(echo tests/data/$d/$file)
-                 ;;
-    esac
-    run libavformat/seek-test $target_path/$file
-}
-
 mkdir -p "$outdir"
 
 exec 3>&2
-$command > "$outfile" 2>$errfile
+eval $command >"$outfile" 2>$errfile
 err=$?
 
 if [ $err -gt 128 ]; then
@@ -157,7 +173,7 @@ fi
 
 if test -e "$ref" || test $cmp = "oneline" ; then
     case $cmp in
-        diff)   diff -u -w "$ref" "$outfile"            >$cmpfile ;;
+        diff)   diff -u -b "$ref" "$outfile"            >$cmpfile ;;
         oneoff) oneoff     "$ref" "$outfile"            >$cmpfile ;;
         stddev) stddev     "$ref" "$outfile"            >$cmpfile ;;
         oneline)oneline    "$ref" "$outfile"            >$cmpfile ;;