jdmainct.c


Log

Author Commit Date CI Message
DRC 2241434e 2022-12-15T12:20:50 16-bit lossless JPEG support
DRC af618ffe 2022-11-08T15:01:18 Clean up the lossless JPEG feature - Rename jpeg_simple_lossless() to jpeg_enable_lossless() and modify the function so that it stores the lossless parameters directly in the Ss and Al fields of jpeg_compress_struct rather than using a scan script. - Move the cjpeg -lossless switch into "Switches for advanced users". - Document the libjpeg API and run-time features that are unavailable in lossless mode, and ensure that all parameters, functions, and switches related to unavailable features are ignored or generate errors in lossless mode. - Defer any action that depends on whether lossless mode is enabled until jpeg_start_compress()/jpeg_start_decompress() is called. - Document the purpose of the point transform value. - "Codec" stands for coder/decoder, so it is a bit awkward to say "lossless compression codec" and "lossless decompression codec". Use "lossless compressor" and "lossless decompressor" instead. - Restore backward API/ABI compatibility with libjpeg v6b: * Move the new 'lossless' field from the exposed jpeg_compress_struct and jpeg_decompress_struct structures into the opaque jpeg_comp_master and jpeg_decomp_master structures, and allocate the master structures in the body of jpeg_create_compress() and jpeg_create_decompress(). * Remove the new 'process' field from jpeg_compress_struct and jpeg_decompress_struct and replace it with the old 'progressive_mode' field and the new 'lossless' field. * Remove the new 'data_unit' field from jpeg_compress_struct and jpeg_decompress_struct and replace it with a locally-computed data unit variable. * Restore the names of macros and fields that refer to DCT blocks, and document that they have a different meaning in lossless mode. (Most of them aren't very meaningful in lossless mode anyhow.) * Remove the new alloc_darray() method from jpeg_memory_mgr and replace it with an internal macro that wraps the alloc_sarray() method. * Move the JDIFF* data types from jpeglib.h and jmorecfg.h into jpegint.h. * Remove the new 'codec' field from jpeg_compress_struct and jpeg_decompress_struct and instead reuse the existing internal coefficient control, forward/inverse DCT, and entropy encoding/decoding structures for lossless compression/decompression. * Repurpose existing error codes rather than introducing new ones. (The new JERR_BAD_RESTART and JWRN_MUST_DOWNSCALE codes remain, although JWRN_MUST_DOWNSCALE will probably be removed in libjpeg-turbo, since we have a different way of handling multiple data precisions.) - Automatically enable lossless mode when a scan script with parameters that are only valid for lossless mode is detected, and document the use of scan scripts to generate lossless JPEG images. - Move the sequential and shared Huffman routines back into jchuff.c and jdhuff.c, and document that those routines are shared with jclhuff.c and jdlhuff.c as well as with jcphuff.c and jdphuff.c. - Move MAX_DIFF_BITS from jchuff.h into jclhuff.c, the only place where it is used. - Move the predictor and scaler code into jclossls.c and jdlossls.c. - Streamline register usage in the [un]differencers (inspired by similar optimizations in the color [de]converters.) - Restructure the logic in a few places to reduce duplicated code. - Ensure that all lossless-specific code is guarded by C_LOSSLESS_SUPPORTED or D_LOSSLESS_SUPPORTED and that the library can be built successfully if either or both of those macros is undefined. - Remove all short forms of external names introduced by the lossless JPEG patch. (These will not be needed by libjpeg-turbo, so there is no use cleaning them up.) - Various wordsmithing, formatting, and punctuation tweaks - Eliminate various compiler warnings.
DRC b56e8b28 2022-11-08T15:01:18 Clean up the lossless JPEG feature - Rename jpeg_simple_lossless() to jpeg_enable_lossless() and modify the function so that it stores the lossless parameters directly in the Ss and Al fields of jpeg_compress_struct rather than using a scan script. - Move the cjpeg -lossless switch into "Switches for advanced users". - Document the libjpeg API and run-time features that are unavailable in lossless mode, and ensure that all parameters, functions, and switches related to unavailable features are ignored or generate errors in lossless mode. - Defer any action that depends on whether lossless mode is enabled until jpeg_start_compress()/jpeg_start_decompress() is called. - Document the purpose of the point transform value. - "Codec" stands for coder/decoder, so it is a bit awkward to say "lossless compression codec" and "lossless decompression codec". Use "lossless compressor" and "lossless decompressor" instead. - Restore backward API/ABI compatibility with libjpeg v6b: * Move the new 'lossless' field from the exposed jpeg_compress_struct and jpeg_decompress_struct structures into the opaque jpeg_comp_master and jpeg_decomp_master structures, and allocate the master structures in the body of jpeg_create_compress() and jpeg_create_decompress(). * Remove the new 'process' field from jpeg_compress_struct and jpeg_decompress_struct and replace it with the old 'progressive_mode' field and the new 'lossless' field. * Remove the new 'data_unit' field from jpeg_compress_struct and jpeg_decompress_struct and replace it with a locally-computed data unit variable. * Restore the names of macros and fields that refer to DCT blocks, and document that they have a different meaning in lossless mode. (Most of them aren't very meaningful in lossless mode anyhow.) * Remove the new alloc_darray() method from jpeg_memory_mgr and replace it with an internal macro that wraps the alloc_sarray() method. * Move the JDIFF* data types from jpeglib.h and jmorecfg.h into jpegint.h. * Remove the new 'codec' field from jpeg_compress_struct and jpeg_decompress_struct and instead reuse the existing internal coefficient control, forward/inverse DCT, and entropy encoding/decoding structures for lossless compression/decompression. * Repurpose existing error codes rather than introducing new ones. (The new JERR_BAD_RESTART and JWRN_MUST_DOWNSCALE codes remain, although JWRN_MUST_DOWNSCALE will probably be removed in libjpeg-turbo, since we have a different way of handling multiple data precisions.) - Automatically enable lossless mode when a scan script with parameters that are only valid for lossless mode is detected, and document the use of scan scripts to generate lossless JPEG images. - Move the sequential and shared Huffman routines back into jchuff.c and jdhuff.c, and document that those routines are shared with jclhuff.c and jdlhuff.c as well as with jcphuff.c and jdphuff.c. - Move MAX_DIFF_BITS from jchuff.h into jclhuff.c, the only place where it is used. - Move the predictor and scaler code into jclossls.c and jdlossls.c. - Streamline register usage in the [un]differencers (inspired by similar optimizations in the color [de]converters.) - Restructure the logic in a few places to reduce duplicated code. - Ensure that all lossless-specific code is guarded by C_LOSSLESS_SUPPORTED or D_LOSSLESS_SUPPORTED and that the library can be built successfully if either or both of those macros is undefined. - Remove all short forms of external names introduced by the lossless JPEG patch. (These will not be needed by libjpeg-turbo, so there is no use cleaning them up.) - Various wordsmithing, formatting, and punctuation tweaks - Eliminate various compiler warnings.
DRC 97772cba 2022-11-14T15:36:25 Merge branch 'ijg.lossless' into dev Refer to #402
DRC 217d1a75 2022-11-08T15:01:18 Clean up the lossless JPEG feature - Rename jpeg_simple_lossless() to jpeg_enable_lossless() and modify the function so that it stores the lossless parameters directly in the Ss and Al fields of jpeg_compress_struct rather than using a scan script. - Move the cjpeg -lossless switch into "Switches for advanced users". - Document the libjpeg API and run-time features that are unavailable in lossless mode, and ensure that all parameters, functions, and switches related to unavailable features are ignored or generate errors in lossless mode. - Defer any action that depends on whether lossless mode is enabled until jpeg_start_compress()/jpeg_start_decompress() is called. - Document the purpose of the point transform value. - "Codec" stands for coder/decoder, so it is a bit awkward to say "lossless compression codec" and "lossless decompression codec". Use "lossless compressor" and "lossless decompressor" instead. - Restore backward API/ABI compatibility with libjpeg v6b: * Move the new 'lossless' field from the exposed jpeg_compress_struct and jpeg_decompress_struct structures into the opaque jpeg_comp_master and jpeg_decomp_master structures, and allocate the master structures in the body of jpeg_create_compress() and jpeg_create_decompress(). * Remove the new 'process' field from jpeg_compress_struct and jpeg_decompress_struct and replace it with the old 'progressive_mode' field and the new 'lossless' field. * Remove the new 'data_unit' field from jpeg_compress_struct and jpeg_decompress_struct and replace it with a locally-computed data unit variable. * Restore the names of macros and fields that refer to DCT blocks, and document that they have a different meaning in lossless mode. (Most of them aren't very meaningful in lossless mode anyhow.) * Remove the new alloc_darray() method from jpeg_memory_mgr and replace it with an internal macro that wraps the alloc_sarray() method. * Move the JDIFF* data types from jpeglib.h and jmorecfg.h into jpegint.h. * Remove the new 'codec' field from jpeg_compress_struct and jpeg_decompress_struct and instead reuse the existing internal coefficient control, forward/inverse DCT, and entropy encoding/decoding structures for lossless compression/decompression. * Repurpose existing error codes rather than introducing new ones. (The new JERR_BAD_RESTART and JWRN_MUST_DOWNSCALE codes remain, although JWRN_MUST_DOWNSCALE will probably be removed in libjpeg-turbo, since we have a different way of handling multiple data precisions.) - Automatically enable lossless mode when a scan script with parameters that are only valid for lossless mode is detected, and document the use of scan scripts to generate lossless JPEG images. - Move the sequential and shared Huffman routines back into jchuff.c and jdhuff.c, and document that those routines are shared with jclhuff.c and jdlhuff.c as well as with jcphuff.c and jdphuff.c. - Move MAX_DIFF_BITS from jchuff.h into jclhuff.c, the only place where it is used. - Move the predictor and scaler code into jclossls.c and jdlossls.c. - Streamline register usage in the [un]differencers (inspired by similar optimizations in the color [de]converters.) - Restructure the logic in a few places to reduce duplicated code. - Ensure that all lossless-specific code is guarded by C_LOSSLESS_SUPPORTED or D_LOSSLESS_SUPPORTED and that the library can be built successfully if either or both of those macros is undefined. - Remove all short forms of external names introduced by the lossless JPEG patch. (These will not be needed by libjpeg-turbo, so there is no use cleaning them up.) - Various wordsmithing, formatting, and punctuation tweaks - Eliminate various compiler warnings.
DRC e8b40f3c 2022-11-01T21:45:39 Vastly improve 12-bit JPEG integration The Gordian knot that 7fec5074f962b20ed00b4f5da4533e1e8d4ed8ac attempted to unravel was caused by the fact that there are several data-precision-dependent (JSAMPLE-dependent) fields and methods in the exposed libjpeg API structures, and if you change the exposed libjpeg API structures, then you have to change the whole API. If you change the whole API, then you have to provide a whole new library to support the new API, and that makes it difficult to support multiple data precisions in the same application. (It is not impossible, as example.c demonstrated, but using data-precision-dependent libjpeg API structures would have made the cjpeg, djpeg, and jpegtran source code hard to read, so it made more sense to build, install, and package 12-bit-specific versions of those applications.) Unfortunately, the result of that initial integration effort was an unreadable and unmaintainable mess, which is a problem for a library that is an ISO/ITU-T reference implementation. Also, as I dug into the problem of lossless JPEG support, I realized that 16-bit lossless JPEG images are a thing, and supporting yet another version of the libjpeg API just for those images is untenable. In fact, however, the touch points for JSAMPLE in the exposed libjpeg API structures are minimal: - The colormap and sample_range_limit fields in jpeg_decompress_struct - The alloc_sarray() and access_virt_sarray() methods in jpeg_memory_mgr - jpeg_write_scanlines() and jpeg_write_raw_data() - jpeg_read_scanlines() and jpeg_read_raw_data() - jpeg_skip_scanlines() and jpeg_crop_scanline() (This is subtle, but both of those functions use JSAMPLE-dependent opaque structures behind the scenes.) It is much more readable and maintainable to provide 12-bit-specific versions of those six top-level API functions and to document that the aforementioned methods and fields must be type-cast when using 12-bit samples. Since that eliminates the need to provide a 12-bit-specific version of the exposed libjpeg API structures, we can: - Compile only the precision-dependent libjpeg modules (the coefficient buffer controllers, the colorspace converters, the DCT/IDCT managers, the main buffer controllers, the preprocessing and postprocessing controller, the downsampler and upsamplers, the quantizers, the integer DCT methods, and the IDCT methods) for multiple data precisions. - Introduce 12-bit-specific methods into the various internal structures defined in jpegint.h. - Create precision-independent data type, macro, method, field, and function names that are prefixed by an underscore, and use an internal header to convert those into precision-dependent data type, macro, method, field, and function names, based on the value of BITS_IN_JSAMPLE, when compiling the precision-dependent libjpeg modules. - Expose precision-dependent jinit*() functions for each of the precision-dependent libjpeg modules. - Abstract the precision-dependent libjpeg modules by calling the appropriate precision-dependent jinit*() function, based on the value of cinfo->data_precision, from top-level libjpeg API functions.
DRC ec6e451d 2022-10-21T16:45:25 Lossless JPEG support: Add copyright attributions Referring to https://github.com/libjpeg-turbo/libjpeg-turbo/issues/402#issuecomment-768348440 and https://github.com/libjpeg-turbo/libjpeg-turbo/issues/402#issuecomment-770221584 Ken Murchison clarified that it was his intent to release the lossless JPEG patch under the IJG License and that adding his name to the copyright headers would be sufficient to acknowledge that any derivatives are based on his work.
Ken Murchison 2e8360e0 1999-04-27T00:00:00 IJG's JPEG software v6b with lossless JPEG support Patch obtained from: https://sourceforge.net/projects/jpeg/files/ftp.oceana.com Author date taken from original announcement and timestamp of patch tarball: https://groups.google.com/g/comp.protocols.dicom/c/rrkP8BxoMRk/m/Ij4dfprggp8J
DRC eb0a024a 2022-10-04T12:51:38 Remove redundant jconfigint.h #includes Because of 607b668ff96e40fdc749de9b1bb98e7f40c86d93, jconfigint.h is included by jinclude.h.
Peter Kasting 9df5786f 2021-06-26T16:22:21 Fix -Wimplicit-fallthrough warnings with Clang The existing /*FALLTHROUGH*/ comments work with GCC but not Clang, so this commit adds a FALLTHROUGH macro that uses the 'fallthrough' attribute if the compiler supports it. Refer to https://bugs.chromium.org/p/chromium/issues/detail?id=995993 NOTE: All versions of GCC that support -Wimplicit-fallthrough also support the 'fallthrough' attribute, but certain other compilers (Oracle Solaris Studio, for instance) support /*FALLTHROUGH*/ but not the 'fallthrough' attribute. Thus, this commit retains the /*FALLTHROUGH*/ comments, which have existed in the libjpeg code base in some form since 1994 (libjpeg v5.) Closes #531
Guido Vollbeding 96e4e7eb 2018-01-14T00:00:00 The Independent JPEG Group's JPEG software v9c
DRC 19c791cd 2018-03-08T10:55:20 Improve code formatting consistency With rare exceptions ... - Always separate line continuation characters by one space from preceding code. - Always use two-space indentation. Never use tabs. - Always use K&R-style conditional blocks. - Always surround operators with spaces, except in raw assembly code. - Always put a space after, but not before, a comma. - Never put a space between type casts and variables/function calls. - Never put a space between the function name and the argument list in function declarations and prototypes. - Always surround braces ('{' and '}') with spaces. - Always surround statements (if, for, else, catch, while, do, switch) with spaces. - Always attach pointer symbols ('*' and '**') to the variable or function name. - Always precede pointer symbols ('*' and '**') by a space in type casts. - Use the MIN() macro from jpegint.h within the libjpeg and TurboJPEG API libraries (using min() from tjutil.h is still necessary for TJBench.) - Where it makes sense (particularly in the TurboJPEG code), put a blank line after variable declaration blocks. - Always separate statements in one-liners by two spaces. The purpose of this was to ease maintenance on my part and also to make it easier for contributors to figure out how to format patch submissions. This was admittedly confusing (even to me sometimes) when we had 3 or 4 different style conventions in the same source tree. The new convention is more consistent with the formatting of other OSS code bases. This commit corrects deviations from the chosen formatting style in the libjpeg API code and reformats the TurboJPEG API code such that it conforms to the same standard. NOTES: - Although it is no longer necessary for the function name in function declarations to begin in Column 1 (this was historically necessary because of the ansi2knr utility, which allowed libjpeg to be built with non-ANSI compilers), we retain that formatting for the libjpeg code because it improves readability when using libjpeg's function attribute macros (GLOBAL(), etc.) - This reformatting project was accomplished with the help of AStyle and Uncrustify, although neither was completely up to the task, and thus a great deal of manual tweaking was required. Note to developers of code formatting utilities: the libjpeg-turbo code base is an excellent test bed, because AFAICT, it breaks every single one of the utilities that are currently available. - The legacy (MMX, SSE, 3DNow!) assembly code for i386 has been formatted to match the SSE2 code (refer to ff5685d5344273df321eb63a005eaae19d2496e3.) I hadn't intended to bother with this, but the Loongson MMI implementation demonstrated that there is still academic value to the MMX implementation, as an algorithmic model for other 64-bit vector implementations. Thus, it is desirable to improve its readability in the same manner as that of the SSE2 implementation.
Guido Vollbeding e7f88aec 2013-01-13T00:00:00 The Independent JPEG Group's JPEG software v9
DRC ce0dd949 2016-02-06T12:18:44 Fix MinGW build jinclude.h can't be safely included multiple times, so instead of including it in the shared (broken-out) headers, it should instead be included by the source files that include one or more of those headers.
DRC 7e3acc0e 2015-10-10T10:25:46 Rename README, LICENSE, BUILDING text files The IJG README file has been renamed to README.ijg, in order to avoid confusion (many people were assuming that that was our project's README file and weren't reading README-turbo.txt) and to lay the groundwork for markdown versions of the libjpeg-turbo README and build instructions.
Thomas G. Lane 489583f5 1996-02-07T00:00:00 The Independent JPEG Group's JPEG software v6a
Thomas G. Lane bc79e068 1995-08-02T00:00:00 The Independent JPEG Group's JPEG software v6
Thomas G. Lane 36a4cccc 1994-09-24T00:00:00 The Independent JPEG Group's JPEG software v5
Guido Vollbeding 5996a25e 2009-06-27T00:00:00 The Independent JPEG Group's JPEG software v7
DRC eb32cc1e 2015-06-25T03:44:36 Add a new libjpeg API function (jpeg_skip_scanlines()) to allow for partially decoding a JPEG image. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1582 632fc199-4ca6-4c93-a231-07263d6284db
DRC 5de454b2 2014-05-18T19:04:03 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. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1313 632fc199-4ca6-4c93-a231-07263d6284db
DRC bc56b754 2014-05-16T10:43:44 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. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1308 632fc199-4ca6-4c93-a231-07263d6284db
DRC b7753510 2014-05-11T09:36:25 Convert tabs to spaces in the libjpeg code and the SIMD code (TurboJPEG retains the use of tabs for historical reasons. They were annoying in the libjpeg code primarily because they were not consistently used and because they were used to format as well as indent the code. In the case of TurboJPEG, tabs are used just to indent the code, so even if the editor assumes a different tab width, the code will still be readable.) git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1285 632fc199-4ca6-4c93-a231-07263d6284db
DRC e5eaf374 2014-05-09T18:00:32 Convert tabs to spaces in the libjpeg code and the SIMD code (TurboJPEG retains the use of tabs for historical reasons. They were annoying in the libjpeg code primarily because they were not consistently used and because they were used to format as well as indent the code. In the case of TurboJPEG, tabs are used just to indent the code, so even if the editor assumes a different tab width, the code will still be readable.) git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1278 632fc199-4ca6-4c93-a231-07263d6284db
DRC a6ef282a 2013-09-28T03:23:49 Some of the IJG headers say "Modified by", so clarify that our "Modifications" are not referring to these. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1053 632fc199-4ca6-4c93-a231-07263d6284db
DRC a73e870a 2012-12-31T02:52:30 Change the copyright notices to make it clear that our modified files are not part of the IJG's software. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.2.x@873 632fc199-4ca6-4c93-a231-07263d6284db
DRC 7ed7b572 2012-02-07T22:51:49 Eliminate "main is usually a function" warnings git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@780 632fc199-4ca6-4c93-a231-07263d6284db
DRC 49967cdb 2010-10-09T19:57:51 Improve readability and flexibility of compatibility macros git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@241 632fc199-4ca6-4c93-a231-07263d6284db
DRC 36a6eec9 2010-10-08T08:05:44 Added optional emulation of the jpeg-7 or jpeg-8b API/ABI's git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@236 632fc199-4ca6-4c93-a231-07263d6284db