Handle lossless JPEG images w/2-15 bits per sample

Closes #768
Closes #769
This commit is contained in:
DRC
2024-06-13 11:52:13 -04:00
parent 3290711d9c
commit 6ec8e41f50
63 changed files with 1566 additions and 869 deletions

View File

@@ -154,8 +154,8 @@ about the same --- often a little smaller.
Switches for advanced users:
.TP
.BI \-precision " N"
Create JPEG file with N-bit data precision. N is 8, 12, or 16; default is 8.
If N is 16, then
Create JPEG file with N-bit data precision. N is 2 to 16; default is 8. If N
is not 8 or 12, then
.B -lossless
must also be specified. Note that only the PBMPLUS input file format supports
data precisions other than 8. Note also that PBMPLUS input files are silently
@@ -166,9 +166,8 @@ to
.B cjpeg
will cause it to print information about the precision of the input file.
.B 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.
only 8-bit data precision is widely implemented, so many decoders will be
unable to handle JPEG files with other data precisions.
.IP
.B \-precision\ 12
implies

View File

@@ -1,5 +1,5 @@
PROJECT_NAME = TurboJPEG
PROJECT_NUMBER = 3.0.1
PROJECT_NUMBER = 3.0.2
OUTPUT_DIRECTORY = ../doc/
HTML_OUTPUT = turbojpeg
USE_WINDOWS_ENCODING = NO

View File

@@ -31,7 +31,7 @@ TABLE OF CONTENTS
Overview:
Functions provided by the library
12-bit and 16-bit Data Precision
Data Precision
Outline of typical usage
Basic library usage:
Data formats
@@ -101,8 +101,8 @@ use.) Unsupported ISO options include:
* Hierarchical storage
* DNL marker
* Nonintegral subsampling ratios
We support 8-bit (lossy and lossless), 12-bit (lossy and lossless), and 16-bit
(lossless) data precision.
We support 8-bit and 12-bit data precision in lossy mode and 2-bit through
16-bit data precision in lossless mode.
By itself, the library handles only interchange JPEG datastreams --- in
particular the widely used JFIF file format. The library can be used by
@@ -111,19 +111,21 @@ are embedded in more complex file formats. (For example, this library is
used by the free LIBTIFF library to support JPEG compression in TIFF.)
12-bit and 16-bit Data Precision
--------------------------------
Data Precision
--------------
The JPEG standard provides for baseline (8-bit-per-sample) and
12-bit-per-sample DCT processes as well as 8-bit-per-sample, 12-bit-per-sample,
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 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.
The data precision is the number of bits in the maximum sample value (which may
not be the same as the width of the data type used to store the sample.) The
JPEG standard provides for, and this code supports, baseline (8-bit-per-sample)
and 12-bit-per-sample DCT processes as well as lossless (predictive) processes
with 2 to 16 bits of data precision per sample. To create a JPEG image with a
particular data precision, set cinfo->data_precision accordingly. Note that
9-bit and higher data precisions cause the sample size to be larger than a
char, which affects 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 2-bit
through 7-bit and 9-bit through 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
@@ -134,8 +136,9 @@ to supply your own DCT quantization tables; the existing quality-scaling code
has been developed for 8-bit data precision and probably doesn't generate
especially good tables for 12-bit data precision.
Functions that are specific to 12-bit data precision have a prefix of "jpeg12_"
instead of "jpeg_" and use the following data types and macros:
Functions that are specific to 9-bit through 12-bit data precision have a
prefix of "jpeg12_" instead of "jpeg_" and use the following data types and
macros:
* J12SAMPLE instead of JSAMPLE
* J12SAMPROW instead of JSAMPROW
@@ -144,8 +147,9 @@ instead of "jpeg_" and use the following data types and macros:
* MAXJ12SAMPLE instead of MAXJSAMPLE
* CENTERJ12SAMPLE instead of CENTERJSAMPLE
Functions that are specific to 16-bit data precision have a prefix of "jpeg16_"
instead of "jpeg_" and use the following data types and macros:
Functions that are specific to 13-bit through 16-bit data precision have a
prefix of "jpeg16_" instead of "jpeg_" and use the following data types and
macros:
* J16SAMPLE instead of JSAMPLE
* J16SAMPROW instead of JSAMPROW
@@ -154,17 +158,17 @@ instead of "jpeg_" and use the following data types and macros:
* MAXJ16SAMPLE instead of MAXJSAMPLE
* CENTERJ16SAMPLE instead of CENTERJSAMPLE
This allows 8-bit, 12-bit, and 16-bit data precision to be used in a single
application. (Refer to example.c). Arithmetic coding and SIMD acceleration
are not currently implemented for 12-bit data precision, nor are they
implemented for lossless mode with any data precision.
This allows multiple data precisions to be used in a single application.
(Refer to example.c). Arithmetic coding and SIMD acceleration are currently
only implemented for lossy mode with 8-bit data precision.
Refer to the descriptions of the data_precision compression and decompression
parameters below for further information.
This documentation uses "J*SAMPLE", "J*SAMPROW", "J*SAMPARRAY", and
"J*SAMPIMAGE" to generically refer to the 8-bit-per-sample, 12-bit-per-sample,
or 16-bit-per-sample data types.
"J*SAMPIMAGE" to generically refer to the data types with 2 to 8 bits of data
precision per sample, 9 to 12 bits of data precision per sample, and 13 to 16
bits of data precision per sample.
Outline of typical usage
@@ -178,9 +182,11 @@ The rough outline of a JPEG compression operation is:
jpeg_start_compress(...);
while (scan lines remain to be written)
jpeg_write_scanlines(...); /* Use jpeg12_write_scanlines() for
12-bit data precision and
9-bit through 12-bit data
precision and
jpeg16_write_scanlines() for
16-bit data precision. */
13-bit through 16-bit data
precision. */
jpeg_finish_compress(...);
Release the JPEG compression object
@@ -208,9 +214,11 @@ Similarly, the rough outline of a JPEG decompression operation is:
jpeg_start_decompress(...);
while (scan lines remain to be read)
jpeg_read_scanlines(...); /* Use jpeg12_read_scanlines() for
12-bit data precision and
9-bit through 12-bit data
precision and
jpeg16_read_scanlines() for
16-bit data precision. */
13-bit through 16-bit data
precision. */
jpeg_finish_decompress(...);
Release the JPEG decompression object
@@ -287,13 +295,6 @@ processed top-to-bottom. You can process an entire image in one call if you
have it all in memory, but usually it's simplest to process one scanline at
a time.
For best results, source data values should have the precision specified by
cinfo->data_precision (normally 8 bits per sample). For instance, if you
choose to compress data that's only 6 bits/channel, you should left-justify
each value in a byte before passing it to the compressor. If you need to
compress data that has more than 8 bits/channel, set cinfo->data_precision = 12
or 16.
The data format returned by the decompressor is the same in all details,
except that colormapped output is supported. (Again, a JPEG file is never
@@ -443,10 +444,10 @@ the compression cycle.
5. while (scan lines remain to be written)
jpeg_write_scanlines(...); /* Use jpeg12_write_scanlines() for 12-bit
data precision and
jpeg16_write_scanlines() for 16-bit data
precision. */
jpeg_write_scanlines(...); /* Use jpeg12_write_scanlines() for 9-bit
through 12-bit data precision and
jpeg16_write_scanlines() for 13-bit
through 16-bit data precision. */
Now write all the required image data by calling jpeg*_write_scanlines()
one or more times. You can pass one or more scanlines in each call, up
@@ -472,17 +473,19 @@ example.c shows the following code for the case of a full-size 2-D source
array containing 3-byte RGB pixels:
JSAMPROW row_pointer[1]; /* pointer to a single row
Use J12SAMPROW for 12-bit data
precision and J16SAMPROW for 16-bit
data precision. */
Use J12SAMPROW for 9-bit through
12-bit data precision and J16SAMPROW
for 13-bit through 16-bit data
precision. */
while (cinfo.next_scanline < cinfo.image_height) {
row_pointer[0] = image_buffer[cinfo.next_scanline];
jpeg_write_scanlines(&cinfo, row_pointer, 1);
/* Use jpeg12_write_scanlines() for
12-bit data precision and
jpeg16_write_scanlines() for 16-bit
data precision. */
9-bit through 12-bit data precision
and jpeg16_write_scanlines() for
13-bit through 16-bit data
precision. */
}
jpeg*_write_scanlines() returns the number of scanlines actually written.
@@ -726,10 +729,10 @@ relevant parameters (scaling, output color space, and quantization flag).
6. while (scan lines remain to be read)
jpeg_read_scanlines(...); /* Use jpeg12_read_scanlines() for 12-bit
data precision and
jpeg16_read_scanlines() for 16-bit data
precision. */
jpeg_read_scanlines(...); /* Use jpeg12_read_scanlines() for 9-bit
through 12-bit data precision and
jpeg16_read_scanlines() for 13-bit
through 16-bit data precision. */
Now you can read the decompressed image data by calling jpeg*_read_scanlines()
one or more times. At each call, you pass in the maximum number of scanlines
@@ -1083,14 +1086,14 @@ boolean arith_code
If FALSE, use Huffman coding.
int data_precision
To create a 12-bit-per-sample JPEG file, set data_precision to 12 prior
to calling jpeg_start_compress() or using the memory manager, then use
Prior to calling jpeg_start_compress() or using the memory manager, set
data_precision to the desired number of bits per sample (2 to 16) in
the JPEG file. To create a JPEG file with 9 to 12 bits per sample, use
jpeg12_write_scanlines() or jpeg12_write_raw_data() instead of
jpeg_write_scanlines() or jpeg_write_raw_data(). To create a
16-bit-per-sample lossless JPEG file, set data_precision to 16 prior to
calling jpeg_start_compress() or using the memory manager, then use
jpeg16_write_scanlines() instead of jpeg_write_scanlines(). Note that
16-bit data precision requires lossless mode. (See
jpeg_write_scanlines() or jpeg_write_raw_data(). To create a lossless
JPEG file with 13 to 16 bits per sample, use jpeg16_write_scanlines()
instead of jpeg_write_scanlines(). Note that data precisions other
than 8-bit and 12-bit require lossless mode. (See
jpeg_enable_lossless().)
J_DCT_METHOD dct_method
@@ -1318,11 +1321,11 @@ The following fields in the JPEG object are set by jpeg_read_header() and
may be useful to the application in choosing decompression parameters:
int data_precision Data precision (bits per sample)
If data_precision is 12, then use jpeg12_read_scanlines(),
If data_precision is 9 to 12, then use jpeg12_read_scanlines(),
jpeg12_skip_scanlines(), jpeg12_crop_scanline(), and/or
jpeg12_read_raw_data() instead of jpeg_read_scanlines(),
jpeg_skip_scanlines(), jpeg_crop_scanline(), and/or
jpeg_read_raw_data(). If data_precision is 16, then use
jpeg_read_raw_data(). If data_precision is 13 to 16, then use
jpeg16_read_scanlines() instead of jpeg_read_scanlines().
JDIMENSION image_width Width and height of image
@@ -2122,9 +2125,10 @@ The basic control flow for buffered-image decoding is
jpeg_start_output() /* start a new output pass */
for (all scanlines in image) {
jpeg_read_scanlines() /* Use jpeg12_read_scanlines() for
12-bit data precision and
jpeg16_read_scanlines() for 16-bit
data precision. */
9-bit through 12-bit data precision
and jpeg16_read_scanlines() for
13-bit through 16-bit data
precision. */
display scanlines
}
jpeg_finish_output() /* terminate output pass */
@@ -3191,11 +3195,11 @@ As of v6b, the decompressor requires:
This does not count any memory allocated by the application, such as a
buffer to hold the final output image.
The above figures are valid for 8-bit JPEG data precision and a machine with
32-bit ints. For 12-bit-per-sample and 16-bit-per-sample JPEG data, double the
size of the strip buffers and quantization pixel buffer. The "fixed-size" data
will be somewhat smaller with 16-bit ints, larger with 64-bit ints. Also, CMYK
or other unusual color spaces will require different amounts of space.
The above figures are valid for 2-bit through 8-bit JPEG data precision and a
machine with 32-bit ints. For other data precisions, double the size of the
strip buffers and quantization pixel buffer. The "fixed-size" data will be
somewhat smaller with 16-bit ints, larger with 64-bit ints. Also, CMYK or
other unusual color spaces will require different amounts of space.
The full-image coefficient and pixel buffers, if needed at all, do not
have to be fully RAM resident; you can have the library use temporary

View File

@@ -22,7 +22,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.1</span>
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.2</span>
</div>
</td>
</tr>

View File

@@ -22,7 +22,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.1</span>
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.2</span>
</div>
</td>
</tr>

View File

@@ -22,7 +22,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.1</span>
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.2</span>
</div>
</td>
</tr>

View File

@@ -22,7 +22,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.1</span>
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.2</span>
</div>
</td>
</tr>

View File

@@ -22,7 +22,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.1</span>
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.2</span>
</div>
</td>
</tr>
@@ -278,13 +278,13 @@ Functions</h2></td></tr>
<tr class="memdesc:ga34af9ba3183bdf0ec7c8f47bb9a4c84f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the value of a parameter. <br /></td></tr>
<tr class="separator:ga34af9ba3183bdf0ec7c8f47bb9a4c84f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2cc418a2dab709ad7f30f5b25905f138" id="r_ga2cc418a2dab709ad7f30f5b25905f138"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga2cc418a2dab709ad7f30f5b25905f138">tj3Compress8</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf, size_t *jpegSize)</td></tr>
<tr class="memdesc:ga2cc418a2dab709ad7f30f5b25905f138"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compress an 8-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into an 8-bit-per-sample JPEG image. <br /></td></tr>
<tr class="memdesc:ga2cc418a2dab709ad7f30f5b25905f138"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compress a packed-pixel RGB, grayscale, or CMYK image with 2 to 8 bits of data precision per sample into a JPEG image with the same data precision. <br /></td></tr>
<tr class="separator:ga2cc418a2dab709ad7f30f5b25905f138"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9a1968c384ec7abb6122830253ebf570" id="r_ga9a1968c384ec7abb6122830253ebf570"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9a1968c384ec7abb6122830253ebf570">tj3Compress12</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const short *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf, size_t *jpegSize)</td></tr>
<tr class="memdesc:ga9a1968c384ec7abb6122830253ebf570"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compress a 12-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into a 12-bit-per-sample JPEG image. <br /></td></tr>
<tr class="memdesc:ga9a1968c384ec7abb6122830253ebf570"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compress a packed-pixel RGB, grayscale, or CMYK image with 9 to 12 bits of data precision per sample into a JPEG image with the same data precision. <br /></td></tr>
<tr class="separator:ga9a1968c384ec7abb6122830253ebf570"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga77901b71d0471784f318ada31ff4e7bd" id="r_ga77901b71d0471784f318ada31ff4e7bd"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga77901b71d0471784f318ada31ff4e7bd">tj3Compress16</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned short *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf, size_t *jpegSize)</td></tr>
<tr class="memdesc:ga77901b71d0471784f318ada31ff4e7bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compress a 16-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into a 16-bit-per-sample lossless JPEG image. <br /></td></tr>
<tr class="memdesc:ga77901b71d0471784f318ada31ff4e7bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compress a packed-pixel RGB, grayscale, or CMYK image with 13 to 16 bits of data precision per sample into a lossless JPEG image with the same data precision. <br /></td></tr>
<tr class="separator:ga77901b71d0471784f318ada31ff4e7bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga041c870d9c669eb3f385c78f4346c43f" id="r_ga041c870d9c669eb3f385c78f4346c43f"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga041c870d9c669eb3f385c78f4346c43f">tj3CompressFromYUV8</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int align, int height, unsigned char **jpegBuf, size_t *jpegSize)</td></tr>
<tr class="memdesc:ga041c870d9c669eb3f385c78f4346c43f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compress an 8-bit-per-sample unified planar YUV image into an 8-bit-per-sample JPEG image. <br /></td></tr>
@@ -326,13 +326,13 @@ Functions</h2></td></tr>
<tr class="memdesc:gaa49c7bd4c9431667a043cfc93388ba1c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the cropping region for partially decompressing a lossy JPEG image into a packed-pixel image. <br /></td></tr>
<tr class="separator:gaa49c7bd4c9431667a043cfc93388ba1c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1169c7c1a26ec18c9e6122cb8ae64013" id="r_ga1169c7c1a26ec18c9e6122cb8ae64013"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga1169c7c1a26ec18c9e6122cb8ae64013">tj3Decompress8</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, size_t jpegSize, unsigned char *dstBuf, int pitch, int pixelFormat)</td></tr>
<tr class="memdesc:ga1169c7c1a26ec18c9e6122cb8ae64013"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress an 8-bit-per-sample JPEG image into an 8-bit-per-sample packed-pixel RGB, grayscale, or CMYK image. <br /></td></tr>
<tr class="memdesc:ga1169c7c1a26ec18c9e6122cb8ae64013"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress a JPEG image with 2 to 8 bits of data precision per sample into a packed-pixel RGB, grayscale, or CMYK image with the same data precision. <br /></td></tr>
<tr class="separator:ga1169c7c1a26ec18c9e6122cb8ae64013"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga39b848f01781ad74a5b3941c012b6199" id="r_ga39b848f01781ad74a5b3941c012b6199"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga39b848f01781ad74a5b3941c012b6199">tj3Decompress12</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, size_t jpegSize, short *dstBuf, int pitch, int pixelFormat)</td></tr>
<tr class="memdesc:ga39b848f01781ad74a5b3941c012b6199"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress a 12-bit-per-sample JPEG image into a 12-bit-per-sample packed-pixel RGB, grayscale, or CMYK image. <br /></td></tr>
<tr class="memdesc:ga39b848f01781ad74a5b3941c012b6199"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress a JPEG image with 9 to 12 bits of data precision per sample into a packed-pixel RGB, grayscale, or CMYK image with the same data precision. <br /></td></tr>
<tr class="separator:ga39b848f01781ad74a5b3941c012b6199"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa074e63f9beb0b3ff42b833a4049df6e" id="r_gaa074e63f9beb0b3ff42b833a4049df6e"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaa074e63f9beb0b3ff42b833a4049df6e">tj3Decompress16</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, size_t jpegSize, unsigned short *dstBuf, int pitch, int pixelFormat)</td></tr>
<tr class="memdesc:gaa074e63f9beb0b3ff42b833a4049df6e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress a 16-bit-per-sample lossless JPEG image into a 16-bit-per-sample packed-pixel RGB, grayscale, or CMYK image. <br /></td></tr>
<tr class="memdesc:gaa074e63f9beb0b3ff42b833a4049df6e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress a lossless JPEG image with 13 to 16 bits of data precision per sample into a packed-pixel RGB, grayscale, or CMYK image with the same data precision. <br /></td></tr>
<tr class="separator:gaa074e63f9beb0b3ff42b833a4049df6e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1e6bf6a19fec3f9fa7534348879d8320" id="r_ga1e6bf6a19fec3f9fa7534348879d8320"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga1e6bf6a19fec3f9fa7534348879d8320">tj3DecompressToYUV8</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, size_t jpegSize, unsigned char *dstBuf, int align)</td></tr>
<tr class="memdesc:ga1e6bf6a19fec3f9fa7534348879d8320"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decompress an 8-bit-per-sample JPEG image into an 8-bit-per-sample unified planar YUV image. <br /></td></tr>
@@ -356,22 +356,22 @@ Functions</h2></td></tr>
<tr class="memdesc:ga1a2c96d8b47530b6e6050ba6f10b7c57"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate a byte buffer for use with TurboJPEG. <br /></td></tr>
<tr class="separator:ga1a2c96d8b47530b6e6050ba6f10b7c57"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga884023536e70985616126a073f662001" id="r_ga884023536e70985616126a073f662001"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga884023536e70985616126a073f662001">tj3LoadImage8</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const char *filename, int *width, int align, int *height, int *pixelFormat)</td></tr>
<tr class="memdesc:ga884023536e70985616126a073f662001"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load an 8-bit-per-sample packed-pixel image from disk into memory. <br /></td></tr>
<tr class="memdesc:ga884023536e70985616126a073f662001"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load a packed-pixel image with 2 to 8 bits of data precision per sample from disk into memory. <br /></td></tr>
<tr class="separator:ga884023536e70985616126a073f662001"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa1d3772cfdb53afa21aae3c606238d44" id="r_gaa1d3772cfdb53afa21aae3c606238d44"><td class="memItemLeft" align="right" valign="top">DLLEXPORT short *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaa1d3772cfdb53afa21aae3c606238d44">tj3LoadImage12</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const char *filename, int *width, int align, int *height, int *pixelFormat)</td></tr>
<tr class="memdesc:gaa1d3772cfdb53afa21aae3c606238d44"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load a 12-bit-per-sample packed-pixel image from disk into memory. <br /></td></tr>
<tr class="memdesc:gaa1d3772cfdb53afa21aae3c606238d44"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load a packed-pixel image with 9 to 12 bits of data precision per sample from disk into memory. <br /></td></tr>
<tr class="separator:gaa1d3772cfdb53afa21aae3c606238d44"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gace4240b665dc47742cbb3b76b03dfd69" id="r_gace4240b665dc47742cbb3b76b03dfd69"><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned short *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gace4240b665dc47742cbb3b76b03dfd69">tj3LoadImage16</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const char *filename, int *width, int align, int *height, int *pixelFormat)</td></tr>
<tr class="memdesc:gace4240b665dc47742cbb3b76b03dfd69"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load a 16-bit-per-sample packed-pixel image from disk into memory. <br /></td></tr>
<tr class="memdesc:gace4240b665dc47742cbb3b76b03dfd69"><td class="mdescLeft">&#160;</td><td class="mdescRight">Load a packed-pixel image with 13 to 16 bits of data precision per sample from disk into memory. <br /></td></tr>
<tr class="separator:gace4240b665dc47742cbb3b76b03dfd69"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa4ec838988e469cc15618e4690cc8722" id="r_gaa4ec838988e469cc15618e4690cc8722"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaa4ec838988e469cc15618e4690cc8722">tj3SaveImage8</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const char *filename, const unsigned char *buffer, int width, int pitch, int height, int pixelFormat)</td></tr>
<tr class="memdesc:gaa4ec838988e469cc15618e4690cc8722"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save an 8-bit-per-sample packed-pixel image from memory to disk. <br /></td></tr>
<tr class="memdesc:gaa4ec838988e469cc15618e4690cc8722"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save a packed-pixel image with 2 to 8 bits of data precision per sample from memory to disk. <br /></td></tr>
<tr class="separator:gaa4ec838988e469cc15618e4690cc8722"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7c64b5106d04267a46aad85f9714ad90" id="r_ga7c64b5106d04267a46aad85f9714ad90"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga7c64b5106d04267a46aad85f9714ad90">tj3SaveImage12</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const char *filename, const short *buffer, int width, int pitch, int height, int pixelFormat)</td></tr>
<tr class="memdesc:ga7c64b5106d04267a46aad85f9714ad90"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save a 12-bit-per-sample packed-pixel image from memory to disk. <br /></td></tr>
<tr class="memdesc:ga7c64b5106d04267a46aad85f9714ad90"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save a packed-pixel image with 9 to 12 bits of data precision per sample from memory to disk. <br /></td></tr>
<tr class="separator:ga7c64b5106d04267a46aad85f9714ad90"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0fd87851f4266aca24bf4594dd0c0e71" id="r_ga0fd87851f4266aca24bf4594dd0c0e71"><td class="memItemLeft" align="right" valign="top">DLLEXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga0fd87851f4266aca24bf4594dd0c0e71">tj3SaveImage16</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const char *filename, const unsigned short *buffer, int width, int pitch, int height, int pixelFormat)</td></tr>
<tr class="memdesc:ga0fd87851f4266aca24bf4594dd0c0e71"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save a 16-bit-per-sample packed-pixel image from memory to disk. <br /></td></tr>
<tr class="memdesc:ga0fd87851f4266aca24bf4594dd0c0e71"><td class="mdescLeft">&#160;</td><td class="mdescRight">Save a packed-pixel image with 13 to 16 bits of data precision per sample from memory to disk. <br /></td></tr>
<tr class="separator:ga0fd87851f4266aca24bf4594dd0c0e71"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaddb84fb6c81769e9faa0f5a63b296606" id="r_gaddb84fb6c81769e9faa0f5a63b296606"><td class="memItemLeft" align="right" valign="top">DLLEXPORT void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaddb84fb6c81769e9faa0f5a63b296606">tj3Free</a> (void *buffer)</td></tr>
<tr class="memdesc:gaddb84fb6c81769e9faa0f5a63b296606"><td class="mdescLeft">&#160;</td><td class="mdescRight">Free a byte buffer previously allocated by TurboJPEG. <br /></td></tr>
@@ -861,12 +861,13 @@ scalingFactor)</code>. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82a8f76673be73f2b659440a9572a65a95f" name="ggaa0f6be63ba78278299c9f5c12031fe82a8f76673be73f2b659440a9572a65a95f"></a>TJPARAM_JPEGHEIGHT&#160;</td><td class="fielddoc"><p>JPEG height (in pixels) [decompression only, read-only]. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" name="ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8"></a>TJPARAM_PRECISION&#160;</td><td class="fielddoc"><p>JPEG data precision (bits per sample) [decompression only, read-only]. </p>
<p>The JPEG image uses the specified number of bits per sample.</p>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" name="ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8"></a>TJPARAM_PRECISION&#160;</td><td class="fielddoc"><p>Data precision (bits per sample) </p>
<p>The JPEG image uses (decompression) or will use (lossless compression) the specified number of bits per sample. This parameter also specifies the target data precision when loading a PBMPLUS file with <a class="el" href="group___turbo_j_p_e_g.html#ga884023536e70985616126a073f662001" title="Load a packed-pixel image with 2 to 8 bits of data precision per sample from disk into memory.">tj3LoadImage8()</a>, <a class="el" href="group___turbo_j_p_e_g.html#gaa1d3772cfdb53afa21aae3c606238d44" title="Load a packed-pixel image with 9 to 12 bits of data precision per sample from disk into memory.">tj3LoadImage12()</a>, or <a class="el" href="group___turbo_j_p_e_g.html#gace4240b665dc47742cbb3b76b03dfd69" title="Load a packed-pixel image with 13 to 16 bits of data precision per sample from disk into memory.">tj3LoadImage16()</a> and the source data precision when saving a PBMPLUS file with <a class="el" href="group___turbo_j_p_e_g.html#gaa4ec838988e469cc15618e4690cc8722" title="Save a packed-pixel image with 2 to 8 bits of data precision per sample from memory to disk.">tj3SaveImage8()</a>, <a class="el" href="group___turbo_j_p_e_g.html#ga7c64b5106d04267a46aad85f9714ad90" title="Save a packed-pixel image with 9 to 12 bits of data precision per sample from memory to disk.">tj3SaveImage12()</a>, or <a class="el" href="group___turbo_j_p_e_g.html#ga0fd87851f4266aca24bf4594dd0c0e71" title="Save a packed-pixel image with 13 to 16 bits of data precision per sample from memory to disk.">tj3SaveImage16()</a>.</p>
<p>The data precision is the number of bits in the maximum sample value, which may not be the same as the width of the data type used to store the sample.</p>
<p><b>Value</b></p><ul>
<li><code>8</code>, <code>12</code>, or <code>16</code></li>
<li><code>8</code> or <code>12</code> for lossy JPEG images; <code>2</code> to <code>16</code> for lossless JPEG and PBMPLUS images</li>
</ul>
<p>12-bit data precision implies <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a8f0af9afc0b36443751f9ee82b760aa6" title="Optimized baseline entropy coding [lossy compression only].">TJPARAM_OPTIMIZE</a> unless <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a1c756757384308145602c040524aebf7" title="Arithmetic entropy coding.">TJPARAM_ARITHMETIC</a> is set. </p>
<p>12-bit JPEG data precision implies <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a8f0af9afc0b36443751f9ee82b760aa6" title="Optimized baseline entropy coding [lossy compression only].">TJPARAM_OPTIMIZE</a> unless <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a1c756757384308145602c040524aebf7" title="Arithmetic entropy coding.">TJPARAM_ARITHMETIC</a> is set. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82a46a10d46309514907d0c39fcd86c324c" name="ggaa0f6be63ba78278299c9f5c12031fe82a46a10d46309514907d0c39fcd86c324c"></a>TJPARAM_COLORSPACE&#160;</td><td class="fielddoc"><p>JPEG colorspace. </p>
<p>The JPEG image uses (decompression) or will use (lossy compression) the specified colorspace.</p>
@@ -969,7 +970,7 @@ scalingFactor)</code>. </p>
<li><code>0</code> through <em><b>precision</b></em> <em>- 1</em>, where <em><b>precision</b></em> is the JPEG data precision in bits <em>[default for compression: <code>0</code>]</em></li>
</ul>
<p>A point transform value of <code>0</code> is necessary in order to generate a fully lossless JPEG image. (A non-zero point transform value right-shifts the input samples by the specified number of bits, which is effectively a form of lossy color quantization.)</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a249f35f0770792b19f995e603bb17c6f" title="Lossless JPEG.">TJPARAM_LOSSLESS</a>, <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="JPEG data precision (bits per sample) [decompression only, read-only].">TJPARAM_PRECISION</a> </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a249f35f0770792b19f995e603bb17c6f" title="Lossless JPEG.">TJPARAM_LOSSLESS</a>, <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> </dd></dl>
</td></tr>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82a343c72883b7160f23f3ef46fc548a0ec" name="ggaa0f6be63ba78278299c9f5c12031fe82a343c72883b7160f23f3ef46fc548a0ec"></a>TJPARAM_RESTARTBLOCKS&#160;</td><td class="fielddoc"><p>JPEG restart marker interval in MCU blocks (lossy) or samples (lossless) [compression only]. </p>
<p>The nature of entropy coding is such that a corrupt JPEG image cannot be decompressed beyond the point of corruption unless it contains restart markers. A restart marker stops and restarts the entropy coding algorithm so that, if a JPEG image is corrupted, decompression can resume at the next marker. Thus, adding more restart markers improves the fault tolerance of the JPEG image, but adding too many restart markers can adversely affect the compression ratio and performance.</p>
@@ -989,14 +990,14 @@ scalingFactor)</code>. </p>
<p><b>Value</b></p><ul>
<li>The JPEG image has (decompression) or will have (compression) the specified horizontal pixel density <em>[default for compression: <code>1</code>]</em>.</li>
</ul>
<p>This value is stored in or read from the JPEG header. It does not affect the contents of the JPEG image. Note that this parameter is set by <a class="el" href="group___turbo_j_p_e_g.html#ga884023536e70985616126a073f662001" title="Load an 8-bit-per-sample packed-pixel image from disk into memory.">tj3LoadImage8()</a> when loading a Windows BMP file that contains pixel density information, and the value of this parameter is stored to a Windows BMP file by <a class="el" href="group___turbo_j_p_e_g.html#gaa4ec838988e469cc15618e4690cc8722" title="Save an 8-bit-per-sample packed-pixel image from memory to disk.">tj3SaveImage8()</a> if the value of <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a4c045981bd8a303521a401dbbe1df208" title="JPEG pixel density units.">TJPARAM_DENSITYUNITS</a> is <code>2</code>.</p>
<p>This value is stored in or read from the JPEG header. It does not affect the contents of the JPEG image. Note that this parameter is set by <a class="el" href="group___turbo_j_p_e_g.html#ga884023536e70985616126a073f662001" title="Load a packed-pixel image with 2 to 8 bits of data precision per sample from disk into memory.">tj3LoadImage8()</a> when loading a Windows BMP file that contains pixel density information, and the value of this parameter is stored to a Windows BMP file by <a class="el" href="group___turbo_j_p_e_g.html#gaa4ec838988e469cc15618e4690cc8722" title="Save a packed-pixel image with 2 to 8 bits of data precision per sample from memory to disk.">tj3SaveImage8()</a> if the value of <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a4c045981bd8a303521a401dbbe1df208" title="JPEG pixel density units.">TJPARAM_DENSITYUNITS</a> is <code>2</code>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a4c045981bd8a303521a401dbbe1df208" title="JPEG pixel density units.">TJPARAM_DENSITYUNITS</a> </dd></dl>
</td></tr>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82abda48f2df7eb9b88e2b7621efb017eba" name="ggaa0f6be63ba78278299c9f5c12031fe82abda48f2df7eb9b88e2b7621efb017eba"></a>TJPARAM_YDENSITY&#160;</td><td class="fielddoc"><p>JPEG vertical pixel density. </p>
<p><b>Value</b></p><ul>
<li>The JPEG image has (decompression) or will have (compression) the specified vertical pixel density <em>[default for compression: <code>1</code>]</em>.</li>
</ul>
<p>This value is stored in or read from the JPEG header. It does not affect the contents of the JPEG image. Note that this parameter is set by <a class="el" href="group___turbo_j_p_e_g.html#ga884023536e70985616126a073f662001" title="Load an 8-bit-per-sample packed-pixel image from disk into memory.">tj3LoadImage8()</a> when loading a Windows BMP file that contains pixel density information, and the value of this parameter is stored to a Windows BMP file by <a class="el" href="group___turbo_j_p_e_g.html#gaa4ec838988e469cc15618e4690cc8722" title="Save an 8-bit-per-sample packed-pixel image from memory to disk.">tj3SaveImage8()</a> if the value of <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a4c045981bd8a303521a401dbbe1df208" title="JPEG pixel density units.">TJPARAM_DENSITYUNITS</a> is <code>2</code>.</p>
<p>This value is stored in or read from the JPEG header. It does not affect the contents of the JPEG image. Note that this parameter is set by <a class="el" href="group___turbo_j_p_e_g.html#ga884023536e70985616126a073f662001" title="Load a packed-pixel image with 2 to 8 bits of data precision per sample from disk into memory.">tj3LoadImage8()</a> when loading a Windows BMP file that contains pixel density information, and the value of this parameter is stored to a Windows BMP file by <a class="el" href="group___turbo_j_p_e_g.html#gaa4ec838988e469cc15618e4690cc8722" title="Save a packed-pixel image with 2 to 8 bits of data precision per sample from memory to disk.">tj3SaveImage8()</a> if the value of <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a4c045981bd8a303521a401dbbe1df208" title="JPEG pixel density units.">TJPARAM_DENSITYUNITS</a> is <code>2</code>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a4c045981bd8a303521a401dbbe1df208" title="JPEG pixel density units.">TJPARAM_DENSITYUNITS</a> </dd></dl>
</td></tr>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82a4c045981bd8a303521a401dbbe1df208" name="ggaa0f6be63ba78278299c9f5c12031fe82a4c045981bd8a303521a401dbbe1df208"></a>TJPARAM_DENSITYUNITS&#160;</td><td class="fielddoc"><p>JPEG pixel density units. </p>
@@ -1005,7 +1006,7 @@ scalingFactor)</code>. </p>
<li><code>1</code> The pixel density of the JPEG image is expressed (decompression) or will be expressed (compression) in units of pixels/inch.</li>
<li><code>2</code> The pixel density of the JPEG image is expressed (decompression) or will be expressed (compression) in units of pixels/cm.</li>
</ul>
<p>This value is stored in or read from the JPEG header. It does not affect the contents of the JPEG image. Note that this parameter is set by <a class="el" href="group___turbo_j_p_e_g.html#ga884023536e70985616126a073f662001" title="Load an 8-bit-per-sample packed-pixel image from disk into memory.">tj3LoadImage8()</a> when loading a Windows BMP file that contains pixel density information, and the value of this parameter is stored to a Windows BMP file by <a class="el" href="group___turbo_j_p_e_g.html#gaa4ec838988e469cc15618e4690cc8722" title="Save an 8-bit-per-sample packed-pixel image from memory to disk.">tj3SaveImage8()</a> if the value is <code>2</code>.</p>
<p>This value is stored in or read from the JPEG header. It does not affect the contents of the JPEG image. Note that this parameter is set by <a class="el" href="group___turbo_j_p_e_g.html#ga884023536e70985616126a073f662001" title="Load a packed-pixel image with 2 to 8 bits of data precision per sample from disk into memory.">tj3LoadImage8()</a> when loading a Windows BMP file that contains pixel density information, and the value of this parameter is stored to a Windows BMP file by <a class="el" href="group___turbo_j_p_e_g.html#gaa4ec838988e469cc15618e4690cc8722" title="Save a packed-pixel image with 2 to 8 bits of data precision per sample from memory to disk.">tj3SaveImage8()</a> if the value is <code>2</code>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a4de5c9d7cab5be806143a43c3b0e0877" title="JPEG horizontal pixel density.">TJPARAM_XDENSITY</a>, <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82abda48f2df7eb9b88e2b7621efb017eba" title="JPEG vertical pixel density.">TJPARAM_YDENSITY</a> </dd></dl>
</td></tr>
<tr><td class="fieldname"><a id="ggaa0f6be63ba78278299c9f5c12031fe82a0de0a8281da45d1fc984edc8918f7dd2" name="ggaa0f6be63ba78278299c9f5c12031fe82a0de0a8281da45d1fc984edc8918f7dd2"></a>TJPARAM_MAXMEMORY&#160;</td><td class="fielddoc"><p>Memory limit for intermediate buffers. </p>
@@ -1056,7 +1057,7 @@ scalingFactor)</code>. </p>
<p>The red, green, and blue components in the image are stored in 4-sample pixels in the order B, G, R from highest to lowest memory address within each pixel. The X component is ignored when compressing and undefined when decompressing. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a" name="ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a"></a>TJPF_GRAY&#160;</td><td class="fielddoc"><p>Grayscale pixel format. </p>
<p>Each 1-sample pixel represents a luminance (brightness) level from 0 to the maximum sample value (255 for 8-bit samples, 4095 for 12-bit samples, and 65535 for 16-bit samples.) </p>
<p>Each 1-sample pixel represents a luminance (brightness) level from 0 to the maximum sample value (which is, for instance, 255 for 8-bit samples or 4095 for 12-bit samples or 65535 for 16-bit samples.) </p>
</td></tr>
<tr><td class="fieldname"><a id="ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12" name="ggac916144e26c3817ac514e64ae5d12e2aa88d2e88fab67f6503cf972e14851cc12"></a>TJPF_RGBA&#160;</td><td class="fielddoc"><p>RGBA pixel format. </p>
<p>This is the same as <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01">TJPF_RGBX</a>, except that when decompressing, the X component is guaranteed to be equal to the maximum sample value, which can be interpreted as an opaque alpha channel. </p>
@@ -1074,7 +1075,7 @@ scalingFactor)</code>. </p>
<p>Unlike RGB, which is an additive color model used primarily for display, CMYK (Cyan/Magenta/Yellow/Key) is a subtractive color model used primarily for printing. In the CMYK color model, the value of each color component typically corresponds to an amount of cyan, magenta, yellow, or black ink that is applied to a white background. In order to convert between CMYK and RGB, it is necessary to use a color management system (CMS.) A CMS will attempt to map colors within the printer's gamut to perceptually similar colors in the display's gamut and vice versa, but the mapping is typically not 1:1 or reversible, nor can it be defined with a simple formula. Thus, such a conversion is out of scope for a codec library. However, the TurboJPEG API allows for compressing packed-pixel CMYK images into YCCK JPEG images (see <a class="el" href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e" title="YCCK colorspace.">TJCS_YCCK</a>) and decompressing YCCK JPEG images into packed-pixel CMYK images. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed" name="ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed"></a>TJPF_UNKNOWN&#160;</td><td class="fielddoc"><p>Unknown pixel format. </p>
<p>Currently this is only used by <a class="el" href="group___turbo_j_p_e_g.html#ga884023536e70985616126a073f662001" title="Load an 8-bit-per-sample packed-pixel image from disk into memory.">tj3LoadImage8()</a>, <a class="el" href="group___turbo_j_p_e_g.html#gaa1d3772cfdb53afa21aae3c606238d44" title="Load a 12-bit-per-sample packed-pixel image from disk into memory.">tj3LoadImage12()</a>, and <a class="el" href="group___turbo_j_p_e_g.html#gace4240b665dc47742cbb3b76b03dfd69" title="Load a 16-bit-per-sample packed-pixel image from disk into memory.">tj3LoadImage16()</a>. </p>
<p>Currently this is only used by <a class="el" href="group___turbo_j_p_e_g.html#ga884023536e70985616126a073f662001" title="Load a packed-pixel image with 2 to 8 bits of data precision per sample from disk into memory.">tj3LoadImage8()</a>, <a class="el" href="group___turbo_j_p_e_g.html#gaa1d3772cfdb53afa21aae3c606238d44" title="Load a packed-pixel image with 9 to 12 bits of data precision per sample from disk into memory.">tj3LoadImage12()</a>, and <a class="el" href="group___turbo_j_p_e_g.html#gace4240b665dc47742cbb3b76b03dfd69" title="Load a packed-pixel image with 13 to 16 bits of data precision per sample from disk into memory.">tj3LoadImage16()</a>. </p>
</td></tr>
</table>
@@ -1261,11 +1262,11 @@ scalingFactor)</code>. </p>
</table>
</div><div class="memdoc">
<p>Compress a 12-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into a 12-bit-per-sample JPEG image. </p>
<p>Compress a packed-pixel RGB, grayscale, or CMYK image with 9 to 12 bits of data precision per sample into a JPEG image with the same data precision. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>handle to a TurboJPEG instance that has been initialized for compression</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to a buffer containing a packed-pixel RGB, grayscale, or CMYK source image to be compressed. This buffer should normally be <code>pitch * height</code> samples in size. However, you can also use this parameter to compress from a specific region of a larger buffer.</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to a buffer containing a packed-pixel RGB, grayscale, or CMYK source image to be compressed. This buffer should normally be <code>pitch * height</code> samples in size. However, you can also use this parameter to compress from a specific region of a larger buffer. The data precision of the source image (from 9 to 12 bits per sample) can be specified using <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> and defaults to 12 if <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> is unset or out of range.</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
<tr><td class="paramname">pitch</td><td>samples per row in the source image. Normally this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in samples) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>, if the image is unpadded. (Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in samples) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.) However, you can also use this parameter to specify the row alignment/padding of the source image, to skip rows, or to compress from a specific region of a larger buffer.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
@@ -1280,7 +1281,7 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga5a23ad0776c5333cda0d7c6d826e9d29" title="Returns a descriptive error message explaining why the last command failed.">tj3GetErrorStr()</a> and <a class="el" href="group___turbo_j_p_e_g.html#gab8c8279f1415fe425ff30dbbc56013bd" title="Returns a code indicating the severity of the last error.">tj3GetErrorCode()</a>.) </dd></dl>
<dl class="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga5a23ad0776c5333cda0d7c6d826e9d29" title="Returns a descriptive error message explaining why the last command failed.">tj3GetErrorStr()</a> and <a class="el" href="group___turbo_j_p_e_g.html#gab8c8279f1415fe425ff30dbbc56013bd" title="Returns a code indicating the severity of the last error.">tj3GetErrorCode()</a>.) </dd></dl>
</div>
</div>
@@ -1346,11 +1347,11 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</div><div class="memdoc">
<p>Compress a 16-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into a 16-bit-per-sample lossless JPEG image. </p>
<p>Compress a packed-pixel RGB, grayscale, or CMYK image with 13 to 16 bits of data precision per sample into a lossless JPEG image with the same data precision. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>handle to a TurboJPEG instance that has been initialized for compression</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to a buffer containing a packed-pixel RGB, grayscale, or CMYK source image to be compressed. This buffer should normally be <code>pitch * height</code> samples in size. However, you can also use this parameter to compress from a specific region of a larger buffer.</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to a buffer containing a packed-pixel RGB, grayscale, or CMYK source image to be compressed. This buffer should normally be <code>pitch * height</code> samples in size. However, you can also use this parameter to compress from a specific region of a larger buffer. The data precision of the source image (from 13 to 16 bits per sample) can be specified using <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> and defaults to 16 if <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> is unset or out of range.</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
<tr><td class="paramname">pitch</td><td>samples per row in the source image. Normally this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in samples) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>, if the image is unpadded. (Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in samples) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.) However, you can also use this parameter to specify the row alignment/padding of the source image, to skip rows, or to compress from a specific region of a larger buffer.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
@@ -1365,7 +1366,7 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga5a23ad0776c5333cda0d7c6d826e9d29" title="Returns a descriptive error message explaining why the last command failed.">tj3GetErrorStr()</a> and <a class="el" href="group___turbo_j_p_e_g.html#gab8c8279f1415fe425ff30dbbc56013bd" title="Returns a code indicating the severity of the last error.">tj3GetErrorCode()</a>.) </dd></dl>
<dl class="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga5a23ad0776c5333cda0d7c6d826e9d29" title="Returns a descriptive error message explaining why the last command failed.">tj3GetErrorStr()</a> and <a class="el" href="group___turbo_j_p_e_g.html#gab8c8279f1415fe425ff30dbbc56013bd" title="Returns a code indicating the severity of the last error.">tj3GetErrorCode()</a>.) </dd></dl>
</div>
</div>
@@ -1431,11 +1432,11 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</div><div class="memdoc">
<p>Compress an 8-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into an 8-bit-per-sample JPEG image. </p>
<p>Compress a packed-pixel RGB, grayscale, or CMYK image with 2 to 8 bits of data precision per sample into a JPEG image with the same data precision. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>handle to a TurboJPEG instance that has been initialized for compression</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to a buffer containing a packed-pixel RGB, grayscale, or CMYK source image to be compressed. This buffer should normally be <code>pitch * height</code> samples in size. However, you can also use this parameter to compress from a specific region of a larger buffer.</td></tr>
<tr><td class="paramname">srcBuf</td><td>pointer to a buffer containing a packed-pixel RGB, grayscale, or CMYK source image to be compressed. This buffer should normally be <code>pitch * height</code> samples in size. However, you can also use this parameter to compress from a specific region of a larger buffer. The data precision of the source image (from 2 to 8 bits per sample) can be specified using <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> and defaults to 8 if <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> is unset or out of range.</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the source image</td></tr>
<tr><td class="paramname">pitch</td><td>samples per row in the source image. Normally this should be <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in samples) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>, if the image is unpadded. (Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in samples) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.) However, you can also use this parameter to specify the row alignment/padding of the source image, to skip rows, or to compress from a specific region of a larger buffer.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the source image</td></tr>
@@ -1822,7 +1823,7 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</div><div class="memdoc">
<p>Decompress a 12-bit-per-sample JPEG image into a 12-bit-per-sample packed-pixel RGB, grayscale, or CMYK image. </p>
<p>Decompress a JPEG image with 9 to 12 bits of data precision per sample into a packed-pixel RGB, grayscale, or CMYK image with the same data precision. </p>
<p>The <a class="el" href="group___turbo_j_p_e_g.html#gaa0f6be63ba78278299c9f5c12031fe82">parameters</a> that describe the JPEG image will be set when this function returns.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
@@ -1889,7 +1890,7 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</div><div class="memdoc">
<p>Decompress a 16-bit-per-sample lossless JPEG image into a 16-bit-per-sample packed-pixel RGB, grayscale, or CMYK image. </p>
<p>Decompress a lossless JPEG image with 13 to 16 bits of data precision per sample into a packed-pixel RGB, grayscale, or CMYK image with the same data precision. </p>
<p>The <a class="el" href="group___turbo_j_p_e_g.html#gaa0f6be63ba78278299c9f5c12031fe82">parameters</a> that describe the JPEG image will be set when this function returns.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
@@ -1956,7 +1957,7 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</div><div class="memdoc">
<p>Decompress an 8-bit-per-sample JPEG image into an 8-bit-per-sample packed-pixel RGB, grayscale, or CMYK image. </p>
<p>Decompress a JPEG image with 2 to 8 bits of data precision per sample into a packed-pixel RGB, grayscale, or CMYK image with the same data precision. </p>
<p>The <a class="el" href="group___turbo_j_p_e_g.html#gaa0f6be63ba78278299c9f5c12031fe82">parameters</a> that describe the JPEG image will be set when this function returns.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
@@ -2598,17 +2599,17 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</div><div class="memdoc">
<p>Load a 12-bit-per-sample packed-pixel image from disk into memory. </p>
<p>Load a packed-pixel image with 9 to 12 bits of data precision per sample from disk into memory. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>handle to a TurboJPEG instance</td></tr>
<tr><td class="paramname">filename</td><td>name of a file containing a packed-pixel image in Windows BMP or PBMPLUS (PPM/PGM) format. Windows BMP files require 8-bit-per-sample data precision. If the data precision of the PBMPLUS file does not match the target data precision, then upconverting or downconverting will be performed.</td></tr>
<tr><td class="paramname">filename</td><td>name of a file containing a packed-pixel image in PBMPLUS (PPM/PGM) format. The target data precision (from 9 to 12 bits per sample) can be specified using <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> and defaults to 12 if <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> is unset or out of range. If the data precision of the PBMPLUS file does not match the target data precision, then upconverting or downconverting will be performed.</td></tr>
<tr><td class="paramname">width</td><td>pointer to an integer variable that will receive the width (in pixels) of the packed-pixel image</td></tr>
<tr><td class="paramname">align</td><td>row alignment (in samples) of the packed-pixel buffer to be returned (must be a power of 2.) Setting this parameter to n will cause all rows in the buffer to be padded to the nearest multiple of n samples (1 = unpadded.)</td></tr>
<tr><td class="paramname">height</td><td>pointer to an integer variable that will receive the height (in pixels) of the packed-pixel image</td></tr>
<tr><td class="paramname">pixelFormat</td><td>pointer to an integer variable that specifies or will receive the pixel format of the packed-pixel buffer. The behavior of this function will vary depending on the value of <code>*pixelFormat</code> passed to the function:<ul>
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed">TJPF_UNKNOWN</a> : The packed-pixel buffer returned by this function will use the most optimal pixel format for the file type, and <code>*pixelFormat</code> will contain the ID of that pixel format upon successful return from this function.</li>
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a> : Only PGM files and 8-bit-per-pixel BMP files with a grayscale colormap can be loaded.</li>
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a> : Only PGM files can be loaded.</li>
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a> : The RGB or grayscale pixels stored in the file will be converted using a quick &amp; dirty algorithm that is suitable only for testing purposes. (Proper conversion between CMYK and other formats requires a color management system.)</li>
<li>Other <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">pixel formats</a> : The packed-pixel buffer will use the specified pixel format, and pixel format conversion will be performed if necessary.</li>
</ul>
@@ -2616,7 +2617,7 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly-allocated buffer containing the packed-pixel image, converted to the chosen pixel format and with the chosen row alignment, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga5a23ad0776c5333cda0d7c6d826e9d29" title="Returns a descriptive error message explaining why the last command failed.">tj3GetErrorStr()</a>.) This buffer should be freed using <a class="el" href="group___turbo_j_p_e_g.html#gaddb84fb6c81769e9faa0f5a63b296606" title="Free a byte buffer previously allocated by TurboJPEG.">tj3Free()</a>. </dd></dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly-allocated buffer containing the packed-pixel image, converted to the chosen pixel format and with the chosen row alignment, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga5a23ad0776c5333cda0d7c6d826e9d29" title="Returns a descriptive error message explaining why the last command failed.">tj3GetErrorStr()</a>.) This buffer should be freed using <a class="el" href="group___turbo_j_p_e_g.html#gaddb84fb6c81769e9faa0f5a63b296606" title="Free a byte buffer previously allocated by TurboJPEG.">tj3Free()</a>. </dd></dl>
</div>
</div>
@@ -2670,17 +2671,17 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</div><div class="memdoc">
<p>Load a 16-bit-per-sample packed-pixel image from disk into memory. </p>
<p>Load a packed-pixel image with 13 to 16 bits of data precision per sample from disk into memory. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>handle to a TurboJPEG instance</td></tr>
<tr><td class="paramname">filename</td><td>name of a file containing a packed-pixel image in Windows BMP or PBMPLUS (PPM/PGM) format. Windows BMP files require 8-bit-per-sample data precision. If the data precision of the PBMPLUS file does not match the target data precision, then upconverting or downconverting will be performed.</td></tr>
<tr><td class="paramname">filename</td><td>name of a file containing a packed-pixel image in PBMPLUS (PPM/PGM) format. The target data precision (from 13 to 16 bits per sample) can be specified using <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> and defaults to 16 if <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> is unset or out of range. If the data precision of the PBMPLUS file does not match the target data precision, then upconverting or downconverting will be performed.</td></tr>
<tr><td class="paramname">width</td><td>pointer to an integer variable that will receive the width (in pixels) of the packed-pixel image</td></tr>
<tr><td class="paramname">align</td><td>row alignment (in samples) of the packed-pixel buffer to be returned (must be a power of 2.) Setting this parameter to n will cause all rows in the buffer to be padded to the nearest multiple of n samples (1 = unpadded.)</td></tr>
<tr><td class="paramname">height</td><td>pointer to an integer variable that will receive the height (in pixels) of the packed-pixel image</td></tr>
<tr><td class="paramname">pixelFormat</td><td>pointer to an integer variable that specifies or will receive the pixel format of the packed-pixel buffer. The behavior of this function will vary depending on the value of <code>*pixelFormat</code> passed to the function:<ul>
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed">TJPF_UNKNOWN</a> : The packed-pixel buffer returned by this function will use the most optimal pixel format for the file type, and <code>*pixelFormat</code> will contain the ID of that pixel format upon successful return from this function.</li>
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a> : Only PGM files and 8-bit-per-pixel BMP files with a grayscale colormap can be loaded.</li>
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a> : Only PGM files can be loaded.</li>
<li><a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a> : The RGB or grayscale pixels stored in the file will be converted using a quick &amp; dirty algorithm that is suitable only for testing purposes. (Proper conversion between CMYK and other formats requires a color management system.)</li>
<li>Other <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">pixel formats</a> : The packed-pixel buffer will use the specified pixel format, and pixel format conversion will be performed if necessary.</li>
</ul>
@@ -2688,7 +2689,7 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly-allocated buffer containing the packed-pixel image, converted to the chosen pixel format and with the chosen row alignment, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga5a23ad0776c5333cda0d7c6d826e9d29" title="Returns a descriptive error message explaining why the last command failed.">tj3GetErrorStr()</a>.) This buffer should be freed using <a class="el" href="group___turbo_j_p_e_g.html#gaddb84fb6c81769e9faa0f5a63b296606" title="Free a byte buffer previously allocated by TurboJPEG.">tj3Free()</a>. </dd></dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to a newly-allocated buffer containing the packed-pixel image, converted to the chosen pixel format and with the chosen row alignment, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga5a23ad0776c5333cda0d7c6d826e9d29" title="Returns a descriptive error message explaining why the last command failed.">tj3GetErrorStr()</a>.) This buffer should be freed using <a class="el" href="group___turbo_j_p_e_g.html#gaddb84fb6c81769e9faa0f5a63b296606" title="Free a byte buffer previously allocated by TurboJPEG.">tj3Free()</a>. </dd></dl>
</div>
</div>
@@ -2742,11 +2743,11 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</div><div class="memdoc">
<p>Load an 8-bit-per-sample packed-pixel image from disk into memory. </p>
<p>Load a packed-pixel image with 2 to 8 bits of data precision per sample from disk into memory. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>handle to a TurboJPEG instance</td></tr>
<tr><td class="paramname">filename</td><td>name of a file containing a packed-pixel image in Windows BMP or PBMPLUS (PPM/PGM) format. Windows BMP files require 8-bit-per-sample data precision. If the data precision of the PBMPLUS file does not match the target data precision, then upconverting or downconverting will be performed.</td></tr>
<tr><td class="paramname">filename</td><td>name of a file containing a packed-pixel image in Windows BMP or PBMPLUS (PPM/PGM) format. Windows BMP files require 8-bit-per-sample data precision. When loading a PBMPLUS file, the target data precision (from 2 to 8 bits per sample) can be specified using <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> and defaults to 8 if <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> is unset or out of range. If the data precision of the PBMPLUS file does not match the target data precision, then upconverting or downconverting will be performed.</td></tr>
<tr><td class="paramname">width</td><td>pointer to an integer variable that will receive the width (in pixels) of the packed-pixel image</td></tr>
<tr><td class="paramname">align</td><td>row alignment (in samples) of the packed-pixel buffer to be returned (must be a power of 2.) Setting this parameter to n will cause all rows in the buffer to be padded to the nearest multiple of n samples (1 = unpadded.)</td></tr>
<tr><td class="paramname">height</td><td>pointer to an integer variable that will receive the height (in pixels) of the packed-pixel image</td></tr>
@@ -2820,20 +2821,20 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</div><div class="memdoc">
<p>Save a 12-bit-per-sample packed-pixel image from memory to disk. </p>
<p>Save a packed-pixel image with 9 to 12 bits of data precision per sample from memory to disk. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>handle to a TurboJPEG instance</td></tr>
<tr><td class="paramname">filename</td><td>name of a file to which to save the packed-pixel image. The image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, depending on the file extension. Windows BMP files require 8-bit-per-sample data precision.</td></tr>
<tr><td class="paramname">filename</td><td>name of a file to which to save the packed-pixel image, which will be stored in PBMPLUS (PPM/PGM) format. The source data precision (from 9 to 12 bits per sample) can be specified using <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> and defaults to 12 if <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> is unset or out of range.</td></tr>
<tr><td class="paramname">buffer</td><td>pointer to a buffer containing a packed-pixel RGB, grayscale, or CMYK image to be saved</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the packed-pixel image</td></tr>
<tr><td class="paramname">pitch</td><td>samples per row in the packed-pixel image. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in samples) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the packed-pixel image</td></tr>
<tr><td class="paramname">pixelFormat</td><td>pixel format of the packed-pixel image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>, then the image will be stored in PGM or 8-bit-per-pixel (indexed color) BMP format. Otherwise, the image will be stored in PPM or 24-bit-per-pixel BMP format. If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a>, then the CMYK pixels will be converted to RGB using a quick &amp; dirty algorithm that is suitable only for testing purposes. (Proper conversion between CMYK and other formats requires a color management system.)</td></tr>
<tr><td class="paramname">pixelFormat</td><td>pixel format of the packed-pixel image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>, then the image will be stored in PGM format. Otherwise, the image will be stored in PPM format. If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a>, then the CMYK pixels will be converted to RGB using a quick &amp; dirty algorithm that is suitable only for testing purposes. (Proper conversion between CMYK and other formats requires a color management system.)</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga5a23ad0776c5333cda0d7c6d826e9d29" title="Returns a descriptive error message explaining why the last command failed.">tj3GetErrorStr()</a>.) </dd></dl>
<dl class="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga5a23ad0776c5333cda0d7c6d826e9d29" title="Returns a descriptive error message explaining why the last command failed.">tj3GetErrorStr()</a>.) </dd></dl>
</div>
</div>
@@ -2893,20 +2894,20 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</div><div class="memdoc">
<p>Save a 16-bit-per-sample packed-pixel image from memory to disk. </p>
<p>Save a packed-pixel image with 13 to 16 bits of data precision per sample from memory to disk. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>handle to a TurboJPEG instance</td></tr>
<tr><td class="paramname">filename</td><td>name of a file to which to save the packed-pixel image. The image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, depending on the file extension. Windows BMP files require 8-bit-per-sample data precision.</td></tr>
<tr><td class="paramname">filename</td><td>name of a file to which to save the packed-pixel image, which will be stored in PBMPLUS (PPM/PGM) format. The source data precision (from 13 to 16 bits per sample) can be specified using <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> and defaults to 16 if <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> is unset or out of range.</td></tr>
<tr><td class="paramname">buffer</td><td>pointer to a buffer containing a packed-pixel RGB, grayscale, or CMYK image to be saved</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the packed-pixel image</td></tr>
<tr><td class="paramname">pitch</td><td>samples per row in the packed-pixel image. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in samples) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><td class="paramname">height</td><td>height (in pixels) of the packed-pixel image</td></tr>
<tr><td class="paramname">pixelFormat</td><td>pixel format of the packed-pixel image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>, then the image will be stored in PGM or 8-bit-per-pixel (indexed color) BMP format. Otherwise, the image will be stored in PPM or 24-bit-per-pixel BMP format. If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a>, then the CMYK pixels will be converted to RGB using a quick &amp; dirty algorithm that is suitable only for testing purposes. (Proper conversion between CMYK and other formats requires a color management system.)</td></tr>
<tr><td class="paramname">pixelFormat</td><td>pixel format of the packed-pixel image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>, then the image will be stored in PGM format. Otherwise, the image will be stored in PPM format. If this parameter is set to <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a>, then the CMYK pixels will be converted to RGB using a quick &amp; dirty algorithm that is suitable only for testing purposes. (Proper conversion between CMYK and other formats requires a color management system.)</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga5a23ad0776c5333cda0d7c6d826e9d29" title="Returns a descriptive error message explaining why the last command failed.">tj3GetErrorStr()</a>.) </dd></dl>
<dl class="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga5a23ad0776c5333cda0d7c6d826e9d29" title="Returns a descriptive error message explaining why the last command failed.">tj3GetErrorStr()</a>.) </dd></dl>
</div>
</div>
@@ -2966,11 +2967,11 @@ If you choose option 1, then <code>*jpegSize</code> should be set to the size of
</table>
</div><div class="memdoc">
<p>Save an 8-bit-per-sample packed-pixel image from memory to disk. </p>
<p>Save a packed-pixel image with 2 to 8 bits of data precision per sample from memory to disk. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handle</td><td>handle to a TurboJPEG instance</td></tr>
<tr><td class="paramname">filename</td><td>name of a file to which to save the packed-pixel image. The image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, depending on the file extension. Windows BMP files require 8-bit-per-sample data precision.</td></tr>
<tr><td class="paramname">filename</td><td>name of a file to which to save the packed-pixel image. The image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, depending on the file extension. Windows BMP files require 8-bit-per-sample data precision. When saving a PBMPLUS file, the source data precision (from 2 to 8 bits per sample) can be specified using <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> and defaults to 8 if <a class="el" href="group___turbo_j_p_e_g.html#ggaa0f6be63ba78278299c9f5c12031fe82a781db82741934e8cd008d308597c59d8" title="Data precision (bits per sample)">TJPARAM_PRECISION</a> is unset or out of range.</td></tr>
<tr><td class="paramname">buffer</td><td>pointer to a buffer containing a packed-pixel RGB, grayscale, or CMYK image to be saved</td></tr>
<tr><td class="paramname">width</td><td>width (in pixels) of the packed-pixel image</td></tr>
<tr><td class="paramname">pitch</td><td>samples per row in the packed-pixel image. Setting this parameter to 0 is the equivalent of setting it to <code>width * <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c" title="Pixel size (in samples) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>

View File

@@ -22,7 +22,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.1</span>
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.2</span>
</div>
</td>
</tr>

View File

@@ -22,7 +22,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.1</span>
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.2</span>
</div>
</td>
</tr>

View File

@@ -22,7 +22,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.1</span>
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.2</span>
</div>
</td>
</tr>

View File

@@ -22,7 +22,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.1</span>
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.2</span>
</div>
</td>
</tr>

View File

@@ -22,7 +22,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.1</span>
<div id="projectname">TurboJPEG<span id="projectnumber">&#160;3.0.2</span>
</div>
</td>
</tr>

View File

@@ -167,7 +167,7 @@ file size is about the same --- often a little smaller.
Switches for advanced users:
-precision N Create JPEG file with N-bit data precision.
N is 8, 12, or 16; default is 8. If N is 16, then
N is 2 to 16; default is 8. If N is not 8 or 12, then
-lossless must also be specified. Note that only the
PBMPLUS input file format supports data precisions other
than 8. Note also that PBMPLUS input files are silently
@@ -175,10 +175,9 @@ Switches for advanced users:
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.
CAUTION: only 8-bit data precision is widely
implemented, so many decoders will be unable to handle
JPEG files with other data precisions.
"-precision 12" implies -optimize unless -arithmetic is
also specified.