regression-funcs.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/bin/sh
  2. #
  3. # common regression functions for ffmpeg
  4. #
  5. #
  6. test="${1#regtest-}"
  7. test_ref=$2
  8. raw_src_dir=$3
  9. target_exec=$4
  10. target_path=$5
  11. threads=${6:-1}
  12. cpuflags=${8:-all}
  13. target_samples=$9
  14. datadir="./tests/data"
  15. target_datadir="${target_path}/${datadir}"
  16. this="$test.$test_ref"
  17. outfile="$datadir/$test_ref/"
  18. # various files
  19. ffmpeg="$target_exec ${target_path}/ffmpeg"
  20. raw_src="${target_path}/$raw_src_dir/%02d.pgm"
  21. raw_dst="$datadir/$this.out.yuv"
  22. pcm_src="$target_datadir/asynth1.sw"
  23. pcm_src_1ch="$target_datadir/asynth-16000-1.wav"
  24. pcm_ref_1ch="$datadir/$test_ref-16000-1.ref.wav"
  25. crcfile="$datadir/$this.crc"
  26. target_crcfile="$target_datadir/$this.crc"
  27. cleanfiles="$raw_dst $crcfile"
  28. trap 'rm -f -- $cleanfiles' EXIT
  29. mkdir -p "$datadir"
  30. mkdir -p "$outfile"
  31. [ "${V-0}" -gt 0 ] && echov=echov || echov=:
  32. echov(){
  33. echo "$@" >&3
  34. }
  35. . $(dirname $0)/md5.sh
  36. AVCONV_OPTS="-nostats -y -cpuflags $cpuflags"
  37. COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
  38. DEC_OPTS="$COMMON_OPTS -threads $threads"
  39. ENC_OPTS="$COMMON_OPTS -threads 1 -dct fastint"
  40. run_avconv()
  41. {
  42. $echov $ffmpeg $AVCONV_OPTS $*
  43. $ffmpeg $AVCONV_OPTS $*
  44. }
  45. do_avconv()
  46. {
  47. f="$1"
  48. shift
  49. set -- $* ${target_path}/$f
  50. run_avconv $*
  51. do_md5sum $f
  52. echo $(wc -c $f)
  53. }
  54. do_avconv_nomd5()
  55. {
  56. f="$1"
  57. shift
  58. set -- $* ${target_path}/$f
  59. run_avconv $*
  60. if [ $f = $raw_dst ] ; then
  61. $tiny_psnr $f $raw_ref
  62. elif [ $f = $pcm_dst ] ; then
  63. $tiny_psnr $f $pcm_ref 2
  64. else
  65. echo $(wc -c $f)
  66. fi
  67. }
  68. do_avconv_crc()
  69. {
  70. f="$1"
  71. shift
  72. run_avconv $* -f crc "$target_crcfile"
  73. echo "$f $(cat $crcfile)"
  74. }