Libjpeg turbo
Author: f | 2025-04-25
Unofficial libjpeg-turbo repository focusing on iOS compatibility - libjpeg-turbo/example.c at master aumuell/libjpeg-turbo
libjpeg-turbo/libjpeg-turbo: Main libjpeg-turbo
Build, their current values, and a help string describing what they do.Installing libjpeg-turboYou can use the build system to install libjpeg-turbo (as opposed to creating an installer package.) To do this, run make install or nmake install (or build the “install” target in the Visual Studio IDE.) Running make uninstall or nmake uninstall (or building the “uninstall” target in the Visual Studio IDE) will uninstall libjpeg-turbo.The CMAKE_INSTALL_PREFIX CMake variable can be modified in order to install libjpeg-turbo into a directory of your choosing. If you don't specify CMAKE_INSTALL_PREFIX, then the default is:c:\libjpeg-turbo Visual Studio 32-bit buildc:\libjpeg-turbo64 Visual Studio 64-bit buildc:\libjpeg-turbo-gcc MinGW 32-bit buildc:\libjpeg-turbo-gcc64 MinGW 64-bit build/opt/libjpeg-turbo Un*xThe default value of CMAKE_INSTALL_PREFIX causes the libjpeg-turbo files to be installed with a directory structure resembling that of the official libjpeg-turbo binary packages. Changing the value of CMAKE_INSTALL_PREFIX (for instance, to /usr/local) causes the libjpeg-turbo files to be installed with a directory structure that conforms to GNU standards.The CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_DATAROOTDIR, CMAKE_INSTALL_DOCDIR, CMAKE_INSTALL_INCLUDEDIR, CMAKE_INSTALL_JAVADIR, CMAKE_INSTALL_LIBDIR, and CMAKE_INSTALL_MANDIR CMake variables allow a finer degree of control over where specific files in the libjpeg-turbo distribution should be installed. These directory variables can either be specified as absolute paths or as paths relative to CMAKE_INSTALL_PREFIX (for instance, setting CMAKE_INSTALL_DOCDIR to doc would cause the documentation to be installed in ${CMAKE_INSTALL_PREFIX}/doc.) If a directory variable contains the name of another directory variable in angle brackets, then its final value will depend on the final value of that other variable. For instance, the default value of CMAKE_INSTALL_MANDIR is /man.Creating Distribution PackagesThe following commands can be used to create various types of distribution packages:Linuxmake rpmCreate Red Hat-style binary RPM package. Requires RPM v4 or later.make srpmThis runs make dist to create a pristine source tarball, then creates a Red Hat-style source RPM package from the tarball. Requires RPM v4 or Later.make debCreate Debian-style binary package. Requires dpkg.Macmake dmgCreate Mac package/disk image. This requires pkgbuild and productbuild, which are installed by default on OS X/macOS 10.7 and later.In order to create a Mac package/disk image that contains universal x86-64/Arm binaries, set the following CMake variable:SECONDARY_BUILD: Directory containing a cross-compiled x86-64 or Armv8 (64-bit) iOS or macOS build of libjpeg-turbo to include in the universal binariesYou should first use CMake to configure the cross-compiled x86-64 or Armv8 secondary build of libjpeg-turbo (see “Building libjpeg-turbo for iOS” above, if applicable) in a build directory that matches the one specified in the aforementioned CMake variable. Next, configure the primary (native) build of libjpeg-turbo as an out-of-tree build, specifying the aforementioned CMake variable, and build it. Once the primary build has been built, run make dmg from the build directory. The packaging system will build the secondary build, use lipo to combine it with the primary build into a single set of universal binaries, then package the universal binaries.WindowsIf using NMake:cd {build_directory}nmake installerIf using MinGW:cd {build_directory}make installerIf using the Visual Studio IDE, build the “installer” target.The installer package (libjpeg-turbo-{version}[-gcc|-vc][64].exe) will be located under {build_directory}. If building using the Visual Studio IDE, then the installer package will be located in a subdirectory with the same name as the configuration you built (such as {build_directory}\Debug\ or {build_directory}\Release).Building a Windows installer requires the Nullsoft Install System. makensis.exe should be in your PATH.Regression testingThe most common way to test libjpeg-turbo is by invoking make test (Un*x) or nmake test (Windows command line) or by building the “RUN_TESTS” target (Visual Studio IDE), once the build has completed. This runs a series of tests to ensure that mathematical compatibility has been maintained between libjpeg-turbo and libjpeg v6b. This also invokes the TurboJPEG unit tests, which ensure that the colorspace extensions, YUVGitHub - libjpeg-turbo/libjpeg-turbo: Main libjpeg-turbo
(usually /usr/bin.) Next, execute the following commands:cd {build_directory}cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \ -DCMAKE_INSTALL_PREFIX={install_path} \ [additional CMake flags] {source_directory}make{install_path} is the path under which the libjpeg-turbo binaries should be installed.64-bit MinGW Build on Un*x (including Mac and Cygwin)Create a file called toolchain.cmake under {build_directory}, with the following contents:set(CMAKE_SYSTEM_NAME Windows)set(CMAKE_SYSTEM_PROCESSOR AMD64)set(CMAKE_C_COMPILER {mingw_binary_path}/x86_64-w64-mingw32-gcc)set(CMAKE_RC_COMPILER {mingw_binary_path}/x86_64-w64-mingw32-windres){mingw_binary_path} is the directory under which the MinGW binaries are located (usually /usr/bin.) Next, execute the following commands:cd {build_directory}cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \ -DCMAKE_INSTALL_PREFIX={install_path} \ [additional CMake flags] {source_directory}make{install_path} is the path under which the libjpeg-turbo binaries should be installed.Building libjpeg-turbo for iOSiOS platforms, such as the iPhone and iPad, use Arm processors, and all currently supported models include Neon instructions. Thus, they can take advantage of libjpeg-turbo's SIMD extensions to significantly accelerate JPEG compression/decompression. This section describes how to build libjpeg-turbo for these platforms.Armv8 (64-bit)Xcode 5 or later required, Xcode 6.3.x or later recommendedThe following script demonstrates how to build libjpeg-turbo to run on the iPhone 5S/iPad Mini 2/iPad Air and newer.IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platformIOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk)export CFLAGS="-Wall -miphoneos-version-min=8.0 -funwind-tables"cd {build_directory}cmake -G"Unix Makefiles" \ -DCMAKE_C_COMPILER=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang \ -DCMAKE_OSX_ARCHITECTURES=arm64 \ -DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \ [additional CMake flags] {source_directory}makeReplace iPhoneOS with iPhoneSimulator and -miphoneos-version-min with -miphonesimulator-version-min to build libjpeg-turbo for the iOS simulator on Macs with Apple silicon CPUs.Building libjpeg-turbo for AndroidBuilding libjpeg-turbo for Android platforms requires v13b or later of the Android NDK.Armv7 (32-bit)NDK r19 or later with Clang recommendedThe following is a general recipe script that can be modified for your specific needs.# Set these variables to suit your needsNDK_PATH={full path to the NDK directory-- for example, /opt/android/android-ndk-r16b}TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r16b and earlier, and "clang" must be used with NDK r17c and later}ANDROID_VERSION={the minimum version of Android to support-- for example, "16", "19", etc.}cd {build_directory}cmake -G"Unix Makefiles" \ -DANDROID_ABI=armeabi-v7a \ -DANDROID_ARM_MODE=arm \ -DANDROID_PLATFORM=android-${ANDROID_VERSION} \ -DANDROID_TOOLCHAIN=${TOOLCHAIN} \ -DCMAKE_ASM_FLAGS="--target=arm-linux-androideabi${ANDROID_VERSION}" \ -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \ [additional. Unofficial libjpeg-turbo repository focusing on iOS compatibility - libjpeg-turbo/example.c at master aumuell/libjpeg-turbolibjpeg-turbo/libjpeg-turbo: Main libjpeg-turbo repository - GitHub
For 32-bit and 64-bit builds.You can then open ALL_BUILD.vcproj in Visual Studio and build one of the configurations in that project (“Debug”, “Release”, etc.) to generate a full build of libjpeg-turbo.This will generate the following files under {build_directory}:{configuration}/jpeg-static.lib Static link library for the libjpeg API{configuration}/jpeg{version}.dll DLL for the libjpeg API{configuration}/jpeg.lib Import library for the libjpeg API{configuration}/turbojpeg-static.lib Static link library for the TurboJPEG API{configuration}/turbojpeg.dll DLL for the TurboJPEG API{configuration}/turbojpeg.lib Import library for the TurboJPEG API{configuration} is Debug, Release, RelWithDebInfo, or MinSizeRel, depending on the configuration you built in the IDE, and {version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.MinGWNOTE: This assumes that you are building on a Windows machine using the MSYS environment. If you are cross-compiling on a Un*x platform (including Mac and Cygwin), then see “Build Recipes” below.cd {build_directory}cmake -G"MSYS Makefiles" [additional CMake flags] {source_directory}makeThis will generate the following files under {build_directory}:libjpeg.a Static link library for the libjpeg APIlibjpeg-{version}.dll DLL for the libjpeg APIlibjpeg.dll.a Import library for the libjpeg APIlibturbojpeg.a Static link library for the TurboJPEG APIlibturbojpeg.dll DLL for the TurboJPEG APIlibturbojpeg.dll.a Import library for the TurboJPEG API{version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.Debug BuildAdd -DCMAKE_BUILD_TYPE=Debug to the CMake command line. Or, if building with NMake, remove -DCMAKE_BUILD_TYPE=Release (Debug builds are the default with NMake.)libjpeg v7 or v8 API/ABI EmulationAdd -DWITH_JPEG7=1 to the CMake command line to build a version of libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add -DWITH_JPEG8=1 to the CMake command line to build a version of libjpeg-turbo that is API/ABI-compatible with libjpeg v8. See README.md for more information about libjpeg v7 and v8 emulation.Arithmetic Coding SupportSince the patent on arithmetic coding has expired, this functionality has been included in this release of libjpeg-turbo. libjpeg-turbo's Operating systems, maintained by an informal independent group and iterating occasionally. It tries to balance encoding speed, quality, and file size. Libjpeg-turbo is intended to be a higher performance replacement for libjpeg, and it is in fact the default library for most Linux distributions. “Performance” in this scenario means using less CPU time during encoding and decoding. Libjpeg-turbo forked libjpeg in 2010 and claims to be “generally 2-6x as fast as libjpeg, all else being equal.” MozJPEG is intended for a specific use case: images on the web. Mozilla forked libjpeg-turbo in 2014 so they could focus on reducing file size in order to reduce bandwidth and get images on the web to load faster. It does this through progressive coding and trellis quantization that sacrifices some encoding time, in the range of 4-7x. You can read the libjpeg-turbo creator’s thoughts on MozJPEG and why their two projects’ goals are incompatible. Guetzli is what brings us here today, and it is focused on image quality. Google uses a new perceptual psychovisual model to decide where image quality loss will be the least noticeable. It sacrifices encoding time, on the order of 800-1000x slower than MozJPEG. Google claims file byte size is about 20-30% smaller than libjpeg, which is comparable to MozJPEG. Google Guetzli vs MozJPEG Head-to-Head Comparison Test Computer Overview MacBook Air (13-inch, Early 2015) Processor: 1.6 GHz Intel Core i5 Memory: 4 GB 1600 MHz DDR3 Encoders Mozilla MozJPEG Google Guetzli Methodology I’m going to export product images from Photoshop as quality 100 JPG and then run each through both MozJPEG and Guetzli at quality 90. I’ll give before-and-after images for quality comparison, record CPU encoding time, and compare file sizes. Commands: $ time mozcjpeg -quality 90 -progressive [input] > [output] $ time guetzli --quality 90 [input] [output] I’llReleases libjpeg-turbo/libjpeg-turbo - GitHub
Can be adapted to the CMake GUI as well.Un*xThe following procedure will build libjpeg-turbo on Unix and Unix-like systems. (On Solaris, this generates a 32-bit build. See “Build Recipes” below for 64-bit build instructions.)cd {build_directory}cmake -G"Unix Makefiles" [additional CMake flags] {source_directory}makeThis will generate the following files under {build_directory}:libjpeg.a Static link library for the libjpeg APIlibjpeg.so.{version} (Linux, Unix) libjpeg.{version}.dylib (Mac) cygjpeg-{version}.dll (Cygwin) Shared library for the libjpeg APIBy default, {version} is 62.2.0, 7.2.0, or 8.1.2, depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled. If using Cygwin, {version} is 62, 7, or 8.libjpeg.so (Linux, Unix) libjpeg.dylib (Mac) Development symlink for the libjpeg APIlibjpeg.dll.a (Cygwin) Import library for the libjpeg APIlibturbojpeg.a Static link library for the TurboJPEG APIlibturbojpeg.so.0.2.0 (Linux, Unix) libturbojpeg.0.2.0.dylib (Mac) cygturbojpeg-0.dll (Cygwin) Shared library for the TurboJPEG APIlibturbojpeg.so (Linux, Unix) libturbojpeg.dylib (Mac) Development symlink for the TurboJPEG APIlibturbojpeg.dll.a (Cygwin) Import library for the TurboJPEG APIVisual C++ (Command Line)cd {build_directory}cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release [additional CMake flags] {source_directory}nmakeThis will build either a 32-bit or a 64-bit version of libjpeg-turbo, depending on which version of cl.exe is in the PATH.The following files will be generated under {build_directory}:jpeg-static.lib Static link library for the libjpeg APIjpeg{version}.dll DLL for the libjpeg APIjpeg.lib Import library for the libjpeg APIturbojpeg-static.lib Static link library for the TurboJPEG APIturbojpeg.dll DLL for the TurboJPEG APIturbojpeg.lib Import library for the TurboJPEG API{version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.Visual C++ (IDE)Choose the appropriate CMake generator option for your version of Visual Studio (run cmake with no arguments for a list of available generators.) For instance:cd {build_directory}cmake -G"Visual Studio 10" [additional CMake flags] {source_directory}NOTE: Add “Win64” to the generator name (for example, “Visual Studio 10 Win64”) to build a 64-bit version of libjpeg-turbo. A separate build directory must be usedDownload libjpeg-turbo-.tar.gz.sig (libjpeg-turbo)
Then add the appropriate compiler and SDK directories to the INCLUDE, LIB, and PATH environment variables. This is generally accomplished by executing vcvars32.bat or vcvars64.bat, which are located in the same directory as the compiler.If built with Visual C++ 2015 or later, the libjpeg-turbo static libraries cannot be used with earlier versions of Visual C++, and vice versa.The libjpeg API DLL (jpeg{version}.dll) will depend on the C run-time DLLs corresponding to the version of Visual C++ that was used to build it.... OR ...MinGWMSYS2 or tdm-gcc recommended if building on a Windows machine. Both distributions install a Start Menu link that can be used to launch a command prompt with the appropriate compiler paths automatically set.If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This can be downloaded from using JDK 11 or later, CMake 3.10.x or later must also be used.Sub-Project BuildsThe libjpeg-turbo build system does not support being included as a sub-project using the CMake add_subdirectory() function. Use the CMake ExternalProject_Add() function instead.Out-of-Tree BuildsBinary objects, libraries, and executables are generated in the directory from which CMake is executed (the “binary directory”), and this directory need not necessarily be the same as the libjpeg-turbo source directory. You can create multiple independent binary directories, in which different versions of libjpeg-turbo can be built from the same source tree using different compilers or settings. In the sections below, {build_directory} refers to the binary directory, whereas {source_directory} refers to the libjpeg-turbo source directory. For in-tree builds, these directories are the same.NinjaIf using Ninja, then replace make or nmake with ninja, and replace the CMake generator (specified with the -G option) with Ninja, in all of the procedures and recipes below.Build ProcedureNOTE: The build procedures below assume that CMake is invoked from the command line, but all of these procedures. Unofficial libjpeg-turbo repository focusing on iOS compatibility - libjpeg-turbo/example.c at master aumuell/libjpeg-turbolomorage/libjpeg-turbo: libjpeg-turbo - GitHub
Build RequirementsAll SystemsCMake v2.8.12 or laterNASM or Yasm (if building x86 or x86-64 SIMD extensions)If using NASM, 2.13 or later is required.If using Yasm, 1.2.0 or later is required.NASM 2.15 or later is required if building libjpeg-turbo with Intel Control-flow Enforcement Technology (CET) support.If building on macOS, NASM or Yasm can be obtained from MacPorts or Homebrew.NOTE: Currently, if it is desirable to hide the SIMD function symbols in Mac executables or shared libraries that statically link with libjpeg-turbo, then NASM 2.14 or later or Yasm must be used when building libjpeg-turbo.If NASM or Yasm is not in your PATH, then you can specify the full path to the assembler by using either the CMAKE_ASM_NASM_COMPILER CMake variable or the ASM_NASM environment variable. On Windows, use forward slashes rather than backslashes in the path (for example, c:/nasm/nasm.exe).NASM and Yasm are located in the CRB (Code Ready Builder) or PowerTools repository on Red Hat Enterprise Linux 8+ and derivatives, which is not enabled by default.Un*x Platforms (including Linux, Mac, FreeBSD, Solaris, and Cygwin)GCC v4.1 (or later) or Clang recommended for best performanceIf building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is required. Most modern Linux distributions, as well as Solaris 10 and later, include JDK or OpenJDK. For other systems, you can obtain the Oracle Java Development Kit from using JDK 11 or later, CMake 3.10.x or later must also be used.WindowsMicrosoft Visual C++ 2005 or laterIf you don't already have Visual C++, then the easiest way to get it is by installing Visual Studio Community Edition, which includes everything necessary to build libjpeg-turbo.You can also download and install the standalone Windows SDK (for Windows 7 or later), which includes command-line versions of the 32-bit and 64-bit Visual C++ compilers.If you intend to build libjpeg-turbo from the command line,Comments
Build, their current values, and a help string describing what they do.Installing libjpeg-turboYou can use the build system to install libjpeg-turbo (as opposed to creating an installer package.) To do this, run make install or nmake install (or build the “install” target in the Visual Studio IDE.) Running make uninstall or nmake uninstall (or building the “uninstall” target in the Visual Studio IDE) will uninstall libjpeg-turbo.The CMAKE_INSTALL_PREFIX CMake variable can be modified in order to install libjpeg-turbo into a directory of your choosing. If you don't specify CMAKE_INSTALL_PREFIX, then the default is:c:\libjpeg-turbo Visual Studio 32-bit buildc:\libjpeg-turbo64 Visual Studio 64-bit buildc:\libjpeg-turbo-gcc MinGW 32-bit buildc:\libjpeg-turbo-gcc64 MinGW 64-bit build/opt/libjpeg-turbo Un*xThe default value of CMAKE_INSTALL_PREFIX causes the libjpeg-turbo files to be installed with a directory structure resembling that of the official libjpeg-turbo binary packages. Changing the value of CMAKE_INSTALL_PREFIX (for instance, to /usr/local) causes the libjpeg-turbo files to be installed with a directory structure that conforms to GNU standards.The CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_DATAROOTDIR, CMAKE_INSTALL_DOCDIR, CMAKE_INSTALL_INCLUDEDIR, CMAKE_INSTALL_JAVADIR, CMAKE_INSTALL_LIBDIR, and CMAKE_INSTALL_MANDIR CMake variables allow a finer degree of control over where specific files in the libjpeg-turbo distribution should be installed. These directory variables can either be specified as absolute paths or as paths relative to CMAKE_INSTALL_PREFIX (for instance, setting CMAKE_INSTALL_DOCDIR to doc would cause the documentation to be installed in ${CMAKE_INSTALL_PREFIX}/doc.) If a directory variable contains the name of another directory variable in angle brackets, then its final value will depend on the final value of that other variable. For instance, the default value of CMAKE_INSTALL_MANDIR is /man.Creating Distribution PackagesThe following commands can be used to create various types of distribution packages:Linuxmake rpmCreate Red Hat-style binary RPM package. Requires RPM v4 or later.make srpmThis runs make dist to create a pristine source tarball, then creates a Red Hat-style source RPM package from the tarball. Requires RPM v4 or
2025-03-28Later.make debCreate Debian-style binary package. Requires dpkg.Macmake dmgCreate Mac package/disk image. This requires pkgbuild and productbuild, which are installed by default on OS X/macOS 10.7 and later.In order to create a Mac package/disk image that contains universal x86-64/Arm binaries, set the following CMake variable:SECONDARY_BUILD: Directory containing a cross-compiled x86-64 or Armv8 (64-bit) iOS or macOS build of libjpeg-turbo to include in the universal binariesYou should first use CMake to configure the cross-compiled x86-64 or Armv8 secondary build of libjpeg-turbo (see “Building libjpeg-turbo for iOS” above, if applicable) in a build directory that matches the one specified in the aforementioned CMake variable. Next, configure the primary (native) build of libjpeg-turbo as an out-of-tree build, specifying the aforementioned CMake variable, and build it. Once the primary build has been built, run make dmg from the build directory. The packaging system will build the secondary build, use lipo to combine it with the primary build into a single set of universal binaries, then package the universal binaries.WindowsIf using NMake:cd {build_directory}nmake installerIf using MinGW:cd {build_directory}make installerIf using the Visual Studio IDE, build the “installer” target.The installer package (libjpeg-turbo-{version}[-gcc|-vc][64].exe) will be located under {build_directory}. If building using the Visual Studio IDE, then the installer package will be located in a subdirectory with the same name as the configuration you built (such as {build_directory}\Debug\ or {build_directory}\Release).Building a Windows installer requires the Nullsoft Install System. makensis.exe should be in your PATH.Regression testingThe most common way to test libjpeg-turbo is by invoking make test (Un*x) or nmake test (Windows command line) or by building the “RUN_TESTS” target (Visual Studio IDE), once the build has completed. This runs a series of tests to ensure that mathematical compatibility has been maintained between libjpeg-turbo and libjpeg v6b. This also invokes the TurboJPEG unit tests, which ensure that the colorspace extensions, YUV
2025-04-05(usually /usr/bin.) Next, execute the following commands:cd {build_directory}cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \ -DCMAKE_INSTALL_PREFIX={install_path} \ [additional CMake flags] {source_directory}make{install_path} is the path under which the libjpeg-turbo binaries should be installed.64-bit MinGW Build on Un*x (including Mac and Cygwin)Create a file called toolchain.cmake under {build_directory}, with the following contents:set(CMAKE_SYSTEM_NAME Windows)set(CMAKE_SYSTEM_PROCESSOR AMD64)set(CMAKE_C_COMPILER {mingw_binary_path}/x86_64-w64-mingw32-gcc)set(CMAKE_RC_COMPILER {mingw_binary_path}/x86_64-w64-mingw32-windres){mingw_binary_path} is the directory under which the MinGW binaries are located (usually /usr/bin.) Next, execute the following commands:cd {build_directory}cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \ -DCMAKE_INSTALL_PREFIX={install_path} \ [additional CMake flags] {source_directory}make{install_path} is the path under which the libjpeg-turbo binaries should be installed.Building libjpeg-turbo for iOSiOS platforms, such as the iPhone and iPad, use Arm processors, and all currently supported models include Neon instructions. Thus, they can take advantage of libjpeg-turbo's SIMD extensions to significantly accelerate JPEG compression/decompression. This section describes how to build libjpeg-turbo for these platforms.Armv8 (64-bit)Xcode 5 or later required, Xcode 6.3.x or later recommendedThe following script demonstrates how to build libjpeg-turbo to run on the iPhone 5S/iPad Mini 2/iPad Air and newer.IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platformIOS_SYSROOT=($IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk)export CFLAGS="-Wall -miphoneos-version-min=8.0 -funwind-tables"cd {build_directory}cmake -G"Unix Makefiles" \ -DCMAKE_C_COMPILER=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang \ -DCMAKE_OSX_ARCHITECTURES=arm64 \ -DCMAKE_OSX_SYSROOT=${IOS_SYSROOT[0]} \ [additional CMake flags] {source_directory}makeReplace iPhoneOS with iPhoneSimulator and -miphoneos-version-min with -miphonesimulator-version-min to build libjpeg-turbo for the iOS simulator on Macs with Apple silicon CPUs.Building libjpeg-turbo for AndroidBuilding libjpeg-turbo for Android platforms requires v13b or later of the Android NDK.Armv7 (32-bit)NDK r19 or later with Clang recommendedThe following is a general recipe script that can be modified for your specific needs.# Set these variables to suit your needsNDK_PATH={full path to the NDK directory-- for example, /opt/android/android-ndk-r16b}TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r16b and earlier, and "clang" must be used with NDK r17c and later}ANDROID_VERSION={the minimum version of Android to support-- for example, "16", "19", etc.}cd {build_directory}cmake -G"Unix Makefiles" \ -DANDROID_ABI=armeabi-v7a \ -DANDROID_ARM_MODE=arm \ -DANDROID_PLATFORM=android-${ANDROID_VERSION} \ -DANDROID_TOOLCHAIN=${TOOLCHAIN} \ -DCMAKE_ASM_FLAGS="--target=arm-linux-androideabi${ANDROID_VERSION}" \ -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \ [additional
2025-04-23For 32-bit and 64-bit builds.You can then open ALL_BUILD.vcproj in Visual Studio and build one of the configurations in that project (“Debug”, “Release”, etc.) to generate a full build of libjpeg-turbo.This will generate the following files under {build_directory}:{configuration}/jpeg-static.lib Static link library for the libjpeg API{configuration}/jpeg{version}.dll DLL for the libjpeg API{configuration}/jpeg.lib Import library for the libjpeg API{configuration}/turbojpeg-static.lib Static link library for the TurboJPEG API{configuration}/turbojpeg.dll DLL for the TurboJPEG API{configuration}/turbojpeg.lib Import library for the TurboJPEG API{configuration} is Debug, Release, RelWithDebInfo, or MinSizeRel, depending on the configuration you built in the IDE, and {version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.MinGWNOTE: This assumes that you are building on a Windows machine using the MSYS environment. If you are cross-compiling on a Un*x platform (including Mac and Cygwin), then see “Build Recipes” below.cd {build_directory}cmake -G"MSYS Makefiles" [additional CMake flags] {source_directory}makeThis will generate the following files under {build_directory}:libjpeg.a Static link library for the libjpeg APIlibjpeg-{version}.dll DLL for the libjpeg APIlibjpeg.dll.a Import library for the libjpeg APIlibturbojpeg.a Static link library for the TurboJPEG APIlibturbojpeg.dll DLL for the TurboJPEG APIlibturbojpeg.dll.a Import library for the TurboJPEG API{version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.Debug BuildAdd -DCMAKE_BUILD_TYPE=Debug to the CMake command line. Or, if building with NMake, remove -DCMAKE_BUILD_TYPE=Release (Debug builds are the default with NMake.)libjpeg v7 or v8 API/ABI EmulationAdd -DWITH_JPEG7=1 to the CMake command line to build a version of libjpeg-turbo that is API/ABI-compatible with libjpeg v7. Add -DWITH_JPEG8=1 to the CMake command line to build a version of libjpeg-turbo that is API/ABI-compatible with libjpeg v8. See README.md for more information about libjpeg v7 and v8 emulation.Arithmetic Coding SupportSince the patent on arithmetic coding has expired, this functionality has been included in this release of libjpeg-turbo. libjpeg-turbo's
2025-04-07