cjpeg: Only support 8-bit precision w/ GIF input

Creating 12-bit-per-sample JPEG images from GIF input images was a
useful testing feature when the data precision was a compile-time
setting.  However, now that the data precision is a runtime setting,
it doesn't make sense for cjpeg to allow data precisions other than
8-bit with GIF input images.  GIF images are limited to 256 colors from
a palette of 8-bit-per-component RGB values, so they cannot take
advantage of the additional gamut afforded by higher data precisions.
This commit is contained in:
DRC
2024-06-22 17:45:31 -04:00
parent ed79114acb
commit 3290711d9c
10 changed files with 48 additions and 67 deletions

View File

@@ -158,12 +158,9 @@ Create JPEG file with N-bit data precision. N is 8, 12, or 16; default is 8.
If N is 16, then
.B -lossless
must also be specified. Note that only the PBMPLUS input file format supports
data precisions other than 8. (For historical reasons,
.B cjpeg
allows GIF input files to be converted into 12-bit-per-sample JPEG files, but
this is not a useful conversion.) Note also that PBMPLUS input files are
silently scaled to the target data precision, even if it is lower than the
precision of the input file. Passing an argument of
data precisions other than 8. Note also that PBMPLUS input files are silently
scaled to the target data precision, even if it is lower than the precision of
the input file. Passing an argument of
.B \-verbose
to
.B cjpeg

View File

@@ -120,9 +120,10 @@ and 16-bit-per-sample lossless (predictive) processes. This code supports
12-bit-per-sample lossy or lossless JPEG if you set cinfo->data_precision to 12
and 16-bit-per-sample lossless JPEG if you set cinfo->data_precision to 16.
Note that this causes the sample size to be larger than a char, so it affects
the surrounding application's image data. The sample applications cjpeg and
djpeg can support 12-bit data precision only for PPM, PGM, and GIF file formats
and 16-bit data precision only for PPM and PGM file formats.
the surrounding application's image data. The sample application djpeg can
support 12-bit data precision only for PPM, PGM, and GIF file formats. The
sample applications cjpeg and djpeg can support 16-bit data precision only for
PPM and PGM file formats.
Note that, when 12-bit data precision is enabled in lossy mode, the library
compresses in Huffman optimization mode by default, in order to generate valid

View File

@@ -170,17 +170,15 @@ Switches for advanced users:
N is 8, 12, or 16; default is 8. If N is 16, then
-lossless must also be specified. Note that only the
PBMPLUS input file format supports data precisions other
than 8. (For historical reasons, cjpeg allows GIF input
files to be converted into 12-bit-per-sample JPEG files,
but this is not a useful conversion.) Note also that
PBMPLUS input files are silently scaled to the target
data precision, even if it is lower than the precision
of the input file. Passing an argument of -verbose to
cjpeg will cause it to print information about the
precision of the input file. CAUTION: 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.
than 8. Note also that PBMPLUS input files are silently
scaled to the target data precision, even if it is lower
than the precision of the input file. Passing an
argument of -verbose to cjpeg will cause it to print
information about the precision of the input file.
CAUTION: 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.
"-precision 12" implies -optimize unless -arithmetic is
also specified.