Add support for aom to rd_collect framework.
authorNathan E. Egge <negge@dgql.org>
Thu, 19 May 2016 20:07:19 +0000 (16:07 -0400)
committerNathan E. Egge <negge@dgql.org>
Thu, 19 May 2016 20:07:19 +0000 (16:07 -0400)
Adds ability to run rd_collect with the av1 codec.

tools/rd_collect.sh
tools/rd_collect_aom.sh [new file with mode: 0755]

index 7a145a6..ef3d4ae 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 set -e
 
-CODECS="<daala|vp8|vp9|vp10|x264|x265|libjpeg|mozjpeg|theora|webp>"
+CODECS="<daala|av1|vp8|vp9|vp10|x264|x265|libjpeg|mozjpeg|theora|webp>"
 
 if [ $# == 0 ]; then
   echo "usage: DAALA_ROOT=<build_dir> $0 $CODECS *.y4m"
@@ -51,6 +51,34 @@ case $CODEC in
 
     export RD_COLLECT_SUB=$(dirname "$0")/rd_collect_daala.sh
     ;;
+  av1)
+    if [ -z $AOM_ROOT ] || [ ! -d $AOM_ROOT ]; then
+      echo "Please set AOM_ROOT to the location of your aom git clone"
+      exit 1
+    fi
+
+    if [ -z "$AOMENC" ]; then
+      export AOMENC=$AOM_ROOT/aomenc
+    fi
+
+    if [ -z "$AOMDEC" ]; then
+      export AOMDEC=$AOM_ROOT/aomdec
+    fi
+
+    if [ ! -x "$AOMENC" ]; then
+      echo "Executable not found AOMENC=$AOMENC"
+      echo "Do you have the right AOM_ROOT=$AOM_ROOT"
+      exit 1
+    fi
+
+    if [ ! -x "$AOMDEC" ]; then
+      echo "Executable not found AOMDEC=$AOMDEC"
+      echo "Do you have the right AOM_ROOT=$AOM_ROOT"
+      exit 1
+    fi
+
+    export RD_COLLECT_SUB=$(dirname $0)/rd_collect_aom.sh
+    ;;
   vp8 | vp9 | vp10)
     if [ -z $LIBVPX_ROOT ] || [ ! -d $LIBVPX_ROOT ]; then
       echo "Please set LIBVPX_ROOT to the location of your libvpx git clone"
diff --git a/tools/rd_collect_aom.sh b/tools/rd_collect_aom.sh
new file mode 100755 (executable)
index 0000000..64acb16
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/bash
+set -e
+
+if [ -z $RD_COLLECT_SUB ]; then
+  echo "Please use: $(dirname $0)/rd_collect.sh av1 *.y4m"
+  exit 1
+fi
+
+FILE=$1
+
+BASENAME=$(basename $FILE)-$CODEC
+rm $BASENAME.out 2> /dev/null || true
+echo $BASENAME
+
+WIDTH=$(head -1 $FILE | cut -d\  -f 2 | tr -d 'W')
+HEIGHT=$(head -1 $FILE | cut -d\  -f 3 | tr -d 'H')
+
+RANGE=$(seq 1 63)
+case $CODEC in
+av1)
+  QSTR="--end-usage=q --cq-level=\$x"
+  ;;
+esac
+
+for x in $RANGE; do
+  $AOMENC --codec=$CODEC --good --cpu-used=0 --ivf $(echo $QSTR | sed 's/\$x/'$x'/g') -o $BASENAME.ivf $FILE 2> $BASENAME-$x-enc.out
+  $AOMDEC --codec=$CODEC -o $BASENAME.y4m $BASENAME.ivf
+  SIZE=$(wc -c $BASENAME.ivf | awk '{ print $1 }')
+  $DUMP_PSNR $FILE $BASENAME.y4m > $BASENAME-$x-psnr.out 2> /dev/null
+  FRAMES=$(cat $BASENAME-$x-psnr.out | grep ^0 | wc -l)
+  PIXELS=$(($WIDTH*$HEIGHT*$FRAMES))
+  PSNR=$(cat $BASENAME-$x-psnr.out | grep Total | tr -s ' ' | cut -d\  -f $((4+$PLANE*2)))
+  PSNRHVS=$($DUMP_PSNRHVS $FILE $BASENAME.y4m 2> /dev/null | grep Total | tr -s ' ' | cut -d\  -f $((4+$PLANE*2)))
+  SSIM=$($DUMP_SSIM $FILE $BASENAME.y4m 2> /dev/null | grep Total | tr -s ' ' | cut -d\  -f $((4+$PLANE*2)))
+  FASTSSIM=$($DUMP_FASTSSIM -c $FILE $BASENAME.y4m 2> /dev/null | grep Total | tr -s ' ' | cut -d\  -f $((4+$PLANE*2)))
+  rm $BASENAME.ivf $BASENAME.y4m $BASENAME-$x-enc.out $BASENAME-$x-psnr.out
+  echo $x $PIXELS $SIZE $PSNR $PSNRHVS $SSIM $FASTSSIM >> $BASENAME.out
+  #tail -1 $BASENAME.out
+done