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

Delta Between Two Patch Sets: tools/ab_compare.sh

Issue 1393: Deduplicate code in ab_compare.sh.
Left Patch Set: Deduplicate code in ab_compare.sh. Created 2 years, 3 months ago
Right Patch Set: Deduplicate code in ab_compare.sh. Created 2 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | tools/ab_compare_daala.sh » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/bin/bash 1 #!/bin/bash
2 set -e 2 set -e
3 3
4 USAGE=\ 4 USAGE=\
5 'This script creates images or videos that are compressed by different codecs 5 'This script creates images or videos that are compressed by different codecs
6 but have nearly the same size, facilitating comparison among codecs. 6 but have nearly the same size, facilitating comparison among codecs.
7 7
8 Usage: 8 Usage:
9 ab_compare.sh [OPTIONS] file1.y4m file2.y4m ... fileN.y4m 9 ab_compare.sh [OPTIONS] file1.y4m file2.y4m ... fileN.y4m
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 echo "with -d." 110 echo "with -d."
111 exit 1 111 exit 1
112 fi 112 fi
113 113
114 if [ ! -x "$DAALA2_ROOT" ] && echo "$CODECS" | grep 'daala2' > /dev/null; then 114 if [ ! -x "$DAALA2_ROOT" ] && echo "$CODECS" | grep 'daala2' > /dev/null; then
115 echo "Second Daala build not found at $DAALA2_ROOT. Please give its location" 115 echo "Second Daala build not found at $DAALA2_ROOT. Please give its location"
116 echo "with -D." 116 echo "with -D."
117 exit 1 117 exit 1
118 fi 118 fi
119 119
120 export X264="$X264_ROOT/x264"
121 export X265="$X265_ROOT/build/linux/x265"
122 export VPXENC="$LIBVPX_ROOT/$CODEC/vpxenc"
123 export VPXDEC="$LIBVPX_ROOT/vpxdec"
124 export AOMENC="$LIBAOM_ROOT/aomenc"
125 export AOMDEC="$LIBAOM_ROOT/aomdec"
126 if [ -z "$THORENC" ]; then
127 export THORENC="$WORK_ROOT/$CODEC/build/Thorenc"
128 fi
129 if [ -z "$THORDIR" ]; then
130 export THORDIR="$(dirname $THORENC)/../"
131 fi
132 if [ -z "$THORDEC" ]; then
133 export THORDEC="$(dirname $THORENC)/Thordec"
134 fi
135 if [ -z "$ENCODER_EXAMPLE" ]; then
136 export ENCODER_EXAMPLE="$DAALA_ROOT/examples/encoder_example"
137 fi
138 if [ -z "$YUV2YUV4MPEG" ]; then
139 YUV2YUV4MPEG=$DAALA_ROOT/tools/yuv2yuv4mpeg
140 fi
141 if [ -z "$YUVJPEG" ]; then
142 export YUVJPEG=yuvjpeg
143 fi
144 if [ -z "$JPEGYUV" ]; then
145 export JPEGYUV=jpegyuv
146 fi
147
120 if [ -z "$Y4M2PNG" ]; then 148 if [ -z "$Y4M2PNG" ]; then
121 Y4M2PNG=$DAALA_ROOT/tools/y4m2png 149 Y4M2PNG=$DAALA_ROOT/tools/y4m2png
122 fi 150 fi
123 151
124 if [ -z "$KEYINT" ]; then 152 if [ -z "$KEYINT" ]; then
125 KEYINT=256; 153 KEYINT=256;
126 fi 154 fi
127 155
128 if [ -z "$CODECS" ]; then 156 if [ -z "$CODECS" ]; then
129 CODECS="daala vp8 x264 x265" 157 CODECS="daala vp8 x264 x265"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 221
194 if [ -n "$V" ]; then 222 if [ -n "$V" ]; then
195 SIZE=$(x=$V CODEC=daala BASENAME=$BASENAME FILE=$FILE $AB_ROOT/ab_compare_en code.sh) 223 SIZE=$(x=$V CODEC=daala BASENAME=$BASENAME FILE=$FILE $AB_ROOT/ab_compare_en code.sh)
196 fi 224 fi
197 225
198 for CODEC in $CODECS; do 226 for CODEC in $CODECS; do
199 WIDTH=$(head -1 $FILE | cut -d\ -f 2 | tr -d 'W') 227 WIDTH=$(head -1 $FILE | cut -d\ -f 2 | tr -d 'W')
200 HEIGHT=$(head -1 $FILE | cut -d\ -f 3 | tr -d 'H') 228 HEIGHT=$(head -1 $FILE | cut -d\ -f 3 | tr -d 'H')
201 case $CODEC in 229 case $CODEC in
202 x264) 230 x264)
231 if [ ! -x "$X264" ]; then
232 echo "Executable not found X264=$X264"
233 echo "Do you have the right X264_ROOT=$X264_ROOT"
234 exit 1
235 fi
203 MIN_QUALITY_BOUND=51 236 MIN_QUALITY_BOUND=51
204 MAX_QUALITY_BOUND=1 237 MAX_QUALITY_BOUND=1
205 EXT=x264 238 EXT=x264
206 ;; 239 ;;
207 x265) 240 x265)
241 if [ ! -x "$X265" ]; then
242 echo "Executable not found X265=$X265"
243 echo "Do you have the right X265_ROOT=$X265_ROOT"
244 exit 1
245 fi
208 MIN_QUALITY_BOUND=51 246 MIN_QUALITY_BOUND=51
209 MAX_QUALITY_BOUND=1 247 MAX_QUALITY_BOUND=1
210 EXT=x265 248 EXT=x265
211 ;; 249 ;;
212 vp8|vp9|av1) 250 vp8|vp9|av1)
251 if [ ! -x "$VPXENC" ]; then
252 echo "Executable not found VPXENC=$VPXENC"
253 echo "Do you have the right LIBVPX_ROOT=$LIBVPX_ROOT"
254 exit 1
255 fi
256 if [ ! -x "$VPXDEC" ]; then
257 echo "Executable not found VPXDEC=$VPXDEC"
258 echo "Do you have the right LIBVPX_ROOT=$LIBVPX_ROOT"
259 exit 1
260 fi
213 MAX_QUALITY_BOUND=3 261 MAX_QUALITY_BOUND=3
214 MIN_QUALITY_BOUND=63 262 MIN_QUALITY_BOUND=63
215 EXT=ivf 263 EXT=ivf
216 ;; 264 ;;
265 av1)
266 if [ ! -x "$AOMENC" ]; then
267 echo "Executable not found VPXENC=$AOMENC"
268 echo "Do you have the right LIBVPX_ROOT=$LIBAOM_ROOT"
269 exit 1
270 fi
271 if [ ! -x "$AOMDEC" ]; then
272 echo "Executable not found VPXDEC=$VPXDEC"
273 echo "Do you have the right LIBVPX_ROOT=$LIBAOM_ROOT"
274 exit 1
275 fi
276 MAX_QUALITY_BOUND=3
277 MIN_QUALITY_BOUND=63
278 EXT=ivf
279 ;;
217 daala) 280 daala)
281 if [ ! -x "$ENCODER_EXAMPLE" ]; then
282 echo "Example encoder not found at '$ENCODER_EXAMPLE.'"
283 exit 1
284 fi
218 MAX_QUALITY_BOUND=0 285 MAX_QUALITY_BOUND=0
219 MIN_QUALITY_BOUND=511 286 MIN_QUALITY_BOUND=511
220 EXT=ogv 287 EXT=ogv
221 ;; 288 ;;
222 jpeg) 289 jpeg)
290 if [ ! -x "$YUVJPEG" ]; then
291 echo "Executable not found YUVJPEG=$YUVJPEG"
292 echo "Do you have the right DAALA_ROOT=$DAALA_ROOT"
293 exit 1
294 fi
295 if [ ! -x "$JPEGYUV" ]; then
296 echo "Executable not found JPEGYUV=$JPEGYUV"
297 echo "Do you have the right DAALA_ROOT=$DAALA_ROOT"
298 exit 1
299 fi
223 MAX_QUALITY_BOUND=0 300 MAX_QUALITY_BOUND=0
224 MIN_QUALITY_BOUND=100 301 MIN_QUALITY_BOUND=100
225 EXT=jpeg 302 EXT=jpeg
226 ;; 303 ;;
227 esac 304 esac
228 305
229 MAX_QUALITY=$MAX_QUALITY_BOUND 306 MAX_QUALITY=$MAX_QUALITY_BOUND
230 MIN_QUALITY=$MIN_QUALITY_BOUND 307 MIN_QUALITY=$MIN_QUALITY_BOUND
231 308
232 export CODEC=$CODEC 309 export CODEC=$CODEC
(...skipping 28 matching lines...) Expand all
261 BEST_FILE="$BASENAME-$BEST_QUALITY.$EXT" 338 BEST_FILE="$BASENAME-$BEST_QUALITY.$EXT"
262 339
263 if [ $FRAMES -eq 1 ]; then 340 if [ $FRAMES -eq 1 ]; then
264 $Y4M2PNG -o $BASENAME-$BEST_QUALITY.png $BASENAME-$BEST_QUALITY-tmp.y4m 341 $Y4M2PNG -o $BASENAME-$BEST_QUALITY.png $BASENAME-$BEST_QUALITY-tmp.y4m
265 else 342 else
266 mv $BASENAME-$BEST_QUALITY-tmp.y4m $BASENAME-$BEST_QUALITY.y4m 343 mv $BASENAME-$BEST_QUALITY-tmp.y4m $BASENAME-$BEST_QUALITY.y4m
267 fi 344 fi
268 345
269 rm "$BASENAME"-*-tmp*.y4m 346 rm "$BASENAME"-*-tmp*.y4m
270 rm "$BASENAME"-*-tmp*.$EXT 347 rm "$BASENAME"-*-tmp*.$EXT
348 rm "$BASENAME"-*-tmp*.out
271 done 349 done
272 done 350 done
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld