Commit Graph

59 Commits

Author SHA1 Message Date
Kornel Lesiński
4966e1eec5 Const on getters 2015-01-24 16:28:31 +00:00
Kornel Lesiński
67753d1298 Const on simple getters and copy source 2015-01-24 16:28:29 +00:00
Kornel Lesiński
85e2e0f9c2 Declare inbuffer const 2015-01-08 00:53:35 +00:00
Frank Bossen
a6b1bda094 Consider vertical gradient in DC trellis
Add extension parameter JFLOAT_TRELLIS_DELTA_DC_WEIGHT that controls
how distortion is calculated in DC trellis quantization. The parameter
defines weighting between actual distortion of DC and distortion of
vertical gradient of DC.
By default the parameter is 0.0 and has no effect.
Addresses #117
2014-12-17 07:51:12 +09:00
DRC
3e2cf6909c Convert JBOOLEAN_USE_MOZ_DEFAULTS into an integer "compression profile" parameter
This eliminates JBOOLEAN_USE_MOZ_DEFAULTS and replaces it with
JINT_COMPRESS_PROFILE, a more flexible and descriptive parameter.  Currently,
this new parameter works in much the same way as the old-- it changes the
behavior of jpeg_set_defaults().  It currently supports only two values
(max. compression, i.e. mozjpeg defaults, and fastest, i.e. libjpeg-turbo
defaults), but it can be extended in the future with additional profiles that
balance compression ratio with performance.
2014-12-14 01:56:26 -06:00
Frank Bossen
faa4c44453 Use single parameter for DC scan opt mode
JBOOLEAN_ONE_DC_SCAN and JBOOLEAN_SEP_DC_SCAN are merged into a single
parameter JINT_DC_SCAN_OPT_MODE
Default behavior is modified to use one DC scan per component
2014-11-29 19:15:46 -05:00
Frank Bossen
5dae26de7c Remove access to parameter that shouldn't be exposed 2014-11-28 15:06:30 -05:00
Frank Bossen
675ad04262 Merge branch 'qtable'
Conflicts:
	jcparam.c (resolved)
2014-11-27 16:16:35 -05:00
Frank Bossen
f3db724c2d Merge branch 'master' into qtable
Conflicts:
	cjpeg.c
	jcdctmgr.c
	jcparam.c
	jpeglib.h
	rdswitch.c
2014-11-12 14:15:12 -10:00
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
Frank Bossen
36b2fecd0c Merge branch 'floatovershoot' of https://github.com/pornel/mozjpeg into pornel-floatovershoot
Conflicts:
	jcdctmgr.c (resolved)
2014-09-30 10:57:09 -04:00
Frank Bossen
41ebea736d Make provisions for more default quant tables 2014-09-09 16:06:32 -04:00
Kornel Lesiński
a7eb278df1 Merge mozjpeg into libjpeg-turbo
* origin/master: (23 commits)
  Update .gitignore
  .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).
  Enable DC trellis by default
  Avoid double inline attribute
  Detect libpng
  Implement DHT Merging
  Add .gitignore for autotools files
  Check memory alloc success
  Update cjpeg usage text
  Implement DQT merging
  Fix issue with scan printout
  Get rid of unnecessary and obsolete platform configuration instructions.
  Add error checks for malloc calls that don't already have them. Issue #87.
  yuvjpeg: fix trivial leak
  Parse quality as float
  PNG reading support
  Fix issue with DC trellis
  Add option to split DC scans
  Add trellis for DC
  Bump version to 2.1.
  ...

Conflicts:
	BUILDING.txt
	cdjpeg.h
	jcdctmgr.c
	jchuff.h
	jcmarker.c
	jcmaster.c
	jconfig.txt
	jpeglib.h
	rdswitch.c
2014-09-07 18:20:38 +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
Josh Aas
d3c8cde986 Merge pull request #89 from pornel/floatq
Parse quality as float
2014-08-15 14:18:36 -05:00
Kornel Lesiński
5f434e6053 Parse quality as float 2014-08-04 21:35:51 +01:00
Frank Bossen
33f39a2818 Add option to split DC scans
Command line option -split-dc-scan is added to code DC scans
independently (instead of interleaved). It should be determined whether
this option introduces any decoder compatibility issues ( see #83 )
Option -multidcscan is renamed to -opt-dc-scan
2014-07-31 15:26:38 -04:00
Frank Bossen
049e5c80b9 Add trellis for DC
Add option to apply trellis quantization to the DC coefficients ( see
#57 ). May need further refinement to make sure block order during
trellis optimization matches order during coding.
2014-07-31 12:11:36 -04:00
DRC
144e7b79e4 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. 2014-05-18 18:33:44 +00:00
DRC
44e609fa3a Further copyright header cleanup 2014-05-18 17:52:06 +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
2c0b793539 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.) 2014-05-15 20:30:16 +00:00
DRC
cfbb147aad Add support for decompressing to RGB565 (16-bit) pixels 2014-05-12 09:23:57 +00:00
DRC
f413bb5fb7 Use 2-space indentation for the enums, to be consistent with the structs 2014-05-12 00:34:58 +00:00
DRC
e45363d7c2 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.) 2014-05-09 18:00:32 +00:00
Frank Bossen
13e2115054 Add option to have single DC scan
Add option to have a single DC scan wherein all components are
interleaved when using progressive mode. This may resolve compatibility
issues raised in #29 and #48.
This option is available through -onedcscan in cjpeg
2014-05-08 17:33:14 -04:00
Frank Bossen
8a99fcac80 Correct comment 2014-05-08 17:00:53 -04:00
Frank Bossen
c88aade31c Revert type change
Revert type of use_moz_defaults to boolean
2014-04-30 14:54:18 -04:00
Frank Bossen
b03b5797f4 Add optimization of quantization matrix
Optimizes quantization matrix by minimizing reconstruction error based
on quantized coefficients.
Feature is controlled by cinfo->trellis_q_opt; disabled by default.
2014-04-28 16:28:05 -04:00
DRC
682c2b69f9 Minor comment correction (we support the full range of IDCT scaling factors now.) 2014-04-18 07:57:48 +00:00
Frank Bossen
1733487e17 Add option to perform multiple trellis quantization iterations
Multiple trellis iterations may improve coding performance as Huffman
tables are updated with each iteration. In practice the benefit appears
to be very minimal
2014-04-01 23:14:29 +02:00
Frank Bossen
2012e32f19 Update trellis quantization to support progressive coding mode
Trellis quantization is modified:
- to work on the configurable spectral range Ss to Se
- to optionally optimize runs of EOBs
- to optionally split optimization between 2 spectral ranges
In trellis quantization passes Huffman table code optimization is
modified such as to generable a valid code length for each possible
symbol by resetting frequency counters to 1 instead of 0
2014-04-01 20:14:37 +02:00
Frank Bossen
2de8e97989 Add option to use lambda weighting table
Different lambda values may be used for each frequency in DCT domain.
The weighting table is currently not configurable but can be
enabled/disabled with cinfo-> use_lambda_weight_tbl
2014-03-26 00:06:07 +01:00
Frank Bossen
758ed27a05 Add option to use flat quantization table
Set cinfo->use_flat_quant_tbl to TRUE to use flat quantization table or
-flat option in cjpeg
2014-03-24 16:30:56 +01:00
Frank Bossen
d200b2c144 Initial implementation of trellis quantization
A new pass type trellis_pass is added. It defines a pass where trellis
quantization is done in the quantize_trellis() function.
Trellis quantization can be enabled by setting use_moz_defaults to 2 or
by using the -trellis option in cjpeg
Note that trellis does currently not work with scan optimization. Scan
optimization is disabled when trellis is enabled.
2014-03-23 21:06:01 +01:00
fbossen
b346a5cc31 Move field 2014-02-19 16:49:57 -05:00
fbossen
3d26a0a343 Regroup copying of scan buffers 2014-02-19 15:38:20 -05:00
fbossen
579d16b032 Add pruning of frequency split selection
Skip passes for frequency splitting if they are unlikely to provide
better results.
Moved related fields from cinfo to master object.
2014-02-19 15:12:23 -05:00
fbossen
09fde9eaf6 Clean up scan optimisation code
Remove hard coded values and restructure code.
2014-02-14 17:11:56 -05:00
fbossen
71f953d0be Clean up scan optimisation code
Lessen use of hardcoded values in luma search
2014-02-13 19:09:32 -05:00
fbossen
16c3cdb956 Initial version of scan optimisation
First implementation of scan optimisation as done by jpgcrush. Many
parameters are currently hardcoded which should be changed.
Implementation is missing for monochrome.
2014-02-13 16:55:56 -05:00
fbossen
52925cfff2 Add fast jpgcrush mode
Add the fast mode of jpgcrush where:
- Huffman table optimisation is enabled
- Progressive coding mode is enabled
- New default scans are defined for progressive coding
2014-02-11 11:09:37 -05:00
Josh Aas
72b66f9c77 Initial commit of libjpeg-turbo plus readme edits. 2014-01-13 18:28:20 -06:00
DRC
ba4a6c32f8 Implement in-memory source/destination managers even when not emulating the libjpeg v8 API/ABI 2013-01-18 23:42:31 +00:00
DRC
de30fe9460 Change the copyright notices to make it clear that our modified files are not part of the IJG's software. 2012-12-31 02:42:18 +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
7e08d60891 Document new v7/v8 features; .doc = .txt 2010-10-12 01:55:31 +00:00
DRC
ba825db7ad Remove comments describing DCT scaling feature 2010-10-09 19:24:28 +00:00
DRC
d0d0f09d40 Added optional emulation of the jpeg-7 or jpeg-8b API/ABI's 2010-10-08 08:05:44 +00:00