12.0.2 2===== 3 4### Significant changes relative to 2.0.1: 5 61. Fixed a regression introduced by 2.0.1[5] that prevented a runtime search 7path (rpath) from being embedded in the libjpeg-turbo shared libraries and 8executables for macOS and iOS. This caused a fatal error of the form 9"dyld: Library not loaded" when attempting to use one of the executables, 10unless `DYLD_LIBRARY_PATH` was explicitly set to the location of the 11libjpeg-turbo shared libraries. 12 132. Fixed an integer overflow and subsequent segfault (CVE-2018-20330) that 14occurred when attempting to load a BMP file with more than 1 billion pixels 15using the `tjLoadImage()` function. 16 173. Fixed a buffer overrun (CVE-2018-19664) that occurred when attempting to 18decompress a specially-crafted malformed JPEG image to a 256-color BMP using 19djpeg. 20 214. Fixed a floating point exception that occurred when attempting to 22decompress a specially-crafted malformed JPEG image with a specified image 23width or height of 0 using the C version of TJBench. 24 255. The TurboJPEG API will now decompress 4:4:4 JPEG images with 2x1, 1x2, 3x1, 26or 1x3 luminance and chrominance sampling factors. This is a non-standard way 27of specifying 1x subsampling (normally 4:4:4 JPEGs have 1x1 luminance and 28chrominance sampling factors), but the JPEG format and the libjpeg API both 29allow it. 30 316. Fixed a regression introduced by 2.0 beta1[7] that caused djpeg to generate 32incorrect PPM images when used with the `-colors` option. 33 347. Fixed an issue whereby a static build of libjpeg-turbo (a build in which 35`ENABLE_SHARED` is `0`) could not be installed using the Visual Studio IDE. 36 378. Fixed a severe performance issue in the Loongson MMI SIMD extensions that 38occurred when compressing RGB images whose image rows were not 64-bit-aligned. 39 40 412.0.1 42===== 43 44### Significant changes relative to 2.0.0: 45 461. Fixed a regression introduced with the new CMake-based Un*x build system, 47whereby jconfig.h could cause compiler warnings of the form 48`"HAVE_*_H" redefined` if it was included by downstream Autotools-based 49projects that used `AC_CHECK_HEADERS()` to check for the existence of locale.h, 50stddef.h, or stdlib.h. 51 522. The `jsimd_quantize_float_dspr2()` and `jsimd_convsamp_float_dspr2()` 53functions in the MIPS DSPr2 SIMD extensions are now disabled at compile time 54if the soft float ABI is enabled. Those functions use instructions that are 55incompatible with the soft float ABI. 56 573. Fixed a regression in the SIMD feature detection code, introduced by 58the AVX2 SIMD extensions (2.0 beta1[1]), that caused libjpeg-turbo to crash on 59Windows 7 if Service Pack 1 was not installed. 60 614. Fixed out-of-bounds read in cjpeg that occurred when attempting to compress 62a specially-crafted malformed color-index (8-bit-per-sample) Targa file in 63which some of the samples (color indices) exceeded the bounds of the Targa 64file's color table. 65 665. Fixed an issue whereby installing a fully static build of libjpeg-turbo 67(a build in which `CFLAGS` contains `-static` and `ENABLE_SHARED` is `0`) would 68fail with "No valid ELF RPATH or RUNPATH entry exists in the file." 69 70 712.0.0 72===== 73 74### Significant changes relative to 2.0 beta1: 75 761. The TurboJPEG API can now decompress CMYK JPEG images that have subsampled M 77and Y components (not to be confused with YCCK JPEG images, in which the C/M/Y 78components have been transformed into luma and chroma.) Previously, an error 79was generated ("Could not determine subsampling type for JPEG image") when such 80an image was passed to `tjDecompressHeader3()`, `tjTransform()`, 81`tjDecompressToYUVPlanes()`, `tjDecompressToYUV2()`, or the equivalent Java 82methods. 83 842. Fixed an issue (CVE-2018-11813) whereby a specially-crafted malformed input 85file (specifically, a file with a valid Targa header but incomplete pixel data) 86would cause cjpeg to generate a JPEG file that was potentially thousands of 87times larger than the input file. The Targa reader in cjpeg was not properly 88detecting that the end of the input file had been reached prematurely, so after 89all valid pixels had been read from the input, the reader injected dummy pixels 90with values of 255 into the JPEG compressor until the number of pixels 91specified in the Targa header had been compressed. The Targa reader in cjpeg 92now behaves like the PPM reader and aborts compression if the end of the input 93file is reached prematurely. Because this issue only affected cjpeg and not 94the underlying library, and because it did not involve any out-of-bounds reads 95or other exploitable behaviors, it was not believed to represent a security 96threat. 97 983. Fixed an issue whereby the `tjLoadImage()` and `tjSaveImage()` functions 99would produce a "Bogus message code" error message if the underlying bitmap and 100PPM readers/writers threw an error that was specific to the readers/writers 101(as opposed to a general libjpeg API error.) 102 1034. Fixed an issue whereby a specially-crafted malformed BMP file, one in which 104the header specified an image width of 1073741824 pixels, would trigger a 105floating point exception (division by zero) in the `tjLoadImage()` function 106when attempting to load the BMP file into a 4-component image buffer. 107 1085. Fixed an issue whereby certain combinations of calls to 109`jpeg_skip_scanlines()` and `jpeg_read_scanlines()` could trigger an infinite 110loop when decompressing progressive JPEG images that use vertical chroma 111subsampling (for instance, 4:2:0 or 4:4:0.) 112 1136. Fixed a segfault in `jpeg_skip_scanlines()` that occurred when decompressing 114a 4:2:2 or 4:2:0 JPEG image using the merged (non-fancy) upsampling algorithms 115(that is, when setting `cinfo.do_fancy_upsampling` to `FALSE`.) 116 1177. The new CMake-based build system will now disable the MIPS DSPr2 SIMD 118extensions if it detects that the compiler does not support DSPr2 instructions. 119 1208. Fixed out-of-bounds read in cjpeg that occurred when attempting to compress 121a specially-crafted malformed color-index (8-bit-per-sample) BMP file in which 122some of the samples (color indices) exceeded the bounds of the BMP file's color 123table. 124 1259. Fixed a signed integer overflow in the progressive Huffman decoder, detected 126by the Clang and GCC undefined behavior sanitizers, that could be triggered by 127attempting to decompress a specially-crafted malformed JPEG image. This issue 128did not pose a security threat, but removing the warning made it easier to 129detect actual security issues, should they arise in the future. 130 131 1321.5.90 (2.0 beta1) 133================== 134 135### Significant changes relative to 1.5.3: 136 1371. Added AVX2 SIMD implementations of the colorspace conversion, chroma 138downsampling and upsampling, integer quantization and sample conversion, and 139slow integer DCT/IDCT algorithms. When using the slow integer DCT/IDCT 140algorithms on AVX2-equipped CPUs, the compression of RGB images is 141approximately 13-36% (avg. 22%) faster (relative to libjpeg-turbo 1.5.x) with 14264-bit code and 11-21% (avg. 17%) faster with 32-bit code, and the 143decompression of RGB images is approximately 9-35% (avg. 17%) faster with 14464-bit code and 7-17% (avg. 12%) faster with 32-bit code. (As tested on a 1453 GHz Intel Core i7. Actual mileage may vary.) 146 1472. Overhauled the build system to use CMake on all platforms, and removed the 148autotools-based build system. This decision resulted from extensive 149discussions within the libjpeg-turbo community. libjpeg-turbo traditionally 150used CMake only for Windows builds, but there was an increasing amount of 151demand to extend CMake support to other platforms. However, because of the 152unique nature of our code base (the need to support different assemblers on 153each platform, the need for Java support, etc.), providing dual build systems 154as other OSS imaging libraries do (including libpng and libtiff) would have 155created a maintenance burden. The use of CMake greatly simplifies some aspects 156of our build system, owing to CMake's built-in support for various assemblers, 157Java, and unit testing, as well as generally fewer quirks that have to be 158worked around in order to implement our packaging system. Eliminating 159autotools puts our project slightly at odds with the traditional practices of 160the OSS community, since most "system libraries" tend to be built with 161autotools, but it is believed that the benefits of this move outweigh the 162risks. In addition to providing a unified build environment, switching to 163CMake allows for the use of various build tools and IDEs that aren't supported 164under autotools, including XCode, Ninja, and Eclipse. It also eliminates the 165need to install autotools via MacPorts/Homebrew on OS X and allows 166libjpeg-turbo to be configured without the use of a terminal/command prompt. 167Extensive testing was conducted to ensure that all features provided by the 168autotools-based build system are provided by the new build system. 169 1703. The libjpeg API in this version of libjpeg-turbo now includes two additional 171functions, `jpeg_read_icc_profile()` and `jpeg_write_icc_profile()`, that can 172be used to extract ICC profile data from a JPEG file while decompressing or to 173embed ICC profile data in a JPEG file while compressing or transforming. This 174eliminates the need for downstream projects, such as color management libraries 175and browsers, to include their own glueware for accomplishing this. 176 1774. Improved error handling in the TurboJPEG API library: 178 179 - Introduced a new function (`tjGetErrorStr2()`) in the TurboJPEG C API 180that allows compression/decompression/transform error messages to be retrieved 181in a thread-safe manner. Retrieving error messages from global functions, such 182as `tjInitCompress()` or `tjBufSize()`, is still thread-unsafe, but since those 183functions will only throw errors if passed an invalid argument or if a memory 184allocation failure occurs, thread safety is not as much of a concern. 185 - Introduced a new function (`tjGetErrorCode()`) in the TurboJPEG C API 186and a new method (`TJException.getErrorCode()`) in the TurboJPEG Java API that 187can be used to determine the severity of the last 188compression/decompression/transform error. This allows applications to 189choose whether to ignore warnings (non-fatal errors) from the underlying 190libjpeg API or to treat them as fatal. 191 - Introduced a new flag (`TJFLAG_STOPONWARNING` in the TurboJPEG C API and 192`TJ.FLAG_STOPONWARNING` in the TurboJPEG Java API) that causes the library to 193immediately halt a compression/decompression/transform operation if it 194encounters a warning from the underlying libjpeg API (the default behavior is 195to allow the operation to complete unless a fatal error is encountered.) 196 1975. Introduced a new flag in the TurboJPEG C and Java APIs (`TJFLAG_PROGRESSIVE` 198and `TJ.FLAG_PROGRESSIVE`, respectively) that causes the library to use 199progressive entropy coding in JPEG images generated by compression and 200transform operations. Additionally, a new transform option 201(`TJXOPT_PROGRESSIVE` in the C API and `TJTransform.OPT_PROGRESSIVE` in the 202Java API) has been introduced, allowing progressive entropy coding to be 203enabled for selected transforms in a multi-transform operation. 204 2056. Introduced a new transform option in the TurboJPEG API (`TJXOPT_COPYNONE` in 206the C API and `TJTransform.OPT_COPYNONE` in the Java API) that allows the 207copying of markers (including EXIF and ICC profile data) to be disabled for a 208particular transform. 209 2107. Added two functions to the TurboJPEG C API (`tjLoadImage()` and 211`tjSaveImage()`) that can be used to load/save a BMP or PPM/PGM image to/from a 212memory buffer with a specified pixel format and layout. These functions 213replace the project-private (and slow) bmp API, which was previously used by 214TJBench, and they also provide a convenient way for first-time users of 215libjpeg-turbo to quickly develop a complete JPEG compression/decompression 216program. 217 2188. The TurboJPEG C API now includes a new convenience array (`tjAlphaOffset[]`) 219that contains the alpha component index for each pixel format (or -1 if the 220pixel format lacks an alpha component.) The TurboJPEG Java API now includes a 221new method (`TJ.getAlphaOffset()`) that returns the same value. In addition, 222the `tjRedOffset[]`, `tjGreenOffset[]`, and `tjBlueOffset[]` arrays-- and the 223corresponding `TJ.getRedOffset()`, `TJ.getGreenOffset()`, and 224`TJ.getBlueOffset()` methods-- now return -1 for `TJPF_GRAY`/`TJ.PF_GRAY` 225rather than 0. This allows programs to easily determine whether a pixel format 226has red, green, blue, and alpha components. 227 2289. Added a new example (tjexample.c) that demonstrates the basic usage of the 229TurboJPEG C API. This example mirrors the functionality of TJExample.java. 230Both files are now included in the libjpeg-turbo documentation. 231 23210. Fixed two signed integer overflows in the arithmetic decoder, detected by 233the Clang undefined behavior sanitizer, that could be triggered by attempting 234to decompress a specially-crafted malformed JPEG image. These issues did not 235pose a security threat, but removing the warnings makes it easier to detect 236actual security issues, should they arise in the future. 237 23811. Fixed a bug in the merged 4:2:0 upsampling/dithered RGB565 color conversion 239algorithm that caused incorrect dithering in the output image. This algorithm 240now produces bitwise-identical results to the unmerged algorithms. 241 24212. The SIMD function symbols for x86[-64]/ELF, MIPS/ELF, macOS/x86[-64] (if 243libjpeg-turbo is built with YASM), and iOS/ARM[64] builds are now private. 244This prevents those symbols from being exposed in applications or shared 245libraries that link statically with libjpeg-turbo. 246 24713. Added Loongson MMI SIMD implementations of the RGB-to-YCbCr and 248YCbCr-to-RGB colorspace conversion, 4:2:0 chroma downsampling, 4:2:0 fancy 249chroma upsampling, integer quantization, and slow integer DCT/IDCT algorithms. 250When using the slow integer DCT/IDCT, this speeds up the compression of RGB 251images by approximately 70-100% and the decompression of RGB images by 252approximately 2-3.5x. 253 25414. Fixed a build error when building with older MinGW releases (regression 255caused by 1.5.1[7].) 256 25715. Added SIMD acceleration for progressive Huffman encoding on SSE2-capable 258x86 and x86-64 platforms. This speeds up the compression of full-color 259progressive JPEGs by about 85-90% on average (relative to libjpeg-turbo 1.5.x) 260when using modern Intel and AMD CPUs. 261 262 2631.5.3 264===== 265 266### Significant changes relative to 1.5.2: 267 2681. Fixed a NullPointerException in the TurboJPEG Java wrapper that occurred 269when using the YUVImage constructor that creates an instance backed by separate 270image planes and allocates memory for the image planes. 271 2722. Fixed an issue whereby the Java version of TJUnitTest would fail when 273testing BufferedImage encoding/decoding on big endian systems. 274 2753. Fixed a segfault in djpeg that would occur if an output format other than 276PPM/PGM was selected along with the `-crop` option. The `-crop` option now 277works with the GIF and Targa formats as well (unfortunately, it cannot be made 278to work with the BMP and RLE formats due to the fact that those output engines 279write scanlines in bottom-up order.) djpeg will now exit gracefully if an 280output format other than PPM/PGM, GIF, or Targa is selected along with the 281`-crop` option. 282 2834. Fixed an issue whereby `jpeg_skip_scanlines()` would segfault if color 284quantization was enabled. 285 2865. TJBench (both C and Java versions) will now display usage information if any 287command-line argument is unrecognized. This prevents the program from silently 288ignoring typos. 289 2906. Fixed an access violation in tjbench.exe (Windows) that occurred when the 291program was used to decompress an existing JPEG image. 292 2937. Fixed an ArrayIndexOutOfBoundsException in the TJExample Java program that 294occurred when attempting to decompress a JPEG image that had been compressed 295with 4:1:1 chrominance subsampling. 296 2978. Fixed an issue whereby, when using `jpeg_skip_scanlines()` to skip to the 298end of a single-scan (non-progressive) image, subsequent calls to 299`jpeg_consume_input()` would return `JPEG_SUSPENDED` rather than 300`JPEG_REACHED_EOI`. 301 3029. `jpeg_crop_scanlines()` now works correctly when decompressing grayscale 303JPEG images that were compressed with a sampling factor other than 1 (for 304instance, with `cjpeg -grayscale -sample 2x2`). 305 306 3071.5.2 308===== 309 310### Significant changes relative to 1.5.1: 311 3121. Fixed a regression introduced by 1.5.1[7] that prevented libjpeg-turbo from 313building with Android NDK platforms prior to android-21 (5.0). 314 3152. Fixed a regression introduced by 1.5.1[1] that prevented the MIPS DSPR2 SIMD 316code in libjpeg-turbo from building. 317 3183. Fixed a regression introduced by 1.5 beta1[11] that prevented the Java 319version of TJBench from outputting any reference images (the `-nowrite` switch 320was accidentally enabled by default.) 321 3224. libjpeg-turbo should now build and run with full AltiVec SIMD acceleration 323on PowerPC-based AmigaOS 4 and OpenBSD systems. 324 3255. Fixed build and runtime errors on Windows that occurred when building 326libjpeg-turbo with libjpeg v7 API/ABI emulation and the in-memory 327source/destination managers. Due to an oversight, the `jpeg_skip_scanlines()` 328and `jpeg_crop_scanlines()` functions were not being included in jpeg7.dll when 329libjpeg-turbo was built with `-DWITH_JPEG7=1` and `-DWITH_MEMSRCDST=1`. 330 3316. Fixed "Bogus virtual array access" error that occurred when using the 332lossless crop feature in jpegtran or the TurboJPEG API, if libjpeg-turbo was 333built with libjpeg v7 API/ABI emulation. This was apparently a long-standing 334bug that has existed since the introduction of libjpeg v7/v8 API/ABI emulation 335in libjpeg-turbo v1.1. 336 3377. The lossless transform features in jpegtran and the TurboJPEG API will now 338always attempt to adjust the EXIF image width and height tags if the image size 339changed as a result of the transform. This behavior has always existed when 340using libjpeg v8 API/ABI emulation. It was supposed to be available with 341libjpeg v7 API/ABI emulation as well but did not work properly due to a bug. 342Furthermore, there was never any good reason not to enable it with libjpeg v6b 343API/ABI emulation, since the behavior is entirely internal. Note that 344`-copy all` must be passed to jpegtran in order to transfer the EXIF tags from 345the source image to the destination image. 346 3478. Fixed several memory leaks in the TurboJPEG API library that could occur 348if the library was built with certain compilers and optimization levels 349(known to occur with GCC 4.x and clang with `-O1` and higher but not with 350GCC 5.x or 6.x) and one of the underlying libjpeg API functions threw an error 351after a TurboJPEG API function allocated a local buffer. 352 3539. The libjpeg-turbo memory manager will now honor the `max_memory_to_use` 354structure member in jpeg\_memory\_mgr, which can be set to the maximum amount 355of memory (in bytes) that libjpeg-turbo should use during decompression or 356multi-pass (including progressive) compression. This limit can also be set 357using the `JPEGMEM` environment variable or using the `-maxmemory` switch in 358cjpeg/djpeg/jpegtran (refer to the respective man pages for more details.) 359This has been a documented feature of libjpeg since v5, but the 360`malloc()`/`free()` implementation of the memory manager (jmemnobs.c) never 361implemented the feature. Restricting libjpeg-turbo's memory usage is useful 362for two reasons: it allows testers to more easily work around the 2 GB limit 363in libFuzzer, and it allows developers of security-sensitive applications to 364more easily defend against one of the progressive JPEG exploits (LJT-01-004) 365identified in 366[this report](http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf). 367 36810. TJBench will now run each benchmark for 1 second prior to starting the 369timer, in order to improve the consistency of the results. Furthermore, the 370`-warmup` option is now used to specify the amount of warmup time rather than 371the number of warmup iterations. 372 37311. Fixed an error (`short jump is out of range`) that occurred when assembling 374the 32-bit x86 SIMD extensions with NASM versions prior to 2.04. This was a 375regression introduced by 1.5 beta1[12]. 376 377 3781.5.1 379===== 380 381### Significant changes relative to 1.5.0: 382 3831. Previously, the undocumented `JSIMD_FORCE*` environment variables could be 384used to force-enable a particular SIMD instruction set if multiple instruction 385sets were available on a particular platform. On x86 platforms, where CPU 386feature detection is bulletproof and multiple SIMD instruction sets are 387available, it makes sense for those environment variables to allow forcing the 388use of an instruction set only if that instruction set is available. However, 389since the ARM implementations of libjpeg-turbo can only use one SIMD 390instruction set, and since their feature detection code is less bulletproof 391(parsing /proc/cpuinfo), it makes sense for the `JSIMD_FORCENEON` environment 392variable to bypass the feature detection code and really force the use of NEON 393instructions. A new environment variable (`JSIMD_FORCEDSPR2`) was introduced 394in the MIPS implementation for the same reasons, and the existing 395`JSIMD_FORCENONE` environment variable was extended to that implementation. 396These environment variables provide a workaround for those attempting to test 397ARM and MIPS builds of libjpeg-turbo in QEMU, which passes through 398/proc/cpuinfo from the host system. 399 4002. libjpeg-turbo previously assumed that AltiVec instructions were always 401available on PowerPC platforms, which led to "illegal instruction" errors when 402running on PowerPC chips that lack AltiVec support (such as the older 7xx/G3 403and newer e5500 series.) libjpeg-turbo now examines /proc/cpuinfo on 404Linux/Android systems and enables AltiVec instructions only if the CPU supports 405them. It also now provides two environment variables, `JSIMD_FORCEALTIVEC` and 406`JSIMD_FORCENONE`, to force-enable and force-disable AltiVec instructions in 407environments where /proc/cpuinfo is an unreliable means of CPU feature 408detection (such as when running in QEMU.) On OS X, libjpeg-turbo continues to 409assume that AltiVec support is always available, which means that libjpeg-turbo 410cannot be used with G3 Macs unless you set the environment variable 411`JSIMD_FORCENONE` to `1`. 412 4133. Fixed an issue whereby 64-bit ARM (AArch64) builds of libjpeg-turbo would 414crash when built with recent releases of the Clang/LLVM compiler. This was 415caused by an ABI conformance issue in some of libjpeg-turbo's 64-bit NEON SIMD 416routines. Those routines were incorrectly using 64-bit instructions to 417transfer a 32-bit JDIMENSION argument, whereas the ABI allows the upper 418(unused) 32 bits of a 32-bit argument's register to be undefined. The new 419Clang/LLVM optimizer uses load combining to transfer multiple adjacent 32-bit 420structure members into a single 64-bit register, and this exposed the ABI 421conformance issue. 422 4234. Fancy upsampling is now supported when decompressing JPEG images that use 4244:4:0 (h1v2) chroma subsampling. These images are generated when losslessly 425rotating or transposing JPEG images that use 4:2:2 (h2v1) chroma subsampling. 426The h1v2 fancy upsampling algorithm is not currently SIMD-accelerated. 427 4285. If merged upsampling isn't SIMD-accelerated but YCbCr-to-RGB conversion is, 429then libjpeg-turbo will now disable merged upsampling when decompressing YCbCr 430JPEG images into RGB or extended RGB output images. This significantly speeds 431up the decompression of 4:2:0 and 4:2:2 JPEGs on ARM platforms if fancy 432upsampling is not used (for example, if the `-nosmooth` option to djpeg is 433specified.) 434 4356. The TurboJPEG API will now decompress 4:2:2 and 4:4:0 JPEG images with 4362x2 luminance sampling factors and 2x1 or 1x2 chrominance sampling factors. 437This is a non-standard way of specifying 2x subsampling (normally 4:2:2 JPEGs 438have 2x1 luminance and 1x1 chrominance sampling factors, and 4:4:0 JPEGs have 4391x2 luminance and 1x1 chrominance sampling factors), but the JPEG format and 440the libjpeg API both allow it. 441 4427. Fixed an unsigned integer overflow in the libjpeg memory manager, detected 443by the Clang undefined behavior sanitizer, that could be triggered by 444attempting to decompress a specially-crafted malformed JPEG image. This issue 445affected only 32-bit code and did not pose a security threat, but removing the 446warning makes it easier to detect actual security issues, should they arise in 447the future. 448 4498. Fixed additional negative left shifts and other issues reported by the GCC 450and Clang undefined behavior sanitizers when attempting to decompress 451specially-crafted malformed JPEG images. None of these issues posed a security 452threat, but removing the warnings makes it easier to detect actual security 453issues, should they arise in the future. 454 4559. Fixed an out-of-bounds array reference, introduced by 1.4.90[2] (partial 456image decompression) and detected by the Clang undefined behavior sanitizer, 457that could be triggered by a specially-crafted malformed JPEG image with more 458than four components. Because the out-of-bounds reference was still within the 459same structure, it was not known to pose a security threat, but removing the 460warning makes it easier to detect actual security issues, should they arise in 461the future. 462 46310. Fixed another ABI conformance issue in the 64-bit ARM (AArch64) NEON SIMD 464code. Some of the routines were incorrectly reading and storing data below the 465stack pointer, which caused segfaults in certain applications under specific 466circumstances. 467 468 4691.5.0 470===== 471 472### Significant changes relative to 1.5 beta1: 473 4741. Fixed an issue whereby a malformed motion-JPEG frame could cause the "fast 475path" of libjpeg-turbo's Huffman decoder to read from uninitialized memory. 476 4772. Added libjpeg-turbo version and build information to the global string table 478of the libjpeg and TurboJPEG API libraries. This is a common practice in other 479infrastructure libraries, such as OpenSSL and libpng, because it makes it easy 480to examine an application binary and determine which version of the library the 481application was linked against. 482 4833. Fixed a couple of issues in the PPM reader that would cause buffer overruns 484in cjpeg if one of the values in a binary PPM/PGM input file exceeded the 485maximum value defined in the file's header. libjpeg-turbo 1.4.2 already 486included a similar fix for ASCII PPM/PGM files. Note that these issues were 487not security bugs, since they were confined to the cjpeg program and did not 488affect any of the libjpeg-turbo libraries. 489 4904. Fixed an issue whereby attempting to decompress a JPEG file with a corrupt 491header using the `tjDecompressToYUV2()` function would cause the function to 492abort without returning an error and, under certain circumstances, corrupt the 493stack. This only occurred if `tjDecompressToYUV2()` was called prior to 494calling `tjDecompressHeader3()`, or if the return value from 495`tjDecompressHeader3()` was ignored (both cases represent incorrect usage of 496the TurboJPEG API.) 497 4985. Fixed an issue in the ARM 32-bit SIMD-accelerated Huffman encoder that 499prevented the code from assembling properly with clang. 500 5016. The `jpeg_stdio_src()`, `jpeg_mem_src()`, `jpeg_stdio_dest()`, and 502`jpeg_mem_dest()` functions in the libjpeg API will now throw an error if a 503source/destination manager has already been assigned to the compress or 504decompress object by a different function or by the calling program. This 505prevents these functions from attempting to reuse a source/destination manager 506structure that was allocated elsewhere, because there is no way to ensure that 507it would be big enough to accommodate the new source/destination manager. 508 509 5101.4.90 (1.5 beta1) 511================== 512 513### Significant changes relative to 1.4.2: 514 5151. Added full SIMD acceleration for PowerPC platforms using AltiVec VMX 516(128-bit SIMD) instructions. Although the performance of libjpeg-turbo on 517PowerPC was already good, due to the increased number of registers available 518to the compiler vs. x86, it was still possible to speed up compression by about 5193-4x and decompression by about 2-2.5x (relative to libjpeg v6b) through the 520use of AltiVec instructions. 521 5222. Added two new libjpeg API functions (`jpeg_skip_scanlines()` and 523`jpeg_crop_scanline()`) that can be used to partially decode a JPEG image. See 524[libjpeg.txt](libjpeg.txt) for more details. 525 5263. The TJCompressor and TJDecompressor classes in the TurboJPEG Java API now 527implement the Closeable interface, so those classes can be used with a 528try-with-resources statement. 529 5304. The TurboJPEG Java classes now throw unchecked idiomatic exceptions 531(IllegalArgumentException, IllegalStateException) for unrecoverable errors 532caused by incorrect API usage, and those classes throw a new checked exception 533type (TJException) for errors that are passed through from the C library. 534 5355. Source buffers for the TurboJPEG C API functions, as well as the 536`jpeg_mem_src()` function in the libjpeg API, are now declared as const 537pointers. This facilitates passing read-only buffers to those functions and 538ensures the caller that the source buffer will not be modified. This should 539not create any backward API or ABI incompatibilities with prior libjpeg-turbo 540releases. 541 5426. The MIPS DSPr2 SIMD code can now be compiled to support either FR=0 or FR=1 543FPUs. 544 5457. Fixed additional negative left shifts and other issues reported by the GCC 546and Clang undefined behavior sanitizers. Most of these issues affected only 54732-bit code, and none of them was known to pose a security threat, but removing 548the warnings makes it easier to detect actual security issues, should they 549arise in the future. 550 5518. Removed the unnecessary `.arch` directive from the ARM64 NEON SIMD code. 552This directive was preventing the code from assembling using the clang 553integrated assembler. 554 5559. Fixed a regression caused by 1.4.1[6] that prevented 32-bit and 64-bit 556libjpeg-turbo RPMs from being installed simultaneously on recent Red Hat/Fedora 557distributions. This was due to the addition of a macro in jconfig.h that 558allows the Huffman codec to determine the word size at compile time. Since 559that macro differs between 32-bit and 64-bit builds, this caused a conflict 560between the i386 and x86_64 RPMs (any differing files, other than executables, 561are not allowed when 32-bit and 64-bit RPMs are installed simultaneously.) 562Since the macro is used only internally, it has been moved into jconfigint.h. 563 56410. The x86-64 SIMD code can now be disabled at run time by setting the 565`JSIMD_FORCENONE` environment variable to `1` (the other SIMD implementations 566already had this capability.) 567 56811. Added a new command-line argument to TJBench (`-nowrite`) that prevents the 569benchmark from outputting any images. This removes any potential operating 570system overhead that might be caused by lazy writes to disk and thus improves 571the consistency of the performance measurements. 572 57312. Added SIMD acceleration for Huffman encoding on SSE2-capable x86 and x86-64 574platforms. This speeds up the compression of full-color JPEGs by about 10-15% 575on average (relative to libjpeg-turbo 1.4.x) when using modern Intel and AMD 576CPUs. Additionally, this works around an issue in the clang optimizer that 577prevents it (as of this writing) from achieving the same performance as GCC 578when compiling the C version of the Huffman encoder 579(<https://llvm.org/bugs/show_bug.cgi?id=16035>). For the purposes of 580benchmarking or regression testing, SIMD-accelerated Huffman encoding can be 581disabled by setting the `JSIMD_NOHUFFENC` environment variable to `1`. 582 58313. Added ARM 64-bit (ARMv8) NEON SIMD implementations of the commonly-used 584compression algorithms (including the slow integer forward DCT and h2v2 & h2v1 585downsampling algorithms, which are not accelerated in the 32-bit NEON 586implementation.) This speeds up the compression of full-color JPEGs by about 58775% on average on a Cavium ThunderX processor and by about 2-2.5x on average on 588Cortex-A53 and Cortex-A57 cores. 589 59014. Added SIMD acceleration for Huffman encoding on NEON-capable ARM 32-bit 591and 64-bit platforms. 592 593 For 32-bit code, this speeds up the compression of full-color JPEGs by 594about 30% on average on a typical iOS device (iPhone 4S, Cortex-A9) and by 595about 6-7% on average on a typical Android device (Nexus 5X, Cortex-A53 and 596Cortex-A57), relative to libjpeg-turbo 1.4.x. Note that the larger speedup 597under iOS is due to the fact that iOS builds use LLVM, which does not optimize 598the C Huffman encoder as well as GCC does. 599 600 For 64-bit code, NEON-accelerated Huffman encoding speeds up the 601compression of full-color JPEGs by about 40% on average on a typical iOS device 602(iPhone 5S, Apple A7) and by about 7-8% on average on a typical Android device 603(Nexus 5X, Cortex-A53 and Cortex-A57), in addition to the speedup described in 604[13] above. 605 606 For the purposes of benchmarking or regression testing, SIMD-accelerated 607Huffman encoding can be disabled by setting the `JSIMD_NOHUFFENC` environment 608variable to `1`. 609 61015. pkg-config (.pc) scripts are now included for both the libjpeg and 611TurboJPEG API libraries on Un*x systems. Note that if a project's build system 612relies on these scripts, then it will not be possible to build that project 613with libjpeg or with a prior version of libjpeg-turbo. 614 61516. Optimized the ARM 64-bit (ARMv8) NEON SIMD decompression routines to 616improve performance on CPUs with in-order pipelines. This speeds up the 617decompression of full-color JPEGs by nearly 2x on average on a Cavium ThunderX 618processor and by about 15% on average on a Cortex-A53 core. 619 62017. Fixed an issue in the accelerated Huffman decoder that could have caused 621the decoder to read past the end of the input buffer when a malformed, 622specially-crafted JPEG image was being decompressed. In prior versions of 623libjpeg-turbo, the accelerated Huffman decoder was invoked (in most cases) only 624if there were > 128 bytes of data in the input buffer. However, it is possible 625to construct a JPEG image in which a single Huffman block is over 430 bytes 626long, so this version of libjpeg-turbo activates the accelerated Huffman 627decoder only if there are > 512 bytes of data in the input buffer. 628 62918. Fixed a memory leak in tjunittest encountered when running the program 630with the `-yuv` option. 631 632 6331.4.2 634===== 635 636### Significant changes relative to 1.4.1: 637 6381. Fixed an issue whereby cjpeg would segfault if a Windows bitmap with a 639negative width or height was used as an input image (Windows bitmaps can have 640a negative height if they are stored in top-down order, but such files are 641rare and not supported by libjpeg-turbo.) 642 6432. Fixed an issue whereby, under certain circumstances, libjpeg-turbo would 644incorrectly encode certain JPEG images when quality=100 and the fast integer 645forward DCT were used. This was known to cause `make test` to fail when the 646library was built with `-march=haswell` on x86 systems. 647 6483. Fixed an issue whereby libjpeg-turbo would crash when built with the latest 649& greatest development version of the Clang/LLVM compiler. This was caused by 650an x86-64 ABI conformance issue in some of libjpeg-turbo's 64-bit SSE2 SIMD 651routines. Those routines were incorrectly using a 64-bit `mov` instruction to 652transfer a 32-bit JDIMENSION argument, whereas the x86-64 ABI allows the upper 653(unused) 32 bits of a 32-bit argument's register to be undefined. The new 654Clang/LLVM optimizer uses load combining to transfer multiple adjacent 32-bit 655structure members into a single 64-bit register, and this exposed the ABI 656conformance issue. 657 6584. Fixed a bug in the MIPS DSPr2 4:2:0 "plain" (non-fancy and non-merged) 659upsampling routine that caused a buffer overflow (and subsequent segfault) when 660decompressing a 4:2:0 JPEG image whose scaled output width was less than 16 661pixels. The "plain" upsampling routines are normally only used when 662decompressing a non-YCbCr JPEG image, but they are also used when decompressing 663a JPEG image whose scaled output height is 1. 664 6655. Fixed various negative left shifts and other issues reported by the GCC and 666Clang undefined behavior sanitizers. None of these was known to pose a 667security threat, but removing the warnings makes it easier to detect actual 668security issues, should they arise in the future. 669 670 6711.4.1 672===== 673 674### Significant changes relative to 1.4.0: 675 6761. tjbench now properly handles CMYK/YCCK JPEG files. Passing an argument of 677`-cmyk` (instead of, for instance, `-rgb`) will cause tjbench to internally 678convert the source bitmap to CMYK prior to compression, to generate YCCK JPEG 679files, and to internally convert the decompressed CMYK pixels back to RGB after 680decompression (the latter is done automatically if a CMYK or YCCK JPEG is 681passed to tjbench as a source image.) The CMYK<->RGB conversion operation is 682not benchmarked. NOTE: The quick & dirty CMYK<->RGB conversions that tjbench 683uses are suitable for testing only. Proper conversion between CMYK and RGB 684requires a color management system. 685 6862. `make test` now performs additional bitwise regression tests using tjbench, 687mainly for the purpose of testing compression from/decompression to a subregion 688of a larger image buffer. 689 6903. `make test` no longer tests the regression of the floating point DCT/IDCT 691by default, since the results of those tests can vary if the algorithms in 692question are not implemented using SIMD instructions on a particular platform. 693See the comments in [Makefile.am](Makefile.am) for information on how to 694re-enable the tests and to specify an expected result for them based on the 695particulars of your platform. 696 6974. The NULL color conversion routines have been significantly optimized, 698which speeds up the compression of RGB and CMYK JPEGs by 5-20% when using 69964-bit code and 0-3% when using 32-bit code, and the decompression of those 700images by 10-30% when using 64-bit code and 3-12% when using 32-bit code. 701 7025. Fixed an "illegal instruction" error that occurred when djpeg from a 703SIMD-enabled libjpeg-turbo MIPS build was executed with the `-nosmooth` option 704on a MIPS machine that lacked DSPr2 support. The MIPS SIMD routines for h2v1 705and h2v2 merged upsampling were not properly checking for the existence of 706DSPr2. 707 7086. Performance has been improved significantly on 64-bit non-Linux and 709non-Windows platforms (generally 10-20% faster compression and 5-10% faster 710decompression.) Due to an oversight, the 64-bit version of the accelerated 711Huffman codec was not being compiled in when libjpeg-turbo was built on 712platforms other than Windows or Linux. Oops. 713 7147. Fixed an extremely rare bug in the Huffman encoder that caused 64-bit 715builds of libjpeg-turbo to incorrectly encode a few specific test images when 716quality=98, an optimized Huffman table, and the slow integer forward DCT were 717used. 718 7198. The Windows (CMake) build system now supports building only static or only 720shared libraries. This is accomplished by adding either `-DENABLE_STATIC=0` or 721`-DENABLE_SHARED=0` to the CMake command line. 722 7239. TurboJPEG API functions will now return an error code if a warning is 724triggered in the underlying libjpeg API. For instance, if a JPEG file is 725corrupt, the TurboJPEG decompression functions will attempt to decompress 726as much of the image as possible, but those functions will now return -1 to 727indicate that the decompression was not entirely successful. 728 72910. Fixed a bug in the MIPS DSPr2 4:2:2 fancy upsampling routine that caused a 730buffer overflow (and subsequent segfault) when decompressing a 4:2:2 JPEG image 731in which the right-most MCU was 5 or 6 pixels wide. 732 733 7341.4.0 735===== 736 737### Significant changes relative to 1.4 beta1: 738 7391. Fixed a build issue on OS X PowerPC platforms (md5cmp failed to build 740because OS X does not provide the `le32toh()` and `htole32()` functions.) 741 7422. The non-SIMD RGB565 color conversion code did not work correctly on big 743endian machines. This has been fixed. 744 7453. Fixed an issue in `tjPlaneSizeYUV()` whereby it would erroneously return 1 746instead of -1 if `componentID` was > 0 and `subsamp` was `TJSAMP_GRAY`. 747 7483. Fixed an issue in `tjBufSizeYUV2()` whereby it would erroneously return 0 749instead of -1 if `width` was < 1. 750 7515. The Huffman encoder now uses `clz` and `bsr` instructions for bit counting 752on ARM64 platforms (see 1.4 beta1[5].) 753 7546. The `close()` method in the TJCompressor and TJDecompressor Java classes is 755now idempotent. Previously, that method would call the native `tjDestroy()` 756function even if the TurboJPEG instance had already been destroyed. This 757caused an exception to be thrown during finalization, if the `close()` method 758had already been called. The exception was caught, but it was still an 759expensive operation. 760 7617. The TurboJPEG API previously generated an error (`Could not determine 762subsampling type for JPEG image`) when attempting to decompress grayscale JPEG 763images that were compressed with a sampling factor other than 1 (for instance, 764with `cjpeg -grayscale -sample 2x2`). Subsampling technically has no meaning 765with grayscale JPEGs, and thus the horizontal and vertical sampling factors 766for such images are ignored by the decompressor. However, the TurboJPEG API 767was being too rigid and was expecting the sampling factors to be equal to 1 768before it treated the image as a grayscale JPEG. 769 7708. cjpeg, djpeg, and jpegtran now accept an argument of `-version`, which will 771print the library version and exit. 772 7739. Referring to 1.4 beta1[15], another extremely rare circumstance was 774discovered under which the Huffman encoder's local buffer can be overrun 775when a buffered destination manager is being used and an 776extremely-high-frequency block (basically junk image data) is being encoded. 777Even though the Huffman local buffer was increased from 128 bytes to 136 bytes 778to address the previous issue, the new issue caused even the larger buffer to 779be overrun. Further analysis reveals that, in the absolute worst case (such as 780setting alternating AC coefficients to 32767 and -32768 in the JPEG scanning 781order), the Huffman encoder can produce encoded blocks that approach double the 782size of the unencoded blocks. Thus, the Huffman local buffer was increased to 783256 bytes, which should prevent any such issue from re-occurring in the future. 784 78510. The new `tjPlaneSizeYUV()`, `tjPlaneWidth()`, and `tjPlaneHeight()` 786functions were not actually usable on any platform except OS X and Windows, 787because those functions were not included in the libturbojpeg mapfile. This 788has been fixed. 789 79011. Restored the `JPP()`, `JMETHOD()`, and `FAR` macros in the libjpeg-turbo 791header files. The `JPP()` and `JMETHOD()` macros were originally implemented 792in libjpeg as a way of supporting non-ANSI compilers that lacked support for 793prototype parameters. libjpeg-turbo has never supported such compilers, but 794some software packages still use the macros to define their own prototypes. 795Similarly, libjpeg-turbo has never supported MS-DOS and other platforms that 796have far symbols, but some software packages still use the `FAR` macro. A 797pretty good argument can be made that this is a bad practice on the part of the 798software in question, but since this affects more than one package, it's just 799easier to fix it here. 800 80112. Fixed issues that were preventing the ARM 64-bit SIMD code from compiling 802for iOS, and included an ARMv8 architecture in all of the binaries installed by 803the "official" libjpeg-turbo SDK for OS X. 804 805 8061.3.90 (1.4 beta1) 807================== 808 809### Significant changes relative to 1.3.1: 810 8111. New features in the TurboJPEG API: 812 813 - YUV planar images can now be generated with an arbitrary line padding 814(previously only 4-byte padding, which was compatible with X Video, was 815supported.) 816 - The decompress-to-YUV function has been extended to support image 817scaling. 818 - JPEG images can now be compressed from YUV planar source images. 819 - YUV planar images can now be decoded into RGB or grayscale images. 820 - 4:1:1 subsampling is now supported. This is mainly included for 821compatibility, since 4:1:1 is not fully accelerated in libjpeg-turbo and has no 822significant advantages relative to 4:2:0. 823 - CMYK images are now supported. This feature allows CMYK source images 824to be compressed to YCCK JPEGs and YCCK or CMYK JPEGs to be decompressed to 825CMYK destination images. Conversion between CMYK/YCCK and RGB or YUV images is 826not supported. Such conversion requires a color management system and is thus 827out of scope for a codec library. 828 - The handling of YUV images in the Java API has been significantly 829refactored and should now be much more intuitive. 830 - The Java API now supports encoding a YUV image from an arbitrary 831position in a large image buffer. 832 - All of the YUV functions now have a corresponding function that operates 833on separate image planes instead of a unified image buffer. This allows for 834compressing/decoding from or decompressing/encoding to a subregion of a larger 835YUV image. It also allows for handling YUV formats that swap the order of the 836U and V planes. 837 8382. Added SIMD acceleration for DSPr2-capable MIPS platforms. This speeds up 839the compression of full-color JPEGs by 70-80% on such platforms and 840decompression by 25-35%. 841 8423. If an application attempts to decompress a Huffman-coded JPEG image whose 843header does not contain Huffman tables, libjpeg-turbo will now insert the 844default Huffman tables. In order to save space, many motion JPEG video frames 845are encoded without the default Huffman tables, so these frames can now be 846successfully decompressed by libjpeg-turbo without additional work on the part 847of the application. An application can still override the Huffman tables, for 848instance to re-use tables from a previous frame of the same video. 849 8504. The Mac packaging system now uses pkgbuild and productbuild rather than 851PackageMaker (which is obsolete and no longer supported.) This means that 852OS X 10.6 "Snow Leopard" or later must be used when packaging libjpeg-turbo, 853although the packages produced can be installed on OS X 10.5 "Leopard" or 854later. OS X 10.4 "Tiger" is no longer supported. 855 8565. The Huffman encoder now uses `clz` and `bsr` instructions for bit counting 857on ARM platforms rather than a lookup table. This reduces the memory footprint 858by 64k, which may be important for some mobile applications. Out of four 859Android devices that were tested, two demonstrated a small overall performance 860loss (~3-4% on average) with ARMv6 code and a small gain (also ~3-4%) with 861ARMv7 code when enabling this new feature, but the other two devices 862demonstrated a significant overall performance gain with both ARMv6 and ARMv7 863code (~10-20%) when enabling the feature. Actual mileage may vary. 864 8656. Worked around an issue with Visual C++ 2010 and later that caused incorrect 866pixels to be generated when decompressing a JPEG image to a 256-color bitmap, 867if compiler optimization was enabled when libjpeg-turbo was built. This caused 868the regression tests to fail when doing a release build under Visual C++ 2010 869and later. 870 8717. Improved the accuracy and performance of the non-SIMD implementation of the 872floating point inverse DCT (using code borrowed from libjpeg v8a and later.) 873The accuracy of this implementation now matches the accuracy of the SSE/SSE2 874implementation. Note, however, that the floating point DCT/IDCT algorithms are 875mainly a legacy feature. They generally do not produce significantly better 876accuracy than the slow integer DCT/IDCT algorithms, and they are quite a bit 877slower. 878 8798. Added a new output colorspace (`JCS_RGB565`) to the libjpeg API that allows 880for decompressing JPEG images into RGB565 (16-bit) pixels. If dithering is not 881used, then this code path is SIMD-accelerated on ARM platforms. 882 8839. Numerous obsolete features, such as support for non-ANSI compilers and 884support for the MS-DOS memory model, were removed from the libjpeg code, 885greatly improving its readability and making it easier to maintain and extend. 886 88710. Fixed a segfault that occurred when calling `output_message()` with 888`msg_code` set to `JMSG_COPYRIGHT`. 889 89011. Fixed an issue whereby wrjpgcom was allowing comments longer than 65k 891characters to be passed on the command line, which was causing it to generate 892incorrect JPEG files. 893 89412. Fixed a bug in the build system that was causing the Windows version of 895wrjpgcom to be built using the rdjpgcom source code. 896 89713. Restored 12-bit-per-component JPEG support. A 12-bit version of 898libjpeg-turbo can now be built by passing an argument of `--with-12bit` to 899configure (Unix) or `-DWITH_12BIT=1` to cmake (Windows.) 12-bit JPEG support 900is included only for convenience. Enabling this feature disables all of the 901performance features in libjpeg-turbo, as well as arithmetic coding and the 902TurboJPEG API. The resulting library still contains the other libjpeg-turbo 903features (such as the colorspace extensions), but in general, it performs no 904faster than libjpeg v6b. 905 90614. Added ARM 64-bit SIMD acceleration for the YCC-to-RGB color conversion 907and IDCT algorithms (both are used during JPEG decompression.) For unknown 908reasons (probably related to clang), this code cannot currently be compiled for 909iOS. 910 91115. Fixed an extremely rare bug that could cause the Huffman encoder's local 912buffer to overrun when a very high-frequency MCU is compressed using quality 913100 and no subsampling, and when the JPEG output buffer is being dynamically 914resized by the destination manager. This issue was so rare that, even with a 915test program specifically designed to make the bug occur (by injecting random 916high-frequency YUV data into the compressor), it was reproducible only once in 917about every 25 million iterations. 918 91916. Fixed an oversight in the TurboJPEG C wrapper: if any of the JPEG 920compression functions was called repeatedly with the same 921automatically-allocated destination buffer, then TurboJPEG would erroneously 922assume that the `jpegSize` parameter was equal to the size of the buffer, when 923in fact that parameter was probably equal to the size of the most recently 924compressed JPEG image. If the size of the previous JPEG image was not as large 925as the current JPEG image, then TurboJPEG would unnecessarily reallocate the 926destination buffer. 927 928 9291.3.1 930===== 931 932### Significant changes relative to 1.3.0: 933 9341. On Un*x systems, `make install` now installs the libjpeg-turbo libraries 935into /opt/libjpeg-turbo/lib32 by default on any 32-bit system, not just x86, 936and into /opt/libjpeg-turbo/lib64 by default on any 64-bit system, not just 937x86-64. You can override this by overriding either the `prefix` or `libdir` 938configure variables. 939 9402. The Windows installer now places a copy of the TurboJPEG DLLs in the same 941directory as the rest of the libjpeg-turbo binaries. This was mainly done 942to support TurboVNC 1.3, which bundles the DLLs in its Windows installation. 943When using a 32-bit version of CMake on 64-bit Windows, it is impossible to 944access the c:\WINDOWS\system32 directory, which made it impossible for the 945TurboVNC build scripts to bundle the 64-bit TurboJPEG DLL. 946 9473. Fixed a bug whereby attempting to encode a progressive JPEG with arithmetic 948entropy coding (by passing arguments of `-progressive -arithmetic` to cjpeg or 949jpegtran, for instance) would result in an error, `Requested feature was 950omitted at compile time`. 951 9524. Fixed a couple of issues whereby malformed JPEG images would cause 953libjpeg-turbo to use uninitialized memory during decompression. 954 9555. Fixed an error (`Buffer passed to JPEG library is too small`) that occurred 956when calling the TurboJPEG YUV encoding function with a very small (< 5x5) 957source image, and added a unit test to check for this error. 958 9596. The Java classes should now build properly under Visual Studio 2010 and 960later. 961 9627. Fixed an issue that prevented SRPMs generated using the in-tree packaging 963tools from being rebuilt on certain newer Linux distributions. 964 9658. Numerous minor fixes to eliminate compilation and build/packaging system 966warnings, fix cosmetic issues, improve documentation clarity, and other general 967source cleanup. 968 969 9701.3.0 971===== 972 973### Significant changes relative to 1.3 beta1: 974 9751. `make test` now works properly on FreeBSD, and it no longer requires the 976md5sum executable to be present on other Un*x platforms. 977 9782. Overhauled the packaging system: 979 980 - To avoid conflict with vendor-supplied libjpeg-turbo packages, the 981official RPMs and DEBs for libjpeg-turbo have been renamed to 982"libjpeg-turbo-official". 983 - The TurboJPEG libraries are now located under /opt/libjpeg-turbo in the 984official Linux and Mac packages, to avoid conflict with vendor-supplied 985packages and also to streamline the packaging system. 986 - Release packages are now created with the directory structure defined 987by the configure variables `prefix`, `bindir`, `libdir`, etc. (Un\*x) or by the 988`CMAKE_INSTALL_PREFIX` variable (Windows.) The exception is that the docs are 989always located under the system default documentation directory on Un\*x and 990Mac systems, and on Windows, the TurboJPEG DLL is always located in the Windows 991system directory. 992 - To avoid confusion, official libjpeg-turbo packages on Linux/Unix 993platforms (except for Mac) will always install the 32-bit libraries in 994/opt/libjpeg-turbo/lib32 and the 64-bit libraries in /opt/libjpeg-turbo/lib64. 995 - Fixed an issue whereby, in some cases, the libjpeg-turbo executables on 996Un*x systems were not properly linking with the shared libraries installed by 997the same package. 998 - Fixed an issue whereby building the "installer" target on Windows when 999`WITH_JAVA=1` would fail if the TurboJPEG JAR had not been previously built. 1000 - Building the "install" target on Windows now installs files into the 1001same places that the installer does. 1002 10033. Fixed a Huffman encoder bug that prevented I/O suspension from working 1004properly. 1005 1006 10071.2.90 (1.3 beta1) 1008================== 1009 1010### Significant changes relative to 1.2.1: 1011 10121. Added support for additional scaling factors (3/8, 5/8, 3/4, 7/8, 9/8, 5/4, 101311/8, 3/2, 13/8, 7/4, 15/8, and 2) when decompressing. Note that the IDCT will 1014not be SIMD-accelerated when using any of these new scaling factors. 1015 10162. The TurboJPEG dynamic library is now versioned. It was not strictly 1017necessary to do so, because TurboJPEG uses versioned symbols, and if a function 1018changes in an ABI-incompatible way, that function is renamed and a legacy 1019function is provided to maintain backward compatibility. However, certain 1020Linux distro maintainers have a policy against accepting any library that isn't 1021versioned. 1022 10233. Extended the TurboJPEG Java API so that it can be used to compress a JPEG 1024image from and decompress a JPEG image to an arbitrary position in a large 1025image buffer. 1026 10274. The `tjDecompressToYUV()` function now supports the `TJFLAG_FASTDCT` flag. 1028 10295. The 32-bit supplementary package for amd64 Debian systems now provides 1030symlinks in /usr/lib/i386-linux-gnu for the TurboJPEG libraries in /usr/lib32. 1031This allows those libraries to be used on MultiArch-compatible systems (such as 1032Ubuntu 11 and later) without setting the linker path. 1033 10346. The TurboJPEG Java wrapper should now find the JNI library on Mac systems 1035without having to pass `-Djava.library.path=/usr/lib` to java. 1036 10377. TJBench has been ported to Java to provide a convenient way of validating 1038the performance of the TurboJPEG Java API. It can be run with 1039`java -cp turbojpeg.jar TJBench`. 1040 10418. cjpeg can now be used to generate JPEG files with the RGB colorspace 1042(feature ported from jpeg-8d.) 1043 10449. The width and height in the `-crop` argument passed to jpegtran can now be 1045suffixed with `f` to indicate that, when the upper left corner of the cropping 1046region is automatically moved to the nearest iMCU boundary, the bottom right 1047corner should be moved by the same amount. In other words, this feature causes 1048jpegtran to strictly honor the specified width/height rather than the specified 1049bottom right corner (feature ported from jpeg-8d.) 1050 105110. JPEG files using the RGB colorspace can now be decompressed into grayscale 1052images (feature ported from jpeg-8d.) 1053 105411. Fixed a regression caused by 1.2.1[7] whereby the build would fail with 1055multiple "Mismatch in operand sizes" errors when attempting to build the x86 1056SIMD code with NASM 0.98. 1057 105812. The in-memory source/destination managers (`jpeg_mem_src()` and 1059`jpeg_mem_dest()`) are now included by default when building libjpeg-turbo with 1060libjpeg v6b or v7 emulation, so that programs can take advantage of these 1061functions without requiring the use of the backward-incompatible libjpeg v8 1062ABI. The "age number" of the libjpeg-turbo library on Un*x systems has been 1063incremented by 1 to reflect this. You can disable this feature with a 1064configure/CMake switch in order to retain strict API/ABI compatibility with the 1065libjpeg v6b or v7 API/ABI (or with previous versions of libjpeg-turbo.) See 1066[README.md](README.md) for more details. 1067 106813. Added ARMv7s architecture to libjpeg.a and libturbojpeg.a in the official 1069libjpeg-turbo binary package for OS X, so that those libraries can be used to 1070build applications that leverage the faster CPUs in the iPhone 5 and iPad 4. 1071 1072 10731.2.1 1074===== 1075 1076### Significant changes relative to 1.2.0: 1077 10781. Creating or decoding a JPEG file that uses the RGB colorspace should now 1079properly work when the input or output colorspace is one of the libjpeg-turbo 1080colorspace extensions. 1081 10822. When libjpeg-turbo was built without SIMD support and merged (non-fancy) 1083upsampling was used along with an alpha-enabled colorspace during 1084decompression, the unused byte of the decompressed pixels was not being set to 10850xFF. This has been fixed. TJUnitTest has also been extended to test for the 1086correct behavior of the colorspace extensions when merged upsampling is used. 1087 10883. Fixed a bug whereby the libjpeg-turbo SSE2 SIMD code would not preserve the 1089upper 64 bits of xmm6 and xmm7 on Win64 platforms, which violated the Win64 1090calling conventions. 1091 10924. Fixed a regression caused by 1.2.0[6] whereby decompressing corrupt JPEG 1093images (specifically, images in which the component count was erroneously set 1094to a large value) would cause libjpeg-turbo to segfault. 1095 10965. Worked around a severe performance issue with "Bobcat" (AMD Embedded APU) 1097processors. The `MASKMOVDQU` instruction, which was used by the libjpeg-turbo 1098SSE2 SIMD code, is apparently implemented in microcode on AMD processors, and 1099it is painfully slow on Bobcat processors in particular. Eliminating the use 1100of this instruction improved performance by an order of magnitude on Bobcat 1101processors and by a small amount (typically 5%) on AMD desktop processors. 1102 11036. Added SIMD acceleration for performing 4:2:2 upsampling on NEON-capable ARM 1104platforms. This speeds up the decompression of 4:2:2 JPEGs by 20-25% on such 1105platforms. 1106 11077. Fixed a regression caused by 1.2.0[2] whereby, on Linux/x86 platforms 1108running the 32-bit SSE2 SIMD code in libjpeg-turbo, decompressing a 4:2:0 or 11094:2:2 JPEG image into a 32-bit (RGBX, BGRX, etc.) buffer without using fancy 1110upsampling would produce several incorrect columns of pixels at the right-hand 1111side of the output image if each row in the output image was not evenly 1112divisible by 16 bytes. 1113 11148. Fixed an issue whereby attempting to build the SIMD extensions with Xcode 11154.3 on OS X platforms would cause NASM to return numerous errors of the form 1116"'%define' expects a macro identifier". 1117 11189. Added flags to the TurboJPEG API that allow the caller to force the use of 1119either the fast or the accurate DCT/IDCT algorithms in the underlying codec. 1120 1121 11221.2.0 1123===== 1124 1125### Significant changes relative to 1.2 beta1: 1126 11271. Fixed build issue with YASM on Unix systems (the libjpeg-turbo build system 1128was not adding the current directory to the assembler include path, so YASM 1129was not able to find jsimdcfg.inc.) 1130 11312. Fixed out-of-bounds read in SSE2 SIMD code that occurred when decompressing 1132a JPEG image to a bitmap buffer whose size was not a multiple of 16 bytes. 1133This was more of an annoyance than an actual bug, since it did not cause any 1134actual run-time problems, but the issue showed up when running libjpeg-turbo in 1135valgrind. See <http://crbug.com/72399> for more information. 1136 11373. Added a compile-time macro (`LIBJPEG_TURBO_VERSION`) that can be used to 1138check the version of libjpeg-turbo against which an application was compiled. 1139 11404. Added new RGBA/BGRA/ABGR/ARGB colorspace extension constants (libjpeg API) 1141and pixel formats (TurboJPEG API), which allow applications to specify that, 1142when decompressing to a 4-component RGB buffer, the unused byte should be set 1143to 0xFF so that it can be interpreted as an opaque alpha channel. 1144 11455. Fixed regression issue whereby DevIL failed to build against libjpeg-turbo 1146because libjpeg-turbo's distributed version of jconfig.h contained an `INLINE` 1147macro, which conflicted with a similar macro in DevIL. This macro is used only 1148internally when building libjpeg-turbo, so it was moved into config.h. 1149 11506. libjpeg-turbo will now correctly decompress erroneous CMYK/YCCK JPEGs whose 1151K component is assigned a component ID of 1 instead of 4. Although these files 1152are in violation of the spec, other JPEG implementations handle them 1153correctly. 1154 11557. Added ARMv6 and ARMv7 architectures to libjpeg.a and libturbojpeg.a in 1156the official libjpeg-turbo binary package for OS X, so that those libraries can 1157be used to build both OS X and iOS applications. 1158 1159 11601.1.90 (1.2 beta1) 1161================== 1162 1163### Significant changes relative to 1.1.1: 1164 11651. Added a Java wrapper for the TurboJPEG API. See [java/README](java/README) 1166for more details. 1167 11682. The TurboJPEG API can now be used to scale down images during 1169decompression. 1170 11713. Added SIMD routines for RGB-to-grayscale color conversion, which 1172significantly improves the performance of grayscale JPEG compression from an 1173RGB source image. 1174 11754. Improved the performance of the C color conversion routines, which are used 1176on platforms for which SIMD acceleration is not available. 1177 11785. Added a function to the TurboJPEG API that performs lossless transforms. 1179This function is implemented using the same back end as jpegtran, but it 1180performs transcoding entirely in memory and allows multiple transforms and/or 1181crop operations to be batched together, so the source coefficients only need to 1182be read once. This is useful when generating image tiles from a single source 1183JPEG. 1184 11856. Added tests for the new TurboJPEG scaled decompression and lossless 1186transform features to tjbench (the TurboJPEG benchmark, formerly called 1187"jpgtest".) 1188 11897. Added support for 4:4:0 (transposed 4:2:2) subsampling in TurboJPEG, which 1190was necessary in order for it to read 4:2:2 JPEG files that had been losslessly 1191transposed or rotated 90 degrees. 1192 11938. All legacy VirtualGL code has been re-factored, and this has allowed 1194libjpeg-turbo, in its entirety, to be re-licensed under a BSD-style license. 1195 11969. libjpeg-turbo can now be built with YASM. 1197 119810. Added SIMD acceleration for ARM Linux and iOS platforms that support 1199NEON instructions. 1200 120111. Refactored the TurboJPEG C API and documented it using Doxygen. The 1202TurboJPEG 1.2 API uses pixel formats to define the size and component order of 1203the uncompressed source/destination images, and it includes a more efficient 1204version of `TJBUFSIZE()` that computes a worst-case JPEG size based on the 1205level of chrominance subsampling. The refactored implementation of the 1206TurboJPEG API now uses the libjpeg memory source and destination managers, 1207which allows the TurboJPEG compressor to grow the JPEG buffer as necessary. 1208 120912. Eliminated errors in the output of jpegtran on Windows that occurred when 1210the application was invoked using I/O redirection 1211(`jpegtran <input.jpg >output.jpg`.) 1212 121313. The inclusion of libjpeg v7 and v8 emulation as well as arithmetic coding 1214support in libjpeg-turbo v1.1.0 introduced several new error constants in 1215jerror.h, and these were mistakenly enabled for all emulation modes, causing 1216the error enum in libjpeg-turbo to sometimes have different values than the 1217same enum in libjpeg. This represents an ABI incompatibility, and it caused 1218problems with rare applications that took specific action based on a particular 1219error value. The fix was to include the new error constants conditionally 1220based on whether libjpeg v7 or v8 emulation was enabled. 1221 122214. Fixed an issue whereby Windows applications that used libjpeg-turbo would 1223fail to compile if the Windows system headers were included before jpeglib.h. 1224This issue was caused by a conflict in the definition of the INT32 type. 1225 122615. Fixed 32-bit supplementary package for amd64 Debian systems, which was 1227broken by enhancements to the packaging system in 1.1. 1228 122916. When decompressing a JPEG image using an output colorspace of 1230`JCS_EXT_RGBX`, `JCS_EXT_BGRX`, `JCS_EXT_XBGR`, or `JCS_EXT_XRGB`, 1231libjpeg-turbo will now set the unused byte to 0xFF, which allows applications 1232to interpret that byte as an alpha channel (0xFF = opaque). 1233 1234 12351.1.1 1236===== 1237 1238### Significant changes relative to 1.1.0: 1239 12401. Fixed a 1-pixel error in row 0, column 21 of the luminance plane generated 1241by `tjEncodeYUV()`. 1242 12432. libjpeg-turbo's accelerated Huffman decoder previously ignored unexpected 1244markers found in the middle of the JPEG data stream during decompression. It 1245will now hand off decoding of a particular block to the unaccelerated Huffman 1246decoder if an unexpected marker is found, so that the unaccelerated Huffman 1247decoder can generate an appropriate warning. 1248 12493. Older versions of MinGW64 prefixed symbol names with underscores by 1250default, which differed from the behavior of 64-bit Visual C++. MinGW64 1.0 1251has adopted the behavior of 64-bit Visual C++ as the default, so to accommodate 1252this, the libjpeg-turbo SIMD function names are no longer prefixed with an 1253underscore when building with MinGW64. This means that, when building 1254libjpeg-turbo with older versions of MinGW64, you will now have to add 1255`-fno-leading-underscore` to the `CFLAGS`. 1256 12574. Fixed a regression bug in the NSIS script that caused the Windows installer 1258build to fail when using the Visual Studio IDE. 1259 12605. Fixed a bug in `jpeg_read_coefficients()` whereby it would not initialize 1261`cinfo->image_width` and `cinfo->image_height` if libjpeg v7 or v8 emulation 1262was enabled. This specifically caused the jpegoptim program to fail if it was 1263linked against a version of libjpeg-turbo that was built with libjpeg v7 or v8 1264emulation. 1265 12666. Eliminated excessive I/O overhead that occurred when reading BMP files in 1267cjpeg. 1268 12697. Eliminated errors in the output of cjpeg on Windows that occurred when the 1270application was invoked using I/O redirection (`cjpeg <inputfile >output.jpg`.) 1271 1272 12731.1.0 1274===== 1275 1276### Significant changes relative to 1.1 beta1: 1277 12781. The algorithm used by the SIMD quantization function cannot produce correct 1279results when the JPEG quality is >= 98 and the fast integer forward DCT is 1280used. Thus, the non-SIMD quantization function is now used for those cases, 1281and libjpeg-turbo should now produce identical output to libjpeg v6b in all 1282cases. 1283 12842. Despite the above, the fast integer forward DCT still degrades somewhat for 1285JPEG qualities greater than 95, so the TurboJPEG wrapper will now automatically 1286use the slow integer forward DCT when generating JPEG images of quality 96 or 1287greater. This reduces compression performance by as much as 15% for these 1288high-quality images but is necessary to ensure that the images are perceptually 1289lossless. It also ensures that the library can avoid the performance pitfall 1290created by [1]. 1291 12923. Ported jpgtest.cxx to pure C to avoid the need for a C++ compiler. 1293 12944. Fixed visual artifacts in grayscale JPEG compression caused by a typo in 1295the RGB-to-luminance lookup tables. 1296 12975. The Windows distribution packages now include the libjpeg run-time programs 1298(cjpeg, etc.) 1299 13006. All packages now include jpgtest. 1301 13027. The TurboJPEG dynamic library now uses versioned symbols. 1303 13048. Added two new TurboJPEG API functions, `tjEncodeYUV()` and 1305`tjDecompressToYUV()`, to replace the somewhat hackish `TJ_YUV` flag. 1306 1307 13081.0.90 (1.1 beta1) 1309================== 1310 1311### Significant changes relative to 1.0.1: 1312 13131. Added emulation of the libjpeg v7 and v8 APIs and ABIs. See 1314[README.md](README.md) for more details. This feature was sponsored by 1315CamTrace SAS. 1316 13172. Created a new CMake-based build system for the Visual C++ and MinGW builds. 1318 13193. Grayscale bitmaps can now be compressed from/decompressed to using the 1320TurboJPEG API. 1321 13224. jpgtest can now be used to test decompression performance with existing 1323JPEG images. 1324 13255. If the default install prefix (/opt/libjpeg-turbo) is used, then 1326`make install` now creates /opt/libjpeg-turbo/lib32 and 1327/opt/libjpeg-turbo/lib64 sym links to duplicate the behavior of the binary 1328packages. 1329 13306. All symbols in the libjpeg-turbo dynamic library are now versioned, even 1331when the library is built with libjpeg v6b emulation. 1332 13337. Added arithmetic encoding and decoding support (can be disabled with 1334configure or CMake options) 1335 13368. Added a `TJ_YUV` flag to the TurboJPEG API, which causes both the compressor 1337and decompressor to output planar YUV images. 1338 13399. Added an extended version of `tjDecompressHeader()` to the TurboJPEG API, 1340which allows the caller to determine the type of subsampling used in a JPEG 1341image. 1342 134310. Added further protections against invalid Huffman codes. 1344 1345 13461.0.1 1347===== 1348 1349### Significant changes relative to 1.0.0: 1350 13511. The Huffman decoder will now handle erroneous Huffman codes (for instance, 1352from a corrupt JPEG image.) Previously, these would cause libjpeg-turbo to 1353crash under certain circumstances. 1354 13552. Fixed typo in SIMD dispatch routines that was causing 4:2:2 upsampling to 1356be used instead of 4:2:0 when decompressing JPEG images using SSE2 code. 1357 13583. The configure script will now automatically determine whether the 1359`INCOMPLETE_TYPES_BROKEN` macro should be defined. 1360 1361 13621.0.0 1363===== 1364 1365### Significant changes relative to 0.0.93: 1366 13671. 2983700: Further FreeBSD build tweaks (no longer necessary to specify 1368`--host` when configuring on a 64-bit system) 1369 13702. Created symlinks in the Unix/Linux packages so that the TurboJPEG 1371include file can always be found in /opt/libjpeg-turbo/include, the 32-bit 1372static libraries can always be found in /opt/libjpeg-turbo/lib32, and the 137364-bit static libraries can always be found in /opt/libjpeg-turbo/lib64. 1374 13753. The Unix/Linux distribution packages now include the libjpeg run-time 1376programs (cjpeg, etc.) and man pages. 1377 13784. Created a 32-bit supplementary package for amd64 Debian systems, which 1379contains just the 32-bit libjpeg-turbo libraries. 1380 13815. Moved the libraries from */lib32 to */lib in the i386 Debian package. 1382 13836. Include distribution package for Cygwin 1384 13857. No longer necessary to specify `--without-simd` on non-x86 architectures, 1386and unit tests now work on those architectures. 1387 1388 13890.0.93 1390====== 1391 1392### Significant changes since 0.0.91: 1393 13941. 2982659: Fixed x86-64 build on FreeBSD systems 1395 13962. 2988188: Added support for Windows 64-bit systems 1397 1398 13990.0.91 1400====== 1401 1402### Significant changes relative to 0.0.90: 1403 14041. Added documentation to .deb packages 1405 14062. 2968313: Fixed data corruption issues when decompressing large JPEG images 1407and/or using buffered I/O with the libjpeg-turbo decompressor 1408 1409 14100.0.90 1411====== 1412 1413Initial release 1414