TurboJPEG: More documentation improvements

- TJBench/TJUnitTest: Wordsmith command-line output

- Java: "decompress operations"="decompression operations"

- tjLoadImage(): Error message tweak

- Don't mention compression performance in the description of
  TJXOPT_PROGRESSIVE/TJTransform.OPT_PROGRESSIVE, because the image has
  already been compressed at that point.

(Oversights from 9a146f0f23)
This commit is contained in:
DRC
2023-01-18 06:44:46 -06:00
parent 7ed186ed79
commit fb15efe94f
11 changed files with 90 additions and 103 deletions

View File

@@ -717,7 +717,7 @@ YUV Image Format Notes</h2>
</div><div class="memdoc">
<p>This option will enable progressive entropy coding in the JPEG image generated by this particular transform. </p>
<p>Progressive entropy coding will generally improve compression relative to baseline entropy coding (the default), but it will reduce compression and decompression performance considerably. </p>
<p>Progressive entropy coding will generally improve compression relative to baseline entropy coding (the default), but it will reduce decompression performance considerably. </p>
</div>
</div>

View File

@@ -525,7 +525,7 @@ final class TJBench {
if (quiet == 1) {
System.out.println("All performance values in Mpixels/sec\n");
System.out.format("Bitmap JPEG JPEG %s %s Xform Comp Decomp ",
System.out.format("Pixel JPEG JPEG %s %s Xform Comp Decomp ",
(doTile ? "Tile " : "Image"),
(doTile ? "Tile " : "Image"));
if (doYUV)
@@ -696,34 +696,29 @@ final class TJBench {
String className = new TJBench().getClass().getName();
System.out.println("\nUSAGE: java " + className);
System.out.println(" <Inputfile (BMP)> <Quality> [options]\n");
System.out.println(" <Inputimage (BMP)> <Quality> [options]\n");
System.out.println(" java " + className);
System.out.println(" <Inputfile (JPG)> [options]\n");
System.out.println(" <Inputimage (JPG)> [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.");
System.out.println("-subsamp <s> = When testing JPEG compression, this option specifies the level");
System.out.println(" of chrominance subsampling to use (<s> = 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");
System.out.println("-subsamp <s> = When compressing, use the specified level of chrominance");
System.out.println(" subsampling (<s> = 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 <p> = 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 <p> = The number of bytes by which each row in each plane of an");
System.out.println(" intermediate YUV image is evenly divisible [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(),
@@ -741,24 +736,24 @@ final class TJBench {
}
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 <t> = Run each benchmark for at least <t> seconds (default = 5.0)");
System.out.println("-warmup <t> = Run each benchmark for <t> seconds (default = 1.0) prior to");
System.out.println(" when transforming the input image");
System.out.println("-benchtime <t> = Run each benchmark for at least <t> seconds [default = 5.0]");
System.out.println("-warmup <t> = Run each benchmark for <t> 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);
@@ -806,7 +801,7 @@ final class TJBench {
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");
@@ -962,7 +957,7 @@ final class TJBench {
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)

View File

@@ -48,10 +48,10 @@ final class 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("-bi = test BufferedImage support\n");
System.out.println("-bi = test BufferedImage I/O\n");
System.exit(1);
}

View File

@@ -626,7 +626,7 @@ implements java.io.Closeable</pre>
"tables-only") datastream of length <code>imageSize</code> bytes stored in
<code>jpegImage</code> with this decompressor instance. If
<code>jpegImage</code> 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,
@@ -662,8 +662,8 @@ public&nbsp;void&nbsp;setJPEGImage(byte[]&nbsp;jpegImage,
<h4>setSourceImage</h4>
<pre>public&nbsp;void&nbsp;setSourceImage(<a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg">YUVImage</a>&nbsp;srcImage)</pre>
<div class="block">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.</div>
instance. Subsequent decompression operations will decode this image into
a packed-pixel RGB or grayscale destination image.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>srcImage</code> - <a href="../../../org/libjpegturbo/turbojpeg/YUVImage.html" title="class in org.libjpegturbo.turbojpeg"><code>YUVImage</code></a> instance containing a planar YUV source
image to be decoded. This image is not modified.</dd></dl>
</li>

View File

@@ -577,8 +577,7 @@ extends java.awt.Rectangle</pre>
<div class="block">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.</div>
default), but it will reduce decompression performance considerably.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_PROGRESSIVE">Constant Field Values</a></dd></dl>
</li>
</ul>

View File

@@ -99,7 +99,7 @@ public class TJDecompressor implements Closeable {
* "tables-only") datastream of length <code>imageSize</code> bytes stored in
* <code>jpegImage</code> with this decompressor instance. If
* <code>jpegImage</code> 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,
@@ -134,8 +134,8 @@ public class TJDecompressor implements Closeable {
/**
* 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.

View File

@@ -130,8 +130,7 @@ 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.
* default), but it will reduce decompression performance considerably.
*/
public static final int OPT_PROGRESSIVE = 32;
/**

View File

@@ -273,7 +273,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) {
@@ -305,7 +305,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:
@@ -568,7 +568,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");
@@ -750,38 +750,33 @@ static void usage(char *progName)
int i;
printf("USAGE: %s\n", progName);
printf(" <Inputfile (BMP|PPM)> <Quality> [options]\n\n");
printf(" <Inputimage (BMP|PPM)> <Quality> [options]\n\n");
printf(" %s\n", progName);
printf(" <Inputfile (JPG)> [options]\n\n");
printf(" <Inputimage (JPG)> [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.\n");
printf("-subsamp <s> = When testing JPEG compression, this option specifies the level\n");
printf(" of chrominance subsampling to use (<s> = 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\n");
printf("-subsamp <s> = When compressing, use the specified level of chrominance\n");
printf(" subsampling (<s> = 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 <p> = 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 <p> = The number of bytes by which each row in each plane of an\n");
printf(" intermediate YUV image is evenly divisible [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);
@@ -794,24 +789,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 <t> = Run each benchmark for at least <t> seconds (default = 5.0)\n");
printf("-warmup <t> = Run each benchmark for <t> seconds (default = 1.0) prior to\n");
printf(" when transforming the input image\n");
printf("-benchtime <t> = Run each benchmark for at least <t> seconds [default = 5.0]\n");
printf("-warmup <t> = Run each benchmark for <t> 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);
@@ -857,7 +852,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");
@@ -986,14 +981,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 ");

View File

@@ -55,11 +55,11 @@ 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("-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);
}

View File

@@ -2158,7 +2158,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");

View File

@@ -549,8 +549,7 @@ 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.
* default), but it will reduce decompression performance considerably.
*/
#define TJXOPT_PROGRESSIVE 32
/**