build.sh 1.99 KB
Newer Older
1 2 3 4 5 6 7
#!/bin/bash

# Stop on first error
set -e

#SEQ=!!!!! ENTER YOUR FAVORITE Y4M HERE !!!!!

8
IS_RELEASE=1
Luc Trudeau's avatar
Luc Trudeau committed
9 10 11 12

for arg in "$@"; do
  shift
  case "$arg" in
13
    "--debug") IS_RELEASE=0 ;;
Luc Trudeau's avatar
Luc Trudeau committed
14 15 16 17
    *)        set -- "$@" "$arg"
  esac
done

18
if [[ -z "${SEQ}" ]]; then
19
  SEQ=nyan.y4m
20 21
  SEQ10=nyan10.y4m
  SEQ12=nyan12.y4m
22

23
  wget -nc https://mf4.xiph.org/~ltrudeau/videos/nyan.y4m
24 25
  #wget -nc https://people.xiph.org/~tdaede/nyan10.y4m
  #wget -nc https://people.xiph.org/~tdaede/nyan12.y4m
26 27 28 29 30 31 32 33 34 35 36
fi


if [ ! -f $SEQ ]; then
  (>&2 echo "ERROR: Failed to find $SEQ")
  (>&2 echo "Please recheck the variables")
  exit 1 # terminate and indicate error
fi

# File containing the encoded sequence
ENC_FILE="enc_file.ivf"
37 38
# File containing the reconstructed sequence
REC_FILE="rec_file.y4m"
39 40 41 42 43 44 45
# File containing the decoded sequence
DEC_FILE="dec_file.y4m"

# Print the backtrace on error
export RUST_BACKTRACE=1

# Build and run encoder
Luc Trudeau's avatar
Luc Trudeau committed
46 47 48 49 50 51
BUILD_TYPE=""
if [ $IS_RELEASE == 1 ]; then
  BUILD_TYPE="--release"
fi

cargo run --bin rav1e $BUILD_TYPE -- $SEQ -o $ENC_FILE -s 3 -r $REC_FILE
52 53

# Decode
54
aomdec $ENC_FILE -o $DEC_FILE
55

56
# Input/Output compare
57 58
tail -n+2 $DEC_FILE > /tmp/dec_file
tail -n+2 $REC_FILE > /tmp/rec_file
59
cmp /tmp/dec_file /tmp/rec_file || (printf '\e[1;31m%-6s\e[m\n\n' 'Desync detected!!!' && exit 1)
60

61 62 63 64 65 66 67 68 69 70 71 72 73 74
# Daala tools support coming soon
#DAALA_TOOLS="../daala/tools/"
# Convert to png
#${DAALA_TOOLS}/y4m2png -o out.png $DEC_FILE

# Compute and print PSNR (not working)
#${DAALA_TOOLS}/dump_psnr $DEC_OUT $SEQ

# Compute and print CIEDE2000 (not working)
#${DAALA_TOOLS}/dump_ciede2000.py $DEC_OUT $SEQ

# Show decoded sequence
# --pause
mpv --loop $DEC_FILE
75 76

# Repeat for high bit depth clips
Monty's avatar
Monty committed
77
#cargo run --bin rav1e --release -- $SEQ10 -o $ENC_FILE -s 3 -r $REC_FILE
78
#aomdec $ENC_FILE -o $DEC_FILE
Monty's avatar
Monty committed
79
#cmp <(tail -n+2 $DEC_FILE) <(tail -n+2 $REC_FILE)
80 81
#mpv --loop $DEC_FILE

Monty's avatar
Monty committed
82
#cargo run --bin rav1e --release -- $SEQ12 -o $ENC_FILE -s 3 -r $REC_FILE
83
#aomdec $ENC_FILE -o $DEC_FILE
Monty's avatar
Monty committed
84
#cmp <(tail -n+2 $DEC_FILE) <(tail -n+2 $REC_FILE)
85
#mpv --loop $DEC_FILE