Merge "VP8 parameter tweaker: New structure"
diff --git a/run_h264_tests.sh b/run_h264_tests.sh
index f659309..e8074d6 100755
--- a/run_h264_tests.sh
+++ b/run_h264_tests.sh
@@ -8,6 +8,8 @@
 
 tempyuvfile=$(mktemp ./tempXXXXX.yuv)
 
+H264CONFIG=5
+
 if [ ! -d "$1" ]; then
   echo "No such directory: $1"
   exit 1
@@ -61,7 +63,22 @@
   do
     echo "Encoding for $rate"
     # Encode into ./<clip_name>_<width>_<height>_<frame_rate>_<rate>kbps.yuv
-    ./bin/x264 \
+    case $H264CONFIG in
+    0)
+      # Configuration from previous @HEAD
+      ./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 \
+        -o ./encoded_clips/h264/${clip_stem}_${rate}kbps.mkv ${filename} \
+        2> ./logs/h264/${clip_stem}_${rate}kbps.txt
+        ;;
+    1)
+      # Configuration by Bo Burman
+      ./bin/x264 \
       --vbv-bufsize ${rate} \
       --bitrate ${rate} --fps ${frame_rate} \
       --threads 1 \
@@ -71,6 +88,53 @@
       -o ./encoded_clips/h264/${clip_stem}_${rate}kbps.mkv ${filename} \
       2> ./logs/h264/${clip_stem}_${rate}kbps.txt
 
+      ;;
+    3)
+      # As above, but add --vbv-maxrate ${rate} and --vbv-init 0.8
+      ./bin/x264 \
+      --vbv-bufsize ${rate} \
+      --vbv-maxrate ${rate} --vbv-init 0.8 \
+      --bitrate ${rate} --fps ${frame_rate} \
+      --threads 1 \
+      --profile baseline --no-scenecut --keyint infinite --preset veryslow \
+      --input-res ${width}x${height} \
+      --tune psnr \
+      -o ./encoded_clips/h264/${clip_stem}_${rate}kbps.mkv ${filename} \
+      2> ./logs/h264/${clip_stem}_${rate}kbps.txt
+      ;;
+    4)
+      # As above, but remove lookahead (as not appropriate for VC mode)
+      ./bin/x264 \
+      --vbv-maxrate ${rate} --vbv-bufsize ${rate} --vbv-init 0.8 \
+      --bitrate ${rate} --fps ${frame_rate} \
+      --threads 1 \
+      --rc-lookahead 0 \
+      --profile baseline --no-scenecut --keyint infinite --preset veryslow \
+      --input-res ${width}x${height} \
+      --tune psnr \
+      -o ./encoded_clips/h264/${clip_stem}_${rate}kbps.mkv ${filename} \
+      2> ./logs/h264/${clip_stem}_${rate}kbps.txt
+      ;;
+    5)
+      # As above, but limit the reference frames to 2
+      ./bin/x264 \
+      --vbv-maxrate ${rate} --vbv-bufsize ${rate} --vbv-init 0.8 \
+      --bitrate ${rate} --fps ${frame_rate} \
+      --threads 1 \
+      --rc-lookahead 0 \
+      --ref 2 \
+      --profile baseline --no-scenecut --keyint infinite --preset veryslow \
+      --input-res ${width}x${height} \
+      --tune psnr \
+      -o ./encoded_clips/h264/${clip_stem}_${rate}kbps.mkv ${filename} \
+      2> ./logs/h264/${clip_stem}_${rate}kbps.txt
+      ;;
+    *)
+      echo "No such configuration"
+      exit 1
+      ;;
+    esac
+
     # Decode the clip to a temporary file in order to compute PSNR and extract
     # bitrate.
     rm -f $tempyuvfile
diff --git a/run_vp8_tests.sh b/run_vp8_tests.sh
index 4be4679..73b9bb8 100755
--- a/run_vp8_tests.sh
+++ b/run_vp8_tests.sh
@@ -58,16 +58,26 @@
     # Encode video into the following file:
     #  ./<clip_name>_<width>_<height>_<frame_rate>_<rate>kbps.yuv
     # Data-rate & PSNR will be output to the file "opsnr.stt"
-    ./bin/vpxenc --lag-in-frames=0 --target-bitrate=${rate} --kf-min-dist=3000 \
-      --kf-max-dist=3000 --cpu-used=0 --fps=${frame_rate}/1 --static-thresh=0 \
-      --token-parts=1 --drop-frame=0 --end-usage=cbr --min-q=2 --max-q=56 \
-      --undershoot-pct=100 --overshoot-pct=15 --buf-sz=1000 \
-      --buf-initial-sz=800 --buf-optimal-sz=1000 --max-intra-rate=1200 \
-      --resize-allowed=0 --drop-frame=0 --passes=1 --good --noise-sensitivity=0 \
+    # Settings from Adrian's Oct 26 message.
+    ./bin/vpxenc \
+      --passes=1 --best \
+      --end-usage=cbr \
+      --buf-sz=1000 --buf-optimal-sz=1000 --buf-initial-sz=800 \
+      --undershoot-pct=100 --overshoot-pct=15 \
+      --min-q=2 --max-q=56 \
+      --max-intra-rate=1200 \
+      --kf-min-dist=9999 --kf-max-dist=9999 \
+      --lag-in-frames=0 \
+      --drop-frame=0 \
+      --resize-allowed=0 \
+      --target-bitrate=${rate} --fps=${frame_rate}/1 \
+      --static-thresh=0 --noise-sensitivity=0 \
+      --token-parts=1 \
       -w ${width} -h ${height} ${filename} --codec=vp8 \
       -o ./encoded_clips/vp8/${clip_stem}_${rate}kbps.webm \
       &>./logs/vp8/${clip_stem}_${rate}kbps.txt
 
+
     # Decode the clip to a temporary file in order to compute PSNR and extract
     # bitrate.
     rm -f $tempyuvfile