From d04cff3d6cc7578e9a1f35c531d12d23d7728d9b Mon Sep 17 00:00:00 2001 From: Kornel Date: Mon, 23 Dec 2024 00:18:20 +0000 Subject: [PATCH] Normalize whitespace and other merge details --- .gitattributes | 3 +- BUILDING.md | 3 +- BUILDING.txt | 902 --------------------------------------- CMakeLists.txt | 46 +- cdjpeg.h | 4 +- cjpeg.c | 8 +- java/CMakeLists.txt | 2 +- jcapistd.c | 1 - jcarith.c | 20 +- jccoefct.c | 30 +- jcdctmgr.c | 120 +++--- jchuff.h | 10 +- jcinit.c | 10 +- jcmaster.c | 109 +++-- jcmaster.h | 8 +- jcparam.c | 81 ++-- jcphuff.c | 96 ++--- jctrans.c | 54 +-- jdapimin.c | 36 +- jdatadst.c | 38 +- jerror.h | 72 ++-- jpegint.h | 77 ++-- jpeglib.h | 189 ++++---- jpegtran.c | 8 +- jversion.h.in | 1 - rdswitch.c | 59 +-- release/Welcome.rtf.in | 2 +- release/makemacpkg.in | 2 +- sharedlib/CMakeLists.txt | 5 +- simd/CMakeLists.txt | 2 +- turbojpeg.c | 1 - usage.txt | 7 +- win/jpeg62-memsrcdst.def | 210 ++++----- win/jpeg62.def | 206 ++++----- win/jpeg7-memsrcdst.def | 214 +++++----- win/jpeg7.def | 210 ++++----- win/jpeg8.def | 216 +++++----- 37 files changed, 1100 insertions(+), 1962 deletions(-) delete mode 100644 BUILDING.txt diff --git a/.gitattributes b/.gitattributes index 299e0032..46de94f5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,5 @@ -/.travis.yml export-ignore /appveyor.yml export-ignore -/ci export-ignore /.gitattributes export-ignore +/.github export-ignore *.ppm binary /ChangeLog.md conflict-marker-size=8 diff --git a/BUILDING.md b/BUILDING.md index 9e0d7150..cd58f706 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -47,7 +47,8 @@ Build Requirements If you don't already have Visual C++, then the easiest way to get it is by installing - [Visual Studio Community Edition](https://visualstudio.microsoft.com). + [Visual Studio Community Edition](https://visualstudio.microsoft.com), + 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 diff --git a/BUILDING.txt b/BUILDING.txt deleted file mode 100644 index 9309628e..00000000 --- a/BUILDING.txt +++ /dev/null @@ -1,902 +0,0 @@ -******************************************************************************* -** Building on Un*x Platforms (including Cygwin and OS X) -******************************************************************************* - - -================== -Build Requirements -================== - --- pkg-config --- autoconf 2.56 or later --- automake 1.7 or later --- libtool 1.4 or later - * If using Xcode 4.3 or later on OS X, autoconf and automake are no longer - provided. The easiest way to obtain them is from MacPorts - (http://www.macports.org/). - --- NASM or YASM (if building x86 or x86-64 SIMD extensions) - * NASM 0.98, or 2.01 or later is required for an x86 build (0.99 and 2.00 do - not work properly with libjpeg-turbo's x86 SIMD code.) - * NASM 2.00 or later is required for an x86-64 build. - * NASM 2.07, or 2.11.09 or later is required for an x86-64 Mac build - (2.11.08 does not work properly with libjpeg-turbo's x86-64 SIMD code when - building macho64 objects.) NASM or YASM can be obtained from MacPorts - (http://www.macports.org/). - - The binary RPMs released by the NASM project do not work on older Linux - systems, such as Red Hat Enterprise Linux 4. On such systems, you can - easily build and install NASM from a source RPM by downloading one of the - SRPMs from - - http://www.nasm.us/pub/nasm/releasebuilds - - and executing the following as root: - - ARCH=`uname -m` - rpmbuild --rebuild nasm-{version}.src.rpm - rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-{version}.$ARCH.rpm - - NOTE: the NASM build will fail if texinfo is not installed. - --- GCC v4.1 or later recommended for best performance - * Beginning with Xcode 4, Apple stopped distributing GCC and switched to - the LLVM compiler. Xcode v4.0 through v4.6 provides a GCC front end - called LLVM-GCC. Unfortunately, as of this writing, neither LLVM-GCC nor - the LLVM (clang) compiler produces optimal performance with libjpeg-turbo. - Building mozjpeg with LLVM-GCC v4.2 results in a 10% performance - degradation when compressing using 64-bit code, relative to building - libjpeg-turbo with GCC v4.2. Building libjpeg-turbo with LLVM (clang) - results in a 20% performance degradation when compressing using 64-bit - code, relative to building libjpeg-turbo with GCC v4.2. If you are - running Snow Leopard or earlier, it is suggested that you continue to use - Xcode v3.2.6, which provides GCC v4.2. If you are using Lion or later, it - is suggested that you install Apple GCC v4.2 or GCC v5 through MacPorts. - --- If building the TurboJPEG Java wrapper, JDK or OpenJDK 1.5 or later is - required. Some systems, such as Solaris 10 and later and Red Hat Enterprise - Linux 5 and later, have this pre-installed. On OS X 10.5 and later, it will - be necessary to install the Java Developer Package, which can be downloaded - from http://developer.apple.com/downloads (Apple ID required.) For systems - that do not have a JDK installed, you can obtain the Oracle Java Development - Kit from http://www.java.com. - - -================== -Out-of-Tree Builds -================== - -Binary objects, libraries, and executables are generated in the same directory -from which configure was executed (the "binary directory"), and this directory -need not necessarily be the same as the mozjpeg source directory. You -can create multiple independent binary directories, in which different versions -of mozjpeg 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 mozjpeg source -directory. For in-tree builds, these directories are the same. - - -================ -Building mozjpeg -================ - -The following procedure will build mozjpeg on Linux, FreeBSD, Cygwin, and -Solaris/x86 systems (on Solaris, this generates a 32-bit library. See below -for 64-bit build instructions.) - -Simple Release tar.gz Source Build ----------------------------------- - - cd {source_directory} - ./configure [additional configure flags] - make - -Non-Release Source Build (e.g. GitHub clone) --------------------------------------------- - - cd {source_directory} - autoreconf -fiv - cd {build_directory} - sh {source_directory}/configure [additional configure flags] - make - -NOTE: Running autoreconf in the source directory is not necessary if building -mozjpeg from one of the official release tarballs. - -This will generate the following files under .libs/ - - libjpeg.a - Static link library for the libjpeg API - - libjpeg.so.{version} (Linux, Unix) - libjpeg.{version}.dylib (OS X) - cygjpeg-{version}.dll (Cygwin) - Shared library for the libjpeg API - - By 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 (OS X) - Development symlink for the libjpeg API - - libjpeg.dll.a (Cygwin) - Import library for the libjpeg API - - libturbojpeg.a - Static link library for the TurboJPEG API - - libturbojpeg.so.0.1.0 (Linux, Unix) - libturbojpeg.0.1.0.dylib (OS X) - cygturbojpeg-0.dll (Cygwin) - Shared library for the TurboJPEG API - - libturbojpeg.so (Linux, Unix) - libturbojpeg.dylib (OS X) - Development symlink for the TurboJPEG API - - libturbojpeg.dll.a (Cygwin) - Import library for the TurboJPEG API - - -libjpeg v7 or v8 API/ABI Emulation ----------------------------------- - -Add --with-jpeg7 to the configure command line to build a version of -mozjpeg that is API/ABI-compatible with libjpeg v7. Add --with-jpeg8 to -the configure command to build a version of mozjpeg that is -API/ABI-compatible with libjpeg v8. See README-turbo.txt for more information -on libjpeg v7 and v8 emulation. - - -In-Memory Source/Destination Managers -------------------------------------- - -When using libjpeg v6b or v7 API/ABI emulation, add --without-mem-srcdst to the -configure command line to build a version of mozjpeg that lacks the -jpeg_mem_src() and jpeg_mem_dest() functions. These functions were not part of -the original libjpeg v6b and v7 APIs, so removing them ensures strict -conformance with those APIs. See README-turbo.txt for more information. - - -Arithmetic Coding Support -------------------------- - -Since the patent on arithmetic coding has expired, this functionality has been -included in this release of mozjpeg. mozjpeg's implementation is -based on the implementation in libjpeg v8, but it works when emulating libjpeg -v7 or v6b as well. The default is to enable both arithmetic encoding and -decoding, but those who have philosophical objections to arithmetic coding can -add --without-arith-enc or --without-arith-dec to the configure command line to -disable encoding or decoding (respectively.) - - -TurboJPEG Java Wrapper ----------------------- -Add --with-java to the configure command line to incorporate an optional Java -Native Interface wrapper into the TurboJPEG shared library and build the Java -front-end classes to support it. This allows the TurboJPEG shared library to -be used directly from Java applications. See java/README for more details. - -You can set the JAVAC, JAR, and JAVA configure variables to specify -alternate commands for javac, jar, and java (respectively.) You can also -set the JAVACFLAGS configure variable to specify arguments that should be -passed to the Java compiler when building the front-end classes, and JNI_CFLAGS -to specify arguments that should be passed to the C compiler when building the -JNI wrapper. Run 'configure --help' for more details. - - -================== -Installing mozjpeg -================== - -If you intend to install these libraries and the associated header files, then -replace 'make' in the instructions above with - - make install prefix={base dir} libdir={library directory} - -For example, - - make install prefix=/usr/local libdir=/usr/local/lib64 - -will install the header files in /usr/local/include and the library files in -/usr/local/lib64. If 'prefix' and 'libdir' are not specified, then the default -is to install the header files in /opt/mozjpeg/include and the library -files in /opt/mozjpeg/lib32 (32-bit) or /opt/mozjpeg/lib64 -(64-bit.) - -NOTE: You can specify a prefix of /usr and a libdir of, for instance, -/usr/lib64 to overwrite the system's version of libjpeg. If you do this, -however, then be sure to BACK UP YOUR SYSTEM'S INSTALLATION OF LIBJPEG before -overwriting it. It is recommended that you instead install mozjpeg into -a non-system directory and manipulate the LD_LIBRARY_PATH or create symlinks -to force applications to use mozjpeg instead of libjpeg. See -README-turbo.txt for more information. - - -============= -Build Recipes -============= - - -32-bit Build on 64-bit Linux ----------------------------- - -Add - - --host i686-pc-linux-gnu CFLAGS='-O3 -m32' LDFLAGS=-m32 - -to the configure command line. - - -64-bit Build on 64-bit OS X ---------------------------- - -Add - - --host x86_64-apple-darwin NASM=/opt/local/bin/nasm - -to the configure command line. NASM 2.07 or later from MacPorts must be -installed. - - -32-bit Build on 64-bit OS X ---------------------------- - -Add - - --host i686-apple-darwin CFLAGS='-O3 -m32' LDFLAGS=-m32 - -to the configure command line. - - -64-bit Backward-Compatible Build on 64-bit OS X ------------------------------------------------ - -Add - - --host x86_64-apple-darwin NASM=/opt/local/bin/nasm \ - CFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk \ - -mmacosx-version-min=10.5 -O3' \ - LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk \ - -mmacosx-version-min=10.5' - -to the configure command line. The OS X 10.5 SDK, and NASM 2.07 or later from -MacPorts, must be installed. - - -32-bit Backward-Compatible Build on OS X ----------------------------------------- - -Add - - --host i686-apple-darwin \ - CFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk \ - -mmacosx-version-min=10.5 -O3 -m32' \ - LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk \ - -mmacosx-version-min=10.5 -m32' - -to the configure command line. The OS X 10.5 SDK must be installed. - - -64-bit Library Build on 64-bit Solaris --------------------------------------- - -Add - - --host x86_64-pc-solaris CFLAGS='-O3 -m64' LDFLAGS=-m64 - -to the configure command line. - - -32-bit Build on 64-bit FreeBSD ------------------------------- - -Add - - --host i386-unknown-freebsd CC='gcc -B /usr/lib32' CFLAGS='-O3 -m32' \ - LDFLAGS='-B/usr/lib32' - -to the configure command line. NASM 2.07 or later from FreeBSD ports must be -installed. - - -Oracle Solaris Studio ---------------------- - -Add - - CC=cc - -to the configure command line. mozjpeg will automatically be built with -the maximum optimization level (-xO5) unless you override CFLAGS. - -To build a 64-bit version of mozjpeg using Oracle Solaris Studio, add - - --host x86_64-pc-solaris CC=cc CFLAGS='-xO5 -m64' LDFLAGS=-m64 - -to the configure command line. - - -MinGW Build on Cygwin ---------------------- - -Use CMake (see recipes below) - - -=========== -ARM Support -=========== - -This release of mozjpeg can use ARM NEON SIMD instructions to accelerate -JPEG compression/decompression by approximately 2-4x on ARMv7 and later -platforms. If mozjpeg is configured on an ARM Linux platform, then the -build system will automatically include the NEON SIMD routines, if they are -supported. Build instructions for other ARM-based platforms follow. - - -Building mozjpeg for iOS ------------------------- - -iOS platforms, such as the iPhone and iPad, use ARM processors, some of which -support NEON instructions. Additional steps are required in order to build -mozjpeg for these platforms. - -Additional build requirements: - - gas-preprocessor.pl - (https://raw.githubusercontent.com/libjpeg-turbo/gas-preprocessor/master/gas-preprocessor.pl) - should be installed in your PATH. - - -ARM 32-bit Build (Xcode 4.6.x and earlier, LLVM-GCC): - -Set the following shell variables for simplicity: - - Xcode 4.2 and earlier: - IOS_PLATFORMDIR=/Developer/Platforms/iPhoneOS.platform - Xcode 4.3 and later: - IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform - - IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk - IOS_GCC=$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 - - ARMv6 (code will run on all iOS devices, not SIMD-accelerated): - [NOTE: Requires Xcode 4.4.x or earlier] - IOS_CFLAGS="-march=armv6 -mcpu=arm1176jzf-s -mfpu=vfp" - - ARMv7 (code will run on iPhone 3GS-4S/iPad 1st-3rd Generation and newer): - IOS_CFLAGS="-march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon" - - ARMv7s (code will run on iPhone 5/iPad 4th Generation and newer): - [NOTE: Requires Xcode 4.5 or later] - IOS_CFLAGS="-march=armv7s -mcpu=swift -mtune=swift -mfpu=neon" - -Follow the procedure under "Building mozjpeg" above, adding - - --host arm-apple-darwin10 \ - CC="$IOS_GCC" LD="$IOS_GCC" \ - CFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \ - LDFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT $IOS_CFLAGS" - -to the configure command line. - - -ARM 32-bit Build (Xcode 5.0.x and later, Clang): - -Set the following shell variables for simplicity: - - IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform - IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk - IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - - ARMv7 (code will run on iPhone 3GS-4S/iPad 1st-3rd Generation and newer): - IOS_CFLAGS="-arch armv7" - - ARMv7s (code will run on iPhone 5/iPad 4th Generation and newer): - IOS_CFLAGS="-arch armv7s" - -Follow the procedure under "Building libjpeg-turbo" above, adding - - --host arm-apple-darwin10 \ - CC="$IOS_GCC" LD="$IOS_GCC" \ - CFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \ - LDFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT $IOS_CFLAGS" \ - CCASFLAGS="-no-integrated-as $IOS_CFLAGS" - -to the configure command line. - - -ARMv8 64-bit Build (Xcode 5.0.x and later, Clang): - -Code will run on iPhone 5S/iPad Mini 2/iPad Air and newer. - -Set the following shell variables for simplicity: - - IOS_PLATFORMDIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform - IOS_SYSROOT=$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS*.sdk - IOS_GCC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - IOS_CFLAGS="-arch arm64" - -Follow the procedure under "Building libjpeg-turbo" above, adding - - --host aarch64-apple-darwin \ - CC="$IOS_GCC" LD="$IOS_GCC" \ - CFLAGS="-isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \ - LDFLAGS="-isysroot $IOS_SYSROOT $IOS_CFLAGS" - -to the configure command line. - - -NOTE: You can also add -miphoneos-version-min={version} to $IOS_CFLAGS above -in order to support older versions of iOS than the default version supported by -the SDK. - -Once built, lipo can be used to combine the ARMv6, v7, v7s, and/or v8 variants -into a universal library. - - -Building libjpeg-turbo for Android ----------------------------------- - -Building libjpeg-turbo for Android platforms requires the Android NDK -(https://developer.android.com/tools/sdk/ndk) and autotools. The following is -a general recipe script that can be modified for your specific needs. - - # Set these variables to suit your needs - NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/ndk} - BUILD_PLATFORM={the platform name for the NDK package you installed-- - for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"} - TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a - toolchain directory under ${NDK_PATH}/toolchains/.} - ANDROID_VERSION={The minimum version of Android to support-- for example, - "16", "19", etc. "21" or later is required for a 64-bit build.} - - # 32-bit ARMv7 build - HOST=arm-linux-androideabi - SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm - ANDROID_CFLAGS="-march=armv7-a -mfloat-abi=softfp -fprefetch-loop-arrays \ - --sysroot=${SYSROOT}" - - # 64-bit ARMv8 build - HOST=aarch64-linux-android - SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm64 - ANDROID_CFLAGS="--sysroot=${SYSROOT}" - - TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM} - ANDROID_INCLUDES="-I${SYSROOT}/usr/include -I${TOOLCHAIN}/include" - export CPP=${TOOLCHAIN}/bin/${HOST}-cpp - export AR=${TOOLCHAIN}/bin/${HOST}-ar - export AS=${TOOLCHAIN}/bin/${HOST}-as - export NM=${TOOLCHAIN}/bin/${HOST}-nm - export CC=${TOOLCHAIN}/bin/${HOST}-gcc - export LD=${TOOLCHAIN}/bin/${HOST}-ld - export RANLIB=${TOOLCHAIN}/bin/${HOST}-ranlib - export OBJDUMP=${TOOLCHAIN}/bin/${HOST}-objdump - export STRIP=${TOOLCHAIN}/bin/${HOST}-strip - cd {build_directory} - sh {source_directory}/configure --host=${HOST} \ - CFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS} -O3 -fPIE" \ - CPPFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS}" \ - LDFLAGS="${ANDROID_CFLAGS} -pie" --with-simd ${1+"$@"} - make - -If building for Android 4.0.x (API level < 16) or earlier, remove -fPIE from -CFLAGS and -pie from LDFLAGS. - - -******************************************************************************* -** Building on Windows (Visual C++ or MinGW) -******************************************************************************* - - -================== -Build Requirements -================== - --- CMake (http://www.cmake.org) v2.8.8 or later - --- Microsoft Visual C++ 2005 or later - - If you don't already have Visual C++, then the easiest way to get it is by - installing the Windows SDK: - - http://msdn.microsoft.com/en-us/windows/bb980924.aspx - - The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and - everything necessary to build mozjpeg. - - * You can also use Microsoft Visual Studio Express Edition, which is a free - download. (NOTE: versions prior to 2012 can only be used to build 32-bit - code.) - * If you intend to build mozjpeg from the command line, 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 and SetEnv.cmd. vcvars32.bat and - vcvars64.bat are part of Visual C++ and are located in the same directory - as the compiler. SetEnv.cmd is part of the Windows SDK. You can pass - optional arguments to SetEnv.cmd to specify a 32-bit or 64-bit build - environment. - -... OR ... - --- MinGW - - MinGW-builds (http://sourceforge.net/projects/mingwbuilds/) or - tdm-gcc (http://tdm-gcc.tdragon.net/) 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. - --- NASM (http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for - a 64-bit build) - --- If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This - can be downloaded from http://www.java.com. - - -================== -Out-of-Tree Builds -================== - -Binary objects, libraries, and executables are generated in the same directory -from which cmake was executed (the "binary directory"), and this directory need -not necessarily be the same as the mozjpeg source directory. You can -create multiple independent binary directories, in which different versions of -mozjpeg 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 mozjpeg source -directory. For in-tree builds, these directories are the same. - - -================ -Building mozjpeg -================ - - -Visual C++ (Command Line) -------------------------- - - cd {build_directory} - cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release {source_directory} - nmake - -This will build either a 32-bit or a 64-bit version of mozjpeg, 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 API - sharedlib/jpeg{version}.dll - DLL for the libjpeg API - sharedlib/jpeg.lib - Import library for the libjpeg API - turbojpeg-static.lib - Static link library for the TurboJPEG API - turbojpeg.dll - DLL for the TurboJPEG API - turbojpeg.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" {source_directory} - -NOTE: Add "Win64" to the generator name (for example, "Visual Studio 10 -Win64") to build a 64-bit version of libjpeg-turbo. Recent versions of CMake -no longer document that. A separate build directory must be used 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 mozjpeg. - -This will generate the following files under {build_directory}: - - {configuration}/jpeg-static.lib - Static link library for the libjpeg API - sharedlib/{configuration}/jpeg{version}.dll - DLL for the libjpeg API - sharedlib/{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. - - -MinGW ------ - -NOTE: This assumes that you are building on a Windows machine. If you are -cross-compiling on a Linux/Unix machine, then see "Build Recipes" below. - - cd {build_directory} - cmake -G "MinGW Makefiles" {source_directory} - mingw32-make - -This will generate the following files under {build_directory} - - libjpeg.a - Static link library for the libjpeg API - sharedlib/libjpeg-{version}.dll - DLL for the libjpeg API - sharedlib/libjpeg.dll.a - Import library for the libjpeg API - libturbojpeg.a - Static link library for the TurboJPEG API - libturbojpeg.dll - DLL for the TurboJPEG API - libturbojpeg.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 Build ------------ - -Add "-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 Emulation ------------------------------------ - -Add "-DWITH_JPEG7=1" to the cmake command line to build a version of -mozjpeg that is API/ABI-compatible with libjpeg v7. Add "-DWITH_JPEG8=1" -to the cmake command to build a version of mozjpeg that is -API/ABI-compatible with libjpeg v8. See README-turbo.txt for more information -on libjpeg v7 and v8 emulation. - - -In-Memory Source/Destination Managers -------------------------------------- - -When using libjpeg v6b or v7 API/ABI emulation, add -DWITH_MEM_SRCDST=0 to the -CMake command line to build a version of mozjpeg that lacks the -jpeg_mem_src() and jpeg_mem_dest() functions. These functions were not part of -the original libjpeg v6b and v7 APIs, so removing them ensures strict -conformance with those APIs. See README-turbo.txt for more information. - - -Arithmetic Coding Support -------------------------- - -Since the patent on arithmetic coding has expired, this functionality has been -included in this release of mozjpeg. mozjpeg's implementation is -based on the implementation in libjpeg v8, but it works when emulating libjpeg -v7 or v6b as well. The default is to enable both arithmetic encoding and -decoding, but those who have philosophical objections to arithmetic coding can -add "-DWITH_ARITH_ENC=0" or "-DWITH_ARITH_DEC=0" to the cmake command line to -disable encoding or decoding (respectively.) - - -TurboJPEG Java Wrapper ----------------------- -Add "-DWITH_JAVA=1" to the cmake command line to incorporate an optional Java -Native Interface wrapper into the TurboJPEG shared library and build the Java -front-end classes to support it. This allows the TurboJPEG shared library to -be used directly from Java applications. See java/README for more details. - -If you are using CMake 2.8, you can set the Java_JAVAC_EXECUTABLE, -Java_JAVA_EXECUTABLE, and Java_JAR_EXECUTABLE CMake variables to specify -alternate commands or locations for javac, jar, and java (respectively.) If -you are using CMake 2.6, set JAVA_COMPILE, JAVA_RUNTIME, and JAVA_ARCHIVE -instead. You can also set the JAVACFLAGS CMake variable to specify arguments -that should be passed to the Java compiler when building the front-end classes. - - -================== -Installing mozjpeg -================== - -You can use the build system to install mozjpeg into a directory of your -choosing (as opposed to creating an installer.) To do this, add: - - -DCMAKE_INSTALL_PREFIX={install_directory} - -to the cmake command line. - -For example, - - cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=c:\mozjpeg {source_directory} - nmake install - -will install the header files in c:\mozjpeg\include, the library files -in c:\mozjpeg\lib, the DLL's in c:\mozjpeg\bin, and the -documentation in c:\mozjpeg\doc. - - -============= -Build Recipes -============= - - -64-bit MinGW Build on Cygwin ----------------------------- - - cd {build_directory} - CC=/usr/bin/x86_64-w64-mingw32-gcc \ - cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ - -DCMAKE_RC_COMPILER=/usr/bin/x86_64-w64-mingw32-windres.exe \ - {source_directory} - make - -This produces a 64-bit build of mozjpeg that does not depend on -cygwin1.dll or other Cygwin DLL's. The mingw64-x86_64-gcc-core and -mingw64-x86_64-gcc-g++ packages (and their dependencies) must be installed. - - -32-bit MinGW Build on Cygwin ----------------------------- - - cd {build_directory} - CC=/usr/bin/i686-w64-mingw32-gcc \ - cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ - -DCMAKE_RC_COMPILER=/usr/bin/i686-w64-mingw32-windres.exe \ - {source_directory} - make - -This produces a 32-bit build of mozjpeg that does not depend on -cygwin1.dll or other Cygwin DLL's. The mingw64-i686-gcc-core and -mingw64-i686-gcc-g++ packages (and their dependencies) must be installed. - - -MinGW Build on Linux --------------------- - - cd {build_directory} - CC={mingw_binary_path}/i386-mingw32-gcc \ - cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \ - -DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \ - -DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \ - {source_directory} - make - - -******************************************************************************* -** Creating Release Packages -******************************************************************************* - -The following commands can be used to create various types of release packages: - - -Unix/Linux ----------- - -make rpm - - Create Red Hat-style binary RPM package. Requires RPM v4 or later. - -make srpm - - This 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 deb - - Create Debian-style binary package. Requires dpkg. - -make dmg - - Create Macintosh package/disk image. This requires pkgbuild and - productbuild, which are installed by default on OS X 10.7 and later and which - can be obtained by installing Xcode 3.2.6 (with the "Unix Development" - option) on OS X 10.6. Packages built in this manner can be installed on OS X - 10.5 and later, but they must be built on OS X 10.6 or later. - -make udmg [BUILDDIR32={32-bit build directory}] - - On 64-bit OS X systems, this creates a Macintosh package and disk image that - contains universal i386/x86-64 binaries. You should first configure a 32-bit - out-of-tree build of mozjpeg, then configure a 64-bit out-of-tree - build, then run 'make udmg' from the 64-bit build directory. The build - system will look for the 32-bit build under {source_directory}/osxx86 by - default, but you can override this by setting the BUILDDIR32 variable on the - make command line as shown above. - -make iosdmg [BUILDDIR32={32-bit build directory}] \ - [BUILDDIRARMV6={ARMv6 build directory}] \ - [BUILDDIRARMV7={ARMv7 build directory}] \ - [BUILDDIRARMV7S={ARMv7s build directory}] \ - [BUILDDIRARMV8={ARMv8 build directory}] - - On OS X systems, this creates a Macintosh package and disk image in which the - mozjpeg static libraries contain ARM architectures necessary to build - iOS applications. If building on an x86-64 system, the binaries will also - contain the i386 architecture, as with 'make udmg' above. You should first - configure ARMv6, ARMv7, ARMv7s, and/or ARMv8 out-of-tree builds of - mozjpeg (see "Building mozjpeg for iOS" above.) If you are - building an x86-64 version of mozjpeg, you should configure a 32-bit - out-of-tree build as well. Next, build mozjpeg as you would normally, - using an out-of-tree build. When it is built, run 'make iosdmg' from the - build directory. The build system will look for the ARMv6 build under - {source_directory}/iosarmv6 by default, the ARMv7 build under - {source_directory}/iosarmv7 by default, the ARMv7s build under - {source_directory}/iosarmv7s by default, the ARMv8 build under - {source_directory}/iosarmv8 by default, and (if applicable) the 32-bit build - under {source_directory}/osxx86 by default, but you can override this by - setting the BUILDDIR32, BUILDDIRARMV6, BUILDDIRARMV7, BUILDDIRARMV7S, and/or - BUILDDIRARMV8 variables on the make command line as shown above. - - NOTE: If including an ARMv8 build in the package, then you may need to use - Xcode's version of lipo instead of the operating system's. To do this, pass - an argument of LIPO="xcrun lipo" on the make command line. - -make cygwinpkg - - Build a Cygwin binary package. - - -Windows -------- - -If using NMake: - - cd {build_directory} - nmake installer - -If using MinGW: - - cd {build_directory} - make installer - -If using the Visual Studio IDE, build the "installer" project. - -The installer package (mozjpeg[-gcc][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 -(http://nsis.sourceforge.net/.) makensis.exe should be in your PATH. - - -******************************************************************************* -** Regression testing -******************************************************************************* - -The most common way to test mozjpeg is by invoking 'make test' on -Unix/Linux platforms or 'ctest' on Windows platforms, once the build has -completed. This runs a series of tests to ensure that mathematical -compatibility has been maintained. This also invokes the TurboJPEG unit tests, -which ensure that the colorspace extensions, YUV encoding, decompression -scaling, and other features of the TurboJPEG C and Java APIs are working -properly (and, by extension, that the equivalent features of the underlying -libjpeg API are also working.) - -Invoking 'make testclean' or 'nmake testclean' (if using NMake) or building -the 'testclean' target (if using the Visual Studio IDE) will clean up the -output images generated by 'make test'. - -On Unix/Linux platforms, more extensive tests of the TurboJPEG C and Java -wrappers can be run by invoking 'make tjtest'. These extended TurboJPEG tests -essentially iterate through all of the available features of the TurboJPEG APIs -that are not covered by the TurboJPEG unit tests (this includes the lossless -transform options) and compare the images generated by each feature to images -generated using the equivalent feature in the libjpeg API. The extended -TurboJPEG tests are meant to test for regressions in the TurboJPEG wrappers, -not in the underlying libjpeg API library. diff --git a/CMakeLists.txt b/CMakeLists.txt index 939625d4..452b2f86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -596,7 +596,8 @@ if(CMAKE_EXECUTABLE_SUFFIX_TMP) endif() message(STATUS "CMAKE_EXECUTABLE_SUFFIX = ${CMAKE_EXECUTABLE_SUFFIX}") -set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c jcext.c +set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c + jcext.c jcicc.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdicc.c jdinput.c @@ -754,7 +755,8 @@ else() endif() if(ENABLE_STATIC) - add_executable(cjpeg-static cjpeg.c cdjpeg.c rdgif.c rdppm.c rdjpeg.c rdswitch.c + add_executable(cjpeg-static cjpeg.c cdjpeg.c rdgif.c rdppm.c rdswitch.c + rdjpeg.c ${CJPEG_BMP_SOURCES}) set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) target_link_libraries(cjpeg-static jpeg-static) @@ -1096,6 +1098,25 @@ foreach(libtype ${TEST_LIBTYPES}) set_tests_properties(tjbench-${libtype}-tile PROPERTIES DEPENDS tjbench-${libtype}-tile-cp) + foreach(tile 8 16 32 64 128) + add_test(tjbench-${libtype}-tile-gray-${tile}x${tile}-cmp + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} ${MD5_PPM_GRAY_TILE} + testout_tile_GRAY_Q95_${tile}x${tile}.ppm) + foreach(subsamp 420 422) + add_test(tjbench-${libtype}-tile-${subsamp}-${tile}x${tile}-cmp + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} + ${MD5_PPM_${subsamp}_${tile}x${tile}_TILE} + testout_tile_${subsamp}_Q95_${tile}x${tile}.ppm) + endforeach() + add_test(tjbench-${libtype}-tile-444-${tile}x${tile}-cmp + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} ${MD5_PPM_444_TILE} + testout_tile_444_Q95_${tile}x${tile}.ppm) + foreach(subsamp gray 420 422 444) + set_tests_properties(tjbench-${libtype}-tile-${subsamp}-${tile}x${tile}-cmp + PROPERTIES DEPENDS tjbench-${libtype}-tile) + endforeach() + endforeach() + add_test(tjbench-${libtype}-tilem-cp ${CMAKE_COMMAND} -E copy_if_different ${TESTIMAGES}/testorig.ppm testout_tilem.ppm) @@ -1104,6 +1125,27 @@ foreach(libtype ${TEST_LIBTYPES}) -rgb -fastupsample -quiet -tile -benchtime 0.01 -warmup 0) set_tests_properties(tjbench-${libtype}-tilem PROPERTIES DEPENDS tjbench-${libtype}-tilem-cp) + + add_test(tjbench-${libtype}-tile-420m-8x8-cmp + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} ${MD5_PPM_420M_8x8_TILE} + testout_tilem_420_Q95_8x8.ppm) + add_test(tjbench-${libtype}-tile-422m-8x8-cmp + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} ${MD5_PPM_422M_8x8_TILE} + testout_tilem_422_Q95_8x8.ppm) + foreach(tile 16 32 64 128) + foreach(subsamp 420 422) + add_test(tjbench-${libtype}-tile-${subsamp}m-${tile}x${tile}-cmp + ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} + ${MD5_PPM_${subsamp}M_TILE} + testout_tilem_${subsamp}_Q95_${tile}x${tile}.ppm) + endforeach() + endforeach() + foreach(tile 8 16 32 64 128) + foreach(subsamp 420 422) + set_tests_properties(tjbench-${libtype}-tile-${subsamp}m-${tile}x${tile}-cmp + PROPERTIES DEPENDS tjbench-${libtype}-tilem) + endforeach() + endforeach() endif() # These tests are carefully crafted to provide full coverage of as many of diff --git a/cdjpeg.h b/cdjpeg.h index 79e66240..23f38b42 100644 --- a/cdjpeg.h +++ b/cdjpeg.h @@ -6,9 +6,9 @@ * Modified 2019 by Guido Vollbeding. * libjpeg-turbo Modifications: * Copyright (C) 2017, 2019, 2021, D. R. Commander. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. - * For conditions of distribution and use, see the accompanying README.ijg file. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains common declarations for the sample applications * cjpeg and djpeg. It is NOT used by the core JPEG library. diff --git a/cjpeg.c b/cjpeg.c index ad7b4f96..16399ede 100644 --- a/cjpeg.c +++ b/cjpeg.c @@ -6,9 +6,9 @@ * Modified 2003-2011 by Guido Vollbeding. * libjpeg-turbo Modifications: * Copyright (C) 2010, 2013-2014, 2017, 2019-2022, D. R. Commander. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. - * For conditions of distribution and use, see the accompanying README file. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains a command-line user interface for the JPEG compressor. * It should work on any system with Unix- or MS-DOS-style command lines. @@ -206,10 +206,10 @@ usage(void) fprintf(stderr, " -grayscale Create monochrome JPEG file\n"); fprintf(stderr, " -rgb Create RGB JPEG file\n"); #ifdef ENTROPY_OPT_SUPPORTED - fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression, enabled by default)\n"); + fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n"); #endif #ifdef C_PROGRESSIVE_SUPPORTED - fprintf(stderr, " -progressive Create progressive JPEG file (enabled by default)\n"); + fprintf(stderr, " -progressive Create progressive JPEG file\n"); #endif fprintf(stderr, " -baseline Create baseline JPEG file (disable progressive coding)\n"); #ifdef TARGA_SUPPORTED diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 578b8162..3d863bdd 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -37,7 +37,7 @@ if(WIN32) ${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java) else() configure_file(org/libjpegturbo/turbojpeg/TJLoader-unix.java.in - ${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java) + ${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java) endif() set(JAVA_SOURCES ${JAVA_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java) diff --git a/jcapistd.c b/jcapistd.c index 163d2871..df0fd97d 100644 --- a/jcapistd.c +++ b/jcapistd.c @@ -3,7 +3,6 @@ * * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. * For conditions of distribution and use, see the accompanying README file. * diff --git a/jcarith.c b/jcarith.c index 7a545d9e..b7d20688 100644 --- a/jcarith.c +++ b/jcarith.c @@ -66,8 +66,8 @@ typedef arith_entropy_encoder *arith_entropy_ptr; * in the lower bits (mask 0x7F). */ -#define DC_STAT_BINS 64 -#define AC_STAT_BINS 256 +#define DC_STAT_BINS 64 +#define AC_STAT_BINS 256 /* NOTE: Uncomment the following #define if you want to use the * given formula for calculating the AC conditioning parameter Kx @@ -109,9 +109,9 @@ typedef arith_entropy_encoder *arith_entropy_ptr; #ifdef RIGHT_SHIFT_IS_UNSIGNED #define ISHIFT_TEMPS int ishift_temp; #define IRIGHT_SHIFT(x, shft) \ - ((ishift_temp = (x)) < 0 ? \ + ((ishift_temp = (x)) < 0 ? \ (ishift_temp >> (shft)) | ((~0) << (16 - (shft))) : \ - (ishift_temp >> (shft))) + (ishift_temp >> (shft))) #else #define ISHIFT_TEMPS #define IRIGHT_SHIFT(x, shft) ((x) >> (shft)) @@ -128,7 +128,7 @@ emit_byte(int val, j_compress_ptr cinfo) if (cinfo->master->trellis_passes) return; - *dest->next_output_byte++ = (JOCTET) val; + *dest->next_output_byte++ = (JOCTET)val; if (--dest->free_in_buffer == 0) if (!(*dest->empty_output_buffer) (cinfo)) ERREXIT(cinfo, JERR_CANT_SUSPEND); @@ -238,8 +238,8 @@ arith_encode(j_compress_ptr cinfo, unsigned char *st, int val) */ sv = *st; qe = jpeg_aritab[sv & 0x7F]; /* => Qe_Value */ - nl = qe & 0xFF; qe >>= 8; /* Next_Index_LPS + Switch_MPS */ - nm = qe & 0xFF; qe >>= 8; /* Next_Index_MPS */ + nl = qe & 0xFF; qe >>= 8; /* Next_Index_LPS + Switch_MPS */ + nm = qe & 0xFF; qe >>= 8; /* Next_Index_MPS */ /* Encode & estimation procedures per sections D.1.4 & D.1.5 */ e->a -= qe; @@ -517,7 +517,7 @@ encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data) break; } } - arith_encode(cinfo, st + 1, 0); st += 3; k++; + arith_encode(cinfo, st + 1, 0); st += 3; k++; } st += 2; /* Figure F.8: Encoding the magnitude category of v */ @@ -669,7 +669,7 @@ encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data) break; } } - arith_encode(cinfo, st + 1, 0); st += 3; k++; + arith_encode(cinfo, st + 1, 0); st += 3; k++; } } /* Encode EOB decision only if k <= cinfo->Se */ @@ -777,7 +777,7 @@ encode_mcu(j_compress_ptr cinfo, JBLOCKROW *MCU_data) st = entropy->ac_stats[tbl] + 3 * (k - 1); arith_encode(cinfo, st, 0); /* EOB decision */ while ((v = (*block)[jpeg_natural_order[k]]) == 0) { - arith_encode(cinfo, st + 1, 0); st += 3; k++; + arith_encode(cinfo, st + 1, 0); st += 3; k++; } arith_encode(cinfo, st + 1, 1); /* Figure F.6: Encoding nonzero value v */ diff --git a/jccoefct.c b/jccoefct.c index 99e19561..985ede70 100644 --- a/jccoefct.c +++ b/jccoefct.c @@ -5,9 +5,9 @@ * Copyright (C) 1994-1997, Thomas G. Lane. * It was modified by The libjpeg-turbo Project to include only code and * information relevant to libjpeg-turbo. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. - * For conditions of distribution and use, see the accompanying README file. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains the coefficient buffer controller for compression. * This controller is the top level of the JPEG compressor proper. @@ -188,7 +188,7 @@ compress_data(j_compress_ptr cinfo, JSAMPIMAGE input_buf) (*cinfo->fdct->forward_DCT) (cinfo, compptr, input_buf[compptr->component_index], coef->MCU_buffer[blkn], - ypos, xpos, (JDIMENSION) blockcnt, + ypos, xpos, (JDIMENSION)blockcnt, NULL); if (blockcnt < compptr->MCU_width) { /* Create some dummy blocks at the right edge of the image. */ @@ -274,12 +274,12 @@ compress_first_pass(j_compress_ptr cinfo, JSAMPIMAGE input_buf) buffer = (*cinfo->mem->access_virt_barray) ((j_common_ptr)cinfo, coef->whole_image[ci], coef->iMCU_row_num * compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, TRUE); + (JDIMENSION)compptr->v_samp_factor, TRUE); buffer_dst = (*cinfo->mem->access_virt_barray) ((j_common_ptr) cinfo, coef->whole_image_uq[ci], coef->iMCU_row_num * compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, TRUE); + (JDIMENSION)compptr->v_samp_factor, TRUE); /* Count non-dummy DCT block rows in this iMCU row. */ if (coef->iMCU_row_num < last_iMCU_row) @@ -302,8 +302,8 @@ compress_first_pass(j_compress_ptr cinfo, JSAMPIMAGE input_buf) thisblockrow = buffer[block_row]; (*cinfo->fdct->forward_DCT) (cinfo, compptr, input_buf[ci], thisblockrow, - (JDIMENSION) (block_row * DCTSIZE), - (JDIMENSION) 0, blocks_across, + (JDIMENSION)(block_row * DCTSIZE), + (JDIMENSION)0, blocks_across, buffer_dst[block_row]); if (ndummy > 0) { /* Create dummy blocks at the right edge of the image. */ @@ -388,12 +388,12 @@ compress_trellis_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) buffer = (*cinfo->mem->access_virt_barray) ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], coef->iMCU_row_num * compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, TRUE); + (JDIMENSION)compptr->v_samp_factor, TRUE); buffer_dst = (*cinfo->mem->access_virt_barray) ((j_common_ptr) cinfo, coef->whole_image_uq[compptr->component_index], coef->iMCU_row_num * compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, TRUE); + (JDIMENSION)compptr->v_samp_factor, TRUE); /* Count non-dummy DCT block rows in this iMCU row. */ if (coef->iMCU_row_num < last_iMCU_row) @@ -576,19 +576,19 @@ jinit_c_coef_controller(j_compress_ptr cinfo, boolean need_full_buffer) ci++, compptr++) { coef->whole_image[ci] = (*cinfo->mem->request_virt_barray) ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - (JDIMENSION) jround_up((long) compptr->width_in_blocks, + (JDIMENSION)jround_up((long) compptr->width_in_blocks, (long) compptr->h_samp_factor), - (JDIMENSION) jround_up((long) compptr->height_in_blocks, + (JDIMENSION)jround_up((long) compptr->height_in_blocks, (long) compptr->v_samp_factor), - (JDIMENSION) compptr->v_samp_factor); + (JDIMENSION)compptr->v_samp_factor); coef->whole_image_uq[ci] = (*cinfo->mem->request_virt_barray) ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, - (JDIMENSION) jround_up((long) compptr->width_in_blocks, + (JDIMENSION)jround_up((long) compptr->width_in_blocks, (long) compptr->h_samp_factor), - (JDIMENSION) jround_up((long) compptr->height_in_blocks, + (JDIMENSION)jround_up((long) compptr->height_in_blocks, (long) compptr->v_samp_factor), - (JDIMENSION) compptr->v_samp_factor); + (JDIMENSION)compptr->v_samp_factor); } #else ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); diff --git a/jcdctmgr.c b/jcdctmgr.c index f45d1088..09839453 100644 --- a/jcdctmgr.c +++ b/jcdctmgr.c @@ -6,10 +6,10 @@ * libjpeg-turbo Modifications: * Copyright (C) 1999-2006, MIYASAKA Masaru. * Copyright 2009 Pierre Ossman for Cendio AB - * Copyright (C) 2011, 2014-2015 D. R. Commander - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. - * For conditions of distribution and use, see the accompanying README file. + * Copyright (C) 2011, 2014-2015, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains the forward-DCT management logic. * This code selects a particular DCT implementation to be used, @@ -48,7 +48,7 @@ typedef void (*float_quantize_method_ptr) (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace); -METHODDEF(void) quantize (JCOEFPTR, DCTELEM *, DCTELEM *); +METHODDEF(void) quantize(JCOEFPTR, DCTELEM *, DCTELEM *); typedef struct { struct jpeg_forward_dct pub; /* public fields */ @@ -89,7 +89,7 @@ typedef my_fdct_controller *my_fdct_ptr; */ LOCAL(int) -flss (UINT16 val) +flss(UINT16 val) { int bit; @@ -179,7 +179,7 @@ flss (UINT16 val) */ LOCAL(int) -compute_reciprocal (UINT16 divisor, DCTELEM *dtbl) +compute_reciprocal(UINT16 divisor, DCTELEM *dtbl) { UDCTELEM2 fq, fr; UDCTELEM c; @@ -191,10 +191,10 @@ compute_reciprocal (UINT16 divisor, DCTELEM *dtbl) * identity function. Since only the C quantization algorithm is used in * these cases, the scale value is irrelevant. */ - dtbl[DCTSIZE2 * 0] = (DCTELEM) 1; /* reciprocal */ - dtbl[DCTSIZE2 * 1] = (DCTELEM) 0; /* correction */ - dtbl[DCTSIZE2 * 2] = (DCTELEM) 1; /* scale */ - dtbl[DCTSIZE2 * 3] = -(DCTELEM) (sizeof(DCTELEM) * 8); /* shift */ + dtbl[DCTSIZE2 * 0] = (DCTELEM)1; /* reciprocal */ + dtbl[DCTSIZE2 * 1] = (DCTELEM)0; /* correction */ + dtbl[DCTSIZE2 * 2] = (DCTELEM)1; /* scale */ + dtbl[DCTSIZE2 * 3] = -(DCTELEM)(sizeof(DCTELEM) * 8); /* shift */ return 0; } @@ -204,26 +204,26 @@ compute_reciprocal (UINT16 divisor, DCTELEM *dtbl) fq = ((UDCTELEM2)1 << r) / divisor; fr = ((UDCTELEM2)1 << r) % divisor; - c = divisor / 2; /* for rounding */ + c = divisor / 2; /* for rounding */ - if (fr == 0) { /* divisor is power of two */ + if (fr == 0) { /* divisor is power of two */ /* fq will be one bit too large to fit in DCTELEM, so adjust */ fq >>= 1; r--; - } else if (fr <= (divisor / 2U)) { /* fractional part is < 0.5 */ + } else if (fr <= (divisor / 2U)) { /* fractional part is < 0.5 */ c++; - } else { /* fractional part is > 0.5 */ + } else { /* fractional part is > 0.5 */ fq++; } - dtbl[DCTSIZE2 * 0] = (DCTELEM) fq; /* reciprocal */ - dtbl[DCTSIZE2 * 1] = (DCTELEM) c; /* correction + roundfactor */ + dtbl[DCTSIZE2 * 0] = (DCTELEM)fq; /* reciprocal */ + dtbl[DCTSIZE2 * 1] = (DCTELEM)c; /* correction + roundfactor */ #ifdef WITH_SIMD - dtbl[DCTSIZE2 * 2] = (DCTELEM) (1 << (sizeof(DCTELEM)*8*2 - r)); /* scale */ + dtbl[DCTSIZE2 * 2] = (DCTELEM)(1 << (sizeof(DCTELEM) * 8 * 2 - r)); /* scale */ #else dtbl[DCTSIZE2 * 2] = 1; #endif - dtbl[DCTSIZE2 * 3] = (DCTELEM) r - sizeof(DCTELEM)*8; /* shift */ + dtbl[DCTSIZE2 * 3] = (DCTELEM)r - sizeof(DCTELEM) * 8; /* shift */ if (r <= 16) return 0; else return 1; @@ -242,9 +242,9 @@ compute_reciprocal (UINT16 divisor, DCTELEM *dtbl) */ METHODDEF(void) -start_pass_fdctmgr (j_compress_ptr cinfo) +start_pass_fdctmgr(j_compress_ptr cinfo) { - my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; + my_fdct_ptr fdct = (my_fdct_ptr)cinfo->fdct; int ci, qtblno, i; jpeg_component_info *compptr; JQUANT_TBL *qtbl; @@ -268,7 +268,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) */ if (fdct->divisors[qtblno] == NULL) { fdct->divisors[qtblno] = (DCTELEM *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, (DCTSIZE2 * 4) * sizeof(DCTELEM)); } dtbl = fdct->divisors[qtblno]; @@ -278,7 +278,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) fdct->quantize == jsimd_quantize) fdct->quantize = quantize; #else - dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3; + dtbl[i] = ((DCTELEM)qtbl->quantval[i]) << 3; #endif } break; @@ -292,7 +292,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 * We apply a further scale factor of 8. */ -#define CONST_BITS 14 +#define CONST_BITS 14 static const INT16 aanscales[DCTSIZE2] = { /* precomputed values scaled up by 14 bits */ 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, @@ -308,23 +308,23 @@ start_pass_fdctmgr (j_compress_ptr cinfo) if (fdct->divisors[qtblno] == NULL) { fdct->divisors[qtblno] = (DCTELEM *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, (DCTSIZE2 * 4) * sizeof(DCTELEM)); } dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { #if BITS_IN_JSAMPLE == 8 if (!compute_reciprocal( - DESCALE(MULTIPLY16V16((JLONG) qtbl->quantval[i], - (JLONG) aanscales[i]), - CONST_BITS-3), &dtbl[i]) && + DESCALE(MULTIPLY16V16((JLONG)qtbl->quantval[i], + (JLONG)aanscales[i]), + CONST_BITS - 3), &dtbl[i]) && fdct->quantize == jsimd_quantize) fdct->quantize = quantize; #else - dtbl[i] = (DCTELEM) - DESCALE(MULTIPLY16V16((JLONG) qtbl->quantval[i], - (JLONG) aanscales[i]), - CONST_BITS-3); + dtbl[i] = (DCTELEM) + DESCALE(MULTIPLY16V16((JLONG)qtbl->quantval[i], + (JLONG)aanscales[i]), + CONST_BITS - 3); #endif } } @@ -350,7 +350,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) if (fdct->float_divisors[qtblno] == NULL) { fdct->float_divisors[qtblno] = (FAST_FLOAT *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, DCTSIZE2 * sizeof(FAST_FLOAT)); } fdtbl = fdct->float_divisors[qtblno]; @@ -358,7 +358,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo) for (row = 0; row < DCTSIZE; row++) { for (col = 0; col < DCTSIZE; col++) { fdtbl[i] = (FAST_FLOAT) - (1.0 / (((double) qtbl->quantval[i] * + (1.0 / (((double)qtbl->quantval[i] * aanscalefactor[row] * aanscalefactor[col] * 8.0))); i++; } @@ -563,7 +563,7 @@ float_preprocess_deringing(FAST_FLOAT *data, const JQUANT_TBL *quantization_tabl */ METHODDEF(void) -convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace) +convsamp(JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace) { register DCTELEM *workspaceptr; register JSAMPROW elemptr; @@ -598,7 +598,7 @@ convsamp (JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace) */ METHODDEF(void) -quantize (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace) +quantize(JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace) { int i; DCTELEM temp; @@ -619,15 +619,15 @@ quantize (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace) if (temp < 0) { temp = -temp; product = (UDCTELEM2)(temp + corr) * recip; - product >>= shift + sizeof(DCTELEM)*8; + product >>= shift + sizeof(DCTELEM) * 8; temp = (DCTELEM)product; temp = -temp; } else { product = (UDCTELEM2)(temp + corr) * recip; - product >>= shift + sizeof(DCTELEM)*8; + product >>= shift + sizeof(DCTELEM) * 8; temp = (DCTELEM)product; } - output_ptr[i] = (JCOEF) temp; + output_ptr[i] = (JCOEF)temp; } #else @@ -650,20 +650,20 @@ quantize (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace) * If your machine's division is fast enough, define FAST_DIVIDE. */ #ifdef FAST_DIVIDE -#define DIVIDE_BY(a,b) a /= b +#define DIVIDE_BY(a, b) a /= b #else -#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0 +#define DIVIDE_BY(a, b) if (a >= b) a /= b; else a = 0 #endif if (temp < 0) { temp = -temp; - temp += qval>>1; /* for rounding */ + temp += qval >> 1; /* for rounding */ DIVIDE_BY(temp, qval); temp = -temp; } else { - temp += qval>>1; /* for rounding */ + temp += qval >> 1; /* for rounding */ DIVIDE_BY(temp, qval); } - output_ptr[i] = (JCOEF) temp; + output_ptr[i] = (JCOEF)temp; } #endif @@ -680,14 +680,14 @@ quantize (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace) */ METHODDEF(void) -forward_DCT (j_compress_ptr cinfo, jpeg_component_info *compptr, - JSAMPARRAY sample_data, JBLOCKROW coef_blocks, - JDIMENSION start_row, JDIMENSION start_col, - JDIMENSION num_blocks, JBLOCKROW dst) +forward_DCT(j_compress_ptr cinfo, jpeg_component_info *compptr, + JSAMPARRAY sample_data, JBLOCKROW coef_blocks, + JDIMENSION start_row, JDIMENSION start_col, JDIMENSION num_blocks, + JBLOCKROW dst) /* This version is used for integer DCT implementations. */ { /* This routine is heavily used, so it's worth coding it tightly. */ - my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; + my_fdct_ptr fdct = (my_fdct_ptr)cinfo->fdct; DCTELEM *divisors = fdct->divisors[compptr->quant_tbl_no]; JQUANT_TBL *qtbl = cinfo->quant_tbl_ptrs[compptr->quant_tbl_no]; DCTELEM *workspace; @@ -756,7 +756,7 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info *compptr, coef_blocks[bi][i] = maxval; } } -} + } } @@ -811,20 +811,20 @@ quantize_float(JCOEFPTR coef_block, FAST_FLOAT *divisors, * The maximum coefficient size is +-16K (for 12-bit data), so this * code should work for either 16-bit or 32-bit ints. */ - output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384); + output_ptr[i] = (JCOEF)((int)(temp + (FAST_FLOAT)16384.5) - 16384); } } METHODDEF(void) -forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info *compptr, - JSAMPARRAY sample_data, JBLOCKROW coef_blocks, - JDIMENSION start_row, JDIMENSION start_col, - JDIMENSION num_blocks, JBLOCKROW dst) +forward_DCT_float(j_compress_ptr cinfo, jpeg_component_info *compptr, + JSAMPARRAY sample_data, JBLOCKROW coef_blocks, + JDIMENSION start_row, JDIMENSION start_col, + JDIMENSION num_blocks, JBLOCKROW dst) /* This version is used for floating-point DCT implementations. */ { /* This routine is heavily used, so it's worth coding it tightly. */ - my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; + my_fdct_ptr fdct = (my_fdct_ptr)cinfo->fdct; FAST_FLOAT *divisors = fdct->float_divisors[compptr->quant_tbl_no]; JQUANT_TBL *qtbl = cinfo->quant_tbl_ptrs[compptr->quant_tbl_no]; FAST_FLOAT *workspace; @@ -1659,15 +1659,15 @@ quantize_trellis_arith(j_compress_ptr cinfo, arith_rates *r, JBLOCKROW coef_bloc */ GLOBAL(void) -jinit_forward_dct (j_compress_ptr cinfo) +jinit_forward_dct(j_compress_ptr cinfo) { my_fdct_ptr fdct; int i; fdct = (my_fdct_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, sizeof(my_fdct_controller)); - cinfo->fdct = (struct jpeg_forward_dct *) fdct; + cinfo->fdct = (struct jpeg_forward_dct *)fdct; fdct->pub.start_pass = start_pass_fdctmgr; /* First determine the DCT... */ @@ -1758,12 +1758,12 @@ jinit_forward_dct (j_compress_ptr cinfo) #ifdef DCT_FLOAT_SUPPORTED if (cinfo->dct_method == JDCT_FLOAT) fdct->float_workspace = (FAST_FLOAT *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, sizeof(FAST_FLOAT) * DCTSIZE2); else #endif fdct->workspace = (DCTELEM *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, sizeof(DCTELEM) * DCTSIZE2); /* Mark divisor tables unallocated */ diff --git a/jchuff.h b/jchuff.h index 3a588f88..b71bb8ba 100644 --- a/jchuff.h +++ b/jchuff.h @@ -7,7 +7,6 @@ * Copyright (C) 2022, D. R. Commander. * For conditions of distribution and use, see the accompanying README.ijg * file. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. * * This file contains declarations for Huffman entropy encoding routines @@ -22,9 +21,9 @@ */ #if BITS_IN_JSAMPLE == 8 -#define MAX_COEF_BITS 10 +#define MAX_COEF_BITS 10 #else -#define MAX_COEF_BITS 14 +#define MAX_COEF_BITS 14 #endif /* The progressive Huffman encoder uses an unsigned 16-bit data type to store @@ -48,10 +47,9 @@ EXTERN(void) jpeg_make_c_derived_tbl(j_compress_ptr cinfo, boolean isDC, int tblno, c_derived_tbl **pdtbl); /* Generate an optimal table definition given the specified counts */ -EXTERN(void) jpeg_gen_optimal_table - (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[]); - EXTERN(void) quantize_trellis (j_compress_ptr cinfo, c_derived_tbl *dctbl, c_derived_tbl *actbl, JBLOCKROW coef_blocks, JBLOCKROW src, JDIMENSION num_blocks, JQUANT_TBL * qtbl, double *norm_src, double *norm_coef, JCOEF *last_dc_val, JBLOCKROW coef_blocks_above, JBLOCKROW src_above); +EXTERN(void) jpeg_gen_optimal_table(j_compress_ptr cinfo, JHUFF_TBL *htbl, + long freq[]); diff --git a/jcinit.c b/jcinit.c index 4941c71c..18d6af1e 100644 --- a/jcinit.c +++ b/jcinit.c @@ -5,9 +5,9 @@ * Copyright (C) 1991-1997, Thomas G. Lane. * libjpeg-turbo Modifications: * Copyright (C) 2020, D. R. Commander. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. - * For conditions of distribution and use, see the accompanying README file. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains initialization logic for the JPEG compressor. * This routine is in charge of selecting the modules to be executed and @@ -32,13 +32,13 @@ */ GLOBAL(void) -jinit_compress_master (j_compress_ptr cinfo) +jinit_compress_master(j_compress_ptr cinfo) { /* Initialize master control (includes parameter checking/processing) */ jinit_c_master_control(cinfo, FALSE /* full compression */); /* Preprocessing */ - if (! cinfo->raw_data_in) { + if (!cinfo->raw_data_in) { jinit_color_converter(cinfo); jinit_downsampler(cinfo); jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */); @@ -72,7 +72,7 @@ jinit_compress_master (j_compress_ptr cinfo) jinit_marker_writer(cinfo); /* We can now tell the memory manager to allocate virtual arrays. */ - (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); + (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo); /* Write the datastream header (SOI) immediately. * Frame and scan headers are postponed till later. diff --git a/jcmaster.c b/jcmaster.c index b1ce15c2..83fbada7 100644 --- a/jcmaster.c +++ b/jcmaster.c @@ -6,9 +6,9 @@ * Modified 2003-2010 by Guido Vollbeding. * libjpeg-turbo Modifications: * Copyright (C) 2010, 2016, 2018, D. R. Commander. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. - * For conditions of distribution and use, see the accompanying README file. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains master control logic for the JPEG compressor. * These routines are concerned with parameter validation, initial setup, @@ -25,7 +25,7 @@ #include "jcmaster.h" - /* +/* * Support routines that do various essential calculations. */ @@ -37,7 +37,7 @@ */ GLOBAL(void) -jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo) +jpeg_calc_jpeg_dimensions(j_compress_ptr cinfo) /* Do computations that are needed before master selection phase */ { /* Hardwire it to "no scaling" */ @@ -50,7 +50,7 @@ jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo) LOCAL(void) -initial_setup (j_compress_ptr cinfo, boolean transcode_only) +initial_setup(j_compress_ptr cinfo, boolean transcode_only) /* Do computations that are needed before master selection phase */ { int ci; @@ -71,14 +71,14 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only) ERREXIT(cinfo, JERR_EMPTY_IMAGE); /* Make sure image isn't bigger than I can handle */ - if ((long) cinfo->_jpeg_height > (long) JPEG_MAX_DIMENSION || - (long) cinfo->_jpeg_width > (long) JPEG_MAX_DIMENSION) - ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION); + if ((long)cinfo->_jpeg_height > (long)JPEG_MAX_DIMENSION || + (long)cinfo->_jpeg_width > (long)JPEG_MAX_DIMENSION) + ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)JPEG_MAX_DIMENSION); /* Width of an input scanline must be representable as JDIMENSION. */ - samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components; - jd_samplesperrow = (JDIMENSION) samplesperrow; - if ((long) jd_samplesperrow != samplesperrow) + samplesperrow = (long)cinfo->image_width * (long)cinfo->input_components; + jd_samplesperrow = (JDIMENSION)samplesperrow; + if ((long)jd_samplesperrow != samplesperrow) ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); /* For now, precision must match compiled-in value... */ @@ -119,18 +119,18 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only) #endif /* Size in DCT blocks */ compptr->width_in_blocks = (JDIMENSION) - jdiv_round_up((long) cinfo->_jpeg_width * (long) compptr->h_samp_factor, - (long) (cinfo->max_h_samp_factor * DCTSIZE)); + jdiv_round_up((long)cinfo->_jpeg_width * (long)compptr->h_samp_factor, + (long)(cinfo->max_h_samp_factor * DCTSIZE)); compptr->height_in_blocks = (JDIMENSION) - jdiv_round_up((long) cinfo->_jpeg_height * (long) compptr->v_samp_factor, - (long) (cinfo->max_v_samp_factor * DCTSIZE)); + jdiv_round_up((long)cinfo->_jpeg_height * (long)compptr->v_samp_factor, + (long)(cinfo->max_v_samp_factor * DCTSIZE)); /* Size in samples */ compptr->downsampled_width = (JDIMENSION) - jdiv_round_up((long) cinfo->_jpeg_width * (long) compptr->h_samp_factor, - (long) cinfo->max_h_samp_factor); + jdiv_round_up((long)cinfo->_jpeg_width * (long)compptr->h_samp_factor, + (long)cinfo->max_h_samp_factor); compptr->downsampled_height = (JDIMENSION) - jdiv_round_up((long) cinfo->_jpeg_height * (long) compptr->v_samp_factor, - (long) cinfo->max_v_samp_factor); + jdiv_round_up((long)cinfo->_jpeg_height * (long)compptr->v_samp_factor, + (long)cinfo->max_v_samp_factor); /* Mark component needed (this flag isn't actually used for compression) */ compptr->component_needed = TRUE; } @@ -139,15 +139,15 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only) * main controller will call coefficient controller). */ cinfo->total_iMCU_rows = (JDIMENSION) - jdiv_round_up((long) cinfo->_jpeg_height, - (long) (cinfo->max_v_samp_factor*DCTSIZE)); + jdiv_round_up((long)cinfo->_jpeg_height, + (long)(cinfo->max_v_samp_factor * DCTSIZE)); } #ifdef C_MULTISCAN_FILES_SUPPORTED LOCAL(void) -validate_script (j_compress_ptr cinfo) +validate_script(j_compress_ptr cinfo) /* Verify that the scan script in cinfo->scan_info[] is valid; also * determine whether it uses progressive JPEG, and set cinfo->progressive_mode. */ @@ -177,10 +177,10 @@ validate_script (j_compress_ptr cinfo) * for progressive JPEG, no scan can have this. */ scanptr = cinfo->scan_info; - if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2-1) { + if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2 - 1) { #ifdef C_PROGRESSIVE_SUPPORTED cinfo->progressive_mode = TRUE; - last_bitpos_ptr = & last_bitpos[0][0]; + last_bitpos_ptr = &last_bitpos[0][0]; for (ci = 0; ci < cinfo->num_components; ci++) for (coefi = 0; coefi < DCTSIZE2; coefi++) *last_bitpos_ptr++ = -1; @@ -203,7 +203,7 @@ validate_script (j_compress_ptr cinfo) if (thisi < 0 || thisi >= cinfo->num_components) ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); /* Components must appear in SOF order within each scan */ - if (ci > 0 && thisi <= scanptr->component_index[ci-1]) + if (ci > 0 && thisi <= scanptr->component_index[ci - 1]) ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); } /* Validate progression parameters */ @@ -221,9 +221,9 @@ validate_script (j_compress_ptr cinfo) * which might cause problems for some decoders. */ #if BITS_IN_JSAMPLE == 8 -#define MAX_AH_AL 10 +#define MAX_AH_AL 10 #else -#define MAX_AH_AL 13 +#define MAX_AH_AL 13 #endif if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 || Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL) @@ -236,7 +236,7 @@ validate_script (j_compress_ptr cinfo) ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); } for (ci = 0; ci < ncomps; ci++) { - last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0]; + last_bitpos_ptr = &last_bitpos[scanptr->component_index[ci]][0]; if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */ ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); for (coefi = Ss; coefi <= Se; coefi++) { @@ -246,7 +246,7 @@ validate_script (j_compress_ptr cinfo) ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); } else { /* not first scan */ - if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1) + if (Ah != last_bitpos_ptr[coefi] || Al != Ah - 1) ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); } last_bitpos_ptr[coefi] = Al; @@ -255,7 +255,7 @@ validate_script (j_compress_ptr cinfo) #endif } else { /* For sequential JPEG, all progression parameters must be these: */ - if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0) + if (Ss != 0 || Se != DCTSIZE2 - 1 || Ah != 0 || Al != 0) ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); /* Make sure components are not sent twice */ for (ci = 0; ci < ncomps; ci++) { @@ -282,7 +282,7 @@ validate_script (j_compress_ptr cinfo) #endif } else { for (ci = 0; ci < cinfo->num_components; ci++) { - if (! component_sent[ci]) + if (!component_sent[ci]) ERREXIT(cinfo, JERR_MISSING_DATA); } } @@ -292,7 +292,7 @@ validate_script (j_compress_ptr cinfo) LOCAL(void) -select_scan_parameters (j_compress_ptr cinfo) +select_scan_parameters(j_compress_ptr cinfo) /* Set up the scan parameters for the current scan */ { int ci; @@ -345,8 +345,7 @@ select_scan_parameters (j_compress_ptr cinfo) } /* save value for later retrieval during printout of scans */ master->actual_Al[master->scan_number] = cinfo->Al; - } - else + } else #endif { /* Prepare for single sequential-JPEG scan containing all components */ @@ -358,7 +357,7 @@ select_scan_parameters (j_compress_ptr cinfo) cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci]; } cinfo->Ss = 0; - cinfo->Se = DCTSIZE2-1; + cinfo->Se = DCTSIZE2 - 1; cinfo->Ah = 0; cinfo->Al = 0; } @@ -366,7 +365,7 @@ select_scan_parameters (j_compress_ptr cinfo) LOCAL(void) -per_scan_setup (j_compress_ptr cinfo) +per_scan_setup(j_compress_ptr cinfo) /* Do computations that are needed before processing a JPEG scan */ /* cinfo->comps_in_scan and cinfo->cur_comp_info[] are already set */ { @@ -391,7 +390,7 @@ per_scan_setup (j_compress_ptr cinfo) /* For noninterleaved scans, it is convenient to define last_row_height * as the number of block rows present in the last iMCU row. */ - tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor); + tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor); if (tmp == 0) tmp = compptr->v_samp_factor; compptr->last_row_height = tmp; @@ -408,11 +407,11 @@ per_scan_setup (j_compress_ptr cinfo) /* Overall image size in MCUs */ cinfo->MCUs_per_row = (JDIMENSION) - jdiv_round_up((long) cinfo->_jpeg_width, - (long) (cinfo->max_h_samp_factor*DCTSIZE)); + jdiv_round_up((long)cinfo->_jpeg_width, + (long)(cinfo->max_h_samp_factor * DCTSIZE)); cinfo->MCU_rows_in_scan = (JDIMENSION) - jdiv_round_up((long) cinfo->_jpeg_height, - (long) (cinfo->max_v_samp_factor*DCTSIZE)); + jdiv_round_up((long)cinfo->_jpeg_height, + (long)(cinfo->max_v_samp_factor * DCTSIZE)); cinfo->blocks_in_MCU = 0; @@ -424,10 +423,10 @@ per_scan_setup (j_compress_ptr cinfo) compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height; compptr->MCU_sample_width = compptr->MCU_width * DCTSIZE; /* Figure number of non-dummy blocks in last MCU column & row */ - tmp = (int) (compptr->width_in_blocks % compptr->MCU_width); + tmp = (int)(compptr->width_in_blocks % compptr->MCU_width); if (tmp == 0) tmp = compptr->MCU_width; compptr->last_col_width = tmp; - tmp = (int) (compptr->height_in_blocks % compptr->MCU_height); + tmp = (int)(compptr->height_in_blocks % compptr->MCU_height); if (tmp == 0) tmp = compptr->MCU_height; compptr->last_row_height = tmp; /* Prepare array describing MCU composition */ @@ -444,8 +443,8 @@ per_scan_setup (j_compress_ptr cinfo) /* Convert restart specified in rows to actual MCU count. */ /* Note that count must fit in 16 bits, so we provide limiting. */ if (cinfo->restart_in_rows > 0) { - long nominal = (long) cinfo->restart_in_rows * (long) cinfo->MCUs_per_row; - cinfo->restart_interval = (unsigned int) MIN(nominal, 65535L); + long nominal = (long)cinfo->restart_in_rows * (long)cinfo->MCUs_per_row; + cinfo->restart_interval = (unsigned int)MIN(nominal, 65535L); } } @@ -459,9 +458,9 @@ per_scan_setup (j_compress_ptr cinfo) */ METHODDEF(void) -prepare_for_pass (j_compress_ptr cinfo) +prepare_for_pass(j_compress_ptr cinfo) { - my_master_ptr master = (my_master_ptr) cinfo->master; + my_master_ptr master = (my_master_ptr)cinfo->master; cinfo->master->trellis_passes = master->pass_number < master->pass_number_scan_opt_base; @@ -472,7 +471,7 @@ prepare_for_pass (j_compress_ptr cinfo) */ select_scan_parameters(cinfo); per_scan_setup(cinfo); - if (! cinfo->raw_data_in) { + if (!cinfo->raw_data_in) { (*cinfo->cconvert->start_pass) (cinfo); (*cinfo->downsample->start_pass) (cinfo); (*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU); @@ -512,7 +511,7 @@ prepare_for_pass (j_compress_ptr cinfo) case output_pass: /* Do a data-output pass. */ /* We need not repeat per-scan setup if prior optimization pass did it. */ - if (! cinfo->optimize_coding) { + if (!cinfo->optimize_coding) { select_scan_parameters(cinfo); per_scan_setup(cinfo); } @@ -553,7 +552,7 @@ prepare_for_pass (j_compress_ptr cinfo) ERREXIT(cinfo, JERR_NOT_COMPILED); } - master->pub.is_last_pass = (master->pass_number == master->total_passes-1); + master->pub.is_last_pass = (master->pass_number == master->total_passes - 1); /* Set up progress monitor's pass info if present */ if (cinfo->progress != NULL) { @@ -574,7 +573,7 @@ prepare_for_pass (j_compress_ptr cinfo) */ METHODDEF(void) -pass_startup (j_compress_ptr cinfo) +pass_startup(j_compress_ptr cinfo) { cinfo->master->call_pass_startup = FALSE; /* reset flag so call only once */ @@ -814,9 +813,9 @@ select_scans (j_compress_ptr cinfo, int next_scan_number) */ METHODDEF(void) -finish_pass_master (j_compress_ptr cinfo) +finish_pass_master(j_compress_ptr cinfo) { - my_master_ptr master = (my_master_ptr) cinfo->master; + my_master_ptr master = (my_master_ptr)cinfo->master; /* The entropy coder always needs an end-of-pass call, * either to analyze statistics or to flush its output buffer. @@ -833,7 +832,7 @@ finish_pass_master (j_compress_ptr cinfo) master->pass_type = trellis_pass; else { master->pass_type = output_pass; - if (! cinfo->optimize_coding) + if (!cinfo->optimize_coding) master->scan_number++; } break; @@ -888,7 +887,7 @@ finish_pass_master (j_compress_ptr cinfo) */ GLOBAL(void) -jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only) +jinit_c_master_control(j_compress_ptr cinfo, boolean transcode_only) { my_master_ptr master = (my_master_ptr) cinfo->master; diff --git a/jcmaster.h b/jcmaster.h index 1abf7b60..091a01f6 100644 --- a/jcmaster.h +++ b/jcmaster.h @@ -14,10 +14,10 @@ /* Private state */ typedef enum { - main_pass, /* input data, also do first output step */ - huff_opt_pass, /* Huffman code optimization pass */ - output_pass, /* data output pass */ - trellis_pass /* trellis quantization pass */ + main_pass, /* input data, also do first output step */ + huff_opt_pass, /* Huffman code optimization pass */ + output_pass, /* data output pass */ + trellis_pass /* trellis quantization pass */ } c_pass_type; typedef struct { diff --git a/jcparam.c b/jcparam.c index a432a491..04e4aa67 100644 --- a/jcparam.c +++ b/jcparam.c @@ -6,9 +6,9 @@ * Modified 2003-2008 by Guido Vollbeding. * libjpeg-turbo Modifications: * Copyright (C) 2009-2011, 2018, D. R. Commander. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. - * For conditions of distribution and use, see the accompanying README file. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains optional default-setting code for the JPEG compressor. * Applications do not have to use this file, but those that don't use it @@ -26,7 +26,7 @@ */ GLOBAL(void) -jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl, +jpeg_add_quant_table(j_compress_ptr cinfo, int which_tbl, const unsigned int *basic_table, int scale_factor, boolean force_baseline) /* Define a quantization table equal to the basic_table times @@ -46,19 +46,19 @@ jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl, if (which_tbl < 0 || which_tbl >= NUM_QUANT_TBLS) ERREXIT1(cinfo, JERR_DQT_INDEX, which_tbl); - qtblptr = & cinfo->quant_tbl_ptrs[which_tbl]; + qtblptr = &cinfo->quant_tbl_ptrs[which_tbl]; if (*qtblptr == NULL) - *qtblptr = jpeg_alloc_quant_table((j_common_ptr) cinfo); + *qtblptr = jpeg_alloc_quant_table((j_common_ptr)cinfo); for (i = 0; i < DCTSIZE2; i++) { - temp = ((long) basic_table[i] * scale_factor + 50L) / 100L; + temp = ((long)basic_table[i] * scale_factor + 50L) / 100L; /* limit the values to the valid range */ if (temp <= 0L) temp = 1L; if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */ if (force_baseline && temp > 255L) temp = 255L; /* limit to baseline range if requested */ - (*qtblptr)->quantval[i] = (UINT16) temp; + (*qtblptr)->quantval[i] = (UINT16)temp; } /* Initialize sent_table FALSE so table will be written to JPEG file. */ @@ -291,7 +291,7 @@ static const unsigned int std_chrominance_quant_tbl[9][DCTSIZE2] = { #if JPEG_LIB_VERSION >= 70 GLOBAL(void) -jpeg_default_qtables (j_compress_ptr cinfo, boolean force_baseline) +jpeg_default_qtables(j_compress_ptr cinfo, boolean force_baseline) /* Set or change the 'quality' (quantization) setting, using default tables * and straight percentage-scaling quality scales. * This entry point allows different scalings for luminance and chrominance. @@ -307,8 +307,8 @@ jpeg_default_qtables (j_compress_ptr cinfo, boolean force_baseline) GLOBAL(void) -jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, - boolean force_baseline) +jpeg_set_linear_quality(j_compress_ptr cinfo, int scale_factor, + boolean force_baseline) /* Set or change the 'quality' (quantization) setting, using default tables * and a straight percentage-scaling quality scale. In most cases it's better * to use jpeg_set_quality (below); this entry point is provided for @@ -324,7 +324,7 @@ jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, GLOBAL(int) -jpeg_quality_scaling (int quality) +jpeg_quality_scaling(int quality) { return jpeg_float_quality_scaling(quality); } @@ -356,7 +356,7 @@ jpeg_float_quality_scaling(float quality) GLOBAL(void) -jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline) +jpeg_set_quality(j_compress_ptr cinfo, int quality, boolean force_baseline) /* Set or change the 'quality' (quantization) setting, using default tables. * This is the standard quality-adjusting entry point for typical user * interfaces; only those who want detailed control over quantization tables @@ -382,7 +382,7 @@ jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline) */ GLOBAL(void) -jpeg_set_defaults (j_compress_ptr cinfo) +jpeg_set_defaults(j_compress_ptr cinfo) { int i; @@ -396,7 +396,7 @@ jpeg_set_defaults (j_compress_ptr cinfo) */ if (cinfo->comp_info == NULL) cinfo->comp_info = (jpeg_component_info *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT, MAX_COMPONENTS * sizeof(jpeg_component_info)); /* Initialize everything not dependent on the color space */ @@ -409,7 +409,7 @@ jpeg_set_defaults (j_compress_ptr cinfo) /* Set up two quantization tables using default quality of 75 */ jpeg_set_quality(cinfo, 75, TRUE); /* Set up two Huffman tables */ - std_huff_tables((j_common_ptr) cinfo); + std_huff_tables((j_common_ptr)cinfo); /* Initialize default arithmetic coding conditioning */ for (i = 0; i < NUM_ARITH_TBLS; i++) { @@ -520,7 +520,7 @@ jpeg_set_defaults (j_compress_ptr cinfo) */ GLOBAL(void) -jpeg_default_colorspace (j_compress_ptr cinfo) +jpeg_default_colorspace(j_compress_ptr cinfo) { switch (cinfo->in_color_space) { case JCS_GRAYSCALE: @@ -562,12 +562,12 @@ jpeg_default_colorspace (j_compress_ptr cinfo) */ GLOBAL(void) -jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace) +jpeg_set_colorspace(j_compress_ptr cinfo, J_COLOR_SPACE colorspace) { jpeg_component_info *compptr; int ci; -#define SET_COMP(index,id,hsamp,vsamp,quant,dctbl,actbl) \ +#define SET_COMP(index, id, hsamp, vsamp, quant, dctbl, actbl) \ (compptr = &cinfo->comp_info[index], \ compptr->component_id = (id), \ compptr->h_samp_factor = (hsamp), \ @@ -594,39 +594,39 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace) cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */ cinfo->num_components = 1; /* JFIF specifies component ID 1 */ - SET_COMP(0, 1, 1,1, 0, 0,0); + SET_COMP(0, 1, 1, 1, 0, 0, 0); break; case JCS_RGB: cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */ cinfo->num_components = 3; - SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0); - SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0); - SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0); + SET_COMP(0, 0x52 /* 'R' */, 1, 1, 0, 0, 0); + SET_COMP(1, 0x47 /* 'G' */, 1, 1, 0, 0, 0); + SET_COMP(2, 0x42 /* 'B' */, 1, 1, 0, 0, 0); break; case JCS_YCbCr: cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */ cinfo->num_components = 3; /* JFIF specifies component IDs 1,2,3 */ /* We default to 2x2 subsamples of chrominance */ - SET_COMP(0, 1, 2,2, 0, 0,0); - SET_COMP(1, 2, 1,1, 1, 1,1); - SET_COMP(2, 3, 1,1, 1, 1,1); + SET_COMP(0, 1, 2, 2, 0, 0, 0); + SET_COMP(1, 2, 1, 1, 1, 1, 1); + SET_COMP(2, 3, 1, 1, 1, 1, 1); break; case JCS_CMYK: cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */ cinfo->num_components = 4; - SET_COMP(0, 0x43 /* 'C' */, 1,1, 0, 0,0); - SET_COMP(1, 0x4D /* 'M' */, 1,1, 0, 0,0); - SET_COMP(2, 0x59 /* 'Y' */, 1,1, 0, 0,0); - SET_COMP(3, 0x4B /* 'K' */, 1,1, 0, 0,0); + SET_COMP(0, 0x43 /* 'C' */, 1, 1, 0, 0, 0); + SET_COMP(1, 0x4D /* 'M' */, 1, 1, 0, 0, 0); + SET_COMP(2, 0x59 /* 'Y' */, 1, 1, 0, 0, 0); + SET_COMP(3, 0x4B /* 'K' */, 1, 1, 0, 0, 0); break; case JCS_YCCK: cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */ cinfo->num_components = 4; - SET_COMP(0, 1, 2,2, 0, 0,0); - SET_COMP(1, 2, 1,1, 1, 1,1); - SET_COMP(2, 3, 1,1, 1, 1,1); - SET_COMP(3, 4, 2,2, 0, 0,0); + SET_COMP(0, 1, 2, 2, 0, 0, 0); + SET_COMP(1, 2, 1, 1, 1, 1, 1); + SET_COMP(2, 3, 1, 1, 1, 1, 1); + SET_COMP(3, 4, 2, 2, 0, 0, 0); break; case JCS_UNKNOWN: cinfo->num_components = cinfo->input_components; @@ -634,7 +634,7 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace) ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, MAX_COMPONENTS); for (ci = 0; ci < cinfo->num_components; ci++) { - SET_COMP(ci, ci, 1,1, 0, 0,0); + SET_COMP(ci, ci, 1, 1, 0, 0, 0); } break; default: @@ -676,8 +676,7 @@ fill_a_scan_pair (jpeg_scan_info * scanptr, int ci, } LOCAL(jpeg_scan_info *) -fill_scans (jpeg_scan_info *scanptr, int ncomps, - int Ss, int Se, int Ah, int Al) +fill_scans(jpeg_scan_info *scanptr, int ncomps, int Ss, int Se, int Ah, int Al) /* Support routine: generate one scan for each component */ { int ci; @@ -695,7 +694,7 @@ fill_scans (jpeg_scan_info *scanptr, int ncomps, } LOCAL(jpeg_scan_info *) -fill_dc_scans (jpeg_scan_info *scanptr, int ncomps, int Ah, int Al) +fill_dc_scans(jpeg_scan_info *scanptr, int ncomps, int Ah, int Al) /* Support routine: generate interleaved DC scan if possible, else N scans */ { int ci; @@ -849,7 +848,7 @@ jpeg_search_progression (j_compress_ptr cinfo) */ GLOBAL(void) -jpeg_simple_progression (j_compress_ptr cinfo) +jpeg_simple_progression(j_compress_ptr cinfo) { int ncomps; int nscans; @@ -887,7 +886,7 @@ jpeg_simple_progression (j_compress_ptr cinfo) else nscans = 1 + 4 * ncomps; /* 2 DC scans; 4 AC scans per component */ } else { - if (ncomps > MAX_COMPS_IN_SCAN) + if (ncomps > MAX_COMPS_IN_SCAN) nscans = 6 * ncomps; /* 2 DC + 4 AC scans per component */ else nscans = 2 + 4 * ncomps; /* 2 DC scans; 4 AC scans per component */ @@ -904,7 +903,7 @@ jpeg_simple_progression (j_compress_ptr cinfo) if (cinfo->script_space == NULL || cinfo->script_space_size < nscans) { cinfo->script_space_size = MAX(nscans, 10); cinfo->script_space = (jpeg_scan_info *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT, cinfo->script_space_size * sizeof(jpeg_scan_info)); } scanptr = cinfo->script_space; @@ -975,7 +974,7 @@ jpeg_simple_progression (j_compress_ptr cinfo) /* Successive approximation final pass */ scanptr = fill_scans(scanptr, ncomps, 1, 63, 1, 0); } else { - /* Successive approximation first pass */ + /* Successive approximation first pass */ scanptr = fill_dc_scans(scanptr, ncomps, 0, 1); scanptr = fill_scans(scanptr, ncomps, 1, 5, 0, 2); scanptr = fill_scans(scanptr, ncomps, 6, 63, 0, 2); diff --git a/jcphuff.c b/jcphuff.c index f80c7963..9259d988 100644 --- a/jcphuff.c +++ b/jcphuff.c @@ -141,34 +141,34 @@ typedef phuff_entropy_encoder *phuff_entropy_ptr; #ifdef RIGHT_SHIFT_IS_UNSIGNED #define ISHIFT_TEMPS int ishift_temp; -#define IRIGHT_SHIFT(x,shft) \ +#define IRIGHT_SHIFT(x, shft) \ ((ishift_temp = (x)) < 0 ? \ - (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \ + (ishift_temp >> (shft)) | ((~0) << (16 - (shft))) : \ (ishift_temp >> (shft))) #else #define ISHIFT_TEMPS -#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) +#define IRIGHT_SHIFT(x, shft) ((x) >> (shft)) #endif #define PAD(v, p) ((v + (p) - 1) & (~((p) - 1))) /* Forward declarations */ -METHODDEF(boolean) encode_mcu_DC_first (j_compress_ptr cinfo, +METHODDEF(boolean) encode_mcu_DC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data); METHODDEF(void) encode_mcu_AC_first_prepare (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, UJCOEF *values, size_t *zerobits); METHODDEF(boolean) encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data); -METHODDEF(boolean) encode_mcu_DC_refine (j_compress_ptr cinfo, +METHODDEF(boolean) encode_mcu_DC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data); METHODDEF(int) encode_mcu_AC_refine_prepare (const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al, UJCOEF *absvalues, size_t *bits); METHODDEF(boolean) encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data); -METHODDEF(void) finish_pass_phuff (j_compress_ptr cinfo); -METHODDEF(void) finish_pass_gather_phuff (j_compress_ptr cinfo); +METHODDEF(void) finish_pass_phuff(j_compress_ptr cinfo); +METHODDEF(void) finish_pass_gather_phuff(j_compress_ptr cinfo); /* Count bit loop zeroes */ @@ -204,9 +204,9 @@ count_zeroes(size_t *x) */ METHODDEF(void) -start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) +start_pass_phuff(j_compress_ptr cinfo, boolean gather_statistics) { - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy; boolean is_DC_band; int ci, tbl; jpeg_component_info *compptr; @@ -240,7 +240,7 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) /* AC refinement needs a correction bit buffer */ if (entropy->bit_buffer == NULL) entropy->bit_buffer = (char *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, MAX_CORR_BITS * sizeof(char)); } } @@ -273,7 +273,7 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */ if (entropy->count_ptrs[tbl] == NULL) entropy->count_ptrs[tbl] = (long *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, 257 * sizeof(long)); memset(entropy->count_ptrs[tbl], 0, 257 * sizeof(long)); @@ -289,7 +289,7 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) /* Compute derived values for Huffman table */ /* We may do this more than once for a table, but it's not expensive */ jpeg_make_c_derived_tbl(cinfo, is_DC_band, tbl, - & entropy->derived_tbls[tbl]); + &entropy->derived_tbls[tbl]); } } @@ -321,12 +321,12 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) LOCAL(void) -dump_buffer (phuff_entropy_ptr entropy) +dump_buffer(phuff_entropy_ptr entropy) /* Empty the output buffer; we do not support suspension in this module. */ { struct jpeg_destination_mgr *dest = entropy->cinfo->dest; - if (! (*dest->empty_output_buffer) (entropy->cinfo)) + if (!(*dest->empty_output_buffer) (entropy->cinfo)) ERREXIT(entropy->cinfo, JERR_CANT_SUSPEND); /* After a successful buffer dump, must reset buffer pointers */ entropy->next_output_byte = dest->next_output_byte; @@ -343,11 +343,11 @@ dump_buffer (phuff_entropy_ptr entropy) */ LOCAL(void) -emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) +emit_bits(phuff_entropy_ptr entropy, unsigned int code, int size) /* Emit some bits, unless we are in gather mode */ { /* This routine is heavily used, so it's worth coding tightly. */ - register size_t put_buffer = (size_t) code; + register size_t put_buffer = (size_t)code; register int put_bits = entropy->put_bits; /* if size is 0, caller used an invalid Huffman table entry */ @@ -357,7 +357,7 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) if (entropy->gather_statistics) return; /* do nothing if we're only getting stats */ - put_buffer &= (((size_t) 1)<put_buffer; /* and merge with old buffer contents */ while (put_bits >= 8) { - int c = (int) ((put_buffer >> 16) & 0xFF); + int c = (int)((put_buffer >> 16) & 0xFF); emit_byte(entropy, c); if (c == 0xFF) { /* need to stuff a zero byte? */ @@ -382,7 +382,7 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) LOCAL(void) -flush_bits (phuff_entropy_ptr entropy) +flush_bits(phuff_entropy_ptr entropy) { emit_bits(entropy, 0x7F, 7); /* fill any partial byte with ones */ entropy->put_buffer = 0; /* and reset bit-buffer to empty */ @@ -395,7 +395,7 @@ flush_bits (phuff_entropy_ptr entropy) */ LOCAL(void) -emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol) +emit_symbol(phuff_entropy_ptr entropy, int tbl_no, int symbol) { if (entropy->gather_statistics) entropy->count_ptrs[tbl_no][symbol]++; @@ -411,14 +411,14 @@ emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol) */ LOCAL(void) -emit_buffered_bits (phuff_entropy_ptr entropy, char *bufstart, +emit_buffered_bits(phuff_entropy_ptr entropy, char *bufstart, unsigned int nbits) { if (entropy->gather_statistics) return; /* no real work */ while (nbits > 0) { - emit_bits(entropy, (unsigned int) (*bufstart), 1); + emit_bits(entropy, (unsigned int)(*bufstart), 1); bufstart++; nbits--; } @@ -430,7 +430,7 @@ emit_buffered_bits (phuff_entropy_ptr entropy, char *bufstart, */ LOCAL(void) -emit_eobrun (phuff_entropy_ptr entropy) +emit_eobrun(phuff_entropy_ptr entropy) { register int temp, nbits; @@ -459,13 +459,13 @@ emit_eobrun (phuff_entropy_ptr entropy) */ LOCAL(void) -emit_restart (phuff_entropy_ptr entropy, int restart_num) +emit_restart(phuff_entropy_ptr entropy, int restart_num) { int ci; emit_eobrun(entropy); - if (! entropy->gather_statistics) { + if (!entropy->gather_statistics) { flush_bits(entropy); emit_byte(entropy, 0xFF); emit_byte(entropy, JPEG_RST0 + restart_num); @@ -489,9 +489,9 @@ emit_restart (phuff_entropy_ptr entropy, int restart_num) */ METHODDEF(boolean) -encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) +encode_mcu_DC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data) { - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy; register int temp, temp2, temp3; register int nbits; int blkn, ci; @@ -517,7 +517,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) /* Compute the DC value after the required point transform by Al. * This is simply an arithmetic right shift. */ - temp2 = IRIGHT_SHIFT((int) ((*block)[0]), Al); + temp2 = IRIGHT_SHIFT((int)((*block)[0]), Al); /* DC differences are figured on the point-transformed values. */ temp = temp2 - entropy->last_dc_val[ci]; @@ -541,7 +541,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) /* Check for out-of-range coefficient values. * Since we're encoding a difference, the range limit is twice as much. */ - if (nbits > MAX_COEF_BITS+1) + if (nbits > MAX_COEF_BITS + 1) ERREXIT(cinfo, JERR_BAD_DCT_COEF); /* Count/emit the Huffman-coded symbol for the number of bits */ @@ -550,7 +550,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) /* Emit that number of bits of the value, if positive, */ /* or the complement of its magnitude, if negative. */ if (nbits) /* emit_bits rejects calls with size 0 */ - emit_bits(entropy, (unsigned int) temp2, nbits); + emit_bits(entropy, (unsigned int)temp2, nbits); } cinfo->dest->next_output_byte = entropy->next_output_byte; @@ -668,9 +668,9 @@ label \ } METHODDEF(boolean) -encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) +encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data) { - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy; register int temp, temp2; register int nbits, r; int Sl = cinfo->Se - cinfo->Ss + 1; @@ -760,9 +760,9 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) */ METHODDEF(boolean) -encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) +encode_mcu_DC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data) { - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy; register int temp; int blkn; int Al = cinfo->Al; @@ -782,7 +782,7 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) /* We simply emit the Al'th bit of the DC coefficient value. */ temp = (*block)[0]; - emit_bits(entropy, (unsigned int) (temp >> Al), 1); + emit_bits(entropy, (unsigned int)(temp >> Al), 1); } cinfo->dest->next_output_byte = entropy->next_output_byte; @@ -932,9 +932,9 @@ label \ } METHODDEF(boolean) -encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) +encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data) { - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy; register int temp, r, idx; char *BR_buffer; unsigned int BR; @@ -1033,9 +1033,9 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) */ METHODDEF(void) -finish_pass_phuff (j_compress_ptr cinfo) +finish_pass_phuff(j_compress_ptr cinfo) { - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy; entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->free_in_buffer = cinfo->dest->free_in_buffer; @@ -1054,9 +1054,9 @@ finish_pass_phuff (j_compress_ptr cinfo) */ METHODDEF(void) -finish_pass_gather_phuff (j_compress_ptr cinfo) +finish_pass_gather_phuff(j_compress_ptr cinfo) { - phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy; boolean is_DC_band; int ci, tbl; jpeg_component_info *compptr; @@ -1082,13 +1082,13 @@ finish_pass_gather_phuff (j_compress_ptr cinfo) } else { tbl = compptr->ac_tbl_no; } - if (! did[tbl]) { + if (!did[tbl]) { if (is_DC_band) - htblptr = & cinfo->dc_huff_tbl_ptrs[tbl]; + htblptr = &cinfo->dc_huff_tbl_ptrs[tbl]; else - htblptr = & cinfo->ac_huff_tbl_ptrs[tbl]; + htblptr = &cinfo->ac_huff_tbl_ptrs[tbl]; if (*htblptr == NULL) - *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); + *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo); jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[tbl]); did[tbl] = TRUE; } @@ -1101,15 +1101,15 @@ finish_pass_gather_phuff (j_compress_ptr cinfo) */ GLOBAL(void) -jinit_phuff_encoder (j_compress_ptr cinfo) +jinit_phuff_encoder(j_compress_ptr cinfo) { phuff_entropy_ptr entropy; int i; entropy = (phuff_entropy_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, sizeof(phuff_entropy_encoder)); - cinfo->entropy = (struct jpeg_entropy_encoder *) entropy; + cinfo->entropy = (struct jpeg_entropy_encoder *)entropy; entropy->pub.start_pass = start_pass_phuff; /* Mark tables unallocated */ diff --git a/jctrans.c b/jctrans.c index a6bd1196..6748c01f 100644 --- a/jctrans.c +++ b/jctrans.c @@ -6,9 +6,9 @@ * Modified 2000-2009 by Guido Vollbeding. * libjpeg-turbo Modifications: * Copyright (C) 2020, 2022, D. R. Commander. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. - * For conditions of distribution and use, see the accompanying README file. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains library routines for transcoding compression, * that is, writing raw DCT coefficient arrays to an output JPEG file. @@ -41,7 +41,7 @@ LOCAL(void) transencode_coef_controller(j_compress_ptr cinfo, */ GLOBAL(void) -jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays) +jpeg_write_coefficients(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays) { /* setting up scan optimisation pattern failed, disable scan optimisation */ if (cinfo->master->num_scans_luma == 0) @@ -52,7 +52,7 @@ jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays) /* Mark all tables to be written */ jpeg_suppress_tables(cinfo, FALSE); /* (Re)initialize error mgr and destination modules */ - (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); + (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo); (*cinfo->dest->init_destination) (cinfo); /* Perform master selection of active modules */ transencode_master_selection(cinfo, coef_arrays); @@ -104,11 +104,11 @@ jpeg_copy_critical_parameters (const j_decompress_ptr srcinfo, j_compress_ptr ds /* Copy the source's quantization tables. */ for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) { if (srcinfo->quant_tbl_ptrs[tblno] != NULL) { - qtblptr = & dstinfo->quant_tbl_ptrs[tblno]; + qtblptr = &dstinfo->quant_tbl_ptrs[tblno]; if (*qtblptr == NULL) - *qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo); + *qtblptr = jpeg_alloc_quant_table((j_common_ptr)dstinfo); memcpy((*qtblptr)->quantval, srcinfo->quant_tbl_ptrs[tblno]->quantval, - sizeof((*qtblptr)->quantval)); + sizeof((*qtblptr)->quantval)); (*qtblptr)->sent_table = FALSE; } } @@ -171,7 +171,7 @@ jpeg_copy_critical_parameters (const j_decompress_ptr srcinfo, j_compress_ptr ds */ LOCAL(void) -transencode_master_selection (j_compress_ptr cinfo, +transencode_master_selection(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays) { /* Although we don't actually use input_components for transcoding, @@ -205,7 +205,7 @@ transencode_master_selection (j_compress_ptr cinfo, jinit_marker_writer(cinfo); /* We can now tell the memory manager to allocate virtual arrays. */ - (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); + (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo); /* Write the datastream header (SOI, JFIF) immediately. * Frame and scan headers are postponed till later. @@ -244,10 +244,10 @@ typedef my_coef_controller *my_coef_ptr; LOCAL(void) -start_iMCU_row (j_compress_ptr cinfo) +start_iMCU_row(j_compress_ptr cinfo) /* Reset within-iMCU-row counters for a new row */ { - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + my_coef_ptr coef = (my_coef_ptr)cinfo->coef; /* In an interleaved scan, an MCU row is the same as an iMCU row. * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. @@ -256,7 +256,7 @@ start_iMCU_row (j_compress_ptr cinfo) if (cinfo->comps_in_scan > 1) { coef->MCU_rows_per_iMCU_row = 1; } else { - if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1)) + if (coef->iMCU_row_num < (cinfo->total_iMCU_rows - 1)) coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; else coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; @@ -272,9 +272,9 @@ start_iMCU_row (j_compress_ptr cinfo) */ METHODDEF(void) -start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) +start_pass_coef(j_compress_ptr cinfo, J_BUF_MODE pass_mode) { - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + my_coef_ptr coef = (my_coef_ptr)cinfo->coef; if (pass_mode != JBUF_CRANK_DEST) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); @@ -295,9 +295,9 @@ start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) */ METHODDEF(boolean) -compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) +compress_output(j_compress_ptr cinfo, JSAMPIMAGE input_buf) { - my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + my_coef_ptr coef = (my_coef_ptr)cinfo->coef; JDIMENSION MCU_col_num; /* index of current MCU within row */ JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; @@ -312,9 +312,9 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; buffer[ci] = (*cinfo->mem->access_virt_barray) - ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], + ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index], coef->iMCU_row_num * compptr->v_samp_factor, - (JDIMENSION) compptr->v_samp_factor, FALSE); + (JDIMENSION)compptr->v_samp_factor, FALSE); } /* Loop to process one whole iMCU row */ @@ -331,9 +331,9 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) compptr->last_col_width; for (yindex = 0; yindex < compptr->MCU_height; yindex++) { if (coef->iMCU_row_num < last_iMCU_row || - yindex+yoffset < compptr->last_row_height) { + yindex + yoffset < compptr->last_row_height) { /* Fill in pointers to real blocks in this row */ - buffer_ptr = buffer[ci][yindex+yoffset] + start_col; + buffer_ptr = buffer[ci][yindex + yoffset] + start_col; for (xindex = 0; xindex < blockcnt; xindex++) MCU_buffer[blkn++] = buffer_ptr++; } else { @@ -348,13 +348,13 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) */ for (; xindex < compptr->MCU_width; xindex++) { MCU_buffer[blkn] = coef->dummy_buffer[blkn]; - MCU_buffer[blkn][0][0] = MCU_buffer[blkn-1][0][0]; + MCU_buffer[blkn][0][0] = MCU_buffer[blkn - 1][0][0]; blkn++; } } } /* Try to write the MCU. */ - if (! (*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) { + if (!(*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) { /* Suspension forced; update state counters and exit */ coef->MCU_vert_offset = yoffset; coef->mcu_ctr = MCU_col_num; @@ -380,7 +380,7 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) */ LOCAL(void) -transencode_coef_controller (j_compress_ptr cinfo, +transencode_coef_controller(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays) { my_coef_ptr coef; @@ -388,9 +388,9 @@ transencode_coef_controller (j_compress_ptr cinfo, int i; coef = (my_coef_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, sizeof(my_coef_controller)); - cinfo->coef = (struct jpeg_c_coef_controller *) coef; + cinfo->coef = (struct jpeg_c_coef_controller *)coef; coef->pub.start_pass = start_pass_coef; coef->pub.compress_data = compress_output; @@ -399,9 +399,9 @@ transencode_coef_controller (j_compress_ptr cinfo, /* Allocate and pre-zero space for dummy DCT blocks. */ buffer = (JBLOCKROW) - (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE, C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK)); - jzero_far((void *) buffer, C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK)); + jzero_far((void *)buffer, C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK)); for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) { coef->dummy_buffer[i] = buffer + i; } diff --git a/jdapimin.c b/jdapimin.c index b7f91f25..dda2c4bf 100644 --- a/jdapimin.c +++ b/jdapimin.c @@ -31,7 +31,7 @@ */ GLOBAL(void) -jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) +jpeg_CreateDecompress(j_decompress_ptr cinfo, int version, size_t structsize) { int i; @@ -41,7 +41,7 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); if (structsize != sizeof(struct jpeg_decompress_struct)) ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, - (int) sizeof(struct jpeg_decompress_struct), (int) structsize); + (int)sizeof(struct jpeg_decompress_struct), (int)structsize); /* For debugging purposes, we zero the whole master structure. * But the application has already set the err pointer, and may have set @@ -50,8 +50,8 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) * complain here. */ { - struct jpeg_error_mgr * err = cinfo->err; - void * client_data = cinfo->client_data; /* ignore Purify complaint here */ + struct jpeg_error_mgr *err = cinfo->err; + void *client_data = cinfo->client_data; /* ignore Purify complaint here */ memset(cinfo, 0, sizeof(struct jpeg_decompress_struct)); cinfo->err = err; cinfo->client_data = client_data; @@ -59,7 +59,7 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) cinfo->is_decompressor = TRUE; /* Initialize a memory manager instance for this object */ - jinit_memory_mgr((j_common_ptr) cinfo); + jinit_memory_mgr((j_common_ptr)cinfo); /* Zero out pointers to permanent structures. */ cinfo->progress = NULL; @@ -89,7 +89,7 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) * here. */ cinfo->master = (struct jpeg_decomp_master *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT, sizeof(my_decomp_master)); memset(cinfo->master, 0, sizeof(my_decomp_master)); } @@ -100,9 +100,9 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) */ GLOBAL(void) -jpeg_destroy_decompress (j_decompress_ptr cinfo) +jpeg_destroy_decompress(j_decompress_ptr cinfo) { - jpeg_destroy((j_common_ptr) cinfo); /* use common routine */ + jpeg_destroy((j_common_ptr)cinfo); /* use common routine */ } @@ -112,9 +112,9 @@ jpeg_destroy_decompress (j_decompress_ptr cinfo) */ GLOBAL(void) -jpeg_abort_decompress (j_decompress_ptr cinfo) +jpeg_abort_decompress(j_decompress_ptr cinfo) { - jpeg_abort((j_common_ptr) cinfo); /* use common routine */ + jpeg_abort((j_common_ptr)cinfo); /* use common routine */ } @@ -123,7 +123,7 @@ jpeg_abort_decompress (j_decompress_ptr cinfo) */ LOCAL(void) -default_decompress_parms (j_decompress_ptr cinfo) +default_decompress_parms(j_decompress_ptr cinfo) { /* Guess the input colorspace, and set output colorspace accordingly. */ /* (Wish JPEG committee had provided a real way to specify this...) */ @@ -250,7 +250,7 @@ default_decompress_parms (j_decompress_ptr cinfo) */ GLOBAL(int) -jpeg_read_header (j_decompress_ptr cinfo, boolean require_image) +jpeg_read_header(j_decompress_ptr cinfo, boolean require_image) { int retcode; @@ -271,7 +271,7 @@ jpeg_read_header (j_decompress_ptr cinfo, boolean require_image) * call jpeg_abort, but we can't change it now for compatibility reasons. * A side effect is to free any temporary memory (there shouldn't be any). */ - jpeg_abort((j_common_ptr) cinfo); /* sets state = DSTATE_START */ + jpeg_abort((j_common_ptr)cinfo); /* sets state = DSTATE_START */ retcode = JPEG_HEADER_TABLES_ONLY; break; case JPEG_SUSPENDED: @@ -296,7 +296,7 @@ jpeg_read_header (j_decompress_ptr cinfo, boolean require_image) */ GLOBAL(int) -jpeg_consume_input (j_decompress_ptr cinfo) +jpeg_consume_input(j_decompress_ptr cinfo) { int retcode = JPEG_SUSPENDED; @@ -378,10 +378,10 @@ jpeg_has_multiple_scans (const j_decompress_ptr cinfo) */ GLOBAL(boolean) -jpeg_finish_decompress (j_decompress_ptr cinfo) +jpeg_finish_decompress(j_decompress_ptr cinfo) { if ((cinfo->global_state == DSTATE_SCANNING || - cinfo->global_state == DSTATE_RAW_OK) && ! cinfo->buffered_image) { + cinfo->global_state == DSTATE_RAW_OK) && !cinfo->buffered_image) { /* Terminate final pass of non-buffered mode */ if (cinfo->output_scanline < cinfo->output_height) ERREXIT(cinfo, JERR_TOO_LITTLE_DATA); @@ -395,13 +395,13 @@ jpeg_finish_decompress (j_decompress_ptr cinfo) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); } /* Read until EOI */ - while (! cinfo->inputctl->eoi_reached) { + while (!cinfo->inputctl->eoi_reached) { if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) return FALSE; /* Suspend, come back later */ } /* Do final cleanup */ (*cinfo->src->term_source) (cinfo); /* We can use jpeg_abort to release memory and reset global_state */ - jpeg_abort((j_common_ptr) cinfo); + jpeg_abort((j_common_ptr)cinfo); return TRUE; } diff --git a/jdatadst.c b/jdatadst.c index 37b80c47..21ccaa9b 100644 --- a/jdatadst.c +++ b/jdatadst.c @@ -62,13 +62,13 @@ typedef my_mem_destination_mgr *my_mem_dest_ptr; */ METHODDEF(void) -init_destination (j_compress_ptr cinfo) +init_destination(j_compress_ptr cinfo) { - my_dest_ptr dest = (my_dest_ptr) cinfo->dest; + my_dest_ptr dest = (my_dest_ptr)cinfo->dest; /* Allocate the output buffer --- it will be released when done with image */ dest->buffer = (JOCTET *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, OUTPUT_BUF_SIZE * sizeof(JOCTET)); dest->pub.next_output_byte = dest->buffer; @@ -77,7 +77,7 @@ init_destination (j_compress_ptr cinfo) #if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) METHODDEF(void) -init_mem_destination (j_compress_ptr cinfo) +init_mem_destination(j_compress_ptr cinfo) { /* no work necessary here */ } @@ -108,12 +108,12 @@ init_mem_destination (j_compress_ptr cinfo) */ METHODDEF(boolean) -empty_output_buffer (j_compress_ptr cinfo) +empty_output_buffer(j_compress_ptr cinfo) { - my_dest_ptr dest = (my_dest_ptr) cinfo->dest; + my_dest_ptr dest = (my_dest_ptr)cinfo->dest; if (fwrite(dest->buffer, 1, OUTPUT_BUF_SIZE, dest->outfile) != - (size_t) OUTPUT_BUF_SIZE) + (size_t)OUTPUT_BUF_SIZE) ERREXIT(cinfo, JERR_FILE_WRITE); dest->pub.next_output_byte = dest->buffer; @@ -124,15 +124,15 @@ empty_output_buffer (j_compress_ptr cinfo) #if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) METHODDEF(boolean) -empty_mem_output_buffer (j_compress_ptr cinfo) +empty_mem_output_buffer(j_compress_ptr cinfo) { size_t nextsize; JOCTET *nextbuffer; - my_mem_dest_ptr dest = (my_mem_dest_ptr) cinfo->dest; + my_mem_dest_ptr dest = (my_mem_dest_ptr)cinfo->dest; /* Try to allocate new buffer with double size */ nextsize = dest->bufsize * 2; - nextbuffer = (JOCTET *) malloc(nextsize); + nextbuffer = (JOCTET *)malloc(nextsize); if (nextbuffer == NULL) ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10); @@ -164,9 +164,9 @@ empty_mem_output_buffer (j_compress_ptr cinfo) */ METHODDEF(void) -term_destination (j_compress_ptr cinfo) +term_destination(j_compress_ptr cinfo) { - my_dest_ptr dest = (my_dest_ptr) cinfo->dest; + my_dest_ptr dest = (my_dest_ptr)cinfo->dest; size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer; /* Write any data remaining in the buffer */ @@ -182,9 +182,9 @@ term_destination (j_compress_ptr cinfo) #if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) METHODDEF(void) -term_mem_destination (j_compress_ptr cinfo) +term_mem_destination(j_compress_ptr cinfo) { - my_mem_dest_ptr dest = (my_mem_dest_ptr) cinfo->dest; + my_mem_dest_ptr dest = (my_mem_dest_ptr)cinfo->dest; *dest->outbuffer = dest->buffer; *dest->outsize = (unsigned long)(dest->bufsize - dest->pub.free_in_buffer); @@ -199,7 +199,7 @@ term_mem_destination (j_compress_ptr cinfo) */ GLOBAL(void) -jpeg_stdio_dest (j_compress_ptr cinfo, FILE *outfile) +jpeg_stdio_dest(j_compress_ptr cinfo, FILE *outfile) { my_dest_ptr dest; @@ -208,7 +208,7 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE *outfile) */ if (cinfo->dest == NULL) { /* first time for this JPEG object? */ cinfo->dest = (struct jpeg_destination_mgr *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT, sizeof(my_destination_mgr)); } else if (cinfo->dest->init_destination != init_destination) { /* It is unsafe to reuse the existing destination manager unless it was @@ -220,7 +220,7 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE *outfile) ERREXIT(cinfo, JERR_BUFFER_SIZE); } - dest = (my_dest_ptr) cinfo->dest; + dest = (my_dest_ptr)cinfo->dest; dest->pub.init_destination = init_destination; dest->pub.empty_output_buffer = empty_output_buffer; dest->pub.term_destination = term_destination; @@ -266,7 +266,7 @@ jpeg_mem_dest_internal (j_compress_ptr cinfo, ERREXIT(cinfo, JERR_BUFFER_SIZE); } - dest = (my_mem_dest_ptr) cinfo->dest; + dest = (my_mem_dest_ptr)cinfo->dest; dest->pub.init_destination = init_mem_destination; dest->pub.empty_output_buffer = empty_mem_output_buffer; dest->pub.term_destination = term_mem_destination; @@ -276,7 +276,7 @@ jpeg_mem_dest_internal (j_compress_ptr cinfo, if (*outbuffer == NULL || *outsize == 0) { /* Allocate initial buffer */ - dest->newbuffer = *outbuffer = (unsigned char *) malloc(OUTPUT_BUF_SIZE); + dest->newbuffer = *outbuffer = (unsigned char *)malloc(OUTPUT_BUF_SIZE); if (dest->newbuffer == NULL) ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10); *outsize = OUTPUT_BUF_SIZE; diff --git a/jerror.h b/jerror.h index 17bccf8d..2ada370e 100644 --- a/jerror.h +++ b/jerror.h @@ -28,7 +28,7 @@ #define JMAKE_ENUM_LIST #else /* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ -#define JMESSAGE(code,string) +#define JMESSAGE(code, string) #endif /* JERROR_H */ #endif /* JMESSAGE */ @@ -36,7 +36,7 @@ typedef enum { -#define JMESSAGE(code,string) code , +#define JMESSAGE(code, string) code, #endif /* JMAKE_ENUM_LIST */ @@ -235,25 +235,25 @@ JMESSAGE(JERR_BAD_DROP_SAMPLING, /* The first parameter is either type of cinfo pointer */ /* Fatal errors (print message and exit) */ -#define ERREXIT(cinfo,code) \ +#define ERREXIT(cinfo, code) \ ((cinfo)->err->msg_code = (code), \ - (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) -#define ERREXIT1(cinfo,code,p1) \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXIT1(cinfo, code, p1) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ - (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) -#define ERREXIT2(cinfo,code,p1,p2) \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXIT2(cinfo, code, p1, p2) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ - (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) -#define ERREXIT3(cinfo,code,p1,p2,p3) \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXIT3(cinfo, code, p1, p2, p3) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ (cinfo)->err->msg_parm.i[2] = (p3), \ - (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) -#define ERREXIT4(cinfo,code,p1,p2,p3,p4) \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXIT4(cinfo, code, p1, p2, p3, p4) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ @@ -278,55 +278,55 @@ JMESSAGE(JERR_BAD_DROP_SAMPLING, #define MAKESTMT(stuff) do { stuff } while (0) /* Nonfatal errors (we can keep going, but the data is probably corrupt) */ -#define WARNMS(cinfo,code) \ +#define WARNMS(cinfo, code) \ ((cinfo)->err->msg_code = (code), \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) -#define WARNMS1(cinfo,code,p1) \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1)) +#define WARNMS1(cinfo, code, p1) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) -#define WARNMS2(cinfo,code,p1,p2) \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1)) +#define WARNMS2(cinfo, code, p1, p2) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1)) /* Informational/debugging messages */ -#define TRACEMS(cinfo,lvl,code) \ +#define TRACEMS(cinfo, lvl, code) \ ((cinfo)->err->msg_code = (code), \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) -#define TRACEMS1(cinfo,lvl,code,p1) \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl))) +#define TRACEMS1(cinfo, lvl, code, p1) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) -#define TRACEMS2(cinfo,lvl,code,p1,p2) \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl))) +#define TRACEMS2(cinfo, lvl, code, p1, p2) \ ((cinfo)->err->msg_code = (code), \ (cinfo)->err->msg_parm.i[0] = (p1), \ (cinfo)->err->msg_parm.i[1] = (p2), \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) -#define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \ - MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl))) +#define TRACEMS3(cinfo, lvl, code, p1, p2, p3) \ + MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \ (cinfo)->err->msg_code = (code); \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) -#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \ - MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); ) +#define TRACEMS4(cinfo, lvl, code, p1, p2, p3, p4) \ + MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ (cinfo)->err->msg_code = (code); \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) -#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \ - MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); ) +#define TRACEMS5(cinfo, lvl, code, p1, p2, p3, p4, p5) \ + MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ _mp[4] = (p5); \ (cinfo)->err->msg_code = (code); \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) -#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \ - MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); ) +#define TRACEMS8(cinfo, lvl, code, p1, p2, p3, p4, p5, p6, p7, p8) \ + MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \ _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \ (cinfo)->err->msg_code = (code); \ - (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) -#define TRACEMSS(cinfo,lvl,code,str) \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); ) +#define TRACEMSS(cinfo, lvl, code, str) \ ((cinfo)->err->msg_code = (code), \ strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ (cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \ diff --git a/jpegint.h b/jpegint.h index 092f98f9..91a0289e 100644 --- a/jpegint.h +++ b/jpegint.h @@ -8,7 +8,6 @@ * Copyright (C) 2015-2016, 2019, 2021, D. R. Commander. * Copyright (C) 2015, Google, Inc. * Copyright (C) 2021, Alex Richardson. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. * For conditions of distribution and use, see the accompanying README.ijg * file. @@ -352,9 +351,9 @@ struct jpeg_color_quantizer { /* Miscellaneous useful macros */ #undef MAX -#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) #undef MIN -#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) /* We assume that right shift corresponds to signed division by 2 with @@ -369,54 +368,54 @@ struct jpeg_color_quantizer { #ifdef RIGHT_SHIFT_IS_UNSIGNED #define SHIFT_TEMPS JLONG shift_temp; -#define RIGHT_SHIFT(x,shft) \ +#define RIGHT_SHIFT(x, shft) \ ((shift_temp = (x)) < 0 ? \ - (shift_temp >> (shft)) | ((~((JLONG) 0)) << (32-(shft))) : \ + (shift_temp >> (shft)) | ((~((JLONG)0)) << (32 - (shft))) : \ (shift_temp >> (shft))) #else #define SHIFT_TEMPS -#define RIGHT_SHIFT(x,shft) ((x) >> (shft)) +#define RIGHT_SHIFT(x, shft) ((x) >> (shft)) #endif /* Compression module initialization routines */ -EXTERN(void) jinit_compress_master (j_compress_ptr cinfo); -EXTERN(void) jinit_c_master_control (j_compress_ptr cinfo, +EXTERN(void) jinit_compress_master(j_compress_ptr cinfo); +EXTERN(void) jinit_c_master_control(j_compress_ptr cinfo, boolean transcode_only); -EXTERN(void) jinit_c_main_controller (j_compress_ptr cinfo, +EXTERN(void) jinit_c_main_controller(j_compress_ptr cinfo, boolean need_full_buffer); -EXTERN(void) jinit_c_prep_controller (j_compress_ptr cinfo, +EXTERN(void) jinit_c_prep_controller(j_compress_ptr cinfo, boolean need_full_buffer); -EXTERN(void) jinit_c_coef_controller (j_compress_ptr cinfo, +EXTERN(void) jinit_c_coef_controller(j_compress_ptr cinfo, boolean need_full_buffer); -EXTERN(void) jinit_color_converter (j_compress_ptr cinfo); -EXTERN(void) jinit_downsampler (j_compress_ptr cinfo); -EXTERN(void) jinit_forward_dct (j_compress_ptr cinfo); -EXTERN(void) jinit_huff_encoder (j_compress_ptr cinfo); -EXTERN(void) jinit_phuff_encoder (j_compress_ptr cinfo); -EXTERN(void) jinit_arith_encoder (j_compress_ptr cinfo); -EXTERN(void) jinit_marker_writer (j_compress_ptr cinfo); +EXTERN(void) jinit_color_converter(j_compress_ptr cinfo); +EXTERN(void) jinit_downsampler(j_compress_ptr cinfo); +EXTERN(void) jinit_forward_dct(j_compress_ptr cinfo); +EXTERN(void) jinit_huff_encoder(j_compress_ptr cinfo); +EXTERN(void) jinit_phuff_encoder(j_compress_ptr cinfo); +EXTERN(void) jinit_arith_encoder(j_compress_ptr cinfo); +EXTERN(void) jinit_marker_writer(j_compress_ptr cinfo); /* Decompression module initialization routines */ -EXTERN(void) jinit_master_decompress (j_decompress_ptr cinfo); -EXTERN(void) jinit_d_main_controller (j_decompress_ptr cinfo, +EXTERN(void) jinit_master_decompress(j_decompress_ptr cinfo); +EXTERN(void) jinit_d_main_controller(j_decompress_ptr cinfo, boolean need_full_buffer); -EXTERN(void) jinit_d_coef_controller (j_decompress_ptr cinfo, +EXTERN(void) jinit_d_coef_controller(j_decompress_ptr cinfo, boolean need_full_buffer); -EXTERN(void) jinit_d_post_controller (j_decompress_ptr cinfo, +EXTERN(void) jinit_d_post_controller(j_decompress_ptr cinfo, boolean need_full_buffer); -EXTERN(void) jinit_input_controller (j_decompress_ptr cinfo); -EXTERN(void) jinit_marker_reader (j_decompress_ptr cinfo); -EXTERN(void) jinit_huff_decoder (j_decompress_ptr cinfo); -EXTERN(void) jinit_phuff_decoder (j_decompress_ptr cinfo); -EXTERN(void) jinit_arith_decoder (j_decompress_ptr cinfo); -EXTERN(void) jinit_inverse_dct (j_decompress_ptr cinfo); -EXTERN(void) jinit_upsampler (j_decompress_ptr cinfo); -EXTERN(void) jinit_color_deconverter (j_decompress_ptr cinfo); -EXTERN(void) jinit_1pass_quantizer (j_decompress_ptr cinfo); -EXTERN(void) jinit_2pass_quantizer (j_decompress_ptr cinfo); -EXTERN(void) jinit_merged_upsampler (j_decompress_ptr cinfo); +EXTERN(void) jinit_input_controller(j_decompress_ptr cinfo); +EXTERN(void) jinit_marker_reader(j_decompress_ptr cinfo); +EXTERN(void) jinit_huff_decoder(j_decompress_ptr cinfo); +EXTERN(void) jinit_phuff_decoder(j_decompress_ptr cinfo); +EXTERN(void) jinit_arith_decoder(j_decompress_ptr cinfo); +EXTERN(void) jinit_inverse_dct(j_decompress_ptr cinfo); +EXTERN(void) jinit_upsampler(j_decompress_ptr cinfo); +EXTERN(void) jinit_color_deconverter(j_decompress_ptr cinfo); +EXTERN(void) jinit_1pass_quantizer(j_decompress_ptr cinfo); +EXTERN(void) jinit_2pass_quantizer(j_decompress_ptr cinfo); +EXTERN(void) jinit_merged_upsampler(j_decompress_ptr cinfo); /* Memory manager initialization */ -EXTERN(void) jinit_memory_mgr (j_common_ptr cinfo); +EXTERN(void) jinit_memory_mgr(j_common_ptr cinfo); #if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) EXTERN(void) @@ -425,14 +424,14 @@ jpeg_mem_dest_internal (j_compress_ptr cinfo, #endif /* Utility routines in jutils.c */ -EXTERN(long) jdiv_round_up (long a, long b); -EXTERN(long) jround_up (long a, long b); -EXTERN(void) jcopy_sample_rows (JSAMPARRAY input_array, int source_row, +EXTERN(long) jdiv_round_up(long a, long b); +EXTERN(long) jround_up(long a, long b); +EXTERN(void) jcopy_sample_rows(JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols); -EXTERN(void) jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, +EXTERN(void) jcopy_block_row(JBLOCKROW input_row, JBLOCKROW output_row, JDIMENSION num_blocks); -EXTERN(void) jzero_far (void *target, size_t bytestozero); +EXTERN(void) jzero_far(void *target, size_t bytestozero); #ifdef C_ARITH_CODING_SUPPORTED EXTERN(void) jget_arith_rates (j_compress_ptr cinfo, int dc_tbl_no, int ac_tbl_no, arith_rates *r); diff --git a/jpeglib.h b/jpeglib.h index 1a78024b..91a41955 100644 --- a/jpeglib.h +++ b/jpeglib.h @@ -7,7 +7,6 @@ * libjpeg-turbo Modifications: * Copyright (C) 2009-2011, 2013-2014, 2016-2017, 2020, 2023, D. R. Commander. * Copyright (C) 2015, Google, Inc. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. * For conditions of distribution and use, see the accompanying README.ijg * file. @@ -213,8 +212,8 @@ struct jpeg_marker_struct { /* Known color spaces. */ -#define JCS_EXTENSIONS 1 -#define JCS_ALPHA_EXTENSIONS 1 +#define JCS_EXTENSIONS 1 +#define JCS_ALPHA_EXTENSIONS 1 typedef enum { JCS_UNKNOWN, /* error/unspecified */ @@ -317,11 +316,11 @@ enum { /* Common fields between JPEG compression and decompression master structs. */ #define jpeg_common_fields \ - struct jpeg_error_mgr *err; /* Error handler module */\ - struct jpeg_memory_mgr *mem; /* Memory manager module */\ - struct jpeg_progress_mgr *progress; /* Progress monitor, or NULL if none */\ - void *client_data; /* Available for use by application */\ - boolean is_decompressor; /* So common code can tell which is which */\ + struct jpeg_error_mgr *err; /* Error handler module */ \ + struct jpeg_memory_mgr *mem; /* Memory manager module */ \ + struct jpeg_progress_mgr *progress; /* Progress monitor, or NULL if none */ \ + void *client_data; /* Available for use by application */ \ + boolean is_decompressor; /* So common code can tell which is which */ \ int global_state /* For checking call sequence validity */ /* Routines that are to be used by both halves of the library are declared @@ -873,9 +872,9 @@ struct jpeg_source_mgr { * successful. */ -#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */ -#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ -#define JPOOL_NUMPOOLS 2 +#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */ +#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ +#define JPOOL_NUMPOOLS 2 typedef struct jvirt_sarray_control *jvirt_sarray_ptr; typedef struct jvirt_barray_control *jvirt_barray_ptr; @@ -939,7 +938,7 @@ typedef boolean (*jpeg_marker_parser_method) (j_decompress_ptr cinfo); /* Default error-management setup */ -EXTERN(struct jpeg_error_mgr *) jpeg_std_error (struct jpeg_error_mgr *err); +EXTERN(struct jpeg_error_mgr *) jpeg_std_error(struct jpeg_error_mgr *err); /* Initialization of JPEG compression objects. * jpeg_create_compress() and jpeg_create_decompress() are the exported @@ -949,83 +948,83 @@ EXTERN(struct jpeg_error_mgr *) jpeg_std_error (struct jpeg_error_mgr *err); * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx. */ #define jpeg_create_compress(cinfo) \ - jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ - (size_t) sizeof(struct jpeg_compress_struct)) + jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ + (size_t)sizeof(struct jpeg_compress_struct)) #define jpeg_create_decompress(cinfo) \ - jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ - (size_t) sizeof(struct jpeg_decompress_struct)) -EXTERN(void) jpeg_CreateCompress (j_compress_ptr cinfo, int version, - size_t structsize); -EXTERN(void) jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, - size_t structsize); + jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ + (size_t)sizeof(struct jpeg_decompress_struct)) +EXTERN(void) jpeg_CreateCompress(j_compress_ptr cinfo, int version, + size_t structsize); +EXTERN(void) jpeg_CreateDecompress(j_decompress_ptr cinfo, int version, + size_t structsize); /* Destruction of JPEG compression objects */ -EXTERN(void) jpeg_destroy_compress (j_compress_ptr cinfo); -EXTERN(void) jpeg_destroy_decompress (j_decompress_ptr cinfo); +EXTERN(void) jpeg_destroy_compress(j_compress_ptr cinfo); +EXTERN(void) jpeg_destroy_decompress(j_decompress_ptr cinfo); /* Standard data source and destination managers: stdio streams. */ /* Caller is responsible for opening the file before and closing after. */ -EXTERN(void) jpeg_stdio_dest (j_compress_ptr cinfo, FILE *outfile); -EXTERN(void) jpeg_stdio_src (j_decompress_ptr cinfo, FILE *infile); +EXTERN(void) jpeg_stdio_dest(j_compress_ptr cinfo, FILE *outfile); +EXTERN(void) jpeg_stdio_src(j_decompress_ptr cinfo, FILE *infile); #if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) /* Data source and destination managers: memory buffers. */ -EXTERN(void) jpeg_mem_dest (j_compress_ptr cinfo, unsigned char **outbuffer, - unsigned long *outsize); -EXTERN(void) jpeg_mem_src (j_decompress_ptr cinfo, +EXTERN(void) jpeg_mem_dest(j_compress_ptr cinfo, unsigned char **outbuffer, + unsigned long *outsize); +EXTERN(void) jpeg_mem_src(j_decompress_ptr cinfo, const unsigned char *inbuffer, unsigned long insize); #endif /* Default parameter setup for compression */ -EXTERN(void) jpeg_set_defaults (j_compress_ptr cinfo); +EXTERN(void) jpeg_set_defaults(j_compress_ptr cinfo); /* Compression parameter setup aids */ -EXTERN(void) jpeg_set_colorspace (j_compress_ptr cinfo, - J_COLOR_SPACE colorspace); -EXTERN(void) jpeg_default_colorspace (j_compress_ptr cinfo); -EXTERN(void) jpeg_set_quality (j_compress_ptr cinfo, int quality, - boolean force_baseline); -EXTERN(void) jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, - boolean force_baseline); +EXTERN(void) jpeg_set_colorspace(j_compress_ptr cinfo, + J_COLOR_SPACE colorspace); +EXTERN(void) jpeg_default_colorspace(j_compress_ptr cinfo); +EXTERN(void) jpeg_set_quality(j_compress_ptr cinfo, int quality, + boolean force_baseline); +EXTERN(void) jpeg_set_linear_quality(j_compress_ptr cinfo, int scale_factor, + boolean force_baseline); #if JPEG_LIB_VERSION >= 70 -EXTERN(void) jpeg_default_qtables (j_compress_ptr cinfo, - boolean force_baseline); +EXTERN(void) jpeg_default_qtables(j_compress_ptr cinfo, + boolean force_baseline); #endif -EXTERN(void) jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl, - const unsigned int *basic_table, - int scale_factor, boolean force_baseline); -EXTERN(int) jpeg_quality_scaling (int quality); +EXTERN(void) jpeg_add_quant_table(j_compress_ptr cinfo, int which_tbl, + const unsigned int *basic_table, + int scale_factor, boolean force_baseline); +EXTERN(int) jpeg_quality_scaling(int quality); EXTERN(float) jpeg_float_quality_scaling (float quality); -EXTERN(void) jpeg_simple_progression (j_compress_ptr cinfo); -EXTERN(void) jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress); -EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table (j_common_ptr cinfo); -EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table (j_common_ptr cinfo); +EXTERN(void) jpeg_simple_progression(j_compress_ptr cinfo); +EXTERN(void) jpeg_suppress_tables(j_compress_ptr cinfo, boolean suppress); +EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table(j_common_ptr cinfo); +EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table(j_common_ptr cinfo); /* Main entry points for compression */ -EXTERN(void) jpeg_start_compress (j_compress_ptr cinfo, - boolean write_all_tables); -EXTERN(JDIMENSION) jpeg_write_scanlines (j_compress_ptr cinfo, - JSAMPARRAY scanlines, - JDIMENSION num_lines); -EXTERN(void) jpeg_finish_compress (j_compress_ptr cinfo); +EXTERN(void) jpeg_start_compress(j_compress_ptr cinfo, + boolean write_all_tables); +EXTERN(JDIMENSION) jpeg_write_scanlines(j_compress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION num_lines); +EXTERN(void) jpeg_finish_compress(j_compress_ptr cinfo); #if JPEG_LIB_VERSION >= 70 /* Precalculate JPEG dimensions for current compression parameters. */ -EXTERN(void) jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo); +EXTERN(void) jpeg_calc_jpeg_dimensions(j_compress_ptr cinfo); #endif /* Replaces jpeg_write_scanlines when writing raw downsampled data. */ -EXTERN(JDIMENSION) jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data, - JDIMENSION num_lines); +EXTERN(JDIMENSION) jpeg_write_raw_data(j_compress_ptr cinfo, JSAMPIMAGE data, + JDIMENSION num_lines); /* Write a special marker. See libjpeg.txt concerning safe usage. */ -EXTERN(void) jpeg_write_marker (j_compress_ptr cinfo, int marker, - const JOCTET *dataptr, unsigned int datalen); +EXTERN(void) jpeg_write_marker(j_compress_ptr cinfo, int marker, + const JOCTET *dataptr, unsigned int datalen); /* Same, but piecemeal. */ -EXTERN(void) jpeg_write_m_header (j_compress_ptr cinfo, int marker, - unsigned int datalen); -EXTERN(void) jpeg_write_m_byte (j_compress_ptr cinfo, int val); +EXTERN(void) jpeg_write_m_header(j_compress_ptr cinfo, int marker, + unsigned int datalen); +EXTERN(void) jpeg_write_m_byte(j_compress_ptr cinfo, int val); /* Alternate compression function: just write an abbreviated table file */ -EXTERN(void) jpeg_write_tables (j_compress_ptr cinfo); +EXTERN(void) jpeg_write_tables(j_compress_ptr cinfo); /* Write ICC profile. See libjpeg.txt for usage information. */ EXTERN(void) jpeg_write_icc_profile(j_compress_ptr cinfo, @@ -1034,11 +1033,11 @@ EXTERN(void) jpeg_write_icc_profile(j_compress_ptr cinfo, /* Decompression startup: read start of JPEG datastream to see what's there */ -EXTERN(int) jpeg_read_header (j_decompress_ptr cinfo, boolean require_image); +EXTERN(int) jpeg_read_header(j_decompress_ptr cinfo, boolean require_image); /* Return value is one of: */ -#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ -#define JPEG_HEADER_OK 1 /* Found valid image datastream */ -#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ +#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ +#define JPEG_HEADER_OK 1 /* Found valid image datastream */ +#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ /* If you pass require_image = TRUE (normal case), you need not check for * a TABLES_ONLY return code; an abbreviated file will cause an error exit. * JPEG_SUSPENDED is only possible if you use a data source module that can @@ -1046,27 +1045,27 @@ EXTERN(int) jpeg_read_header (j_decompress_ptr cinfo, boolean require_image); */ /* Main entry points for decompression */ -EXTERN(boolean) jpeg_start_decompress (j_decompress_ptr cinfo); -EXTERN(JDIMENSION) jpeg_read_scanlines (j_decompress_ptr cinfo, - JSAMPARRAY scanlines, - JDIMENSION max_lines); -EXTERN(JDIMENSION) jpeg_skip_scanlines (j_decompress_ptr cinfo, - JDIMENSION num_lines); -EXTERN(void) jpeg_crop_scanline (j_decompress_ptr cinfo, JDIMENSION *xoffset, - JDIMENSION *width); -EXTERN(boolean) jpeg_finish_decompress (j_decompress_ptr cinfo); +EXTERN(boolean) jpeg_start_decompress(j_decompress_ptr cinfo); +EXTERN(JDIMENSION) jpeg_read_scanlines(j_decompress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION max_lines); +EXTERN(JDIMENSION) jpeg_skip_scanlines(j_decompress_ptr cinfo, + JDIMENSION num_lines); +EXTERN(void) jpeg_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset, + JDIMENSION *width); +EXTERN(boolean) jpeg_finish_decompress(j_decompress_ptr cinfo); /* Replaces jpeg_read_scanlines when reading raw downsampled data. */ -EXTERN(JDIMENSION) jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data, - JDIMENSION max_lines); +EXTERN(JDIMENSION) jpeg_read_raw_data(j_decompress_ptr cinfo, JSAMPIMAGE data, + JDIMENSION max_lines); /* Additional entry points for buffered-image mode. */ EXTERN(boolean) jpeg_has_multiple_scans (const j_decompress_ptr cinfo); -EXTERN(boolean) jpeg_start_output (j_decompress_ptr cinfo, int scan_number); -EXTERN(boolean) jpeg_finish_output (j_decompress_ptr cinfo); +EXTERN(boolean) jpeg_start_output(j_decompress_ptr cinfo, int scan_number); +EXTERN(boolean) jpeg_finish_output(j_decompress_ptr cinfo); EXTERN(boolean) jpeg_input_complete (const j_decompress_ptr cinfo); -EXTERN(void) jpeg_new_colormap (j_decompress_ptr cinfo); -EXTERN(int) jpeg_consume_input (j_decompress_ptr cinfo); +EXTERN(void) jpeg_new_colormap(j_decompress_ptr cinfo); +EXTERN(int) jpeg_consume_input(j_decompress_ptr cinfo); /* Return value is one of: */ /* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ #define JPEG_REACHED_SOS 1 /* Reached start of new scan */ @@ -1076,25 +1075,25 @@ EXTERN(int) jpeg_consume_input (j_decompress_ptr cinfo); /* Precalculate output dimensions for current decompression parameters. */ #if JPEG_LIB_VERSION >= 80 -EXTERN(void) jpeg_core_output_dimensions (j_decompress_ptr cinfo); +EXTERN(void) jpeg_core_output_dimensions(j_decompress_ptr cinfo); #endif -EXTERN(void) jpeg_calc_output_dimensions (j_decompress_ptr cinfo); +EXTERN(void) jpeg_calc_output_dimensions(j_decompress_ptr cinfo); /* Control saving of COM and APPn markers into marker_list. */ -EXTERN(void) jpeg_save_markers (j_decompress_ptr cinfo, int marker_code, - unsigned int length_limit); +EXTERN(void) jpeg_save_markers(j_decompress_ptr cinfo, int marker_code, + unsigned int length_limit); /* Install a special processing method for COM or APPn markers. */ -EXTERN(void) jpeg_set_marker_processor (j_decompress_ptr cinfo, - int marker_code, - jpeg_marker_parser_method routine); +EXTERN(void) jpeg_set_marker_processor(j_decompress_ptr cinfo, + int marker_code, + jpeg_marker_parser_method routine); /* Read or write raw DCT coefficients --- useful for lossless transcoding. */ -EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients (j_decompress_ptr cinfo); -EXTERN(void) jpeg_write_coefficients (j_compress_ptr cinfo, - jvirt_barray_ptr *coef_arrays); +EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients(j_decompress_ptr cinfo); +EXTERN(void) jpeg_write_coefficients(j_compress_ptr cinfo, + jvirt_barray_ptr *coef_arrays); EXTERN(void) jpeg_copy_critical_parameters (const j_decompress_ptr srcinfo, - j_compress_ptr dstinfo); + j_compress_ptr dstinfo); /* If you choose to abort compression or decompression before completing * jpeg_finish_(de)compress, then you need to clean up to release memory, @@ -1102,17 +1101,17 @@ EXTERN(void) jpeg_copy_critical_parameters (const j_decompress_ptr srcinfo, * if you're done with the JPEG object, but if you want to clean it up and * reuse it, call this: */ -EXTERN(void) jpeg_abort_compress (j_compress_ptr cinfo); -EXTERN(void) jpeg_abort_decompress (j_decompress_ptr cinfo); +EXTERN(void) jpeg_abort_compress(j_compress_ptr cinfo); +EXTERN(void) jpeg_abort_decompress(j_decompress_ptr cinfo); /* Generic versions of jpeg_abort and jpeg_destroy that work on either * flavor of JPEG object. These may be more convenient in some places. */ -EXTERN(void) jpeg_abort (j_common_ptr cinfo); -EXTERN(void) jpeg_destroy (j_common_ptr cinfo); +EXTERN(void) jpeg_abort(j_common_ptr cinfo); +EXTERN(void) jpeg_destroy(j_common_ptr cinfo); /* Default restart-marker-resync procedure for use by data source modules */ -EXTERN(boolean) jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired); +EXTERN(boolean) jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired); /* Accessor functions for extension parameters */ #define JPEG_C_PARAM_SUPPORTED 1 diff --git a/jpegtran.c b/jpegtran.c index 0ad080b6..7bd588b9 100644 --- a/jpegtran.c +++ b/jpegtran.c @@ -5,9 +5,9 @@ * Copyright (C) 1995-2019, Thomas G. Lane, Guido Vollbeding. * libjpeg-turbo Modifications: * Copyright (C) 2010, 2014, 2017, 2019-2022, D. R. Commander. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. - * For conditions of distribution and use, see the accompanying README file. + * For conditions of distribution and use, see the accompanying README.ijg + * file. * * This file contains a command-line user interface for JPEG transcoding. * It is very similar to cjpeg.c, and partly to djpeg.c, but provides @@ -65,10 +65,10 @@ usage(void) fprintf(stderr, " -copy icc Copy only ICC profile markers\n"); fprintf(stderr, " -copy all Copy all extra markers\n"); #ifdef ENTROPY_OPT_SUPPORTED - fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression, enabled by default)\n"); + fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n"); #endif #ifdef C_PROGRESSIVE_SUPPORTED - fprintf(stderr, " -progressive Create progressive JPEG file (enabled by default)\n"); + fprintf(stderr, " -progressive Create progressive JPEG file\n"); #endif fprintf(stderr, " -revert Revert to standard defaults (instead of mozjpeg defaults)\n"); fprintf(stderr, " -fastcrush Disable progressive scan optimization\n"); diff --git a/jversion.h.in b/jversion.h.in index 6e4b01f4..ef370134 100644 --- a/jversion.h.in +++ b/jversion.h.in @@ -7,7 +7,6 @@ * Copyright (C) 2010, 2012-2023, D. R. Commander. * For conditions of distribution and use, see the accompanying README.ijg * file. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. * * This file contains software version identification. diff --git a/rdswitch.c b/rdswitch.c index 13cf1020..b06dab20 100644 --- a/rdswitch.c +++ b/rdswitch.c @@ -26,7 +26,7 @@ LOCAL(int) -text_getc (FILE *file) +text_getc(FILE *file) /* Read next char, skipping over any comments (# to end of line) */ /* A comment/newline sequence is returned as a newline */ { @@ -43,7 +43,7 @@ text_getc (FILE *file) LOCAL(boolean) -read_text_integer (FILE *file, long *result, int *termchar) +read_text_integer(FILE *file, long *result, int *termchar) /* Read an unsigned decimal integer from a file, store it in result */ /* Reads one trailing character after the integer; returns it in termchar */ { @@ -59,14 +59,14 @@ read_text_integer (FILE *file, long *result, int *termchar) } } while (isspace(ch)); - if (! isdigit(ch)) { + if (!isdigit(ch)) { *termchar = ch; return FALSE; } val = ch - '0'; while ((ch = text_getc(file)) != EOF) { - if (! isdigit(ch)) + if (!isdigit(ch)) break; val *= 10; val += ch - '0'; @@ -78,7 +78,7 @@ read_text_integer (FILE *file, long *result, int *termchar) #if JPEG_LIB_VERSION < 70 -static int q_scale_factor[NUM_QUANT_TBLS] = {100, 100, 100, 100}; +static int q_scale_factor[NUM_QUANT_TBLS] = { 100, 100, 100, 100 }; #endif GLOBAL(boolean) @@ -110,14 +110,14 @@ read_quant_tables(j_compress_ptr cinfo, char *filename, boolean force_baseline) fclose(fp); return FALSE; } - table[0] = (unsigned int) val; + table[0] = (unsigned int)val; for (i = 1; i < DCTSIZE2; i++) { - if (! read_text_integer(fp, &val, &termchar)) { + if (!read_text_integer(fp, &val, &termchar)) { fprintf(stderr, "Invalid table data in file %s\n", filename); fclose(fp); return FALSE; } - table[i] = (unsigned int) val; + table[i] = (unsigned int)val; } #if JPEG_LIB_VERSION >= 70 jpeg_add_quant_table(cinfo, tblno, table, cinfo->q_scale_factor[tblno], @@ -143,14 +143,14 @@ read_quant_tables(j_compress_ptr cinfo, char *filename, boolean force_baseline) #ifdef C_MULTISCAN_FILES_SUPPORTED LOCAL(boolean) -read_scan_integer (FILE *file, long *result, int *termchar) +read_scan_integer(FILE *file, long *result, int *termchar) /* Variant of read_text_integer that always looks for a non-space termchar; * this simplifies parsing of punctuation in scan scripts. */ { register int ch; - if (! read_text_integer(file, result, termchar)) + if (!read_text_integer(file, result, termchar)) return FALSE; ch = *termchar; while (ch != EOF && isspace(ch)) @@ -172,7 +172,7 @@ read_scan_integer (FILE *file, long *result, int *termchar) GLOBAL(boolean) -read_scan_script (j_compress_ptr cinfo, char *filename) +read_scan_script(j_compress_ptr cinfo, char *filename) /* Read a scan script from the specified text file. * Each entry in the file defines one scan to be emitted. * Entries are separated by semicolons ';'. @@ -209,7 +209,7 @@ read_scan_script (j_compress_ptr cinfo, char *filename) fclose(fp); return FALSE; } - scanptr->component_index[0] = (int) val; + scanptr->component_index[0] = (int)val; ncomps = 1; while (termchar == ' ') { if (ncomps >= MAX_COMPS_IN_SCAN) { @@ -218,29 +218,29 @@ read_scan_script (j_compress_ptr cinfo, char *filename) fclose(fp); return FALSE; } - if (! read_scan_integer(fp, &val, &termchar)) + if (!read_scan_integer(fp, &val, &termchar)) goto bogus; - scanptr->component_index[ncomps] = (int) val; + scanptr->component_index[ncomps] = (int)val; ncomps++; } scanptr->comps_in_scan = ncomps; if (termchar == ':') { - if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ') + if (!read_scan_integer(fp, &val, &termchar) || termchar != ' ') goto bogus; - scanptr->Ss = (int) val; - if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ') + scanptr->Ss = (int)val; + if (!read_scan_integer(fp, &val, &termchar) || termchar != ' ') goto bogus; - scanptr->Se = (int) val; - if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ') + scanptr->Se = (int)val; + if (!read_scan_integer(fp, &val, &termchar) || termchar != ' ') goto bogus; - scanptr->Ah = (int) val; - if (! read_scan_integer(fp, &val, &termchar)) + scanptr->Ah = (int)val; + if (!read_scan_integer(fp, &val, &termchar)) goto bogus; - scanptr->Al = (int) val; + scanptr->Al = (int)val; } else { /* set non-progressive parameters */ scanptr->Ss = 0; - scanptr->Se = DCTSIZE2-1; + scanptr->Se = DCTSIZE2 - 1; scanptr->Ah = 0; scanptr->Al = 0; } @@ -265,7 +265,7 @@ bogus: * but if you want to compress multiple images you'd want JPOOL_PERMANENT. */ scanptr = (jpeg_scan_info *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, scanno * sizeof(jpeg_scan_info)); memcpy(scanptr, scans, scanno * sizeof(jpeg_scan_info)); cinfo->scan_info = scanptr; @@ -506,8 +506,9 @@ static const unsigned int std_chrominance_quant_tbl[9][DCTSIZE2] = { } }; + LOCAL(void) -jpeg_default_qtables (j_compress_ptr cinfo, boolean force_baseline) +jpeg_default_qtables(j_compress_ptr cinfo, boolean force_baseline) { int quant_tbl_master_idx = 0; if (jpeg_c_int_param_supported(cinfo, JINT_BASE_QUANT_TBL_IDX)) @@ -522,7 +523,7 @@ jpeg_default_qtables (j_compress_ptr cinfo, boolean force_baseline) GLOBAL(boolean) -set_quality_ratings (j_compress_ptr cinfo, char *arg, boolean force_baseline) +set_quality_ratings(j_compress_ptr cinfo, char *arg, boolean force_baseline) /* Process a quality-ratings parameter string, of the form * N[,N,...] * If there are more q-table slots than parameters, the last value is replicated. @@ -573,7 +574,7 @@ set_quality_ratings (j_compress_ptr cinfo, char *arg, boolean force_baseline) GLOBAL(boolean) -set_quant_slots (j_compress_ptr cinfo, char *arg) +set_quant_slots(j_compress_ptr cinfo, char *arg) /* Process a quantization-table-selectors parameter string, of the form * N[,N,...] * If there are more components than parameters, the last value is replicated. @@ -592,7 +593,7 @@ set_quant_slots (j_compress_ptr cinfo, char *arg) return FALSE; if (val < 0 || val >= NUM_QUANT_TBLS) { fprintf(stderr, "JPEG quantization tables are numbered 0..%d\n", - NUM_QUANT_TBLS-1); + NUM_QUANT_TBLS - 1); return FALSE; } cinfo->comp_info[ci].quant_tbl_no = val; @@ -608,7 +609,7 @@ set_quant_slots (j_compress_ptr cinfo, char *arg) GLOBAL(boolean) -set_sample_factors (j_compress_ptr cinfo, char *arg) +set_sample_factors(j_compress_ptr cinfo, char *arg) /* Process a sample-factors parameter string, of the form * HxV[,HxV,...] * If there are more components than parameters, "1x1" is assumed for the rest. diff --git a/release/Welcome.rtf.in b/release/Welcome.rtf.in index e4021cf7..6bec24d9 100644 --- a/release/Welcome.rtf.in +++ b/release/Welcome.rtf.in @@ -14,4 +14,4 @@ \f0 \cf0 \ from the command line.\ -} \ No newline at end of file +} diff --git a/release/makemacpkg.in b/release/makemacpkg.in index 3adf541e..c87d3398 100755 --- a/release/makemacpkg.in +++ b/release/makemacpkg.in @@ -161,7 +161,7 @@ install_subbuild() if [ "$BUILDDIRARMV8" != "" ]; then install_subbuild $BUILDDIRARMV8 Armv8 armv8 arm64 - fi +fi install_name_tool -id $LIBDIR/$LIBJPEG_DSO_NAME $PKGROOT/$LIBDIR/$LIBJPEG_DSO_NAME install_name_tool -id $LIBDIR/$TURBOJPEG_DSO_NAME $PKGROOT/$LIBDIR/$TURBOJPEG_DSO_NAME diff --git a/sharedlib/CMakeLists.txt b/sharedlib/CMakeLists.txt index f13b958f..d3126ae1 100644 --- a/sharedlib/CMakeLists.txt +++ b/sharedlib/CMakeLists.txt @@ -31,7 +31,7 @@ endif() if(WIN32) if(WITH_MEM_SRCDST) set(DEFFILE ../win/jpeg${SO_MAJOR_VERSION}-memsrcdst.def) -else() + else() set(DEFFILE ../win/jpeg${SO_MAJOR_VERSION}.def) endif() endif() @@ -85,7 +85,8 @@ else() endif() endif() -add_executable(cjpeg ../cjpeg.c ../cdjpeg.c ../rdgif.c ../rdppm.c ../rdjpeg.c +add_executable(cjpeg ../cjpeg.c ../cdjpeg.c ../rdgif.c ../rdppm.c + ../rdjpeg.c ../rdswitch.c ${CJPEG_BMP_SOURCES}) set_property(TARGET cjpeg PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) target_link_libraries(cjpeg jpeg) diff --git a/simd/CMakeLists.txt b/simd/CMakeLists.txt index 13fb835a..60249001 100644 --- a/simd/CMakeLists.txt +++ b/simd/CMakeLists.txt @@ -195,7 +195,7 @@ foreach(file ${SIMD_SOURCES}) endforeach() if(MSVC_IDE OR XCODE) -set(SIMD_OBJS ${SIMD_OBJS} PARENT_SCOPE) + set(SIMD_OBJS ${SIMD_OBJS} PARENT_SCOPE) add_library(simd OBJECT ${CPU_TYPE}/jsimd.c) add_custom_target(simd-objs DEPENDS ${SIMD_OBJS}) add_dependencies(simd simd-objs) diff --git a/turbojpeg.c b/turbojpeg.c index a5e45f79..f2c62d7c 100644 --- a/turbojpeg.c +++ b/turbojpeg.c @@ -1,7 +1,6 @@ /* * Copyright (C)2009-2023 D. R. Commander. All Rights Reserved. * Copyright (C)2021 Alex Richardson. All Rights Reserved. - * mozjpeg Modifications: * Copyright (C) 2014, Mozilla Corporation. * * Redistribution and use in source and binary forms, with or without diff --git a/usage.txt b/usage.txt index b5076264..0b6036ac 100644 --- a/usage.txt +++ b/usage.txt @@ -236,7 +236,12 @@ factor will visibly blur the image, however. Switches for wizards: - -baseline Create baseline JPEG file (disable progressive coding) + -baseline Force baseline-compatible quantization tables to be + generated. This clamps quantization values to 8 bits + even at low quality settings. (This switch is poorly + named, since it does not ensure that the output is + actually baseline JPEG. For example, you can use + -baseline and -progressive together.) -qtables file Use the quantization tables given in the specified text file. diff --git a/win/jpeg62-memsrcdst.def b/win/jpeg62-memsrcdst.def index cf288d47..7bfa1f4e 100644 --- a/win/jpeg62-memsrcdst.def +++ b/win/jpeg62-memsrcdst.def @@ -1,109 +1,4 @@ EXPORTS - jcopy_block_row @ 1 ; - jcopy_sample_rows @ 2 ; - jdiv_round_up @ 3 ; - jinit_1pass_quantizer @ 4 ; - jinit_2pass_quantizer @ 5 ; - jinit_c_coef_controller @ 6 ; - jinit_c_main_controller @ 7 ; - jinit_c_master_control @ 8 ; - jinit_c_prep_controller @ 9 ; - jinit_color_converter @ 10 ; - jinit_color_deconverter @ 11 ; - jinit_compress_master @ 12 ; - jinit_d_coef_controller @ 13 ; - jinit_d_main_controller @ 14 ; - jinit_d_post_controller @ 15 ; - jinit_downsampler @ 16 ; - jinit_forward_dct @ 17 ; - jinit_huff_decoder @ 18 ; - jinit_huff_encoder @ 19 ; - jinit_input_controller @ 20 ; - jinit_inverse_dct @ 21 ; - jinit_marker_reader @ 22 ; - jinit_marker_writer @ 23 ; - jinit_master_decompress @ 24 ; - jinit_memory_mgr @ 25 ; - jinit_merged_upsampler @ 26 ; - jinit_phuff_decoder @ 27 ; - jinit_phuff_encoder @ 28 ; - jinit_upsampler @ 29 ; - jpeg_CreateCompress @ 30 ; - jpeg_CreateDecompress @ 31 ; - jpeg_abort @ 32 ; - jpeg_abort_compress @ 33 ; - jpeg_abort_decompress @ 34 ; - jpeg_add_quant_table @ 35 ; - jpeg_alloc_huff_table @ 36 ; - jpeg_alloc_quant_table @ 37 ; - jpeg_calc_output_dimensions @ 38 ; - jpeg_consume_input @ 39 ; - jpeg_copy_critical_parameters @ 40 ; - jpeg_default_colorspace @ 41 ; - jpeg_destroy @ 42 ; - jpeg_destroy_compress @ 43 ; - jpeg_destroy_decompress @ 44 ; - jpeg_fdct_float @ 45 ; - jpeg_fdct_ifast @ 46 ; - jpeg_fdct_islow @ 47 ; - jpeg_fill_bit_buffer @ 48 ; - jpeg_finish_compress @ 49 ; - jpeg_finish_decompress @ 50 ; - jpeg_finish_output @ 51 ; - jpeg_free_large @ 52 ; - jpeg_free_small @ 53 ; - jpeg_gen_optimal_table @ 54 ; - jpeg_get_large @ 55 ; - jpeg_get_small @ 56 ; - jpeg_has_multiple_scans @ 57 ; - jpeg_huff_decode @ 58 ; - jpeg_idct_1x1 @ 59 ; - jpeg_idct_2x2 @ 60 ; - jpeg_idct_4x4 @ 61 ; - jpeg_idct_float @ 62 ; - jpeg_idct_ifast @ 63 ; - jpeg_idct_islow @ 64 ; - jpeg_input_complete @ 65 ; - jpeg_make_c_derived_tbl @ 66 ; - jpeg_make_d_derived_tbl @ 67 ; - jpeg_mem_available @ 68 ; - jpeg_mem_init @ 69 ; - jpeg_mem_term @ 70 ; - jpeg_new_colormap @ 71 ; - jpeg_open_backing_store @ 72 ; - jpeg_quality_scaling @ 73 ; - jpeg_read_coefficients @ 74 ; - jpeg_read_header @ 75 ; - jpeg_read_raw_data @ 76 ; - jpeg_read_scanlines @ 77 ; - jpeg_resync_to_restart @ 78 ; - jpeg_save_markers @ 79 ; - jpeg_set_colorspace @ 80 ; - jpeg_set_defaults @ 81 ; - jpeg_set_linear_quality @ 82 ; - jpeg_set_marker_processor @ 83 ; - jpeg_set_quality @ 84 ; - jpeg_simple_progression @ 85 ; - jpeg_start_compress @ 86 ; - jpeg_start_decompress @ 87 ; - jpeg_start_output @ 88 ; - jpeg_std_error @ 89 ; - jpeg_stdio_dest @ 90 ; - jpeg_stdio_src @ 91 ; - jpeg_suppress_tables @ 92 ; - jpeg_write_coefficients @ 93 ; - jpeg_write_m_byte @ 94 ; - jpeg_write_m_header @ 95 ; - jpeg_write_marker @ 96 ; - jpeg_write_raw_data @ 97 ; - jpeg_write_scanlines @ 98 ; - jpeg_write_tables @ 99 ; - jround_up @ 100 ; - jzero_far @ 101 ; - jpeg_mem_dest @ 102 ; - jpeg_mem_src @ 103 ; - jpeg_skip_scanlines @ 104 ; - jpeg_crop_scanline @ 105 ; jpeg_c_bool_param_supported @ 200 ; jpeg_c_set_bool_param @ 201 ; jpeg_c_get_bool_param @ 202 ; @@ -114,5 +9,110 @@ EXPORTS jpeg_c_set_int_param @ 207 ; jpeg_c_get_int_param @ 208 ; jpeg_float_quality_scaling @ 1000 ; + jcopy_block_row @ 1 ; + jcopy_sample_rows @ 2 ; + jdiv_round_up @ 3 ; + jinit_1pass_quantizer @ 4 ; + jinit_2pass_quantizer @ 5 ; + jinit_c_coef_controller @ 6 ; + jinit_c_main_controller @ 7 ; + jinit_c_master_control @ 8 ; + jinit_c_prep_controller @ 9 ; + jinit_color_converter @ 10 ; + jinit_color_deconverter @ 11 ; + jinit_compress_master @ 12 ; + jinit_d_coef_controller @ 13 ; + jinit_d_main_controller @ 14 ; + jinit_d_post_controller @ 15 ; + jinit_downsampler @ 16 ; + jinit_forward_dct @ 17 ; + jinit_huff_decoder @ 18 ; + jinit_huff_encoder @ 19 ; + jinit_input_controller @ 20 ; + jinit_inverse_dct @ 21 ; + jinit_marker_reader @ 22 ; + jinit_marker_writer @ 23 ; + jinit_master_decompress @ 24 ; + jinit_memory_mgr @ 25 ; + jinit_merged_upsampler @ 26 ; + jinit_phuff_decoder @ 27 ; + jinit_phuff_encoder @ 28 ; + jinit_upsampler @ 29 ; + jpeg_CreateCompress @ 30 ; + jpeg_CreateDecompress @ 31 ; + jpeg_abort @ 32 ; + jpeg_abort_compress @ 33 ; + jpeg_abort_decompress @ 34 ; + jpeg_add_quant_table @ 35 ; + jpeg_alloc_huff_table @ 36 ; + jpeg_alloc_quant_table @ 37 ; + jpeg_calc_output_dimensions @ 38 ; + jpeg_consume_input @ 39 ; + jpeg_copy_critical_parameters @ 40 ; + jpeg_default_colorspace @ 41 ; + jpeg_destroy @ 42 ; + jpeg_destroy_compress @ 43 ; + jpeg_destroy_decompress @ 44 ; + jpeg_fdct_float @ 45 ; + jpeg_fdct_ifast @ 46 ; + jpeg_fdct_islow @ 47 ; + jpeg_fill_bit_buffer @ 48 ; + jpeg_finish_compress @ 49 ; + jpeg_finish_decompress @ 50 ; + jpeg_finish_output @ 51 ; + jpeg_free_large @ 52 ; + jpeg_free_small @ 53 ; + jpeg_gen_optimal_table @ 54 ; + jpeg_get_large @ 55 ; + jpeg_get_small @ 56 ; + jpeg_has_multiple_scans @ 57 ; + jpeg_huff_decode @ 58 ; + jpeg_idct_1x1 @ 59 ; + jpeg_idct_2x2 @ 60 ; + jpeg_idct_4x4 @ 61 ; + jpeg_idct_float @ 62 ; + jpeg_idct_ifast @ 63 ; + jpeg_idct_islow @ 64 ; + jpeg_input_complete @ 65 ; + jpeg_make_c_derived_tbl @ 66 ; + jpeg_make_d_derived_tbl @ 67 ; + jpeg_mem_available @ 68 ; + jpeg_mem_init @ 69 ; + jpeg_mem_term @ 70 ; + jpeg_new_colormap @ 71 ; + jpeg_open_backing_store @ 72 ; + jpeg_quality_scaling @ 73 ; + jpeg_read_coefficients @ 74 ; + jpeg_read_header @ 75 ; + jpeg_read_raw_data @ 76 ; + jpeg_read_scanlines @ 77 ; + jpeg_resync_to_restart @ 78 ; + jpeg_save_markers @ 79 ; + jpeg_set_colorspace @ 80 ; + jpeg_set_defaults @ 81 ; + jpeg_set_linear_quality @ 82 ; + jpeg_set_marker_processor @ 83 ; + jpeg_set_quality @ 84 ; + jpeg_simple_progression @ 85 ; + jpeg_start_compress @ 86 ; + jpeg_start_decompress @ 87 ; + jpeg_start_output @ 88 ; + jpeg_std_error @ 89 ; + jpeg_stdio_dest @ 90 ; + jpeg_stdio_src @ 91 ; + jpeg_suppress_tables @ 92 ; + jpeg_write_coefficients @ 93 ; + jpeg_write_m_byte @ 94 ; + jpeg_write_m_header @ 95 ; + jpeg_write_marker @ 96 ; + jpeg_write_raw_data @ 97 ; + jpeg_write_scanlines @ 98 ; + jpeg_write_tables @ 99 ; + jround_up @ 100 ; + jzero_far @ 101 ; + jpeg_mem_dest @ 102 ; + jpeg_mem_src @ 103 ; + jpeg_skip_scanlines @ 104 ; + jpeg_crop_scanline @ 105 ; jpeg_read_icc_profile @ 106 ; jpeg_write_icc_profile @ 107 ; diff --git a/win/jpeg62.def b/win/jpeg62.def index e45f8c63..063baec9 100644 --- a/win/jpeg62.def +++ b/win/jpeg62.def @@ -1,107 +1,4 @@ EXPORTS - jcopy_block_row @ 1 ; - jcopy_sample_rows @ 2 ; - jdiv_round_up @ 3 ; - jinit_1pass_quantizer @ 4 ; - jinit_2pass_quantizer @ 5 ; - jinit_c_coef_controller @ 6 ; - jinit_c_main_controller @ 7 ; - jinit_c_master_control @ 8 ; - jinit_c_prep_controller @ 9 ; - jinit_color_converter @ 10 ; - jinit_color_deconverter @ 11 ; - jinit_compress_master @ 12 ; - jinit_d_coef_controller @ 13 ; - jinit_d_main_controller @ 14 ; - jinit_d_post_controller @ 15 ; - jinit_downsampler @ 16 ; - jinit_forward_dct @ 17 ; - jinit_huff_decoder @ 18 ; - jinit_huff_encoder @ 19 ; - jinit_input_controller @ 20 ; - jinit_inverse_dct @ 21 ; - jinit_marker_reader @ 22 ; - jinit_marker_writer @ 23 ; - jinit_master_decompress @ 24 ; - jinit_memory_mgr @ 25 ; - jinit_merged_upsampler @ 26 ; - jinit_phuff_decoder @ 27 ; - jinit_phuff_encoder @ 28 ; - jinit_upsampler @ 29 ; - jpeg_CreateCompress @ 30 ; - jpeg_CreateDecompress @ 31 ; - jpeg_abort @ 32 ; - jpeg_abort_compress @ 33 ; - jpeg_abort_decompress @ 34 ; - jpeg_add_quant_table @ 35 ; - jpeg_alloc_huff_table @ 36 ; - jpeg_alloc_quant_table @ 37 ; - jpeg_calc_output_dimensions @ 38 ; - jpeg_consume_input @ 39 ; - jpeg_copy_critical_parameters @ 40 ; - jpeg_default_colorspace @ 41 ; - jpeg_destroy @ 42 ; - jpeg_destroy_compress @ 43 ; - jpeg_destroy_decompress @ 44 ; - jpeg_fdct_float @ 45 ; - jpeg_fdct_ifast @ 46 ; - jpeg_fdct_islow @ 47 ; - jpeg_fill_bit_buffer @ 48 ; - jpeg_finish_compress @ 49 ; - jpeg_finish_decompress @ 50 ; - jpeg_finish_output @ 51 ; - jpeg_free_large @ 52 ; - jpeg_free_small @ 53 ; - jpeg_gen_optimal_table @ 54 ; - jpeg_get_large @ 55 ; - jpeg_get_small @ 56 ; - jpeg_has_multiple_scans @ 57 ; - jpeg_huff_decode @ 58 ; - jpeg_idct_1x1 @ 59 ; - jpeg_idct_2x2 @ 60 ; - jpeg_idct_4x4 @ 61 ; - jpeg_idct_float @ 62 ; - jpeg_idct_ifast @ 63 ; - jpeg_idct_islow @ 64 ; - jpeg_input_complete @ 65 ; - jpeg_make_c_derived_tbl @ 66 ; - jpeg_make_d_derived_tbl @ 67 ; - jpeg_mem_available @ 68 ; - jpeg_mem_init @ 69 ; - jpeg_mem_term @ 70 ; - jpeg_new_colormap @ 71 ; - jpeg_open_backing_store @ 72 ; - jpeg_quality_scaling @ 73 ; - jpeg_read_coefficients @ 74 ; - jpeg_read_header @ 75 ; - jpeg_read_raw_data @ 76 ; - jpeg_read_scanlines @ 77 ; - jpeg_resync_to_restart @ 78 ; - jpeg_save_markers @ 79 ; - jpeg_set_colorspace @ 80 ; - jpeg_set_defaults @ 81 ; - jpeg_set_linear_quality @ 82 ; - jpeg_set_marker_processor @ 83 ; - jpeg_set_quality @ 84 ; - jpeg_simple_progression @ 85 ; - jpeg_start_compress @ 86 ; - jpeg_start_decompress @ 87 ; - jpeg_start_output @ 88 ; - jpeg_std_error @ 89 ; - jpeg_stdio_dest @ 90 ; - jpeg_stdio_src @ 91 ; - jpeg_suppress_tables @ 92 ; - jpeg_write_coefficients @ 93 ; - jpeg_write_m_byte @ 94 ; - jpeg_write_m_header @ 95 ; - jpeg_write_marker @ 96 ; - jpeg_write_raw_data @ 97 ; - jpeg_write_scanlines @ 98 ; - jpeg_write_tables @ 99 ; - jround_up @ 100 ; - jzero_far @ 101 ; - jpeg_skip_scanlines @ 102 ; - jpeg_crop_scanline @ 103 ; jpeg_c_bool_param_supported @ 200 ; jpeg_c_set_bool_param @ 201 ; jpeg_c_get_bool_param @ 202 ; @@ -112,5 +9,108 @@ EXPORTS jpeg_c_set_int_param @ 207 ; jpeg_c_get_int_param @ 208 ; jpeg_float_quality_scaling @ 1000 ; + jcopy_block_row @ 1 ; + jcopy_sample_rows @ 2 ; + jdiv_round_up @ 3 ; + jinit_1pass_quantizer @ 4 ; + jinit_2pass_quantizer @ 5 ; + jinit_c_coef_controller @ 6 ; + jinit_c_main_controller @ 7 ; + jinit_c_master_control @ 8 ; + jinit_c_prep_controller @ 9 ; + jinit_color_converter @ 10 ; + jinit_color_deconverter @ 11 ; + jinit_compress_master @ 12 ; + jinit_d_coef_controller @ 13 ; + jinit_d_main_controller @ 14 ; + jinit_d_post_controller @ 15 ; + jinit_downsampler @ 16 ; + jinit_forward_dct @ 17 ; + jinit_huff_decoder @ 18 ; + jinit_huff_encoder @ 19 ; + jinit_input_controller @ 20 ; + jinit_inverse_dct @ 21 ; + jinit_marker_reader @ 22 ; + jinit_marker_writer @ 23 ; + jinit_master_decompress @ 24 ; + jinit_memory_mgr @ 25 ; + jinit_merged_upsampler @ 26 ; + jinit_phuff_decoder @ 27 ; + jinit_phuff_encoder @ 28 ; + jinit_upsampler @ 29 ; + jpeg_CreateCompress @ 30 ; + jpeg_CreateDecompress @ 31 ; + jpeg_abort @ 32 ; + jpeg_abort_compress @ 33 ; + jpeg_abort_decompress @ 34 ; + jpeg_add_quant_table @ 35 ; + jpeg_alloc_huff_table @ 36 ; + jpeg_alloc_quant_table @ 37 ; + jpeg_calc_output_dimensions @ 38 ; + jpeg_consume_input @ 39 ; + jpeg_copy_critical_parameters @ 40 ; + jpeg_default_colorspace @ 41 ; + jpeg_destroy @ 42 ; + jpeg_destroy_compress @ 43 ; + jpeg_destroy_decompress @ 44 ; + jpeg_fdct_float @ 45 ; + jpeg_fdct_ifast @ 46 ; + jpeg_fdct_islow @ 47 ; + jpeg_fill_bit_buffer @ 48 ; + jpeg_finish_compress @ 49 ; + jpeg_finish_decompress @ 50 ; + jpeg_finish_output @ 51 ; + jpeg_free_large @ 52 ; + jpeg_free_small @ 53 ; + jpeg_gen_optimal_table @ 54 ; + jpeg_get_large @ 55 ; + jpeg_get_small @ 56 ; + jpeg_has_multiple_scans @ 57 ; + jpeg_huff_decode @ 58 ; + jpeg_idct_1x1 @ 59 ; + jpeg_idct_2x2 @ 60 ; + jpeg_idct_4x4 @ 61 ; + jpeg_idct_float @ 62 ; + jpeg_idct_ifast @ 63 ; + jpeg_idct_islow @ 64 ; + jpeg_input_complete @ 65 ; + jpeg_make_c_derived_tbl @ 66 ; + jpeg_make_d_derived_tbl @ 67 ; + jpeg_mem_available @ 68 ; + jpeg_mem_init @ 69 ; + jpeg_mem_term @ 70 ; + jpeg_new_colormap @ 71 ; + jpeg_open_backing_store @ 72 ; + jpeg_quality_scaling @ 73 ; + jpeg_read_coefficients @ 74 ; + jpeg_read_header @ 75 ; + jpeg_read_raw_data @ 76 ; + jpeg_read_scanlines @ 77 ; + jpeg_resync_to_restart @ 78 ; + jpeg_save_markers @ 79 ; + jpeg_set_colorspace @ 80 ; + jpeg_set_defaults @ 81 ; + jpeg_set_linear_quality @ 82 ; + jpeg_set_marker_processor @ 83 ; + jpeg_set_quality @ 84 ; + jpeg_simple_progression @ 85 ; + jpeg_start_compress @ 86 ; + jpeg_start_decompress @ 87 ; + jpeg_start_output @ 88 ; + jpeg_std_error @ 89 ; + jpeg_stdio_dest @ 90 ; + jpeg_stdio_src @ 91 ; + jpeg_suppress_tables @ 92 ; + jpeg_write_coefficients @ 93 ; + jpeg_write_m_byte @ 94 ; + jpeg_write_m_header @ 95 ; + jpeg_write_marker @ 96 ; + jpeg_write_raw_data @ 97 ; + jpeg_write_scanlines @ 98 ; + jpeg_write_tables @ 99 ; + jround_up @ 100 ; + jzero_far @ 101 ; + jpeg_skip_scanlines @ 102 ; + jpeg_crop_scanline @ 103 ; jpeg_read_icc_profile @ 104 ; jpeg_write_icc_profile @ 105 ; diff --git a/win/jpeg7-memsrcdst.def b/win/jpeg7-memsrcdst.def index 1963e1d1..85e5e104 100644 --- a/win/jpeg7-memsrcdst.def +++ b/win/jpeg7-memsrcdst.def @@ -1,111 +1,4 @@ EXPORTS - jcopy_block_row @ 1 ; - jcopy_sample_rows @ 2 ; - jdiv_round_up @ 3 ; - jinit_1pass_quantizer @ 4 ; - jinit_2pass_quantizer @ 5 ; - jinit_c_coef_controller @ 6 ; - jinit_c_main_controller @ 7 ; - jinit_c_master_control @ 8 ; - jinit_c_prep_controller @ 9 ; - jinit_color_converter @ 10 ; - jinit_color_deconverter @ 11 ; - jinit_compress_master @ 12 ; - jinit_d_coef_controller @ 13 ; - jinit_d_main_controller @ 14 ; - jinit_d_post_controller @ 15 ; - jinit_downsampler @ 16 ; - jinit_forward_dct @ 17 ; - jinit_huff_decoder @ 18 ; - jinit_huff_encoder @ 19 ; - jinit_input_controller @ 20 ; - jinit_inverse_dct @ 21 ; - jinit_marker_reader @ 22 ; - jinit_marker_writer @ 23 ; - jinit_master_decompress @ 24 ; - jinit_memory_mgr @ 25 ; - jinit_merged_upsampler @ 26 ; - jinit_phuff_decoder @ 27 ; - jinit_phuff_encoder @ 28 ; - jinit_upsampler @ 29 ; - jpeg_CreateCompress @ 30 ; - jpeg_CreateDecompress @ 31 ; - jpeg_abort @ 32 ; - jpeg_abort_compress @ 33 ; - jpeg_abort_decompress @ 34 ; - jpeg_add_quant_table @ 35 ; - jpeg_alloc_huff_table @ 36 ; - jpeg_alloc_quant_table @ 37 ; - jpeg_calc_jpeg_dimensions @ 38 ; - jpeg_calc_output_dimensions @ 39 ; - jpeg_consume_input @ 40 ; - jpeg_copy_critical_parameters @ 41 ; - jpeg_default_colorspace @ 42 ; - jpeg_default_qtables @ 43 ; - jpeg_destroy @ 44 ; - jpeg_destroy_compress @ 45 ; - jpeg_destroy_decompress @ 46 ; - jpeg_fdct_float @ 47 ; - jpeg_fdct_ifast @ 48 ; - jpeg_fdct_islow @ 49 ; - jpeg_fill_bit_buffer @ 50 ; - jpeg_finish_compress @ 51 ; - jpeg_finish_decompress @ 52 ; - jpeg_finish_output @ 53 ; - jpeg_free_large @ 54 ; - jpeg_free_small @ 55 ; - jpeg_gen_optimal_table @ 56 ; - jpeg_get_large @ 57 ; - jpeg_get_small @ 58 ; - jpeg_has_multiple_scans @ 59 ; - jpeg_huff_decode @ 60 ; - jpeg_idct_1x1 @ 61 ; - jpeg_idct_2x2 @ 62 ; - jpeg_idct_4x4 @ 63 ; - jpeg_idct_float @ 64 ; - jpeg_idct_ifast @ 65 ; - jpeg_idct_islow @ 66 ; - jpeg_input_complete @ 67 ; - jpeg_make_c_derived_tbl @ 68 ; - jpeg_make_d_derived_tbl @ 69 ; - jpeg_mem_available @ 70 ; - jpeg_mem_init @ 71 ; - jpeg_mem_term @ 72 ; - jpeg_new_colormap @ 73 ; - jpeg_open_backing_store @ 74 ; - jpeg_quality_scaling @ 75 ; - jpeg_read_coefficients @ 76 ; - jpeg_read_header @ 77 ; - jpeg_read_raw_data @ 78 ; - jpeg_read_scanlines @ 79 ; - jpeg_resync_to_restart @ 80 ; - jpeg_save_markers @ 81 ; - jpeg_set_colorspace @ 82 ; - jpeg_set_defaults @ 83 ; - jpeg_set_linear_quality @ 84 ; - jpeg_set_marker_processor @ 85 ; - jpeg_set_quality @ 86 ; - jpeg_simple_progression @ 87 ; - jpeg_start_compress @ 88 ; - jpeg_start_decompress @ 89 ; - jpeg_start_output @ 90 ; - jpeg_std_error @ 91 ; - jpeg_stdio_dest @ 92 ; - jpeg_stdio_src @ 93 ; - jpeg_suppress_tables @ 94 ; - jpeg_write_coefficients @ 95 ; - jpeg_write_m_byte @ 96 ; - jpeg_write_m_header @ 97 ; - jpeg_write_marker @ 98 ; - jpeg_write_raw_data @ 99 ; - jpeg_write_scanlines @ 100 ; - jpeg_write_tables @ 101 ; - jround_up @ 102 ; - jzero_far @ 103 ; - jpeg_mem_dest @ 104 ; - jpeg_mem_src @ 105 ; - jpeg_skip_scanlines @ 106 ; - jpeg_crop_scanline @ 107 ; jpeg_c_bool_param_supported @ 200 ; jpeg_c_set_bool_param @ 201 ; jpeg_c_get_bool_param @ 202 ; @@ -116,5 +9,112 @@ EXPORTS jpeg_c_set_int_param @ 207 ; jpeg_c_get_int_param @ 208 ; jpeg_float_quality_scaling @ 1000 ; + jcopy_block_row @ 1 ; + jcopy_sample_rows @ 2 ; + jdiv_round_up @ 3 ; + jinit_1pass_quantizer @ 4 ; + jinit_2pass_quantizer @ 5 ; + jinit_c_coef_controller @ 6 ; + jinit_c_main_controller @ 7 ; + jinit_c_master_control @ 8 ; + jinit_c_prep_controller @ 9 ; + jinit_color_converter @ 10 ; + jinit_color_deconverter @ 11 ; + jinit_compress_master @ 12 ; + jinit_d_coef_controller @ 13 ; + jinit_d_main_controller @ 14 ; + jinit_d_post_controller @ 15 ; + jinit_downsampler @ 16 ; + jinit_forward_dct @ 17 ; + jinit_huff_decoder @ 18 ; + jinit_huff_encoder @ 19 ; + jinit_input_controller @ 20 ; + jinit_inverse_dct @ 21 ; + jinit_marker_reader @ 22 ; + jinit_marker_writer @ 23 ; + jinit_master_decompress @ 24 ; + jinit_memory_mgr @ 25 ; + jinit_merged_upsampler @ 26 ; + jinit_phuff_decoder @ 27 ; + jinit_phuff_encoder @ 28 ; + jinit_upsampler @ 29 ; + jpeg_CreateCompress @ 30 ; + jpeg_CreateDecompress @ 31 ; + jpeg_abort @ 32 ; + jpeg_abort_compress @ 33 ; + jpeg_abort_decompress @ 34 ; + jpeg_add_quant_table @ 35 ; + jpeg_alloc_huff_table @ 36 ; + jpeg_alloc_quant_table @ 37 ; + jpeg_calc_jpeg_dimensions @ 38 ; + jpeg_calc_output_dimensions @ 39 ; + jpeg_consume_input @ 40 ; + jpeg_copy_critical_parameters @ 41 ; + jpeg_default_colorspace @ 42 ; + jpeg_default_qtables @ 43 ; + jpeg_destroy @ 44 ; + jpeg_destroy_compress @ 45 ; + jpeg_destroy_decompress @ 46 ; + jpeg_fdct_float @ 47 ; + jpeg_fdct_ifast @ 48 ; + jpeg_fdct_islow @ 49 ; + jpeg_fill_bit_buffer @ 50 ; + jpeg_finish_compress @ 51 ; + jpeg_finish_decompress @ 52 ; + jpeg_finish_output @ 53 ; + jpeg_free_large @ 54 ; + jpeg_free_small @ 55 ; + jpeg_gen_optimal_table @ 56 ; + jpeg_get_large @ 57 ; + jpeg_get_small @ 58 ; + jpeg_has_multiple_scans @ 59 ; + jpeg_huff_decode @ 60 ; + jpeg_idct_1x1 @ 61 ; + jpeg_idct_2x2 @ 62 ; + jpeg_idct_4x4 @ 63 ; + jpeg_idct_float @ 64 ; + jpeg_idct_ifast @ 65 ; + jpeg_idct_islow @ 66 ; + jpeg_input_complete @ 67 ; + jpeg_make_c_derived_tbl @ 68 ; + jpeg_make_d_derived_tbl @ 69 ; + jpeg_mem_available @ 70 ; + jpeg_mem_init @ 71 ; + jpeg_mem_term @ 72 ; + jpeg_new_colormap @ 73 ; + jpeg_open_backing_store @ 74 ; + jpeg_quality_scaling @ 75 ; + jpeg_read_coefficients @ 76 ; + jpeg_read_header @ 77 ; + jpeg_read_raw_data @ 78 ; + jpeg_read_scanlines @ 79 ; + jpeg_resync_to_restart @ 80 ; + jpeg_save_markers @ 81 ; + jpeg_set_colorspace @ 82 ; + jpeg_set_defaults @ 83 ; + jpeg_set_linear_quality @ 84 ; + jpeg_set_marker_processor @ 85 ; + jpeg_set_quality @ 86 ; + jpeg_simple_progression @ 87 ; + jpeg_start_compress @ 88 ; + jpeg_start_decompress @ 89 ; + jpeg_start_output @ 90 ; + jpeg_std_error @ 91 ; + jpeg_stdio_dest @ 92 ; + jpeg_stdio_src @ 93 ; + jpeg_suppress_tables @ 94 ; + jpeg_write_coefficients @ 95 ; + jpeg_write_m_byte @ 96 ; + jpeg_write_m_header @ 97 ; + jpeg_write_marker @ 98 ; + jpeg_write_raw_data @ 99 ; + jpeg_write_scanlines @ 100 ; + jpeg_write_tables @ 101 ; + jround_up @ 102 ; + jzero_far @ 103 ; + jpeg_mem_dest @ 104 ; + jpeg_mem_src @ 105 ; + jpeg_skip_scanlines @ 106 ; + jpeg_crop_scanline @ 107 ; jpeg_read_icc_profile @ 108 ; jpeg_write_icc_profile @ 109 ; diff --git a/win/jpeg7.def b/win/jpeg7.def index 5e184475..b918b719 100644 --- a/win/jpeg7.def +++ b/win/jpeg7.def @@ -1,109 +1,4 @@ EXPORTS - jcopy_block_row @ 1 ; - jcopy_sample_rows @ 2 ; - jdiv_round_up @ 3 ; - jinit_1pass_quantizer @ 4 ; - jinit_2pass_quantizer @ 5 ; - jinit_c_coef_controller @ 6 ; - jinit_c_main_controller @ 7 ; - jinit_c_master_control @ 8 ; - jinit_c_prep_controller @ 9 ; - jinit_color_converter @ 10 ; - jinit_color_deconverter @ 11 ; - jinit_compress_master @ 12 ; - jinit_d_coef_controller @ 13 ; - jinit_d_main_controller @ 14 ; - jinit_d_post_controller @ 15 ; - jinit_downsampler @ 16 ; - jinit_forward_dct @ 17 ; - jinit_huff_decoder @ 18 ; - jinit_huff_encoder @ 19 ; - jinit_input_controller @ 20 ; - jinit_inverse_dct @ 21 ; - jinit_marker_reader @ 22 ; - jinit_marker_writer @ 23 ; - jinit_master_decompress @ 24 ; - jinit_memory_mgr @ 25 ; - jinit_merged_upsampler @ 26 ; - jinit_phuff_decoder @ 27 ; - jinit_phuff_encoder @ 28 ; - jinit_upsampler @ 29 ; - jpeg_CreateCompress @ 30 ; - jpeg_CreateDecompress @ 31 ; - jpeg_abort @ 32 ; - jpeg_abort_compress @ 33 ; - jpeg_abort_decompress @ 34 ; - jpeg_add_quant_table @ 35 ; - jpeg_alloc_huff_table @ 36 ; - jpeg_alloc_quant_table @ 37 ; - jpeg_calc_jpeg_dimensions @ 38 ; - jpeg_calc_output_dimensions @ 39 ; - jpeg_consume_input @ 40 ; - jpeg_copy_critical_parameters @ 41 ; - jpeg_default_colorspace @ 42 ; - jpeg_default_qtables @ 43 ; - jpeg_destroy @ 44 ; - jpeg_destroy_compress @ 45 ; - jpeg_destroy_decompress @ 46 ; - jpeg_fdct_float @ 47 ; - jpeg_fdct_ifast @ 48 ; - jpeg_fdct_islow @ 49 ; - jpeg_fill_bit_buffer @ 50 ; - jpeg_finish_compress @ 51 ; - jpeg_finish_decompress @ 52 ; - jpeg_finish_output @ 53 ; - jpeg_free_large @ 54 ; - jpeg_free_small @ 55 ; - jpeg_gen_optimal_table @ 56 ; - jpeg_get_large @ 57 ; - jpeg_get_small @ 58 ; - jpeg_has_multiple_scans @ 59 ; - jpeg_huff_decode @ 60 ; - jpeg_idct_1x1 @ 61 ; - jpeg_idct_2x2 @ 62 ; - jpeg_idct_4x4 @ 63 ; - jpeg_idct_float @ 64 ; - jpeg_idct_ifast @ 65 ; - jpeg_idct_islow @ 66 ; - jpeg_input_complete @ 67 ; - jpeg_make_c_derived_tbl @ 68 ; - jpeg_make_d_derived_tbl @ 69 ; - jpeg_mem_available @ 70 ; - jpeg_mem_init @ 71 ; - jpeg_mem_term @ 72 ; - jpeg_new_colormap @ 73 ; - jpeg_open_backing_store @ 74 ; - jpeg_quality_scaling @ 75 ; - jpeg_read_coefficients @ 76 ; - jpeg_read_header @ 77 ; - jpeg_read_raw_data @ 78 ; - jpeg_read_scanlines @ 79 ; - jpeg_resync_to_restart @ 80 ; - jpeg_save_markers @ 81 ; - jpeg_set_colorspace @ 82 ; - jpeg_set_defaults @ 83 ; - jpeg_set_linear_quality @ 84 ; - jpeg_set_marker_processor @ 85 ; - jpeg_set_quality @ 86 ; - jpeg_simple_progression @ 87 ; - jpeg_start_compress @ 88 ; - jpeg_start_decompress @ 89 ; - jpeg_start_output @ 90 ; - jpeg_std_error @ 91 ; - jpeg_stdio_dest @ 92 ; - jpeg_stdio_src @ 93 ; - jpeg_suppress_tables @ 94 ; - jpeg_write_coefficients @ 95 ; - jpeg_write_m_byte @ 96 ; - jpeg_write_m_header @ 97 ; - jpeg_write_marker @ 98 ; - jpeg_write_raw_data @ 99 ; - jpeg_write_scanlines @ 100 ; - jpeg_write_tables @ 101 ; - jround_up @ 102 ; - jzero_far @ 103 ; - jpeg_skip_scanlines @ 104 ; - jpeg_crop_scanline @ 105 ; jpeg_c_bool_param_supported @ 200 ; jpeg_c_set_bool_param @ 201 ; jpeg_c_get_bool_param @ 202 ; @@ -114,5 +9,110 @@ EXPORTS jpeg_c_set_int_param @ 207 ; jpeg_c_get_int_param @ 208 ; jpeg_float_quality_scaling @ 1000 ; + jcopy_block_row @ 1 ; + jcopy_sample_rows @ 2 ; + jdiv_round_up @ 3 ; + jinit_1pass_quantizer @ 4 ; + jinit_2pass_quantizer @ 5 ; + jinit_c_coef_controller @ 6 ; + jinit_c_main_controller @ 7 ; + jinit_c_master_control @ 8 ; + jinit_c_prep_controller @ 9 ; + jinit_color_converter @ 10 ; + jinit_color_deconverter @ 11 ; + jinit_compress_master @ 12 ; + jinit_d_coef_controller @ 13 ; + jinit_d_main_controller @ 14 ; + jinit_d_post_controller @ 15 ; + jinit_downsampler @ 16 ; + jinit_forward_dct @ 17 ; + jinit_huff_decoder @ 18 ; + jinit_huff_encoder @ 19 ; + jinit_input_controller @ 20 ; + jinit_inverse_dct @ 21 ; + jinit_marker_reader @ 22 ; + jinit_marker_writer @ 23 ; + jinit_master_decompress @ 24 ; + jinit_memory_mgr @ 25 ; + jinit_merged_upsampler @ 26 ; + jinit_phuff_decoder @ 27 ; + jinit_phuff_encoder @ 28 ; + jinit_upsampler @ 29 ; + jpeg_CreateCompress @ 30 ; + jpeg_CreateDecompress @ 31 ; + jpeg_abort @ 32 ; + jpeg_abort_compress @ 33 ; + jpeg_abort_decompress @ 34 ; + jpeg_add_quant_table @ 35 ; + jpeg_alloc_huff_table @ 36 ; + jpeg_alloc_quant_table @ 37 ; + jpeg_calc_jpeg_dimensions @ 38 ; + jpeg_calc_output_dimensions @ 39 ; + jpeg_consume_input @ 40 ; + jpeg_copy_critical_parameters @ 41 ; + jpeg_default_colorspace @ 42 ; + jpeg_default_qtables @ 43 ; + jpeg_destroy @ 44 ; + jpeg_destroy_compress @ 45 ; + jpeg_destroy_decompress @ 46 ; + jpeg_fdct_float @ 47 ; + jpeg_fdct_ifast @ 48 ; + jpeg_fdct_islow @ 49 ; + jpeg_fill_bit_buffer @ 50 ; + jpeg_finish_compress @ 51 ; + jpeg_finish_decompress @ 52 ; + jpeg_finish_output @ 53 ; + jpeg_free_large @ 54 ; + jpeg_free_small @ 55 ; + jpeg_gen_optimal_table @ 56 ; + jpeg_get_large @ 57 ; + jpeg_get_small @ 58 ; + jpeg_has_multiple_scans @ 59 ; + jpeg_huff_decode @ 60 ; + jpeg_idct_1x1 @ 61 ; + jpeg_idct_2x2 @ 62 ; + jpeg_idct_4x4 @ 63 ; + jpeg_idct_float @ 64 ; + jpeg_idct_ifast @ 65 ; + jpeg_idct_islow @ 66 ; + jpeg_input_complete @ 67 ; + jpeg_make_c_derived_tbl @ 68 ; + jpeg_make_d_derived_tbl @ 69 ; + jpeg_mem_available @ 70 ; + jpeg_mem_init @ 71 ; + jpeg_mem_term @ 72 ; + jpeg_new_colormap @ 73 ; + jpeg_open_backing_store @ 74 ; + jpeg_quality_scaling @ 75 ; + jpeg_read_coefficients @ 76 ; + jpeg_read_header @ 77 ; + jpeg_read_raw_data @ 78 ; + jpeg_read_scanlines @ 79 ; + jpeg_resync_to_restart @ 80 ; + jpeg_save_markers @ 81 ; + jpeg_set_colorspace @ 82 ; + jpeg_set_defaults @ 83 ; + jpeg_set_linear_quality @ 84 ; + jpeg_set_marker_processor @ 85 ; + jpeg_set_quality @ 86 ; + jpeg_simple_progression @ 87 ; + jpeg_start_compress @ 88 ; + jpeg_start_decompress @ 89 ; + jpeg_start_output @ 90 ; + jpeg_std_error @ 91 ; + jpeg_stdio_dest @ 92 ; + jpeg_stdio_src @ 93 ; + jpeg_suppress_tables @ 94 ; + jpeg_write_coefficients @ 95 ; + jpeg_write_m_byte @ 96 ; + jpeg_write_m_header @ 97 ; + jpeg_write_marker @ 98 ; + jpeg_write_raw_data @ 99 ; + jpeg_write_scanlines @ 100 ; + jpeg_write_tables @ 101 ; + jround_up @ 102 ; + jzero_far @ 103 ; + jpeg_skip_scanlines @ 104 ; + jpeg_crop_scanline @ 105 ; jpeg_read_icc_profile @ 106 ; jpeg_write_icc_profile @ 107 ; diff --git a/win/jpeg8.def b/win/jpeg8.def index c2aea39a..53968b4e 100644 --- a/win/jpeg8.def +++ b/win/jpeg8.def @@ -1,112 +1,4 @@ EXPORTS - jcopy_block_row @ 1 ; - jcopy_sample_rows @ 2 ; - jdiv_round_up @ 3 ; - jinit_1pass_quantizer @ 4 ; - jinit_2pass_quantizer @ 5 ; - jinit_c_coef_controller @ 6 ; - jinit_c_main_controller @ 7 ; - jinit_c_master_control @ 8 ; - jinit_c_prep_controller @ 9 ; - jinit_color_converter @ 10 ; - jinit_color_deconverter @ 11 ; - jinit_compress_master @ 12 ; - jinit_d_coef_controller @ 13 ; - jinit_d_main_controller @ 14 ; - jinit_d_post_controller @ 15 ; - jinit_downsampler @ 16 ; - jinit_forward_dct @ 17 ; - jinit_huff_decoder @ 18 ; - jinit_huff_encoder @ 19 ; - jinit_input_controller @ 20 ; - jinit_inverse_dct @ 21 ; - jinit_marker_reader @ 22 ; - jinit_marker_writer @ 23 ; - jinit_master_decompress @ 24 ; - jinit_memory_mgr @ 25 ; - jinit_merged_upsampler @ 26 ; - jinit_phuff_decoder @ 27 ; - jinit_phuff_encoder @ 28 ; - jinit_upsampler @ 29 ; - jpeg_CreateCompress @ 30 ; - jpeg_CreateDecompress @ 31 ; - jpeg_abort @ 32 ; - jpeg_abort_compress @ 33 ; - jpeg_abort_decompress @ 34 ; - jpeg_add_quant_table @ 35 ; - jpeg_alloc_huff_table @ 36 ; - jpeg_alloc_quant_table @ 37 ; - jpeg_calc_jpeg_dimensions @ 38 ; - jpeg_calc_output_dimensions @ 39 ; - jpeg_consume_input @ 40 ; - jpeg_copy_critical_parameters @ 41 ; - jpeg_core_output_dimensions @ 42 ; - jpeg_default_colorspace @ 43 ; - jpeg_default_qtables @ 44 ; - jpeg_destroy @ 45 ; - jpeg_destroy_compress @ 46 ; - jpeg_destroy_decompress @ 47 ; - jpeg_fdct_float @ 48 ; - jpeg_fdct_ifast @ 49 ; - jpeg_fdct_islow @ 50 ; - jpeg_fill_bit_buffer @ 51 ; - jpeg_finish_compress @ 52 ; - jpeg_finish_decompress @ 53 ; - jpeg_finish_output @ 54 ; - jpeg_free_large @ 55 ; - jpeg_free_small @ 56 ; - jpeg_gen_optimal_table @ 57 ; - jpeg_get_large @ 58 ; - jpeg_get_small @ 59 ; - jpeg_has_multiple_scans @ 60 ; - jpeg_huff_decode @ 61 ; - jpeg_idct_1x1 @ 62 ; - jpeg_idct_2x2 @ 63 ; - jpeg_idct_4x4 @ 64 ; - jpeg_idct_float @ 65 ; - jpeg_idct_ifast @ 66 ; - jpeg_idct_islow @ 67 ; - jpeg_input_complete @ 68 ; - jpeg_make_c_derived_tbl @ 69 ; - jpeg_make_d_derived_tbl @ 70 ; - jpeg_mem_available @ 71 ; - jpeg_mem_dest @ 72 ; - jpeg_mem_init @ 73 ; - jpeg_mem_src @ 74 ; - jpeg_mem_term @ 75 ; - jpeg_new_colormap @ 76 ; - jpeg_open_backing_store @ 77 ; - jpeg_quality_scaling @ 78 ; - jpeg_read_coefficients @ 79 ; - jpeg_read_header @ 80 ; - jpeg_read_raw_data @ 81 ; - jpeg_read_scanlines @ 82 ; - jpeg_resync_to_restart @ 83 ; - jpeg_save_markers @ 84 ; - jpeg_set_colorspace @ 85 ; - jpeg_set_defaults @ 86 ; - jpeg_set_linear_quality @ 87 ; - jpeg_set_marker_processor @ 88 ; - jpeg_set_quality @ 89 ; - jpeg_simple_progression @ 90 ; - jpeg_start_compress @ 91 ; - jpeg_start_decompress @ 92 ; - jpeg_start_output @ 93 ; - jpeg_std_error @ 94 ; - jpeg_stdio_dest @ 95 ; - jpeg_stdio_src @ 96 ; - jpeg_suppress_tables @ 97 ; - jpeg_write_coefficients @ 98 ; - jpeg_write_m_byte @ 99 ; - jpeg_write_m_header @ 100 ; - jpeg_write_marker @ 101 ; - jpeg_write_raw_data @ 102 ; - jpeg_write_scanlines @ 103 ; - jpeg_write_tables @ 104 ; - jround_up @ 105 ; - jzero_far @ 106 ; - jpeg_skip_scanlines @ 107 ; - jpeg_crop_scanline @ 108 ; jpeg_c_bool_param_supported @ 200 ; jpeg_c_set_bool_param @ 201 ; jpeg_c_get_bool_param @ 202 ; @@ -117,5 +9,113 @@ EXPORTS jpeg_c_set_int_param @ 207 ; jpeg_c_get_int_param @ 208 ; jpeg_float_quality_scaling @ 1000 ; + jcopy_block_row @ 1 ; + jcopy_sample_rows @ 2 ; + jdiv_round_up @ 3 ; + jinit_1pass_quantizer @ 4 ; + jinit_2pass_quantizer @ 5 ; + jinit_c_coef_controller @ 6 ; + jinit_c_main_controller @ 7 ; + jinit_c_master_control @ 8 ; + jinit_c_prep_controller @ 9 ; + jinit_color_converter @ 10 ; + jinit_color_deconverter @ 11 ; + jinit_compress_master @ 12 ; + jinit_d_coef_controller @ 13 ; + jinit_d_main_controller @ 14 ; + jinit_d_post_controller @ 15 ; + jinit_downsampler @ 16 ; + jinit_forward_dct @ 17 ; + jinit_huff_decoder @ 18 ; + jinit_huff_encoder @ 19 ; + jinit_input_controller @ 20 ; + jinit_inverse_dct @ 21 ; + jinit_marker_reader @ 22 ; + jinit_marker_writer @ 23 ; + jinit_master_decompress @ 24 ; + jinit_memory_mgr @ 25 ; + jinit_merged_upsampler @ 26 ; + jinit_phuff_decoder @ 27 ; + jinit_phuff_encoder @ 28 ; + jinit_upsampler @ 29 ; + jpeg_CreateCompress @ 30 ; + jpeg_CreateDecompress @ 31 ; + jpeg_abort @ 32 ; + jpeg_abort_compress @ 33 ; + jpeg_abort_decompress @ 34 ; + jpeg_add_quant_table @ 35 ; + jpeg_alloc_huff_table @ 36 ; + jpeg_alloc_quant_table @ 37 ; + jpeg_calc_jpeg_dimensions @ 38 ; + jpeg_calc_output_dimensions @ 39 ; + jpeg_consume_input @ 40 ; + jpeg_copy_critical_parameters @ 41 ; + jpeg_core_output_dimensions @ 42 ; + jpeg_default_colorspace @ 43 ; + jpeg_default_qtables @ 44 ; + jpeg_destroy @ 45 ; + jpeg_destroy_compress @ 46 ; + jpeg_destroy_decompress @ 47 ; + jpeg_fdct_float @ 48 ; + jpeg_fdct_ifast @ 49 ; + jpeg_fdct_islow @ 50 ; + jpeg_fill_bit_buffer @ 51 ; + jpeg_finish_compress @ 52 ; + jpeg_finish_decompress @ 53 ; + jpeg_finish_output @ 54 ; + jpeg_free_large @ 55 ; + jpeg_free_small @ 56 ; + jpeg_gen_optimal_table @ 57 ; + jpeg_get_large @ 58 ; + jpeg_get_small @ 59 ; + jpeg_has_multiple_scans @ 60 ; + jpeg_huff_decode @ 61 ; + jpeg_idct_1x1 @ 62 ; + jpeg_idct_2x2 @ 63 ; + jpeg_idct_4x4 @ 64 ; + jpeg_idct_float @ 65 ; + jpeg_idct_ifast @ 66 ; + jpeg_idct_islow @ 67 ; + jpeg_input_complete @ 68 ; + jpeg_make_c_derived_tbl @ 69 ; + jpeg_make_d_derived_tbl @ 70 ; + jpeg_mem_available @ 71 ; + jpeg_mem_dest @ 72 ; + jpeg_mem_init @ 73 ; + jpeg_mem_src @ 74 ; + jpeg_mem_term @ 75 ; + jpeg_new_colormap @ 76 ; + jpeg_open_backing_store @ 77 ; + jpeg_quality_scaling @ 78 ; + jpeg_read_coefficients @ 79 ; + jpeg_read_header @ 80 ; + jpeg_read_raw_data @ 81 ; + jpeg_read_scanlines @ 82 ; + jpeg_resync_to_restart @ 83 ; + jpeg_save_markers @ 84 ; + jpeg_set_colorspace @ 85 ; + jpeg_set_defaults @ 86 ; + jpeg_set_linear_quality @ 87 ; + jpeg_set_marker_processor @ 88 ; + jpeg_set_quality @ 89 ; + jpeg_simple_progression @ 90 ; + jpeg_start_compress @ 91 ; + jpeg_start_decompress @ 92 ; + jpeg_start_output @ 93 ; + jpeg_std_error @ 94 ; + jpeg_stdio_dest @ 95 ; + jpeg_stdio_src @ 96 ; + jpeg_suppress_tables @ 97 ; + jpeg_write_coefficients @ 98 ; + jpeg_write_m_byte @ 99 ; + jpeg_write_m_header @ 100 ; + jpeg_write_marker @ 101 ; + jpeg_write_raw_data @ 102 ; + jpeg_write_scanlines @ 103 ; + jpeg_write_tables @ 104 ; + jround_up @ 105 ; + jzero_far @ 106 ; + jpeg_skip_scanlines @ 107 ; + jpeg_crop_scanline @ 108 ; jpeg_read_icc_profile @ 109 ; jpeg_write_icc_profile @ 110 ;