Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dcommander committed Jan 20, 2023
2 parents 6a060d8 + 0738305 commit 7ab6222
Show file tree
Hide file tree
Showing 13 changed files with 144 additions and 137 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: |
echo "BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}" >$GITHUB_ENV
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up build
run: |
mkdir -p $HOME/src/ljt.nightly
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
run: |
echo "BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}" >$GITHUB_ENV
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up build
run: |
brew install yasm md5sha1sum
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up build
run: |
sudo apt install -y nasm
Expand All @@ -113,7 +113,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up build
run: |
sudo apt update
Expand All @@ -138,7 +138,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up build
run: |
sudo apt -y install nasm
Expand All @@ -162,7 +162,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Build
env:
CTEST_OUTPUT_ON_FAILURE: 1
Expand Down
7 changes: 7 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ image dimensions.
(`-DWITH_12BIT=1`) using an alpha-enabled output color space such as
`JCS_EXT_RGBA`, the alpha channel was set to 255 rather than 4095.

8. Fixed an issue whereby the Java version of TJBench did not accept a range of
quality values.

9. Fixed an issue whereby, when `-progressive` was passed to TJBench, the JPEG
input image was not transformed into a progressive JPEG image prior to
decompression.


2.1.4
=====
Expand Down
4 changes: 2 additions & 2 deletions doc/html/group___turbo_j_p_e_g.html
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#gaecaaa3b7e2af812592c015d
</div><div class="memdoc">

<p>This option will enable arithmetic entropy coding in the JPEG image generated by this particular transform. </p>
<p>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 <a class="el" href="group___turbo_j_p_e_g.html#gad2371c80674584ecc1a7d75e564cf026" title="This option will enable progressive entropy coding in the JPEG image generated by this particular tra...">TJXOPT_PROGRESSIVE</a>. </p>
<p>Arithmetic entropy coding will generally improve compression relative to Huffman entropy coding (the default), but it will reduce decompression performance considerably. Can be combined with <a class="el" href="group___turbo_j_p_e_g.html#gad2371c80674584ecc1a7d75e564cf026" title="This option will enable progressive entropy coding in the JPEG image generated by this particular tra...">TJXOPT_PROGRESSIVE</a>. </p>

</div>
</div>
Expand Down Expand Up @@ -787,7 +787,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#gad2371c80674584ecc1a7d75
</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. Can be combined with <a class="el" href="group___turbo_j_p_e_g.html#gaecaaa3b7e2af812592c015d83207f010" title="This option will enable arithmetic entropy coding in the JPEG image generated by this particular tran...">TJXOPT_ARITHMETIC</a>. </p>
<p>Progressive entropy coding will generally improve compression relative to baseline entropy coding (the default), but it will reduce decompression performance considerably. Can be combined with <a class="el" href="group___turbo_j_p_e_g.html#gaecaaa3b7e2af812592c015d83207f010" title="This option will enable arithmetic entropy coding in the JPEG image generated by this particular tran...">TJXOPT_ARITHMETIC</a>. </p>

</div>
</div>
Expand Down
103 changes: 52 additions & 51 deletions java/TJBench.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ static void decompTest(String fileName) throws Exception {

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)
Expand Down Expand Up @@ -705,42 +705,37 @@ static void usage() throws Exception {
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. (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 <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 (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 <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 (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(),
Expand All @@ -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 <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);
Expand Down Expand Up @@ -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;
}

Expand All @@ -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");
Expand All @@ -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;
Expand Down Expand Up @@ -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++;
Expand All @@ -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"))
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions java/TJUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 3 additions & 3 deletions java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ <h4>setSourceImage</h4>
"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,
Expand All @@ -629,8 +629,8 @@ <h4>setSourceImage</h4>
<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>
Expand Down
Loading

0 comments on commit 7ab6222

Please sign in to comment.