Compare commits

...

89 Commits

Author SHA1 Message Date
DRC
ba29357611 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
2011-05-18 03:50:53 +00:00
DRC
2c289bfa9b git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@612 632fc199-4ca6-4c93-a231-07263d6284db 2011-05-10 22:15:04 +00:00
DRC
5ee81f43cf 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.1.x@603 632fc199-4ca6-4c93-a231-07263d6284db
2011-05-02 00:35:50 +00:00
DRC
4f81526385 New libjpeg-turbo domain
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@601 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-27 00:33:14 +00:00
DRC
fad469f51e New libjpeg-turbo domain
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.0.x@602 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-30 04:43:23 +00:00
DRC
83c8f14fa2 Eliminate excessive I/O overhead when reading BMP files in cjpeg
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.0.x@595 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-25 22:53:44 +00:00
DRC
049aef51d4 Eliminate excessive I/O overhead when reading BMP files in cjpeg
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@592 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-25 22:41:14 +00:00
DRC
c56a74cdac Get rid of unused IS_WIN32 conditional
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.0.x@589 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-17 15:36:38 +00:00
DRC
51705fb967 git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.0.x@588 632fc199-4ca6-4c93-a231-07263d6284db 2011-04-17 15:31:46 +00:00
DRC
e43d21d57f git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@586 632fc199-4ca6-4c93-a231-07263d6284db 2011-04-17 15:28:32 +00:00
DRC
9e6378c448 The previous attempt to handle unexpected markers in the data stream caused breakage in applications that attempted to set bytes_in_buffer to a larger value than the actual size of the JPEG image. The latter behavior was causing the fast decoder to be used for the last MCU in the image under certain circumstances, and this sometimes caused the EOI marker to be encountered by the fast decoder, which was treating it as an "unexpected" marker and throwing an error. Now, the fast decoder simply hands off the decoding of the block to the slow decoder if any marker is encountered.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.0.x@585 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-16 18:54:12 +00:00
DRC
62de12281a This is subtle, but an unread marker is not an error unless we run out of bits, which may not occur in the same MCU in which the unread marker is encountered. Thus, don't try to use the fast decoder as long as there is an outstanding unread marker.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@583 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-16 18:50:42 +00:00
DRC
5c36465fd5 The previous attempt to handle unexpected markers in the data stream caused breakage in applications that attempted to set bytes_in_buffer to a larger value than the actual size of the JPEG image. The latter behavior was causing the fast decoder to be used for the last MCU in the image under certain circumstances, and this sometimes caused the EOI marker to be encountered by the fast decoder, which was treating it as an "unexpected" marker and throwing an error. Now, the fast decoder simply hands off the decoding of the block to the slow decoder if any marker is encountered.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@582 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-16 17:39:58 +00:00
DRC
58454c74cc Update build instructions to reflect the fact that 32-bit LJT build doesn't work with NASM 0.99 or 2.00
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@578 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-16 13:26:36 +00:00
DRC
98b8529d1f Use option() to handle configuration variables, so they will show up in the CMake GUI
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@576 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-15 00:20:15 +00:00
DRC
577ae78c30 Don't need MSVC definition in assembler code anymore
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@574 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-07 05:26:52 +00:00
DRC
926e01ffe1 Attempt to make build work with Visual Studio 2010 (still doesn't work if SIMD or Java are enabled-- see bug tracker)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@573 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-06 06:35:38 +00:00
DRC
2a33dfcaab git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@571 632fc199-4ca6-4c93-a231-07263d6284db 2011-04-05 06:51:59 +00:00
DRC
e7fde87ca5 Fix jpegoptim with v7 emulation as well
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@568 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-03 07:09:49 +00:00
DRC
59a58343ea Ensure that image_width and image_height are initialized if libjpeg v8 emulation is enabled.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@565 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-02 05:40:16 +00:00
DRC
9e50fa7fbe Fixed a regression bug in the NSIS script that caused the Windows installer
build to fail when using the Visual Studio IDE.


git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@554 632fc199-4ca6-4c93-a231-07263d6284db
2011-04-01 11:24:31 +00:00
DRC
e44f8c0112 make testclean should clean up .yuv files as well
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@544 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-31 09:19:53 +00:00
DRC
1e14b47c22 Get rid of unused IS_WIN32 conditional
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@542 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-31 04:15:50 +00:00
DRC
a8eabfebd1 Create local round up function for jmemmgr.c so we can revert the original argument types of jround_up() without breaking the build on 64-bit Windows.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@539 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-29 04:58:40 +00:00
DRC
1c87e45cff We want to keep the same name for the install directory, even though the installer name has changed
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@535 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-22 06:49:31 +00:00
DRC
539b288780 Typo
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@534 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-22 06:28:04 +00:00
DRC
47aaf6fa15 MinGW64 no longer prefixes symbols with underscores by default
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@533 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-22 05:40:39 +00:00
DRC
328c4388b7 Oops. Forgot to generate makecygwinpkg
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@532 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-22 05:04:30 +00:00
DRC
e6f597f28f Don't use architecture extension in package name, since we're building a combined package
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@531 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-22 03:19:11 +00:00
DRC
bfa34cf143 "release/"="pkgscripts/"
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@530 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-22 01:38:04 +00:00
DRC
5e091d4d1f Need to put the generated packaging scripts in a directory other than release/ so they won't get distributed
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@529 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-22 01:21:42 +00:00
DRC
95db4f48a5 Clean up packaging system
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@528 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-22 00:20:43 +00:00
DRC
1a79ede633 1.1.1
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@527 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-21 22:42:31 +00:00
DRC
a6471c34ed git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@526 632fc199-4ca6-4c93-a231-07263d6284db 2011-03-18 05:59:21 +00:00
DRC
df1c38df74 Throw a warning if an unexpected marker is found in the middle of the JPEG data stream
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@521 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-18 05:40:33 +00:00
DRC
6ee5459459 Don't call jpeg_finish_compress() with YUV output, because it tries to insert an EOI marker right in the middle of our image data.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@475 632fc199-4ca6-4c93-a231-07263d6284db
2011-03-01 08:18:30 +00:00
DRC
66df5eca03 Oops. cconvert is still needed for 12-bit samples
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@470 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-27 09:48:48 +00:00
DRC
da58a91d1e Make Visual C++ happy
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@465 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-27 00:07:51 +00:00
DRC
0769f505bf Fix compiler warnings
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@461 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-26 21:08:39 +00:00
DRC
b4a50ceefb Enable full GCC compiler warnings by default
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@460 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-26 21:07:50 +00:00
DRC
361a637174 Fix uninitialized variables
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@455 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-26 19:46:27 +00:00
DRC
3484e0b160 Add RGB-->Grayscale YUV decode test
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@453 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-25 06:21:15 +00:00
DRC
d5a69afa5a Fix the buffer size regression test so that it generates the intended pixel patterns
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@450 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-25 02:13:07 +00:00
DRC
0745c0fb6a Correct memory allocation failure messages
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@447 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-25 01:31:13 +00:00
DRC
94476c648b Only access TJBUFSIZEYUV symbol if YUV encoding is enabled, and add 1 to the buffer size; This allows jpgtest to be used to benchmark the old TurboJPEG/IPP libraries.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@446 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-25 01:14:46 +00:00
DRC
0cc1279e03 Use correct size for YUV buffers
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@445 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-25 00:54:29 +00:00
DRC
10e3193373 git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@441 632fc199-4ca6-4c93-a231-07263d6284db 2011-02-25 00:14:12 +00:00
DRC
eeab6957dd Replace the TJ_YUV flag with two new API functions, and add TJBUFSIZEYUV() from trunk
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@440 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-25 00:02:04 +00:00
DRC
5cb1b68d39 Tiling doesn't work with YUV encoding either
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@439 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-24 22:13:20 +00:00
DRC
0b11d1c815 Fix various CR/LF issues
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@438 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-24 21:43:35 +00:00
DRC
582a46a59e Ensure that libjpeg state is reset if an error occurs
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@437 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-24 21:16:10 +00:00
DRC
6e51e19b1c Use a proper version script for libturbojpeg, since we've added functions to it since 1.0
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@436 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-24 19:36:02 +00:00
DRC
2ca3eb5660 Oops. dumpbuf() was displaying only red components.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@429 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-23 01:40:44 +00:00
DRC
404e82e070 Test all YUV decode paths
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@427 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-22 19:59:54 +00:00
DRC
7d9d434826 "TurboJPEG/OSS"="TurboJPEG", since the TurboJPEG header is used with other codecs besides libjpeg-turbo
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@420 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-22 00:31:27 +00:00
DRC
b4b31403c7 RGBA=RGBX, BGRA=BGRX, ABGR=XBGR, ARGB=XRGB
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@412 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-19 17:31:24 +00:00
DRC
2a28599343 Implement "ultra quiet mode" for generating output that is easy to copy/paste into a spreadsheet
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@411 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-19 17:20:11 +00:00
DRC
3e87c8b0a4 Wordsmithing
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@410 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-19 16:42:14 +00:00
DRC
db8df01c85 git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@409 632fc199-4ca6-4c93-a231-07263d6284db 2011-02-19 00:01:11 +00:00
DRC
240d82f8be Include jpgtest in Unix/Linux distribution packages
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@408 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-19 00:00:34 +00:00
DRC
8569c2f5a6 Include libjpeg run-time programs and jpgtest in installer; Move documentation in SDK distribution packages into doc\ subdirectory
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@407 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 23:49:42 +00:00
DRC
5d6f858235 Disable CXX compiler check
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@406 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 23:08:58 +00:00
DRC
f3281e8275 Oops. We still had the description left over from VirtualGL
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@403 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 22:40:34 +00:00
DRC
0d2d965364 Wordsmithed the project description
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@402 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 22:29:45 +00:00
DRC
16e761e59c Include high-quality test image in distribution
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@401 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 21:20:50 +00:00
DRC
69e15442f3 1.1.0
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@400 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 21:16:56 +00:00
DRC
da509e32c6 New C version of jpgtest needs libm
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@399 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 21:16:04 +00:00
DRC
23ce65d25d Updated (C)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@392 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 07:02:32 +00:00
DRC
f38eee0739 The API/ABI should be described as "libjpeg v8", not "libjpeg v8b", since there are multiple libjpeg releases with the same interface
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@391 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 07:00:38 +00:00
DRC
c4ef01fc66 Add high-quality JPEG tests to CMake
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@388 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 05:06:58 +00:00
DRC
ab4db657db Various documentation tweaks
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@387 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 04:55:08 +00:00
DRC
f0a5ba7542 "integer forward DCT", not "forward integer DCT"
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@382 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 03:21:06 +00:00
DRC
7c1df0a430 Performance pitfalls
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@380 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 02:45:24 +00:00
DRC
bb4465f392 git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@379 632fc199-4ca6-4c93-a231-07263d6284db 2011-02-18 02:41:03 +00:00
DRC
72abc29722 The SIMD quantization algorithm does not produce correct results with the fast forward integer DCT and JPEG qualities >= 98, so for now, use the non-SIMD quantization function under those circumstances.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@378 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-18 01:45:24 +00:00
DRC
fc1970acef Fix typo that was causing visual artifacts in grayscale JPEGs
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@376 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-17 07:51:35 +00:00
DRC
dbf80031ae Not using Intel codec anymore
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@371 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-16 01:39:29 +00:00
DRC
8254df1a06 Document that pitch=0 == pitch=width*pixelsize
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@366 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-15 07:57:48 +00:00
DRC
91e86ba6cf Ensure that YUV temp buffers get properly freed if a failure occurs
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@364 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-15 05:24:08 +00:00
DRC
cfef7f1bd8 Ensure that the exit status of the program indicates failure if one of the pixel value checks fails
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@362 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-15 05:17:20 +00:00
DRC
b8cc52bf1a Ported jpgtest.cxx to pure C to avoid the need for a C++ compiler
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@360 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-15 03:59:11 +00:00
DRC
e27124ab39 git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@359 632fc199-4ca6-4c93-a231-07263d6284db 2011-02-08 07:14:33 +00:00
DRC
2e4d044cab Ported jpgtest.cxx to pure C to avoid the need for a C++ compiler
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@355 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-08 01:18:37 +00:00
DRC
daae6d966a Clarify that the C wrappers and headers fall under the same license as the rest of the SIMD code
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@334 632fc199-4ca6-4c93-a231-07263d6284db
2011-02-02 05:41:15 +00:00
DRC
4a1c2d9693 git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@329 632fc199-4ca6-4c93-a231-07263d6284db 2011-01-28 08:00:10 +00:00
DRC
c4bce4857e git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@327 632fc199-4ca6-4c93-a231-07263d6284db 2011-01-28 07:51:25 +00:00
DRC
a4efd4eec7 Create 1.1.x branch
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@325 632fc199-4ca6-4c93-a231-07263d6284db
2011-01-28 06:06:34 +00:00
DRC
2d94e261ec The fast integer DCT degrades for qualities > 95, so use the slow integer DCT instead to ensure that perceptually lossless performance is maintained.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@320 632fc199-4ca6-4c93-a231-07263d6284db
2011-01-25 06:52:31 +00:00
DRC
01e6909180 Clarifications
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@319 632fc199-4ca6-4c93-a231-07263d6284db
2011-01-06 01:19:43 +00:00
47 changed files with 874 additions and 667 deletions

View File

@@ -12,21 +12,25 @@ Build Requirements
-- libtool 1.4 or later
-- NASM
* 0.98 or later is required for a 32-bit build
* NASM 2.05 or later is required for a 64-bit build
* 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
obtained from MacPorts (http://www.macports.org/).
The NASM 2.05 RPMs do not work on older Linux systems, such as Red Hat
Enterprise Linux 4. On such systems, you can easily build and install NASM
2.05 from the source RPM by executing the following as root:
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`
wget http://www.nasm.us/pub/nasm/releasebuilds/2.05.01/nasm-2.05.01-1.src.rpm
rpmbuild --rebuild nasm-2.05.01-1.src.rpm
rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-2.05.01-1.$ARCH.rpm
rpmbuild --rebuild nasm-{version}.src.rpm
rpm -Uvh /usr/src/redhat/RPMS/$ARCH/nasm-{version}.$ARCH.rpm
NOTE: NASM build will fail if texinfo is not installed.
NOTE: the NASM build will fail if texinfo is not installed.
-- GCC v4.1 or later recommended for best performance
@@ -91,17 +95,17 @@ This will generate the following files under .libs/
Development stub for TurboJPEG/OSS shared library
{version} is 62.0.0, 7.0.0, or 8.0.2, depending on whether libjpeg v6b
(default), v7, or v8b emulation is enabled. If using Cygwin, {version} is
(default), v7, or v8 emulation is enabled. If using Cygwin, {version} is
62, 7, or 8.
libjpeg v7 or v8b Emulation
---------------------------
libjpeg v7 or v8 Emulation
--------------------------
Add --with-jpeg7 to the configure command line to build a version of
libjpeg-turbo that is compatible with libjpeg v7. Add --with-jpeg8 to the
configure command to build a version of libjpeg-turbo that is compatible with
libjpeg v8b. See README-turbo.txt for more information on libjpeg v7 and v8b
libjpeg v8. See README-turbo.txt for more information on libjpeg v7 and v8
emulation.
@@ -110,7 +114,7 @@ Arithmetic Coding Support
Since the patent on arithmetic coding has expired, this functionality has been
included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
based on the implementation in libjpeg v8b, but it works when emulating libjpeg
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
@@ -154,7 +158,7 @@ Build Recipes
Add
--host i686-pc-linux-gnu CFLAGS='-O3 -m32' CXXFLAGS='-O3 -m32' LDFLAGS=-m32
--host i686-pc-linux-gnu CFLAGS='-O3 -m32' LDFLAGS=-m32
to the configure command line.
@@ -175,7 +179,7 @@ installed.
Add
CFLAGS='-O3 -m32' CXXFLAGS='-O3 -m32' LDFLAGS=-m32
CFLAGS='-O3 -m32' LDFLAGS=-m32
to the configure command line.
@@ -187,8 +191,6 @@ Add
--host x86_64-apple-darwin NASM=/opt/local/bin/nasm \
CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
-mmacosx-version-min=10.4 -O3' \
CXXFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
-mmacosx-version-min=10.4 -O3' \
LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
-mmacosx-version-min=10.4'
@@ -203,8 +205,6 @@ MacPorts, must be installed.
Add
CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
-mmacosx-version-min=10.4 -O3 -m32' \
CXXFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
-mmacosx-version-min=10.4 -O3 -m32' \
LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
-mmacosx-version-min=10.4 -m32'
@@ -217,7 +217,7 @@ to the configure command line. The OS X 10.4 SDK must be installed.
Add
--host x86_64-pc-solaris CFLAGS='-O3 -m64' CXXFLAGS='-O3 -m64' LDFLAGS=-m64
--host x86_64-pc-solaris CFLAGS='-O3 -m64' LDFLAGS=-m64
to the configure command line.
@@ -227,8 +227,8 @@ to the configure command line.
Add
--host i386-unknown-freebsd CC='gcc -B /usr/lib32' CXX='g++ -B/usr/lib32' \
CFLAGS='-O3 -m32' CXXFLAGS='-O3 -m32' LDFLAGS='-B/usr/lib32'
--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.
@@ -239,15 +239,14 @@ Sun Studio
Add
CC=cc CXX=CC
CC=cc
to the configure command line. libjpeg-turbo will automatically be built with
the maximum optimization level (-xO5) unless you override CFLAGS and CXXFLAGS.
the maximum optimization level (-xO5) unless you override CFLAGS.
To build a 64-bit version of libjpeg-turbo using Sun Studio, add
--host x86_64-pc-solaris CC=cc CXX=CC CFLAGS='-xO5 -m64' \
CXXFLAGS='-xO5 -m64' LDFLAGS=-m64
--host x86_64-pc-solaris CC=cc CFLAGS='-xO5 -m64' LDFLAGS=-m64
to the configure command line.
@@ -346,7 +345,7 @@ The following files will be generated under {build_directory}:
Import library for TurboJPEG/OSS DLL
{version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
v8b emulation is enabled.
v8 emulation is enabled.
Visual C++ (IDE)
@@ -380,7 +379,7 @@ This will generate the following files under {build_directory}:
{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 v8b emulation is enabled.
depending on whether libjpeg v6b (default), v7, or v8 emulation is enabled.
MinGW
@@ -406,7 +405,7 @@ This will generate the following files under {build_directory}
Import library for TurboJPEG/OSS DLL
{version} is 62, 7, or 8, depending on whether libjpeg v6b (default), v7, or
v8b emulation is enabled.
v8 emulation is enabled.
Debug Build
@@ -417,13 +416,13 @@ NMake, remove "-DCMAKE_BUILD_TYPE=Release" (Debug builds are the default with
NMake.)
libjpeg v7 or v8b Emulation
---------------------------
libjpeg v7 or v8 Emulation
--------------------------
Add "-DWITH_JPEG7=1" to the cmake command line to build a version of
libjpeg-turbo that is compatible with libjpeg v7. Add "-DWITH_JPEG8=1" to the
cmake command to build a version of libjpeg-turbo that is compatible with
libjpeg v8b. See README-turbo.txt for more information on libjpeg v7 and v8b
libjpeg v8. See README-turbo.txt for more information on libjpeg v7 and v8
emulation.
@@ -432,7 +431,7 @@ Arithmetic Coding Support
Since the patent on arithmetic coding has expired, this functionality has been
included in this release of libjpeg-turbo. libjpeg-turbo's implementation is
based on the implementation in libjpeg v8b, but it works when emulating libjpeg
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
@@ -470,7 +469,7 @@ Build Recipes
----------------------------
cd {build_directory}
CC=/usr/bin/x86_64-w64-mingw32-gcc CXX=/usr/bin/x86_64-w64-mingw32-g++ \
CC=/usr/bin/x86_64-w64-mingw32-gcc \
cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_AR=/usr/bin/x86_64-w64-mingw32-ar \
-DCMAKE_RANLIB=/usr/bin/x86_64-w64-mingw32-ranlib {source_directory}
@@ -485,7 +484,7 @@ mingw64-x86_64-gcc-g++ packages (and their dependencies) must be installed.
----------------------------
cd {build_directory}
CC=/usr/bin/i686-w64-mingw32-gcc CXX=/usr/bin/i686-w64-mingw32-g++ \
CC=/usr/bin/i686-w64-mingw32-gcc \
cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
-DDCMAKE_AR=/usr/bin/i686-w64-mingw32-ar \
-DCMAKE_RANLIB=/usr/bin/i686-w64-mingw32-ranlib {source_directory}
@@ -504,7 +503,6 @@ toolchain (which is faster than the Cygwin version):
cd {build_directory}
CC={mingw-w64_binary_path}/x86_64-w64-mingw32-gcc \
CXX={mingw-w64_binary_path}/x86_64-w64-mingw32-g++ \
cmake -G "MSYS Makefiles" \
-DCMAKE_AR={mingw-w64_binary_path}/x86_64-w64-mingw32-ar \
-DCMAKE_RANLIB={mingw-w64_binary_path}/x86_64-w64-mingw32-ranlib \
@@ -517,7 +515,6 @@ MinGW Build on Linux
cd {build_directory}
CC={mingw_binary_path}/i386-mingw32-gcc \
CXX={mingw_binary_path}/i386-mingw32-g++ \
cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_AR={mingw_binary_path}/i386-mingw32-ar \
-DCMAKE_RANLIB={mingw_binary_path}/i386-mingw32-ranlib \

View File

@@ -4,8 +4,8 @@
cmake_minimum_required(VERSION 2.6)
project(libjpeg-turbo)
set(VERSION 1.0.90)
project(libjpeg-turbo C)
set(VERSION 1.1.1)
if(MINGW OR CYGWIN)
execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD)
@@ -32,17 +32,11 @@ endif()
message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
if(NOT DEFINED WITH_SIMD)
set(WITH_SIMD 1)
endif()
if(NOT DEFINED WITH_ARITH_ENC)
set(WITH_ARITH_ENC 1)
endif()
if(NOT DEFINED WITH_ARITH_DEC)
set(WITH_ARITH_DEC 1)
endif()
option(WITH_SIMD "Include SIMD extensions" TRUE)
option(WITH_ARITH_ENC "Include arithmetic encoding support" TRUE)
option(WITH_ARITH_DEC "Include arithmetic decoding support" TRUE)
option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
if(WITH_ARITH_ENC)
set(C_ARITH_CODING_SUPPORTED 1)
@@ -65,7 +59,7 @@ if(WITH_JPEG8)
set(JPEG_LIB_VERSION 80)
set(DLL_VERSION 8)
set(FULLVERSION ${DLL_VERSION}.0.2)
message(STATUS "Emulating libjpeg v8b API/ABI")
message(STATUS "Emulating libjpeg v8 API/ABI")
elseif(WITH_JPEG7)
set(JPEG_LIB_VERSION 70)
set(DLL_VERSION 7)
@@ -76,9 +70,7 @@ endif(WITH_JPEG8)
if(MSVC)
# Use the static C library for all build types
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
if(${var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}")
endif()
@@ -177,22 +169,22 @@ target_link_libraries(jpegut turbojpeg)
add_executable(jpegut-static jpegut.c)
target_link_libraries(jpegut-static turbojpeg-static)
add_executable(jpgtest jpgtest.cxx bmp.c)
add_executable(jpgtest jpgtest.c bmp.c)
target_link_libraries(jpgtest turbojpeg)
add_executable(jpgtest-static jpgtest.cxx bmp.c)
add_executable(jpgtest-static jpgtest.c bmp.c)
target_link_libraries(jpgtest-static turbojpeg-static)
add_executable(cjpeg-static cjpeg.c cdjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c
rdtarga.c)
set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED")
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
target_link_libraries(cjpeg-static jpeg-static)
add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c
wrppm.c wrtarga.c)
set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED")
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
target_link_libraries(djpeg-static jpeg-static)
add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c)
@@ -214,6 +206,8 @@ add_test(cjpeg-int sharedlib/cjpeg -dct int -outfile testoutint.jpg ${CMAKE_SOUR
add_test(cjpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg)
add_test(cjpeg-fast sharedlib/cjpeg -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
add_test(cjpeg-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.jpg testoutfst.jpg)
add_test(cjpeg-fast-100 sharedlib/cjpeg -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
add_test(cjpeg-fast-100-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst100.jpg testoutfst100.jpg)
add_test(cjpeg-float sharedlib/cjpeg -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
if(WITH_SIMD)
add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.jpg testoutflt.jpg)
@@ -257,6 +251,8 @@ add_test(cjpeg-static-int cjpeg-static -dct int -outfile testoutint.jpg ${CMAKE_
add_test(cjpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg)
add_test(cjpeg-static-fast cjpeg-static -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
add_test(cjpeg-static-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.jpg testoutfst.jpg)
add_test(cjpeg-static-fast-100 cjpeg-static -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
add_test(cjpeg-static-fast-100-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst100.jpg testoutfst100.jpg)
add_test(cjpeg-static-float cjpeg-static -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
if(WITH_SIMD)
add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.jpg testoutflt.jpg)
@@ -299,24 +295,26 @@ add_test(jpegtran-static-crop-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOUR
# Installer
#
set(INST_NAME ${CMAKE_PROJECT_NAME})
if(MSVC)
set(INST_PLATFORM "Visual C++")
set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc)
set(INST_DIR ${CMAKE_PROJECT_NAME})
elseif(MINGW)
set(INST_PLATFORM GCC)
set(INST_NAME ${INST_NAME}-gcc)
set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc)
set(INST_DIR ${CMAKE_PROJECT_NAME}-gcc)
set(INST_DEFS -DGCC)
endif()
if(64BIT)
set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
set(INST_NAME ${INST_NAME}64)
set(INST_DIR ${INST_DIR}64)
set(INST_DEFS ${INST_DEFS} -DWIN64)
endif()
if(MSVC_IDE)
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=$(OutDir)\\")
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\")
else()
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
endif()
@@ -325,10 +323,11 @@ configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY)
add_custom_target(installer
makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi
DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static
DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
cjpeg djpeg jpegtran jpgtest
SOURCES libjpeg-turbo.nsi)
install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom jpgtest
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin

View File

@@ -1,14 +1,84 @@
Significant changes since 1.0.1
===============================
1.1.1
=====
[1] Added emulation of the libjpeg v7 and v8b APIs and ABIs. See
[1] Fixed a 1-pixel error in row 0, column 21 of the luminance plane generated
by tjEncodeYUV().
[2] libjpeg-turbo's accelerated Huffman decoder previously ignored unexpected
markers found in the middle of the JPEG data stream during decompression. It
will now hand off decoding of a particular block to the unaccelerated Huffman
decoder if an unexpected marker is found, so that the unaccelerated Huffman
decoder can generate an appropriate warning.
[3] Older versions of MinGW64 prefixed symbol names with underscores by
default, which differed from the behavior of 64-bit Visual C++. MinGW64 1.0
has adopted the behavior of 64-bit Visual C++ as the default, so to accommodate
this, the libjpeg-turbo SIMD function names are no longer prefixed with an
underscore when building with MinGW64. This means that, when building
libjpeg-turbo with older versions of MinGW64, you will now have to add
-fno-leading-underscore to the CFLAGS.
[4] Fixed a regression bug in the NSIS script that caused the Windows installer
build to fail when using the Visual Studio IDE.
[5] Fixed a bug in jpeg_read_coefficients() whereby it would not initialize
cinfo->image_width and cinfo->image_height if libjpeg v7 or v8 emulation was
enabled. This specifically caused the jpegoptim program to fail if it was
linked against a version of libjpeg-turbo that was built with libjpeg v7 or v8
emulation.
[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 <inputfile >output.jpg).
1.1.0
=====
[1] The algorithm used by the SIMD quantization function cannot produce correct
results when the JPEG quality is >= 98 and the fast integer forward DCT is
used. Thus, the non-SIMD quantization function is now used for those cases,
and libjpeg-turbo should now produce identical output to libjpeg v6b in all
cases.
[2] Despite the above, the fast integer forward DCT still degrades somewhat for
JPEG qualities greater than 95, so TurboJPEG/OSS will now automatically use the
slow integer forward DCT when generating JPEG images of quality 96 or greater.
This reduces compression performance by as much as 15% for these high-quality
images but is necessary to ensure that the images are perceptually lossless.
It also ensures that the library can avoid the performance pitfall created by
[1].
[3] Ported jpgtest.cxx to pure C to avoid the need for a C++ compiler.
[4] Fixed visual artifacts in grayscale JPEG compression caused by a typo in
the RGB-to-luminance lookup tables.
[5] The Windows distribution packages now include the libjpeg run-time programs
(cjpeg, etc.)
[6] All packages now include jpgtest.
[7] The TurboJPEG dynamic library now uses versioned symbols.
[8] Added two new TurboJPEG API functions, tjEncodeYUV() and
tjDecompressToYUV(), to replace the somewhat hackish TJ_YUV flag.
1.0.90 (1.1 beta1)
==================
[1] Added emulation of the libjpeg v7 and v8 APIs and ABIs. See
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.
[4] jpgtest can now be used to test decompression performance only.
[4] jpgtest can now be used to test decompression performance with existing
JPEG images.
[5] If the default install prefix (/opt/libjpeg-turbo) is used, then
'make install' now creates /opt/libjpeg-turbo/lib32 and
@@ -18,7 +88,7 @@ packages.
[6] All symbols in the libjpeg-turbo dynamic library are now versioned, even
when the library is built with libjpeg v6b emulation.
[7] Added arithmetic encoding and decoding support (can be disabled via
[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
@@ -30,8 +100,8 @@ allows the caller to determine the type of subsampling used in a JPEG image.
[10] Added further protections against invalid Huffman codes.
Significant changes since 1.0.0
===============================
1.0.1
=====
[1] The Huffman decoder will now handle erroneous Huffman codes (for instance,
from a corrupt JPEG image.) Previously, these would cause libjpeg-turbo to
@@ -44,8 +114,8 @@ be used instead of 4:2:0 when decompressing JPEG images using SSE2 code.
INCOMPLETE_TYPES_BROKEN macro should be defined.
Significant changes since 0.0.93
================================
1.0.0
=====
[1] 2983700: Further FreeBSD build tweaks (no longer necessary to specify
--host when configuring on a 64-bit system)
@@ -69,18 +139,24 @@ contains just the 32-bit libjpeg-turbo libraries.
unit tests now work on those architectures.
Significant changes since 0.0.91
================================
0.0.93
======
[1] 2982659, Fixed x86-64 build on FreeBSD systems
[2] 2988188: Added support for Windows 64-bit systems
Significant changes since 0.0.90
================================
0.0.91
======
[1] Added documentation to .deb packages
[2] 2968313: Fixed data corruption issues when decompressing large JPEG images
and/or using buffered I/O with the libjpeg-turbo decompressor
0.0.90
======
Initial release

View File

@@ -37,14 +37,9 @@ endif
libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpegl.c turbojpeg.h \
turbojpeg-mapfile
if ANON_VERSION_SCRIPT
libturbojpeg_la_LDFLAGS += $(ANON_VERSION_SCRIPT_FLAG)$(srcdir)/turbojpeg-mapfile
endif
if VERSION_SCRIPT
libturbojpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)$(srcdir)/turbojpeg-mapfile
libjpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)libjpeg.map
endif
@@ -63,12 +58,12 @@ endif
TSTHDRS = rrutil.h rrtimer.h
bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom
noinst_PROGRAMS = jpgtest jpegut
bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom jpgtest
noinst_PROGRAMS = jpegut
jpgtest_SOURCES = $(TSTHDRS) jpgtest.cxx bmp.h bmp.c
jpgtest_SOURCES = $(TSTHDRS) jpgtest.c bmp.h bmp.c
jpgtest_LDADD = libturbojpeg.la
jpgtest_LDADD = libturbojpeg.la -lm
jpegut_SOURCES = $(TSTHDRS) jpegut.c bmp.h bmp.c
@@ -113,7 +108,7 @@ DOCS= README install.txt usage.txt wizard.txt example.c libjpeg.txt \
TESTFILES= testorig.jpg testorig.ppm testimg.bmp testimgflt.jpg \
testimgfst.jpg testimgint.jpg testimgp.jpg testimgflt.ppm testimgfst.ppm \
testimgint.ppm testimgflt-nosimd.jpg testimgcrop.jpg testimgari.jpg \
testimgari.ppm
testimgari.ppm testimgfst100.jpg
EXTRA_DIST = win release $(DOCS) $(TESTFILES) CMakeLists.txt \
sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in
@@ -129,6 +124,8 @@ test: testclean all
cmp $(srcdir)/testimgint.jpg testoutint.jpg
./cjpeg -dct fast -opt -outfile testoutfst.jpg $(srcdir)/testorig.ppm
cmp $(srcdir)/testimgfst.jpg testoutfst.jpg
./cjpeg -dct fast -quality 100 -opt -outfile testoutfst100.jpg $(srcdir)/testorig.ppm
cmp $(srcdir)/testimgfst100.jpg testoutfst100.jpg
./cjpeg -dct float -outfile testoutflt.jpg $(srcdir)/testorig.ppm
if WITH_SIMD
cmp $(srcdir)/testimgflt.jpg testoutflt.jpg
@@ -172,15 +169,19 @@ testclean:
rm -f *_GRAYQ[0-9]*.bmp
rm -f *_GRAYQ[0-9]*.ppm
rm -f *_GRAYQ[0-9]*.jpg
rm -f *_GRAY.yuv
rm -f *_420Q[0-9]*.bmp
rm -f *_420Q[0-9]*.ppm
rm -f *_420Q[0-9]*.jpg
rm -f *_420.yuv
rm -f *_422Q[0-9]*.bmp
rm -f *_422Q[0-9]*.ppm
rm -f *_422Q[0-9]*.jpg
rm -f *_422.yuv
rm -f *_444Q[0-9]*.bmp
rm -f *_444Q[0-9]*.ppm
rm -f *_444Q[0-9]*.jpg
rm -f *_444.yuv
if X86_64
@@ -210,11 +211,12 @@ rpm: all
TMPDIR=`mktemp -d /tmp/${PACKAGE_NAME}-build.XXXXXX`; \
mkdir -p $$TMPDIR/RPMS; \
ln -fs `pwd` $$TMPDIR/BUILD; \
rm -f ${PACKAGE_NAME}.${RPMARCH}.rpm; \
rm -f ${PACKAGE_NAME}-${VERSION}.${RPMARCH}.rpm; \
rpmbuild -bb --define "_blddir $$TMPDIR/buildroot" \
--define "_topdir $$TMPDIR" --define "_srcdir ${srcdir}" \
--target ${RPMARCH} libjpeg-turbo.spec; \
cp $$TMPDIR/RPMS/${RPMARCH}/${PACKAGE_NAME}-${VERSION}-${BUILD}.${RPMARCH}.rpm ${PACKAGE_NAME}.${RPMARCH}.rpm; \
--target ${RPMARCH} pkgscripts/libjpeg-turbo.spec; \
cp $$TMPDIR/RPMS/${RPMARCH}/${PACKAGE_NAME}-${VERSION}-${BUILD}.${RPMARCH}.rpm \
${PACKAGE_NAME}-${VERSION}.${RPMARCH}.rpm; \
rm -rf $$TMPDIR
srpm: dist-gzip
@@ -224,38 +226,38 @@ srpm: dist-gzip
mkdir -p $$TMPDIR/BUILD; \
mkdir -p $$TMPDIR/SOURCES; \
mkdir -p $$TMPDIR/SPECS; \
rm -f ${PACKAGE_NAME}.src.rpm; \
rm -f ${PACKAGE_NAME}-${VERSION}.src.rpm; \
cp ${PACKAGE_NAME}-${VERSION}.tar.gz $$TMPDIR/SOURCES; \
cat libjpeg-turbo.spec | sed s/%{_blddir}/%{_tmppath}/g \
cat pkgscripts/libjpeg-turbo.spec | sed s/%{_blddir}/%{_tmppath}/g \
| sed s@%{_srcdir}/@@g | sed s/#--\>//g \
>$$TMPDIR/SPECS/libjpeg-turbo.spec; \
> $$TMPDIR/SPECS/libjpeg-turbo.spec; \
rpmbuild -bs --define "_topdir $$TMPDIR" $$TMPDIR/SPECS/libjpeg-turbo.spec; \
cp $$TMPDIR/SRPMS/${PACKAGE_NAME}-${VERSION}-${BUILD}.src.rpm ${PACKAGE_NAME}.src.rpm; \
cp $$TMPDIR/SRPMS/${PACKAGE_NAME}-${VERSION}-${BUILD}.src.rpm \
${PACKAGE_NAME}-${VERSION}.src.rpm; \
rm -rf $$TMPDIR
deb: all
sh $(srcdir)/release/makedpkg ${PACKAGE_NAME} ${VERSION} ${BUILD} \
${DEBARCH} ${srcdir}
sh pkgscripts/makedpkg
if X86_64
udmg: all
sh makemacpkg universal ${BUILDDIR32}
sh pkgscripts/makemacpkg universal ${BUILDDIR32}
endif
dmg: all
sh makemacpkg
sh pkgscripts/makemacpkg
if X86_64
csunpkg: all
sh makesunpkg combined ${BUILDDIR32}
sh pkgscripts/makesunpkg combined ${BUILDDIR32}
endif
sunpkg: all
sh makesunpkg
sh pkgscripts/makesunpkg
cygwinpkg: all
sh $(srcdir)/release/makecygwinpkg ${PACKAGE_NAME} ${VERSION} ${srcdir}
sh pkgscripts/makecygwinpkg

View File

@@ -2,22 +2,23 @@
** Background
*******************************************************************************
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
libjpeg-turbo is a derivative of libjpeg which 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.
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but
the TigerVNC and VirtualGL projects made numerous enhancements to the codec,
including improved support for Mac OS X, 64-bit support, support for 32-bit
and big endian pixel formats, accelerated Huffman encoding/decoding, and
various bug fixes. The goal was to produce a fully open source codec that
could replace the partially closed source TurboJPEG/IPP codec used by VirtualGL
and TurboVNC. libjpeg-turbo generally performs in the range of 80-120% of
TurboJPEG/IPP. It is faster in some areas but slower in others.
the TigerVNC and VirtualGL projects made numerous enhancements to the codec in
2009, including improved support for Mac OS X, 64-bit support, support for
32-bit and big endian pixel formats (RGBX, XBGR, etc.), accelerated Huffman
encoding/decoding, and various bug fixes. The goal was to produce a fully open
source codec that could replace the partially closed source TurboJPEG/IPP codec
used by VirtualGL and TurboVNC. libjpeg-turbo generally performs in the range
of 80-120% of TurboJPEG/IPP. It is faster in some areas but slower in others.
It was decided to split libjpeg-turbo into a separate SDK so that other
projects could take advantage of this technology. The libjpeg-turbo shared
In early 2010, libjpeg-turbo spun off into its own independent project, with
the goal of making high-speed JPEG compression/decompression technology
available to a broader range of users and developers. The libjpeg-turbo shared
libraries can be used as drop-in replacements for libjpeg on most systems.
@@ -25,21 +26,21 @@ libraries can be used as drop-in replacements for libjpeg on most systems.
** License
*******************************************************************************
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 optimizations 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 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.
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
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
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.
The rest of the source code, apart from the Huffman codec optimizations, falls
under a less restrictive, BSD-style license (see README.) You can choose to
distribute libjpeg-turbo, as a whole, under this BSD-style license by simply
replacing the optimized jchuff.c and jdhuff.c with their unoptimized
counterparts from the libjpeg v6b source.
The rest of the source code, apart from TurboJPEG/OSS and the Huffman codec
optimizations, falls under a less restrictive, BSD-style license (see README.)
You can choose to distribute libjpeg-turbo, as a whole, under this BSD-style
license by simply removing TurboJPEG/OSS and replacing the optimized jchuff.c
and jdhuff.c with their unoptimized counterparts from the libjpeg v6b source.
*******************************************************************************
@@ -51,7 +52,7 @@ Replacing libjpeg at Run Time
=============================
If a Unix application is dynamically linked with libjpeg, then you can replace
libjpeg with libjpeg-turbo at run time by manipulating the LD_LIBRARY_PATH.
libjpeg with libjpeg-turbo at run time by manipulating LD_LIBRARY_PATH.
For instance:
[Using libjpeg]
@@ -75,28 +76,29 @@ links to the libjpeg dynamic library located in /opt/libjpeg-turbo/{lib}. This
will effectively accelerate every dynamically linked libjpeg application on the
system.
The Windows distribution of the libjpeg-turbo SDK installs the libjpeg-turbo
DLL (jpeg62.dll, jpeg7.dll, or jpeg8.dll, depending on whether libjpeg v6b,
v7, or v8 emulation is enabled) into c:\libjpeg-turbo[64]\bin, and the PATH
The libjpeg-turbo SDK for Visual C++ installs the libjpeg-turbo DLL
(jpeg62.dll, jpeg7.dll, or jpeg8.dll, depending on whether libjpeg v6b, v7, or
v8 emulation is enabled) into c:\libjpeg-turbo[64]\bin, and the PATH
environment variable can be modified such that this directory is searched
before any others that might contain a libjpeg DLL. However, if a libjpeg
DLL exists in an application's install directory, then Windows will load this
DLL first whenever the application is launched. Thus, if an application ships
with jpeg62.dll, jpeg7.dll, or jpeg8.dll, then back up the application's
version of this DLL and copy c:\libjpeg-turbo\bin\jpeg*.dll into the
version of this DLL and copy c:\libjpeg-turbo[64]\bin\jpeg*.dll into the
application's install directory to accelerate it.
The version of the libjpeg-turbo DLL distributed with the "official"
libjpeg-turbo SDK requires the Visual C++ 2008 C run time DLL (msvcr90.dll).
The version of the libjpeg-turbo DLL distributed in the libjpeg-turbo SDK for
Visual C++ requires the Visual C++ 2008 C run time DLL (msvcr90.dll).
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
as a file handle, from an application to libjpeg will probably not work with
the "official" version of the libjpeg-turbo DLL unless the application is also
built to use the Visual C++ 2008 C run time DLL. In particular, this affects
jpeg_stdio_dest() and jpeg_stdio_src().
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
run time DLL. In particular, this affects jpeg_stdio_dest() and
jpeg_stdio_src().
Mac applications typically embed their own copies of the libjpeg dylib inside
the (hidden) application bundle, so it is not possible to globally replace
@@ -117,8 +119,8 @@ VirtualGL 2.1.x and TurboVNC 0.6 (and prior.) libjpeg-turbo contains a wrapper
library (TurboJPEG/OSS) that emulates the TurboJPEG API using libjpeg-turbo
instead of the closed source Intel Performance Primitives. You can replace the
TurboJPEG/IPP package on Linux systems with the libjpeg-turbo package in order
to make existing releases of VirtualGL 2.1.x and TurboVNC use the new codec at
run time. Note that the 64-bit libjpeg-turbo packages contain only 64-bit
to make existing releases of VirtualGL 2.1.x and TurboVNC 0.x use the new codec
at run time. Note that the 64-bit libjpeg-turbo packages contain only 64-bit
binaries, whereas the TurboJPEG/IPP 64-bit packages contained both 64-bit and
32-bit binaries. Thus, to replace a TurboJPEG/IPP 64-bit package, install
both the 64-bit and 32-bit versions of libjpeg-turbo.
@@ -152,11 +154,11 @@ If using MinGW, then set
Building against libjpeg-turbo is useful, for instance, if you want to build an
application that leverages the libjpeg-turbo colorspace extensions (see below.)
On Linux and Solaris systems, you would still need to manipulate the
LD_LIBRARY_PATH or sym links appropriately to use libjpeg-turbo at run time.
On such systems, you can pass -R /opt/libjpeg-turbo/{lib} to the linker to
force the use of libjpeg-turbo at run time rather than libjpeg (also useful if
you want to leverage the colorspace extensions), or you can link against the
On Linux and Solaris systems, you would still need to manipulate
LD_LIBRARY_PATH or create appropriate sym links to use libjpeg-turbo at run
time. On such systems, you can pass -R /opt/libjpeg-turbo/{lib} to the linker
to force the use of libjpeg-turbo at run time rather than libjpeg (also useful
if you want to leverage the colorspace extensions), or you can link against the
libjpeg-turbo static library.
To force a Linux, Solaris, or MinGW application to link against the static
@@ -168,8 +170,8 @@ On OS X, simply add /opt/libjpeg-turbo/lib/libjpeg.a to the linker command
line (this also works on Linux and Solaris.)
To build Visual C++ applications using libjpeg-turbo, add
c:\libjpeg-turbo[64]\include to your system or user INCLUDE environment
variable and c:\libjpeg-turbo[64]\lib to your system or user LIB environment
c:\libjpeg-turbo[64]\include to the system or user INCLUDE environment
variable and c:\libjpeg-turbo[64]\lib to the system or user LIB environment
variable, and then link against either jpeg.lib (to use the DLL version of
libjpeg-turbo) or jpeg-static.lib (to use the static version of libjpeg-turbo.)
@@ -227,7 +229,7 @@ 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 v8b API/ABI, so that programs
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
following section describes which libjpeg v7+ features are supported and which
aren't.
@@ -272,3 +274,31 @@ Not supported:
-- jpegtran: Scaling
Seems to depend on the DCT scaling feature, which isn't supported.
*******************************************************************************
** Performance pitfalls
*******************************************************************************
===============
Restart Markers
===============
The optimized Huffman decoder in libjpeg-turbo does not handle restart markers
in a way that makes libjpeg happy, so it is necessary to use the slow Huffman
decoder when decompressing a JPEG image that has restart markers. This can
cause the decompression performance to drop by as much as 20%, but the
performance will still be much much greater than that of libjpeg v6b. Many
consumer packages, such as PhotoShop, use restart markers when generating JPEG
images, so images generated by those programs will experience this issue.
===============================================
Fast Integer Forward DCT at High Quality Levels
===============================================
The algorithm used by the SIMD-accelerated quantization function cannot produce
correct results whenever the fast integer forward DCT is used along with a JPEG
quality of 98-100. Thus, libjpeg-turbo must use the non-SIMD quantization
function in those cases. This causes performance to drop by as much as 40%.
It is therefore strongly advised that you use the slow integer forward DCT
whenever encoding images with a JPEG quality of 98 or higher.

3
bmp.h
View File

@@ -1,5 +1,6 @@
/* Copyright (C)2004 Landmark Graphics Corporation
* Copyright (C)2005 Sun Microsystems, Inc.
* Copyright (C)2011 D. R. Commander
*
* This library is free software and may be redistributed and/or modified under
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -19,7 +20,7 @@
#define __BMP_H__
#define BMPPIXELFORMATS 6
enum BMPPIXELFORMAT {BMP_RGB=0, BMP_RGBA, BMP_BGR, BMP_BGRA, BMP_ABGR, BMP_ARGB};
enum BMPPIXELFORMAT {BMP_RGB=0, BMP_RGBX, BMP_BGR, BMP_BGRX, BMP_XBGR, BMP_XRGB};
#ifdef __cplusplus
extern "C" {

View File

@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.56])
AC_INIT([libjpeg-turbo], [1.0.90])
AC_INIT([libjpeg-turbo], [1.1.1])
BUILD=`date +%Y%m%d`
AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
@@ -13,10 +13,9 @@ AC_DEFINE([HAVE_PROTOTYPES], 1, [Define if your compiler supports prototypes])
# Checks for programs.
SAVED_CFLAGS=${CFLAGS}
SAVED_CXXFLAGS=${CXXFLAGS}
SAVED_CPPFLAGS=${CPPFLAGS}
AC_PROG_CPP
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_LN_S
@@ -32,8 +31,8 @@ if test "x${GCC}" = "xyes"; then
if test "x${SAVED_CFLAGS}" = "x"; then
CFLAGS=-O3
fi
if test "x${SAVED_CXXFLAGS}" = "x"; then
CXXFLAGS=-O3
if test "x${SAVED_CPPFLAGS}" = "x"; then
CPPFLAGS=-Wall
fi
fi
@@ -42,9 +41,6 @@ if test "x${SUNCC}" = "xyes"; then
if test "x${SAVED_CFLAGS}" = "x"; then
CFLAGS=-xO5
fi
if test "x${SAVED_CXXFLAGS}" = "x"; then
CXXFLAGS=-xO5
fi
fi
# Checks for libraries.
@@ -102,21 +98,13 @@ AC_CHECK_FUNCS([memset memcpy], [],
[AC_DEFINE([NEED_BSD_STRINGS], 1,
[Define if you have BSD-like bzero and bcopy])])
# Set flags to indicate platform
case "$host_os" in
cygwin* | mingw* | pw32* | interix*)
is_win32=1
;;
esac
AM_CONDITIONAL([IS_WIN32], [test "x$is_win32" = "x1"])
AC_MSG_CHECKING([libjpeg API version])
AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
if test "x$JPEG_LIB_VERSION" = "x"; then
AC_ARG_WITH([jpeg7],
AC_HELP_STRING([--with-jpeg7], [Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
AC_ARG_WITH([jpeg8],
AC_HELP_STRING([--with-jpeg8], [Emulate libjpeg v8b API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
AC_HELP_STRING([--with-jpeg8], [Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b.)]))
if test "x${with_jpeg8}" = "xyes"; then
JPEG_LIB_VERSION=80
else
@@ -176,36 +164,13 @@ if test "x$VERSION_SCRIPT_FLAG" = "x"; then
VERSION_SCRIPT=no
AC_MSG_RESULT(no)
fi
ANON_VERSION_SCRIPT=yes
AC_MSG_CHECKING([whether the linker supports anonymous version scripts])
LDFLAGS="$SAVED_LDFLAGS -Wl,--version-script,conftest.map"
cat > conftest.map <<EOF
{
global: main;
local: *;
};
EOF
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
[ANON_VERSION_SCRIPT_FLAG=-Wl,--version-script,; AC_MSG_RESULT([yes (GNU style)])], [])
if test "x$ANON_VERSION_SCRIPT_FLAG" = "x"; then
LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map"
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
[ANON_VERSION_SCRIPT_FLAG=-Wl,-M,; AC_MSG_RESULT([yes (Sun style)])], [])
fi
if test "x$ANON_VERSION_SCRIPT_FLAG" = "x"; then
ANON_VERSION_SCRIPT=no
AC_MSG_RESULT(no)
fi
LDFLAGS="$SAVED_LDFLAGS"
AC_MSG_CHECKING([whether to use version script when building libjpeg])
AC_MSG_CHECKING([whether to use version script when building libjpeg-turbo])
AC_MSG_RESULT($VERSION_SCRIPT)
AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
AM_CONDITIONAL(ANON_VERSION_SCRIPT, test "x$ANON_VERSION_SCRIPT" = "xyes")
AC_SUBST(VERSION_SCRIPT_FLAG)
AC_SUBST(ANON_VERSION_SCRIPT_FLAG)
AC_MSG_CHECKING([whether to include arithmetic encoding support])
AC_ARG_WITH([arith-enc],
@@ -233,7 +198,7 @@ AM_CONDITIONAL([WITH_ARITH], [test "x$with_arith_dec" != "xno" -o "x$with_arith_
# SIMD is optional
AC_ARG_WITH([simd],
AC_HELP_STRING([--without-simd],[Omit accelerated SIMD routines.]))
AC_HELP_STRING([--without-simd],[Omit SIMD extensions.]))
if test "x${with_simd}" != "xno"; then
# Check if we're on a supported CPU
AC_MSG_CHECKING([if we have SIMD optimisations for cpu type])
@@ -287,9 +252,16 @@ AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [Build number])
# jconfig.h is a minimal version that allows this package to be built
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_HEADERS([jconfig.h])
AC_CONFIG_FILES([libjpeg-turbo.spec:release/libjpeg-turbo.spec.in])
AC_CONFIG_FILES([makemacpkg:release/makemacpkg.in])
AC_CONFIG_FILES([makesunpkg:release/makesunpkg.in])
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])
AC_CONFIG_FILES([pkgscripts/uninstall:release/uninstall.in])
AC_CONFIG_FILES([pkgscripts/makesunpkg:release/makesunpkg.in])
AC_CONFIG_FILES([pkgscripts/pkginfo:release/pkginfo.in])
AC_CONFIG_FILES([libjpeg.map])
AC_CONFIG_FILES([Makefile simd/Makefile])
AC_OUTPUT

View File

@@ -3,7 +3,7 @@
*
* Copyright (C) 1991-1996, Thomas G. Lane.
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright 2009 D. R. Commander
* Copyright 2009-2011 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.
*
@@ -122,7 +122,7 @@ static const unsigned char green_lut[256] = {
113, 113, 114, 114, 115, 116, 116, 117, 117, 118, 119, 119,
120, 120, 121, 122, 122, 123, 123, 124, 124, 125, 126, 126,
127, 127, 128, 129, 129, 130, 130, 131, 131, 132, 133, 133,
34, 134, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140,
134, 134, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140,
141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 147,
148, 149, 149, 150
};
@@ -258,14 +258,13 @@ rgb_gray_convert (j_compress_ptr cinfo,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows)
{
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
#if BITS_IN_JSAMPLE != 8
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
register INT32 * ctab = cconvert->rgb_ycc_tab;
#endif
register JSAMPROW inptr;
register JSAMPROW outptr;
JSAMPLE *maxoutptr;
register JDIMENSION col;
JDIMENSION num_cols = cinfo->image_width;
int rindex = rgb_red[cinfo->in_color_space];
int gindex = rgb_green[cinfo->in_color_space];

View File

@@ -4,6 +4,7 @@
* Copyright (C) 1994-1996, Thomas G. Lane.
* Copyright (C) 1999-2006, MIYASAKA Masaru.
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2011 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.
*
@@ -39,6 +40,8 @@ typedef JMETHOD(void, float_quantize_method_ptr,
(JCOEFPTR coef_block, FAST_FLOAT * divisors,
FAST_FLOAT * workspace));
METHODDEF(void) quantize (JCOEFPTR, DCTELEM *, DCTELEM *);
typedef struct {
struct jpeg_forward_dct pub; /* public fields */
@@ -160,7 +163,7 @@ flss (UINT16 val)
* of in a consecutive manner, yet again in order to allow SIMD
* routines.
*/
LOCAL(void)
LOCAL(int)
compute_reciprocal (UINT16 divisor, DCTELEM * dtbl)
{
UDCTELEM2 fq, fr;
@@ -189,6 +192,9 @@ compute_reciprocal (UINT16 divisor, DCTELEM * dtbl)
dtbl[DCTSIZE2 * 1] = (DCTELEM) c; /* correction + roundfactor */
dtbl[DCTSIZE2 * 2] = (DCTELEM) (1 << (sizeof(DCTELEM)*8*2 - r)); /* scale */
dtbl[DCTSIZE2 * 3] = (DCTELEM) r - sizeof(DCTELEM)*8; /* shift */
if(r <= 16) return 0;
else return 1;
}
/*
@@ -232,7 +238,9 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
}
dtbl = fdct->divisors[qtblno];
for (i = 0; i < DCTSIZE2; i++) {
compute_reciprocal(qtbl->quantval[i] << 3, &dtbl[i]);
if(!compute_reciprocal(qtbl->quantval[i] << 3, &dtbl[i])
&& fdct->quantize == jsimd_quantize)
fdct->quantize = quantize;
}
break;
#endif
@@ -266,10 +274,12 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
}
dtbl = fdct->divisors[qtblno];
for (i = 0; i < DCTSIZE2; i++) {
compute_reciprocal(
if(!compute_reciprocal(
DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
(INT32) aanscales[i]),
CONST_BITS-3), &dtbl[i]);
CONST_BITS-3), &dtbl[i])
&& fdct->quantize == jsimd_quantize)
fdct->quantize = quantize;
}
}
break;

View File

@@ -75,7 +75,9 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
JDIMENSION jd_samplesperrow;
#if JPEG_LIB_VERSION >= 70
#if JPEG_LIB_VERSION >= 80
if (!transcode_only)
#endif
jpeg_calc_jpeg_dimensions(cinfo);
#endif

View File

@@ -223,7 +223,6 @@ gray_rgb_convert (j_decompress_ptr cinfo,
{
register JSAMPROW inptr, outptr;
JSAMPLE *maxinptr;
register JDIMENSION col;
JDIMENSION num_cols = cinfo->output_width;
int rindex = rgb_red[cinfo->out_color_space];
int gindex = rgb_green[cinfo->out_color_space];

View File

@@ -623,6 +623,7 @@ decode_mcu_slow (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
if (val0 == 0xFF) { \
buffer++; \
if (val1 != 0) { \
cinfo->unread_marker = val1; \
buffer -= 2; \
get_buffer &= ~0xFF; \
} \
@@ -739,6 +740,11 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
}
}
if (cinfo->unread_marker != 0) {
cinfo->unread_marker = 0;
return FALSE;
}
br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
br_state.next_input_byte = buffer;
BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
@@ -778,7 +784,8 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
usefast = 0;
}
if (cinfo->src->bytes_in_buffer < BUFSIZE * cinfo->blocks_in_MCU)
if (cinfo->src->bytes_in_buffer < BUFSIZE * cinfo->blocks_in_MCU
|| cinfo->unread_marker != 0)
usefast = 0;
/* If we've run out of data, just leave the MCU set to zeroes.
@@ -787,9 +794,10 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
if (! entropy->pub.insufficient_data) {
if (usefast) {
if (!decode_mcu_fast(cinfo, MCU_data)) return FALSE;
if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
}
else {
use_slow:
if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
}

View File

@@ -99,6 +99,11 @@ transdecode_master_selection (j_decompress_ptr cinfo)
/* This is effectively a buffered-image operation. */
cinfo->buffered_image = TRUE;
#if JPEG_LIB_VERSION >= 80
/* Compute output image dimensions and related values. */
jpeg_core_output_dimensions(cinfo);
#endif
/* Entropy decoding: either Huffman or arithmetic coding. */
if (cinfo->arith_code) {
#ifdef D_ARITH_CODING_SUPPORTED

View File

@@ -37,6 +37,15 @@ extern char * getenv JPP((const char * name));
#endif
LOCAL(size_t)
round_up_pow2 (size_t a, size_t b)
/* a rounded up to the next multiple of b, i.e. ceil(a/b)*b */
/* Assumes a >= 0, b > 0, and b is a power of 2 */
{
return ((a + b - 1) & (~(b - 1)));
}
/*
* Some important notes:
* The allocation routines provided here must never return NULL.
@@ -265,7 +274,7 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
* and so that algorithms can straddle outside the proper area up
* to the next alignment.
*/
sizeofobject = jround_up(sizeofobject, ALIGN_SIZE);
sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
/* Check for unsatisfiable request (do now to ensure no overflow below) */
if ((SIZEOF(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK)
@@ -354,7 +363,7 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
* algorithms can straddle outside the proper area up to the next
* alignment.
*/
sizeofobject = jround_up(sizeofobject, ALIGN_SIZE);
sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
/* Check for unsatisfiable request (do now to ensure no overflow below) */
if ((SIZEOF(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) > MAX_ALLOC_CHUNK)
@@ -420,7 +429,7 @@ alloc_sarray (j_common_ptr cinfo, int pool_id,
/* Make sure each row is properly aligned */
if ((ALIGN_SIZE % SIZEOF(JSAMPLE)) != 0)
out_of_memory(cinfo, 5); /* safety check */
samplesperrow = (JDIMENSION)jround_up(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE));
samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE));
/* Calculate max # of rows allowed in one allocation chunk */
ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /

View File

@@ -375,7 +375,7 @@ EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
/* Utility routines in jutils.c */
EXTERN(long) jdiv_round_up JPP((long a, long b));
EXTERN(size_t) jround_up JPP((size_t a, size_t b));
EXTERN(long) jround_up JPP((long a, long b));
EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
JSAMPARRAY output_array, int dest_row,
int num_rows, JDIMENSION num_cols));

104
jpegut.c
View File

@@ -1,6 +1,6 @@
/* Copyright (C)2004 Landmark Graphics Corporation
* Copyright (C)2005 Sun Microsystems, Inc.
* Copyright (C)2009-2010 D. R. Commander
* Copyright (C)2009-2011 D. R. Commander
*
* This library is free software and may be redistributed and/or modified under
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -107,12 +107,13 @@ void dumpbuf(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,
j;
printf("\n");
for(i=0; i<h; i++)
{
for(j=0; j<w; j++)
{
printf("%.3d/%.3d/%.3d ", buf[(w*i+j)*ps+roffset],
buf[(w*i+j)*ps+roffset], buf[(w*i+j)*ps+roffset]);
buf[(w*i+j)*ps+goffset], buf[(w*i+j)*ps+boffset]);
}
printf("\n");
}
@@ -218,15 +219,14 @@ int checkbuf(unsigned char *buf, int w, int h, int ps, int subsamp, int flags)
}}
#define checkval255(v) { \
if(v<254 && !(v==217 && i==0 && j==21)) { \
if(v<254) { \
printf("\nComp. %s at %d,%d should be 255, not %d\n", #v, i, j, v); \
retval=0; goto bailout; \
}}
#define PAD(v, p) ((v+(p)-1)&(~((p)-1)))
int checkbufyuv(unsigned char *buf, unsigned long size, int w, int h,
int subsamp)
int checkbufyuv(unsigned char *buf, int w, int h, int subsamp)
{
int i, j;
int hsf=_hsf[subsamp], vsf=_vsf[subsamp];
@@ -234,13 +234,6 @@ int checkbufyuv(unsigned char *buf, unsigned long size, int w, int h,
int cw=pw/hsf, ch=ph/vsf;
int ypitch=PAD(pw, 4), uvpitch=PAD(cw, 4);
int retval=1;
unsigned long correctsize=ypitch*ph + (subsamp==TJ_GRAYSCALE? 0:uvpitch*ch*2);
if(size!=correctsize)
{
printf("\nIncorrect size %lu. Should be %lu\n", size, correctsize);
retval=0; goto bailout;
}
for(i=0; i<16; i++)
{
@@ -349,17 +342,15 @@ void gentestjpeg(tjhandle hnd, unsigned char *jpegbuf, unsigned long *size,
char tempstr[1024]; unsigned char *bmpbuf=NULL;
const char *pixformat; double t;
if(yuv==YUVENCODE) flags|=TJ_YUV;
if(flags&TJ_BGR)
{
if(ps==3) pixformat="BGR";
else {if(flags&TJ_ALPHAFIRST) pixformat="ABGR"; else pixformat="BGRA";}
else {if(flags&TJ_ALPHAFIRST) pixformat="XBGR"; else pixformat="BGRX";}
}
else
{
if(ps==3) pixformat="RGB";
else {if(flags&TJ_ALPHAFIRST) pixformat="ARGB"; else pixformat="RGBA";}
else {if(flags&TJ_ALPHAFIRST) pixformat="XRGB"; else pixformat="RGBX";}
}
if(ps==1) pixformat="Grayscale";
if(yuv==YUVENCODE)
@@ -374,10 +365,20 @@ void gentestjpeg(tjhandle hnd, unsigned char *jpegbuf, unsigned long *size,
printf("ERROR: Could not allocate buffer\n"); bailout();
}
initbuf(bmpbuf, w, h, ps, flags);
memset(jpegbuf, 0, TJBUFSIZE(w, h));
memset(jpegbuf, 0,
yuv==YUVENCODE? TJBUFSIZEYUV(w, h, subsamp):TJBUFSIZE(w, h));
t=rrtime();
_catch(tjCompress(hnd, bmpbuf, w, 0, h, ps, jpegbuf, size, subsamp, qual, flags));
if(yuv==YUVENCODE)
{
_catch(tjEncodeYUV(hnd, bmpbuf, w, 0, h, ps, jpegbuf, subsamp, flags));
*size=TJBUFSIZEYUV(w, h, subsamp);
}
else
{
_catch(tjCompress(hnd, bmpbuf, w, 0, h, ps, jpegbuf, size, subsamp, qual,
flags));
}
t=rrtime()-t;
if(yuv==YUVENCODE)
@@ -389,8 +390,8 @@ void gentestjpeg(tjhandle hnd, unsigned char *jpegbuf, unsigned long *size,
writejpeg(jpegbuf, *size, tempstr);
if(yuv==YUVENCODE)
{
if(checkbufyuv(jpegbuf, *size, w, h, subsamp)) printf("Passed.");
else printf("FAILED!");
if(checkbufyuv(jpegbuf, w, h, subsamp)) printf("Passed.");
else {printf("FAILED!"); exitstatus=-1;}
}
else printf("Done.");
printf(" %f ms\n Result in %s\n", t*1000., tempstr);
@@ -405,23 +406,18 @@ void gentestbmp(tjhandle hnd, unsigned char *jpegbuf, unsigned long jpegsize,
unsigned char *bmpbuf=NULL;
const char *pixformat; int _w=0, _h=0; double t;
unsigned long size=0;
int hsf=_hsf[subsamp], vsf=_vsf[subsamp];
int pw=PAD(w, hsf), ph=PAD(h, vsf);
int cw=pw/hsf, ch=ph/vsf;
int ypitch=PAD(pw, 4), uvpitch=PAD(cw, 4);
if(yuv==YUVDECODE) flags|=TJ_YUV;
else if(yuv==YUVENCODE) return;
if(yuv==YUVENCODE) return;
if(flags&TJ_BGR)
{
if(ps==3) pixformat="BGR";
else {if(flags&TJ_ALPHAFIRST) pixformat="ABGR"; else pixformat="BGRA";}
else {if(flags&TJ_ALPHAFIRST) pixformat="XBGR"; else pixformat="BGRX";}
}
else
{
if(ps==3) pixformat="RGB";
else {if(flags&TJ_ALPHAFIRST) pixformat="ARGB"; else pixformat="RGBA";}
else {if(flags&TJ_ALPHAFIRST) pixformat="XRGB"; else pixformat="RGBX";}
}
if(ps==1) pixformat="Grayscale";
if(yuv==YUVDECODE)
@@ -436,30 +432,39 @@ void gentestbmp(tjhandle hnd, unsigned char *jpegbuf, unsigned long jpegsize,
printf("Incorrect JPEG header\n"); bailout();
}
if(yuv==YUVDECODE)
size=ypitch*ph + (subsamp==TJ_GRAYSCALE? 0:uvpitch*ch*2);
else
size=w*h*ps;
if((bmpbuf=(unsigned char *)malloc(size+1))==NULL)
if(yuv==YUVDECODE) size=TJBUFSIZEYUV(w, h, subsamp);
else size=w*h*ps+1;
if((bmpbuf=(unsigned char *)malloc(size))==NULL)
{
printf("ERROR: Could not allocate buffer\n"); bailout();
}
memset(bmpbuf, 0, size+1);
memset(bmpbuf, 0, size);
t=rrtime();
_catch(tjDecompress(hnd, jpegbuf, jpegsize, bmpbuf, w, w*ps, h, ps, flags));
if(yuv==YUVDECODE)
{
_catch(tjDecompressToYUV(hnd, jpegbuf, jpegsize, bmpbuf, flags));
}
else
{
_catch(tjDecompress(hnd, jpegbuf, jpegsize, bmpbuf, w, w*ps, h, ps,
flags));
}
t=rrtime()-t;
if(yuv==YUVDECODE)
{
if(checkbufyuv(bmpbuf, size, pw, ph, subsamp))
printf("Passed.");
else printf("FAILED!");
if(checkbufyuv(bmpbuf, w, h, subsamp)) printf("Passed.");
else {printf("FAILED!"); exitstatus=-1;}
}
else
{
if(checkbuf(bmpbuf, w, h, ps, subsamp, flags)) printf("Passed.");
else {printf("FAILED!"); dumpbuf(bmpbuf, w, h, ps, flags);}
else
{
printf("FAILED!"); exitstatus=-1;
dumpbuf(bmpbuf, w, h, ps, flags);
}
}
printf(" %f ms\n\n", t*1000.);
@@ -472,7 +477,8 @@ void dotest(int w, int h, int ps, int subsamp, char *basefilename)
tjhandle hnd=NULL, dhnd=NULL; unsigned char *jpegbuf=NULL;
unsigned long size;
if((jpegbuf=(unsigned char *)malloc(TJBUFSIZE(w, h))) == NULL)
size=(yuv==YUVENCODE? TJBUFSIZEYUV(w, h, subsamp):TJBUFSIZE(w, h));
if((jpegbuf=(unsigned char *)malloc(size)) == NULL)
{
puts("ERROR: Could not allocate buffer."); bailout();
}
@@ -542,9 +548,9 @@ void dotest1(void)
{
bmpbuf[i2*4]=pixels[i2%9][2];
bmpbuf[i2*4+1]=pixels[i2%9][1];
bmpbuf[i2*2+2]=pixels[i2%9][0];
bmpbuf[i2*4+2]=pixels[i2%9][0];
}
_catch(tjCompress(hnd, bmpbuf, i, i*4, j, 4,
_catch(tjCompress(hnd, bmpbuf, i, 0, j, 4,
jpgbuf, &size, TJ_444, 100, TJ_BGR));
free(bmpbuf); bmpbuf=NULL; free(jpgbuf); jpgbuf=NULL;
@@ -553,12 +559,12 @@ void dotest1(void)
{
printf("Memory allocation failure\n"); bailout();
}
for(i2=0; i2<j*i*4; i2++)
for(i2=0; i2<j*i; i2++)
{
if(i2%2==0) bmpbuf[i2]=0xFF;
else bmpbuf[i2]=0;
if(i2%2==0) bmpbuf[i2*4]=bmpbuf[i2*4+1]=bmpbuf[i2*4+2]=0xFF;
else bmpbuf[i2*4]=bmpbuf[i2*4+1]=bmpbuf[i2*4+2]=0;
}
_catch(tjCompress(hnd, bmpbuf, j, j*4, i, 4,
_catch(tjCompress(hnd, bmpbuf, j, 0, i, 4,
jpgbuf, &size, TJ_444, 100, TJ_BGR));
free(bmpbuf); bmpbuf=NULL; free(jpgbuf); jpgbuf=NULL;
}
@@ -593,6 +599,12 @@ int main(int argc, char *argv[])
yuv=YUVDECODE;
dotest(48, 48, 3, TJ_444, "test");
dotest(35, 39, 3, TJ_444, "test");
dotest(48, 48, 3, TJ_422, "test");
dotest(39, 41, 3, TJ_422, "test");
dotest(48, 48, 3, TJ_420, "test");
dotest(41, 35, 3, TJ_420, "test");
dotest(48, 48, 3, TJ_GRAYSCALE, "test");
dotest(35, 39, 3, TJ_GRAYSCALE, "test");
dotest(48, 48, 1, TJ_GRAYSCALE, "test");
dotest(39, 41, 1, TJ_GRAYSCALE, "test");
}

View File

@@ -1,6 +1,6 @@
/* Copyright (C)2004 Landmark Graphics Corporation
* Copyright (C)2005, 2006 Sun Microsystems, Inc.
* Copyright (C)2009-2010 D. R. Commander
* Copyright (C)2009-2011 D. R. Commander
*
* This library is free software and may be redistributed and/or modified under
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -40,11 +40,9 @@ const int _flags[BMPPIXELFORMATS]={0, 0, TJ_BGR, TJ_BGR,
const int _rindex[BMPPIXELFORMATS]={0, 0, 2, 2, 3, 1};
const int _gindex[BMPPIXELFORMATS]={1, 1, 1, 1, 2, 2};
const int _bindex[BMPPIXELFORMATS]={2, 2, 0, 0, 1, 3};
const char *_pfname[]={"RGB", "RGBA", "BGR", "BGRA", "ABGR", "ARGB"};
const char *_pfname[]={"RGB", "RGBX", "BGR", "BGRX", "XBGR", "XRGB"};
const char *_subnamel[NUMSUBOPT]={"4:4:4", "4:2:2", "4:2:0", "GRAY"};
const char *_subnames[NUMSUBOPT]={"444", "422", "420", "GRAY"};
const int _hsf[NUMSUBOPT]={1, 2, 2, 1};
const int _vsf[NUMSUBOPT]={1, 1, 2, 1};
void printsigfig(double val, int figs)
{
@@ -64,43 +62,39 @@ void printsigfig(double val, int figs)
printf(format, val);
}
void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu,
void dotest(unsigned char *srcbuf, int w, int h, int pf, int bu,
int jpegsub, int qual, char *filename, int dotile, int useppm, int quiet)
{
char tempstr[1024];
FILE *outfile=NULL; tjhandle hnd;
FILE *outfile=NULL; tjhandle hnd=NULL;
unsigned char **jpegbuf=NULL, *rgbbuf=NULL;
rrtimer timer; double elapsed;
int jpgbufsize=0, i, j, tilesizex, tilesizey, numtilesx, numtilesy, ITER;
double start, elapsed;
int jpgbufsize=0, i, j, tilesizex=w, tilesizey=h, numtilesx=1, numtilesy=1,
ITER;
unsigned long *comptilesize=NULL;
int flags=(forcemmx?TJ_FORCEMMX:0)|(forcesse?TJ_FORCESSE:0)
|(forcesse2?TJ_FORCESSE2:0)|(forcesse3?TJ_FORCESSE3:0)
|(fastupsample?TJ_FASTUPSAMPLE:0);
int ps=_ps[pf];
int pitch=w*ps, yuvsize;
int hsf=_hsf[jpegsub], vsf=_vsf[jpegsub];
int pw=PAD(w, hsf), ph=PAD(h, vsf);
int cw=pw/hsf, ch=ph/vsf;
int ypitch=PAD(pw, 4), uvpitch=PAD(cw, 4);
int ps=_ps[pf], tilen;
int pitch=w*ps, yuvsize=0;
flags |= _flags[pf];
if(bu) flags |= TJ_BOTTOMUP;
if(yuv==YUVENCODE) flags |= TJ_YUV;
yuvsize=ypitch*ph + (jpegsub==TJ_GRAYSCALE? 0:uvpitch*ch*2);
if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h))) == NULL)
if(yuv==YUVENCODE) yuvsize=TJBUFSIZEYUV(w, h, jpegsub);
if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h+1))) == NULL)
_throwunix("allocating image buffer");
if(!quiet)
{
if(yuv==YUVENCODE)
printf("\n>>>>> %s (%s) <--> YUV %s <<<<<\n", _pfname[pf],
printf(">>>>> %s (%s) <--> YUV %s <<<<<\n", _pfname[pf],
bu?"Bottom-up":"Top-down", _subnamel[jpegsub]);
else
printf("\n>>>>> %s (%s) <--> JPEG %s Q%d <<<<<\n", _pfname[pf],
printf(">>>>> %s (%s) <--> JPEG %s Q%d <<<<<\n", _pfname[pf],
bu?"Bottom-up":"Top-down", _subnamel[jpegsub], qual);
}
if(yuv==YUVDECODE) dotile=0;
if(yuv) dotile=0;
if(dotile) {tilesizex=tilesizey=4;} else {tilesizex=w; tilesizey=h;}
do
@@ -115,30 +109,46 @@ void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu,
memset(jpegbuf, 0, sizeof(unsigned char *)*numtilesx*numtilesy);
for(i=0; i<numtilesx*numtilesy; i++)
{
if((jpegbuf[i]=(unsigned char *)malloc(TJBUFSIZE(tilesizex, tilesizey))) == NULL)
if((jpegbuf[i]=(unsigned char *)malloc(
yuv==YUVENCODE? TJBUFSIZEYUV(tilesizex, tilesizey, jpegsub)
: TJBUFSIZE(tilesizex, tilesizey))) == NULL)
_throwunix("allocating image buffers");
}
// Compression test
if(quiet) printf("%s\t%s\t%s\t%d\t", _pfname[pf], bu?"BU":"TD",
if(quiet==1) printf("%s\t%s\t%s\t%d\t", _pfname[pf], bu?"BU":"TD",
_subnamel[jpegsub], qual);
for(i=0; i<h; i++) memcpy(&rgbbuf[pitch*i], &srcbuf[w*ps*i], w*ps);
if((hnd=tjInitCompress())==NULL)
_throwtj("executing tjInitCompress()");
if(tjCompress(hnd, rgbbuf, tilesizex, pitch, tilesizey, ps,
if(yuv==YUVENCODE)
{
if(tjEncodeYUV(hnd, rgbbuf, tilesizex, pitch, tilesizey, ps,
jpegbuf[0], jpegsub, flags)==-1)
_throwtj("executing tjEncodeYUV()");
comptilesize[0]=TJBUFSIZEYUV(tilesizex, tilesizey, jpegsub);
}
else if(tjCompress(hnd, rgbbuf, tilesizex, pitch, tilesizey, ps,
jpegbuf[0], &comptilesize[0], jpegsub, qual, flags)==-1)
_throwtj("executing tjCompress()");
ITER=0;
timer.start();
start=rrtime();
do
{
jpgbufsize=0; int tilen=0;
jpgbufsize=0; tilen=0;
for(i=0; i<h; i+=tilesizey)
{
for(j=0; j<w; j+=tilesizex)
{
int tempw=min(tilesizex, w-j), temph=min(tilesizey, h-i);
if(tjCompress(hnd, &rgbbuf[pitch*i+j*ps], tempw, pitch,
if(yuv==YUVENCODE)
{
if(tjEncodeYUV(hnd, &rgbbuf[pitch*i+j*ps], tempw, pitch,
temph, ps, jpegbuf[tilen], jpegsub, flags)==-1)
_throwtj("executing tjEncodeYUV()");
comptilesize[tilen]=TJBUFSIZEYUV(tempw, temph, jpegsub);
}
else if(tjCompress(hnd, &rgbbuf[pitch*i+j*ps], tempw, pitch,
temph, ps, jpegbuf[tilen], &comptilesize[tilen], jpegsub, qual,
flags)==-1)
_throwtj("executing tjCompress()");
@@ -147,17 +157,20 @@ void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu,
}
}
ITER++;
} while((elapsed=timer.elapsed())<5.);
} while((elapsed=rrtime()-start)<5.);
if(tjDestroy(hnd)==-1) _throwtj("executing tjDestroy()");
hnd=NULL;
if(quiet)
if(quiet==1)
{
if(tilesizex==w && tilesizey==h) printf("Full \t");
else printf("%-4d %-4d\t", tilesizex, tilesizey);
}
if(quiet)
{
printsigfig((double)(w*h)/1000000.*(double)ITER/elapsed, 4);
printf("\t");
printf("%c", quiet==2? '\n':'\t');
printsigfig((double)(w*h*ps)/(double)jpgbufsize, 4);
printf("\t");
printf("%c", quiet==2? '\n':'\t');
}
else
{
@@ -185,18 +198,25 @@ void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu,
fclose(outfile); outfile=NULL;
if(!quiet) printf("Reference image written to %s\n", tempstr);
}
if(yuv==YUVENCODE) goto bailout;
if(yuv==YUVENCODE)
{
if(quiet==1) printf("\n"); goto bailout;
}
// Decompression test
if(yuv==YUVDECODE) flags |= TJ_YUV;
memset(rgbbuf, 127, max(yuvsize, pitch*h)); // Grey image means decompressor did nothing
if((hnd=tjInitDecompress())==NULL)
_throwtj("executing tjInitDecompress()");
if(tjDecompress(hnd, jpegbuf[0], jpgbufsize, rgbbuf, tilesizex, pitch,
if(yuv==YUVDECODE)
{
if(tjDecompressToYUV(hnd, jpegbuf[0], jpgbufsize, rgbbuf, flags)==-1)
_throwtj("executing tjDecompressToYUV()");
}
else if(tjDecompress(hnd, jpegbuf[0], jpgbufsize, rgbbuf, tilesizex, pitch,
tilesizey, ps, flags)==-1)
_throwtj("executing tjDecompress()");
ITER=0;
timer.start();
start=rrtime();
do
{
int tilen=0;
@@ -205,14 +225,20 @@ void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu,
for(j=0; j<w; j+=tilesizex)
{
int tempw=min(tilesizex, w-j), temph=min(tilesizey, h-i);
if(tjDecompress(hnd, jpegbuf[tilen], comptilesize[tilen],
if(yuv==YUVDECODE)
{
if(tjDecompressToYUV(hnd, jpegbuf[tilen], comptilesize[tilen],
&rgbbuf[pitch*i+ps*j], flags)==-1)
_throwtj("executing tjDecompressToYUV()");
}
else if(tjDecompress(hnd, jpegbuf[tilen], comptilesize[tilen],
&rgbbuf[pitch*i+ps*j], tempw, pitch, temph, ps, flags)==-1)
_throwtj("executing tjDecompress()");
tilen++;
}
}
ITER++;
} while((elapsed=timer.elapsed())<5.);
} while((elapsed=rrtime()-start)<5.);
if(tjDestroy(hnd)==-1) _throwtj("executing tjDestroy()");
hnd=NULL;
if(quiet)
@@ -301,13 +327,13 @@ void dotest(unsigned char *srcbuf, int w, int h, BMPPIXELFORMAT pf, int bu,
}
void dodecomptest(char *filename, BMPPIXELFORMAT pf, int bu, int useppm,
void dodecomptest(char *filename, int pf, int bu, int useppm,
int quiet)
{
char tempstr[1024];
FILE *file=NULL; tjhandle hnd;
FILE *file=NULL; tjhandle hnd=NULL;
unsigned char *jpegbuf=NULL, *rgbbuf=NULL;
rrtimer timer; double elapsed;
double start, elapsed;
int w, h, ITER;
unsigned long jpgbufsize=0;
int flags=(forcemmx?TJ_FORCEMMX:0)|(forcesse?TJ_FORCESSE:0)
@@ -315,11 +341,10 @@ void dodecomptest(char *filename, BMPPIXELFORMAT pf, int bu, int useppm,
|(fastupsample?TJ_FASTUPSAMPLE:0);
int ps=_ps[pf], pitch, jpegsub=-1;
char *temp=NULL;
int hsf, vsf, pw, ph, cw, ch, ypitch, uvpitch, yuvsize;
int yuvsize, bufsize;
flags |= _flags[pf];
if(bu) flags |= TJ_BOTTOMUP;
if(yuv==YUVDECODE) flags |= TJ_YUV;
if((file=fopen(filename, "rb"))==NULL)
_throwunix("opening file");
@@ -340,15 +365,11 @@ void dodecomptest(char *filename, BMPPIXELFORMAT pf, int bu, int useppm,
if(tjDecompressHeader2(hnd, jpegbuf, jpgbufsize, &w, &h, &jpegsub)==-1)
_throwtj("executing tjDecompressHeader2()");
hsf=_hsf[jpegsub], vsf=_vsf[jpegsub];
pw=PAD(w, hsf), ph=PAD(h, vsf);
cw=pw/hsf, ch=ph/vsf;
ypitch=PAD(pw, 4), uvpitch=PAD(cw, 4);
yuvsize=ypitch*ph + (jpegsub==TJ_GRAYSCALE? 0:uvpitch*ch*2);
yuvsize=TJBUFSIZEYUV(w, h, jpegsub);
pitch=w*ps;
if(quiet)
if(quiet==1)
{
printf("All performance values in Mpixels/sec\n\n");
printf("Bitmap\tBitmap\tImage Size\tDecomp\n"),
@@ -356,31 +377,43 @@ void dodecomptest(char *filename, BMPPIXELFORMAT pf, int bu, int useppm,
printf("%s\t%s\t%-4d %-4d\t", _pfname[pf], bu?"BU":"TD", w, h);
}
if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h)))==NULL)
bufsize=(yuv==YUVDECODE? yuvsize:pitch*h);
if((rgbbuf=(unsigned char *)malloc(bufsize))==NULL)
_throwunix("allocating image buffer");
if(!quiet)
{
if(yuv==YUVDECODE)
printf("\n>>>>> JPEG --> YUV %s <<<<<\n", _subnamel[jpegsub]);
printf(">>>>> JPEG --> YUV %s <<<<<\n", _subnamel[jpegsub]);
else
printf("\n>>>>> JPEG --> %s (%s) <<<<<\n", _pfname[pf],
printf(">>>>> JPEG --> %s (%s) <<<<<\n", _pfname[pf],
bu?"Bottom-up":"Top-down");
printf("\nImage size: %d x %d\n", w, h);
}
memset(rgbbuf, 127, max(yuvsize, pitch*h)); // Grey image means decompressor did nothing
if(tjDecompress(hnd, jpegbuf, jpgbufsize, rgbbuf, w, pitch, h, ps, flags)==-1)
memset(rgbbuf, 127, bufsize); // Grey image means decompressor did nothing
if(yuv==YUVDECODE)
{
if(tjDecompressToYUV(hnd, jpegbuf, jpgbufsize, rgbbuf, flags)==-1)
_throwtj("executing tjDecompressToYUV()");
}
else if(tjDecompress(hnd, jpegbuf, jpgbufsize, rgbbuf, w, pitch, h, ps,
flags)==-1)
_throwtj("executing tjDecompress()");
ITER=0;
timer.start();
start=rrtime();
do
{
if(tjDecompress(hnd, jpegbuf, jpgbufsize, rgbbuf, w, pitch, h, ps, flags)
==-1)
if(yuv==YUVDECODE)
{
if(tjDecompressToYUV(hnd, jpegbuf, jpgbufsize, rgbbuf, flags)==-1)
_throwtj("executing tjDecompressToYUV()");
}
else if(tjDecompress(hnd, jpegbuf, jpgbufsize, rgbbuf, w, pitch, h, ps,
flags)==-1)
_throwtj("executing tjDecompress()");
ITER++;
} while((elapsed=timer.elapsed())<5.);
} while((elapsed=rrtime()-start)<5.);
if(tjDestroy(hnd)==-1) _throwtj("executing tjDestroy()");
hnd=NULL;
if(quiet)
@@ -427,8 +460,8 @@ void usage(char *progname)
printf(" Test performance of the codec when the image is encoded\n");
printf(" as separate tiles of varying sizes.\n\n");
printf(" [-forcemmx] [-forcesse] [-forcesse2] [-forcesse3]\n");
printf(" Force MMX, SSE, or SSE2 code paths in Intel codec\n\n");
printf(" [-rgb | -bgr | -rgba | -bgra | -abgr | -argb]\n");
printf(" Force MMX, SSE, SSE2, or SSE3 code paths in the underlying codec\n\n");
printf(" [-rgb | -bgr | -rgbx | -bgrx | -xbgr | -xrgb]\n");
printf(" Test the specified color conversion path in the codec (default: BGR)\n\n");
printf(" [-fastupsample]\n");
printf(" Use fast, inaccurate upsampling code to perform 4:2:2 and 4:2:0\n");
@@ -448,12 +481,10 @@ void usage(char *progname)
int main(int argc, char *argv[])
{
unsigned char *bmpbuf=NULL; int w, h, i, useppm=0;
int qual, dotile=0, quiet=0, hiqual=-1; char *temp;
BMPPIXELFORMAT pf=BMP_BGR;
int qual=-1, dotile=0, quiet=0, hiqual=-1; char *temp;
int pf=BMP_BGR;
int bu=0, minarg=2;
printf("\n");
if(argc<minarg) usage(argv[0]);
temp=strrchr(argv[1], '.');
@@ -463,18 +494,20 @@ int main(int argc, char *argv[])
if(!stricmp(temp, ".jpg") || !stricmp(temp, ".jpeg")) decomponly=1;
}
printf("\n");
if(argc>minarg)
{
for(i=minarg; i<argc; i++)
{
if(!stricmp(argv[i], "-yuvencode"))
{
printf("Testing YUV planar encoding\n");
printf("Testing YUV planar encoding\n\n");
yuv=YUVENCODE; hiqual=qual=100;
}
if(!stricmp(argv[i], "-yuvdecode"))
{
printf("Testing YUV planar decoding\n");
printf("Testing YUV planar decoding\n\n");
yuv=YUVDECODE;
}
}
@@ -502,37 +535,38 @@ int main(int argc, char *argv[])
if(!stricmp(argv[i], "-tile")) dotile=1;
if(!stricmp(argv[i], "-forcesse3"))
{
printf("Using SSE3 code\n");
printf("Using SSE3 code\n\n");
forcesse3=1;
}
if(!stricmp(argv[i], "-forcesse2"))
{
printf("Using SSE2 code\n");
printf("Using SSE2 code\n\n");
forcesse2=1;
}
if(!stricmp(argv[i], "-forcesse"))
{
printf("Using SSE code\n");
printf("Using SSE code\n\n");
forcesse=1;
}
if(!stricmp(argv[i], "-forcemmx"))
{
printf("Using MMX code\n");
printf("Using MMX code\n\n");
forcemmx=1;
}
if(!stricmp(argv[i], "-fastupsample"))
{
printf("Using fast upsampling code\n");
printf("Using fast upsampling code\n\n");
fastupsample=1;
}
if(!stricmp(argv[i], "-rgb")) pf=BMP_RGB;
if(!stricmp(argv[i], "-rgba")) pf=BMP_RGBA;
if(!stricmp(argv[i], "-rgbx")) pf=BMP_RGBX;
if(!stricmp(argv[i], "-bgr")) pf=BMP_BGR;
if(!stricmp(argv[i], "-bgra")) pf=BMP_BGRA;
if(!stricmp(argv[i], "-abgr")) pf=BMP_ABGR;
if(!stricmp(argv[i], "-argb")) pf=BMP_ARGB;
if(!stricmp(argv[i], "-bgrx")) pf=BMP_BGRX;
if(!stricmp(argv[i], "-xbgr")) pf=BMP_XBGR;
if(!stricmp(argv[i], "-xrgb")) pf=BMP_XRGB;
if(!stricmp(argv[i], "-bottomup")) bu=1;
if(!stricmp(argv[i], "-quiet")) quiet=1;
if(!stricmp(argv[i], "-qq")) quiet=2;
}
}
@@ -544,7 +578,7 @@ int main(int argc, char *argv[])
if(temp!=NULL) *temp='\0';
}
if(quiet && !decomponly)
if(quiet==1 && !decomponly)
{
printf("All performance values in Mpixels/sec\n\n");
printf("Bitmap\tBitmap\tJPEG\tJPEG\tTile Size\tCompr\tCompr\tDecomp\n");
@@ -554,19 +588,21 @@ int main(int argc, char *argv[])
if(decomponly)
{
dodecomptest(argv[1], pf, bu, 1, quiet);
printf("\n");
goto bailout;
}
for(i=hiqual; i>=qual; i--)
dotest(bmpbuf, w, h, pf, bu, TJ_GRAYSCALE, i, argv[1], dotile, useppm, quiet);
if(quiet) printf("\n");
printf("\n");
for(i=hiqual; i>=qual; i--)
dotest(bmpbuf, w, h, pf, bu, TJ_420, i, argv[1], dotile, useppm, quiet);
if(quiet) printf("\n");
printf("\n");
for(i=hiqual; i>=qual; i--)
dotest(bmpbuf, w, h, pf, bu, TJ_422, i, argv[1], dotile, useppm, quiet);
if(quiet) printf("\n");
printf("\n");
for(i=hiqual; i>=qual; i--)
dotest(bmpbuf, w, h, pf, bu, TJ_444, i, argv[1], dotile, useppm, quiet);
printf("\n");
bailout:
if(bmpbuf) free(bmpbuf);

View File

@@ -5,6 +5,7 @@
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
* For conditions of distribution and use, see copyright notice in jsimdext.inc
*
*/

View File

@@ -6,6 +6,7 @@
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
* For conditions of distribution and use, see copyright notice in jsimdext.inc
*
* This file contains stubs for when there is no SIMD support available.
*/

View File

@@ -5,6 +5,7 @@
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
* For conditions of distribution and use, see copyright notice in jsimdext.inc
*
*/

View File

@@ -77,8 +77,8 @@ jdiv_round_up (long a, long b)
}
GLOBAL(size_t)
jround_up (size_t a, size_t b)
GLOBAL(long)
jround_up (long a, long b)
/* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */
/* Assumes a >= 0, b > 0 */
{

View File

@@ -34,4 +34,4 @@
"Copyright (C) 2004 Landmark Graphics Corporation\n" \
"Copyright (C) 2005-2007 Sun Microsystems, Inc.\n" \
"Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \
"Copyright (C) 2009-2010 D. R. Commander"
"Copyright (C) 2009-2011 D. R. Commander"

14
rdbmp.c
View File

@@ -3,6 +3,7 @@
*
* Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2009-2010 by Guido Vollbeding.
* Modified 2011 by Siarhei Siamashka.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -220,10 +221,9 @@ preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
{
bmp_source_ptr source = (bmp_source_ptr) sinfo;
register FILE *infile = source->pub.input_file;
register int c;
register JSAMPROW out_ptr;
JSAMPARRAY image_ptr;
JDIMENSION row, col;
JDIMENSION row;
cd_progress_ptr progress = (cd_progress_ptr) cinfo->progress;
/* Read the data into a virtual array in input-file row order. */
@@ -237,11 +237,11 @@ preload_image (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
((j_common_ptr) cinfo, source->whole_image,
row, (JDIMENSION) 1, TRUE);
out_ptr = image_ptr[0];
for (col = source->row_width; col > 0; col--) {
/* inline copy of read_byte() for speed */
if ((c = getc(infile)) == EOF)
ERREXIT(cinfo, JERR_INPUT_EOF);
*out_ptr++ = (JSAMPLE) c;
if (fread(out_ptr, 1, source->row_width, infile) != source->row_width) {
if (feof(infile))
ERREXIT(cinfo, JERR_INPUT_EOF);
else
ERREXIT(cinfo, JERR_FILE_READ);
}
}
if (progress != NULL)

View File

@@ -5,8 +5,8 @@
<key>IFPkgDescriptionDescription</key>
<string>A SIMD-accelerated JPEG codec which provides both the libjpeg and TurboJPEG APIs</string>
<key>IFPkgDescriptionTitle</key>
<string>{__APPNAME}</string>
<string>@PACKAGE_NAME@</string>
<key>IFPkgDescriptionVersion</key>
<string>{__VERSION}</string>
<string>@VERSION@</string>
</dict>
</plist>

View File

@@ -3,15 +3,15 @@
<plist version="1.0">
<dict>
<key>CFBundleGetInfoString</key>
<string>{__VERSION}, The libjpeg-turbo Project</string>
<string>@VERSION@, The libjpeg-turbo Project</string>
<key>CFBundleIdentifier</key>
<string>com.libjpeg-turbo.libjpeg-turbo</string>
<key>CFBundleShortVersionString</key>
<string>{__VERSION}</string>
<string>@VERSION@</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>{__BUILD}</integer>
<integer>@BUILD@</integer>
<key>IFPkgFlagAllowBackRev</key>
<false/>
<key>IFPkgFlagAuthorizationAction</key>

View File

@@ -1,11 +1,13 @@
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww15200\viewh9600\viewkind0
\deftab720
\pard\pardeftab720\ql\qnatural
\f0\fs24 \cf0 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 as the unmodified version of libjpeg, all else being equal. libjpeg-turbo also includes a wrapper library for the TurboJPEG API used by VirtualGL and TurboVNC.\
\f0\fs24 \cf0 libjpeg-turbo is a derivative of libjpeg which 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. libjpeg-turbo also includes a wrapper library which implements the TurboJPEG API used by VirtualGL and TurboVNC.\
\
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but the TigerVNC and VirtualGL projects made numerous enhancements to the codec, including improved support for Mac OS X, 64-bit support, support for 32-bit and big endian pixel formats, accelerated Huffman encoding/decoding, and various bug fixes. The goal was to produce a fully open source codec that could replace the partially closed source TurboJPEG/IPP codec used by VirtualGL and TurboVNC. libjpeg-turbo generally performs in the range of 80-120% of TurboJPEG/IPP. It is faster in some areas but slower in others.\
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but the TigerVNC and VirtualGL projects made numerous enhancements to the codec in 2009, including improved support for Mac OS X, 64-bit support, support for 32-bit and big endian pixel formats (RGBX, XBGR, etc.), accelerated Huffman encoding/decoding, and various bug fixes. The goal was to produce a fully open source codec that could replace the partially closed source TurboJPEG/IPP codec used by VirtualGL and TurboVNC. libjpeg-turbo generally performs in the range of 80-120% of TurboJPEG/IPP. It is faster in some areas but slower in others.\
\
In early 2010, libjpeg-turbo spun off into its own independent project, with the goal of making high-speed JPEG compression/decompression technology available to a broader range of users and developers.\
}

28
release/deb-control.in Normal file
View File

@@ -0,0 +1,28 @@
Package: @PACKAGE_NAME@
Version: @VERSION@-@BUILD@
Section: misc
Priority: optional
Architecture: @DEBARCH@
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
libjpeg-turbo is a derivative of libjpeg which 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. libjpeg-turbo
also includes a wrapper library which implements the TurboJPEG API used by
VirtualGL and TurboVNC.
.
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but
the TigerVNC and VirtualGL projects made numerous enhancements to the codec
in 2009, including improved support for Mac OS X, 64-bit support, support
for 32-bit and big endian pixel formats (RGBX, XBGR, etc.), accelerated
Huffman encoding/decoding, and various bug fixes. The goal was to produce a
fully open source codec that could replace the partially closed source
TurboJPEG/IPP codec used by VirtualGL and TurboVNC. libjpeg-turbo generally
performs in the range of 80-120% of TurboJPEG/IPP. It is faster in some
areas but slower in others.
.
In early 2010, libjpeg-turbo spun off into its own independent project, with
the goal of making high-speed JPEG compression/decompression technology
available to a broader range of users and developers.

View File

@@ -1,23 +0,0 @@
Package: {__PKGNAME}
Version: {__VERSION}-{__BUILD}
Section: misc
Priority: optional
Architecture: {__ARCH}
Essential: no
Maintainer: The libjpeg-turbo Project [http://libjpeg-turbo.VirtualGL.org]
Description: A toolkit for displaying OpenGL applications to thin clients
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
as the unmodified version of libjpeg, all else being equal. libjpeg-turbo
also includes a wrapper library for the TurboJPEG API used by VirtualGL and
TurboVNC.
.
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but
the TigerVNC and VirtualGL projects made numerous enhancements to the codec,
including improved support for Mac OS X, 64-bit support, support for 32-bit
and big endian pixel formats, accelerated Huffman encoding/decoding, and
various bug fixes. The goal was to produce a fully open source codec that
could replace the partially closed source TurboJPEG/IPP codec used by
VirtualGL and TurboVNC. libjpeg-turbo generally performs in the range of
80-120% of TurboJPEG/IPP. It is faster in some areas but slower in others.

View File

@@ -1,7 +1,7 @@
!include x64.nsh
Name "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@"
OutFile "@CMAKE_BINARY_DIR@\${BUILDDIR}@INST_NAME@.exe"
InstallDir c:\@INST_NAME@
InstallDir c:\@INST_DIR@
SetCompressor bzip2
@@ -45,6 +45,12 @@ Section "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@ (required)"
!else
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpeg@DLL_VERSION@.dll"
!endif
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}cjpeg.exe"
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}djpeg.exe"
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpegtran.exe"
File "@CMAKE_BINARY_DIR@\${BUILDDIR}jpgtest.exe"
File "@CMAKE_BINARY_DIR@\${BUILDDIR}rdjpgcom.exe"
File "@CMAKE_BINARY_DIR@\${BUILDDIR}wrjpgcom.exe"
SetOutPath $INSTDIR\lib
!ifdef GCC
File "@CMAKE_BINARY_DIR@\libturbojpeg.dll.a"
@@ -63,19 +69,20 @@ Section "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@ (required)"
File "@CMAKE_SOURCE_DIR@\jmorecfg.h"
File "@CMAKE_SOURCE_DIR@\jpeglib.h"
File "@CMAKE_SOURCE_DIR@\turbojpeg.h"
SetOutPath $INSTDIR
SetOutPath $INSTDIR\doc
File "@CMAKE_SOURCE_DIR@\README"
File "@CMAKE_SOURCE_DIR@\README-turbo.txt"
File "@CMAKE_SOURCE_DIR@\libjpeg.txt"
File "@CMAKE_SOURCE_DIR@\LGPL.txt"
File "@CMAKE_SOURCE_DIR@\LICENSE.txt"
File "@CMAKE_SOURCE_DIR@\usage.txt"
WriteRegStr HKLM "SOFTWARE\@INST_NAME@ @VERSION@" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\@INST_DIR@ @VERSION@" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@" "DisplayName" "@CMAKE_PROJECT_NAME@ SDK v@VERSION@ for @INST_PLATFORM@"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@" "UninstallString" '"$INSTDIR\uninstall_@VERSION@.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@" "NoRepair" 1
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_DIR@ @VERSION@" "DisplayName" "@CMAKE_PROJECT_NAME@ SDK v@VERSION@ for @INST_PLATFORM@"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_DIR@ @VERSION@" "UninstallString" '"$INSTDIR\uninstall_@VERSION@.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_DIR@ @VERSION@" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_DIR@ @VERSION@" "NoRepair" 1
WriteUninstaller "uninstall_@VERSION@.exe"
SectionEnd
@@ -88,8 +95,8 @@ Section "Uninstall"
SetShellVarContext all
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_NAME@ @VERSION@"
DeleteRegKey HKLM "SOFTWARE\@INST_NAME@ @VERSION@"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@INST_DIR@ @VERSION@"
DeleteRegKey HKLM "SOFTWARE\@INST_DIR@ @VERSION@"
!ifdef GCC
Delete $INSTDIR\bin\libjpeg-@DLL_VERSION@.dll
@@ -106,20 +113,28 @@ Section "Uninstall"
Delete $INSTDIR\lib\turbojpeg.lib
Delete $INSTDIR\lib\turbojpeg-static.lib
!endif
Delete $INSTDIR\bin\cjpeg.exe
Delete $INSTDIR\bin\djpeg.exe
Delete $INSTDIR\bin\jpegtran.exe
Delete $INSTDIR\bin\jpgtest.exe
Delete $INSTDIR\bin\rdjpgcom.exe
Delete $INSTDIR\bin\wrjpgcom.exe
Delete $INSTDIR\include\jconfig.h"
Delete $INSTDIR\include\jerror.h"
Delete $INSTDIR\include\jmorecfg.h"
Delete $INSTDIR\include\jpeglib.h"
Delete $INSTDIR\include\turbojpeg.h"
Delete $INSTDIR\uninstall_@VERSION@.exe
Delete $INSTDIR\README
Delete $INSTDIR\README-turbo.txt
Delete $INSTDIR\libjpeg.txt
Delete $INSTDIR\LGPL.txt
Delete $INSTDIR\LICENSE.txt
Delete $INSTDIR\doc\README
Delete $INSTDIR\doc\README-turbo.txt
Delete $INSTDIR\doc\libjpeg.txt
Delete $INSTDIR\doc\LGPL.txt
Delete $INSTDIR\doc\LICENSE.txt
Delete $INSTDIR\doc\usage.txt
RMDir "$INSTDIR\include"
RMDir "$INSTDIR\lib"
RMDir "$INSTDIR\doc"
RMDir "$INSTDIR\bin"
RMDir "$INSTDIR"

View File

@@ -8,7 +8,7 @@ Summary: A SIMD-accelerated JPEG codec which provides both the libjpeg and Turbo
Name: @PACKAGE_NAME@
Version: @VERSION@
Vendor: The libjpeg-turbo Project
URL: http://libjpeg-turbo.virtualgl.org
URL: http://www.libjpeg-turbo.org
Group: System Environment/Libraries
#-->Source0: http://prdownloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-%{version}.tar.gz
Release: @BUILD@
@@ -19,27 +19,31 @@ Provides: %{name} = %{version}-%{release}, turbojpeg = 2.00
Obsoletes: turbojpeg
%description
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
libjpeg-turbo is a derivative of libjpeg which 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. libjpeg-turbo also
includes a wrapper library for the TurboJPEG API used by VirtualGL and
TurboVNC.
includes a wrapper library which implements the TurboJPEG API used by VirtualGL
and TurboVNC.
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but
the TigerVNC and VirtualGL projects made numerous enhancements to the codec,
including improved support for Mac OS X, 64-bit support, support for 32-bit
and big endian pixel formats, accelerated Huffman encoding/decoding, and
various bug fixes. The goal was to produce a fully open source codec that
could replace the partially closed source TurboJPEG/IPP codec used by VirtualGL
and TurboVNC. libjpeg-turbo generally performs in the range of 80-120% of
TurboJPEG/IPP. It is faster in some areas but slower in others.
the TigerVNC and VirtualGL projects made numerous enhancements to the codec in
2009, including improved support for Mac OS X, 64-bit support, support for
32-bit and big endian pixel formats (RGBX, XBGR, etc.), accelerated Huffman
encoding/decoding, and various bug fixes. The goal was to produce a fully open
source codec that could replace the partially closed source TurboJPEG/IPP codec
used by VirtualGL and TurboVNC. libjpeg-turbo generally performs in the range
of 80-120% of TurboJPEG/IPP. It is faster in some areas but slower in others.
In early 2010, libjpeg-turbo spun off into its own independent project, with
the goal of making high-speed JPEG compression/decompression technology
available to a broader range of users and developers.
#-->%prep
#-->%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
@@ -71,6 +75,7 @@ rm -rf $RPM_BUILD_ROOT
/opt/%{name}/bin/cjpeg
/opt/%{name}/bin/djpeg
/opt/%{name}/bin/jpegtran
/opt/%{name}/bin/jpgtest
/opt/%{name}/bin/rdjpgcom
/opt/%{name}/bin/wrjpgcom
%dir /opt/%{name}/%{__lib}

View File

@@ -15,16 +15,9 @@ onexit()
fi
}
usage()
{
echo "$0 <package name> <version> <source dir.>"
exit 1
}
if [ $# -lt 3 ]; then usage $0; fi
PACKAGE_NAME=$1
VERSION=$2
SRCDIR=$3
PACKAGE_NAME=@PACKAGE_NAME@
VERSION=@VERSION@
SRCDIR=@abs_top_srcdir@
umask 022
rm -f $PACKAGE_NAME-$VERSION-cygwin.tar.bz2

View File

@@ -15,12 +15,6 @@ onexit()
fi
}
usage()
{
echo "$0 <package name> <version> <build> <DEB architecture> <source dir.>"
exit 1
}
makedeb()
{
SUPPLEMENT=$1
@@ -35,12 +29,10 @@ makedeb()
fi
umask 022
rm -f $PACKAGE_NAME\_$DEBARCH.deb
rm -f $PACKAGE_NAME\_$VERSION\_$DEBARCH.deb
TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
mkdir $TMPDIR/DEBIAN
(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)
cp pkgscripts/deb-control $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
@@ -78,15 +70,14 @@ makedeb()
fi
sudo chown -Rh root:root $TMPDIR/*
dpkg -b $TMPDIR $PACKAGE_NAME\_$DEBARCH.deb
dpkg -b $TMPDIR $PACKAGE_NAME\_$VERSION\_$DEBARCH.deb
}
if [ $# -lt 5 ]; then usage $0; fi
PACKAGE_NAME=$1
VERSION=$2
BUILD=$3
DEBARCH=$4
SRCDIR=$5
PACKAGE_NAME=@PACKAGE_NAME@
VERSION=@VERSION@
BUILD=@BUILD@
DEBARCH=@DEBARCH@
SRCDIR=@abs_top_srcdir@
makedeb 0
if [ "$DEBARCH" = "i386" ]; then makedeb 1; fi

View File

@@ -26,8 +26,8 @@ UNIVERSAL=0
PACKAGE_NAME=@PACKAGE_NAME@
VERSION=@VERSION@
BUILD=@BUILD@
SRCDIR=@srcdir@
BUILDDIR32=@srcdir@/osxx86
SRCDIR=@abs_top_srcdir@
BUILDDIR32=@abs_top_srcdir@/osxx86
if [ $# -gt 0 ]; then
if [ "$1" = "universal" ]; then
UNIVERSAL=1
@@ -36,8 +36,8 @@ if [ $# -gt 0 ]; then
fi
PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
if [ -f $PACKAGE_NAME.dmg ]; then
rm -f $PACKAGE_NAME.dmg
if [ -f $PACKAGE_NAME-$VERSION.dmg ]; then
rm -f $PACKAGE_NAME-$VERSION.dmg
fi
umask 022
@@ -102,6 +102,10 @@ if [ $UNIVERSAL = 1 ]; then
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/bin/jpegtran \
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/jpegtran \
-output $PKGROOT/opt/$PACKAGE_NAME/bin/jpegtran
lipo -create \
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/bin/jpgtest \
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/jpgtest \
-output $PKGROOT/opt/$PACKAGE_NAME/bin/jpgtest
lipo -create \
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/bin/rdjpgcom \
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/rdjpgcom \
@@ -130,15 +134,9 @@ chmod 1775 $PKGROOT/Library
chmod 775 $PKGROOT/Library/Documentation
mkdir -p $TMPDIR/pkg/Resources
(cat $SRCDIR/release/Description.plist.tmpl | sed s/{__VERSION}/$VERSION/g \
| sed s/{__APPNAME}/$PACKAGE_NAME/g \
> $TMPDIR/pkg/Description.plist)
(cat $SRCDIR/release/Info.plist.tmpl | sed s/{__VERSION}/$VERSION/g \
| sed s/{__BUILD}/$BUILD/g > $TMPDIR/pkg/Info.plist)
(cat $SRCDIR/release/uninstall.sh.tmpl \
| sed s/{__APPNAME}/$PACKAGE_NAME/g \
> $PKGROOT/opt/$PACKAGE_NAME/bin/uninstall)
chmod 755 $PKGROOT/opt/$PACKAGE_NAME/bin/uninstall
cp pkgscripts/Description.plist $TMPDIR/pkg/
cp pkgscripts/Info.plist $TMPDIR/pkg/
install -m 755 pkgscripts/uninstall $PKGROOT/opt/$PACKAGE_NAME/bin/
install -m 644 $SRCDIR/LICENSE.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/LICENSE.txt
install -m 644 $SRCDIR/LGPL.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/LGPL.txt
@@ -159,8 +157,7 @@ install -m 644 $SRCDIR/release/uninstall.applescript $TMPDIR
sudo osacompile -t APPL -o "$TMPDIR/dmg/Uninstall $PACKAGE_NAME.app" $TMPDIR/uninstall.applescript
sudo chown -R $USER "$TMPDIR/dmg/Uninstall $PACKAGE_NAME.app"
hdiutil create -fs HFS+ -volname $PACKAGE_NAME-$VERSION \
-srcfolder "$TMPDIR/dmg" \
$TMPDIR/$PACKAGE_NAME.dmg
cp $TMPDIR/$PACKAGE_NAME.dmg .
-srcfolder "$TMPDIR/dmg" $TMPDIR/$PACKAGE_NAME-$VERSION.dmg
cp $TMPDIR/$PACKAGE_NAME-$VERSION.dmg .
exit

View File

@@ -27,8 +27,8 @@ PACKAGE_NAME=@PACKAGE_NAME@
VERSION=@VERSION@
BUILD=@BUILD@
PKGARCH=@DEBARCH@
SRCDIR=@srcdir@
BUILDDIR32=@srcdir@/solx86
SRCDIR=@abs_top_srcdir@
BUILDDIR32=@abs_top_srcdir@/solx86
if [ $# -gt 0 ]; then
if [ "$1" = "combined" ]; then
COMBINED=1
@@ -41,9 +41,7 @@ TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
rm -f $PACKAGE_NAME.pkg.bz2
cp $SRCDIR/release/copyright $TMPDIR
touch $TMPDIR/depend
cat $SRCDIR/release/pkginfo.tmpl | sed s/{__VERSION}/$VERSION/g \
| sed s/{__BUILD}/$BUILD/g | sed s/{__APPNAME}/$PACKAGE_NAME/g \
| sed s/{__PKGNAME}/$PACKAGE_NAME/g > $TMPDIR/pkginfo
cp pkgscripts/pkginfo $TMPDIR/pkginfo
if [ "$PKGARCH" = "i386" ]; then
__LIB=lib
@@ -81,6 +79,7 @@ d none $PACKAGE_NAME/bin 0755 root bin
f none $PACKAGE_NAME/bin/cjpeg 0755 root bin
f none $PACKAGE_NAME/bin/djpeg 0755 root bin
f none $PACKAGE_NAME/bin/jpegtran 0755 root bin
f none $PACKAGE_NAME/bin/jpgtest 0755 root bin
f none $PACKAGE_NAME/bin/rdjpgcom 0755 root bin
f none $PACKAGE_NAME/bin/wrjpgcom 0755 root bin
d none $PACKAGE_NAME/lib 0755 root bin
@@ -131,8 +130,8 @@ f none $PACKAGE_NAME/doc/usage.txt 0644 root bin
EOF
pkgmk -o -r $TMPDIR/opt -d $TMPDIR -a i386 -f $TMPDIR/proto
pkgtrans -s $TMPDIR $TMPDIR/$PACKAGE_NAME.pkg $PACKAGE_NAME
bzip2 $TMPDIR/$PACKAGE_NAME.pkg
cp $TMPDIR/$PACKAGE_NAME.pkg.bz2 .
pkgtrans -s $TMPDIR $TMPDIR/$PACKAGE_NAME-$VERSION.pkg $PACKAGE_NAME
bzip2 $TMPDIR/$PACKAGE_NAME-$VERSION.pkg
cp $TMPDIR/$PACKAGE_NAME-$VERSION.pkg.bz2 .
exit

View File

@@ -1,12 +1,12 @@
ARCH=i386
PKG={__PKGNAME}
NAME={__APPNAME} SDK and run time libraries
VERSION={__VERSION},REV={__BUILD}
PKG=@PACKAGE_NAME@
NAME=@PACKAGE_NAME@ SDK and run time libraries
VERSION=@VERSION@,REV=@BUILD@
SUNW_PKGVERS=1.0
DESC=A SIMD-accelerated JPEG codec which provides both the libjpeg and TurboJPEG APIs
VENDOR=The libjpeg-turbo Project
HOTLINE=http://libjpeg-turbo.VirtualGL.org
EMAIL=information@virtualgl.org
HOTLINE=http://www.libjpeg-turbo.org
EMAIL=information@libjpeg-turbo.org
MAXINST=1
CATEGORY=application
BASEDIR=/opt

View File

@@ -1,4 +1,4 @@
# Copyright (C)2009-2010 D. R. Commander
# Copyright (C)2009-2011 D. R. Commander
# Copyright (C)2009 Sun Microsystems, Inc.
#
# This library is free software and may be redistributed and/or modified under
@@ -23,7 +23,7 @@ if [ ! "`id -u`" = "0" ]; then
error "This command must be run as root"
fi
PKGNAME={__APPNAME}
PKGNAME=@PACKAGE_NAME@
MACPKGNAME=com.$PKGNAME.$PKGNAME
RCPT=/Library/Receipts/$PKGNAME.pkg

View File

@@ -15,69 +15,6 @@
#ifndef __RRTIMER_H__
#define __RRTIMER_H__
#ifdef __cplusplus
#ifdef _WIN32
#include <windows.h>
#else
#include <sys/time.h>
#endif
class rrtimer
{
public:
rrtimer(void) : t1(0.0)
{
#ifdef _WIN32
highres=false; tick=0.001;
LARGE_INTEGER Frequency;
if(QueryPerformanceFrequency(&Frequency)!=0)
{
tick=(double)1.0/(double)(Frequency.QuadPart);
highres=true;
}
#endif
}
void start(void)
{
t1=time();
}
double time(void)
{
#ifdef _WIN32
if(highres)
{
LARGE_INTEGER Time;
QueryPerformanceCounter(&Time);
return((double)(Time.QuadPart)*tick);
}
else
return((double)GetTickCount()*tick);
#else
struct timeval __tv;
gettimeofday(&__tv, (struct timezone *)NULL);
return((double)(__tv.tv_sec)+(double)(__tv.tv_usec)*0.000001);
#endif
}
double elapsed(void)
{
return time()-t1;
}
private:
#ifdef _WIN32
bool highres; double tick;
#endif
double t1;
};
#endif // __cplusplus
#ifdef _WIN32
#include <windows.h>
@@ -111,4 +48,3 @@ static __inline double rrtime(void)
#endif
#endif

View File

@@ -8,9 +8,7 @@
if(MSVC)
# Build all configurations against shared C library
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
if(${var} MATCHES "/MT")
string(REGEX REPLACE "/MT" "/MD" ${var} "${${var}}")
endif()
@@ -42,13 +40,13 @@ endif()
add_executable(cjpeg ../cjpeg.c ../cdjpeg.c ../rdbmp.c ../rdgif.c ../rdppm.c
../rdswitch.c ../rdtarga.c)
set_property(TARGET cjpeg PROPERTY COMPILE_FLAGS
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED")
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
target_link_libraries(cjpeg jpeg)
add_executable(djpeg ../djpeg.c ../cdjpeg.c ../rdcolmap.c ../rdswitch.c
../wrbmp.c ../wrgif.c ../wrppm.c ../wrtarga.c)
set_property(TARGET djpeg PROPERTY COMPILE_FLAGS
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED")
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
target_link_libraries(djpeg jpeg)
add_executable(jpegtran ../jpegtran.c ../cdjpeg.c ../rdswitch.c ../transupp.c)

View File

@@ -10,10 +10,6 @@ else()
-I${CMAKE_CURRENT_SOURCE_DIR}/)
endif()
if(MSVC)
set(NAFLAGS ${NAFLAGS} -DMSVC)
endif()
# This only works if building from the command line. There is currently no way
# to set a variable's value based on the build type when using the MSVC IDE.
if(CMAKE_BUILD_TYPE STREQUAL "Debug"
@@ -36,7 +32,7 @@ else()
endif()
if(MSVC_IDE)
set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/$(OutDir)")
set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
else()
set(OBJDIR ${CMAKE_CURRENT_BINARY_DIR})
endif()

View File

@@ -5,6 +5,7 @@
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
* For conditions of distribution and use, see copyright notice in jsimdext.inc
*
*/

View File

@@ -6,6 +6,7 @@
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
* For conditions of distribution and use, see copyright notice in jsimdext.inc
*
* This file contains the interface between the "normal" portions
* of the library and the SIMD implementations when running on a

View File

@@ -6,6 +6,7 @@
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
* For conditions of distribution and use, see copyright notice in jsimdext.inc
*
* This file contains the interface between the "normal" portions
* of the library and the SIMD implementations when running on a

View File

@@ -48,9 +48,7 @@
;
%define SEG_TEXT .text align=16 public use64 class=CODE
%define SEG_CONST .rdata align=16 public use64 class=CONST
%ifdef MSVC
%define EXTN(name) name ; foo() -> foo
%endif
%elifdef OBJ32 ; ----(nasm -fobj -DOBJ32 ...)----------
; * Borland C++ (Win32)

BIN
testimgfst100.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -1,3 +1,4 @@
TURBOJPEG_1.0
{
global:
tjInitCompress;
@@ -5,10 +6,18 @@
TJBUFSIZE;
tjInitDecompress;
tjDecompressHeader;
tjDecompressHeader2;
tjDecompress;
tjDestroy;
tjGetErrorStr;
local:
*;
};
TURBOJPEG_1.1
{
global:
TJBUFSIZEYUV;
tjDecompressHeader2;
tjDecompressToYUV;
tjEncodeYUV;
} TURBOJPEG_1.0;

View File

@@ -1,6 +1,6 @@
/* Copyright (C)2004 Landmark Graphics Corporation
* Copyright (C)2005, 2006 Sun Microsystems, Inc.
* Copyright (C)2009 D. R. Commander
* Copyright (C)2009-2011 D. R. Commander
*
* This library is free software and may be redistributed and/or modified under
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -52,28 +52,9 @@ enum {TJ_444=0, TJ_422, TJ_420, TJ_GRAYSCALE};
(64-bit IPP version only) */
#define TJ_FASTUPSAMPLE 256
/* Use fast, inaccurate 4:2:2 and 4:2:0 YUV upsampling routines
(libjpeg version only) */
(libjpeg and libjpeg-turbo versions only) */
#define TJ_YUV 512
/* If passed to tjCompress(), this causes TurboJPEG/OSS to use the
accelerated color conversion routines in libjpeg-turbo to produce a planar
YUV image that is suitable for X Video. Specifically, if the chrominance
components are subsampled along the horizontal dimension, then the width
of the luminance plane is padded to 2 in the output image (same goes for
the height of the luminance plane, if the chrominance components are
subsampled along the vertical dimension.) Also, each line of each plane
in the output image is padded to 4 bytes. Although this will work with
any subsampling option, it is really only useful in combination with
TJ_420, which produces an image compatible with the I420 (AKA "YUV420P")
format.
If passed to tjDecompress(), this tells TurboJPEG/OSS to perform JPEG
decompression but to leave out the color conversion step, so a planar YUV
image is generated instead of an RGB image. The padding of the planes in
this image is the same as in the above case. Note that, if the width or
height of the output image is not a multiple of 8 (or a multiple of 16
along any dimension in which chrominance subsampling is used), then an
intermediate buffer copy will be performed within TurboJPEG/OSS.
*/
/* Nothing to see here. Pay no attention to the man behind the curtain. */
typedef void* tjhandle;
@@ -96,7 +77,8 @@ extern "C" {
and returns a handle to the instance. Most applications will only
need to call this once at the beginning of the program or once for each
concurrent thread. Don't try to create a new instance every time you
compress an image, because this will cause performance to suffer.
compress an image, because this may cause performance to suffer in some
TurboJPEG implementations.
RETURNS: NULL on error
*/
@@ -111,39 +93,40 @@ DLLEXPORT tjhandle DLLCALL tjInitCompress(void);
[INPUT] j = instance handle previously returned from a call to
tjInitCompress()
[INPUT] srcbuf = pointer to user-allocated image buffer containing pixels in
RGB(A) or BGR(A) form
[INPUT] width = width (in pixels) of the source image
[INPUT] srcbuf = pointer to user-allocated image buffer containing RGB or
grayscale pixels to be compressed
[INPUT] width = width (in pixels) of the source image
[INPUT] pitch = bytes per line of the source image (width*pixelsize if the
bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the bitmap
is padded to the nearest 32-bit boundary, such as is the case for Windows
bitmaps. You can also be clever and use this parameter to skip lines, etc.,
as long as the pitch is greater than 0.)
bitmaps. You can also be clever and use this parameter to skip lines,
etc. Setting this parameter to 0 is the equivalent of setting it to
width*pixelsize.
[INPUT] height = height (in pixels) of the source image
[INPUT] pixelsize = size (in bytes) of each pixel in the source image
RGBA and BGRA: 4, RGB and BGR: 3, Grayscale: 1
RGBX/BGRX/XRGB/XBGR: 4, RGB/BGR: 3, Grayscale: 1
[INPUT] dstbuf = pointer to user-allocated image buffer which will receive
the JPEG image. Use the macro TJBUFSIZE(width, height) to determine
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)
of the compressed image
[INPUT] jpegsubsamp = Specifies either 4:2:0, 4:2:2, or 4:4:4 subsampling.
When the image is converted from the RGB to YCbCr colorspace as part of the
JPEG compression process, every other Cb and Cr (chrominance) pixel can be
discarded to produce a smaller image with little perceptible loss of
image clarity (the human eye is more sensitive to small changes in
brightness than small changes in color.)
[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
as part of the JPEG compression process, every other Cb and Cr
(chrominance) pixel can be discarded to produce a smaller image with
little perceptible loss of image clarity (the human eye is more sensitive
to small changes in brightness than small changes in color.)
TJ_420: 4:2:0 subsampling. Discards every other Cb, Cr pixel in both
horizontal and vertical directions.
horizontal and vertical directions
TJ_422: 4:2:2 subsampling. Discards every other Cb, Cr pixel only in
the horizontal direction.
TJ_444: no subsampling.
the horizontal direction
TJ_444: no subsampling
TJ_GRAYSCALE: Generate grayscale JPEG image
[INPUT] jpegqual = JPEG quality (an integer between 0 and 100 inclusive.)
[INPUT] jpegqual = JPEG quality (an integer between 0 and 100 inclusive)
[INPUT] flags = the bitwise OR of one or more of the flags described in the
"Flags" section above.
"Flags" section above
RETURNS: 0 on success, -1 on error
*/
@@ -152,8 +135,77 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle j,
unsigned char *dstbuf, unsigned long *size,
int jpegsubsamp, int jpegqual, int flags);
/*
unsigned long TJBUFSIZE(int width, int height)
Convenience function which 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
*/
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
hold a YUV planar image with the given width, height, and level of
chrominance subsampling
RETURNS: -1 if arguments are out of bounds
*/
DLLEXPORT unsigned long DLLCALL TJBUFSIZEYUV(int width, int height,
int subsamp);
/*
int tjEncodeYUV(tjhandle j,
unsigned char *srcbuf, int width, int pitch, int height, int pixelsize,
unsigned char *dstbuf, int subsamp, int flags)
This function uses the accelerated color conversion routines in TurboJPEG's
underlying codec to produce a planar YUV image that is suitable for X Video.
Specifically, if the chrominance components are subsampled along the
horizontal dimension, then the width of the luminance plane is padded to 2 in
the output image (same goes for the height of the luminance plane, if the
chrominance components are subsampled along the vertical dimension.) Also,
each line of each plane in the output image is padded to 4 bytes. Although
this will work with any subsampling option, it is really only useful in
combination with TJ_420, which produces an image compatible with the I420
(AKA "YUV420P") format.
[INPUT] j = instance handle previously returned from a call to
tjInitCompress()
[INPUT] srcbuf = pointer to user-allocated image buffer containing RGB or
grayscale pixels to be encoded
[INPUT] width = width (in pixels) of the source image
[INPUT] pitch = bytes per line of the source image (width*pixelsize if the
bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the bitmap
is padded to the nearest 32-bit boundary, such as is the case for Windows
bitmaps. You can also be clever and use this parameter to skip lines,
etc. Setting this parameter to 0 is the equivalent of setting it to
width*pixelsize.
[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
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.
[INPUT] subsamp = Specifies either 4:2:0, 4:2:2, 4:4:4, or grayscale
subsampling (see description under tjCompress())
[INPUT] flags = the bitwise OR of one or more of the flags described in the
"Flags" section above
RETURNS: 0 on success, -1 on error
*/
DLLEXPORT int DLLCALL tjEncodeYUV(tjhandle j,
unsigned char *srcbuf, int width, int pitch, int height, int pixelsize,
unsigned char *dstbuf, int subsamp, int flags);
/*
tjhandle tjInitDecompress(void)
@@ -161,7 +213,8 @@ DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height);
structures, and returns a handle to the instance. Most applications will
only need to call this once at the beginning of the program or once for each
concurrent thread. Don't try to create a new instance every time you
decompress an image, because this will cause performance to suffer.
decompress an image, because this may cause performance to suffer in some
TurboJPEG implementations.
RETURNS: NULL on error
*/
@@ -171,26 +224,25 @@ DLLEXPORT tjhandle DLLCALL tjInitDecompress(void);
/*
int tjDecompressHeader2(tjhandle j,
unsigned char *srcbuf, unsigned long size,
int *width, int *height, int *jpegsub)
int *width, int *height, int *jpegsubsamp)
[INPUT] j = instance handle previously returned from a call to
tjInitDecompress()
[INPUT] srcbuf = pointer to a user-allocated buffer containing the JPEG image
to decompress
[INPUT] srcbuf = pointer to a user-allocated buffer containing a JPEG image
[INPUT] size = size of the JPEG image buffer (in bytes)
[OUTPUT] width = width (in pixels) of the JPEG image
[OUTPUT] height = height (in pixels) of the JPEG image
[OUTPUT] jpegsub = type of chrominance subsampling used when compressing the
JPEG image
[OUTPUT] jpegsubsamp = type of chrominance subsampling used when compressing
the JPEG image
RETURNS: 0 on success, -1 on error
*/
DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle j,
unsigned char *srcbuf, unsigned long size,
int *width, int *height, int *jpegsub);
int *width, int *height, int *jpegsubsamp);
/*
Deprecated version of the above function
Legacy version of the above function
*/
DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle j,
unsigned char *srcbuf, unsigned long size,
@@ -212,15 +264,16 @@ DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle j,
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.
[INPUT] width = width (in pixels) of the destination image
[INPUT] pitch = bytes per line of the destination image (width*pixelsize if the
bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the bitmap
is padded to the nearest 32-bit boundary, such as is the case for Windows
bitmaps. You can also be clever and use this parameter to skip lines, etc.,
as long as the pitch is greater than 0.)
[INPUT] width = width (in pixels) of the destination image
[INPUT] pitch = bytes per line of the destination image (width*pixelsize if
the bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the
bitmap is padded to the nearest 32-bit boundary, such as is the case for
Windows bitmaps. You can also be clever and use this parameter to skip
lines, etc. Setting this parameter to 0 is the equivalent of setting it
to width*pixelsize.
[INPUT] height = height (in pixels) of the destination image
[INPUT] pixelsize = size (in bytes) of each pixel in the destination image
RGBA/RGBx and BGRA/BGRx: 4, RGB and BGR: 3, Grayscale: 1
RGBX/BGRX/XRGB/XBGR: 4, RGB/BGR: 3, Grayscale: 1
[INPUT] flags = the bitwise OR of one or more of the flags described in the
"Flags" section above.
@@ -232,6 +285,37 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle j,
int flags);
/*
int tjDecompressToYUV(tjhandle j,
unsigned char *srcbuf, unsigned long size,
unsigned char *dstbuf, int flags)
This function performs JPEG decompression but leaves out the color conversion
step, so a planar YUV image is generated instead of an RGB image. The
padding of the planes in this image is the same as in tjEncodeYUV().
Note that, if the width or height of the output image is not a multiple of 8
(or a multiple of 16 along any dimension in which chrominance subsampling is
used), then an intermediate buffer copy will be performed within TurboJPEG.
[INPUT] j = instance handle previously returned from a call to
tjInitDecompress()
[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
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.
[INPUT] flags = the bitwise OR of one or more of the flags described in the
"Flags" section above.
RETURNS: 0 on success, -1 on error
*/
DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle j,
unsigned char *srcbuf, unsigned long size,
unsigned char *dstbuf, int flags);
/*
int tjDestroy(tjhandle h)

View File

@@ -1,6 +1,6 @@
/* Copyright (C)2004 Landmark Graphics Corporation
* Copyright (C)2005 Sun Microsystems, Inc.
* Copyright (C)2009-2010 D. R. Commander
* Copyright (C)2009-2011 D. R. Commander
*
* This library is free software and may be redistributed and/or modified under
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -70,10 +70,9 @@ static const int hsampfactor[NUMSUBOPT]={1, 2, 2, 1};
static const int vsampfactor[NUMSUBOPT]={1, 1, 2, 1};
static const int pixelsize[NUMSUBOPT]={3, 3, 3, 1};
#define _throw(c) {sprintf(lasterror, "%s", c); return -1;}
#define _catch(f) {if((f)==-1) return -1;}
#define _throw(c) {sprintf(lasterror, "%s", c); retval=-1; goto bailout;}
#define checkhandle(h) jpgstruct *j=(jpgstruct *)h; \
if(!j) _throw("Invalid handle");
if(!j) {sprintf(lasterror, "Invalid handle"); return -1;}
// CO
@@ -113,18 +112,46 @@ DLLEXPORT tjhandle DLLCALL tjInitCompress(void)
return (tjhandle)j;
}
DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height)
{
// This allows enough room in case the image doesn't compress
return ((width+15)&(~15)) * ((height+15)&(~15)) * 6 + 2048;
unsigned long retval=0;
if(width<1 || height<1)
_throw("Invalid argument in TJBUFSIZE()");
// This allows for rare corner cases in which a JPEG image can actually be
// larger than the uncompressed input (we wouldn't mention it if it hadn't
// happened before.)
retval=((width+15)&(~15)) * ((height+15)&(~15)) * 6 + 2048;
bailout:
return retval;
}
DLLEXPORT unsigned long DLLCALL TJBUFSIZEYUV(int width, int height,
int subsamp)
{
unsigned long retval=0;
int pw, ph, cw, ch;
if(width<1 || height<1 || subsamp<0 || subsamp>=NUMSUBOPT)
_throw("Invalid argument in TJBUFSIZEYUV()");
pw=PAD(width, hsampfactor[subsamp]);
ph=PAD(height, vsampfactor[subsamp]);
cw=pw/hsampfactor[subsamp]; ch=ph/vsampfactor[subsamp];
retval=PAD(pw, 4)*ph + (subsamp==TJ_GRAYSCALE? 0:PAD(cw, 4)*ch*2);
bailout:
return retval;
}
DLLEXPORT int DLLCALL tjCompress(tjhandle h,
unsigned char *srcbuf, int width, int pitch, int height, int ps,
unsigned char *dstbuf, unsigned long *size,
int jpegsub, int qual, int flags)
{
int i; JSAMPROW *row_pointer=NULL;
int i, retval=0; JSAMPROW *row_pointer=NULL;
JSAMPLE *_tmpbuf[MAX_COMPONENTS], *_tmpbuf2[MAX_COMPONENTS];
JSAMPROW *tmpbuf[MAX_COMPONENTS], *tmpbuf2[MAX_COMPONENTS];
JSAMPROW *outbuf[MAX_COMPONENTS];
@@ -174,16 +201,8 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
if(setjmp(j->jerr.jb))
{ // this will execute if LIBJPEG has an error
if(row_pointer) free(row_pointer);
for(i=0; i<MAX_COMPONENTS; i++)
{
if(tmpbuf[i]!=NULL) free(tmpbuf[i]);
if(_tmpbuf[i]!=NULL) free(_tmpbuf[i]);
if(tmpbuf2[i]!=NULL) free(tmpbuf2[i]);
if(_tmpbuf2[i]!=NULL) free(_tmpbuf2[i]);
if(outbuf[i]!=NULL) free(outbuf[i]);
}
return -1;
retval=-1;
goto bailout;
}
jpeg_set_defaults(&j->cinfo);
@@ -193,7 +212,8 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
jpeg_set_colorspace(&j->cinfo, JCS_GRAYSCALE);
else
jpeg_set_colorspace(&j->cinfo, JCS_YCbCr);
j->cinfo.dct_method = JDCT_FASTEST;
if(qual>=96) j->cinfo.dct_method=JDCT_ISLOW;
else j->cinfo.dct_method=JDCT_FASTEST;
j->cinfo.comp_info[0].h_samp_factor=hsampfactor[jpegsub];
j->cinfo.comp_info[1].h_samp_factor=1;
@@ -280,6 +300,7 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
}
*size=yuvsize;
cinfo->next_scanline+=height;
jpeg_abort_compress(&j->cinfo);
}
else
{
@@ -295,12 +316,13 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
jpeg_write_scanlines(&j->cinfo, &row_pointer[j->cinfo.next_scanline],
j->cinfo.image_height-j->cinfo.next_scanline);
}
}
jpeg_finish_compress(&j->cinfo);
if(!(flags&TJ_YUV))
jpeg_finish_compress(&j->cinfo);
*size=TJBUFSIZE(j->cinfo.image_width, j->cinfo.image_height)
-(unsigned long)(j->jdms.free_in_buffer);
}
bailout:
if(j->cinfo.global_state>CSTATE_START) jpeg_abort_compress(&j->cinfo);
if(row_pointer) free(row_pointer);
for(i=0; i<MAX_COMPONENTS; i++)
{
@@ -310,7 +332,17 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
if(_tmpbuf2[i]!=NULL) free(_tmpbuf2[i]);
if(outbuf[i]!=NULL) free(outbuf[i]);
}
return 0;
return retval;
}
DLLEXPORT int DLLCALL tjEncodeYUV(tjhandle h,
unsigned char *srcbuf, int width, int pitch, int height, int ps,
unsigned char *dstbuf, int subsamp, int flags)
{
unsigned long size;
return tjCompress(h, srcbuf, width, pitch, height, ps, dstbuf, &size,
subsamp, 0, flags|TJ_YUV);
}
@@ -360,45 +392,16 @@ DLLEXPORT tjhandle DLLCALL tjInitDecompress(void)
}
DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle h,
unsigned char *srcbuf, unsigned long size,
int *width, int *height)
{
checkhandle(h);
if(srcbuf==NULL || size<=0 || width==NULL || height==NULL)
_throw("Invalid argument in tjDecompressHeader()");
if(!j->initd) _throw("Instance has not been initialized for decompression");
if(setjmp(j->jerr.jb))
{ // this will execute if LIBJPEG has an error
return -1;
}
j->jsms.bytes_in_buffer = size;
j->jsms.next_input_byte = srcbuf;
jpeg_read_header(&j->dinfo, TRUE);
*width=j->dinfo.image_width; *height=j->dinfo.image_height;
jpeg_abort_decompress(&j->dinfo);
if(*width<1 || *height<1) _throw("Invalid data returned in header");
return 0;
}
DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle h,
unsigned char *srcbuf, unsigned long size,
int *width, int *height, int *jpegsub)
{
int i, k;
int i, k, retval=0;
checkhandle(h);
if(srcbuf==NULL || size<=0 || width==NULL || height==NULL || jpegsub==NULL)
_throw("Invalid argument in tjDecompressHeader()");
_throw("Invalid argument in tjDecompressHeader2()");
if(!j->initd) _throw("Instance has not been initialized for decompression");
if(setjmp(j->jerr.jb))
@@ -439,7 +442,18 @@ DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle h,
if(*jpegsub<0) _throw("Could not determine subsampling type for JPEG image");
if(*width<1 || *height<1) _throw("Invalid data returned in header");
return 0;
bailout:
return retval;
}
DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle h,
unsigned char *srcbuf, unsigned long size,
int *width, int *height)
{
int jpegsub;
return tjDecompressHeader2(h, srcbuf, size, width, height, &jpegsub);
}
@@ -448,7 +462,7 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
unsigned char *dstbuf, int width, int pitch, int height, int ps,
int flags)
{
int i, row; JSAMPROW *row_pointer=NULL, *outbuf[MAX_COMPONENTS];
int i, row, retval=0; JSAMPROW *row_pointer=NULL, *outbuf[MAX_COMPONENTS];
int cw[MAX_COMPONENTS], ch[MAX_COMPONENTS], iw[MAX_COMPONENTS],
tmpbufsize=0, usetmpbuf=0, th[MAX_COMPONENTS];
JSAMPLE *_tmpbuf=NULL; JSAMPROW *tmpbuf[MAX_COMPONENTS];
@@ -475,14 +489,8 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
if(setjmp(j->jerr.jb))
{ // this will execute if LIBJPEG has an error
for(i=0; i<MAX_COMPONENTS; i++)
{
if(tmpbuf[i]!=NULL) free(tmpbuf[i]);
if(outbuf[i]!=NULL) free(outbuf[i]);
}
if(_tmpbuf) free(_tmpbuf);
if(row_pointer) free(row_pointer);
return -1;
retval=-1;
goto bailout;
}
j->jsms.bytes_in_buffer = size;
@@ -501,15 +509,15 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
int ih;
iw[i]=compptr->width_in_blocks*DCTSIZE;
ih=compptr->height_in_blocks*DCTSIZE;
cw[i]=PAD(width, dinfo->max_h_samp_factor)*compptr->h_samp_factor
/dinfo->max_h_samp_factor;
ch[i]=PAD(height, dinfo->max_v_samp_factor)*compptr->v_samp_factor
/dinfo->max_v_samp_factor;
cw[i]=PAD(dinfo->image_width, dinfo->max_h_samp_factor)
*compptr->h_samp_factor/dinfo->max_h_samp_factor;
ch[i]=PAD(dinfo->image_height, dinfo->max_v_samp_factor)
*compptr->v_samp_factor/dinfo->max_v_samp_factor;
if(iw[i]!=cw[i] || ih!=ch[i]) usetmpbuf=1;
th[i]=compptr->v_samp_factor*DCTSIZE;
tmpbufsize+=iw[i]*th[i];
if((outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]))==NULL)
_throw("Memory allocation failed in tjInitDecompress()");
_throw("Memory allocation failed in tjDecompress()");
for(row=0; row<ch[i]; row++)
{
outbuf[i][row]=ptr;
@@ -519,13 +527,12 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
if(usetmpbuf)
{
if((_tmpbuf=(JSAMPLE *)malloc(sizeof(JSAMPLE)*tmpbufsize))==NULL)
_throw("Memory allocation failed in tjInitDecompress()");
_throw("Memory allocation failed in tjDecompress()");
ptr=_tmpbuf;
for(i=0; i<dinfo->num_components; i++)
{
jpeg_component_info *compptr=&dinfo->comp_info[i];
if((tmpbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*th[i]))==NULL)
_throw("Memory allocation failed in tjInitDecompress()");
_throw("Memory allocation failed in tjDecompress()");
for(row=0; row<th[i]; row++)
{
tmpbuf[i][row]=ptr;
@@ -537,7 +544,7 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
else
{
if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*height))==NULL)
_throw("Memory allocation failed in tjInitDecompress()");
_throw("Memory allocation failed in tjDecompress()");
for(i=0; i<height; i++)
{
if(flags&TJ_BOTTOMUP) row_pointer[i]= &dstbuf[(height-i-1)*pitch];
@@ -587,7 +594,6 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
int j;
for(i=0; i<dinfo->num_components; i++)
{
jpeg_component_info *compptr=&dinfo->comp_info[i];
for(j=0; j<min(th[i], ch[i]-crow[i]); j++)
{
memcpy(outbuf[i][crow[i]+j], tmpbuf[i][j], cw[i]);
@@ -606,6 +612,8 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
}
jpeg_finish_decompress(&j->dinfo);
bailout:
if(j->dinfo.global_state>DSTATE_START) jpeg_abort_decompress(&j->dinfo);
for(i=0; i<MAX_COMPONENTS; i++)
{
if(tmpbuf[i]) free(tmpbuf[i]);
@@ -613,7 +621,15 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
}
if(_tmpbuf) free(_tmpbuf);
if(row_pointer) free(row_pointer);
return 0;
return retval;
}
DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle h,
unsigned char *srcbuf, unsigned long size,
unsigned char *dstbuf, int flags)
{
return tjDecompress(h, srcbuf, size, dstbuf, 1, 0, 1, 3, flags|TJ_YUV);
}