From e8738541c9afd657aba3efdec02d64e41c65dd32 Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 2 May 2011 00:40:13 +0000 Subject: [PATCH 01/21] Fix I/O redirection in cjpeg and djpeg on Windows git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.0.x@605 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 3 +++ win/Makerules | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 6c3b9354..6edefc05 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -37,6 +37,9 @@ libjpeg-turbo with older versions of MinGW64, you will now have to add [6] Eliminated excessive I/O overhead that occurred when reading BMP files in cjpeg. +[7] Eliminated errors in the output of cjpeg on Windows that occurred when the +application was invoked using I/O redirection (cjpeg output.jpeg). + 1.0.1 ===== diff --git a/win/Makerules b/win/Makerules index 291e1ff6..51fba682 100755 --- a/win/Makerules +++ b/win/Makerules @@ -27,7 +27,7 @@ NASM = nasm endif CFLAGS = -W3 -wd4996 -Iwin -I. -DBMP_SUPPORTED -DGIF_SUPPORTED \ - -DPPM_SUPPORTED -DTARGA_SUPPORTED + -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE ifeq ($(WIN64), yes) NAFLAGS = -fwin64 -DWIN64 -DMSVC -D__x86_64__ -Iwin/ else From 2c289bfa9b8d5259196a5402c885c47bfddf471f Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 10 May 2011 22:15:04 +0000 Subject: [PATCH 02/21] git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@612 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index fcea781a..50a6cd2d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -31,7 +31,7 @@ emulation. cjpeg. [7] Eliminated errors in the output of cjpeg on Windows that occurred when the -application was invoked using I/O redirection (cjpeg output.jpeg). +application was invoked using I/O redirection (cjpeg output.jpg). 1.1.0 From 2bfdb5d4af963e545e2384c903f6acaa29a049ec Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 10 May 2011 22:15:26 +0000 Subject: [PATCH 03/21] git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.0.x@613 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 6edefc05..f31faca4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -38,7 +38,7 @@ libjpeg-turbo with older versions of MinGW64, you will now have to add cjpeg. [7] Eliminated errors in the output of cjpeg on Windows that occurred when the -application was invoked using I/O redirection (cjpeg output.jpeg). +application was invoked using I/O redirection (cjpeg output.jpg). 1.0.1 From ba293576118469e43868bcf337a1f4360802d984 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 18 May 2011 03:50:53 +0000 Subject: [PATCH 04/21] Can't assume that current directory is in PATH git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@614 632fc199-4ca6-4c93-a231-07263d6284db --- release/libjpeg-turbo.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/libjpeg-turbo.spec.in b/release/libjpeg-turbo.spec.in index f7034c41..645be70f 100644 --- a/release/libjpeg-turbo.spec.in +++ b/release/libjpeg-turbo.spec.in @@ -43,7 +43,7 @@ available to a broader range of users and developers. #-->%setup -q #-->%build -#-->configure libdir=/opt/%{name}/%{__lib} mandir=/opt/%{name}/man JPEG_LIB_VERSION=@JPEG_LIB_VERSION@ SO_MAJOR_VERSION=@SO_MAJOR_VERSION@ SO_MINOR_VERSION=@SO_MINOR_VERSION@ --with-pic +#-->./configure libdir=/opt/%{name}/%{__lib} mandir=/opt/%{name}/man JPEG_LIB_VERSION=@JPEG_LIB_VERSION@ SO_MAJOR_VERSION=@SO_MAJOR_VERSION@ SO_MINOR_VERSION=@SO_MINOR_VERSION@ --with-pic #-->make DESTDIR=$RPM_BUILD_ROOT libdir=/opt/%{name}/%{__lib} mandir=/opt/%{name}/man %install From 7e3fd2faf509655065659148cabf87d119c4b483 Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 25 May 2011 06:04:43 +0000 Subject: [PATCH 05/21] jpegtran on Windows needs the same fix as cjpeg and djpeg to eliminate errors when I/O redirection is used. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@650 632fc199-4ca6-4c93-a231-07263d6284db --- CMakeLists.txt | 1 + ChangeLog.txt | 8 ++++++++ sharedlib/CMakeLists.txt | 1 + 3 files changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f347edd6..e69a25fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,6 +189,7 @@ target_link_libraries(djpeg-static jpeg-static) add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c) target_link_libraries(jpegtran-static jpeg-static) +set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS "-DUSE_SETMODE") add_executable(rdjpgcom rdjpgcom.c) diff --git a/ChangeLog.txt b/ChangeLog.txt index 50a6cd2d..ecba1087 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,11 @@ +1.1.2 +===== + +[1] Eliminated errors in the output of jpegtran on Windows that occurred when +the application was invoked using I/O redirection +(jpegtran output.jpg). + + 1.1.1 ===== diff --git a/sharedlib/CMakeLists.txt b/sharedlib/CMakeLists.txt index 7db7e2fd..97e06e39 100755 --- a/sharedlib/CMakeLists.txt +++ b/sharedlib/CMakeLists.txt @@ -51,6 +51,7 @@ target_link_libraries(djpeg jpeg) add_executable(jpegtran ../jpegtran.c ../cdjpeg.c ../rdswitch.c ../transupp.c) target_link_libraries(jpegtran jpeg) +set_property(TARGET jpegtran PROPERTY COMPILE_FLAGS "-DUSE_SETMODE") install(TARGETS jpeg cjpeg djpeg jpegtran ARCHIVE DESTINATION lib From bd86b76e9450aa1ce31358398ea8918b0e3df8ee Mon Sep 17 00:00:00 2001 From: DRC Date: Wed, 25 May 2011 06:09:09 +0000 Subject: [PATCH 06/21] git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.0.x@651 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index f31faca4..a2c630dc 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -37,8 +37,9 @@ libjpeg-turbo with older versions of MinGW64, you will now have to add [6] Eliminated excessive I/O overhead that occurred when reading BMP files in cjpeg. -[7] Eliminated errors in the output of cjpeg on Windows that occurred when the -application was invoked using I/O redirection (cjpeg output.jpg). +[7] Eliminated errors in the output of cjpeg and jpegtran on Windows that +occurred when the application was invoked using I/O redirection +(cjpeg output.jpg). 1.0.1 From 0571e17c550fda0b706e430e495beaa607712128 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 31 May 2011 20:17:16 +0000 Subject: [PATCH 07/21] Fix a minor ABI incompatibility caused by the introduction of new error constants into the enum in jerror.h. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@655 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 11 +++++++++++ jerror.h | 15 +++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index ecba1087..be51d288 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -5,6 +5,17 @@ the application was invoked using I/O redirection (jpegtran output.jpg). +[2] The inclusion of libjpeg v7 and v8 emulation as well as arithmetic coding +support in libjpeg-turbo v1.1.0 introduced several new error constants in +jerror.h, and these were mistakenly enabled for all emulation modes, causing +the error enum in libjpeg-turbo to have different values than the same enum in +libjpeg. This represents an ABI incompatibility, and it caused problems with +applications that took specific action based on libjpeg error values. The fix +was to include the new error constants conditionally based on whether libjpeg +v7 or v8 emulation or arithmetic coding support was enabled. Note that to +achieve full ABI compatibility with jpeg-6b, it is necessary to build +libjpeg-turbo without arithmetic coding support. + 1.1.1 ===== diff --git a/jerror.h b/jerror.h index 88f019e8..0f10f0e9 100644 --- a/jerror.h +++ b/jerror.h @@ -40,15 +40,23 @@ typedef enum { JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */ /* For maintenance convenience, list is alphabetical by message code name */ +#if JPEG_LIB_VERSION < 70 JMESSAGE(JERR_ARITH_NOTIMPL, "Sorry, arithmetic coding is not implemented") +#endif JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix") JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix") JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode") JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS") +#if JPEG_LIB_VERSION >= 70 JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request") +#endif JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range") JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported") +#if JPEG_LIB_VERSION >= 70 +JMESSAGE(JERR_BAD_DROP_SAMPLING, + "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c") +#endif JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition") JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace") JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace") @@ -95,7 +103,9 @@ JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data") JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change") JMESSAGE(JERR_NOTIMPL, "Not implemented yet") JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time") +#if defined(C_ARITH_CODING_SUPPORTED) || defined(D_ARITH_CODING_SUPPORTED) || JPEG_LIB_VERSION >= 70 JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined") +#endif JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined") JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image") @@ -173,7 +183,9 @@ JMESSAGE(JTRC_UNKNOWN_IDS, JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u") JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d") +#if defined(C_ARITH_CODING_SUPPORTED) || defined(D_ARITH_CODING_SUPPORTED) || JPEG_LIB_VERSION >= 70 JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") +#endif JMESSAGE(JWRN_BOGUS_PROGRESSION, "Inconsistent progression sequence for component %d coefficient %d") JMESSAGE(JWRN_EXTRANEOUS_DATA, @@ -186,6 +198,9 @@ JMESSAGE(JWRN_MUST_RESYNC, "Corrupt JPEG data: found marker 0x%02x instead of RST%d") JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG") JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines") +#if JPEG_LIB_VERSION < 70 +JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request") +#endif #ifdef JMAKE_ENUM_LIST From cf137ac46a0ad1c4726b79511be35b184cc1d0f9 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 31 May 2011 20:23:07 +0000 Subject: [PATCH 08/21] 1.1.2 git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@657 632fc199-4ca6-4c93-a231-07263d6284db --- CMakeLists.txt | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e69a25fb..f703acf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 2.6) project(libjpeg-turbo C) -set(VERSION 1.1.1) +set(VERSION 1.1.2) if(MINGW OR CYGWIN) execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD) diff --git a/configure.ac b/configure.ac index 10d1880c..2bf1f9aa 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.56]) -AC_INIT([libjpeg-turbo], [1.1.1]) +AC_INIT([libjpeg-turbo], [1.1.2]) BUILD=`date +%Y%m%d` AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2]) From ffdb8f22f699d7c72ed3282c4f8186f06e9a9fb4 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 21 Jun 2011 04:59:41 +0000 Subject: [PATCH 09/21] Prevent jmorecfg.h from re-defining INT32 and INT16 if those types have already been defined by the Windows system headers. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.0.x@665 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 4 ++++ win/jconfig.h | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index a2c630dc..a10f8e3a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -41,6 +41,10 @@ cjpeg. occurred when the application was invoked using I/O redirection (cjpeg output.jpg). +[8] Fixed an issue whereby Windows applications that used libjpeg-turbo would +fail to compile if the Windows system headers were included before jpeglib.h. +This issue was caused by a conflict in the definition of the INT32 type. + 1.0.1 ===== diff --git a/win/jconfig.h b/win/jconfig.h index 9cf6f102..a023455c 100644 --- a/win/jconfig.h +++ b/win/jconfig.h @@ -21,6 +21,13 @@ typedef unsigned char boolean; #endif #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ +/* Define "INT32" as int, not long, per Windows custom */ +#if !(defined(_BASETSD_H_) || defined(_BASETSD_H)) /* don't conflict if basetsd.h already read */ +typedef short INT16; +typedef signed int INT32; +#endif +#define XMD_H /* prevent jmorecfg.h from redefining it */ + #define inline __inline #ifdef JPEG_INTERNALS From fa9ff8e88cfaebc59536d1ab5ebb52be8a15088f Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 21 Jun 2011 06:17:10 +0000 Subject: [PATCH 10/21] Restore compatibility with the jpeg-6b error enum, even if arithmetic coding is enabled. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@667 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 12 +++++------- jerror.h | 8 ++++++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 6c85ad3d..f4f774eb 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -8,13 +8,11 @@ the application was invoked using I/O redirection [2] The inclusion of libjpeg v7 and v8 emulation as well as arithmetic coding support in libjpeg-turbo v1.1.0 introduced several new error constants in jerror.h, and these were mistakenly enabled for all emulation modes, causing -the error enum in libjpeg-turbo to have different values than the same enum in -libjpeg. This represents an ABI incompatibility, and it caused problems with -applications that took specific action based on libjpeg error values. The fix -was to include the new error constants conditionally based on whether libjpeg -v7 or v8 emulation or arithmetic coding support was enabled. Note that to -achieve full ABI compatibility with jpeg-6b, it is necessary to build -libjpeg-turbo without arithmetic coding support. +the error enum in libjpeg-turbo to sometimes have different values than the +same enum in libjpeg. This represents an ABI incompatibility, and it caused +problems with rare applications that took specific action based on a particular +error value. The fix was to include the new error constants conditionally +based on whether libjpeg v7 or v8 emulation was enabled. [3] Fixed an issue whereby Windows applications that used libjpeg-turbo would fail to compile if the Windows system headers were included before jpeglib.h. diff --git a/jerror.h b/jerror.h index 0f10f0e9..275086e6 100644 --- a/jerror.h +++ b/jerror.h @@ -103,7 +103,7 @@ JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data") JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change") JMESSAGE(JERR_NOTIMPL, "Not implemented yet") JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time") -#if defined(C_ARITH_CODING_SUPPORTED) || defined(D_ARITH_CODING_SUPPORTED) || JPEG_LIB_VERSION >= 70 +#if JPEG_LIB_VERSION >= 70 JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined") #endif JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") @@ -183,7 +183,7 @@ JMESSAGE(JTRC_UNKNOWN_IDS, JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u") JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d") -#if defined(C_ARITH_CODING_SUPPORTED) || defined(D_ARITH_CODING_SUPPORTED) || JPEG_LIB_VERSION >= 70 +#if JPEG_LIB_VERSION >= 70 JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") #endif JMESSAGE(JWRN_BOGUS_PROGRESSION, @@ -200,6 +200,10 @@ JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG") JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines") #if JPEG_LIB_VERSION < 70 JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request") +#if defined(C_ARITH_CODING_SUPPORTED) || defined(D_ARITH_CODING_SUPPORTED) +JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined") +JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") +#endif #endif #ifdef JMAKE_ENUM_LIST From 868ca2b377e30eef53bdb573fdefe6675a2fa005 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 15 Jul 2011 05:29:10 +0000 Subject: [PATCH 11/21] Use random noise to ensure that the JPEG image generated in the buffer size test exceeds the size of the uncompressed source image. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@670 632fc199-4ca6-4c93-a231-07263d6284db --- jpegut.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/jpegut.c b/jpegut.c index 3bbcb898..00fcdad2 100644 --- a/jpegut.c +++ b/jpegut.c @@ -35,19 +35,6 @@ int yuv=0; int exitstatus=0; #define bailout() {exitstatus=-1; goto finally;} -int pixels[9][3]= -{ - {0, 255, 0}, - {255, 0, 255}, - {255, 255, 0}, - {0, 0, 255}, - {0, 255, 255}, - {255, 0, 0}, - {255, 255, 255}, - {0, 0, 0}, - {255, 0, 0} -}; - void initbuf(unsigned char *buf, int w, int h, int ps, int flags) { int roffset=(flags&TJ_BGR)?2:0, goffset=1, boffset=(flags&TJ_BGR)?0:2, i, @@ -544,11 +531,10 @@ void dotest1(void) printf("Memory allocation failure\n"); bailout(); } memset(bmpbuf, 0, i*j*4); - for(i2=0; i2 Date: Fri, 15 Jul 2011 09:55:36 +0000 Subject: [PATCH 12/21] Windows doesn't have random() git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@671 632fc199-4ca6-4c93-a231-07263d6284db --- jpegut.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jpegut.c b/jpegut.c index 00fcdad2..e46e97a6 100644 --- a/jpegut.c +++ b/jpegut.c @@ -20,6 +20,9 @@ #include "./turbojpeg.h" #ifndef _WIN32 #define stricmp strcasecmp +#else + #include + #define random() rand() #endif #define _catch(f) {if((f)==-1) {printf("TJPEG: %s\n", tjGetErrorStr()); bailout();}} @@ -565,6 +568,9 @@ void dotest1(void) int main(int argc, char *argv[]) { int doyuv=0; + #ifdef _WIN32 + srand((unsigned int)time(NULL)); + #endif if(argc>1 && !stricmp(argv[1], "-yuv")) doyuv=1; if(doyuv) yuv=YUVENCODE; dotest(35, 39, 3, TJ_444, "test"); From 2091870c9f229868e9cd9379082b15e8bd007e31 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 19 Jul 2011 09:15:20 +0000 Subject: [PATCH 13/21] Oops. Apparently forgot to change the description when borrowing this from VirtualGL git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.0.x@673 632fc199-4ca6-4c93-a231-07263d6284db --- release/deb-control.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/deb-control.tmpl b/release/deb-control.tmpl index 55890ea7..0a3f11fa 100644 --- a/release/deb-control.tmpl +++ b/release/deb-control.tmpl @@ -5,7 +5,7 @@ Priority: optional Architecture: {__ARCH} Essential: no Maintainer: The libjpeg-turbo Project [http://www.libjpeg-turbo.org] -Description: A toolkit for displaying OpenGL applications to thin clients +Description: A SIMD-accelerated JPEG codec which provides both the libjpeg and TurboJPEG APIs libjpeg-turbo is a high-speed version of libjpeg for x86 and x86-64 processors which uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG compression and decompression. libjpeg-turbo is generally 2-4x as fast From 68a086a1479233654423409b2aa6c0047f3c7f57 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 19 Jul 2011 09:26:23 +0000 Subject: [PATCH 14/21] Trying to out-clever ourselves by having autotools generate the deb-control file broke the 32-bit supplementary DEB, so revert to the method we used in LJT 1.0 to generate this file. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@674 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 3 +++ configure.ac | 1 - release/{deb-control.in => deb-control.tmpl} | 6 +++--- release/makedpkg.in | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) rename release/{deb-control.in => deb-control.tmpl} (95%) diff --git a/ChangeLog.txt b/ChangeLog.txt index f4f774eb..e7b099eb 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -18,6 +18,9 @@ based on whether libjpeg v7 or v8 emulation was enabled. fail to compile if the Windows system headers were included before jpeglib.h. This issue was caused by a conflict in the definition of the INT32 type. +[4] Fixed 32-bit supplementary package for amd64 Debian systems which was +broken by enhancements to the packaging system in 1.1. + 1.1.1 ===== diff --git a/configure.ac b/configure.ac index 2bf1f9aa..b4d037e7 100644 --- a/configure.ac +++ b/configure.ac @@ -255,7 +255,6 @@ AC_CONFIG_HEADERS([jconfig.h]) AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec:release/libjpeg-turbo.spec.in]) AC_CONFIG_FILES([pkgscripts/makecygwinpkg:release/makecygwinpkg.in]) AC_CONFIG_FILES([pkgscripts/makedpkg:release/makedpkg.in]) -AC_CONFIG_FILES([pkgscripts/deb-control:release/deb-control.in]) AC_CONFIG_FILES([pkgscripts/makemacpkg:release/makemacpkg.in]) AC_CONFIG_FILES([pkgscripts/Description.plist:release/Description.plist.in]) AC_CONFIG_FILES([pkgscripts/Info.plist:release/Info.plist.in]) diff --git a/release/deb-control.in b/release/deb-control.tmpl similarity index 95% rename from release/deb-control.in rename to release/deb-control.tmpl index 1a2386d9..5a7377ec 100644 --- a/release/deb-control.in +++ b/release/deb-control.tmpl @@ -1,8 +1,8 @@ -Package: @PACKAGE_NAME@ -Version: @VERSION@-@BUILD@ +Package: {__PKGNAME} +Version: {__VERSION}-{__BUILD} Section: misc Priority: optional -Architecture: @DEBARCH@ +Architecture: {__ARCH} Essential: no Maintainer: The libjpeg-turbo Project [http://www.libjpeg-turbo.org] Description: A SIMD-accelerated JPEG codec which provides both the libjpeg and TurboJPEG APIs diff --git a/release/makedpkg.in b/release/makedpkg.in index 2a0539ac..aaaeacbc 100644 --- a/release/makedpkg.in +++ b/release/makedpkg.in @@ -32,7 +32,9 @@ makedeb() rm -f $PACKAGE_NAME\_$VERSION\_$DEBARCH.deb TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX` mkdir $TMPDIR/DEBIAN - cp pkgscripts/deb-control $TMPDIR/DEBIAN/control + (cat $SRCDIR/release/deb-control.tmpl | sed s/{__PKGNAME}/$PACKAGE_NAME/g \ + | sed s/{__VERSION}/$VERSION/g | sed s/{__BUILD}/$BUILD/g \ + | sed s/{__ARCH}/$DEBARCH/g > $TMPDIR/DEBIAN/control) make install prefix=$TMPDIR/opt/$DIRNAME libdir=$TMPDIR/opt/$DIRNAME/$__LIB mandir=$TMPDIR/opt/$DIRNAME/man rm -f $TMPDIR/opt/$DIRNAME/$__LIB/*.la From 105f9a94ed0d3f9752b4d63aef65f7012d1bdb79 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 29 Nov 2011 09:02:10 +0000 Subject: [PATCH 15/21] Expose NASM variable in ccmake git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@726 632fc199-4ca6-4c93-a231-07263d6284db --- simd/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simd/CMakeLists.txt b/simd/CMakeLists.txt index 263579d1..d956dacb 100755 --- a/simd/CMakeLists.txt +++ b/simd/CMakeLists.txt @@ -1,5 +1,5 @@ if(NOT DEFINED NASM) - set(NASM nasm) + set(NASM nasm CACHE PATH "Path to NASM/YASM executable") endif() if(SIMD_X86_64) From 795e6ad334d86feb4ba8e509dd126a995a8f9972 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 1 Dec 2011 11:14:18 +0000 Subject: [PATCH 16/21] Fixed non-fatal out-of-bounds read in SSE2 SIMD code reported by valgrind when decompressing a JPEG image to a bitmap buffer whose size was not a multiple of 16 bytes. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.0.x@729 632fc199-4ca6-4c93-a231-07263d6284db --- ChangeLog.txt | 6 +++++ simd/jdclrss2-64.asm | 53 ++++++++++++++++++++++++++++++++++++++++++++ simd/jdclrss2.asm | 53 ++++++++++++++++++++++++++++++++++++++++++++ simd/jdmrgss2-64.asm | 53 ++++++++++++++++++++++++++++++++++++++++++++ simd/jdmrgss2.asm | 53 ++++++++++++++++++++++++++++++++++++++++++++ simd/jsimdext.inc | 2 ++ 6 files changed, 220 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index a10f8e3a..d482563e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -45,6 +45,12 @@ occurred when the application was invoked using I/O redirection fail to compile if the Windows system headers were included before jpeglib.h. This issue was caused by a conflict in the definition of the INT32 type. +[9] Fixed out-of-bounds read in SSE2 SIMD code that occurred when decompressing +a JPEG image to a bitmap buffer whose size was not a multiple of 16 bytes. +This was more of an annoyance than an actual bug, since it did not cause any +actual run-time problems, but the issue showed up when running libjpeg-turbo in +valgrind. See http://crbug.com/72399 for more information. + 1.0.1 ===== diff --git a/simd/jdclrss2-64.asm b/simd/jdclrss2-64.asm index 4282bd26..0acf1885 100644 --- a/simd/jdclrss2-64.asm +++ b/simd/jdclrss2-64.asm @@ -292,6 +292,41 @@ EXTN(jsimd_ycc_rgb_convert_sse2): movdqa xmmA,xmmD sub rcx, byte SIZEOF_XMMWORD .column_st15: +%ifdef STRICT_MEMORY_ACCESS + ; Store the lower 8 bytes of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_MMWORD + jb short .column_st7 + movq MMWORD [rdi], xmmA + add rdi, byte SIZEOF_MMWORD + sub rcx, byte SIZEOF_MMWORD + psrldq xmmA, SIZEOF_MMWORD +.column_st7: + ; Store the lower 4 bytes of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_DWORD + jb short .column_st3 + movd DWORD [rdi], xmmA + add rdi, byte SIZEOF_DWORD + sub rcx, byte SIZEOF_DWORD + psrldq xmmA, SIZEOF_DWORD +.column_st3: + ; Store the lower 2 bytes of rax to the output when it has enough + ; space. + movd eax, xmmA + cmp rcx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [rdi], ax + add rdi, byte SIZEOF_WORD + sub rcx, byte SIZEOF_WORD + shr rax, 16 +.column_st1: + ; Store the lower 1 byte of rax to the output when it has enough + ; space. + test rcx, rcx + jz short .nextrow + mov BYTE [rdi], al +%else mov rax,rcx xor rcx, byte 0x0F shl rcx, 2 @@ -331,6 +366,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2): por xmmE,xmmC .adj0: ; ---------------- maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [rdi], xmmA +%endif ; STRICT_MEMORY_ACCESS ; --------------- %else ; RGB_PIXELSIZE == 4 ; ----------- @@ -415,6 +451,22 @@ EXTN(jsimd_ycc_rgb_convert_sse2): movdqa xmmA,xmmD sub rcx, byte SIZEOF_XMMWORD/4 .column_st15: +%ifdef STRICT_MEMORY_ACCESS + ; Store two pixels (8 bytes) of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_XMMWORD/8 + jb short .column_st7 + movq MMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD/8*4 + sub rcx, byte SIZEOF_XMMWORD/8 + psrldq xmmA, SIZEOF_XMMWORD/8*4 +.column_st7: + ; Store one pixel (4 bytes) of xmmA to the output when it has enough + ; space. + test rcx, rcx + jz short .nextrow + movd DWORD [rdi], xmmA +%else cmp rcx, byte SIZEOF_XMMWORD/16 jb near .nextrow mov rax,rcx @@ -454,6 +506,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2): por xmmE,xmmG .adj0: ; ---------------- maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [rdi], xmmA +%endif ; STRICT_MEMORY_ACCESS ; --------------- %endif ; RGB_PIXELSIZE ; --------------- diff --git a/simd/jdclrss2.asm b/simd/jdclrss2.asm index 865fa824..71547bab 100644 --- a/simd/jdclrss2.asm +++ b/simd/jdclrss2.asm @@ -304,6 +304,41 @@ EXTN(jsimd_ycc_rgb_convert_sse2): movdqa xmmA,xmmD sub ecx, byte SIZEOF_XMMWORD .column_st15: +%ifdef STRICT_MEMORY_ACCESS + ; Store the lower 8 bytes of xmmA to the output when it has enough + ; space. + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st7 + movq MMWORD [edi], xmmA + add edi, byte SIZEOF_MMWORD + sub ecx, byte SIZEOF_MMWORD + psrldq xmmA, SIZEOF_MMWORD +.column_st7: + ; Store the lower 4 bytes of xmmA to the output when it has enough + ; space. + cmp ecx, byte SIZEOF_DWORD + jb short .column_st3 + movd DWORD [edi], xmmA + add edi, byte SIZEOF_DWORD + sub ecx, byte SIZEOF_DWORD + psrldq xmmA, SIZEOF_DWORD +.column_st3: + ; Store the lower 2 bytes of eax to the output when it has enough + ; space. + movd eax, xmmA + cmp ecx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [edi], ax + add edi, byte SIZEOF_WORD + sub ecx, byte SIZEOF_WORD + shr eax, 16 +.column_st1: + ; Store the lower 1 byte of eax to the output when it has enough + ; space. + test ecx, ecx + jz short .nextrow + mov BYTE [edi], al +%else mov eax,ecx xor ecx, byte 0x0F shl ecx, 2 @@ -343,6 +378,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2): por xmmE,xmmC .adj0: ; ---------------- maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA +%endif ; STRICT_MEMORY_ACCESS ; --------------- %else ; RGB_PIXELSIZE == 4 ; ----------- @@ -428,6 +464,22 @@ EXTN(jsimd_ycc_rgb_convert_sse2): movdqa xmmA,xmmD sub ecx, byte SIZEOF_XMMWORD/4 .column_st15: +%ifdef STRICT_MEMORY_ACCESS + ; Store two pixels (8 bytes) of xmmA to the output when it has enough + ; space. + cmp ecx, byte SIZEOF_XMMWORD/8 + jb short .column_st7 + movq MMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD/8*4 + sub ecx, byte SIZEOF_XMMWORD/8 + psrldq xmmA, SIZEOF_XMMWORD/8*4 +.column_st7: + ; Store one pixel (4 bytes) of xmmA to the output when it has enough + ; space. + test ecx, ecx + jz short .nextrow + movd DWORD [edi], xmmA +%else cmp ecx, byte SIZEOF_XMMWORD/16 jb short .nextrow mov eax,ecx @@ -467,6 +519,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2): por xmmE,xmmG .adj0: ; ---------------- maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA +%endif ; STRICT_MEMORY_ACCESS ; --------------- %endif ; RGB_PIXELSIZE ; --------------- diff --git a/simd/jdmrgss2-64.asm b/simd/jdmrgss2-64.asm index 121bb82b..36e25822 100644 --- a/simd/jdmrgss2-64.asm +++ b/simd/jdmrgss2-64.asm @@ -296,6 +296,41 @@ EXTN(jsimd_h2v1_merged_upsample_sse2): movdqa xmmA,xmmD sub rcx, byte SIZEOF_XMMWORD .column_st15: +%ifdef STRICT_MEMORY_ACCESS + ; Store the lower 8 bytes of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_MMWORD + jb short .column_st7 + movq MMWORD [rdi], xmmA + add rdi, byte SIZEOF_MMWORD + sub rcx, byte SIZEOF_MMWORD + psrldq xmmA, SIZEOF_MMWORD +.column_st7: + ; Store the lower 4 bytes of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_DWORD + jb short .column_st3 + movd DWORD [rdi], xmmA + add rdi, byte SIZEOF_DWORD + sub rcx, byte SIZEOF_DWORD + psrldq xmmA, SIZEOF_DWORD +.column_st3: + ; Store the lower 2 bytes of rax to the output when it has enough + ; space. + movd eax, xmmA + cmp rcx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [rdi], ax + add rdi, byte SIZEOF_WORD + sub rcx, byte SIZEOF_WORD + shr rax, 16 +.column_st1: + ; Store the lower 1 byte of rax to the output when it has enough + ; space. + test rcx, rcx + jz short .endcolumn + mov BYTE [rdi], al +%else mov rax,rcx xor rcx, byte 0x0F shl rcx, 2 @@ -335,6 +370,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2): por xmmE,xmmC .adj0: ; ---------------- maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA +%endif ; STRICT_MEMORY_ACCESS ; --------------- %else ; RGB_PIXELSIZE == 4 ; ----------- @@ -422,6 +458,22 @@ EXTN(jsimd_h2v1_merged_upsample_sse2): movdqa xmmA,xmmD sub rcx, byte SIZEOF_XMMWORD/4 .column_st15: +%ifdef STRICT_MEMORY_ACCESS + ; Store two pixels (8 bytes) of xmmA to the output when it has enough + ; space. + cmp rcx, byte SIZEOF_XMMWORD/8 + jb short .column_st7 + movq MMWORD [rdi], xmmA + add rdi, byte SIZEOF_XMMWORD/8*4 + sub rcx, byte SIZEOF_XMMWORD/8 + psrldq xmmA, SIZEOF_XMMWORD/8*4 +.column_st7: + ; Store one pixel (4 bytes) of xmmA to the output when it has enough + ; space. + test rcx, rcx + jz short .endcolumn + movd DWORD [rdi], xmmA +%else cmp rcx, byte SIZEOF_XMMWORD/16 jb near .endcolumn mov rax,rcx @@ -461,6 +513,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2): por xmmE,xmmG .adj0: ; ---------------- maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA +%endif ; STRICT_MEMORY_ACCESS ; --------------- %endif ; RGB_PIXELSIZE ; --------------- diff --git a/simd/jdmrgss2.asm b/simd/jdmrgss2.asm index 99b7eb9f..6a0dbd91 100644 --- a/simd/jdmrgss2.asm +++ b/simd/jdmrgss2.asm @@ -309,6 +309,41 @@ EXTN(jsimd_h2v1_merged_upsample_sse2): movdqa xmmA,xmmD sub ecx, byte SIZEOF_XMMWORD .column_st15: +%ifdef STRICT_MEMORY_ACCESS + ; Store the lower 8 bytes of xmmA to the output when it has enough + ; space. + cmp ecx, byte SIZEOF_MMWORD + jb short .column_st7 + movq MMWORD [edi], xmmA + add edi, byte SIZEOF_MMWORD + sub ecx, byte SIZEOF_MMWORD + psrldq xmmA, SIZEOF_MMWORD +.column_st7: + ; Store the lower 4 bytes of xmmA to the output when it has enough + ; space. + cmp ecx, byte SIZEOF_DWORD + jb short .column_st3 + movd DWORD [edi], xmmA + add edi, byte SIZEOF_DWORD + sub ecx, byte SIZEOF_DWORD + psrldq xmmA, SIZEOF_DWORD +.column_st3: + ; Store the lower 2 bytes of eax to the output when it has enough + ; space. + movd eax, xmmA + cmp ecx, byte SIZEOF_WORD + jb short .column_st1 + mov WORD [edi], ax + add edi, byte SIZEOF_WORD + sub ecx, byte SIZEOF_WORD + shr eax, 16 +.column_st1: + ; Store the lower 1 byte of eax to the output when it has enough + ; space. + test ecx, ecx + jz short .endcolumn + mov BYTE [edi], al +%else mov eax,ecx xor ecx, byte 0x0F shl ecx, 2 @@ -348,6 +383,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2): por xmmE,xmmC .adj0: ; ---------------- maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA +%endif ; STRICT_MEMORY_ACCESS ; --------------- %else ; RGB_PIXELSIZE == 4 ; ----------- @@ -436,6 +472,22 @@ EXTN(jsimd_h2v1_merged_upsample_sse2): movdqa xmmA,xmmD sub ecx, byte SIZEOF_XMMWORD/4 .column_st15: +%ifdef STRICT_MEMORY_ACCESS + ; Store two pixels (8 bytes) of xmmA to the output when it has enough + ; space. + cmp ecx, byte SIZEOF_XMMWORD/8 + jb short .column_st7 + movq MMWORD [edi], xmmA + add edi, byte SIZEOF_XMMWORD/2 + sub ecx, byte SIZEOF_XMMWORD/8 + psrldq xmmA, 64 +.column_st7: + ; Store one pixel (4 bytes) of xmmA to the output when it has enough + ; space. + test ecx, ecx + jz short .endcolumn + movd DWORD [edi], xmmA +%else cmp ecx, byte SIZEOF_XMMWORD/16 jb short .endcolumn mov eax,ecx @@ -475,6 +527,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2): por xmmE,xmmG .adj0: ; ---------------- maskmovdqu xmmA,xmmE ; movntdqu XMMWORD [edi], xmmA +%endif ; STRICT_MEMORY_ACCESS ; --------------- %endif ; RGB_PIXELSIZE ; --------------- diff --git a/simd/jsimdext.inc b/simd/jsimdext.inc index c4297f9c..12a04c2e 100644 --- a/simd/jsimdext.inc +++ b/simd/jsimdext.inc @@ -76,6 +76,8 @@ section .note.GNU-stack noalloc noexec nowrite progbits %define SEG_CONST .rodata progbits alloc noexec nowrite align=16 %endif +%define STRICT_MEMORY_ACCESS 1 + ; To make the code position-independent, append -DPIC to the commandline ; %define GOT_SYMBOL _GLOBAL_OFFSET_TABLE_ ; ELF supports PIC From 307156de3373574930f8dd5428d58a41082a7f8a Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 17 Jan 2012 23:09:24 +0000 Subject: [PATCH 17/21] Merge wordsmithing/grammar fixes from trunk git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@737 632fc199-4ca6-4c93-a231-07263d6284db --- BUILDING.txt | 6 +++--- ChangeLog.txt | 18 ++++++++++-------- README-turbo.txt | 22 +++++++++++----------- turbojpeg.h | 14 +++++++------- 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/BUILDING.txt b/BUILDING.txt index 846e9698..70fa4005 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -11,7 +11,7 @@ Build Requirements -- automake 1.7 or later -- libtool 1.4 or later --- NASM +-- NASM (if building x86 or x86-64 SIMD extensions) * 0.98, or 2.01 or later is required for a 32-bit build * NASM 2.00 or later is required for a 64-bit build * NASM 2.07 or later is required for a 64-bit build on OS X. This can be @@ -553,7 +553,7 @@ make dmg make udmg [BUILDDIR32={32-bit build directory}] On 64-bit OS X systems, this creates a version of the Macintosh package and - disk image which contains universal i386/x86-64 binaries. You should first + disk image that contains universal i386/x86-64 binaries. You should first configure a 32-bit out-of-tree build of libjpeg-turbo, 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 @@ -566,7 +566,7 @@ make sunpkg make csunpkg [BUILDDIR32={32-bit build directory}] - On 64-bit Solaris systems, this creates a combined package which contains + On 64-bit Solaris systems, this creates a combined package that contains both 32-bit and 64-bit libraries. You should first configure a 32-bit out-of-tree build of libjpeg-turbo, then configure a 64-bit out-of-tree build, then run 'make csunpkg' from the 64-bit build directory. The build diff --git a/ChangeLog.txt b/ChangeLog.txt index fe264d50..00441d2b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -18,7 +18,7 @@ based on whether libjpeg v7 or v8 emulation was enabled. fail to compile if the Windows system headers were included before jpeglib.h. This issue was caused by a conflict in the definition of the INT32 type. -[4] Fixed 32-bit supplementary package for amd64 Debian systems which was +[4] Fixed 32-bit supplementary package for amd64 Debian systems, which was broken by enhancements to the packaging system in 1.1. [5] Fixed out-of-bounds read in SSE2 SIMD code that occurred when decompressing @@ -105,7 +105,8 @@ README-turbo.txt for more details. This feature was sponsored by CamTrace SAS. [2] Created a new CMake-based build system for the Visual C++ and MinGW builds. -[3] TurboJPEG/OSS can now compress from/decompress to grayscale bitmaps. +[3] Grayscale bitmaps can now be compressed from/decompressed to using the +TurboJPEG API. [4] jpgtest can now be used to test decompression performance with existing JPEG images. @@ -121,11 +122,12 @@ when the library is built with libjpeg v6b emulation. [7] Added arithmetic encoding and decoding support (can be disabled with configure or CMake options) -[8] Added a TJ_YUV flag to TurboJPEG/OSS which causes both the compressor and -decompressor to output planar YUV images. +[8] Added a TJ_YUV flag to the TurboJPEG API, which causes both the compressor +and decompressor to output planar YUV images. -[9] Added an extended version of tjDecompressHeader() to TurboJPEG/OSS which -allows the caller to determine the type of subsampling used in a JPEG image. +[9] Added an extended version of tjDecompressHeader() to the TurboJPEG API, +which allows the caller to determine the type of subsampling used in a JPEG +image. [10] Added further protections against invalid Huffman codes. @@ -137,7 +139,7 @@ allows the caller to determine the type of subsampling used in a JPEG image. from a corrupt JPEG image.) Previously, these would cause libjpeg-turbo to crash under certain circumstances. -[2] Fixed typo in SIMD dispatch routines which was causing 4:2:2 upsampling to +[2] Fixed typo in SIMD dispatch routines that was causing 4:2:2 upsampling to be used instead of 4:2:0 when decompressing JPEG images using SSE2 code. [3] configure script will now automatically determine whether the @@ -158,7 +160,7 @@ static libraries can always be found in /opt/libjpeg-turbo/lib32, and the [3] The Unix/Linux distribution packages now include the libjpeg run-time programs (cjpeg, etc.) and man pages. -[4] Created a 32-bit supplementary package for amd64 Debian systems which +[4] Created a 32-bit supplementary package for amd64 Debian systems, which contains just the 32-bit libjpeg-turbo libraries. [5] Moved the libraries from */lib32 to */lib in the i386 Debian package. diff --git a/README-turbo.txt b/README-turbo.txt index fec34e0c..a385270c 100755 --- a/README-turbo.txt +++ b/README-turbo.txt @@ -2,7 +2,7 @@ ** Background ******************************************************************************* -libjpeg-turbo is a derivative of libjpeg which uses SIMD instructions (MMX, +libjpeg-turbo is a derivative of libjpeg that uses SIMD instructions (MMX, SSE2, etc.) to accelerate baseline JPEG compression and decompression on x86 and x86-64 systems. On such systems, libjpeg-turbo is generally 2-4x as fast as the unmodified version of libjpeg, all else being equal. @@ -28,10 +28,10 @@ libraries can be used as drop-in replacements for libjpeg on most systems. The TurboJPEG/OSS wrapper, as well as some of the optimizations to the Huffman encoder (jchuff.c) and decoder (jdhuff.c), were borrowed from VirtualGL, and -thus any distribution of libjpeg-turbo which includes those files must, as a +thus any distribution of libjpeg-turbo that includes those files must, as a whole, be subject to the terms of the wxWindows Library Licence, Version 3.1. A copy of this license can be found in this directory under LICENSE.txt. The -wxWindows Library License is based on the LGPL but includes provisions which +wxWindows Library License is based on the LGPL but includes provisions that allow the Library to be statically linked into proprietary libraries and applications without requiring the resulting binaries to be distributed under the terms of the LGPL. @@ -93,7 +93,7 @@ msvcr90.dll ships with more recent versions of Windows, but users of older Windows releases can obtain it from the Visual C++ 2008 Redistributable Package, which is available as a free download from Microsoft's web site. -NOTE: Features of libjpeg which require passing a C run time structure, such +NOTE: Features of libjpeg that require passing a C run time structure, such as a file handle, from an application to libjpeg will probably not work with the version of the libjpeg-turbo DLL distributed in the libjpeg-turbo SDK for Visual C++, unless the application is also built to use the Visual C++ 2008 C @@ -179,8 +179,8 @@ libjpeg-turbo) or jpeg-static.lib (to use the static version of libjpeg-turbo.) Colorspace Extensions ===================== -libjpeg-turbo includes extensions which allow JPEG images to be compressed -directly from (and decompressed directly to) buffers which use BGR, BGRX, +libjpeg-turbo includes extensions that allow JPEG images to be compressed +directly from (and decompressed directly to) buffers that use BGR, BGRX, RGBX, XBGR, and XRGB pixel ordering. This is implemented with six new colorspace constants: @@ -194,7 +194,7 @@ colorspace constants: Setting cinfo.in_color_space (compression) or cinfo.out_color_space (decompression) to one of these values will cause libjpeg-turbo to read the red, green, and blue values from (or write them to) the appropriate position in -the pixel when YUV conversion is performed. +the pixel when compressing from/decompressing to an RGB buffer. Your application can check for the existence of these extensions at compile time with: @@ -210,7 +210,7 @@ libjpeg v7 and v8 API/ABI support libjpeg v7 and v8 added new features to the API/ABI, and, unfortunately, the compression and decompression structures were extended in a backward- -incompatible manner to accommodate these features. Thus, programs which are +incompatible manner to accommodate these features. Thus, programs that are built to use libjpeg v7 or v8 did not work with libjpeg-turbo, since it is based on the libjpeg v6b code base. Although libjpeg v7 and v8 are still not as widely used as v6b, enough programs (including a few Linux distros) have @@ -218,7 +218,7 @@ made the switch that it was desirable to provide support for the libjpeg v7/v8 API/ABI in libjpeg-turbo. Some of the libjpeg v7 and v8 features -- DCT scaling, to name one -- involve -deep modifications to the code which cannot be accommodated by libjpeg-turbo +deep modifications to the code that cannot be accommodated by libjpeg-turbo without either breaking compatibility with libjpeg v6b or producing an unsupportable mess. In order to fully support libjpeg v8 with all of its features, we would have to essentially port the SIMD extensions to the libjpeg @@ -229,8 +229,8 @@ releases will also be backward-incompatible. By passing an argument of --with-jpeg7 or --with-jpeg8 to configure, or an argument of -DWITH_JPEG7=1 or -DWITH_JPEG8=1 to cmake, you can build a version -of libjpeg-turbo which emulates the libjpeg v7 or v8 API/ABI, so that programs -which are built against libjpeg v7 or v8 can be run with libjpeg-turbo. The +of libjpeg-turbo that emulates the libjpeg v7 or v8 API/ABI, so that programs +that are built against libjpeg v7 or v8 can be run with libjpeg-turbo. The following section describes which libjpeg v7+ features are supported and which aren't. diff --git a/turbojpeg.h b/turbojpeg.h index 24816d7e..1c1e97fa 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -105,10 +105,10 @@ DLLEXPORT tjhandle DLLCALL tjInitCompress(void); [INPUT] height = height (in pixels) of the source image [INPUT] pixelsize = size (in bytes) of each pixel in the source image RGBX/BGRX/XRGB/XBGR: 4, RGB/BGR: 3, Grayscale: 1 - [INPUT] dstbuf = pointer to user-allocated image buffer which will receive + [INPUT] dstbuf = pointer to user-allocated image buffer that will receive the JPEG image. Use the TJBUFSIZE(width, height) function to determine the appropriate size for this buffer based on the image width and height. - [OUTPUT] size = pointer to unsigned long which receives the size (in bytes) + [OUTPUT] size = pointer to unsigned long that receives the size (in bytes) of the compressed image [INPUT] jpegsubsamp = Specifies either 4:2:0, 4:2:2, 4:4:4, or grayscale subsampling. When the image is converted from the RGB to YCbCr colorspace @@ -139,7 +139,7 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle j, /* unsigned long TJBUFSIZE(int width, int height) - Convenience function which returns the maximum size of the buffer required to + Convenience function that returns the maximum size of the buffer required to hold a JPEG image with the given width and height RETURNS: -1 if arguments are out of bounds @@ -150,7 +150,7 @@ DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height); /* unsigned long TJBUFSIZEYUV(int width, int height, int subsamp) - Convenience function which returns the size of the buffer required to + Convenience function that returns the size of the buffer required to hold a YUV planar image with the given width, height, and level of chrominance subsampling @@ -190,7 +190,7 @@ DLLEXPORT unsigned long DLLCALL TJBUFSIZEYUV(int width, int height, [INPUT] height = height (in pixels) of the source image [INPUT] pixelsize = size (in bytes) of each pixel in the source image RGBX/BGRX/XRGB/XBGR: 4, RGB/BGR: 3, Grayscale: 1 - [INPUT] dstbuf = pointer to user-allocated image buffer which will receive + [INPUT] dstbuf = pointer to user-allocated image buffer that will receive the YUV image. Use the TJBUFSIZEYUV(width, height, subsamp) function to determine the appropriate size for this buffer based on the image width, height, and level of subsampling. @@ -260,7 +260,7 @@ DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle j, [INPUT] srcbuf = pointer to a user-allocated buffer containing the JPEG image to decompress [INPUT] size = size of the JPEG image buffer (in bytes) - [INPUT] dstbuf = pointer to user-allocated image buffer which will receive + [INPUT] dstbuf = pointer to user-allocated image buffer that will receive the bitmap image. This buffer should normally be pitch*height bytes in size, although this pointer may also be used to decompress into a specific region of a larger buffer. @@ -302,7 +302,7 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle j, [INPUT] srcbuf = pointer to a user-allocated buffer containing the JPEG image to decompress [INPUT] size = size of the JPEG image buffer (in bytes) - [INPUT] dstbuf = pointer to user-allocated image buffer which will receive + [INPUT] dstbuf = pointer to user-allocated image buffer that will receive the YUV image. Use the TJBUFSIZEYUV(width, height, subsamp) function to determine the appropriate size for this buffer based on the image width, height, and level of subsampling. From 2d4816591f17a2142e7aa29e7c237b6e3cd999b1 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 17 Jan 2012 23:11:06 +0000 Subject: [PATCH 18/21] Merge spacing changes from VirtualGL git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@738 632fc199-4ca6-4c93-a231-07263d6284db --- turbojpeg.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/turbojpeg.h b/turbojpeg.h index 1c1e97fa..b5359e1c 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -13,7 +13,8 @@ * wxWindows Library License for more details. */ -#if (defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)) && defined(_WIN32) && defined(DLLDEFINE) +#if (defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)) \ + && defined(_WIN32) && defined(DLLDEFINE) #define DLLEXPORT __declspec(dllexport) #else #define DLLEXPORT @@ -21,6 +22,7 @@ #define DLLCALL + /* Subsampling */ #define NUMSUBOPT 4 @@ -28,6 +30,7 @@ enum {TJ_444=0, TJ_422, TJ_420, TJ_GRAYSCALE}; #define TJ_411 TJ_420 /* for backward compatibility with VirtualGL <= 2.1.x, TurboVNC <= 0.6, and TurboJPEG/IPP */ + /* Flags */ #define TJ_BGR 1 /* The components of each pixel in the source/destination bitmap are stored @@ -56,6 +59,7 @@ enum {TJ_444=0, TJ_422, TJ_420, TJ_GRAYSCALE}; #define TJ_YUV 512 /* Nothing to see here. Pay no attention to the man behind the curtain. */ + typedef void* tjhandle; #define TJPAD(p) (((p)+3)&(~3)) @@ -63,6 +67,7 @@ typedef void* tjhandle; #define max(a,b) ((a)>(b)?(a):(b)) #endif + #ifdef __cplusplus extern "C" { #endif @@ -336,6 +341,7 @@ DLLEXPORT int DLLCALL tjDestroy(tjhandle h); */ DLLEXPORT char* DLLCALL tjGetErrorStr(void); + #ifdef __cplusplus } #endif From 7ed7b572032510d8c96972f624a97222818b5625 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 7 Feb 2012 22:51:49 +0000 Subject: [PATCH 19/21] Eliminate "main is usually a function" warnings git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@780 632fc199-4ca6-4c93-a231-07263d6284db --- jcmainct.c | 90 +++++++++++++++++++------------------- jdmainct.c | 124 ++++++++++++++++++++++++++--------------------------- 2 files changed, 107 insertions(+), 107 deletions(-) diff --git a/jcmainct.c b/jcmainct.c index e0279a7e..bd0051af 100644 --- a/jcmainct.c +++ b/jcmainct.c @@ -68,32 +68,32 @@ METHODDEF(void) process_data_buffer_main METHODDEF(void) start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode) { - my_main_ptr main = (my_main_ptr) cinfo->main; + my_main_ptr main_ptr = (my_main_ptr) cinfo->main; /* Do nothing in raw-data mode. */ if (cinfo->raw_data_in) return; - main->cur_iMCU_row = 0; /* initialize counters */ - main->rowgroup_ctr = 0; - main->suspended = FALSE; - main->pass_mode = pass_mode; /* save mode for use by process_data */ + main_ptr->cur_iMCU_row = 0; /* initialize counters */ + main_ptr->rowgroup_ctr = 0; + main_ptr->suspended = FALSE; + main_ptr->pass_mode = pass_mode; /* save mode for use by process_data */ switch (pass_mode) { case JBUF_PASS_THRU: #ifdef FULL_MAIN_BUFFER_SUPPORTED - if (main->whole_image[0] != NULL) + if (main_ptr->whole_image[0] != NULL) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); #endif - main->pub.process_data = process_data_simple_main; + main_ptr->pub.process_data = process_data_simple_main; break; #ifdef FULL_MAIN_BUFFER_SUPPORTED case JBUF_SAVE_SOURCE: case JBUF_CRANK_DEST: case JBUF_SAVE_AND_PASS: - if (main->whole_image[0] == NULL) + if (main_ptr->whole_image[0] == NULL) ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); - main->pub.process_data = process_data_buffer_main; + main_ptr->pub.process_data = process_data_buffer_main; break; #endif default: @@ -114,46 +114,46 @@ process_data_simple_main (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail) { - my_main_ptr main = (my_main_ptr) cinfo->main; + my_main_ptr main_ptr = (my_main_ptr) cinfo->main; - while (main->cur_iMCU_row < cinfo->total_iMCU_rows) { + while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) { /* Read input data if we haven't filled the main buffer yet */ - if (main->rowgroup_ctr < DCTSIZE) + if (main_ptr->rowgroup_ctr < DCTSIZE) (*cinfo->prep->pre_process_data) (cinfo, input_buf, in_row_ctr, in_rows_avail, - main->buffer, &main->rowgroup_ctr, + main_ptr->buffer, &main_ptr->rowgroup_ctr, (JDIMENSION) DCTSIZE); /* If we don't have a full iMCU row buffered, return to application for * more data. Note that preprocessor will always pad to fill the iMCU row * at the bottom of the image. */ - if (main->rowgroup_ctr != DCTSIZE) + if (main_ptr->rowgroup_ctr != DCTSIZE) return; /* Send the completed row to the compressor */ - if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) { + if (! (*cinfo->coef->compress_data) (cinfo, main_ptr->buffer)) { /* If compressor did not consume the whole row, then we must need to * suspend processing and return to the application. In this situation * we pretend we didn't yet consume the last input row; otherwise, if * it happened to be the last row of the image, the application would * think we were done. */ - if (! main->suspended) { + if (! main_ptr->suspended) { (*in_row_ctr)--; - main->suspended = TRUE; + main_ptr->suspended = TRUE; } return; } /* We did finish the row. Undo our little suspension hack if a previous * call suspended; then mark the main buffer empty. */ - if (main->suspended) { + if (main_ptr->suspended) { (*in_row_ctr)++; - main->suspended = FALSE; + main_ptr->suspended = FALSE; } - main->rowgroup_ctr = 0; - main->cur_iMCU_row++; + main_ptr->rowgroup_ctr = 0; + main_ptr->cur_iMCU_row++; } } @@ -173,22 +173,22 @@ process_data_buffer_main (j_compress_ptr cinfo, my_main_ptr main = (my_main_ptr) cinfo->main; int ci; jpeg_component_info *compptr; - boolean writing = (main->pass_mode != JBUF_CRANK_DEST); + boolean writing = (main_ptr->pass_mode != JBUF_CRANK_DEST); - while (main->cur_iMCU_row < cinfo->total_iMCU_rows) { + while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) { /* Realign the virtual buffers if at the start of an iMCU row. */ - if (main->rowgroup_ctr == 0) { + if (main_ptr->rowgroup_ctr == 0) { for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { - main->buffer[ci] = (*cinfo->mem->access_virt_sarray) - ((j_common_ptr) cinfo, main->whole_image[ci], - main->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE), + main_ptr->buffer[ci] = (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, main_ptr->whole_image[ci], + main_ptr->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE), (JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing); } /* In a read pass, pretend we just read some source data. */ if (! writing) { *in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE; - main->rowgroup_ctr = DCTSIZE; + main_ptr->rowgroup_ctr = DCTSIZE; } } @@ -197,40 +197,40 @@ process_data_buffer_main (j_compress_ptr cinfo, if (writing) { (*cinfo->prep->pre_process_data) (cinfo, input_buf, in_row_ctr, in_rows_avail, - main->buffer, &main->rowgroup_ctr, + main_ptr->buffer, &main_ptr->rowgroup_ctr, (JDIMENSION) DCTSIZE); /* Return to application if we need more data to fill the iMCU row. */ - if (main->rowgroup_ctr < DCTSIZE) + if (main_ptr->rowgroup_ctr < DCTSIZE) return; } /* Emit data, unless this is a sink-only pass. */ - if (main->pass_mode != JBUF_SAVE_SOURCE) { - if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) { + if (main_ptr->pass_mode != JBUF_SAVE_SOURCE) { + if (! (*cinfo->coef->compress_data) (cinfo, main_ptr->buffer)) { /* If compressor did not consume the whole row, then we must need to * suspend processing and return to the application. In this situation * we pretend we didn't yet consume the last input row; otherwise, if * it happened to be the last row of the image, the application would * think we were done. */ - if (! main->suspended) { + if (! main_ptr->suspended) { (*in_row_ctr)--; - main->suspended = TRUE; + main_ptr->suspended = TRUE; } return; } /* We did finish the row. Undo our little suspension hack if a previous * call suspended; then mark the main buffer empty. */ - if (main->suspended) { + if (main_ptr->suspended) { (*in_row_ctr)++; - main->suspended = FALSE; + main_ptr->suspended = FALSE; } } /* If get here, we are done with this iMCU row. Mark buffer empty. */ - main->rowgroup_ctr = 0; - main->cur_iMCU_row++; + main_ptr->rowgroup_ctr = 0; + main_ptr->cur_iMCU_row++; } } @@ -244,15 +244,15 @@ process_data_buffer_main (j_compress_ptr cinfo, GLOBAL(void) jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer) { - my_main_ptr main; + my_main_ptr main_ptr; int ci; jpeg_component_info *compptr; - main = (my_main_ptr) + main_ptr = (my_main_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_main_controller)); - cinfo->main = (struct jpeg_c_main_controller *) main; - main->pub.start_pass = start_pass_main; + cinfo->main = (struct jpeg_c_main_controller *) main_ptr; + main_ptr->pub.start_pass = start_pass_main; /* We don't need to create a buffer in raw-data mode. */ if (cinfo->raw_data_in) @@ -267,7 +267,7 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer) /* Note we pad the bottom to a multiple of the iMCU height */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { - main->whole_image[ci] = (*cinfo->mem->request_virt_sarray) + main_ptr->whole_image[ci] = (*cinfo->mem->request_virt_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, compptr->width_in_blocks * DCTSIZE, (JDIMENSION) jround_up((long) compptr->height_in_blocks, @@ -279,12 +279,12 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer) #endif } else { #ifdef FULL_MAIN_BUFFER_SUPPORTED - main->whole_image[0] = NULL; /* flag for no virtual arrays */ + main_ptr->whole_image[0] = NULL; /* flag for no virtual arrays */ #endif /* Allocate a strip buffer for each component */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { - main->buffer[ci] = (*cinfo->mem->alloc_sarray) + main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, compptr->width_in_blocks * DCTSIZE, (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); diff --git a/jdmainct.c b/jdmainct.c index 67f62153..eb32cae0 100644 --- a/jdmainct.c +++ b/jdmainct.c @@ -161,7 +161,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo) * This is done only once, not once per pass. */ { - my_main_ptr main = (my_main_ptr) cinfo->main; + my_main_ptr main_ptr = (my_main_ptr) cinfo->main; int ci, rgroup; int M = cinfo->_min_DCT_scaled_size; jpeg_component_info *compptr; @@ -170,10 +170,10 @@ alloc_funny_pointers (j_decompress_ptr cinfo) /* Get top-level space for component array pointers. * We alloc both arrays with one call to save a few cycles. */ - main->xbuffer[0] = (JSAMPIMAGE) + main_ptr->xbuffer[0] = (JSAMPIMAGE) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->num_components * 2 * SIZEOF(JSAMPARRAY)); - main->xbuffer[1] = main->xbuffer[0] + cinfo->num_components; + main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { @@ -186,9 +186,9 @@ alloc_funny_pointers (j_decompress_ptr cinfo) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW)); xbuf += rgroup; /* want one row group at negative offsets */ - main->xbuffer[0][ci] = xbuf; + main_ptr->xbuffer[0][ci] = xbuf; xbuf += rgroup * (M + 4); - main->xbuffer[1][ci] = xbuf; + main_ptr->xbuffer[1][ci] = xbuf; } } @@ -196,13 +196,13 @@ alloc_funny_pointers (j_decompress_ptr cinfo) LOCAL(void) make_funny_pointers (j_decompress_ptr cinfo) /* Create the funny pointer lists discussed in the comments above. - * The actual workspace is already allocated (in main->buffer), + * The actual workspace is already allocated (in main_ptr->buffer), * and the space for the pointer lists is allocated too. * This routine just fills in the curiously ordered lists. * This will be repeated at the beginning of each pass. */ { - my_main_ptr main = (my_main_ptr) cinfo->main; + my_main_ptr main_ptr = (my_main_ptr) cinfo->main; int ci, i, rgroup; int M = cinfo->_min_DCT_scaled_size; jpeg_component_info *compptr; @@ -212,10 +212,10 @@ make_funny_pointers (j_decompress_ptr cinfo) ci++, compptr++) { rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / cinfo->_min_DCT_scaled_size; /* height of a row group of component */ - xbuf0 = main->xbuffer[0][ci]; - xbuf1 = main->xbuffer[1][ci]; + xbuf0 = main_ptr->xbuffer[0][ci]; + xbuf1 = main_ptr->xbuffer[1][ci]; /* First copy the workspace pointers as-is */ - buf = main->buffer[ci]; + buf = main_ptr->buffer[ci]; for (i = 0; i < rgroup * (M + 2); i++) { xbuf0[i] = xbuf1[i] = buf[i]; } @@ -242,7 +242,7 @@ set_wraparound_pointers (j_decompress_ptr cinfo) * This changes the pointer list state from top-of-image to the normal state. */ { - my_main_ptr main = (my_main_ptr) cinfo->main; + my_main_ptr main_ptr = (my_main_ptr) cinfo->main; int ci, i, rgroup; int M = cinfo->_min_DCT_scaled_size; jpeg_component_info *compptr; @@ -252,8 +252,8 @@ set_wraparound_pointers (j_decompress_ptr cinfo) ci++, compptr++) { rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / cinfo->_min_DCT_scaled_size; /* height of a row group of component */ - xbuf0 = main->xbuffer[0][ci]; - xbuf1 = main->xbuffer[1][ci]; + xbuf0 = main_ptr->xbuffer[0][ci]; + xbuf1 = main_ptr->xbuffer[1][ci]; for (i = 0; i < rgroup; i++) { xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i]; xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i]; @@ -271,7 +271,7 @@ set_bottom_pointers (j_decompress_ptr cinfo) * Also sets rowgroups_avail to indicate number of nondummy row groups in row. */ { - my_main_ptr main = (my_main_ptr) cinfo->main; + my_main_ptr main_ptr = (my_main_ptr) cinfo->main; int ci, i, rgroup, iMCUheight, rows_left; jpeg_component_info *compptr; JSAMPARRAY xbuf; @@ -288,12 +288,12 @@ set_bottom_pointers (j_decompress_ptr cinfo) * so we need only do it once. */ if (ci == 0) { - main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1); + main_ptr->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1); } /* Duplicate the last real sample row rgroup*2 times; this pads out the * last partial rowgroup and ensures at least one full rowgroup of context. */ - xbuf = main->xbuffer[main->whichptr][ci]; + xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci]; for (i = 0; i < rgroup * 2; i++) { xbuf[rows_left + i] = xbuf[rows_left-1]; } @@ -308,27 +308,27 @@ set_bottom_pointers (j_decompress_ptr cinfo) METHODDEF(void) start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) { - my_main_ptr main = (my_main_ptr) cinfo->main; + my_main_ptr main_ptr = (my_main_ptr) cinfo->main; switch (pass_mode) { case JBUF_PASS_THRU: if (cinfo->upsample->need_context_rows) { - main->pub.process_data = process_data_context_main; + main_ptr->pub.process_data = process_data_context_main; make_funny_pointers(cinfo); /* Create the xbuffer[] lists */ - main->whichptr = 0; /* Read first iMCU row into xbuffer[0] */ - main->context_state = CTX_PREPARE_FOR_IMCU; - main->iMCU_row_ctr = 0; + main_ptr->whichptr = 0; /* Read first iMCU row into xbuffer[0] */ + main_ptr->context_state = CTX_PREPARE_FOR_IMCU; + main_ptr->iMCU_row_ctr = 0; } else { /* Simple case with no context needed */ - main->pub.process_data = process_data_simple_main; + main_ptr->pub.process_data = process_data_simple_main; } - main->buffer_full = FALSE; /* Mark buffer empty */ - main->rowgroup_ctr = 0; + main_ptr->buffer_full = FALSE; /* Mark buffer empty */ + main_ptr->rowgroup_ctr = 0; break; #ifdef QUANT_2PASS_SUPPORTED case JBUF_CRANK_DEST: /* For last pass of 2-pass quantization, just crank the postprocessor */ - main->pub.process_data = process_data_crank_post; + main_ptr->pub.process_data = process_data_crank_post; break; #endif default: @@ -348,14 +348,14 @@ process_data_simple_main (j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) { - my_main_ptr main = (my_main_ptr) cinfo->main; + my_main_ptr main_ptr = (my_main_ptr) cinfo->main; JDIMENSION rowgroups_avail; /* Read input data if we haven't filled the main buffer yet */ - if (! main->buffer_full) { - if (! (*cinfo->coef->decompress_data) (cinfo, main->buffer)) + if (! main_ptr->buffer_full) { + if (! (*cinfo->coef->decompress_data) (cinfo, main_ptr->buffer)) return; /* suspension forced, can do nothing more */ - main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ + main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ } /* There are always min_DCT_scaled_size row groups in an iMCU row. */ @@ -366,14 +366,14 @@ process_data_simple_main (j_decompress_ptr cinfo, */ /* Feed the postprocessor */ - (*cinfo->post->post_process_data) (cinfo, main->buffer, - &main->rowgroup_ctr, rowgroups_avail, + (*cinfo->post->post_process_data) (cinfo, main_ptr->buffer, + &main_ptr->rowgroup_ctr, rowgroups_avail, output_buf, out_row_ctr, out_rows_avail); /* Has postprocessor consumed all the data yet? If so, mark buffer empty */ - if (main->rowgroup_ctr >= rowgroups_avail) { - main->buffer_full = FALSE; - main->rowgroup_ctr = 0; + if (main_ptr->rowgroup_ctr >= rowgroups_avail) { + main_ptr->buffer_full = FALSE; + main_ptr->rowgroup_ctr = 0; } } @@ -388,15 +388,15 @@ process_data_context_main (j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail) { - my_main_ptr main = (my_main_ptr) cinfo->main; + my_main_ptr main_ptr = (my_main_ptr) cinfo->main; /* Read input data if we haven't filled the main buffer yet */ - if (! main->buffer_full) { + if (! main_ptr->buffer_full) { if (! (*cinfo->coef->decompress_data) (cinfo, - main->xbuffer[main->whichptr])) + main_ptr->xbuffer[main_ptr->whichptr])) return; /* suspension forced, can do nothing more */ - main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ - main->iMCU_row_ctr++; /* count rows received */ + main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ + main_ptr->iMCU_row_ctr++; /* count rows received */ } /* Postprocessor typically will not swallow all the input data it is handed @@ -404,47 +404,47 @@ process_data_context_main (j_decompress_ptr cinfo, * to exit and restart. This switch lets us keep track of how far we got. * Note that each case falls through to the next on successful completion. */ - switch (main->context_state) { + switch (main_ptr->context_state) { case CTX_POSTPONED_ROW: /* Call postprocessor using previously set pointers for postponed row */ - (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr], - &main->rowgroup_ctr, main->rowgroups_avail, + (*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr], + &main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail, output_buf, out_row_ctr, out_rows_avail); - if (main->rowgroup_ctr < main->rowgroups_avail) + if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail) return; /* Need to suspend */ - main->context_state = CTX_PREPARE_FOR_IMCU; + main_ptr->context_state = CTX_PREPARE_FOR_IMCU; if (*out_row_ctr >= out_rows_avail) return; /* Postprocessor exactly filled output buf */ /*FALLTHROUGH*/ case CTX_PREPARE_FOR_IMCU: /* Prepare to process first M-1 row groups of this iMCU row */ - main->rowgroup_ctr = 0; - main->rowgroups_avail = (JDIMENSION) (cinfo->_min_DCT_scaled_size - 1); + main_ptr->rowgroup_ctr = 0; + main_ptr->rowgroups_avail = (JDIMENSION) (cinfo->_min_DCT_scaled_size - 1); /* Check for bottom of image: if so, tweak pointers to "duplicate" * the last sample row, and adjust rowgroups_avail to ignore padding rows. */ - if (main->iMCU_row_ctr == cinfo->total_iMCU_rows) + if (main_ptr->iMCU_row_ctr == cinfo->total_iMCU_rows) set_bottom_pointers(cinfo); - main->context_state = CTX_PROCESS_IMCU; + main_ptr->context_state = CTX_PROCESS_IMCU; /*FALLTHROUGH*/ case CTX_PROCESS_IMCU: /* Call postprocessor using previously set pointers */ - (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr], - &main->rowgroup_ctr, main->rowgroups_avail, + (*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr], + &main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail, output_buf, out_row_ctr, out_rows_avail); - if (main->rowgroup_ctr < main->rowgroups_avail) + if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail) return; /* Need to suspend */ /* After the first iMCU, change wraparound pointers to normal state */ - if (main->iMCU_row_ctr == 1) + if (main_ptr->iMCU_row_ctr == 1) set_wraparound_pointers(cinfo); /* Prepare to load new iMCU row using other xbuffer list */ - main->whichptr ^= 1; /* 0=>1 or 1=>0 */ - main->buffer_full = FALSE; + main_ptr->whichptr ^= 1; /* 0=>1 or 1=>0 */ + main_ptr->buffer_full = FALSE; /* Still need to process last row group of this iMCU row, */ /* which is saved at index M+1 of the other xbuffer */ - main->rowgroup_ctr = (JDIMENSION) (cinfo->_min_DCT_scaled_size + 1); - main->rowgroups_avail = (JDIMENSION) (cinfo->_min_DCT_scaled_size + 2); - main->context_state = CTX_POSTPONED_ROW; + main_ptr->rowgroup_ctr = (JDIMENSION) (cinfo->_min_DCT_scaled_size + 1); + main_ptr->rowgroups_avail = (JDIMENSION) (cinfo->_min_DCT_scaled_size + 2); + main_ptr->context_state = CTX_POSTPONED_ROW; } } @@ -477,15 +477,15 @@ process_data_crank_post (j_decompress_ptr cinfo, GLOBAL(void) jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) { - my_main_ptr main; + my_main_ptr main_ptr; int ci, rgroup, ngroups; jpeg_component_info *compptr; - main = (my_main_ptr) + main_ptr = (my_main_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_main_controller)); - cinfo->main = (struct jpeg_d_main_controller *) main; - main->pub.start_pass = start_pass_main; + cinfo->main = (struct jpeg_d_main_controller *) main_ptr; + main_ptr->pub.start_pass = start_pass_main; if (need_full_buffer) /* shouldn't happen */ ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); @@ -506,7 +506,7 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) ci++, compptr++) { rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / cinfo->_min_DCT_scaled_size; /* height of a row group of component */ - main->buffer[ci] = (*cinfo->mem->alloc_sarray) + main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, compptr->width_in_blocks * compptr->_DCT_scaled_size, (JDIMENSION) (rgroup * ngroups)); From c3ba39fc3b7ecc4ccb205ca51483faf7747b6f30 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 7 Feb 2012 23:05:46 +0000 Subject: [PATCH 20/21] Merge copyright messages into one string and change the run-time messages to avoid confusion (we are not technically based on the latest libjpeg, although we do borrow some code from it) git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@781 632fc199-4ca6-4c93-a231-07263d6284db --- cjpeg.c | 6 +++--- djpeg.c | 6 +++--- jpegtran.c | 6 +++--- jversion.h | 11 +++-------- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/cjpeg.c b/cjpeg.c index 3daa259a..6f407f83 100644 --- a/cjpeg.c +++ b/cjpeg.c @@ -277,9 +277,9 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, if (! printed_version) { fprintf(stderr, "%s version %s (build %s)\n", PACKAGE_NAME, VERSION, BUILD); - fprintf(stderr, "%s\n\n", LJTCOPYRIGHT); - fprintf(stderr, "Based on Independent JPEG Group's libjpeg, version %s\n%s\n\n", - JVERSION, JCOPYRIGHT); + fprintf(stderr, "%s\n\n", JCOPYRIGHT); + fprintf(stderr, "Emulating The Independent JPEG Group's libjpeg, version %s\n\n", + JVERSION); printed_version = TRUE; } cinfo->err->trace_level++; diff --git a/djpeg.c b/djpeg.c index 466973fe..5fc40276 100644 --- a/djpeg.c +++ b/djpeg.c @@ -244,9 +244,9 @@ parse_switches (j_decompress_ptr cinfo, int argc, char **argv, if (! printed_version) { fprintf(stderr, "%s version %s (build %s)\n", PACKAGE_NAME, VERSION, BUILD); - fprintf(stderr, "%s\n\n", LJTCOPYRIGHT); - fprintf(stderr, "Based on Independent JPEG Group's libjpeg, version %s\n%s\n\n", - JVERSION, JCOPYRIGHT); + fprintf(stderr, "%s\n\n", JCOPYRIGHT); + fprintf(stderr, "Emulating The Independent JPEG Group's libjpeg, version %s\n\n", + JVERSION); printed_version = TRUE; } cinfo->err->trace_level++; diff --git a/jpegtran.c b/jpegtran.c index 73dbe530..b2a31adb 100644 --- a/jpegtran.c +++ b/jpegtran.c @@ -203,9 +203,9 @@ parse_switches (j_compress_ptr cinfo, int argc, char **argv, if (! printed_version) { fprintf(stderr, "%s version %s (build %s)\n", PACKAGE_NAME, VERSION, BUILD); - fprintf(stderr, "%s\n\n", LJTCOPYRIGHT); - fprintf(stderr, "Based on Independent JPEG Group's libjpeg, version %s\n%s\n\n", - JVERSION, JCOPYRIGHT); + fprintf(stderr, "%s\n\n", JCOPYRIGHT); + fprintf(stderr, "Emulating The Independent JPEG Group's libjpeg, version %s\n\n", + JVERSION); printed_version = TRUE; } cinfo->err->trace_level++; diff --git a/jversion.h b/jversion.h index 119c481c..a4bd04f1 100644 --- a/jversion.h +++ b/jversion.h @@ -2,7 +2,7 @@ * jversion.h * * Copyright (C) 1991-2010, Thomas G. Lane, Guido Vollbeding. - * Copyright (C) 2010, D. R. Commander. + * Copyright (C) 2010, 2012, D. R. Commander. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -14,23 +14,18 @@ #define JVERSION "8b 16-May-2010" -#define JCOPYRIGHT "Copyright (C) 2010, Thomas G. Lane, Guido Vollbeding" - #elif JPEG_LIB_VERSION >= 70 #define JVERSION "7 27-Jun-2009" -#define JCOPYRIGHT "Copyright (C) 2009, Thomas G. Lane, Guido Vollbeding" - #else #define JVERSION "6b 27-Mar-1998" -#define JCOPYRIGHT "Copyright (C) 1998, Thomas G. Lane" - #endif -#define LJTCOPYRIGHT "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \ +#define JCOPYRIGHT "Copyright (C) 1991-2010 Thomas G. Lane, Guido Vollbeding\n" \ + "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \ "Copyright (C) 2004 Landmark Graphics Corporation\n" \ "Copyright (C) 2005-2007 Sun Microsystems, Inc.\n" \ "Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \ From 44a97e8fe74bb9b0c674edbdcd535a08afc95569 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 7 Feb 2012 23:13:24 +0000 Subject: [PATCH 21/21] Not necessary to save r10 and r11, since these are scratch registers git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@782 632fc199-4ca6-4c93-a231-07263d6284db --- simd/jsimdext.inc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/simd/jsimdext.inc b/simd/jsimdext.inc index 12a04c2e..10a727fc 100644 --- a/simd/jsimdext.inc +++ b/simd/jsimdext.inc @@ -299,8 +299,6 @@ const_base: %ifdef WIN64 %imacro collect_args 0 - push r10 - push r11 push r12 push r13 push r14 @@ -330,8 +328,6 @@ const_base: pop r14 pop r13 pop r12 - pop r11 - pop r10 %endmacro %else