62, 7, or 8.
-libjpeg v7 or v8 Emulation
---------------------------
+libjpeg v7 or v8 API/ABI Emulation
+----------------------------------
Add --with-jpeg7 to the configure command line to build a version of
-libjpeg-turbo that is compatible with libjpeg v7. Add --with-jpeg8 to the
-configure command to build a version of libjpeg-turbo that is compatible with
-libjpeg v8. See README-turbo.txt for more information on libjpeg v7 and v8
-emulation.
+libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add --with-jpeg8 to
+the configure command to build a version of libjpeg-turbo that is
+API/ABI-compatible with libjpeg v8. See README-turbo.txt for more information
+on libjpeg v7 and v8 emulation.
Arithmetic Coding Support
NMake.)
-libjpeg v7 or v8 Emulation
---------------------------
+libjpeg v7 or v8 API/ABI Emulation
+-----------------------------------
Add "-DWITH_JPEG7=1" to the cmake command line to build a version of
-libjpeg-turbo that is compatible with libjpeg v7. Add "-DWITH_JPEG8=1" to the
-cmake command to build a version of libjpeg-turbo that is compatible with
-libjpeg v8. See README-turbo.txt for more information on libjpeg v7 and v8
-emulation.
+libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add "-DWITH_JPEG8=1"
+to the cmake command to build a version of libjpeg-turbo that is
+API/ABI-compatible with libjpeg v8. See README-turbo.txt for more information
+on libjpeg v7 and v8 emulation.
Arithmetic Coding Support
message(FATAL_ERROR "Platform not supported by this build system. Use autotools instead.")
endif()
+# This does nothing except when using MinGW. CMAKE_BUILD_TYPE has no meaning
+# in Visual Studio, and it always defaults to Debug when using NMake.
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
# This only works if building from the command line. There is currently no way
-# to set a variable's value based on the build type when using the MSVC IDE.
+# to set a variable's value based on the build type when using Visual Studio.
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(BUILD "${BUILD}d")
endif()
-libjpeg-turbo note: This file is mostly taken from the libjpeg v8b README
-file, and it is included only for reference. Some parts of it may not apply to
-libjpeg-turbo. Please see README-turbo.txt for information specific to the
-turbo version.
+libjpeg-turbo note: This file contains portions of the libjpeg v6b and v8
+README files, with additional wordsmithing by The libjpeg-turbo Project.
+It is included only for reference, as some parts of it may not apply to
+libjpeg-turbo. Please see README-turbo.txt for information specific to
+libjpeg-turbo.
The Independent JPEG Group's JPEG software
This package contains C software to implement JPEG image encoding, decoding,
and transcoding. JPEG (pronounced "jay-peg") is a standardized compression
method for full-color and gray-scale images. JPEG's strong suit is compressing
-photographic images or other types of images which have smooth color and
+photographic images or other types of images that have smooth color and
brightness transitions between neighboring pixels. Images with sharp lines or
other abrupt features may not compress well with JPEG, and a higher JPEG
quality may have to be used to avoid visible compression artifacts with such
The "official" archive site for this software is www.ijg.org.
The most recent released version can always be found there in
directory "files". This particular version will be archived as
-http://www.ijg.org/files/jpegsrc.v8b.tar.gz, and in Windows-compatible
-"zip" archive format as http://www.ijg.org/files/jpegsr8b.zip.
+http://www.ijg.org/files/jpegsrc.v8d.tar.gz, and in Windows-compatible
+"zip" archive format as http://www.ijg.org/files/jpegsr8d.zip.
The JPEG FAQ (Frequently Asked Questions) article is a source of some
general information about JPEG.
================
The ISO JPEG standards committee actually promotes different formats like
-"JPEG 2000" or "JPEG XR" which are incompatible with original DCT-based
+"JPEG 2000" or "JPEG XR", which are incompatible with original DCT-based
JPEG. IJG therefore does not support these formats (see REFERENCES). Indeed,
one of the original reasons for developing this free software was to help
force convergence on common, interoperable format standards for JPEG files.
TO DO
=====
-Please send bug reports, offers of help, etc. to jpeg-info@uc.ag.
+Please send bug reports, offers of help, etc. to jpeg-info@jpegclub.org.
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but
the TigerVNC and VirtualGL projects made numerous enhancements to the codec in
2009, including improved support for Mac OS X, 64-bit support, support for
-32-bit and big endian pixel formats (RGBX, XBGR, etc.), accelerated Huffman
-encoding/decoding, and various bug fixes. The goal was to produce a fully open
-source codec that could replace the partially closed source TurboJPEG/IPP codec
-used by VirtualGL and TurboVNC. libjpeg-turbo generally performs in the range
-of 80-120% of TurboJPEG/IPP. It is faster in some areas but slower in others.
+32-bit and big-endian pixel formats (RGBX, XBGR, etc.), accelerated Huffman
+encoding/decoding, and various bug fixes. The goal was to produce a fully
+open-source codec that could replace the partially closed-source TurboJPEG/IPP
+codec used by VirtualGL and TurboVNC. libjpeg-turbo generally achieves 80-120%
+of the performance of TurboJPEG/IPP. It is faster in some areas but slower in
+others.
In early 2010, libjpeg-turbo spun off into its own independent project, with
the goal of making high-speed JPEG compression/decompression technology
-available to a broader range of users and developers. The libjpeg-turbo shared
-libraries can be used as drop-in replacements for libjpeg on most systems.
+available to a broader range of users and developers.
*******************************************************************************
architecture.
System administrators can also replace the libjpeg sym links in /usr/{lib} with
-links to the libjpeg dynamic library located in /opt/libjpeg-turbo/{lib}. This
-will effectively accelerate every dynamically linked libjpeg application on the
-system.
+links to the libjpeg-turbo dynamic library located in /opt/libjpeg-turbo/{lib}.
+This will effectively accelerate every application that uses the libjpeg
+dynamic library on the system.
The libjpeg-turbo SDK for Visual C++ installs the libjpeg-turbo DLL
-(jpeg62.dll, jpeg7.dll, or jpeg8.dll, depending on whether libjpeg v6b, v7, or
-v8 emulation is enabled) into c:\libjpeg-turbo[64]\bin, and the PATH
+(jpeg62.dll, jpeg7.dll, or jpeg8.dll, depending on whether it was built with
+libjpeg v6b, v7, or v8 emulation) into c:\libjpeg-turbo[64]\bin, and the PATH
environment variable can be modified such that this directory is searched
before any others that might contain a libjpeg DLL. However, if a libjpeg
DLL exists in an application's install directory, then Windows will load this
application's install directory to accelerate it.
The version of the libjpeg-turbo DLL distributed in the libjpeg-turbo SDK for
-Visual C++ requires the Visual C++ 2008 C run time DLL (msvcr90.dll).
+Visual C++ requires the Visual C++ 2008 C run-time DLL (msvcr90.dll).
msvcr90.dll ships with more recent versions of Windows, but users of older
Windows releases can obtain it from the Visual C++ 2008 Redistributable
Package, which is available as a free download from Microsoft's web site.
-NOTE: Features of libjpeg that require passing a C run time structure, such
+NOTE: Features of libjpeg that require passing a C run-time structure, such
as a file handle, from an application to libjpeg will probably not work with
the version of the libjpeg-turbo DLL distributed in the libjpeg-turbo SDK for
Visual C++, unless the application is also built to use the Visual C++ 2008 C
-run time DLL. In particular, this affects jpeg_stdio_dest() and
+run-time DLL. In particular, this affects jpeg_stdio_dest() and
jpeg_stdio_src().
Mac applications typically embed their own copies of the libjpeg dylib inside
libjpeg-turbo is a drop-in replacement for the TurboJPEG/IPP SDK used by
VirtualGL 2.1.x and TurboVNC 0.6 (and prior.) libjpeg-turbo contains a wrapper
library (TurboJPEG/OSS) that emulates the TurboJPEG API using libjpeg-turbo
-instead of the closed source Intel Performance Primitives. You can replace the
+instead of the closed-source Intel Performance Primitives. You can replace the
TurboJPEG/IPP package on Linux systems with the libjpeg-turbo package in order
to make existing releases of VirtualGL 2.1.x and TurboVNC 0.x use the new codec
at run time. Note that the 64-bit libjpeg-turbo packages contain only 64-bit
You can also build the VirtualGL 2.1.x and TurboVNC 0.6 source code with
the libjpeg-turbo SDK instead of TurboJPEG/IPP. It should work identically.
libjpeg-turbo also includes static library versions of TurboJPEG/OSS, which
-are used to build TurboVNC 1.0 and later.
+are used to build VirtualGL 2.2 and TurboVNC 1.0 and later.
========================================
Using libjpeg-turbo in Your Own Programs
libjpeg v7 and v8 API/ABI support
=================================
-libjpeg v7 and v8 added new features to the API/ABI, and, unfortunately, the
-compression and decompression structures were extended in a backward-
-incompatible manner to accommodate these features. Thus, programs that are
+With libjpeg v7 and v8, new features were added that necessitated extending the
+compression and decompression structures. Unfortunately, due to the exposed
+nature of those structures, extending them also necessitated breaking backward
+ABI compatibility with previous libjpeg releases. Thus, programs that are
built to use libjpeg v7 or v8 did not work with libjpeg-turbo, since it is
based on the libjpeg v6b code base. Although libjpeg v7 and v8 are still not
as widely used as v6b, enough programs (including a few Linux distros) have
made the switch that it was desirable to provide support for the libjpeg v7/v8
-API/ABI in libjpeg-turbo.
-
-Some of the libjpeg v7 and v8 features -- DCT scaling, to name one -- involve
-deep modifications to the code that cannot be accommodated by libjpeg-turbo
-without either breaking compatibility with libjpeg v6b or producing an
-unsupportable mess. In order to fully support libjpeg v8 with all of its
-features, we would have to essentially port the SIMD extensions to the libjpeg
-v8 code base and maintain two separate code trees. We are hesitant to do this
-until/unless the newer libjpeg code bases garner more community support and
-involvement and until/unless we have some notion of whether future libjpeg
-releases will also be backward-incompatible.
+API/ABI in libjpeg-turbo. Although libjpeg-turbo can now be configured as a
+drop-in replacement for libjpeg v7 or v8, it should be noted that not all of
+the features in libjpeg v7 and v8 are supported (see below.)
By passing an argument of --with-jpeg7 or --with-jpeg8 to configure, or an
argument of -DWITH_JPEG7=1 or -DWITH_JPEG8=1 to cmake, you can build a version
-- libjpeg: DCT scaling in compressor
cinfo.scale_num and cinfo.scale_denom are silently ignored.
+ There is no technical reason why DCT scaling cannot be supported, but
+ without the SmartScale extension (see below), it would only be able to
+ down-scale using ratios of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and 8/9,
+ which is of limited usefulness.
+
+-- libjpeg: SmartScale
+ cinfo.block_size is silently ignored.
+ SmartScale is an extension to the JPEG format that allows for DCT block
+ sizes other than 8x8. It would be difficult to support this feature while
+ retaining backward compatibility with libjpeg v6b.
-- libjpeg: IDCT scaling extensions in decompressor
libjpeg-turbo still supports IDCT scaling with scaling factors of 1/2, 1/4,
-- libjpeg: Fancy downsampling in compressor
cinfo.do_fancy_downsampling is silently ignored.
+ This requires the DCT scaling feature, which is not supported.
-- jpegtran: Scaling
- Seems to depend on the DCT scaling feature, which isn't supported.
+ This requires both the DCT scaling and SmartScale features, which are not
+ supported.
+
+-- Lossless RGB JPEG files
+ This requires the SmartScale feature, which is not supported.
*******************************************************************************
===============
The optimized Huffman decoder in libjpeg-turbo does not handle restart markers
-in a way that makes libjpeg happy, so it is necessary to use the slow Huffman
-decoder when decompressing a JPEG image that has restart markers. This can
-cause the decompression performance to drop by as much as 20%, but the
-performance will still be much much greater than that of libjpeg v6b. Many
-consumer packages, such as PhotoShop, use restart markers when generating JPEG
-images, so images generated by those programs will experience this issue.
+in a way that makes the rest of the libjpeg infrastructure happy, so it is
+necessary to use the slow Huffman decoder when decompressing a JPEG image that
+has restart markers. This can cause the decompression performance to drop by
+as much as 20%, but the performance will still be much greater than that of
+libjpeg. Many consumer packages, such as PhotoShop, use restart markers when
+generating JPEG images, so images generated by those programs will experience
+this issue.
===============================================
Fast Integer Forward DCT at High Quality Levels
-.TH CJPEG 1 "11 October 2010"
+.TH CJPEG 1 "31 January 2012"
.SH NAME
cjpeg \- compress an image file to a JPEG file
.SH SYNOPSIS
subsampling may be unacceptable.
.PP
The \fB-quality\fR option accepts a comma-separated list of parameters, which
-respectively refer to the quality levels which should be assigned to the
+respectively refer to the quality levels that should be assigned to the
quantization table slots. If there are more q-table slots than parameters,
then the last parameter is replicated. Thus, if only one quality parameter is
given, this is used for both luminance and chrominance (slots 0 and 1,
.PP
Switches for advanced users:
.TP
+.B \-arithmetic
+Use arithmetic coding.
+.B Caution:
+arithmetic coded JPEG is not yet widely implemented, so many decoders will be
+unable to view an arithmetic coded JPEG file at all.
+.TP
.B \-dct int
Use integer DCT method (default).
.TP
.PP
Switches for wizards:
.TP
-.B \-arithmetic
-Use arithmetic coding.
-.B Caution:
-arithmetic coded JPEG is not yet widely implemented, so many decoders will be
-unable to view an arithmetic coded JPEG file at all.
-.TP
.B \-baseline
Force baseline-compatible quantization tables to be generated. This clamps
quantization values to 8 bits even at low quality settings. (This switch is
fprintf(stderr, " -targa Input file is Targa format (usually not needed)\n");
#endif
fprintf(stderr, "Switches for advanced users:\n");
+#ifdef C_ARITH_CODING_SUPPORTED
+ fprintf(stderr, " -arithmetic Use arithmetic coding\n");
+#endif
#ifdef DCT_ISLOW_SUPPORTED
fprintf(stderr, " -dct int Use integer DCT method%s\n",
(JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : ""));
fprintf(stderr, " -outfile name Specify name for output file\n");
fprintf(stderr, " -verbose or -debug Emit debug output\n");
fprintf(stderr, "Switches for wizards:\n");
-#ifdef C_ARITH_CODING_SUPPORTED
- fprintf(stderr, " -arithmetic Use arithmetic coding\n");
-#endif
fprintf(stderr, " -baseline Force baseline quantization tables\n");
fprintf(stderr, " -qtables file Use quantization tables given in file\n");
fprintf(stderr, " -qslots N[,...] Set component quantization tables\n");
and experimenting with any optional optimizations such as loop unrolling.
(Unfortunately, far too many compilers have optimizer bugs ... be prepared to
back off if the code fails self-test.) If you do any experimentation along
-these lines, please report the optimal settings to jpeg-info@uc.ag so we
-can mention them in future releases. Be sure to specify your machine
-and compiler version.
+these lines, please report the optimal settings to jpeg-info@jpegclub.org so
+we can mention them in future releases. Be sure to specify your machine and
+compiler version.
HINTS FOR SPECIFIC SYSTEMS
==========================
We welcome reports on changes needed for systems not mentioned here. Submit
-'em to jpeg-info@uc.ag. Also, if configure or ckconfig.c is wrong about how
-to configure the JPEG software for your system, please let us know.
+'em to jpeg-info@jpegclub.org. Also, if configure or ckconfig.c is wrong
+about how to configure the JPEG software for your system, please let us know.
Acorn RISC OS:
-.TH JPEGTRAN 1 "11 October 2010"
+.TH JPEGTRAN 1 "31 January 2012"
.SH NAME
jpegtran \- lossless transformation of JPEG files
.SH SYNOPSIS
.TP
.B \-copy comments
Copy only comment markers. This setting copies comments from the source file
-but discards any other data which is inessential for image display.
+but discards any other data that is inessential for image display.
.TP
.B \-copy all
Copy all extra markers. This setting preserves miscellaneous markers
fprintf(stderr, " -trim Drop non-transformable edge blocks\n");
#endif
fprintf(stderr, "Switches for advanced users:\n");
+#ifdef C_ARITH_CODING_SUPPORTED
+ fprintf(stderr, " -arithmetic Use arithmetic coding\n");
+#endif
fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n");
fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n");
fprintf(stderr, " -outfile name Specify name for output file\n");
fprintf(stderr, " -verbose or -debug Emit debug output\n");
fprintf(stderr, "Switches for wizards:\n");
-#ifdef C_ARITH_CODING_SUPPORTED
- fprintf(stderr, " -arithmetic Use arithmetic coding\n");
-#endif
#ifdef C_MULTISCAN_FILES_SUPPORTED
fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n");
#endif
premise of this routine collapses. Caveat user.
jpeg_default_qtables (j_compress_ptr cinfo, boolean force_baseline)
- [libjpeg v7/v8 only] Set default quantization tables with linear
- q_scale_factor[] values (see below).
+ [libjpeg v7+ API/ABI emulation only]
+ Set default quantization tables with linear q_scale_factor[] values
+ (see below).
jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
const unsigned int *basic_table,
slot 1 for chrominance.
int q_scale_factor[NUM_QUANT_TBLS]
- [libjpeg v7+ only] Linear quantization scaling factors (0-100, default
- 100) for use with jpeg_default_qtables().
+ [libjpeg v7+ API/ABI emulation only]
+ Linear quantization scaling factors (0-100, default 100)
+ for use with jpeg_default_qtables().
See rdswitch.c and cjpeg.c for an example of usage.
Note that the q_scale_factor[] values use "linear" scales, so JPEG
quality levels chosen by the user must be converted to these scales
- using jpeg_quality_scaling(). Here is an example which corresponds to
+ using jpeg_quality_scaling(). Here is an example that corresponds to
cjpeg -quality 90,70:
jpeg_set_defaults(cinfo);
any need to mess with providing your own Huffman tables.
-[libjpeg v7+ only] The actual dimensions of the JPEG image that will be written
-to the file are given by the following fields. These are computed from the
-input image dimensions and the compression parameters by jpeg_start_compress().
-You can also call jpeg_calc_jpeg_dimensions() to obtain the values that will
-result from the current parameter settings.
+[libjpeg v7+ API/ABI emulation only]
+The actual dimensions of the JPEG image that will be written to the file are
+given by the following fields. These are computed from the input image
+dimensions and the compression parameters by jpeg_start_compress(). You can
+also call jpeg_calc_jpeg_dimensions() to obtain the values that will result
+from the current parameter settings.
JDIMENSION jpeg_width Actual dimensions of output image.
JDIMENSION jpeg_height
IJG JPEG LIBRARY: SYSTEM ARCHITECTURE
-Copyright (C) 1991-2009, Thomas G. Lane, Guido Vollbeding.
+Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file.
* Data destination manager: writes the output JPEG datastream to its final
destination (e.g., a file). The destination manager supplied with the
- library knows how to write to a stdio stream; for other behaviors, the
- surrounding application may provide its own destination manager.
+ library knows how to write to a stdio stream or to a memory buffer;
+ for other behaviors, the surrounding application may provide its own
+ destination manager.
* Memory manager: allocates and releases memory, controls virtual arrays
(with backing store management, where required).
* Marker reading: decodes JPEG markers (except for RSTn).
* Data source manager: supplies the input JPEG datastream. The source
- manager supplied with the library knows how to read from a stdio stream;
- for other behaviors, the surrounding application may provide its own source
- manager.
+ manager supplied with the library knows how to read from a stdio stream
+ or from a memory buffer; for other behaviors, the surrounding application
+ may provide its own source manager.
* Memory manager: same as for compression library.
With these conventions, JSAMPLE values can be assumed to be >= 0. This helps
simplify correct rounding during downsampling, etc. The JPEG standard's
specification that sample values run from -128..127 is accommodated by
-subtracting 128 just as the sample value is copied into the source array for
-the DCT step (this will be an array of signed ints). Similarly, during
+subtracting 128 from the sample value in the DCT step. Similarly, during
decompression the output of the IDCT step will be immediately shifted back to
0..255. (NB: different values are required when 12-bit samples are in use.
The code is written in terms of MAXJSAMPLE and CENTERJSAMPLE, which will be
subsampling may be unacceptable.
The -quality option accepts a comma-separated list of parameters, which
-respectively refer to the quality levels which should be assigned to the
+respectively refer to the quality levels that should be assigned to the
quantization table slots. If there are more q-table slots than parameters,
then the last parameter is replicated. Thus, if only one quality parameter is
given, this is used for both luminance and chrominance (slots 0 and 1,
Switches for advanced users:
+ -arithmetic Use arithmetic coding. CAUTION: arithmetic coded JPEG
+ is not yet widely implemented, so many decoders will
+ be unable to view an arithmetic coded JPEG file at
+ all.
+
-dct int Use integer DCT method (default).
-dct fast Use fast integer DCT (less accurate).
-dct float Use floating-point DCT method.
Switches for wizards:
- -arithmetic Use arithmetic coding. CAUTION: arithmetic coded JPEG
- is not yet widely implemented, so many decoders will
- be unable to view an arithmetic coded JPEG file at
- all.
-
-baseline Force baseline-compatible quantization tables to be
generated. This clamps quantization values to 8 bits
even at low quality settings. (This switch is poorly
jpegtran accepts a subset of the switches recognized by cjpeg:
-optimize Perform optimization of entropy encoding parameters.
-progressive Create progressive JPEG file.
+ -arithmetic Use arithmetic coding.
-restart N Emit a JPEG restart marker every N MCU rows, or every
N MCU blocks if "B" is attached to the number.
- -arithmetic Use arithmetic coding.
-scans file Use the scan script given in the specified text file.
See the previous discussion of cjpeg for more details about these switches.
If you specify none of these switches, you get a plain baseline-JPEG output
present in the source file.
-copy comments Copy only comment markers. This setting copies
comments from the source file but discards
- any other data which is inessential for image display.
+ any other data that is inessential for image display.
-copy all Copy all extra markers. This setting preserves
miscellaneous markers found in the source file, such
as JFIF thumbnails, Exif data, and Photoshop settings.