DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 1 | ******************************************************************************* |
| 2 | ** Background |
| 3 | ******************************************************************************* |
| 4 | |
DRC | 0d2d965 | 2011-02-18 22:29:45 +0000 | [diff] [blame] | 5 | libjpeg-turbo is a derivative of libjpeg which uses SIMD instructions (MMX, |
| 6 | SSE2, etc.) to accelerate baseline JPEG compression and decompression on x86 |
| 7 | and x86-64 systems. On such systems, libjpeg-turbo is generally 2-4x as fast |
| 8 | as the unmodified version of libjpeg, all else being equal. |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 9 | |
| 10 | libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but |
DRC | 0d2d965 | 2011-02-18 22:29:45 +0000 | [diff] [blame] | 11 | the TigerVNC and VirtualGL projects made numerous enhancements to the codec in |
| 12 | 2009, including improved support for Mac OS X, 64-bit support, support for |
| 13 | 32-bit and big endian pixel formats (RGBX, XBGR, etc.), accelerated Huffman |
| 14 | encoding/decoding, and various bug fixes. The goal was to produce a fully open |
| 15 | source codec that could replace the partially closed source TurboJPEG/IPP codec |
| 16 | used by VirtualGL and TurboVNC. libjpeg-turbo generally performs in the range |
| 17 | of 80-120% of TurboJPEG/IPP. It is faster in some areas but slower in others. |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 18 | |
DRC | 0d2d965 | 2011-02-18 22:29:45 +0000 | [diff] [blame] | 19 | In early 2010, libjpeg-turbo spun off into its own independent project, with |
| 20 | the goal of making high-speed JPEG compression/decompression technology |
| 21 | available to a broader range of users and developers. The libjpeg-turbo shared |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 22 | libraries can be used as drop-in replacements for libjpeg on most systems. |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 23 | |
| 24 | |
| 25 | ******************************************************************************* |
DRC | ce1546e | 2010-02-13 23:06:03 +0000 | [diff] [blame] | 26 | ** License |
| 27 | ******************************************************************************* |
| 28 | |
DRC | ab4db65 | 2011-02-18 04:55:08 +0000 | [diff] [blame] | 29 | The TurboJPEG/OSS wrapper, as well as some of the optimizations to the Huffman |
| 30 | encoder (jchuff.c) and decoder (jdhuff.c), were borrowed from VirtualGL, and |
| 31 | thus any distribution of libjpeg-turbo which includes those files must, as a |
| 32 | whole, be subject to the terms of the wxWindows Library Licence, Version 3.1. |
| 33 | A copy of this license can be found in this directory under LICENSE.txt. The |
| 34 | wxWindows Library License is based on the LGPL but includes provisions which |
| 35 | allow the Library to be statically linked into proprietary libraries and |
| 36 | applications without requiring the resulting binaries to be distributed under |
| 37 | the terms of the LGPL. |
DRC | 1e6b5b4 | 2010-03-20 20:00:51 +0000 | [diff] [blame] | 38 | |
DRC | ab4db65 | 2011-02-18 04:55:08 +0000 | [diff] [blame] | 39 | The rest of the source code, apart from TurboJPEG/OSS and the Huffman codec |
| 40 | optimizations, falls under a less restrictive, BSD-style license (see README.) |
| 41 | You can choose to distribute libjpeg-turbo, as a whole, under this BSD-style |
| 42 | license by simply removing TurboJPEG/OSS and replacing the optimized jchuff.c |
| 43 | and jdhuff.c with their unoptimized counterparts from the libjpeg v6b source. |
DRC | 7c1df0a | 2011-02-18 02:45:24 +0000 | [diff] [blame] | 44 | |
| 45 | |
| 46 | ******************************************************************************* |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 47 | ** Using libjpeg-turbo |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 48 | ******************************************************************************* |
| 49 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 50 | ============================= |
| 51 | Replacing libjpeg at Run Time |
| 52 | ============================= |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 53 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 54 | If a Unix application is dynamically linked with libjpeg, then you can replace |
DRC | ab4db65 | 2011-02-18 04:55:08 +0000 | [diff] [blame] | 55 | libjpeg with libjpeg-turbo at run time by manipulating LD_LIBRARY_PATH. |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 56 | For instance: |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 57 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 58 | [Using libjpeg] |
| 59 | > time cjpeg <vgl_5674_0098.ppm >vgl_5674_0098.jpg |
| 60 | real 0m0.392s |
| 61 | user 0m0.074s |
| 62 | sys 0m0.020s |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 63 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 64 | [Using libjpeg-turbo] |
| 65 | > export LD_LIBRARY_PATH=/opt/libjpeg-turbo/{lib}:$LD_LIBRARY_PATH |
| 66 | > time cjpeg <vgl_5674_0098.ppm >vgl_5674_0098.jpg |
| 67 | real 0m0.109s |
| 68 | user 0m0.029s |
| 69 | sys 0m0.010s |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 70 | |
DRC | ff95aa6 | 2010-06-05 00:22:32 +0000 | [diff] [blame] | 71 | NOTE: {lib} can be lib, lib32, lib64, or lib/64, depending on the O/S and |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 72 | architecture. |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 73 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 74 | System administrators can also replace the libjpeg sym links in /usr/{lib} with |
| 75 | links to the libjpeg dynamic library located in /opt/libjpeg-turbo/{lib}. This |
| 76 | will effectively accelerate every dynamically linked libjpeg application on the |
| 77 | system. |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 78 | |
DRC | ab4db65 | 2011-02-18 04:55:08 +0000 | [diff] [blame] | 79 | The libjpeg-turbo SDK for Visual C++ installs the libjpeg-turbo DLL |
| 80 | (jpeg62.dll, jpeg7.dll, or jpeg8.dll, depending on whether libjpeg v6b, v7, or |
| 81 | v8 emulation is enabled) into c:\libjpeg-turbo[64]\bin, and the PATH |
DRC | 5559c90 | 2010-10-18 02:21:10 +0000 | [diff] [blame] | 82 | environment variable can be modified such that this directory is searched |
| 83 | before any others that might contain a libjpeg DLL. However, if a libjpeg |
| 84 | DLL exists in an application's install directory, then Windows will load this |
| 85 | DLL first whenever the application is launched. Thus, if an application ships |
| 86 | with jpeg62.dll, jpeg7.dll, or jpeg8.dll, then back up the application's |
DRC | ab4db65 | 2011-02-18 04:55:08 +0000 | [diff] [blame] | 87 | version of this DLL and copy c:\libjpeg-turbo[64]\bin\jpeg*.dll into the |
DRC | 5559c90 | 2010-10-18 02:21:10 +0000 | [diff] [blame] | 88 | application's install directory to accelerate it. |
DRC | 7e0b499 | 2010-02-25 05:52:44 +0000 | [diff] [blame] | 89 | |
DRC | ab4db65 | 2011-02-18 04:55:08 +0000 | [diff] [blame] | 90 | The version of the libjpeg-turbo DLL distributed in the libjpeg-turbo SDK for |
| 91 | Visual C++ requires the Visual C++ 2008 C run time DLL (msvcr90.dll). |
DRC | 5559c90 | 2010-10-18 02:21:10 +0000 | [diff] [blame] | 92 | msvcr90.dll ships with more recent versions of Windows, but users of older |
| 93 | Windows releases can obtain it from the Visual C++ 2008 Redistributable |
| 94 | Package, which is available as a free download from Microsoft's web site. |
DRC | 0248dd9 | 2010-02-25 06:21:12 +0000 | [diff] [blame] | 95 | |
| 96 | NOTE: Features of libjpeg which require passing a C run time structure, such |
| 97 | as a file handle, from an application to libjpeg will probably not work with |
DRC | ab4db65 | 2011-02-18 04:55:08 +0000 | [diff] [blame] | 98 | the version of the libjpeg-turbo DLL distributed in the libjpeg-turbo SDK for |
| 99 | Visual C++, unless the application is also built to use the Visual C++ 2008 C |
| 100 | run time DLL. In particular, this affects jpeg_stdio_dest() and |
| 101 | jpeg_stdio_src(). |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 102 | |
DRC | 5559c90 | 2010-10-18 02:21:10 +0000 | [diff] [blame] | 103 | Mac applications typically embed their own copies of the libjpeg dylib inside |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 104 | the (hidden) application bundle, so it is not possible to globally replace |
| 105 | libjpeg on OS X systems. If an application uses a shared library version of |
| 106 | libjpeg, then it may be possible to replace the application's version of it. |
DRC | 5559c90 | 2010-10-18 02:21:10 +0000 | [diff] [blame] | 107 | This would generally involve copying libjpeg.*.dylib from libjpeg-turbo into |
| 108 | the appropriate place in the application bundle and using install_name_tool to |
| 109 | repoint the dylib to the new directory. This requires an advanced knowledge of |
| 110 | OS X and would not survive an upgrade or a re-install of the application. |
| 111 | Thus, it is not recommended for most users. |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 112 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 113 | ======================= |
| 114 | Replacing TurboJPEG/IPP |
| 115 | ======================= |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 116 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 117 | libjpeg-turbo is a drop-in replacement for the TurboJPEG/IPP SDK used by |
DRC | ff95aa6 | 2010-06-05 00:22:32 +0000 | [diff] [blame] | 118 | VirtualGL 2.1.x and TurboVNC 0.6 (and prior.) libjpeg-turbo contains a wrapper |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 119 | library (TurboJPEG/OSS) that emulates the TurboJPEG API using libjpeg-turbo |
| 120 | instead of the closed source Intel Performance Primitives. You can replace the |
| 121 | TurboJPEG/IPP package on Linux systems with the libjpeg-turbo package in order |
DRC | ab4db65 | 2011-02-18 04:55:08 +0000 | [diff] [blame] | 122 | to make existing releases of VirtualGL 2.1.x and TurboVNC 0.x use the new codec |
| 123 | at run time. Note that the 64-bit libjpeg-turbo packages contain only 64-bit |
DRC | ff95aa6 | 2010-06-05 00:22:32 +0000 | [diff] [blame] | 124 | binaries, whereas the TurboJPEG/IPP 64-bit packages contained both 64-bit and |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 125 | 32-bit binaries. Thus, to replace a TurboJPEG/IPP 64-bit package, install |
| 126 | both the 64-bit and 32-bit versions of libjpeg-turbo. |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 127 | |
DRC | ff95aa6 | 2010-06-05 00:22:32 +0000 | [diff] [blame] | 128 | You can also build the VirtualGL 2.1.x and TurboVNC 0.6 source code with |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 129 | the libjpeg-turbo SDK instead of TurboJPEG/IPP. It should work identically. |
| 130 | libjpeg-turbo also includes static library versions of TurboJPEG/OSS, which |
DRC | ff95aa6 | 2010-06-05 00:22:32 +0000 | [diff] [blame] | 131 | are used to build TurboVNC 1.0 and later. |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 132 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 133 | ======================================== |
| 134 | Using libjpeg-turbo in Your Own Programs |
| 135 | ======================================== |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 136 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 137 | For the most part, libjpeg-turbo should work identically to libjpeg, so in |
| 138 | most cases, an application can be built against libjpeg and then run against |
DRC | 5559c90 | 2010-10-18 02:21:10 +0000 | [diff] [blame] | 139 | libjpeg-turbo. On Unix systems (including Cygwin), you can build against |
| 140 | libjpeg-turbo instead of libjpeg by setting |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 141 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 142 | CPATH=/opt/libjpeg-turbo/include |
| 143 | and |
| 144 | LIBRARY_PATH=/opt/libjpeg-turbo/{lib} |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 145 | |
DRC | ff95aa6 | 2010-06-05 00:22:32 +0000 | [diff] [blame] | 146 | ({lib} = lib32 or lib64, depending on whether you are building a 32-bit or a |
| 147 | 64-bit application.) |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 148 | |
DRC | 0a1f68e | 2010-02-24 07:24:26 +0000 | [diff] [blame] | 149 | If using MinGW, then set |
| 150 | |
DRC | 3dc1bc2 | 2010-05-10 22:18:10 +0000 | [diff] [blame] | 151 | CPATH=/c/libjpeg-turbo-gcc[64]/include |
DRC | 0a1f68e | 2010-02-24 07:24:26 +0000 | [diff] [blame] | 152 | and |
DRC | 3dc1bc2 | 2010-05-10 22:18:10 +0000 | [diff] [blame] | 153 | LIBRARY_PATH=/c/libjpeg-turbo-gcc[64]/lib |
DRC | 0a1f68e | 2010-02-24 07:24:26 +0000 | [diff] [blame] | 154 | |
| 155 | Building against libjpeg-turbo is useful, for instance, if you want to build an |
| 156 | application that leverages the libjpeg-turbo colorspace extensions (see below.) |
DRC | ab4db65 | 2011-02-18 04:55:08 +0000 | [diff] [blame] | 157 | On Linux and Solaris systems, you would still need to manipulate |
| 158 | LD_LIBRARY_PATH or create appropriate sym links to use libjpeg-turbo at run |
| 159 | time. On such systems, you can pass -R /opt/libjpeg-turbo/{lib} to the linker |
| 160 | to force the use of libjpeg-turbo at run time rather than libjpeg (also useful |
| 161 | if you want to leverage the colorspace extensions), or you can link against the |
DRC | 0a1f68e | 2010-02-24 07:24:26 +0000 | [diff] [blame] | 162 | libjpeg-turbo static library. |
| 163 | |
| 164 | To force a Linux, Solaris, or MinGW application to link against the static |
| 165 | version of libjpeg-turbo, you can use the following linker options: |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 166 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 167 | -Wl,-Bstatic -ljpeg -Wl,-Bdynamic |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 168 | |
DRC | ff95aa6 | 2010-06-05 00:22:32 +0000 | [diff] [blame] | 169 | On OS X, simply add /opt/libjpeg-turbo/lib/libjpeg.a to the linker command |
DRC | 0a1f68e | 2010-02-24 07:24:26 +0000 | [diff] [blame] | 170 | line (this also works on Linux and Solaris.) |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 171 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 172 | To build Visual C++ applications using libjpeg-turbo, add |
DRC | ab4db65 | 2011-02-18 04:55:08 +0000 | [diff] [blame] | 173 | c:\libjpeg-turbo[64]\include to the system or user INCLUDE environment |
| 174 | variable and c:\libjpeg-turbo[64]\lib to the system or user LIB environment |
DRC | 5559c90 | 2010-10-18 02:21:10 +0000 | [diff] [blame] | 175 | variable, and then link against either jpeg.lib (to use the DLL version of |
| 176 | libjpeg-turbo) or jpeg-static.lib (to use the static version of libjpeg-turbo.) |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 177 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 178 | ===================== |
| 179 | Colorspace Extensions |
| 180 | ===================== |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 181 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 182 | libjpeg-turbo includes extensions which allow JPEG images to be compressed |
DRC | 646e5a8 | 2010-11-18 19:55:29 +0000 | [diff] [blame] | 183 | directly from (and decompressed directly to) buffers which use BGR, BGRX, |
| 184 | RGBX, XBGR, and XRGB pixel ordering. This is implemented with six new |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 185 | colorspace constants: |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 186 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 187 | JCS_EXT_RGB /* red/green/blue */ |
| 188 | JCS_EXT_RGBX /* red/green/blue/x */ |
| 189 | JCS_EXT_BGR /* blue/green/red */ |
| 190 | JCS_EXT_BGRX /* blue/green/red/x */ |
| 191 | JCS_EXT_XBGR /* x/blue/green/red */ |
| 192 | JCS_EXT_XRGB /* x/red/green/blue */ |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 193 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 194 | Setting cinfo.in_color_space (compression) or cinfo.out_color_space |
| 195 | (decompression) to one of these values will cause libjpeg-turbo to read the |
| 196 | red, green, and blue values from (or write them to) the appropriate position in |
| 197 | the pixel when YUV conversion is performed. |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 198 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 199 | Your application can check for the existence of these extensions at compile |
| 200 | time with: |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 201 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 202 | #ifdef JCS_EXTENSIONS |
DRC | 101f09a | 2010-02-12 22:52:37 +0000 | [diff] [blame] | 203 | |
DRC | 68fef83 | 2010-02-16 05:29:10 +0000 | [diff] [blame] | 204 | At run time, attempting to use these extensions with a version of libjpeg |
| 205 | that doesn't support them will result in a "Bogus input colorspace" error. |
DRC | 77e3964 | 2010-10-12 03:02:31 +0000 | [diff] [blame] | 206 | |
| 207 | ================================= |
| 208 | libjpeg v7 and v8 API/ABI support |
| 209 | ================================= |
| 210 | |
| 211 | libjpeg v7 and v8 added new features to the API/ABI, and, unfortunately, the |
| 212 | compression and decompression structures were extended in a backward- |
| 213 | incompatible manner to accommodate these features. Thus, programs which are |
| 214 | built to use libjpeg v7 or v8 did not work with libjpeg-turbo, since it is |
| 215 | based on the libjpeg v6b code base. Although libjpeg v7 and v8 are still not |
| 216 | as widely used as v6b, enough programs (including a few Linux distros) have |
| 217 | made the switch that it was desirable to provide support for the libjpeg v7/v8 |
| 218 | API/ABI in libjpeg-turbo. |
| 219 | |
| 220 | Some of the libjpeg v7 and v8 features -- DCT scaling, to name one -- involve |
| 221 | deep modifications to the code which cannot be accommodated by libjpeg-turbo |
| 222 | without either breaking compatibility with libjpeg v6b or producing an |
| 223 | unsupportable mess. In order to fully support libjpeg v8 with all of its |
| 224 | features, we would have to essentially port the SIMD extensions to the libjpeg |
| 225 | v8 code base and maintain two separate code trees. We are hesitant to do this |
| 226 | until/unless the newer libjpeg code bases garner more community support and |
| 227 | involvement and until/unless we have some notion of whether future libjpeg |
| 228 | releases will also be backward-incompatible. |
| 229 | |
DRC | 5559c90 | 2010-10-18 02:21:10 +0000 | [diff] [blame] | 230 | By passing an argument of --with-jpeg7 or --with-jpeg8 to configure, or an |
| 231 | argument of -DWITH_JPEG7=1 or -DWITH_JPEG8=1 to cmake, you can build a version |
DRC | ab4db65 | 2011-02-18 04:55:08 +0000 | [diff] [blame] | 232 | of libjpeg-turbo which emulates the libjpeg v7 or v8 API/ABI, so that programs |
DRC | 5559c90 | 2010-10-18 02:21:10 +0000 | [diff] [blame] | 233 | which are built against libjpeg v7 or v8 can be run with libjpeg-turbo. The |
| 234 | following section describes which libjpeg v7+ features are supported and which |
| 235 | aren't. |
DRC | 77e3964 | 2010-10-12 03:02:31 +0000 | [diff] [blame] | 236 | |
| 237 | libjpeg v7 and v8 Features: |
| 238 | --------------------------- |
| 239 | |
| 240 | Fully supported: |
| 241 | |
| 242 | -- cjpeg: Separate quality settings for luminance and chrominance |
| 243 | Note that the libpjeg v7+ API was extended to accommodate this feature only |
| 244 | for convenience purposes. It has always been possible to implement this |
| 245 | feature with libjpeg v6b (see rdswitch.c for an example.) |
| 246 | |
| 247 | -- cjpeg: 32-bit BMP support |
| 248 | |
| 249 | -- jpegtran: lossless cropping |
| 250 | |
| 251 | -- jpegtran: -perfect option |
| 252 | |
| 253 | -- rdjpgcom: -raw option |
| 254 | |
| 255 | -- rdjpgcom: locale awareness |
| 256 | |
| 257 | |
| 258 | Fully supported when using libjpeg v7/v8 emulation: |
| 259 | |
| 260 | -- libjpeg: In-memory source and destination managers |
| 261 | |
| 262 | |
| 263 | Not supported: |
| 264 | |
| 265 | -- libjpeg: DCT scaling in compressor |
| 266 | cinfo.scale_num and cinfo.scale_denom are silently ignored. |
| 267 | |
| 268 | -- libjpeg: IDCT scaling extensions in decompressor |
| 269 | libjpeg-turbo still supports IDCT scaling with scaling factors of 1/2, 1/4, |
| 270 | and 1/8 (same as libjpeg v6b.) |
| 271 | |
| 272 | -- libjpeg: Fancy downsampling in compressor |
| 273 | cinfo.do_fancy_downsampling is silently ignored. |
| 274 | |
DRC | 77e3964 | 2010-10-12 03:02:31 +0000 | [diff] [blame] | 275 | -- jpegtran: Scaling |
| 276 | Seems to depend on the DCT scaling feature, which isn't supported. |
DRC | ab4db65 | 2011-02-18 04:55:08 +0000 | [diff] [blame] | 277 | |
| 278 | |
| 279 | ******************************************************************************* |
| 280 | ** Performance pitfalls |
| 281 | ******************************************************************************* |
| 282 | |
| 283 | =============== |
| 284 | Restart Markers |
| 285 | =============== |
| 286 | |
| 287 | The optimized Huffman decoder in libjpeg-turbo does not handle restart markers |
| 288 | in a way that makes libjpeg happy, so it is necessary to use the slow Huffman |
| 289 | decoder when decompressing a JPEG image that has restart markers. This can |
| 290 | cause the decompression performance to drop by as much as 20%, but the |
| 291 | performance will still be much much greater than that of libjpeg v6b. Many |
| 292 | consumer packages, such as PhotoShop, use restart markers when generating JPEG |
| 293 | images, so images generated by those programs will experience this issue. |
| 294 | |
| 295 | =============================================== |
| 296 | Fast Integer Forward DCT at High Quality Levels |
| 297 | =============================================== |
| 298 | |
| 299 | The algorithm used by the SIMD-accelerated quantization function cannot produce |
| 300 | correct results whenever the fast integer forward DCT is used along with a JPEG |
| 301 | quality of 98-100. Thus, libjpeg-turbo must use the non-SIMD quantization |
| 302 | function in those cases. This causes performance to drop by as much as 40%. |
| 303 | It is therefore strongly advised that you use the slow integer forward DCT |
| 304 | whenever encoding images with a JPEG quality of 98 or higher. |