TurboJPEG: Fix 12-bit-per-sample arith-coded compr
(Regression introduced by7bb958b732) Because of7bb958b732, the TurboJPEG compression and encoding functions no longer transfer the value of TJPARAM_OPTIMIZE into cinfo->data_precision unless the data precision is 8. The intent of that was to prevent using_std_huff_tables() from being called more than once when reusing the same compressor object to generate multiple 12-bit-per-sample JPEG images. However, because cinfo->optimize_coding is always set to TRUE by jpeg_set_defaults() if the data precision is 12, calling applications that use 12-bit data precision had to unset cinfo->optimize_coding if they set cinfo->arith_code after calling jpeg_set_defaults(). Because of7bb958b732, the TurboJPEG API stopped doing that except with 8-bit data precision. Thus, attempting to generate a 12-bit-per-sample arithmetic-coded lossy JPEG image using the TurboJPEG API failed with "Requested features are incompatible." Since the compressor will always fail if cinfo->arith_code and cinfo->optimize_coding are both set, and since cinfo->optimize_coding has no relevance for arithmetic coding, the most robust and user-proof solution is for jinit_c_master_control() to set cinfo->optimize_coding to FALSE if cinfo->arith_code is TRUE. This commit also: - modifies TJBench so that it no longer reports that it is using optimized baseline entropy coding in modes where that setting is irrelevant, - amends the cjpeg documentation to clarify that -optimize is implied when specifying -progressive or '-precision 12' without -arithmetic, and - prevents jpeg_set_defaults() from uselessly checking the value of cinfo->arith_code immediately after it has been set to FALSE.
This commit is contained in:
15
cjpeg.1
15
cjpeg.1
@@ -1,4 +1,4 @@
|
||||
.TH CJPEG 1 "21 June 2024"
|
||||
.TH CJPEG 1 "24 June 2024"
|
||||
.SH NAME
|
||||
cjpeg \- compress an image file to a JPEG file
|
||||
.SH SYNOPSIS
|
||||
@@ -60,7 +60,11 @@ decompression are unaffected by
|
||||
.BR \-optimize .
|
||||
.TP
|
||||
.B \-progressive
|
||||
Create progressive JPEG file (see below).
|
||||
Create progressive JPEG file (see below). Implies
|
||||
.B \-optimize
|
||||
unless
|
||||
.B \-arithmetic
|
||||
is also specified.
|
||||
.TP
|
||||
.B \-targa
|
||||
Input file is Targa format [legacy feature]. Targa files that contain an
|
||||
@@ -168,6 +172,13 @@ will cause it to print information about the precision of the input file.
|
||||
12-bit and 16-bit data precision is not yet widely implemented, so many
|
||||
decoders will be unable to handle a 12-bit-per-sample or 16-bit-per-sample JPEG
|
||||
file at all.
|
||||
.IP
|
||||
.B \-precision\ 12
|
||||
implies
|
||||
.B \-optimize
|
||||
unless
|
||||
.B \-arithmetic
|
||||
is also specified.
|
||||
.TP
|
||||
.BI \-lossless " psv[,Pt]"
|
||||
Create a lossless JPEG file using the specified predictor selection value
|
||||
|
||||
Reference in New Issue
Block a user