[options]\n");
System.out.println("Options:\n");
- System.out.println("-alloc = Dynamically allocate JPEG image buffers");
- System.out.println("-bottomup = Test bottom-up compression/decompression");
- System.out.println("-tile = Test performance of the codec when the image is encoded as separate");
- System.out.println(" tiles of varying sizes.");
+ System.out.println("-bottomup = Use bottom-up row order for packed-pixel source/destination buffers");
+ System.out.println("-tile = Compress/transform the input image into separate JPEG tiles of varying");
+ System.out.println(" sizes (useful for measuring JPEG overhead)");
System.out.println("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb =");
- System.out.println(" Test the specified color conversion path in the codec (default = BGR)");
- System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available in");
- System.out.println(" the underlying codec");
- System.out.println("-fastdct = Use the fastest DCT/IDCT algorithms available in the underlying");
- System.out.println(" codec");
- System.out.println("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the");
- System.out.println(" underlying codec");
+ System.out.println(" Use the specified pixel format for packed-pixel source/destination buffers");
+ System.out.println(" [default = BGR]");
+ System.out.println("-fastupsample = Use the fastest chrominance upsampling algorithm available");
+ System.out.println("-fastdct = Use the fastest DCT/IDCT algorithm available");
+ System.out.println("-accuratedct = Use the most accurate DCT/IDCT algorithm available");
System.out.println("-progressive = Use progressive entropy coding in JPEG images generated by");
- System.out.println(" compression and transform operations. (Can be combined with -arithmetic.)");
+ System.out.println(" compression and transform operations (can be combined with -arithmetic)");
System.out.println("-arithmetic = Use arithmetic entropy coding in JPEG images generated by");
- System.out.println(" compression and transform operations. (Can be combined with");
- System.out.println(" -progressive.)");
- System.out.println("-lossless = Generate lossless JPEG images (implies -subsamp 444). When");
- System.out.println(" generating lossless JPEG images, Quality is psv * 10 + Pt, where psv is");
- System.out.println(" the predictor selection value (1-7) and Pt is the point transform (0-7).");
- System.out.println(" A point transform value of 0 is necessary in order to create a fully");
- System.out.println(" lossless JPEG image.");
- System.out.println("-subsamp = When testing JPEG compression, this option specifies the level");
- System.out.println(" of chrominance subsampling to use ( = 444, 422, 440, 420, 411, or");
- System.out.println(" GRAY). The default is to test Grayscale, 4:2:0, 4:2:2, and 4:4:4 in");
- System.out.println(" sequence.");
+ System.out.println(" compression and transform operations (can be combined with -progressive)");
+ System.out.println("-lossless = Generate lossless JPEG images when compressing (implies");
+ System.out.println(" -subsamp 444). When generating lossless JPEG images, Quality is");
+ System.out.println(" psv * 10 + Pt, where psv is the predictor selection value (1-7) and Pt is");
+ System.out.println(" the point transform (0-7). A point transform value of 0 is necessary in");
+ System.out.println(" order to create a fully lossless JPEG image.");
+ System.out.println("-subsamp = When compressing, use the specified level of chrominance");
+ System.out.println(" subsampling ( = 444, 422, 440, 420, 411, or GRAY) [default = test");
+ System.out.println(" Grayscale, 4:2:0, 4:2:2, and 4:4:4 in sequence]");
System.out.println("-quiet = Output results in tabular rather than verbose format");
- System.out.println("-yuv = Test YUV encoding/decoding functions");
- System.out.println("-yuvpad = If testing YUV encoding/decoding, this specifies the number of");
- System.out.println(" bytes by which each row of each plane in the intermediate YUV image is");
- System.out.println(" evenly divisible (default = 1)");
- System.out.println("-scale M/N = Scale down the width/height of the decompressed JPEG image by a");
+ System.out.println("-yuv = Compress from/decompress to intermediate planar YUV images");
+ System.out.println("-yuvpad
= The number of bytes by which each row in each plane of an");
+ System.out.println(" intermediate YUV image is evenly divisible (must be a power of 2)");
+ System.out.println(" [default = 1]");
+ System.out.println("-scale M/N = When decompressing, scale the width/height of the JPEG image by a");
System.out.print(" factor of M/N (M/N = ");
for (i = 0; i < nsf; i++) {
System.out.format("%d/%d", scalingFactors[i].getNum(),
@@ -758,24 +753,24 @@ else if (nsf > 2) {
}
System.out.println(")");
System.out.println("-hflip, -vflip, -transpose, -transverse, -rot90, -rot180, -rot270 =");
- System.out.println(" Perform the corresponding lossless transform prior to");
- System.out.println(" decompression (these options are mutually exclusive)");
- System.out.println("-grayscale = Perform lossless grayscale conversion prior to decompression");
- System.out.println(" test (can be combined with the other transforms above)");
+ System.out.println(" Perform the specified lossless transform operation on the input image");
+ System.out.println(" prior to decompression (these operations are mutually exclusive)");
+ System.out.println("-grayscale = Transform the input image into a grayscale JPEG image prior to");
+ System.out.println(" decompression (can be combined with the other transform operations above)");
System.out.println("-copynone = Do not copy any extra markers (including EXIF and ICC profile data)");
- System.out.println(" when transforming the image.");
- System.out.println("-benchtime = Run each benchmark for at least seconds (default = 5.0)");
- System.out.println("-warmup = Run each benchmark for seconds (default = 1.0) prior to");
+ System.out.println(" when transforming the input image");
+ System.out.println("-benchtime = Run each benchmark for at least seconds [default = 5.0]");
+ System.out.println("-warmup = Run each benchmark for seconds [default = 1.0] prior to");
System.out.println(" starting the timer, in order to prime the caches and thus improve the");
- System.out.println(" consistency of the results.");
+ System.out.println(" consistency of the benchmark results");
System.out.println("-componly = Stop after running compression tests. Do not test decompression.");
- System.out.println("-nowrite = Do not write reference or output images (improves consistency");
- System.out.println(" of performance measurements.)");
+ System.out.println("-nowrite = Do not write reference or output images (improves consistency of");
+ System.out.println(" benchmark results)");
System.out.println("-limitscans = Refuse to decompress or transform progressive JPEG images that");
System.out.println(" have an unreasonably large number of scans");
System.out.println("-stoponwarning = Immediately discontinue the current");
- System.out.println(" compression/decompression/transform operation if the underlying codec");
- System.out.println(" throws a warning (non-fatal error)\n");
+ System.out.println(" compression/decompression/transform operation if a warning (non-fatal");
+ System.out.println(" error) occurs\n");
System.out.println("NOTE: If the quality is specified as a range (e.g. 90-100), a separate");
System.out.println("test will be performed for all quality values in the range.\n");
System.exit(1);
@@ -803,18 +798,18 @@ public static void main(String[] argv) {
minArg = 2;
if (argv.length < minArg)
usage();
+ String[] quals = argv[1].split("-", 2);
try {
- minQual = Integer.parseInt(argv[1]);
+ minQual = Integer.parseInt(quals[0]);
} catch (NumberFormatException e) {}
if (minQual < 1 || minQual > 100)
throw new Exception("Quality must be between 1 and 100.");
- int dashIndex = argv[1].indexOf('-');
- if (dashIndex > 0 && argv[1].length() > dashIndex + 1) {
+ if (quals.length > 1) {
try {
- maxQual = Integer.parseInt(argv[1].substring(dashIndex + 1));
+ maxQual = Integer.parseInt(quals[1]);
} catch (NumberFormatException e) {}
}
- if (maxQual < 1 || maxQual > 100)
+ if (maxQual < 1 || maxQual > 100 || maxQual < minQual)
maxQual = minQual;
}
@@ -823,7 +818,7 @@ public static void main(String[] argv) {
if (argv[i].equalsIgnoreCase("-tile")) {
doTile = true; xformOpt |= TJTransform.OPT_CROP;
} else if (argv[i].equalsIgnoreCase("-fastupsample")) {
- System.out.println("Using fast upsampling code\n");
+ System.out.println("Using fastest upsampling algorithm\n");
flags |= TJ.FLAG_FASTUPSAMPLE;
} else if (argv[i].equalsIgnoreCase("-fastdct")) {
System.out.println("Using fastest DCT/IDCT algorithm\n");
@@ -834,9 +829,11 @@ public static void main(String[] argv) {
} else if (argv[i].equalsIgnoreCase("-progressive")) {
System.out.println("Using progressive entropy coding\n");
flags |= TJ.FLAG_PROGRESSIVE;
+ xformOpt |= TJTransform.OPT_PROGRESSIVE;
} else if (argv[i].equalsIgnoreCase("-arithmetic")) {
System.out.println("Using arithmetic entropy coding\n");
flags |= TJ.FLAG_ARITHMETIC;
+ xformOpt |= TJTransform.OPT_ARITHMETIC;
} else if (argv[i].equalsIgnoreCase("-lossless")) {
System.out.println("Using lossless JPEG\n\n");
flags |= TJ.FLAG_LOSSLESS;
@@ -936,8 +933,10 @@ else if (argv[i].equalsIgnoreCase("-benchtime") &&
try {
temp = Integer.parseInt(argv[++i]);
} catch (NumberFormatException e) {}
- if (temp >= 1)
+ if (temp >= 1 && (temp & (temp - 1)) == 0)
yuvAlign = temp;
+ else
+ usage();
} else if (argv[i].equalsIgnoreCase("-subsamp") &&
i < argv.length - 1) {
i++;
@@ -953,6 +952,8 @@ else if (argv[i].equals("420"))
subsamp = TJ.SAMP_420;
else if (argv[i].equals("411"))
subsamp = TJ.SAMP_411;
+ else
+ usage();
} else if (argv[i].equalsIgnoreCase("-componly"))
compOnly = true;
else if (argv[i].equalsIgnoreCase("-nowrite"))
@@ -986,7 +987,7 @@ else if (argv[i].equalsIgnoreCase("-stoponwarning"))
if (quiet == 1 && !decompOnly) {
System.out.println("All performance values in Mpixels/sec\n");
- System.out.format("Bitmap JPEG JPEG %s %s ",
+ System.out.format("Pixel JPEG JPEG %s %s ",
(doTile ? "Tile " : "Image"),
(doTile ? "Tile " : "Image"));
if (doYUV)
diff --git a/java/TJUnitTest.java b/java/TJUnitTest.java
index b8f337862..7baef6e7b 100644
--- a/java/TJUnitTest.java
+++ b/java/TJUnitTest.java
@@ -48,11 +48,11 @@ private TJUnitTest() {}
static void usage() {
System.out.println("\nUSAGE: java " + CLASS_NAME + " [options]\n");
System.out.println("Options:");
- System.out.println("-yuv = test YUV encoding/decoding support");
- System.out.println("-noyuvpad = do not pad each line of each Y, U, and V plane to the nearest");
+ System.out.println("-yuv = test YUV encoding/compression/decompression/decoding");
+ System.out.println("-noyuvpad = do not pad each row in each Y, U, and V plane to the nearest");
System.out.println(" multiple of 4 bytes");
System.out.println("-lossless = test lossless JPEG compression/decompression");
- System.out.println("-bi = test BufferedImage support\n");
+ System.out.println("-bi = test BufferedImage I/O\n");
System.exit(1);
}
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html
index 21b393070..ddbaf3d49 100644
--- a/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html
@@ -608,7 +608,7 @@ setSourceImage
"tables-only") datastream of length imageSize
bytes stored in
jpegImage
with this decompressor instance. If
jpegImage
contains a JPEG image, then this image will be used
- as the source image for subsequent decompress operations. Passing a
+ as the source image for subsequent decompression operations. Passing a
tables-only datastream to this method primes the decompressor with
quantization and Huffman tables that can be used when decompressing
subsequent "abbreviated image" datastreams. This is useful, for instance,
@@ -629,8 +629,8 @@ setSourceImage
setSourceImage
public void setSourceImage(YUVImage srcImage)
Associate the specified planar YUV source image with this decompressor
- instance. Subsequent decompress operations will decode this image into a
- packed-pixel RGB or grayscale destination image.
+ instance. Subsequent decompression operations will decode this image into
+ a packed-pixel RGB or grayscale destination image.
- Parameters:
srcImage
- YUVImage
instance containing a planar YUV source
image to be decoded. This image is not modified.
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html b/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html
index a7304cad7..40265efac 100644
--- a/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html
@@ -584,8 +584,8 @@ OPT_PROGRESSIVE
This option will enable progressive entropy coding in the JPEG image
generated by this particular transform. Progressive entropy coding will
generally improve compression relative to baseline entropy coding (the
- default), but it will reduce compression and decompression performance
- considerably. Can be combined with
OPT_ARITHMETIC
.
+ default), but it will reduce decompression performance considerably. Can
+ be combined with OPT_ARITHMETIC
.
- See Also:
- Constant Field Values
@@ -611,8 +611,8 @@ OPT_ARITHMETIC
This option will enable arithmetic entropy coding in the JPEG image
generated by this particular transform. Arithmetic entropy coding will
generally improve compression relative to Huffman entropy coding (the
- default), but it will reduce compression and decompression performance
- considerably. Can be combined with
OPT_PROGRESSIVE
.
+ default), but it will reduce decompression performance considerably. Can
+ be combined with OPT_PROGRESSIVE
.
- See Also:
- Constant Field Values
diff --git a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
index eefecf1fb..52787ba44 100644
--- a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
+++ b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
@@ -99,7 +99,7 @@ public TJDecompressor(YUVImage yuvImage) throws TJException {
* "tables-only") datastream of length imageSize
bytes stored in
* jpegImage
with this decompressor instance. If
* jpegImage
contains a JPEG image, then this image will be used
- * as the source image for subsequent decompress operations. Passing a
+ * as the source image for subsequent decompression operations. Passing a
* tables-only datastream to this method primes the decompressor with
* quantization and Huffman tables that can be used when decompressing
* subsequent "abbreviated image" datastreams. This is useful, for instance,
@@ -124,8 +124,8 @@ public void setSourceImage(byte[] jpegImage, int imageSize)
/**
* Associate the specified planar YUV source image with this decompressor
- * instance. Subsequent decompress operations will decode this image into a
- * packed-pixel RGB or grayscale destination image.
+ * instance. Subsequent decompression operations will decode this image into
+ * a packed-pixel RGB or grayscale destination image.
*
* @param srcImage {@link YUVImage} instance containing a planar YUV source
* image to be decoded. This image is not modified.
diff --git a/java/org/libjpegturbo/turbojpeg/TJTransform.java b/java/org/libjpegturbo/turbojpeg/TJTransform.java
index db5472ebd..d02d258fd 100644
--- a/java/org/libjpegturbo/turbojpeg/TJTransform.java
+++ b/java/org/libjpegturbo/turbojpeg/TJTransform.java
@@ -131,8 +131,8 @@ public class TJTransform extends Rectangle {
* This option will enable progressive entropy coding in the JPEG image
* generated by this particular transform. Progressive entropy coding will
* generally improve compression relative to baseline entropy coding (the
- * default), but it will reduce compression and decompression performance
- * considerably. Can be combined with {@link #OPT_ARITHMETIC}.
+ * default), but it will reduce decompression performance considerably. Can
+ * be combined with {@link #OPT_ARITHMETIC}.
*/
public static final int OPT_PROGRESSIVE = (1 << 5);
/**
@@ -145,8 +145,8 @@ public class TJTransform extends Rectangle {
* This option will enable arithmetic entropy coding in the JPEG image
* generated by this particular transform. Arithmetic entropy coding will
* generally improve compression relative to Huffman entropy coding (the
- * default), but it will reduce compression and decompression performance
- * considerably. Can be combined with {@link #OPT_PROGRESSIVE}.
+ * default), but it will reduce decompression performance considerably. Can
+ * be combined with {@link #OPT_PROGRESSIVE}.
*/
public static final int OPT_ARITHMETIC = (1 << 7);
diff --git a/tjbench.c b/tjbench.c
index 0456e6091..dcf266c19 100644
--- a/tjbench.c
+++ b/tjbench.c
@@ -278,7 +278,7 @@ static int decomp(unsigned char *srcBuf, unsigned char **jpegBuf,
qualStr, sizeStr, ext);
if (tjSaveImage(tempStr, dstBuf, scaledw, 0, scaledh, pf, flags) == -1)
- THROW_TJG("saving bitmap");
+ THROW_TJG("saving output image");
ptr = strrchr(tempStr, '.');
SNPRINTF(ptr, 1024 - (ptr - tempStr), "-err.%s", ext);
if (srcBuf && sf.num == 1 && sf.denom == 1) {
@@ -310,7 +310,7 @@ static int decomp(unsigned char *srcBuf, unsigned char **jpegBuf,
srcBuf[pitch * row + col]);
}
if (tjSaveImage(tempStr, dstBuf, w, 0, h, pf, flags) == -1)
- THROW_TJG("saving bitmap");
+ THROW_TJG("saving output image");
}
bailout:
@@ -575,7 +575,7 @@ static int decompTest(char *fileName)
if (quiet == 1) {
printf("All performance values in Mpixels/sec\n\n");
- printf("Bitmap JPEG JPEG %s %s Xform Comp Decomp ",
+ printf("Pixel JPEG JPEG %s %s Xform Comp Decomp ",
doTile ? "Tile " : "Image", doTile ? "Tile " : "Image");
if (doYUV) printf("Decode");
printf("\n");
@@ -757,46 +757,41 @@ static void usage(char *progName)
int i;
printf("USAGE: %s\n", progName);
- printf(" [options]\n\n");
+ printf(" [options]\n\n");
printf(" %s\n", progName);
- printf(" [options]\n\n");
+ printf(" [options]\n\n");
printf("Options:\n\n");
- printf("-alloc = Dynamically allocate JPEG image buffers\n");
- printf("-bmp = Generate output images in Windows Bitmap format (default = PPM)\n");
- printf("-bottomup = Test bottom-up compression/decompression\n");
- printf("-tile = Test performance of the codec when the image is encoded as separate\n");
- printf(" tiles of varying sizes.\n");
+ printf("-alloc = Dynamically allocate JPEG buffers\n");
+ printf("-bmp = Use Windows Bitmap format for output images [default = PPM]\n");
+ printf("-bottomup = Use bottom-up row order for packed-pixel source/destination buffers\n");
+ printf("-tile = Compress/transform the input image into separate JPEG tiles of varying\n");
+ printf(" sizes (useful for measuring JPEG overhead)\n");
printf("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb =\n");
- printf(" Test the specified color conversion path in the codec (default = BGR)\n");
- printf("-cmyk = Indirectly test YCCK JPEG compression/decompression (the source\n");
- printf(" and destination bitmaps are still RGB. The conversion is done\n");
- printf(" internally prior to compression or after decompression.)\n");
- printf("-fastupsample = Use the fastest chrominance upsampling algorithm available in\n");
- printf(" the underlying codec\n");
- printf("-fastdct = Use the fastest DCT/IDCT algorithms available in the underlying\n");
- printf(" codec\n");
- printf("-accuratedct = Use the most accurate DCT/IDCT algorithms available in the\n");
- printf(" underlying codec\n");
+ printf(" Use the specified pixel format for packed-pixel source/destination buffers\n");
+ printf(" [default = BGR]\n");
+ printf("-cmyk = Indirectly test YCCK JPEG compression/decompression\n");
+ printf(" (use the CMYK pixel format for packed-pixel source/destination buffers)\n");
+ printf("-fastupsample = Use the fastest chrominance upsampling algorithm available\n");
+ printf("-fastdct = Use the fastest DCT/IDCT algorithm available\n");
+ printf("-accuratedct = Use the most accurate DCT/IDCT algorithm available\n");
printf("-progressive = Use progressive entropy coding in JPEG images generated by\n");
- printf(" compression and transform operations. (Can be combined with -arithmetic.)\n");
+ printf(" compression and transform operations (can be combined with -arithmetic)\n");
printf("-arithmetic = Use arithmetic entropy coding in JPEG images generated by\n");
- printf(" compression and transform operations. (Can be combined with\n");
- printf(" -progressive.)\n");
- printf("-lossless = Generate lossless JPEG images (implies -subsamp 444). When\n");
- printf(" generating lossless JPEG images, Quality is psv * 10 + Pt, where psv is\n");
- printf(" the predictor selection value (1-7) and Pt is the point transform (0-7).\n");
- printf(" A point transform value of 0 is necessary in order to create a fully\n");
- printf(" lossless JPEG image.\n");
- printf("-subsamp = When testing JPEG compression, this option specifies the level\n");
- printf(" of chrominance subsampling to use ( = 444, 422, 440, 420, 411, or\n");
- printf(" GRAY). The default is to test Grayscale, 4:2:0, 4:2:2, and 4:4:4 in\n");
- printf(" sequence.\n");
+ printf(" compression and transform operations (can be combined with -progressive)\n");
+ printf("-lossless = Generate lossless JPEG images when compressing (implies\n");
+ printf(" -subsamp 444). When generating lossless JPEG images, Quality is\n");
+ printf(" psv * 10 + Pt, where psv is the predictor selection value (1-7) and Pt is\n");
+ printf(" the point transform (0-7). A point transform value of 0 is necessary in\n");
+ printf(" order to create a fully lossless JPEG image.\n");
+ printf("-subsamp = When compressing, use the specified level of chrominance\n");
+ printf(" subsampling ( = 444, 422, 440, 420, 411, or GRAY) [default = test\n");
+ printf(" Grayscale, 4:2:0, 4:2:2, and 4:4:4 in sequence]\n");
printf("-quiet = Output results in tabular rather than verbose format\n");
- printf("-yuv = Test YUV encoding/decoding functions\n");
- printf("-yuvpad = If testing YUV encoding/decoding, this specifies the number of\n");
- printf(" bytes by which each row of each plane in the intermediate YUV image is\n");
- printf(" evenly divisible (default = 1)\n");
- printf("-scale M/N = Scale down the width/height of the decompressed JPEG image by a\n");
+ printf("-yuv = Compress from/decompress to intermediate planar YUV images\n");
+ printf("-yuvpad
= The number of bytes by which each row in each plane of an\n");
+ printf(" intermediate YUV image is evenly divisible (must be a power of 2)\n");
+ printf(" [default = 1]\n");
+ printf("-scale M/N = When decompressing, scale the width/height of the JPEG image by a\n");
printf(" factor of M/N (M/N = ");
for (i = 0; i < nsf; i++) {
printf("%d/%d", scalingFactors[i].num, scalingFactors[i].denom);
@@ -809,24 +804,24 @@ static void usage(char *progName)
}
printf(")\n");
printf("-hflip, -vflip, -transpose, -transverse, -rot90, -rot180, -rot270 =\n");
- printf(" Perform the corresponding lossless transform prior to\n");
- printf(" decompression (these options are mutually exclusive)\n");
- printf("-grayscale = Perform lossless grayscale conversion prior to decompression\n");
- printf(" test (can be combined with the other transforms above)\n");
+ printf(" Perform the specified lossless transform operation on the input image\n");
+ printf(" prior to decompression (these operations are mutually exclusive)\n");
+ printf("-grayscale = Transform the input image into a grayscale JPEG image prior to\n");
+ printf(" decompression (can be combined with the other transform operations above)\n");
printf("-copynone = Do not copy any extra markers (including EXIF and ICC profile data)\n");
- printf(" when transforming the image.\n");
- printf("-benchtime = Run each benchmark for at least seconds (default = 5.0)\n");
- printf("-warmup = Run each benchmark for seconds (default = 1.0) prior to\n");
+ printf(" when transforming the input image\n");
+ printf("-benchtime = Run each benchmark for at least seconds [default = 5.0]\n");
+ printf("-warmup = Run each benchmark for seconds [default = 1.0] prior to\n");
printf(" starting the timer, in order to prime the caches and thus improve the\n");
- printf(" consistency of the results.\n");
+ printf(" consistency of the benchmark results\n");
printf("-componly = Stop after running compression tests. Do not test decompression.\n");
printf("-nowrite = Do not write reference or output images (improves consistency of\n");
- printf(" performance measurements.)\n");
+ printf(" benchmark results)\n");
printf("-limitscans = Refuse to decompress or transform progressive JPEG images that\n");
printf(" have an unreasonably large number of scans\n");
printf("-stoponwarning = Immediately discontinue the current\n");
- printf(" compression/decompression/transform operation if the underlying codec\n");
- printf(" throws a warning (non-fatal error)\n\n");
+ printf(" compression/decompression/transform operation if a warning (non-fatal\n");
+ printf(" error) occurs\n\n");
printf("NOTE: If the quality is specified as a range (e.g. 90-100), a separate\n");
printf("test will be performed for all quality values in the range.\n\n");
exit(1);
@@ -872,7 +867,7 @@ int main(int argc, char *argv[])
if (!strcasecmp(argv[i], "-tile")) {
doTile = 1; xformOpt |= TJXOPT_CROP;
} else if (!strcasecmp(argv[i], "-fastupsample")) {
- printf("Using fast upsampling code\n\n");
+ printf("Using fastest upsampling algorithm\n\n");
flags |= TJFLAG_FASTUPSAMPLE;
} else if (!strcasecmp(argv[i], "-fastdct")) {
printf("Using fastest DCT/IDCT algorithm\n\n");
@@ -883,9 +878,11 @@ int main(int argc, char *argv[])
} else if (!strcasecmp(argv[i], "-progressive")) {
printf("Using progressive entropy coding\n\n");
flags |= TJFLAG_PROGRESSIVE;
+ xformOpt |= TJXOPT_PROGRESSIVE;
} else if (!strcasecmp(argv[i], "-arithmetic")) {
printf("Using arithmetic entropy coding\n\n");
flags |= TJFLAG_ARITHMETIC;
+ xformOpt |= TJXOPT_ARITHMETIC;
} else if (!strcasecmp(argv[i], "-lossless")) {
printf("Using lossless JPEG\n\n");
flags |= TJFLAG_LOSSLESS;
@@ -967,7 +964,8 @@ int main(int argc, char *argv[])
} else if (!strcasecmp(argv[i], "-yuvpad") && i < argc - 1) {
int tempi = atoi(argv[++i]);
- if (tempi >= 1) yuvAlign = tempi;
+ if (tempi >= 1 && (tempi & (tempi - 1)) == 0) yuvAlign = tempi;
+ else usage(argv[0]);
} else if (!strcasecmp(argv[i], "-subsamp") && i < argc - 1) {
i++;
if (toupper(argv[i][0]) == 'G') subsamp = TJSAMP_GRAY;
@@ -980,6 +978,7 @@ int main(int argc, char *argv[])
case 440: subsamp = TJSAMP_440; break;
case 420: subsamp = TJSAMP_420; break;
case 411: subsamp = TJSAMP_411; break;
+ default: usage(argv[0]);
}
}
} else if (!strcasecmp(argv[i], "-componly"))
@@ -1008,14 +1007,14 @@ int main(int argc, char *argv[])
if (!decompOnly) {
if ((srcBuf = tjLoadImage(argv[1], &w, 1, &h, &pf, flags)) == NULL)
- THROW_TJG("loading bitmap");
+ THROW_TJG("loading input image");
temp = strrchr(argv[1], '.');
if (temp != NULL) *temp = '\0';
}
if (quiet == 1 && !decompOnly) {
printf("All performance values in Mpixels/sec\n\n");
- printf("Bitmap JPEG JPEG %s %s ",
+ printf("Pixel JPEG JPEG %s %s ",
doTile ? "Tile " : "Image", doTile ? "Tile " : "Image");
if (doYUV) printf("Encode ");
printf("Comp Comp Decomp ");
diff --git a/tjunittest.c b/tjunittest.c
index 8e26edbef..a44d66d7c 100644
--- a/tjunittest.c
+++ b/tjunittest.c
@@ -55,12 +55,12 @@ static void usage(char *progName)
{
printf("\nUSAGE: %s [options]\n\n", progName);
printf("Options:\n");
- printf("-yuv = test YUV encoding/decoding support\n");
- printf("-noyuvpad = do not pad each line of each Y, U, and V plane to the nearest\n");
+ printf("-yuv = test YUV encoding/compression/decompression/decoding\n");
+ printf("-noyuvpad = do not pad each row in each Y, U, and V plane to the nearest\n");
printf(" multiple of 4 bytes\n");
printf("-lossless = test lossless JPEG compression/decompression\n");
- printf("-alloc = test automatic buffer allocation\n");
- printf("-bmp = tjLoadImage()/tjSaveImage() unit test\n\n");
+ printf("-alloc = test automatic JPEG buffer allocation\n");
+ printf("-bmp = test packed-pixel image I/O\n");
exit(1);
}
diff --git a/turbojpeg.c b/turbojpeg.c
index 2617869bc..1b01a5796 100644
--- a/turbojpeg.c
+++ b/turbojpeg.c
@@ -2204,7 +2204,7 @@ DLLEXPORT unsigned char *tjLoadImage(const char *filename, int *width,
invert = (flags & TJFLAG_BOTTOMUP) == 0;
} else if (tempc == 'P') {
if ((src = jinit_read_ppm(cinfo)) == NULL)
- THROWG("tjLoadImage(): Could not initialize bitmap loader");
+ THROWG("tjLoadImage(): Could not initialize PPM loader");
invert = (flags & TJFLAG_BOTTOMUP) != 0;
} else
THROWG("tjLoadImage(): Unsupported file type");
diff --git a/turbojpeg.h b/turbojpeg.h
index fa6bf2f84..5f1fdd821 100644
--- a/turbojpeg.h
+++ b/turbojpeg.h
@@ -574,8 +574,8 @@ enum TJXOP {
* This option will enable progressive entropy coding in the JPEG image
* generated by this particular transform. Progressive entropy coding will
* generally improve compression relative to baseline entropy coding (the
- * default), but it will reduce compression and decompression performance
- * considerably. Can be combined with #TJXOPT_ARITHMETIC.
+ * default), but it will reduce decompression performance considerably. Can be
+ * combined with #TJXOPT_ARITHMETIC.
*/
#define TJXOPT_PROGRESSIVE (1 << 5)
/**
@@ -588,8 +588,8 @@ enum TJXOP {
* This option will enable arithmetic entropy coding in the JPEG image
* generated by this particular transform. Arithmetic entropy coding will
* generally improve compression relative to Huffman entropy coding (the
- * default), but it will reduce compression and decompression performance
- * considerably. Can be combined with #TJXOPT_PROGRESSIVE.
+ * default), but it will reduce decompression performance considerably. Can be
+ * combined with #TJXOPT_PROGRESSIVE.
*/
#define TJXOPT_ARITHMETIC (1 << 7)