when using the YUVImage constructor that creates an instance backed by separate
image planes and allocates memory for the image planes.
-2. Fixed an issue whereby the Java version of TJUnitTest would fail when
+8. Fixed an issue whereby the Java version of TJUnitTest would fail when
testing BufferedImage encoding/decoding on big endian systems.
-3. Fixed a segfault in djpeg that would occur if an output format other than
++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.
+
-4. Fixed an issue whereby `jpeg_skip_scanlines()` would segfault if color
++10. Fixed an issue whereby `jpeg_skip_scanlines()` would segfault if color
+ quantization was enabled.
+
-5. 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.
++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.
+
-6. Fixed an access violation in tjbench.exe (Windows) that occurred when the
++12. Fixed an access violation in tjbench.exe (Windows) that occurred when the
+ program was used to decompress an existing JPEG image.
+
-7. Fixed an ArrayIndexOutOfBoundsException in the TJExample Java program that
++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
=====
*_411_*.png
*_411_*.ppm
*_411_*.jpg
-- *_411.yuv)
++ *_411.yuv
++ tjbenchtest*.log
++ tjexampletest*.log)
if(NOT FILES STREQUAL "")
message(STATUS "Removing test files")
#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);
+#endif
+
#include <ctype.h> /* to declare isprint() */
#ifdef USE_CCOMMAND /* command-line reader for Macintosh */
System.out.println("Using most accurate DCT/IDCT algorithm\n");
flags |= TJ.FLAG_ACCURATEDCT;
}
- if (argv[i].equalsIgnoreCase("-progressive")) {
++ else if (argv[i].equalsIgnoreCase("-progressive")) {
+ System.out.println("Using progressive entropy coding\n");
+ flags |= TJ.FLAG_PROGRESSIVE;
+ }
- if (argv[i].equalsIgnoreCase("-rgb"))
+ else if (argv[i].equalsIgnoreCase("-rgb"))
pf = TJ.PF_RGB;
- if (argv[i].equalsIgnoreCase("-rgbx"))
+ else if (argv[i].equalsIgnoreCase("-rgbx"))
pf = TJ.PF_RGBX;
- if (argv[i].equalsIgnoreCase("-bgr"))
+ else if (argv[i].equalsIgnoreCase("-bgr"))
pf = TJ.PF_BGR;
- if (argv[i].equalsIgnoreCase("-bgrx"))
+ else if (argv[i].equalsIgnoreCase("-bgrx"))
pf = TJ.PF_BGRX;
- if (argv[i].equalsIgnoreCase("-xbgr"))
+ else if (argv[i].equalsIgnoreCase("-xbgr"))
pf = TJ.PF_XBGR;
- if (argv[i].equalsIgnoreCase("-xrgb"))
+ else if (argv[i].equalsIgnoreCase("-xrgb"))
pf = TJ.PF_XRGB;
- if (argv[i].equalsIgnoreCase("-bottomup"))
+ else if (argv[i].equalsIgnoreCase("-bottomup"))
flags |= TJ.FLAG_BOTTOMUP;
- if (argv[i].equalsIgnoreCase("-quiet"))
+ else if (argv[i].equalsIgnoreCase("-quiet"))
quiet = 1;
- if (argv[i].equalsIgnoreCase("-qq"))
+ else if (argv[i].equalsIgnoreCase("-qq"))
quiet = 2;
- if (argv[i].equalsIgnoreCase("-scale") && i < argv.length - 1) {
+ else if (argv[i].equalsIgnoreCase("-scale") && i < argv.length - 1) {
int temp1 = 0, temp2 = 0;
boolean match = false, scanned = true;
Scanner scanner = new Scanner(argv[++i]).useDelimiter("/");
} else
usage();
}
- if (argv[i].equalsIgnoreCase("-hflip"))
+ else if (argv[i].equalsIgnoreCase("-hflip"))
xformOp = TJTransform.OP_HFLIP;
- if (argv[i].equalsIgnoreCase("-vflip"))
+ else if (argv[i].equalsIgnoreCase("-vflip"))
xformOp = TJTransform.OP_VFLIP;
- if (argv[i].equalsIgnoreCase("-transpose"))
+ else if (argv[i].equalsIgnoreCase("-transpose"))
xformOp = TJTransform.OP_TRANSPOSE;
- if (argv[i].equalsIgnoreCase("-transverse"))
+ else if (argv[i].equalsIgnoreCase("-transverse"))
xformOp = TJTransform.OP_TRANSVERSE;
- if (argv[i].equalsIgnoreCase("-rot90"))
+ else if (argv[i].equalsIgnoreCase("-rot90"))
xformOp = TJTransform.OP_ROT90;
- if (argv[i].equalsIgnoreCase("-rot180"))
+ else if (argv[i].equalsIgnoreCase("-rot180"))
xformOp = TJTransform.OP_ROT180;
- if (argv[i].equalsIgnoreCase("-rot270"))
+ else if (argv[i].equalsIgnoreCase("-rot270"))
xformOp = TJTransform.OP_ROT270;
- if (argv[i].equalsIgnoreCase("-grayscale"))
+ else if (argv[i].equalsIgnoreCase("-grayscale"))
xformOpt |= TJTransform.OPT_GRAY;
- if (argv[i].equalsIgnoreCase("-nooutput"))
+ else if (argv[i].equalsIgnoreCase("-nooutput"))
xformOpt |= TJTransform.OPT_NOOUTPUT;
- if (argv[i].equalsIgnoreCase("-copynone"))
++ else if (argv[i].equalsIgnoreCase("-copynone"))
+ xformOpt |= TJTransform.OPT_COPYNONE;
- if (argv[i].equalsIgnoreCase("-benchtime") && i < argv.length - 1) {
+ else if (argv[i].equalsIgnoreCase("-benchtime") && i < argv.length - 1) {
double temp = -1;
try {
temp = Double.parseDouble(argv[++i]);
} else
usage();
}
- if (argv[i].equalsIgnoreCase("-stoponwarning"))
++ else if (argv[i].equalsIgnoreCase("-stoponwarning"))
+ flags |= TJ.FLAG_STOPONWARNING;
- if (argv[i].equalsIgnoreCase("-?"))
- usage();
+ else usage();
}
}
printf("Using most accurate DCT/IDCT algorithm\n\n");
flags|=TJFLAG_ACCURATEDCT;
}
- if(!strcasecmp(argv[i], "-progressive"))
++ else if(!strcasecmp(argv[i], "-progressive"))
+ {
+ printf("Using progressive entropy coding\n\n");
+ flags|=TJFLAG_PROGRESSIVE;
+ }
- if(!strcasecmp(argv[i], "-rgb")) pf=TJPF_RGB;
- if(!strcasecmp(argv[i], "-rgbx")) pf=TJPF_RGBX;
- if(!strcasecmp(argv[i], "-bgr")) pf=TJPF_BGR;
- if(!strcasecmp(argv[i], "-bgrx")) pf=TJPF_BGRX;
- if(!strcasecmp(argv[i], "-xbgr")) pf=TJPF_XBGR;
- if(!strcasecmp(argv[i], "-xrgb")) pf=TJPF_XRGB;
- if(!strcasecmp(argv[i], "-cmyk")) pf=TJPF_CMYK;
- if(!strcasecmp(argv[i], "-bottomup")) flags|=TJFLAG_BOTTOMUP;
- if(!strcasecmp(argv[i], "-quiet")) quiet=1;
- if(!strcasecmp(argv[i], "-qq")) quiet=2;
- if(!strcasecmp(argv[i], "-scale") && i<argc-1)
+ else if(!strcasecmp(argv[i], "-rgb")) pf=TJPF_RGB;
+ else if(!strcasecmp(argv[i], "-rgbx")) pf=TJPF_RGBX;
+ else if(!strcasecmp(argv[i], "-bgr")) pf=TJPF_BGR;
+ else if(!strcasecmp(argv[i], "-bgrx")) pf=TJPF_BGRX;
+ else if(!strcasecmp(argv[i], "-xbgr")) pf=TJPF_XBGR;
+ else if(!strcasecmp(argv[i], "-xrgb")) pf=TJPF_XRGB;
+ else if(!strcasecmp(argv[i], "-cmyk")) pf=TJPF_CMYK;
+ else if(!strcasecmp(argv[i], "-bottomup")) flags|=TJFLAG_BOTTOMUP;
+ else if(!strcasecmp(argv[i], "-quiet")) quiet=1;
+ else if(!strcasecmp(argv[i], "-qq")) quiet=2;
+ else if(!strcasecmp(argv[i], "-scale") && i<argc-1)
{
int temp1=0, temp2=0, match=0;
if(sscanf(argv[++i], "%d/%d", &temp1, &temp2)==2)
}
else usage(argv[0]);
}
- if(!strcasecmp(argv[i], "-hflip")) xformop=TJXOP_HFLIP;
- if(!strcasecmp(argv[i], "-vflip")) xformop=TJXOP_VFLIP;
- if(!strcasecmp(argv[i], "-transpose")) xformop=TJXOP_TRANSPOSE;
- if(!strcasecmp(argv[i], "-transverse")) xformop=TJXOP_TRANSVERSE;
- if(!strcasecmp(argv[i], "-rot90")) xformop=TJXOP_ROT90;
- if(!strcasecmp(argv[i], "-rot180")) xformop=TJXOP_ROT180;
- if(!strcasecmp(argv[i], "-rot270")) xformop=TJXOP_ROT270;
- if(!strcasecmp(argv[i], "-grayscale")) xformopt|=TJXOPT_GRAY;
- if(!strcasecmp(argv[i], "-custom")) customFilter=dummyDCTFilter;
- if(!strcasecmp(argv[i], "-nooutput")) xformopt|=TJXOPT_NOOUTPUT;
- if(!strcasecmp(argv[i], "-copynone")) xformopt|=TJXOPT_COPYNONE;
- if(!strcasecmp(argv[i], "-benchtime") && i<argc-1)
+ else if(!strcasecmp(argv[i], "-hflip")) xformop=TJXOP_HFLIP;
+ else if(!strcasecmp(argv[i], "-vflip")) xformop=TJXOP_VFLIP;
+ else if(!strcasecmp(argv[i], "-transpose")) xformop=TJXOP_TRANSPOSE;
+ else if(!strcasecmp(argv[i], "-transverse")) xformop=TJXOP_TRANSVERSE;
+ else if(!strcasecmp(argv[i], "-rot90")) xformop=TJXOP_ROT90;
+ else if(!strcasecmp(argv[i], "-rot180")) xformop=TJXOP_ROT180;
+ else if(!strcasecmp(argv[i], "-rot270")) xformop=TJXOP_ROT270;
+ else if(!strcasecmp(argv[i], "-grayscale")) xformopt|=TJXOPT_GRAY;
+ else if(!strcasecmp(argv[i], "-custom")) customFilter=dummyDCTFilter;
+ else if(!strcasecmp(argv[i], "-nooutput")) xformopt|=TJXOPT_NOOUTPUT;
++ else if(!strcasecmp(argv[i], "-copynone")) xformopt|=TJXOPT_COPYNONE;
+ else if(!strcasecmp(argv[i], "-benchtime") && i<argc-1)
{
double temp=atof(argv[++i]);
if(temp>0.0) benchtime=temp;
}
}
}
- if(!strcasecmp(argv[i], "-componly")) componly=1;
- if(!strcasecmp(argv[i], "-nowrite")) dowrite=0;
- if(!strcasecmp(argv[i], "-stoponwarning")) flags|=TJFLAG_STOPONWARNING;
+ else if(!strcasecmp(argv[i], "-componly")) componly=1;
+ else if(!strcasecmp(argv[i], "-nowrite")) dowrite=0;
++ else if(!strcasecmp(argv[i], "-stoponwarning")) flags|=TJFLAG_STOPONWARNING;
+ else usage(argv[0]);
}
}
}
IMAGES="vgl_5674_0098.bmp vgl_6434_0018a.bmp vgl_6548_0026a.bmp nightshot_iso_100.bmp"
-IMGDIR=@srcdir@/testimages
+IMGDIR=@CMAKE_CURRENT_SOURCE_DIR@/testimages
- OUTDIR=__tjexampletest_output
+ OUTDIR=`mktemp -d /tmp/__tjexampletest_output.XXXXXX`
-EXEDIR=.
-JAVA="@JAVA@ -cp java/turbojpeg.jar -Djava.library.path=.libs"
+EXEDIR=@CMAKE_CURRENT_BINARY_DIR@
+JAVA="@Java_JAVA_EXECUTABLE@ -cp $EXEDIR/java/turbojpeg.jar -Djava.library.path=$EXEDIR"
if [ -d $OUTDIR ]; then
rm -rf $OUTDIR
# Scaled decompression
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
- scalearg=`echo $scale | sed s@_@/@g`
+ scalearg=`echo $scale | sed 's/\_/\//g'`
for samp in GRAY 420 422 444; do
- $EXEDIR/djpeg -rgb -bmp -scale ${scalearg} $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg >$OUTDIR/${basename}_${samp}_${scale}_djpeg.bmp
+ runme $EXEDIR/djpeg -rgb -bmp -scale ${scalearg} -outfile $OUTDIR/${basename}_${samp}_${scale}_djpeg.bmp $OUTDIR/${basename}_${samp}_fast_cjpeg.jpg
runme $JAVA TJExample $OUTDIR/${basename}_${samp}_fast.jpg $OUTDIR/${basename}_${samp}_${scale}.bmp -scale ${scalearg}
runme cmp -i 54:54 $OUTDIR/${basename}_${samp}_${scale}.bmp $OUTDIR/${basename}_${samp}_${scale}_djpeg.bmp
rm $OUTDIR/${basename}_${samp}_${scale}.bmp
for xform in hflip vflip transpose transverse rot90 rot180 rot270; do
for samp in GRAY 444 422 420; do
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
- scalearg=`echo $scale | sed s@_@/@g`
+ scalearg=`echo $scale | sed 's/\_/\//g'`
- $EXEDIR/djpeg -rgb -bmp -scale ${scalearg} $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg >$OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.bmp
+ runme $EXEDIR/djpeg -rgb -bmp -scale ${scalearg} -outfile $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.bmp $OUTDIR/${basename}_${samp}_${xform}_jpegtran.jpg
runme $JAVA TJExample $OUTDIR/${basename}_${samp}_fast.jpg $OUTDIR/${basename}_${samp}_${xform}_${scale}.bmp -$xform -scale ${scalearg} -crop 16,16,70x60
runme cmp -i 54:54 $OUTDIR/${basename}_${samp}_${xform}_${scale}.bmp $OUTDIR/${basename}_${samp}_${xform}_${scale}_jpegtran.bmp
rm $OUTDIR/${basename}_${samp}_${xform}_${scale}.bmp
* @param jpegQual the image quality of the generated JPEG image (1 = worst,
* 100 = best)
*
- * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT
* "flags"
*
- * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2()
+ * and #tjGetErrorCode().)
*/
DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, const unsigned char *srcBuf,
int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf,
* @param jpegQual the image quality of the generated JPEG image (1 = worst,
* 100 = best)
*
- * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT
* "flags"
*
- * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2()
+ * and #tjGetErrorCode().)
*/
DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle,
const unsigned char *srcBuf, int width, int pad, int height, int subsamp,
* @param jpegQual the image quality of the generated JPEG image (1 = worst,
* 100 = best)
*
- * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT
* "flags"
*
- * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2()
+ * and #tjGetErrorCode().)
*/
DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle,
const unsigned char **srcPlanes, int width, const int *strides, int height,
* Video, <tt>subsamp</tt> should be set to @ref TJSAMP_420. This produces an
* image compatible with the I420 (AKA "YUV420P") format.
*
- * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT
* "flags"
*
- * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2()
+ * and #tjGetErrorCode().)
*/
DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle,
const unsigned char *srcBuf, int width, int pitch, int height,
* Video, <tt>subsamp</tt> should be set to @ref TJSAMP_420. This produces an
* image compatible with the I420 (AKA "YUV420P") format.
*
- * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT
* "flags"
*
- * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2()
+ * and #tjGetErrorCode().)
*/
DLLEXPORT int DLLCALL tjEncodeYUVPlanes(tjhandle handle,
const unsigned char *srcBuf, int width, int pitch, int height,
* @param pixelFormat pixel format of the destination image (see @ref
* TJPF "Pixel formats".)
*
- * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT
* "flags"
*
- * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2()
+ * and #tjGetErrorCode().)
*/
DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle,
const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf,
* block height (see #tjMCUHeight), then an intermediate buffer copy will be
* performed within TurboJPEG.
*
- * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT
* "flags"
*
- * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2()
+ * and #tjGetErrorCode().)
*/
DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle,
const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf,
* block height (see #tjMCUHeight), then an intermediate buffer copy will be
* performed within TurboJPEG.
*
- * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT
* "flags"
*
- * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2()
+ * and #tjGetErrorCode().)
*/
DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle,
const unsigned char *jpegBuf, unsigned long jpegSize,
* @param pixelFormat pixel format of the destination image (see @ref TJPF
* "Pixel formats".)
*
- * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT
* "flags"
*
- * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2()
+ * and #tjGetErrorCode().)
*/
DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, const unsigned char *srcBuf,
int pad, int subsamp, unsigned char *dstBuf, int width, int pitch,
* @param pixelFormat pixel format of the destination image (see @ref TJPF
* "Pixel formats".)
*
- * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT
* "flags"
*
- * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2()
+ * and #tjGetErrorCode().)
*/
DLLEXPORT int DLLCALL tjDecodeYUVPlanes(tjhandle handle,
const unsigned char **srcPlanes, const int *strides, int subsamp,
* which specifies the transform parameters and/or cropping region for the
* corresponding transformed output image.
*
- * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT
* "flags"
*
- * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2()
+ * and #tjGetErrorCode().)
*/
DLLEXPORT int DLLCALL tjTransform(tjhandle handle,
const unsigned char *jpegBuf, unsigned long jpegSize, int n,