Improved x264 from 70% worse to only 13% worse

Change-Id: Ief46584bfda77090aa95c69fcaba81b1c2fc0af7
diff --git a/install_software.sh b/install_software.sh
index 9c003b0..689f265 100755
--- a/install_software.sh
+++ b/install_software.sh
@@ -35,7 +35,7 @@
   git clone git://git.videolan.org/x264.git
 fi
 cd x264
-git checkout 198a7ea
+git checkout d967c09
 ./configure
 make x264
 cp x264 ../bin/
diff --git a/run_all_tests.sh b/run_all_tests.sh
index e086034..97cc0cd 100755
--- a/run_all_tests.sh
+++ b/run_all_tests.sh
@@ -1,25 +1,45 @@
 #!/bin/sh
 #
 # Run all tests, with timing info.
-# This script will take about 4 hours to run.
+#
+# Argument: "speed" or "quality", and codec name for running only
+# one set of codecs.
+#
+# This script will take about 4 hours to run with no arguments.
 # Timing notes are on a Dell 3500.
 #
-echo "H.264 quality tests"
-# About half an hour real time, 2 hours CPU time on a Dell T3500
-time ./run_h264_tests.sh video
-echo "VP8 quality tests"
-time ./run_vp8_tests.sh video
-# About 2 hours
-echo "H.264 speed tests"
-# About 45 minutes
-time ./run_h264_speed_tests.sh video
-echo "VP8 speed tests"
-# About half an hour
-time ./run_vp8_speed_tests.sh video
-echo "Drawing graphs"
-# 2 seconds
-./draw_graphs.sh
-echo "PSNR bitrate improvement"
-./core_data.sh 0
-echo "Encode speed improvement"
-./core_data.sh encode_speed
+COMMAND=$1
+CODEC=$2
+
+if [ "$COMMAND" == "" -o "$COMMAND" == "quality" ]; then
+  if [ "$CODEC" == "" -o "$CODEC" == "h264" ]; then
+    echo "H.264 quality tests"
+    # About half an hour real time, 2 hours CPU time on a Dell T3500
+    time ./run_h264_tests.sh video
+  fi
+  if [ "$CODEC" == "" -o "$CODEC" == "vp8" ]; then
+    echo "VP8 quality tests"
+    time ./run_vp8_tests.sh video
+  fi
+  echo "Drawing graphs"
+  # 2 seconds
+  ./draw_graphs.sh
+  echo "PSNR bitrate improvement"
+  ./core_data.sh 0
+fi
+
+if [ "$COMMAND" == "" -o "$COMMAND" == "speed" ]; then
+  # About 2 hours
+  echo "H.264 speed tests"
+  # About 45 minutes
+  time ./run_h264_speed_tests.sh video
+  echo "VP8 speed tests"
+  # About half an hour
+  time ./run_vp8_speed_tests.sh video
+  echo "Drawing graphs"
+  # 2 seconds
+  ./draw_graphs.sh
+  echo "Encode speed improvement"
+  ./core_data.sh encode_speed
+fi
+
diff --git a/run_h264_tests.sh b/run_h264_tests.sh
index 68ed909..f659309 100755
--- a/run_h264_tests.sh
+++ b/run_h264_tests.sh
@@ -61,8 +61,10 @@
   do
     echo "Encoding for $rate"
     # Encode into ./<clip_name>_<width>_<height>_<frame_rate>_<rate>kbps.yuv
-    ./bin/x264 --nal-hrd cbr --vbv-maxrate ${rate} --vbv-bufsize ${rate} \
-      --vbv-init 0.8 --bitrate ${rate} --fps ${frame_rate} \
+    ./bin/x264 \
+      --vbv-bufsize ${rate} \
+      --bitrate ${rate} --fps ${frame_rate} \
+      --threads 1 \
       --profile baseline --no-scenecut --keyint infinite --preset veryslow \
       --input-res ${width}x${height} \
       --tune psnr \