Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(480052)

Unified Diff: tools/ab_compare_encode.sh

Issue 1393: Deduplicate code in ab_compare.sh.
Patch Set: Deduplicate code in ab_compare.sh. Created 2 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/ab_compare_daala.sh ('k') | tools/ab_compare_jpeg.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/ab_compare_encode.sh
diff --git a/tools/ab_compare_encode.sh b/tools/ab_compare_encode.sh
new file mode 100755
index 0000000000000000000000000000000000000000..32e77afe30d6962edfa36344606d12e84a18a93c
--- /dev/null
+++ b/tools/ab_compare_encode.sh
@@ -0,0 +1,120 @@
+#!/bin/bash
+set -e
+
+export X264="$X264_ROOT/x264"
+export X265="$X265_ROOT/build/linux/x265"
+export VPXENC="$LIBVPX_ROOT/$CODEC/vpxenc"
+export VPXDEC="$LIBVPX_ROOT/vpxdec"
+export AOMENC="$LIBAOM_ROOT/aomenc"
+export AOMDEC="$LIBAOM_ROOT/aomdec"
+if [ -z "$THORENC" ]; then
+ export THORENC="$WORK_ROOT/$CODEC/build/Thorenc"
+fi
+if [ -z "$THORDIR" ]; then
+ export THORDIR="$(dirname $THORENC)/../"
+fi
+if [ -z "$THORDEC" ]; then
+ export THORDEC="$(dirname $THORENC)/Thordec"
+fi
+if [ -z "$ENCODER_EXAMPLE" ]; then
+ export ENCODER_EXAMPLE="$DAALA_ROOT/examples/encoder_example"
+fi
+if [ -z "$YUV2YUV4MPEG" ]; then
+ YUV2YUV4MPEG=$DAALA_ROOT/tools/yuv2yuv4mpeg
+fi
+if [ -z "$YUVJPEG" ]; then
+ export YUVJPEG=yuvjpeg
+fi
+if [ -z "$JPEGYUV" ]; then
+ export JPEGYUV=jpegyuv
+fi
+
+KFINT=999
+
+case $CODEC in
+daala)
+ if [ ! -x "$ENCODER_EXAMPLE" ]; then
+ echo "Example encoder not found at '$ENCODER_EXAMPLE.'"
+ exit 1
+ fi
+ OD_LOG_MODULES='encoder:10' OD_DUMP_IMAGES_SUFFIX="$BASENAME" "$ENCODER_EXAMPLE" -k $KFINT -v "$x" $EXTRA_OPTIONS "$FILE" -o "$BASENAME.ogv" > /dev/null 2> "$BASENAME-enc.out"
+ if [ ! -f "$BASENAME.ogv" ]
+ then
+ echo Failed to produce "$BASENAME.ogv"
+ cat "$BASENAME-enc.out"
+ exit 1
+ fi
+ SIZE=$(stat -c %s "$BASENAME.ogv")
+ mv "00000000out-$BASENAME.y4m" "$BASENAME.y4m"
+ ;;
+x264)
+ $X264 --dump-yuv $BASENAME.yuv --preset placebo --min-keyint $KFINT --keyint $KFINT --no-scenecut --crf=$x -o $BASENAME.x264 $EXTRA_OPTIONS $FILE 2> $BASENAME-enc.out > /dev/null
+ $YUV2YUV4MPEG $BASENAME -w$WIDTH -h$HEIGHT -an0 -ad0 -c420mpeg2
+ SIZE=$(stat -c %s $BASENAME.x264)
+ ;;
+x265)
+ $X265 -r $BASENAME.y4m --preset slow --frame-threads 1 --min-keyint $KFINT --keyint $KFINT --no-scenecut --crf=$x -o $BASENAME.x265 $EXTRA_OPTIONS $FILE 2> $BASENAME-enc.out > /dev/null
+ SIZE=$(stat -c %s $BASENAME.x265)
+ ;;
+x265-rt)
+ $X265 -r $BASENAME.y4m --preset slow --tune zerolatency --rc-lookahead 0 --bframes 0 --frame-threads 1 --min-keyint $KFINT --keyint $KFINT --no-scenecut --crf=$x --csv $BASENAME.csv -o $BASENAME.x265 $EXTRA_OPTIONS $FILE 2> $BASENAME-enc.out > /dev/null
+ SIZE=$(stat -c %s $BASENAME.x265)
+ ;;
+vp8)
+ $VPXENC --codec=$CODEC --threads=1 --cpu-used=0 --kf-min-dist=$KFINT --kf-max-dist=$KFINT --end-usage=cq --target-bitrate=100000 --cq-level=$x -o $BASENAME.ivf $EXTRA_OPTIONS $FILE 2> $BASENAME-enc.out > /dev/null
+ $VPXDEC --codec=$CODEC -o $BASENAME.y4m $BASENAME.ivf
+ SIZE=$(stat -c %s $BASENAME.ivf)
+ ;;
+vp9)
+ $VPXENC --codec=$CODEC --ivf --frame-parallel=0 --tile-columns=0 --auto-alt-ref=2 --cpu-used=0 --passes=2 --threads=1 --kf-min-dist=$KFINT --kf-max-dist=$KFINT --lag-in-frames=25 --end-usage=q --cq-level=$x -o $BASENAME.ivf $EXTRA_OPTIONS $FILE 2> $BASENAME-enc.out > /dev/null
+ $VPXDEC --codec=$CODEC -o $BASENAME.y4m $BASENAME.ivf
+ SIZE=$(stat -c %s $BASENAME.ivf)
+ ;;
+vp9-rt)
+ $VPXENC --codec=vp9 --frame-parallel=0 --tile-columns=0 -cpu-used=0 --threads=1 --kf-min-dist=$KFINT --kf-max-dist=$KFINT -p 1 --lag-in-frames=0 --end-usage=q --cq-level=$x -o $BASENAME.ivf $EXTRA_OPTIONS $FILE 2> $BASENAME-enc.out > /dev/null
+ $VPXDEC --codec=vp9 -o $BASENAME.y4m $BASENAME.ivf
+ SIZE=$(stat -c %s $BASENAME.ivf)
+ ;;
+vp10)
+ $VPXENC --codec=$CODEC --ivf --frame-parallel=0 --tile-columns=0 --auto-alt-ref=2 --cpu-used=0 --passes=2 --threads=1 --kf-min-dist=$KFINT --kf-max-dist=$KFINT --lag-in-frames=25 --end-usage=q --cq-level=$x -o $BASENAME.ivf $EXTRA_OPTIONS $FILE 2> $BASENAME-enc.out > /dev/null
+ $VPXDEC --codec=$CODEC -o $BASENAME.y4m $BASENAME.ivf
+ SIZE=$(stat -c %s $BASENAME.ivf)
+ ;;
+vp10-rt)
+ $VPXENC --codec=vp10 --ivf --frame-parallel=0 --tile-columns=0 --cpu-used=0 --passes=1 --threads=1 --kf-min-dist=$KFINT --kf-max-dist=$KFINT --lag-in-frames=0 --end-usage=q --cq-level=$x -o $BASENAME.ivf $EXTRA_OPTIONS $FILE 2> $BASENAME-enc.out > /dev/null
+ $VPXDEC --codec=vp10 -o $BASENAME.y4m $BASENAME.ivf
+ SIZE=$(stat -c %s $BASENAME.ivf)
+ ;;
+av1)
+ $AOMENC --codec=$CODEC --ivf --frame-parallel=0 --tile-columns=0 --auto-alt-ref=2 --cpu-used=0 --passes=2 --threads=1 --kf-min-dist=$KFINT --kf-max-dist=$KFINT --lag-in-frames=25 --end-usage=q --cq-level=$x -o $BASENAME.ivf $EXTRA_OPTIONS $FILE 2> $BASENAME-enc.out > /dev/null
+ $AOMDEC --codec=$CODEC -o $BASENAME.y4m $BASENAME.ivf
+ SIZE=$(stat -c %s $BASENAME.ivf)
+ ;;
+av1-rt)
+ $AOMENC --codec=vp10 --ivf --frame-parallel=0 --tile-columns=0 --cpu-used=0 --passes=1 --threads=1 --kf-min-dist=$KFINT --kf-max-dist=$KFINT --lag-in-frames=0 --end-usage=q --cq-level=$x -o $BASENAME.ivf $EXTRA_OPTIONS $FILE 2> $BASENAME-enc.out > /dev/null
+ $AOMDEC --codec=vp10 -o $BASENAME.y4m $BASENAME.ivf
+ SIZE=$(stat -c %s $BASENAME.ivf)
+ ;;
+thor)
+ $THORENC -qp $x -cf "$THORDIR/config_HDB16_high_efficiency.txt" -if $FILE -of $BASENAME.thor $EXTRA_OPTIONS > $BASENAME-enc.out
+ SIZE=$(stat -c %s $BASENAME.thor)
+ # using reconstruction is currently broken with HDB
+ $THORDEC $BASENAME.thor $BASENAME.yuv > /dev/null
+ $YUV2YUV4MPEG $BASENAME -w$WIDTH -h$HEIGHT
+ ;;
+thor-rt)
+ $THORENC -qp $x -cf "$THORDIR/config_LDB_high_efficiency.txt" -if $FILE -of $BASENAME.thor -rf $BASENAME.y4m $EXTRA_OPTIONS > $BASENAME-enc.out
+ SIZE=$(stat -c %s $BASENAME.thor)
+ ;;
+jpeg)
+ WIDTH=$(head -1 $FILE | cut -d\ -f 2 | tr -d 'W')
+ HEIGHT=$(head -1 $FILE | cut -d\ -f 3 | tr -d 'H')
+ tail -n+3 $FILE > $BASENAME-in.yuv
+ $YUVJPEG $((100-$x)) "$WIDTH"x$HEIGHT $BASENAME-in.yuv $BASENAME.jpeg
+ $JPEGYUV $BASENAME.jpeg $BASENAME.yuv
+ $YUV2YUV4MPEG $BASENAME -w$WIDTH -h$HEIGHT -an0 -ad0 -c420mpeg2
+ rm $BASENAME-in.yuv $BASENAME.yuv
+ SIZE=$(stat -c %s $BASENAME.jpeg)
+esac
+
+echo $SIZE
« no previous file with comments | « tools/ab_compare_daala.sh ('k') | tools/ab_compare_jpeg.sh » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld