Convert daala rd_collect script to use dump_video.
authorNathan E. Egge <negge@dgql.org>
Sun, 13 Nov 2016 21:50:35 +0000 (16:50 -0500)
committerNathan E. Egge <negge@dgql.org>
Sun, 13 Nov 2016 23:34:49 +0000 (18:34 -0500)
tools/rd_collect.sh
tools/rd_collect_daala.sh

index 70904c6..544a3ec 100755 (executable)
@@ -20,6 +20,12 @@ if [ -z $DAALA_ROOT ]; then
   DAALA_ROOT=.
 fi
 
+if [ -z $TOOLS_ROOT ]; then
+  TOOLS_ROOT=$DAALA_ROOT
+fi
+
+export EXTRA_OPTS=$EXTRA_OPTS
+
 if [ ! -d $DAALA_ROOT ]; then
   echo "Please set DAALA_ROOT to the location of your daala git clone"
   exit 1
@@ -33,12 +39,6 @@ case $CODEC in
       exit 1
     fi
 
-    if ((! grep -Fxq "#define OD_DUMP_IMAGES 1" "$DAALA_ROOT/config.h") &&
-        (! grep -Fxq "#define OD_DUMP_RECONS 1" "$DAALA_ROOT/config.h")); then
-      echo "Video dumping not enabled, re-run configure with --enable-dump-recons"
-      exit 1
-    fi
-
     if [ -z "$ENCODER_EXAMPLE" ]; then
       export ENCODER_EXAMPLE=$DAALA_ROOT/examples/encoder_example
     fi
@@ -49,6 +49,16 @@ case $CODEC in
       exit 1
     fi
 
+    if [ -z "$DUMP_VIDEO" ]; then
+      export DUMP_VIDEO=$DAALA_ROOT/examples/dump_video
+    fi
+
+    if [ ! -x "$DUMP_VIDEO" ]; then
+      echo "Executable not found DUMP_VIDEO=$DUMP_VIDEO"
+      echo "Do you have the right DAALA_ROOT=$DAALA_ROOT"
+      exit 1
+    fi
+
     export RD_COLLECT_SUB=$(dirname "$0")/rd_collect_daala.sh
     ;;
   av1)
@@ -297,72 +307,72 @@ fi
 # TODO refactor these out of the daala project into a metrics project
 
 if [ -z "$YUV2YUV4MPEG" ]; then
-  export YUV2YUV4MPEG=$DAALA_ROOT/tools/yuv2yuv4mpeg
+  export YUV2YUV4MPEG=$TOOLS_ROOT/tools/yuv2yuv4mpeg
 fi
 
 if [ -z "$Y4M2PNG" ]; then
-  export Y4M2PNG=$DAALA_ROOT/tools/y4m2png
+  export Y4M2PNG=$TOOLS_ROOT/tools/y4m2png
 fi
 
 if [ -z "$PNG2Y4M" ]; then
-  export PNG2Y4M=$DAALA_ROOT/tools/png2y4m
+  export PNG2Y4M=$TOOLS_ROOT/tools/png2y4m
 fi
 
 if [ -z "$DUMP_PSNR" ]; then
-  export DUMP_PSNR=$DAALA_ROOT/tools/dump_psnr
+  export DUMP_PSNR=$TOOLS_ROOT/tools/dump_psnr
 fi
 
 if [ -z "$DUMP_PSNRHVS" ]; then
-  export DUMP_PSNRHVS=$DAALA_ROOT/tools/dump_psnrhvs
+  export DUMP_PSNRHVS=$TOOLS_ROOT/tools/dump_psnrhvs
 fi
 
 if [ -z "$DUMP_SSIM" ]; then
-  export DUMP_SSIM=$DAALA_ROOT/tools/dump_ssim
+  export DUMP_SSIM=$TOOLS_ROOT/tools/dump_ssim
 fi
 
 if [ -z "$DUMP_FASTSSIM" ]; then
-  export DUMP_FASTSSIM=$DAALA_ROOT/tools/dump_fastssim
+  export DUMP_FASTSSIM=$TOOLS_ROOT/tools/dump_fastssim
 fi
 
 if [ ! -x "$YUV2YUV4MPEG" ]; then
   echo "Executable not found YUV2YUV4MPEG=$YUV2YUV4MPEG"
-  echo "Do you have the right DAALA_ROOT=$DAALA_ROOT"
+  echo "Do you have the right TOOLS_ROOT=$TOOLS_ROOT"
   exit 1
 fi
 
 if [ ! -x "$Y4M2PNG" ]; then
   echo "Executable not found Y4M2PNG=$Y4M2PNG"
-  echo "Do you have the right DAALA_ROOT=$DAALA_ROOT"
+  echo "Do you have the right TOOLS_ROOT=$TOOLS_ROOT"
   exit 1
 fi
 
 if [ ! -x "$PNG2Y4M" ]; then
   echo "Executable not found PNG2Y4M=$PNG2Y4M"
-  echo "Do you have the right DAALA_ROOT=$DAALA_ROOT"
+  echo "Do you have the right TOOLS_ROOT=$TOOLS_ROOT"
   exit 1
 fi
 
 if [ ! -x "$DUMP_PSNR" ]; then
   echo "Executable not found DUMP_PSNR=$DUMP_PSNR"
-  echo "Do you have the right DAALA_ROOT=$DAALA_ROOT"
+  echo "Do you have the right TOOLS_ROOT=$TOOLS_ROOT"
   exit 1
 fi
 
 if [ ! -x "$DUMP_PSNRHVS" ]; then
   echo "Executable not found DUMP_PSNRHVS=$DUMP_PSNRHVS"
-  echo "Do you have the right DAALA_ROOT=$DAALA_ROOT"
+  echo "Do you have the right TOOLS_ROOT=$TOOLS_ROOT"
   exit 1
 fi
 
 if [ ! -x "$DUMP_SSIM" ]; then
   echo "Executable not found DUMP_FASTSSIM=$DUMP_SSIM"
-  echo "Do you have the right DAALA_ROOT=$DAALA_ROOT"
+  echo "Do you have the right TOOLS_ROOT=$TOOLS_ROOT"
   exit 1
 fi
 
 if [ ! -x "$DUMP_FASTSSIM" ]; then
   echo "Executable not found DUMP_FASTSSIM=$DUMP_FASTSSIM"
-  echo "Do you have the right DAALA_ROOT=$DAALA_ROOT"
+  echo "Do you have the right TOOLS_ROOT=$TOOLS_ROOT"
   exit 1
 fi
 
index d41d3d2..23503cb 100755 (executable)
@@ -19,16 +19,17 @@ RANGE="5 7 11 16 25 37 55 81 122 181 270 400"
 #RANGE="1 2 3 4 5 6 7 9 11 13 16 20 25 30 37 45 55 67 81 99 122 148 181 221 270 330 400 500"
 
 for x in $RANGE; do
-  OD_DUMP_IMAGES_SUFFIX=$BASENAME $ENCODER_EXAMPLE -k 256 -z 10 -v $x $FILE -o $BASENAME.ogv 2> $BASENAME-$x-enc.out
+  $ENCODER_EXAMPLE -k 256 -v $x $EXTRA_OPTS $FILE -o $BASENAME.ogv 2> $BASENAME-$x-enc.out
+  $DUMP_VIDEO $BASENAME.ogv -o $BASENAME.y4m 2> /dev/null
   SIZE=$(wc -c $BASENAME.ogv | awk '{ print $1 }')
-  $DUMP_PSNR $FILE 00000000out-$BASENAME.y4m > $BASENAME-psnr.out 2> /dev/null
+  $DUMP_PSNR $FILE $BASENAME.y4m > $BASENAME-psnr.out 2> /dev/null
   FRAMES=$(cat $BASENAME-psnr.out | grep ^0 | wc -l)
   PIXELS=$(($WIDTH*$HEIGHT*$FRAMES))
   PSNR=$(cat $BASENAME-psnr.out | grep Total | tr -s ' ' | cut -d\  -f $((4+$PLANE*2)))
-  PSNRHVS=$($DUMP_PSNRHVS $FILE 00000000out-$BASENAME.y4m 2> /dev/null | grep Total | tr -s ' ' | cut -d\  -f $((4+$PLANE*2)))
-  SSIM=$($DUMP_SSIM $FILE 00000000out-$BASENAME.y4m 2> /dev/null | grep Total | tr -s ' ' | cut -d\  -f $((4+$PLANE*2)))
-  FASTSSIM=$($DUMP_FASTSSIM -c $FILE 00000000out-$BASENAME.y4m 2> /dev/null | grep Total | tr -s ' ' | cut -d\  -f $((4+$PLANE*2)))
-  rm 00000000out-$BASENAME.y4m $BASENAME.ogv $BASENAME-$x-enc.out $BASENAME-psnr.out
+  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.y4m $BASENAME.ogv $BASENAME-$x-enc.out $BASENAME-psnr.out
   echo $x $PIXELS $SIZE $PSNR $PSNRHVS $SSIM $FASTSSIM >> $BASENAME.out
   #tail -1 $BASENAME.out
 done