shun-iwasawa 82a8f5
#!/bin/bash
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
set -u
shun-iwasawa 82a8f5
set -e
shun-iwasawa 82a8f5
trap onexit INT
shun-iwasawa 82a8f5
trap onexit TERM
shun-iwasawa 82a8f5
trap onexit EXIT
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
onexit()
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
	if [ -d $OUTDIR ]; then
shun-iwasawa 82a8f5
		rm -rf $OUTDIR
shun-iwasawa 82a8f5
	fi
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
runme()
shun-iwasawa 82a8f5
{
shun-iwasawa 82a8f5
	echo \*\*\* $*
shun-iwasawa 82a8f5
	$*
shun-iwasawa 82a8f5
}
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
EXT=bmp
shun-iwasawa 82a8f5
IMAGES="vgl_5674_0098.${EXT} vgl_6434_0018a.${EXT} vgl_6548_0026a.${EXT} nightshot_iso_100.${EXT}"
shun-iwasawa 82a8f5
IMGDIR=@CMAKE_CURRENT_SOURCE_DIR@/testimages
shun-iwasawa 82a8f5
OUTDIR=`mktemp -d /tmp/__tjbenchtest_output.XXXXXX`
shun-iwasawa 82a8f5
EXEDIR=@CMAKE_CURRENT_BINARY_DIR@
shun-iwasawa 82a8f5
BMPARG=
shun-iwasawa 82a8f5
NSARG=
shun-iwasawa 82a8f5
YUVARG=
shun-iwasawa 82a8f5
ALLOC=0
shun-iwasawa 82a8f5
ALLOCARG=
shun-iwasawa 82a8f5
PROGARG=
shun-iwasawa 82a8f5
if [ "$EXT" = "bmp" ]; then BMPARG=-bmp; fi
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
if [ -d $OUTDIR ]; then
shun-iwasawa 82a8f5
	rm -rf $OUTDIR
shun-iwasawa 82a8f5
fi
shun-iwasawa 82a8f5
mkdir -p $OUTDIR
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
while [ $# -gt 0 ]; do
shun-iwasawa 82a8f5
	case "$1" in
shun-iwasawa 82a8f5
	-yuv)
shun-iwasawa 82a8f5
		NSARG=-nosmooth
shun-iwasawa 82a8f5
		YUVARG=-yuv
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
# NOTE: The combination of tjEncodeYUV*() and tjCompressFromYUV*() does not
shun-iwasawa 82a8f5
# always produce bitwise-identical results to tjCompress*() if subsampling is
shun-iwasawa 82a8f5
# enabled.  In both cases, if the image width or height are not evenly
shun-iwasawa 82a8f5
# divisible by the MCU width/height, then the bottom and/or right edge are
shun-iwasawa 82a8f5
# expanded.  However, the libjpeg code performs this expansion prior to
shun-iwasawa 82a8f5
# downsampling, and TurboJPEG performs it in tjCompressFromYUV*(), which is
shun-iwasawa 82a8f5
# after downsampling.  Thus, the two will agree only if the width/height along
shun-iwasawa 82a8f5
# each downsampled dimension is an odd number or is evenly divisible by the MCU
shun-iwasawa 82a8f5
# width/height.  This disagreement basically amounts to a round-off error, but
shun-iwasawa 82a8f5
# there is no easy way around it, so for now, we just test the only image that
shun-iwasawa 82a8f5
# works.  (NOTE: nightshot_iso_100 does not suffer from the above issue, but
shun-iwasawa 82a8f5
# it suffers from an unrelated problem whereby the combination of
shun-iwasawa 82a8f5
# tjDecompressToYUV*() and tjDecodeYUV*() do not produce bitwise-identical
shun-iwasawa 82a8f5
# results to tjDecompress*() if decompression scaling is enabled.  This latter
shun-iwasawa 82a8f5
# phenomenon is not yet fully understood but is also believed to be some sort
shun-iwasawa 82a8f5
# of round-off error.)
shun-iwasawa 82a8f5
		IMAGES="vgl_6548_0026a.${EXT}"
shun-iwasawa 82a8f5
		;;
shun-iwasawa 82a8f5
	-alloc)
shun-iwasawa 82a8f5
		ALLOCARG=-alloc
shun-iwasawa 82a8f5
		ALLOC=1
shun-iwasawa 82a8f5
		;;
shun-iwasawa 82a8f5
	-progressive)
shun-iwasawa 82a8f5
		PROGARG=-progressive
shun-iwasawa 82a8f5
		;;
shun-iwasawa 82a8f5
	esac
shun-iwasawa 82a8f5
	shift
shun-iwasawa 82a8f5
done
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
exec >$EXEDIR/tjbenchtest$YUVARG$ALLOCARG$PROGARG.log
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
# Standard tests
shun-iwasawa 82a8f5
for image in $IMAGES; do
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
	cp $IMGDIR/$image $OUTDIR
shun-iwasawa 82a8f5
	basename=`basename $image .${EXT}`
shun-iwasawa 82a8f5
	runme $EXEDIR/cjpeg -quality 95 -dct fast $PROGARG -grayscale -outfile $OUTDIR/${basename}_GRAY_fast_cjpeg.jpg $IMGDIR/${basename}.${EXT}
shun-iwasawa 82a8f5
	runme $EXEDIR/cjpeg -quality 95 -dct fast $PROGARG -sample 2x2 -outfile $OUTDIR/${basename}_420_fast_cjpeg.jpg $IMGDIR/${basename}.${EXT}
shun-iwasawa 82a8f5
	runme $EXEDIR/cjpeg -quality 95 -dct fast $PROGARG -sample 2x1 -outfile $OUTDIR/${basename}_422_fast_cjpeg.jpg $IMGDIR/${basename}.${EXT}
shun-iwasawa 82a8f5
	runme $EXEDIR/cjpeg -quality 95 -dct fast $PROGARG -sample 1x1 -outfile $OUTDIR/${basename}_444_fast_cjpeg.jpg $IMGDIR/${basename}.${EXT}
shun-iwasawa 82a8f5
	runme $EXEDIR/cjpeg -quality 95 -dct int $PROGARG -grayscale -outfile $OUTDIR/${basename}_GRAY_accurate_cjpeg.jpg $IMGDIR/${basename}.${EXT}
shun-iwasawa 82a8f5
	runme $EXEDIR/cjpeg -quality 95 -dct int $PROGARG -sample 2x2 -outfile $OUTDIR/${basename}_420_accurate_cjpeg.jpg $IMGDIR/${basename}.${EXT}
shun-iwasawa 82a8f5
	runme $EXEDIR/cjpeg -quality 95 -dct int $PROGARG -sample 2x1 -outfile $OUTDIR/${basename}_422_accurate_cjpeg.jpg $IMGDIR/${basename}.${EXT}
shun-iwasawa 82a8f5
	runme $EXEDIR/cjpeg -quality 95 -dct int $PROGARG -sample 1x1 -outfile $OUTDIR/${basename}_444_accurate_cjpeg.jpg $IMGDIR/${basename}.${EXT}
shun-iwasawa 82a8f5
	for samp in GRAY 420 422 444; do
shun-iwasawa 82a8f5
		runme $EXEDIR/djpeg -rgb $NSARG $BMPARG -outfile $OUTDIR/${basename}_${samp}_default_djpeg.${EXT} $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg
shun-iwasawa 82a8f5
		runme $EXEDIR/djpeg -dct fast -rgb $NSARG $BMPARG -outfile $OUTDIR/${basename}_${samp}_fast_djpeg.${EXT} $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg
shun-iwasawa 82a8f5
		runme $EXEDIR/djpeg -dct int -rgb $NSARG $BMPARG -outfile $OUTDIR/${basename}_${samp}_accurate_djpeg.${EXT} $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg
shun-iwasawa 82a8f5
	done
shun-iwasawa 82a8f5
	for samp in 420 422; do
shun-iwasawa 82a8f5
		runme $EXEDIR/djpeg -nosmooth $BMPARG -outfile $OUTDIR/${basename}_${samp}_default_nosmooth_djpeg.${EXT} $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg
shun-iwasawa 82a8f5
		runme $EXEDIR/djpeg -dct fast -nosmooth $BMPARG -outfile $OUTDIR/${basename}_${samp}_fast_nosmooth_djpeg.${EXT} $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg
shun-iwasawa 82a8f5
		runme $EXEDIR/djpeg -dct int -nosmooth $BMPARG -outfile $OUTDIR/${basename}_${samp}_accurate_nosmooth_djpeg.${EXT} $OUTDIR/${basename}_${samp}_accurate_cjpeg.jpg
shun-iwasawa 82a8f5
	done
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
	# Compression
shun-iwasawa 82a8f5
	for dct in accurate fast; do
shun-iwasawa 82a8f5
		runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -quiet -benchtime 0.01 -warmup 0 -${dct}dct $YUVARG $ALLOCARG $PROGARG
shun-iwasawa 82a8f5
		for samp in GRAY 420 422 444; do
shun-iwasawa 82a8f5
			runme cmp $OUTDIR/${basename}_${samp}_Q95.jpg $OUTDIR/${basename}_${samp}_${dct}_cjpeg.jpg
shun-iwasawa 82a8f5
		done
shun-iwasawa 82a8f5
	done
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
	for dct in fast accurate default; do
shun-iwasawa 82a8f5
		dctarg=-${dct}dct
shun-iwasawa 82a8f5
		if [ "${dct}" = "default" ]; then
shun-iwasawa 82a8f5
			dctarg=
shun-iwasawa 82a8f5
		fi
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
		# Tiled compression & decompression
shun-iwasawa 82a8f5
		runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01 -warmup 0 ${dctarg} $YUVARG $ALLOCARG $PROGARG
shun-iwasawa 82a8f5
		for samp in GRAY 444; do
shun-iwasawa 82a8f5
			if [ $ALLOC = 1 ]; then
shun-iwasawa 82a8f5
				runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT}
shun-iwasawa 82a8f5
				rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT}
shun-iwasawa 82a8f5
			else
shun-iwasawa 82a8f5
				for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
shun-iwasawa 82a8f5
					$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
shun-iwasawa 82a8f5
					runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT}
shun-iwasawa 82a8f5
					rm $i
shun-iwasawa 82a8f5
				done
shun-iwasawa 82a8f5
			fi
shun-iwasawa 82a8f5
		done
shun-iwasawa 82a8f5
		runme $EXEDIR/tjbench $OUTDIR/$image 95 -rgb -tile -quiet -benchtime 0.01 -warmup 0 -fastupsample ${dctarg} $YUVARG $ALLOCARG $PROGARG
shun-iwasawa 82a8f5
		for samp in 420 422; do
shun-iwasawa 82a8f5
			if [ $ALLOC = 1 ]; then
shun-iwasawa 82a8f5
				runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT}
shun-iwasawa 82a8f5
				rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT}
shun-iwasawa 82a8f5
			else
shun-iwasawa 82a8f5
				for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
shun-iwasawa 82a8f5
					$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
shun-iwasawa 82a8f5
					runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT}
shun-iwasawa 82a8f5
					rm $i
shun-iwasawa 82a8f5
				done
shun-iwasawa 82a8f5
			fi
shun-iwasawa 82a8f5
		done
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
		# Tiled decompression
shun-iwasawa 82a8f5
		for samp in GRAY 444; do
shun-iwasawa 82a8f5
			runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -tile -quiet -benchtime 0.01 -warmup 0 ${dctarg} $YUVARG $ALLOCARG $PROGARG
shun-iwasawa 82a8f5
			if [ $ALLOC = 1 ]; then
shun-iwasawa 82a8f5
				runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT}
shun-iwasawa 82a8f5
				rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT}
shun-iwasawa 82a8f5
			else
shun-iwasawa 82a8f5
				for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
shun-iwasawa 82a8f5
					$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
shun-iwasawa 82a8f5
					runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_djpeg.${EXT}
shun-iwasawa 82a8f5
					rm $i
shun-iwasawa 82a8f5
				done
shun-iwasawa 82a8f5
			fi
shun-iwasawa 82a8f5
		done
shun-iwasawa 82a8f5
		for samp in 420 422; do
shun-iwasawa 82a8f5
			runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -tile -quiet -benchtime 0.01 -warmup 0 -fastupsample ${dctarg} $YUVARG $ALLOCARG $PROGARG
shun-iwasawa 82a8f5
			if [ $ALLOC = 1 ]; then
shun-iwasawa 82a8f5
				runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT}
shun-iwasawa 82a8f5
				rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT}
shun-iwasawa 82a8f5
			else
shun-iwasawa 82a8f5
				for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
shun-iwasawa 82a8f5
					$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
shun-iwasawa 82a8f5
					runme cmp $i $OUTDIR/${basename}_${samp}_${dct}_nosmooth_djpeg.${EXT}
shun-iwasawa 82a8f5
					rm $i
shun-iwasawa 82a8f5
				done
shun-iwasawa 82a8f5
			fi
shun-iwasawa 82a8f5
		done
shun-iwasawa 82a8f5
	done
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
	# Scaled decompression
shun-iwasawa 82a8f5
	for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do
shun-iwasawa 82a8f5
		scalearg=`echo $scale | sed 's/\_/\//g'`
shun-iwasawa 82a8f5
		for samp in GRAY 420 422 444; do
shun-iwasawa 82a8f5
			runme $EXEDIR/djpeg -rgb -scale ${scalearg} $NSARG $BMPARG -outfile $OUTDIR/${basename}_${samp}_${scale}_djpeg.${EXT} $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg
shun-iwasawa 82a8f5
			runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -scale ${scalearg} -quiet -benchtime 0.01 -warmup 0 $YUVARG $ALLOCARG $PROGARG
shun-iwasawa 82a8f5
			runme cmp $OUTDIR/${basename}_${samp}_Q95_${scale}.${EXT} $OUTDIR/${basename}_${samp}_${scale}_djpeg.${EXT}
shun-iwasawa 82a8f5
			rm $OUTDIR/${basename}_${samp}_Q95_${scale}.${EXT}
shun-iwasawa 82a8f5
		done
shun-iwasawa 82a8f5
	done
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
	# Transforms
shun-iwasawa 82a8f5
	for samp in GRAY 420 422 444; do
shun-iwasawa 82a8f5
		runme $EXEDIR/jpegtran -flip horizontal -trim -outfile $OUTDIR/${basename}_${samp}_hflip_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg
shun-iwasawa 82a8f5
		runme $EXEDIR/jpegtran -flip vertical -trim -outfile $OUTDIR/${basename}_${samp}_vflip_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg
shun-iwasawa 82a8f5
		runme $EXEDIR/jpegtran -transpose -trim -outfile $OUTDIR/${basename}_${samp}_transpose_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg
shun-iwasawa 82a8f5
		runme $EXEDIR/jpegtran -transverse -trim -outfile $OUTDIR/${basename}_${samp}_transverse_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg
shun-iwasawa 82a8f5
		runme $EXEDIR/jpegtran -rotate 90 -trim -outfile $OUTDIR/${basename}_${samp}_rot90_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg
shun-iwasawa 82a8f5
		runme $EXEDIR/jpegtran -rotate 180 -trim -outfile $OUTDIR/${basename}_${samp}_rot180_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg
shun-iwasawa 82a8f5
		runme $EXEDIR/jpegtran -rotate 270 -trim -outfile $OUTDIR/${basename}_${samp}_rot270_jpegtran.jpg $OUTDIR/${basename}_${samp}_Q95.jpg
shun-iwasawa 82a8f5
	done
shun-iwasawa 82a8f5
	for xform in hflip vflip transpose transverse rot90 rot180 rot270; do
shun-iwasawa 82a8f5
		for samp in GRAY 444; do
shun-iwasawa 82a8f5
			runme $EXEDIR/djpeg -rgb $BMPARG -outfile $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg
shun-iwasawa 82a8f5
			runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -tile -quiet -benchtime 0.01 -warmup 0 $YUVARG $ALLOCARG $PROGARG
shun-iwasawa 82a8f5
			if [ $ALLOC = 1 ]; then
shun-iwasawa 82a8f5
				runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT}
shun-iwasawa 82a8f5
				rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT}
shun-iwasawa 82a8f5
			else
shun-iwasawa 82a8f5
				for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
shun-iwasawa 82a8f5
					$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
shun-iwasawa 82a8f5
					runme cmp $i $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT}
shun-iwasawa 82a8f5
					rm $i
shun-iwasawa 82a8f5
				done
shun-iwasawa 82a8f5
			fi
shun-iwasawa 82a8f5
		done
shun-iwasawa 82a8f5
		for samp in 420 422; do
shun-iwasawa 82a8f5
			runme $EXEDIR/djpeg -nosmooth -rgb $BMPARG -outfile $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg
shun-iwasawa 82a8f5
			runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -tile -quiet -benchtime 0.01 -warmup 0 -fastupsample $YUVARG $ALLOCARG $PROGARG
shun-iwasawa 82a8f5
			if [ $ALLOC = 1 ]; then
shun-iwasawa 82a8f5
				runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT}
shun-iwasawa 82a8f5
				rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT}
shun-iwasawa 82a8f5
			else
shun-iwasawa 82a8f5
				for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
shun-iwasawa 82a8f5
					$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
shun-iwasawa 82a8f5
					runme cmp $i $OUTDIR/${basename}_${samp}_${xform}_jpegtran.${EXT}
shun-iwasawa 82a8f5
					rm $i
shun-iwasawa 82a8f5
				done
shun-iwasawa 82a8f5
			fi
shun-iwasawa 82a8f5
		done
shun-iwasawa 82a8f5
	done
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
	# Grayscale transform
shun-iwasawa 82a8f5
	for xform in hflip vflip transpose transverse rot90 rot180 rot270; do
shun-iwasawa 82a8f5
		for samp in GRAY 444 422 420; do
shun-iwasawa 82a8f5
			runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -tile -quiet -benchtime 0.01 -warmup 0 -grayscale $YUVARG $ALLOCARG $PROGARG
shun-iwasawa 82a8f5
			if [ $ALLOC = 1 ]; then
shun-iwasawa 82a8f5
				runme cmp $OUTDIR/${basename}_${samp}_Q95_full.${EXT} $OUTDIR/${basename}_GRAY_${xform}_jpegtran.${EXT}
shun-iwasawa 82a8f5
				rm $OUTDIR/${basename}_${samp}_Q95_full.${EXT}
shun-iwasawa 82a8f5
			else
shun-iwasawa 82a8f5
				for i in $OUTDIR/${basename}_${samp}_Q95_[0-9]*[0-9]x[0-9]*[0-9].${EXT} \
shun-iwasawa 82a8f5
					$OUTDIR/${basename}_${samp}_Q95_full.${EXT}; do
shun-iwasawa 82a8f5
					runme cmp $i $OUTDIR/${basename}_GRAY_${xform}_jpegtran.${EXT}
shun-iwasawa 82a8f5
					rm $i
shun-iwasawa 82a8f5
				done
shun-iwasawa 82a8f5
			fi
shun-iwasawa 82a8f5
		done
shun-iwasawa 82a8f5
	done
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
	# Transforms with scaling
shun-iwasawa 82a8f5
	for xform in hflip vflip transpose transverse rot90 rot180 rot270; do
shun-iwasawa 82a8f5
		for samp in GRAY 444 422 420; do
shun-iwasawa 82a8f5
			for scale in 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8; do
shun-iwasawa 82a8f5
				scalearg=`echo $scale | sed 's/\_/\//g'`
shun-iwasawa 82a8f5
				runme $EXEDIR/djpeg -rgb -scale ${scalearg} $NSARG $BMPARG -outfile $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.${EXT} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg
shun-iwasawa 82a8f5
				runme $EXEDIR/tjbench $OUTDIR/${basename}_${samp}_Q95.jpg $BMPARG -$xform -scale ${scalearg} -quiet -benchtime 0.01 -warmup 0 $YUVARG $ALLOCARG $PROGARG
shun-iwasawa 82a8f5
				runme cmp $OUTDIR/${basename}_${samp}_Q95_${scale}.${EXT} $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.${EXT}
shun-iwasawa 82a8f5
				rm $OUTDIR/${basename}_${samp}_Q95_${scale}.${EXT}
shun-iwasawa 82a8f5
			done
shun-iwasawa 82a8f5
		done
shun-iwasawa 82a8f5
	done
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
done
shun-iwasawa 82a8f5
shun-iwasawa 82a8f5
echo SUCCESS!