Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dcommander committed Nov 18, 2017
2 parents 616b4e2 + 19b393b commit 4893e5d
Show file tree
Hide file tree
Showing 28 changed files with 397 additions and 332 deletions.
22 changes: 22 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,28 @@ image planes and allocates memory for the image planes.
8. Fixed an issue whereby the Java version of TJUnitTest would fail when
testing BufferedImage encoding/decoding on big endian systems.

9. Fixed a segfault in djpeg that would occur if an output format other than
PPM/PGM was selected along with the `-crop` option. The `-crop` option now
works with the GIF and Targa formats as well (unfortunately, it cannot be made
to work with the BMP and RLE formats due to the fact that those output engines
write scanlines in bottom-up order.) djpeg will now exit gracefully if an
output format other than PPM/PGM, GIF, or Targa is selected along with the
`-crop` option.

10. Fixed an issue whereby `jpeg_skip_scanlines()` would segfault if color
quantization was enabled.

11. TJBench (both C and Java versions) will now display usage information if
any command-line argument is unrecognized. This prevents the program from
silently ignoring typos.

12. Fixed an access violation in tjbench.exe (Windows) that occurred when the
program was used to decompress an existing JPEG image.

13. Fixed an ArrayIndexOutOfBoundsException in the TJExample Java program that
occurred when attempting to decompress a JPEG image that had been compressed
with 4:1:1 chrominance subsampling.


1.5.2
=====
Expand Down
12 changes: 10 additions & 2 deletions cdjpeg.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1994-1997, Thomas G. Lane.
* It was modified by The libjpeg-turbo Project to include only code relevant
* to libjpeg-turbo.
* libjpeg-turbo Modifications:
* Copyright (C) 2017, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
Expand Down Expand Up @@ -54,6 +54,14 @@ struct djpeg_dest_struct {
JDIMENSION rows_supplied);
/* Finish up at the end of the image. */
void (*finish_output) (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo);
/* Re-calculate buffer dimensions based on output dimensions (for use with
partial image decompression.) If this is NULL, then the output format
does not support partial image decompression (BMP and RLE, in particular,
cannot support partial decompression because they use an inversion buffer
to write the image in bottom-up order.) */
void (*calc_buffer_dimensions) (j_decompress_ptr cinfo,
djpeg_dest_ptr dinfo);


/* Target file spec; filled in by djpeg.c after object is created. */
FILE *output_file;
Expand Down
4 changes: 3 additions & 1 deletion cmakescripts/testclean.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ file(GLOB FILES
*_411_*.png
*_411_*.ppm
*_411_*.jpg
*_411.yuv)
*_411.yuv
tjbenchtest*.log
tjexampletest*.log)

if(NOT FILES STREQUAL "")
message(STATUS "Removing test files")
Expand Down
5 changes: 3 additions & 2 deletions djpeg.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TH DJPEG 1 "18 March 2017"
.TH DJPEG 1 "13 November 2017"
.SH NAME
djpeg \- decompress a JPEG file to an image file
.SH SYNOPSIS
Expand Down Expand Up @@ -207,7 +207,8 @@ Decompress only a rectangular subregion of the image, starting at point X,Y
with width W and height H. If necessary, X will be shifted left to the nearest
iMCU boundary, and the width will be increased accordingly. Note that if
decompression scaling is being used, then X, Y, W, and H are relative to the
scaled image dimensions.
scaled image dimensions. Currently this option only works with the
PBMPLUS (PPM/PGM), GIF, and Targa output formats.
.TP
.B \-verbose
Enable debug printout. More
Expand Down
9 changes: 5 additions & 4 deletions djpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
#include "jversion.h" /* for version message */
#include "jconfigint.h"
#include "wrppm.h"

#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare free() */
extern void free (void *ptr);
Expand Down Expand Up @@ -179,6 +178,7 @@ usage (void)

fprintf(stderr, " -skip Y0,Y1 Decompress all rows except those between Y0 and Y1 (inclusive)\n");
fprintf(stderr, " -crop WxH+X+Y Decompress only a rectangular subregion of the image\n");
fprintf(stderr, " [requires PBMPLUS (PPM/PGM), GIF, or Targa output format]\n");
fprintf(stderr, " -verbose or -debug Emit debug output\n");
fprintf(stderr, " -version Print version information and exit\n");
exit(EXIT_FAILURE);
Expand Down Expand Up @@ -727,9 +727,10 @@ main (int argc, char **argv)
}

jpeg_crop_scanline(&cinfo, &crop_x, &crop_width);
((ppm_dest_ptr) dest_mgr)->buffer_width = cinfo.output_width *
cinfo.out_color_components *
sizeof(JSAMPLE);
if (dest_mgr->calc_buffer_dimensions)
(*dest_mgr->calc_buffer_dimensions) (&cinfo, dest_mgr);
else
ERREXIT(&cinfo, JERR_UNSUPPORTED_FORMAT);

/* Write output file header. This is a hack to ensure that the destination
* manager creates an output image of the proper size.
Expand Down
Loading

0 comments on commit 4893e5d

Please sign in to comment.