Commit Graph

50 Commits

Author SHA1 Message Date
DRC
ebc7c3a760 Reconcile indentation, whitespace, and other code formatting with libjpeg-turbo.
For whatever reason, some of these files didn't get fully merged from
libjpeg-turbo 1.4.  They still contained tab characters and other formatting
conventions from libjpeg-turbo 1.3.  This patch also fixes some obvious
indentation errors in the mozjpeg-specific code.  There is more formatting work
that needs to be done to the mozjpeg-specific code, to fix line overruns,
incorrect operator whitespace, and other issues that make it not consistent
with the libjpeg/libjpeg-turbo code.
2014-11-06 01:14:11 -06:00
DRC
db2986c96f Restore backward ABI compatibility with libjpeg/libjpeg-turbo by moving the mozjpeg-specific parameters into the opaque jpeg_comp_master struct and implementing generic accessor functions for getting/setting those parameters. These functions can be used upstream, if the need for them arises in libjpeg-turbo, and they can also be easily extended to cover future extensions to the decompressor. Note that, in order to use jpeg_comp_master as a repository for extension parameters, cinfo->master is now allocated within the body of jpeg_CreateCompress(). It is later re-allocated in jinit_c_master_control(), because that function (and others in jcmaster.c) use an extended form of jpeg_comp_master, but the existing extension parameters are copied into the new master instance. Similar modifications would need to be made to the decompressor to support the same type of extension framework. 2014-11-04 01:58:52 -06:00
Kornel Lesiński
662bf6ba7b Merge libjpeg-turbo r1390
* commit '73edb3d734a628fd88994bc974dc6737a58bd956': (45 commits)
  Rename the ARM64 assembly file to match the C file
  Fix several mathematical issues discovered in the ARM64 NEON code while running the extended regression tests introduced in r1267.  Specific comments can be found in the original patches: https://sourceforge.net/p/libjpeg-turbo/patches/64/
  Reformat code per Siarhei's original patch (to clearly indicate that the offset instructions are completely independent) and add Siarhei as an individual author (he no longer works for Nokia.)
  Clarify forward compatibility of iOS/ARM builds
  ARM64 NEON SIMD support for YCC-to-RGB565 conversion
  ARM NEON SIMD support for YCC-to-RGB565 conversion, and optimizations to the existing YCC-to-RGB conversion code:
  Ensure that tjFree() is used for any JPEG buffers that might have been dynamically allocated by the compress/transform functions.  To keep things simple, we use tjAlloc() for the statically-allocated buffer as well, so that tjFree() can always be used to free the buffer, regardless of whether it was allocated by tjbench or by the TurboJPEG library.  This fixes crashes that occurred on Windows when running tjunittest or tjbench with the -alloc flag.
  Revert r1335 and r1336.  It was a valiant effort, but on Windows, xmm8-xmm15 are non-volatile, and the overhead of pushing them onto the stack at the beginning of each function and popping them at the end was causing worse performance (in the neighborhood of 3-5%) than just using the work areas and limiting the register usage to xmm0-xmm7.  Best to leave the SSE2 code alone.  We can optimize the register usage for AVX2, once that port takes place.
  Windows doesn't have setenv().  Go, go Gadget Macros.
  1.4 beta1
  Fix 'make dist'
  Don't use sudo when building a Debian package unless the user is non-root
  Add a set of undocumented environment variables and Java system properties that allow compression features of libjpeg that are not normally exposed in the TurboJPEG API to be enabled.  These features are not normally exposed because, for the most part, they aren't "turbo" features, but it is still useful to be able to benchmark them without modifying the code.
  .func/.endfunc are only necessary when generating STABS debug info, which basically went out of style with parachute pants and Rick Astley.  At any rate, none of the platforms for which we're building the ARM code use it (DWARF is the common format these days), and the .func/.endfunc directives cause the clang integrated assembler to fail (http://llvm.org/bugs/show_bug.cgi?id=20424).
  Extend tjbenchtest so that it tests the dynamic JPEG buffer allocation feature in TurboJPEG.  Disable the tiling feature in TJBench whenever dynamic buffer allocation is enabled (because the tiling feature requires a separate buffer for each tile, using it successfully with dynamic buffer allocation would require a separate TurboJPEG compressor instance for each tile, and it's not worth going to that trouble right now.)
  Run the TurboJPEG conformance tests out of a directory in /tmp (for improved performance, if the source directory is on a remote file share.)  Fix an issue in TJBench.java that prevented it from working properly if the source image resided in a directory with a dot in the name.
  Oops
  Subtle point, but dest->outbuffer is a pointer to the address of the JPEG buffer, which is stored in the calling program.  Thus, *(dest->outbuffer) will always equal *outbuffer.  We need to compare *outbuffer with dest->buffer instead to determine if the pointer is being reused.
  If the output buffer in the TurboJPEG destination manager was allocated by the destination manager and is being reused from a previous compression operation, then we need to get the buffer size from the previous operation, since the calling program doesn't know the actual buffer size.
  Actually, we need to increase the size of BUFSIZE, not just the size of _buffer.  The previous patch might have cause problems if, for instance, state->free_in_buffer was 127 but 129 bytes were compressed.  In that case, only 127 of the 129 bytes would have been written to the file.  Also document the fix.
  ...

Conflicts:
	CMakeLists.txt
	Makefile.am
	configure.ac
	jcdctmgr.c
	release/deb-control.tmpl
	sharedlib/CMakeLists.txt
	simd/CMakeLists.txt
	turbojpeg.c
2014-09-07 18:21:19 +01:00
Kornel Lesiński
71539b3e13 Merge libjpeg-turbo r1325
* commit 'b8d044a666056d4d8d28d7a5d0805ac32b619b36': (58 commits)
  Big oops.  wrjpgcom on Windows was being built using the rdjpgcom source.
  Prevent a buffer overrun if the comment begins with a literal quote character and the string exceeds 65k characters.  Also prevent comments longer than 65k characters from being written, since this will produce an incorrect JPEG file.
  Remove VMS-specific code
  Our copyright string is longer than JMSG_LENGTH_MAX, and this was causing a buffer overrun if output_message() was called with msg_code set to JMSG_COPYRIGHT, or if format_message() was called with msg_code set to JMSG_COPYRIGHT and with a buffer of length JMSG_LENGTH_MAX.
  We don't support non-ANSI C compilers
  Allow for building the MIPS DSPr2 extensions if the host is mips-* as well as mipsel-*.  The DSPr2 extensions are little endian, so we still have to check that the compiler defines __MIPSEL__ before enabling them.  This paves the way for supporting big-endian MIPS, and in the near term, it allows the SIMD extensions to be built with Sourcery CodeBench.
  SIMD-accelerated int upsample routine for MIPS DSPr2
  Fix MIPS build
  libjpeg-turbo has never supported non-ANSI compilers, so get rid of the crufty SIZEOF() macro.  It was not being used consistently anyhow, so it would not have been possible to build prior releases of libjpeg-turbo using the broken compilers for which that macro was designed.
  Remove MS-DOS code and information, and adjust copyright headers to reflect the removal of features in r1307 and r1308.  libjpeg-turbo has never supported MS-DOS, nor is it even possible for us to do so.
  Further copyright header cleanup
  Further copyright header cleanup
  Get rid of the HAVE_PROTOTYPES configuration option, as well as the related JMETHOD and JPP macros.  libjpeg-turbo has never supported compilers that don't handle prototypes.  Doing so requires ansi2knr, which isn't even supported in the IJG code anymore.
  Remove all of the NEED_SHORT_EXTERNAL_NAMES stuff.  There is scant information available as to which linkers ever had a 15-character global symbol name limit.  AFAICT, it might have been a VMS and/or a.out BSD thing, but none of those platforms have ever been supported by libjpeg-turbo (nor are such systems supported by other open source libraries of this nature.)
  Clean up code formatting in the SIMD interface functions
  SIMD-accelerated NULL convert routine for MIPS DSPr2
  Fix build, which was broken by the checkin of the MIPS DSPr2 accelerated smooth downsampling routine.  Until/unless other platforms include SIMD support for that function, it's just easier to #ifdef around it rather than adding stubs for the other platforms.
  Fix error in MIPS DSPr2 accelerated smooth downsample routine
  SIMD-accelerated h2v2 smooth downsampling routine for MIPS DSPr2
  Minor tweak to improve code readability
  ...

Conflicts:
	BUILDING.txt
	CMakeLists.txt
	Makefile.am
	cdjpeg.h
	cjpeg.1
	cjpeg.c
	configure.ac
	djpeg.1
	example.c
	jccoefct.c
	jcdctmgr.c
	jchuff.c
	jchuff.h
	jcinit.c
	jcmaster.c
	jcparam.c
	jcphuff.c
	jidctflt.c
	jpegint.h
	jpeglib.h
	jversion.h
	libjpeg.txt
	rdswitch.c
	simd/CMakeLists.txt
	tjbench.c
	turbojpeg.c
	usage.txt
	wrjpgcom.c
2014-09-07 16:59:11 +01:00
Kornel Lesiński
f9d1fcdf6f Merge libjpeg-turbo r1220
* commit '93ddfcfc1a814789ed64d967a6118616753bb9d5': (65 commits)
  Use clz/bsr instructions on ARM for bit counting rather than the lookup table (reduces memory footprint and can improve performance in some cases.)
  Make iOS build instructions more generic and applicable to all versions of Xcode;  modify iOS build procedure for Xcode 5.0 and later to fix a build issue with Xcode 5.1.
  Update build instructions to reflect the use of pkgbuild/productbuild
  Remove any claims of support for OS X 10.4 "Tiger" (the packaging system overhaul produces packages that require Leopard or later, and I haven't been able to test Tiger for years anyhow.)  Update TurboJPEG shared library version.
  Migrate Mac packaging system to pkgbuild, since PackageMaker is no longer supported.
  Remove the sections about replacing libjpeg at run time and compile time.  These were written before O/S distributions started shipping libjpeg-turbo, and they are either pedantic or no longer relevant.  Also remove any text that assumes the use of our official project binaries.  Notes specific to the official binaries have been moved into the project wiki.
  Fix Windows build
  Since we're now maintaining our own Cygwin pseudo-repository directories instead of recommending that users install these packages from a local source, it makes more sense to name the packages according to Cygwin specs, so they can be copied as-is into the pseudo-repository.
  39dbc2db9718f9af2f62eb486fd73328fe8bf5e8
  Fix 'make dist'
  RHEL 6 (and probably other platforms as well) sets _defaultdocdir=%{_datadir}/doc, which screws things up, since we're overriding _datadir.  Since we intend _defaultdocdir to be /usr/share/doc, just be explicit about it.
  Fix compiler warning about unused function when building with the libjpeg v6b API/ABI
  Fix compiler warning ("always_inline function might not be inlinable") when building with recent versions of GCC
  Enable silent build (can be overridden with 'make V=1') if the version of autotools being used is new enough.
  Extend YUVImage class to allow reuse of the same buffer with different metadata;  port TJBench changes that treat YUV encoding/decoding as an intermediate step of the JPEG compression/decompression pipeline rather than a separate test case;  add YUV encode/decode tests to the Java version of tjbenchtest
  formatting tweaks
  Fix an error that occurred when trying to use the lossless transform feature without specifying -quiet;  formatting tweak
  Move the garbage collection of the JPEG tiles into the decompression function to increase the chances that tiled decompression of large images will succeed without an OutOfMemoryError.
  Generate the Java documentation using javadoc 7, to improve readability.
  This should have been checked in with the previous commit.
  ...

Conflicts:
	BUILDING.txt
	configure.ac
	jversion.h
	release/Info.plist.in
	release/ReadMe.rtf
	tjbench.c
	turbojpeg.c
2014-09-07 16:50:54 +01:00
DRC
04962caf3a Add a set of undocumented environment variables and Java system properties that allow compression features of libjpeg that are not normally exposed in the TurboJPEG API to be enabled. These features are not normally exposed because, for the most part, they aren't "turbo" features, but it is still useful to be able to benchmark them without modifying the code.
git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1376 632fc199-4ca6-4c93-a231-07263d6284db
2014-08-22 13:43:33 +00:00
DRC
ce6f3d8cd2 Refactored YUVImage Java class so that it supports both unified YUV image buffers as well as separate YUV image planes; modified the JNI functions accordingly and added new helper functions to the TurboJPEG C API (tjPlaneWidth(), tjPlaneHeight(), tjPlaneSizeYUV()) to facilitate those modifications; changed potentially confusing "component width" and "component height" terms to "plane width" and "plane height" and modified variable names in turbojpeg.c to reflect this; numerous other documentation tweaks
git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1360 632fc199-4ca6-4c93-a231-07263d6284db
2014-08-17 12:23:49 +00:00
DRC
ab62cf7ba5 Extend the TurboJPEG C API to support handling YUV images stored in separate image planes instead of a unified buffer 2014-08-11 18:05:41 +00:00
DRC
46611eb0ee libjpeg-turbo has never supported non-ANSI compilers, so get rid of the crufty SIZEOF() macro. It was not being used consistently anyhow, so it would not have been possible to build prior releases of libjpeg-turbo using the broken compilers for which that macro was designed. 2014-05-18 19:04:03 +00:00
DRC
f8301c92dd Get rid of the HAVE_PROTOTYPES configuration option, as well as the related JMETHOD and JPP macros. libjpeg-turbo has never supported compilers that don't handle prototypes. Doing so requires ansi2knr, which isn't even supported in the IJG code anymore. 2014-05-16 10:43:44 +00:00
DRC
361192b972 Phrasing. Boom. 2014-05-06 09:41:08 +00:00
DRC
4c778664d0 Fix crashes and bogus output in the CMYK and decode-to-YUV features that occurred if JCS_EXTENSIONS wasn't defined. 2014-04-20 09:42:49 +00:00
Reuben Hawkins
548aeb977d turbojpeg.c: clean up warnings around getinstance
This macro defined two local variables, cinfo and dinfo, but both
aren't always used.  Add a (void)cinfo; and (void)dinfo in there
to hush up the compiler.
2014-04-17 23:00:01 -05:00
DRC
378f4528ad Fix warnings about unused variables when building with GCC 4.8.x 2014-04-16 23:38:37 +00:00
Frank Bossen
0c7449c461 Fix #25
Scan pattern needs to be set again after changing colorspace
2014-03-27 14:31:35 +01:00
DRC
1cdf41108b For now, punt on trying to support fancy upsampling in tjDecodeYUV(). Fancy upsampling requires context rows and other refinements, which are difficult to implement correctly with the algorithm we're using. Longer-term, supporting fancy upsampling would probably require using the main buffer that libjpeg allocates. 2014-03-10 20:14:53 +00:00
DRC
adb33bb1a4 Fix additional uninitialized values reported by valgrind 2014-03-10 20:11:56 +00:00
DRC
8419f05afa When tjDecodeYUV() is used with a "fresh" decompressor instance (one that hasn't been previously used to decompress a JPEG image), then it needs comps_in_scan, data_precision, and the quantization tables to be defined. This patch also extends TJUnitTest to check for this error. 2014-03-10 09:34:04 +00:00
DRC
897a525e3f Go ahead and call jinit_master_decompress() rather than trying to reproduce its functionality. That function does a few things that we were missing, including allocating the range limit table used by the plain C color conversion code. 2014-03-07 03:52:57 +00:00
DRC
2409fb9d03 Oops. We need to call start_pass() on the color converter in order to allocate the conversion tables used by the plain C code. 2014-03-06 20:07:03 +00:00
DRC
b861ef600c Fix unitialized value reported by valgrind (the upsampling routine used by 4:4:0 and 4:1:1 reads the value of component_index.) 2014-02-28 09:35:34 +00:00
DRC
5c2f2cccb7 Implement a YUV decode function in the TurboJPEG API, to be symmetric with tjEncodeYUV(). 2014-02-28 09:17:14 +00:00
DRC
6500625c07 Remove unused code (the destination manager is not used during YUV encoding, there are no virtual arrays to realize, and jinit_c_prep_controller() is unnecessary because we are not using smoothing.) 2014-02-28 05:34:02 +00:00
DRC
b7e14cbaca Use C-style comments 2014-02-27 21:22:54 +00:00
fbossen
e9bbf66627 Enable mozjpeg defaults in sample apps and turbojpeg 2014-02-20 10:20:45 -05:00
DRC
040c688263 Fix an issue that prevented tjEncodeYUV3() and TJCompressor.encodeYUV() from working properly if the source image was very tiny. Basically, jpeg_start_compress() was attempting to write the JPEG headers, which was overrunning the YUV buffer. This patch removes the call to jpeg_start_compress() in tjEncodeYUV3() and replaces it with calls to the individual routines that are necessary to initialize the color converter and downsampler. TJUnitTest has also been modified to test for this condition (the buffer size regression test now works in YUV mode.) 2014-02-11 09:45:18 +00:00
Josh Aas
72b66f9c77 Initial commit of libjpeg-turbo plus readme edits. 2014-01-13 18:28:20 -06:00
DRC
fca3a77590 r1065 broke the build on Windows, because getinstance() defines a variable. Thus, it needs to occur before the array initialization code. 2013-10-31 05:00:19 +00:00
DRC
b3633e930b Extend the TurboJPEG C API to support compressing JPEG images from YUV planar images 2013-10-30 23:02:57 +00:00
DRC
8e4a07e20f Oops 2013-10-30 22:21:58 +00:00
DRC
07eadec225 Fix a really subtle issue whereby an invalid free() could occur if a program called tjInitDecompress() and then accidentally passed the handle to tjEncodeYUV3(), or if a program called tjInitCompress() and then accidentally passed the handle to tjDecompressToYUV2(). 2013-10-30 22:21:06 +00:00
DRC
24668df1df Add CMYK support to the TurboJPEG C API 2013-08-23 02:49:25 +00:00
DRC
5ca8bf8738 Add 4:1:1 subsampling support in the TurboJPEG C API 2013-08-18 10:19:00 +00:00
DRC
22be928d5a Fix incorrect data output and buffer overruns in the new tjDecompressToYUV2() function whenever scaling is used along with a 4:2:0 JPEG image; extend tjunittest and TJUnitTest to test for these issues. 2013-05-07 21:17:35 +00:00
DRC
da64629c62 Extend the TurboJPEG C API to support generating YUV images with arbitrary padding and to support image scaling when decompressing to YUV 2013-04-26 10:33:29 +00:00
DRC
cc4145ce2f Actually, turbojpeg.c works with libjpeg as well 2013-01-22 13:56:34 +00:00
DRC
9f8a003137 Eliminated the awkward and confusing "TurboJPEG/OSS" designation, since there are no other active implementations of the TurboJPEG API anymore; don't refer to the libjpeg API library as "libjpeg-turbo" anymore, since that can be confusing; ARM v7s build instructions 2013-01-21 23:42:12 +00:00
DRC
0a9250c2c0 Oops. Add support for TJFLAG_FASTDCT to tjDecompressToYUV() as well. 2012-07-03 20:02:49 +00:00
DRC
019d51d4f1 Add flags to the TurboJPEG API that allow the caller to force the use of either the fast or the accurate DCT/IDCT algorithms in the underlying codec. 2012-06-29 23:46:38 +00:00
DRC
1086af6541 Fix memory leak in the colorspace emulation code 2012-04-26 03:18:49 +00:00
DRC
9d7101c8f6 Emulate colorspace extensions if they are not present in the libjpeg API. This allows the TurboJPEG wrapper to be used with libjpeg rather than libjpeg-turbo. Not useful within the context of our project, but other projects prefer to include the TurboJPEG wrapper in-tree, and this allows them to be linked against either libjpeg-turbo or libjpeg. 2012-03-23 19:47:57 +00:00
DRC
c17aa549ab Ensure that tjDecompress2() exits cleanly if setDecompDefaults() fails 2012-03-23 19:37:40 +00:00
DRC
5e805d2f4b Expose new scaling factors in TurboJPEG API 2012-01-28 06:49:56 +00:00
DRC
5bd7a89f6a Compiler warnings 2012-01-17 11:48:38 +00:00
DRC
c1e4151607 Added new alpha channel colorspace constants/pixel formats, so applications can specify that they need the unused byte in a 4-component RGB output buffer set to 0xFF when decompressing. 2011-12-19 02:21:03 +00:00
DRC
f343d7332a Implement custom filter callback in Java 2011-09-20 05:02:19 +00:00
DRC
85a878bf07 Implement a custom DCT filter callback for lossless transforms 2011-09-17 00:18:31 +00:00
DRC
c02c1fa775 Fix compile error when JCS_EXTENSIONS!=1 2011-09-07 05:03:18 +00:00
DRC
489864aefa Re-work TJBUFSIZE() to take into account the level of chrominance subsampling 2011-07-12 03:17:23 +00:00
DRC
395bf7e218 turbojpegl.c=turbojpeg.c 2011-05-26 10:45:06 +00:00