From: DRC Date: Tue, 12 Aug 2014 15:06:30 +0000 (+0000) Subject: Reformat TurboJPEG C API documentation to improve ease of maintenance and to make... X-Git-Tag: 1.3.90~34 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d77dad4c9082f0dbd26b64b55c087654dfa7b8f;p=libjpeg-turbo Reformat TurboJPEG C API documentation to improve ease of maintenance and to make it more consistent with the javadoc formatting; fix minor error in tjCompressFromYUV() prototype. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1344 632fc199-4ca6-4c93-a231-07263d6284db --- diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html index 8ca4eda..72a3656 100644 --- a/doc/html/group___turbo_j_p_e_g.html +++ b/doc/html/group___turbo_j_p_e_g.html @@ -232,9 +232,9 @@ Functions DLLEXPORT int DLLCALL tjCompressFromYUV (tjhandle handle, unsigned char *srcBuf, int width, int pad, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)  Compress a YUV planar image into a JPEG image. More...
  -DLLEXPORT int DLLCALL tjCompressFromYUVPlanes (tjhandle handle, unsigned char **srcBufs, int width, int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags) - Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. More...
-  +DLLEXPORT int DLLCALL tjCompressFromYUVPlanes (tjhandle handle, unsigned char **srcPlanes, int width, int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags) + Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. More...
+  DLLEXPORT unsigned long DLLCALL tjBufSize (int width, int height, int jpegSubsamp)  The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. More...
  @@ -849,8 +849,8 @@ Variables

The number of bytes returned by this function is larger than the size of the uncompressed source image. The reason for this is that the JPEG format uses 16-bit coefficients, and it is thus possible for a very high-quality JPEG image with very high-frequency content to expand rather than compress when converted to the JPEG format. Such images represent a very rare corner case, but since there is no way to predict the size of a JPEG image prior to compression, the corner case has to be handled.

Parameters
- - + +
widthwidth of the image (in pixels)
heightheight of the image (in pixels)
widthwidth of the image (in pixels)
heightheight of the image (in pixels)
jpegSubsampthe level of chrominance subsampling to be used when generating the JPEG image (see Chrominance subsampling options.)
@@ -898,9 +898,9 @@ Variables

The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters.

Parameters
- - - + + +
widthwidth of the image (in pixels)
padthe width of each line in each plane of the image is padded to the nearest multiple of this number of bytes (must be a power of 2.)
heightheight of the image (in pixels)
widthwidth of the image (in pixels)
padthe width of each line in each plane of the image is padded to the nearest multiple of this number of bytes (must be a power of 2.)
heightheight of the image (in pixels)
subsamplevel of chrominance subsampling in the image (see Chrominance subsampling options.)
@@ -990,21 +990,21 @@ Variables

Compress an RGB, grayscale, or CMYK image into a JPEG image.

Parameters
- - - - - - + + + + + + - - - +If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed. + + +
handlea handle to a TurboJPEG compressor or transformer instance
srcBufpointer to an image buffer containing RGB, grayscale, or CMYK pixels to be compressed
widthwidth (in pixels) of the source image
pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
heightheight (in pixels) of the source image
pixelFormatpixel format of the source image (see Pixel formats.)
handlea handle to a TurboJPEG compressor or transformer instance
srcBufpointer to an image buffer containing RGB, grayscale, or CMYK pixels to be compressed
widthwidth (in pixels) of the source image
pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
heightheight (in pixels) of the source image
pixelFormatpixel format of the source image (see Pixel formats.)
jpegBufaddress of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
  1. pre-allocate the JPEG buffer with an arbitrary size using tjAlloc() and let TurboJPEG grow the buffer as needed,
  2. set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer for you, or
  3. pre-allocate the buffer to a "worst case" size determined by calling tjBufSize(). This should ensure that the buffer never has to be re-allocated (setting TJFLAG_NOREALLOC guarantees this.)
-If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed.
jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
jpegSubsampthe level of chrominance subsampling to be used when generating the JPEG image (see Chrominance subsampling options.)
jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
jpegSubsampthe level of chrominance subsampling to be used when generating the JPEG image (see Chrominance subsampling options.)
jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
flagsthe bitwise OR of one or more of the flags.
@@ -1088,20 +1088,20 @@ If you choose option 1, *jpegSize should be set to the size of your

Compress a YUV planar image into a JPEG image.

Parameters
- - - - - - + + + + + + - - +If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed. + +
handlea handle to a TurboJPEG compressor or transformer instance
srcBufpointer to an image buffer containing a YUV planar image to be compressed. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.)
widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
padthe line padding used in the source image. For instance, if each line in each plane of the YUV image is padded to the nearest multiple of 4 bytes, then pad should be set to 4.
heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
subsampthe level of chrominance subsampling used in the source image (see Chrominance subsampling options.)
handlea handle to a TurboJPEG compressor or transformer instance
srcBufpointer to an image buffer containing a YUV planar image to be compressed. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.)
widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
padthe line padding used in the source image. For instance, if each line in each plane of the YUV image is padded to the nearest multiple of 4 bytes, then pad should be set to 4.
heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
subsampthe level of chrominance subsampling used in the source image (see Chrominance subsampling options.)
jpegBufaddress of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
  1. pre-allocate the JPEG buffer with an arbitrary size using tjAlloc() and let TurboJPEG grow the buffer as needed,
  2. set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer for you, or
  3. pre-allocate the buffer to a "worst case" size determined by calling tjBufSize(). This should ensure that the buffer never has to be re-allocated (setting TJFLAG_NOREALLOC guarantees this.)
-If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed.
jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
flagsthe bitwise OR of one or more of the flags.
@@ -1110,7 +1110,7 @@ If you choose option 1, *jpegSize should be set to the size of your - +
@@ -1124,7 +1124,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + @@ -1185,20 +1185,20 @@ If you choose option 1, *jpegSize should be set to the size of your

Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image.

Parameters
unsigned char ** srcBufs, srcPlanes,
- - - - - - + + + + + + - - +If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed. + +
handlea handle to a TurboJPEG compressor or transformer instance
srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image.
heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
subsampthe level of chrominance subsampling used in the source image (see Chrominance subsampling options.)
handlea handle to a TurboJPEG compressor or transformer instance
srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if compressing a grayscale image) that contain a YUV image to be compressed. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
widthwidth (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to create a JPEG image from a subregion of a larger YUV planar image.
heightheight (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
subsampthe level of chrominance subsampling used in the source image (see Chrominance subsampling options.)
jpegBufaddress of a pointer to an image buffer that will receive the JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
  1. pre-allocate the JPEG buffer with an arbitrary size using tjAlloc() and let TurboJPEG grow the buffer as needed,
  2. set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer for you, or
  3. pre-allocate the buffer to a "worst case" size determined by calling tjBufSize(). This should ensure that the buffer never has to be re-allocated (setting TJFLAG_NOREALLOC guarantees this.)
-If you choose option 1, *jpegSize should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check *jpegBuf upon return from this function, as it may have changed.
jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
jpegSizepointer to an unsigned long variable that holds the size of the JPEG image buffer. If *jpegBuf points to a pre-allocated buffer, then *jpegSize should be set to the size of the buffer. Upon return, *jpegSize will contain the size of the JPEG image (in bytes.)
jpegQualthe image quality of the generated JPEG image (1 = worst, 100 = best)
flagsthe bitwise OR of one or more of the flags.
@@ -1283,15 +1283,15 @@ If you choose option 1, *jpegSize should be set to the size of your

This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process.

Parameters
- - - - - - - - - + + + + + + + + +
handlea handle to a TurboJPEG decompressor or transformer instance
srcBufpointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.)
padUse this parameter to specify that the width of each line in each plane of the YUV source image is padded to the nearest multiple of this number of bytes (must be a power of 2.)
subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
widthwidth (in pixels) of the source and destination images
pitchbytes per line of the destination image. Normally, this should be width * tjPixelSize[pixelFormat] if the destination image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
heightheight (in pixels) of the source and destination images
pixelFormatpixel format of the destination image (see Pixel formats.)
handlea handle to a TurboJPEG decompressor or transformer instance
srcBufpointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by tjBufSizeYUV2() for the given image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer (refer to YUV Image Format Notes.)
padUse this parameter to specify that the width of each line in each plane of the YUV source image is padded to the nearest multiple of this number of bytes (must be a power of 2.)
subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
widthwidth (in pixels) of the source and destination images
pitchbytes per line of the destination image. Normally, this should be width * tjPixelSize[pixelFormat] if the destination image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
heightheight (in pixels) of the source and destination images
pixelFormatpixel format of the destination image (see Pixel formats.)
flagsthe bitwise OR of one or more of the flags.
@@ -1376,15 +1376,15 @@ If you choose option 1, *jpegSize should be set to the size of your

This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG decompression process.

Parameters
- - - - - - - - - + + + + + + + + +
handlea handle to a TurboJPEG decompressor or transformer instance
srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.
subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
widthwidth (in pixels) of the source and destination images
pitchbytes per line of the destination image. Normally, this should be width * tjPixelSize[pixelFormat] if the destination image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
heightheight (in pixels) of the source and destination images
pixelFormatpixel format of the destination image (see Pixel formats.)
handlea handle to a TurboJPEG decompressor or transformer instance
srcPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decoding a grayscale image) that contain a YUV image to be decoded. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the YUV source image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to specify an arbitrary amount of line padding in each plane or to decode a subregion of a larger YUV planar image.
subsampthe level of chrominance subsampling used in the YUV source image (see Chrominance subsampling options.)
dstBufpointer to an image buffer that will receive the decoded image. This buffer should normally be pitch * height bytes in size, but the dstBuf pointer can also be used to decode into a specific region of a larger buffer.
widthwidth (in pixels) of the source and destination images
pitchbytes per line of the destination image. Normally, this should be width * tjPixelSize[pixelFormat] if the destination image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the destination image should be padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
heightheight (in pixels) of the source and destination images
pixelFormatpixel format of the destination image (see Pixel formats.)
flagsthe bitwise OR of one or more of the flags.
@@ -1462,14 +1462,14 @@ If you choose option 1, *jpegSize should be set to the size of your

Decompress a JPEG image to an RGB, grayscale, or CMYK image.

Parameters
- - - - - - - - + + + + + + + +
handlea handle to a TurboJPEG decompressor or transformer instance
jpegBufpointer to a buffer containing the JPEG image to decompress
jpegSizesize of the JPEG image (in bytes)
dstBufpointer to an image buffer that will receive the decompressed image. This buffer should normally be pitch * scaledHeight bytes in size, where scaledHeight can be determined by calling TJSCALED() with the JPEG image height and one of the scaling factors returned by tjGetScalingFactors(). The dstBuf pointer may also be used to decompress into a specific region of a larger buffer.
widthdesired width (in pixels) of the destination image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size.
pitchbytes per line of the destination image. Normally, this is scaledWidth * tjPixelSize[pixelFormat] if the decompressed image is unpadded, else TJPAD(scaledWidth * tjPixelSize[pixelFormat]) if each line of the decompressed image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. (NOTE: scaledWidth can be determined by calling TJSCALED() with the JPEG image width and one of the scaling factors returned by tjGetScalingFactors().) You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to scaledWidth * tjPixelSize[pixelFormat].
heightdesired height (in pixels) of the destination image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size.
pixelFormatpixel format of the destination image (see Pixel formats.)
handlea handle to a TurboJPEG decompressor or transformer instance
jpegBufpointer to a buffer containing the JPEG image to decompress
jpegSizesize of the JPEG image (in bytes)
dstBufpointer to an image buffer that will receive the decompressed image. This buffer should normally be pitch * scaledHeight bytes in size, where scaledHeight can be determined by calling TJSCALED() with the JPEG image height and one of the scaling factors returned by tjGetScalingFactors(). The dstBuf pointer may also be used to decompress into a specific region of a larger buffer.
widthdesired width (in pixels) of the destination image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size.
pitchbytes per line of the destination image. Normally, this is scaledWidth * tjPixelSize[pixelFormat] if the decompressed image is unpadded, else TJPAD(scaledWidth * tjPixelSize[pixelFormat]) if each line of the decompressed image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. (NOTE: scaledWidth can be determined by calling TJSCALED() with the JPEG image width and one of the scaling factors returned by tjGetScalingFactors().) You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to scaledWidth * tjPixelSize[pixelFormat].
heightdesired height (in pixels) of the destination image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size.
pixelFormatpixel format of the destination image (see Pixel formats.)
flagsthe bitwise OR of one or more of the flags.
@@ -1535,12 +1535,12 @@ If you choose option 1, *jpegSize should be set to the size of your

Retrieve information about a JPEG image without decompressing it.

Parameters
- - - - - - + + + + + +
handlea handle to a TurboJPEG decompressor or transformer instance
jpegBufpointer to a buffer containing a JPEG image
jpegSizesize of the JPEG image (in bytes)
widthpointer to an integer variable that will receive the width (in pixels) of the JPEG image
heightpointer to an integer variable that will receive the height (in pixels) of the JPEG image
jpegSubsamppointer to an integer variable that will receive the level of chrominance subsampling used when compressing the JPEG image (see Chrominance subsampling options.)
handlea handle to a TurboJPEG decompressor or transformer instance
jpegBufpointer to a buffer containing a JPEG image
jpegSizesize of the JPEG image (in bytes)
widthpointer to an integer variable that will receive the width (in pixels) of the JPEG image
heightpointer to an integer variable that will receive the height (in pixels) of the JPEG image
jpegSubsamppointer to an integer variable that will receive the level of chrominance subsampling used when compressing the JPEG image (see Chrominance subsampling options.)
jpegColorspacepointer to an integer variable that will receive one of the JPEG colorspace constants, indicating the colorspace of the JPEG image (see JPEG colorspaces.)
@@ -1613,13 +1613,13 @@ If you choose option 1, *jpegSize should be set to the size of your

This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image.

Parameters
- - - - - - - + + + + + + +
handlea handle to a TurboJPEG decompressor or transformer instance
jpegBufpointer to a buffer containing the JPEG image to decompress
jpegSizesize of the JPEG image (in bytes)
dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to YUV Image Format Notes.)
widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
padthe width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, pad should be set to 4.
heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
handlea handle to a TurboJPEG decompressor or transformer instance
jpegBufpointer to a buffer containing the JPEG image to decompress
jpegSizesize of the JPEG image (in bytes)
dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to YUV Image Format Notes.)
widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
padthe width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, pad should be set to 4.
heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
flagsthe bitwise OR of one or more of the flags.
@@ -1692,13 +1692,13 @@ If you choose option 1, *jpegSize should be set to the size of your

This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image.

Parameters
- - - - - - - + + + + + + +
handlea handle to a TurboJPEG decompressor or transformer instance
jpegBufpointer to a buffer containing the JPEG image to decompress
jpegSizesize of the JPEG image (in bytes)
dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {scaled component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective scaled component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to decompress the JPEG image into a subregion of a larger YUV planar image.
heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
handlea handle to a TurboJPEG decompressor or transformer instance
jpegBufpointer to a buffer containing the JPEG image to decompress
jpegSizesize of the JPEG image (in bytes)
dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if decompressing a grayscale image) that will receive the YUV image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {scaled component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
widthdesired width (in pixels) of the YUV image. If this is different than the width of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired width. If width is set to 0, then only the height will be considered when determining the scaled image size. If the scaled width is not an even multiple of the MCU block width (see tjMCUWidth), then an intermediate buffer copy will be performed within TurboJPEG.
stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the scaled component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective scaled component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to decompress the JPEG image into a subregion of a larger YUV planar image.
heightdesired height (in pixels) of the YUV image. If this is different than the height of the JPEG image being decompressed, then TurboJPEG will use scaling in the JPEG decompressor to generate the largest possible image that will fit within the desired height. If height is set to 0, then only the width will be considered when determining the scaled image size. If the scaled height is not an even multiple of the MCU block height (see tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
flagsthe bitwise OR of one or more of the flags.
@@ -1808,15 +1808,15 @@ If you choose option 1, *jpegSize should be set to the size of your

This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process.

Parameters
- - - - - - - - - + + + + + + + + +
handlea handle to a TurboJPEG compressor or transformer instance
srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded
widthwidth (in pixels) of the source image
pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
heightheight (in pixels) of the source image
pixelFormatpixel format of the source image (see Pixel formats.)
dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to YUV Image Format Notes.)
padthe width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, pad should be set to 4.
subsampthe level of chrominance subsampling to be used when generating the YUV image (see Chrominance subsampling options.) To generate images suitable for X Video, subsamp should be set to TJSAMP_420. This produces an image compatible with the I420 (AKA "YUV420P") format.
handlea handle to a TurboJPEG compressor or transformer instance
srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded
widthwidth (in pixels) of the source image
pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
heightheight (in pixels) of the source image
pixelFormatpixel format of the source image (see Pixel formats.)
dstBufpointer to an image buffer that will receive the YUV image. Use tjBufSizeYUV2() to determine the appropriate size for this buffer based on the image width, height, padding, and level of chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the buffer (refer to YUV Image Format Notes.)
padthe width of each line in each plane of the YUV image will be padded to the nearest multiple of this number of bytes (must be a power of 2.) To generate images suitable for X Video, pad should be set to 4.
subsampthe level of chrominance subsampling to be used when generating the YUV image (see Chrominance subsampling options.) To generate images suitable for X Video, subsamp should be set to TJSAMP_420. This produces an image compatible with the I420 (AKA "YUV420P") format.
flagsthe bitwise OR of one or more of the flags.
@@ -1901,15 +1901,15 @@ If you choose option 1, *jpegSize should be set to the size of your

This function uses the accelerated color conversion routines in the underlying codec but does not execute any of the other steps in the JPEG compression process.

Parameters
- - - - - - - - - + + + + + + + + +
handlea handle to a TurboJPEG compressor or transformer instance
srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded
widthwidth (in pixels) of the source image
pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
heightheight (in pixels) of the source image
pixelFormatpixel format of the source image (see Pixel formats.)
dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if generating a grayscale image) that will receive the encoded image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to encode an RGB or grayscale image into a subregion of a larger YUV planar image.
subsampthe level of chrominance subsampling to be used when generating the YUV image (see Chrominance subsampling options.) To generate images suitable for X Video, subsamp should be set to TJSAMP_420. This produces an image compatible with the I420 (AKA "YUV420P") format.
handlea handle to a TurboJPEG compressor or transformer instance
srcBufpointer to an image buffer containing RGB or grayscale pixels to be encoded
widthwidth (in pixels) of the source image
pitchbytes per line of the source image. Normally, this should be width * tjPixelSize[pixelFormat] if the image is unpadded, or TJPAD(width * tjPixelSize[pixelFormat]) if each line of the image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. You can also be clever and use this parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to width * tjPixelSize[pixelFormat].
heightheight (in pixels) of the source image
pixelFormatpixel format of the source image (see Pixel formats.)
dstPlanesan array of pointers to Y, U (Cb), and V (Cr) image planes (or just a Y plane, if generating a grayscale image) that will receive the encoded image. These planes can be contiguous or non-contiguous in memory. Each plane should be at least {component stride} * {component height} bytes in size. (See below for a description of stride, and refer to YUV Image Format Notes for a description of component height.)
stridesan array of integers, each specifying the number of bytes per line in the corresponding plane of the output image. Setting the stride for any plane to 0 is the same as setting it to the component width for the plane. If stride is NULL, then the strides for all planes will be set to their respective component widths. You can adjust the strides in order to add an arbitrary amount of line padding to each plane or to encode an RGB or grayscale image into a subregion of a larger YUV planar image.
subsampthe level of chrominance subsampling to be used when generating the YUV image (see Chrominance subsampling options.) To generate images suitable for X Video, subsamp should be set to TJSAMP_420. This produces an image compatible with the I420 (AKA "YUV420P") format.
flagsthe bitwise OR of one or more of the flags.
@@ -2109,18 +2109,18 @@ If you choose option 1, *jpegSize should be set to the size of your

Lossless transforms work by moving the raw coefficients from one JPEG image structure to another without altering the values of the coefficients. While this is typically faster than decompressing the image, transforming it, and re-compressing it, lossless transforms are not free. Each lossless transform requires reading and performing Huffman decoding on all of the coefficients in the source image, regardless of the size of the destination image. Thus, this function provides a means of generating multiple transformed images from the same source or applying multiple transformations simultaneously, in order to eliminate the need to read the source coefficients multiple times.

Parameters
- - - - + + + + - - +If you choose option 1, dstSizes[i] should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check dstBufs[i] upon return from this function, as it may have changed. + +
handlea handle to a TurboJPEG transformer instance
jpegBufpointer to a buffer containing the JPEG image to transform
jpegSizesize of the JPEG image (in bytes)
nthe number of transformed JPEG images to generate
handlea handle to a TurboJPEG transformer instance
jpegBufpointer to a buffer containing the JPEG image to transform
jpegSizesize of the JPEG image (in bytes)
nthe number of transformed JPEG images to generate
dstBufspointer to an array of n image buffers. dstBufs[i] will receive a JPEG image that has been transformed using the parameters in transforms[i]. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:
  1. pre-allocate the JPEG buffer with an arbitrary size using tjAlloc() and let TurboJPEG grow the buffer as needed,
  2. set dstBufs[i] to NULL to tell TurboJPEG to allocate the buffer for you, or
  3. pre-allocate the buffer to a "worst case" size determined by calling tjBufSize() with the transformed or cropped width and height. This should ensure that the buffer never has to be re-allocated (setting TJFLAG_NOREALLOC guarantees this.)
-If you choose option 1, dstSizes[i] should be set to the size of your pre-allocated buffer. In any case, unless you have set TJFLAG_NOREALLOC, you should always check dstBufs[i] upon return from this function, as it may have changed.
dstSizespointer to an array of n unsigned long variables that will receive the actual sizes (in bytes) of each transformed JPEG image. If dstBufs[i] points to a pre-allocated buffer, then dstSizes[i] should be set to the size of the buffer. Upon return, dstSizes[i] will contain the size of the JPEG image (in bytes.)
transformspointer to an array of n tjtransform structures, each of which specifies the transform parameters and/or cropping region for the corresponding transformed output image.
dstSizespointer to an array of n unsigned long variables that will receive the actual sizes (in bytes) of each transformed JPEG image. If dstBufs[i] points to a pre-allocated buffer, then dstSizes[i] should be set to the size of the buffer. Upon return, dstSizes[i] will contain the size of the JPEG image (in bytes.)
transformspointer to an array of n tjtransform structures, each of which specifies the transform parameters and/or cropping region for the corresponding transformed output image.
flagsthe bitwise OR of one or more of the flags.
diff --git a/doc/html/search/all_74.js b/doc/html/search/all_74.js index e371aae..7b50830 100644 --- a/doc/html/search/all_74.js +++ b/doc/html/search/all_74.js @@ -10,7 +10,7 @@ var searchData= ['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9',1,'turbojpeg.h']]], ['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2',1,'turbojpeg.h']]], ['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga0b931126c7a615ddc3bbd0cca6698d67',1,'turbojpeg.h']]], - ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#gab87b2b19ee8bdd8dba395b74d66a4835',1,'turbojpeg.h']]], + ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#gaa89a1982cb4556b12ae7af4439991af6',1,'turbojpeg.h']]], ['tjcs',['TJCS',['../group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720',1,'turbojpeg.h']]], ['tjcs_5fcmyk',['TJCS_CMYK',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a6c8b636152ac8195b869587db315ee53',1,'turbojpeg.h']]], ['tjcs_5fgray',['TJCS_GRAY',['../group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720ab3e7d6a87f695e45b81c1b5262b5a50a',1,'turbojpeg.h']]], diff --git a/doc/html/search/functions_74.js b/doc/html/search/functions_74.js index 8e7e1f5..35a3f8e 100644 --- a/doc/html/search/functions_74.js +++ b/doc/html/search/functions_74.js @@ -5,7 +5,7 @@ var searchData= ['tjbufsizeyuv2',['tjBufSizeYUV2',['../group___turbo_j_p_e_g.html#gaf451664a62c1f6c7cc5a6401f32908c9',1,'turbojpeg.h']]], ['tjcompress2',['tjCompress2',['../group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2',1,'turbojpeg.h']]], ['tjcompressfromyuv',['tjCompressFromYUV',['../group___turbo_j_p_e_g.html#ga0b931126c7a615ddc3bbd0cca6698d67',1,'turbojpeg.h']]], - ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#gab87b2b19ee8bdd8dba395b74d66a4835',1,'turbojpeg.h']]], + ['tjcompressfromyuvplanes',['tjCompressFromYUVPlanes',['../group___turbo_j_p_e_g.html#gaa89a1982cb4556b12ae7af4439991af6',1,'turbojpeg.h']]], ['tjdecodeyuv',['tjDecodeYUV',['../group___turbo_j_p_e_g.html#ga132ae2c2cadcf64c8bb0f3bdf69da3ed',1,'turbojpeg.h']]], ['tjdecodeyuvplanes',['tjDecodeYUVPlanes',['../group___turbo_j_p_e_g.html#ga6cb5b0e1101a2b20edea576e11faf93d',1,'turbojpeg.h']]], ['tjdecompress2',['tjDecompress2',['../group___turbo_j_p_e_g.html#gada69cc6443d1bb493b40f1626259e5e9',1,'turbojpeg.h']]], diff --git a/doc/html/structtjtransform.html b/doc/html/structtjtransform.html index 54e82e5..7a07c2a 100644 --- a/doc/html/structtjtransform.html +++ b/doc/html/structtjtransform.html @@ -129,11 +129,11 @@ Data Fields

This allows for custom filters or other transformations to be applied in the frequency domain.

Parameters
- - - - - + + + + +
coeffspointer to an array of transformed DCT coefficients. (NOTE: this pointer is not guaranteed to be valid once the callback returns, so applications wishing to hand off the DCT coefficients to another function or library should make a copy of them within the body of the callback.)
arrayRegiontjregion structure containing the width and height of the array pointed to by coeffs as well as its offset relative to the component plane. TurboJPEG implementations may choose to split each component plane into multiple DCT coefficient arrays and call the callback function once for each array.
planeRegiontjregion structure containing the width and height of the component plane to which coeffs belongs
componentIDID number of the component plane to which coeffs belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in typical JPEG images.)
transformIDID number of the transformed image to which coeffs belongs. This is the same as the index of the transform in the transforms array that was passed to tjTransform().
coeffspointer to an array of transformed DCT coefficients. (NOTE: this pointer is not guaranteed to be valid once the callback returns, so applications wishing to hand off the DCT coefficients to another function or library should make a copy of them within the body of the callback.)
arrayRegiontjregion structure containing the width and height of the array pointed to by coeffs as well as its offset relative to the component plane. TurboJPEG implementations may choose to split each component plane into multiple DCT coefficient arrays and call the callback function once for each array.
planeRegiontjregion structure containing the width and height of the component plane to which coeffs belongs
componentIDID number of the component plane to which coeffs belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in typical JPEG images.)
transformIDID number of the transformed image to which coeffs belongs. This is the same as the index of the transform in the transforms array that was passed to tjTransform().
transforma pointer to a tjtransform structure that specifies the parameters and/or cropping region for this transform
diff --git a/turbojpeg.h b/turbojpeg.h index 66b33d6..90985b3 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -550,26 +550,29 @@ typedef struct tjtransform * to be applied in the frequency domain. * * @param coeffs pointer to an array of transformed DCT coefficients. (NOTE: - * this pointer is not guaranteed to be valid once the callback - * returns, so applications wishing to hand off the DCT coefficients - * to another function or library should make a copy of them within - * the body of the callback.) + * this pointer is not guaranteed to be valid once the callback returns, so + * applications wishing to hand off the DCT coefficients to another function + * or library should make a copy of them within the body of the callback.) + * * @param arrayRegion #tjregion structure containing the width and height of - * the array pointed to by coeffs as well as its offset - * relative to the component plane. TurboJPEG implementations may - * choose to split each component plane into multiple DCT coefficient - * arrays and call the callback function once for each array. + * the array pointed to by coeffs as well as its offset relative to + * the component plane. TurboJPEG implementations may choose to split each + * component plane into multiple DCT coefficient arrays and call the callback + * function once for each array. + * * @param planeRegion #tjregion structure containing the width and height of - * the component plane to which coeffs belongs + * the component plane to which coeffs belongs + * * @param componentID ID number of the component plane to which - * coeffs belongs (Y, Cb, and Cr have, respectively, ID's of - * 0, 1, and 2 in typical JPEG images.) + * coeffs belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, + * and 2 in typical JPEG images.) + * * @param transformID ID number of the transformed image to which - * coeffs belongs. This is the same as the index of the - * transform in the transforms array that was passed to - * #tjTransform(). + * coeffs belongs. This is the same as the index of the transform + * in the transforms array that was passed to #tjTransform(). + * * @param transform a pointer to a #tjtransform structure that specifies the - * parameters and/or cropping region for this transform + * parameters and/or cropping region for this transform * * @return 0 if the callback was successful, or -1 if an error occurred. */ @@ -616,46 +619,56 @@ DLLEXPORT tjhandle DLLCALL tjInitCompress(void); * Compress an RGB, grayscale, or CMYK image into a JPEG image. * * @param handle a handle to a TurboJPEG compressor or transformer instance + * * @param srcBuf pointer to an image buffer containing RGB, grayscale, or - * CMYK pixels to be compressed + * CMYK pixels to be compressed + * * @param width width (in pixels) of the source image + * * @param pitch bytes per line of the source image. Normally, this should be - * width * #tjPixelSize[pixelFormat] if the image is unpadded, - * or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of - * the image is padded to the nearest 32-bit boundary, as is the case - * for Windows bitmaps. You can also be clever and use this parameter - * to skip lines, etc. Setting this parameter to 0 is the equivalent of - * setting it to width * #tjPixelSize[pixelFormat]. + * width * #tjPixelSize[pixelFormat] if the image is unpadded, or + * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image + * is padded to the nearest 32-bit boundary, as is the case for Windows + * bitmaps. You can also be clever and use this parameter to skip lines, etc. + * Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * * @param height height (in pixels) of the source image + * * @param pixelFormat pixel format of the source image (see @ref TJPF - * "Pixel formats".) + * "Pixel formats".) + * * @param jpegBuf address of a pointer to an image buffer that will receive the - * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer - * to accommodate the size of the JPEG image. Thus, you can choose to: - * -# pre-allocate the JPEG buffer with an arbitrary size using - * #tjAlloc() and let TurboJPEG grow the buffer as needed, - * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the - * buffer for you, or - * -# pre-allocate the buffer to a "worst case" size determined by - * calling #tjBufSize(). This should ensure that the buffer never has - * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) - * . - * If you choose option 1, *jpegSize should be set to the - * size of your pre-allocated buffer. In any case, unless you have - * set #TJFLAG_NOREALLOC, you should always check *jpegBuf upon - * return from this function, as it may have changed. + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer + * to accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and + * let TurboJPEG grow the buffer as needed, + * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer + * for you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tjBufSize(). This should ensure that the buffer never has to be + * re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) + * . + * If you choose option 1, *jpegSize should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC, + * you should always check *jpegBuf upon return from this function, as + * it may have changed. + * * @param jpegSize pointer to an unsigned long variable that holds the size of - * the JPEG image buffer. If *jpegBuf points to a - * pre-allocated buffer, then *jpegSize should be set to the - * size of the buffer. Upon return, *jpegSize will contain the - * size of the JPEG image (in bytes.) + * the JPEG image buffer. If *jpegBuf points to a pre-allocated + * buffer, then *jpegSize should be set to the size of the buffer. + * Upon return, *jpegSize will contain the size of the JPEG image (in + * bytes.) + * * @param jpegSubsamp the level of chrominance subsampling to be used when - * generating the JPEG image (see @ref TJSAMP - * "Chrominance subsampling options".) + * generating the JPEG image (see @ref TJSAMP + * "Chrominance subsampling options".) + * * @param jpegQual the image quality of the generated JPEG image (1 = worst, - 100 = best) + * 100 = best) + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -668,47 +681,56 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, * Compress a YUV planar image into a JPEG image. * * @param handle a handle to a TurboJPEG compressor or transformer instance + * * @param srcBuf pointer to an image buffer containing a YUV planar image to be - * compressed. The size of this buffer should match the value returned - * by #tjBufSizeYUV2() for the given image width, height, padding, and - * level of chrominance subsampling. The Y, U (Cb), and V (Cr) image - * planes should be stored sequentially in the source buffer (refer to - * @ref YUVnotes "YUV Image Format Notes".) + * compressed. The size of this buffer should match the value returned by + * #tjBufSizeYUV2() for the given image width, height, padding, and level of + * chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be + * stored sequentially in the source buffer (refer to @ref YUVnotes + * "YUV Image Format Notes".) + * * @param width width (in pixels) of the source image. If the width is not an - * even multiple of the MCU block width (see #tjMCUWidth), then an - * intermediate buffer copy will be performed within TurboJPEG. + * even multiple of the MCU block width (see #tjMCUWidth), then an intermediate + * buffer copy will be performed within TurboJPEG. + * * @param pad the line padding used in the source image. For instance, if each - * line in each plane of the YUV image is padded to the nearest multiple - * of 4 bytes, then pad should be set to 4. + * line in each plane of the YUV image is padded to the nearest multiple of 4 + * bytes, then pad should be set to 4. + * * @param height height (in pixels) of the source image. If the height is not - * an even multiple of the MCU block height (see #tjMCUHeight), then an - * intermediate buffer copy will be performed within TurboJPEG. + * an even multiple of the MCU block height (see #tjMCUHeight), then an + * intermediate buffer copy will be performed within TurboJPEG. + * * @param subsamp the level of chrominance subsampling used in the source - * image (see @ref TJSAMP "Chrominance subsampling options".) + * image (see @ref TJSAMP "Chrominance subsampling options".) + * * @param jpegBuf address of a pointer to an image buffer that will receive the - * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer - * to accommodate the size of the JPEG image. Thus, you can choose to: - * -# pre-allocate the JPEG buffer with an arbitrary size using - * #tjAlloc() and let TurboJPEG grow the buffer as needed, - * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the - * buffer for you, or - * -# pre-allocate the buffer to a "worst case" size determined by - * calling #tjBufSize(). This should ensure that the buffer never has - * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) - * . - * If you choose option 1, *jpegSize should be set to the - * size of your pre-allocated buffer. In any case, unless you have - * set #TJFLAG_NOREALLOC, you should always check *jpegBuf upon - * return from this function, as it may have changed. + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and + * let TurboJPEG grow the buffer as needed, + * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer + * for you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tjBufSize(). This should ensure that the buffer never has to be + * re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) + * . + * If you choose option 1, *jpegSize should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC, + * you should always check *jpegBuf upon return from this function, as + * it may have changed. + * * @param jpegSize pointer to an unsigned long variable that holds the size of - * the JPEG image buffer. If *jpegBuf points to a - * pre-allocated buffer, then *jpegSize should be set to the - * size of the buffer. Upon return, *jpegSize will contain the - * size of the JPEG image (in bytes.) + * the JPEG image buffer. If *jpegBuf points to a pre-allocated + * buffer, then *jpegSize should be set to the size of the buffer. + * Upon return, *jpegSize will contain the size of the JPEG image (in + * bytes.) + * * @param jpegQual the image quality of the generated JPEG image (1 = worst, - 100 = best) + * 100 = best) + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -721,58 +743,66 @@ DLLEXPORT int DLLCALL tjCompressFromYUV(tjhandle handle, unsigned char *srcBuf, * Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. * * @param handle a handle to a TurboJPEG compressor or transformer instance + * * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes - * (or just a Y plane, if compressing a grayscale image) that contain a - * YUV image to be compressed. These planes can be contiguous or - * non-contiguous in memory. Each plane should be at least - * {component stride} * {component height} bytes in size. - * (See below for a description of stride, and refer to @ref YUVnotes - * "YUV Image Format Notes" for a description of component height.) + * (or just a Y plane, if compressing a grayscale image) that contain a YUV + * image to be compressed. These planes can be contiguous or non-contiguous in + * memory. Each plane should be at least + * {component stride} * {component height} bytes in size. (See + * below for a description of stride, and refer to @ref YUVnotes + * "YUV Image Format Notes" for a description of component height.) + * * @param width width (in pixels) of the source image. If the width is not an - * even multiple of the MCU block width (see #tjMCUWidth), then an - * intermediate buffer copy will be performed within TurboJPEG. + * even multiple of the MCU block width (see #tjMCUWidth), then an intermediate + * buffer copy will be performed within TurboJPEG. + * * @param strides an array of integers, each specifying the number of bytes per - * line in the corresponding plane of the YUV source image. Setting the - * stride for any plane to 0 is the same as setting it to the component - * width for the plane. If stride is NULL, then the strides - * for all planes will be set to their respective component widths. You - * can adjust the strides in order to specify an arbitrary amount of - * line padding in each plane or to create a JPEG image from a subregion - * of a larger YUV planar image. + * line in the corresponding plane of the YUV source image. Setting the stride + * for any plane to 0 is the same as setting it to the component width for the + * plane. If stride is NULL, then the strides for all planes will be + * set to their respective component widths. You can adjust the strides in + * order to specify an arbitrary amount of line padding in each plane or to + * create a JPEG image from a subregion of a larger YUV planar image. + * * @param height height (in pixels) of the source image. If the height is not - * an even multiple of the MCU block height (see #tjMCUHeight), then an - * intermediate buffer copy will be performed within TurboJPEG. + * an even multiple of the MCU block height (see #tjMCUHeight), then an + * intermediate buffer copy will be performed within TurboJPEG. + * * @param subsamp the level of chrominance subsampling used in the source - * image (see @ref TJSAMP "Chrominance subsampling options".) + * image (see @ref TJSAMP "Chrominance subsampling options".) + * * @param jpegBuf address of a pointer to an image buffer that will receive the - * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer - * to accommodate the size of the JPEG image. Thus, you can choose to: - * -# pre-allocate the JPEG buffer with an arbitrary size using - * #tjAlloc() and let TurboJPEG grow the buffer as needed, - * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the - * buffer for you, or - * -# pre-allocate the buffer to a "worst case" size determined by - * calling #tjBufSize(). This should ensure that the buffer never has - * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) - * . - * If you choose option 1, *jpegSize should be set to the - * size of your pre-allocated buffer. In any case, unless you have - * set #TJFLAG_NOREALLOC, you should always check *jpegBuf upon - * return from this function, as it may have changed. + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and + * let TurboJPEG grow the buffer as needed, + * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer + * for you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tjBufSize(). This should ensure that the buffer never has to be + * re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) + * . + * If you choose option 1, *jpegSize should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC, + * you should always check *jpegBuf upon return from this function, as + * it may have changed. + * * @param jpegSize pointer to an unsigned long variable that holds the size of - * the JPEG image buffer. If *jpegBuf points to a - * pre-allocated buffer, then *jpegSize should be set to the - * size of the buffer. Upon return, *jpegSize will contain the - * size of the JPEG image (in bytes.) + * the JPEG image buffer. If *jpegBuf points to a pre-allocated + * buffer, then *jpegSize should be set to the size of the buffer. + * Upon return, *jpegSize will contain the size of the JPEG image (in + * bytes.) + * * @param jpegQual the image quality of the generated JPEG image (1 = worst, - 100 = best) + * 100 = best) + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle, - unsigned char **srcBufs, int width, int *strides, int height, int subsamp, + unsigned char **srcPlanes, int width, int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags); @@ -788,10 +818,12 @@ DLLEXPORT int DLLCALL tjCompressFromYUVPlanes(tjhandle handle, * handled. * * @param width width of the image (in pixels) + * * @param height height of the image (in pixels) + * * @param jpegSubsamp the level of chrominance subsampling to be used when - * generating the JPEG image (see @ref TJSAMP - * "Chrominance subsampling options".) + * generating the JPEG image (see @ref TJSAMP + * "Chrominance subsampling options".) * * @return the maximum size of the buffer (in bytes) required to hold the * image, or -1 if the arguments are out of bounds. @@ -805,11 +837,14 @@ DLLEXPORT unsigned long DLLCALL tjBufSize(int width, int height, * the given parameters. * * @param width width of the image (in pixels) + * * @param pad the width of each line in each plane of the image is padded to - * the nearest multiple of this number of bytes (must be a power of 2.) + * the nearest multiple of this number of bytes (must be a power of 2.) + * * @param height height of the image (in pixels) + * * @param subsamp level of chrominance subsampling in the image (see - * @ref TJSAMP "Chrominance subsampling options".) + * @ref TJSAMP "Chrominance subsampling options".) * * @return the size of the buffer (in bytes) required to hold the image, or * -1 if the arguments are out of bounds. @@ -825,36 +860,44 @@ DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2(int width, int pad, int height, * process. * * @param handle a handle to a TurboJPEG compressor or transformer instance + * * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels - * to be encoded + * to be encoded + * * @param width width (in pixels) of the source image + * * @param pitch bytes per line of the source image. Normally, this should be - * width * #tjPixelSize[pixelFormat] if the image is unpadded, - * or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of - * the image is padded to the nearest 32-bit boundary, as is the case - * for Windows bitmaps. You can also be clever and use this parameter - * to skip lines, etc. Setting this parameter to 0 is the equivalent of - * setting it to width * #tjPixelSize[pixelFormat]. + * width * #tjPixelSize[pixelFormat] if the image is unpadded, or + * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image + * is padded to the nearest 32-bit boundary, as is the case for Windows + * bitmaps. You can also be clever and use this parameter to skip lines, etc. + * Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * * @param height height (in pixels) of the source image + * * @param pixelFormat pixel format of the source image (see @ref TJPF - * "Pixel formats".) + * "Pixel formats".) + * * @param dstBuf pointer to an image buffer that will receive the YUV image. - * Use #tjBufSizeYUV2() to determine the appropriate size for this - * buffer based on the image width, height, padding, and level of - * chrominance subsampling. The Y, U (Cb), and V (Cr) image planes will - * be stored sequentially in the buffer (refer to @ref YUVnotes - * "YUV Image Format Notes".) + * Use #tjBufSizeYUV2() to determine the appropriate size for this buffer based + * on the image width, height, padding, and level of chrominance subsampling. + * The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the + * buffer (refer to @ref YUVnotes "YUV Image Format Notes".) + * * @param pad the width of each line in each plane of the YUV image will be - * padded to the nearest multiple of this number of bytes (must be a - * power of 2.) To generate images suitable for X Video, pad - * should be set to 4. + * padded to the nearest multiple of this number of bytes (must be a power of + * 2.) To generate images suitable for X Video, pad should be set to + * 4. + * * @param subsamp the level of chrominance subsampling to be used when - * generating the YUV image (see @ref TJSAMP - * "Chrominance subsampling options".) To generate images suitable for - * X Video, subsamp should be set to @ref TJSAMP_420. This - * produces an image compatible with the I420 (AKA "YUV420P") format. + * generating the YUV image (see @ref TJSAMP + * "Chrominance subsampling options".) To generate images suitable for X + * Video, subsamp should be set to @ref TJSAMP_420. This produces an + * image compatible with the I420 (AKA "YUV420P") format. + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -870,41 +913,49 @@ DLLEXPORT int DLLCALL tjEncodeYUV3(tjhandle handle, * compression process. * * @param handle a handle to a TurboJPEG compressor or transformer instance + * * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels - * to be encoded + * to be encoded + * * @param width width (in pixels) of the source image + * * @param pitch bytes per line of the source image. Normally, this should be - * width * #tjPixelSize[pixelFormat] if the image is unpadded, - * or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of - * the image is padded to the nearest 32-bit boundary, as is the case - * for Windows bitmaps. You can also be clever and use this parameter - * to skip lines, etc. Setting this parameter to 0 is the equivalent of - * setting it to width * #tjPixelSize[pixelFormat]. + * width * #tjPixelSize[pixelFormat] if the image is unpadded, or + * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image + * is padded to the nearest 32-bit boundary, as is the case for Windows + * bitmaps. You can also be clever and use this parameter to skip lines, etc. + * Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * * @param height height (in pixels) of the source image + * * @param pixelFormat pixel format of the source image (see @ref TJPF - * "Pixel formats".) + * "Pixel formats".) + * * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes - * (or just a Y plane, if generating a grayscale image) that will - * receive the encoded image. These planes can be contiguous or - * non-contiguous in memory. Each plane should be at least - * {component stride} * {component height} bytes in size. - * (See below for a description of stride, and refer to @ref YUVnotes - * "YUV Image Format Notes" for a description of component height.) + * (or just a Y plane, if generating a grayscale image) that will receive the + * encoded image. These planes can be contiguous or non-contiguous in memory. + * Each plane should be at least + * {component stride} * {component height} bytes in size. + * (See below for a description of stride, and refer to @ref YUVnotes + * "YUV Image Format Notes" for a description of component height.) + * * @param strides an array of integers, each specifying the number of bytes per - * line in the corresponding plane of the output image. Setting the - * stride for any plane to 0 is the same as setting it to the component - * width for the plane. If stride is NULL, then the strides - * for all planes will be set to their respective component widths. You - * can adjust the strides in order to add an arbitrary amount of line - * padding to each plane or to encode an RGB or grayscale image into a - * subregion of a larger YUV planar image. + * line in the corresponding plane of the output image. Setting the stride for + * any plane to 0 is the same as setting it to the component width for the + * plane. If stride is NULL, then the strides for all planes will be + * set to their respective component widths. You can adjust the strides in + * order to add an arbitrary amount of line padding to each plane or to encode + * an RGB or grayscale image into a subregion of a larger YUV planar image. + * * @param subsamp the level of chrominance subsampling to be used when - * generating the YUV image (see @ref TJSAMP - * "Chrominance subsampling options".) To generate images suitable for - * X Video, subsamp should be set to @ref TJSAMP_420. This - * produces an image compatible with the I420 (AKA "YUV420P") format. + * generating the YUV image (see @ref TJSAMP + * "Chrominance subsampling options".) To generate images suitable for X + * Video, subsamp should be set to @ref TJSAMP_420. This produces an + * image compatible with the I420 (AKA "YUV420P") format. + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -926,18 +977,24 @@ DLLEXPORT tjhandle DLLCALL tjInitDecompress(void); * Retrieve information about a JPEG image without decompressing it. * * @param handle a handle to a TurboJPEG decompressor or transformer instance + * * @param jpegBuf pointer to a buffer containing a JPEG image + * * @param jpegSize size of the JPEG image (in bytes) + * * @param width pointer to an integer variable that will receive the width (in - * pixels) of the JPEG image + * pixels) of the JPEG image + * * @param height pointer to an integer variable that will receive the height - * (in pixels) of the JPEG image + * (in pixels) of the JPEG image + * * @param jpegSubsamp pointer to an integer variable that will receive the - * level of chrominance subsampling used when compressing the JPEG image - * (see @ref TJSAMP "Chrominance subsampling options".) + * level of chrominance subsampling used when compressing the JPEG image (see + * @ref TJSAMP "Chrominance subsampling options".) + * * @param jpegColorspace pointer to an integer variable that will receive one - * of the JPEG colorspace constants, indicating the colorspace of the - * JPEG image (see @ref TJCS "JPEG colorspaces".) + * of the JPEG colorspace constants, indicating the colorspace of the JPEG + * image (see @ref TJCS "JPEG colorspaces".) * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -951,7 +1008,7 @@ DLLEXPORT int DLLCALL tjDecompressHeader3(tjhandle handle, * this implementation of TurboJPEG supports. * * @param numscalingfactors pointer to an integer variable that will receive - * the number of elements in the list + * the number of elements in the list * * @return a pointer to a list of fractional scaling factors, or NULL if an * error is encountered (see #tjGetErrorStr().) @@ -963,42 +1020,48 @@ DLLEXPORT tjscalingfactor* DLLCALL tjGetScalingFactors(int *numscalingfactors); * Decompress a JPEG image to an RGB, grayscale, or CMYK image. * * @param handle a handle to a TurboJPEG decompressor or transformer instance + * * @param jpegBuf pointer to a buffer containing the JPEG image to decompress + * * @param jpegSize size of the JPEG image (in bytes) + * * @param dstBuf pointer to an image buffer that will receive the decompressed - * image. This buffer should normally be pitch * scaledHeight - * bytes in size, where scaledHeight can be determined by - * calling #TJSCALED() with the JPEG image height and one of the scaling - * factors returned by #tjGetScalingFactors(). The dstBuf - * pointer may also be used to decompress into a specific region of a - * larger buffer. + * image. This buffer should normally be pitch * scaledHeight bytes + * in size, where scaledHeight can be determined by calling + * #TJSCALED() with the JPEG image height and one of the scaling factors + * returned by #tjGetScalingFactors(). The dstBuf pointer may also be + * used to decompress into a specific region of a larger buffer. + * * @param width desired width (in pixels) of the destination image. If this is - * different than the width of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the - * largest possible image that will fit within the desired width. If - * width is set to 0, then only the height will be considered - * when determining the scaled image size. + * different than the width of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired width. If width is + * set to 0, then only the height will be considered when determining the + * scaled image size. + * * @param pitch bytes per line of the destination image. Normally, this is - * scaledWidth * #tjPixelSize[pixelFormat] if the decompressed - * image is unpadded, else #TJPAD(scaledWidth * - * #tjPixelSize[pixelFormat]) if each line of the decompressed - * image is padded to the nearest 32-bit boundary, as is the case for - * Windows bitmaps. (NOTE: scaledWidth can be determined by - * calling #TJSCALED() with the JPEG image width and one of the scaling - * factors returned by #tjGetScalingFactors().) You can also be clever - * and use the pitch parameter to skip lines, etc. Setting this - * parameter to 0 is the equivalent of setting it to - * scaledWidth * #tjPixelSize[pixelFormat]. + * scaledWidth * #tjPixelSize[pixelFormat] if the decompressed image + * is unpadded, else #TJPAD(scaledWidth * #tjPixelSize[pixelFormat]) + * if each line of the decompressed image is padded to the nearest 32-bit + * boundary, as is the case for Windows bitmaps. (NOTE: scaledWidth + * can be determined by calling #TJSCALED() with the JPEG image width and one + * of the scaling factors returned by #tjGetScalingFactors().) You can also be + * clever and use the pitch parameter to skip lines, etc. Setting this + * parameter to 0 is the equivalent of setting it to + * scaledWidth * #tjPixelSize[pixelFormat]. + * * @param height desired height (in pixels) of the destination image. If this - * is different than the height of the JPEG image being decompressed, - * then TurboJPEG will use scaling in the JPEG decompressor to generate - * the largest possible image that will fit within the desired height. - * If height is set to 0, then only the width will be - * considered when determining the scaled image size. + * is different than the height of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired height. If height + * is set to 0, then only the width will be considered when determining the + * scaled image size. + * * @param pixelFormat pixel format of the destination image (see @ref - * TJPF "Pixel formats".) + * TJPF "Pixel formats".) + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1013,36 +1076,42 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, * image is generated instead of an RGB image. * * @param handle a handle to a TurboJPEG decompressor or transformer instance + * * @param jpegBuf pointer to a buffer containing the JPEG image to decompress + * * @param jpegSize size of the JPEG image (in bytes) + * * @param dstBuf pointer to an image buffer that will receive the YUV image. - * Use #tjBufSizeYUV2() to determine the appropriate size for this - * buffer based on the image width, height, padding, and level of - * subsampling. The Y, U (Cb), and V (Cr) image planes will be stored - * sequentially in the buffer (refer to @ref YUVnotes - * "YUV Image Format Notes".) + * Use #tjBufSizeYUV2() to determine the appropriate size for this buffer based + * on the image width, height, padding, and level of subsampling. The Y, + * U (Cb), and V (Cr) image planes will be stored sequentially in the buffer + * (refer to @ref YUVnotes "YUV Image Format Notes".) + * * @param width desired width (in pixels) of the YUV image. If this is - * different than the width of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the - * largest possible image that will fit within the desired width. If - * width is set to 0, then only the height will be considered - * when determining the scaled image size. If the scaled width is not - * an even multiple of the MCU block width (see #tjMCUWidth), then an - * intermediate buffer copy will be performed within TurboJPEG. + * different than the width of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired width. If width is + * set to 0, then only the height will be considered when determining the + * scaled image size. If the scaled width is not an even multiple of the MCU + * block width (see #tjMCUWidth), then an intermediate buffer copy will be + * performed within TurboJPEG. + * * @param pad the width of each line in each plane of the YUV image will be - * padded to the nearest multiple of this number of bytes (must be a - * power of 2.) To generate images suitable for X Video, pad - * should be set to 4. + * padded to the nearest multiple of this number of bytes (must be a power of + * 2.) To generate images suitable for X Video, pad should be set to + * 4. + * * @param height desired height (in pixels) of the YUV image. If this is - * different than the height of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the - * largest possible image that will fit within the desired height. If - * height is set to 0, then only the width will be considered - * when determining the scaled image size. If the scaled height is not - * an even multiple of the MCU block height (see #tjMCUHeight), then an - * intermediate buffer copy will be performed within TurboJPEG. + * different than the height of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired height. If height + * is set to 0, then only the width will be considered when determining the + * scaled image size. If the scaled height is not an even multiple of the MCU + * block height (see #tjMCUHeight), then an intermediate buffer copy will be + * performed within TurboJPEG. + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1057,42 +1126,47 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, * conversion step, so a planar YUV image is generated instead of an RGB image. * * @param handle a handle to a TurboJPEG decompressor or transformer instance + * * @param jpegBuf pointer to a buffer containing the JPEG image to decompress + * * @param jpegSize size of the JPEG image (in bytes) + * * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes - * (or just a Y plane, if decompressing a grayscale image) that will - * receive the YUV image. These planes can be contiguous or - * non-contiguous in memory. Each plane should be at least - * {component stride} * {scaled component height} bytes in - * size. (See below for a description of stride, and refer to @ref - * YUVnotes "YUV Image Format Notes" for a description of component - * height.) + * (or just a Y plane, if decompressing a grayscale image) that will receive + * the YUV image. These planes can be contiguous or non-contiguous in memory. + * Each plane should be at least + * {component stride} * {scaled component height} bytes in size. + * (See below for a description of stride, and refer to @ref YUVnotes + * "YUV Image Format Notes" for a description of component height.) + * * @param width desired width (in pixels) of the YUV image. If this is - * different than the width of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the - * largest possible image that will fit within the desired width. If - * width is set to 0, then only the height will be considered - * when determining the scaled image size. If the scaled width is not - * an even multiple of the MCU block width (see #tjMCUWidth), then an - * intermediate buffer copy will be performed within TurboJPEG. + * different than the width of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired width. If width is + * set to 0, then only the height will be considered when determining the + * scaled image size. If the scaled width is not an even multiple of the MCU + * block width (see #tjMCUWidth), then an intermediate buffer copy will be + * performed within TurboJPEG. + * * @param strides an array of integers, each specifying the number of bytes per - * line in the corresponding plane of the output image. Setting the - * stride for any plane to 0 is the same as setting it to the scaled - * component width for the plane. If stride is NULL, then the - * strides for all planes will be set to their respective scaled - * component widths. You can adjust the strides in order to add an - * arbitrary amount of line padding to each plane or to decompress the - * JPEG image into a subregion of a larger YUV planar image. + * line in the corresponding plane of the output image. Setting the stride for + * any plane to 0 is the same as setting it to the scaled component width for + * the plane. If stride is NULL, then the strides for all planes will + * be set to their respective scaled component widths. You can adjust the + * strides in order to add an arbitrary amount of line padding to each plane or + * to decompress the JPEG image into a subregion of a larger YUV planar image. + * * @param height desired height (in pixels) of the YUV image. If this is - * different than the height of the JPEG image being decompressed, then - * TurboJPEG will use scaling in the JPEG decompressor to generate the - * largest possible image that will fit within the desired height. If - * height is set to 0, then only the width will be considered - * when determining the scaled image size. If the scaled height is not - * an even multiple of the MCU block height (see #tjMCUHeight), then an - * intermediate buffer copy will be performed within TurboJPEG. + * different than the height of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired height. If height + * is set to 0, then only the width will be considered when determining the + * scaled image size. If the scaled height is not an even multiple of the MCU + * block height (see #tjMCUHeight), then an intermediate buffer copy will be + * performed within TurboJPEG. + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1108,36 +1182,43 @@ DLLEXPORT int DLLCALL tjDecompressToYUVPlanes(tjhandle handle, * process. * * @param handle a handle to a TurboJPEG decompressor or transformer instance + * * @param srcBuf pointer to an image buffer containing a YUV planar image to be - * decoded. The size of this buffer should match the value returned - * by #tjBufSizeYUV2() for the given image width, height, padding, and - * level of chrominance subsampling. The Y, U (Cb), and V (Cr) image - * planes should be stored sequentially in the source buffer (refer to - * @ref YUVnotes "YUV Image Format Notes".) + * decoded. The size of this buffer should match the value returned by + * #tjBufSizeYUV2() for the given image width, height, padding, and level of + * chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be + * stored sequentially in the source buffer (refer to @ref YUVnotes + * "YUV Image Format Notes".) + * * @param pad Use this parameter to specify that the width of each line in each - * plane of the YUV source image is padded to the nearest multiple of - * this number of bytes (must be a power of 2.) + * plane of the YUV source image is padded to the nearest multiple of this + * number of bytes (must be a power of 2.) + * * @param subsamp the level of chrominance subsampling used in the YUV source - * image (see @ref TJSAMP "Chrominance subsampling options".) + * image (see @ref TJSAMP "Chrominance subsampling options".) + * * @param dstBuf pointer to an image buffer that will receive the decoded - * image. This buffer should normally be pitch * height - * bytes in size, but the dstBuf pointer can also be used to - * decode into a specific region of a larger buffer. + * image. This buffer should normally be pitch * height bytes in + * size, but the dstBuf pointer can also be used to decode into a + * specific region of a larger buffer. + * * @param width width (in pixels) of the source and destination images + * * @param pitch bytes per line of the destination image. Normally, this should - * be width * #tjPixelSize[pixelFormat] if the destination - * image is unpadded, or #TJPAD(width * - * #tjPixelSize[pixelFormat]) if each line of the destination - * image should be padded to the nearest 32-bit boundary, as is the case - * for Windows bitmaps. You can also be clever and use the pitch - * parameter to skip lines, etc. Setting this parameter to 0 is the - * equivalent of setting it to width * - * #tjPixelSize[pixelFormat]. + * be width * #tjPixelSize[pixelFormat] if the destination image is + * unpadded, or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line + * of the destination image should be padded to the nearest 32-bit boundary, as + * is the case for Windows bitmaps. You can also be clever and use the pitch + * parameter to skip lines, etc. Setting this parameter to 0 is the equivalent + * of setting it to width * #tjPixelSize[pixelFormat]. + * * @param height height (in pixels) of the source and destination images + * * @param pixelFormat pixel format of the destination image (see @ref TJPF - * "Pixel formats".) + * "Pixel formats".) + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1153,42 +1234,48 @@ DLLEXPORT int DLLCALL tjDecodeYUV(tjhandle handle, unsigned char *srcBuf, * decompression process. * * @param handle a handle to a TurboJPEG decompressor or transformer instance + * * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes - * (or just a Y plane, if decoding a grayscale image) that contain a - * YUV image to be decoded. These planes can be contiguous or - * non-contiguous in memory. Each plane should be at least - * {component stride} * {component height} bytes in size. - * (See below for a description of stride, and refer to @ref YUVnotes - * "YUV Image Format Notes" for a description of component height.) + * (or just a Y plane, if decoding a grayscale image) that contain a YUV image + * to be decoded. These planes can be contiguous or non-contiguous in memory. + * Each plane should be at least + * {component stride} * {component height} bytes in size. + * (See below for a description of stride, and refer to @ref YUVnotes + * "YUV Image Format Notes" for a description of component height.) + * * @param strides an array of integers, each specifying the number of bytes per - * line in the corresponding plane of the YUV source image. Setting the - * stride for any plane to 0 is the same as setting it to the component - * width for the plane. If stride is NULL, then the strides - * for all planes will be set to their respective component widths. You - * can adjust the strides in order to specify an arbitrary amount of - * line padding in each plane or to decode a subregion of a larger YUV - * planar image. + * line in the corresponding plane of the YUV source image. Setting the stride + * for any plane to 0 is the same as setting it to the component width for the + * plane. If stride is NULL, then the strides for all planes will be + * set to their respective component widths. You can adjust the strides in + * order to specify an arbitrary amount of line padding in each plane or to + * decode a subregion of a larger YUV planar image. + * * @param subsamp the level of chrominance subsampling used in the YUV source - * image (see @ref TJSAMP "Chrominance subsampling options".) + * image (see @ref TJSAMP "Chrominance subsampling options".) + * * @param dstBuf pointer to an image buffer that will receive the decoded - * image. This buffer should normally be pitch * height - * bytes in size, but the dstBuf pointer can also be used to - * decode into a specific region of a larger buffer. + * image. This buffer should normally be pitch * height bytes in + * size, but the dstBuf pointer can also be used to decode into a + * specific region of a larger buffer. + * * @param width width (in pixels) of the source and destination images + * * @param pitch bytes per line of the destination image. Normally, this should - * be width * #tjPixelSize[pixelFormat] if the destination - * image is unpadded, or #TJPAD(width * - * #tjPixelSize[pixelFormat]) if each line of the destination - * image should be padded to the nearest 32-bit boundary, as is the case - * for Windows bitmaps. You can also be clever and use the pitch - * parameter to skip lines, etc. Setting this parameter to 0 is the - * equivalent of setting it to width * - * #tjPixelSize[pixelFormat]. + * be width * #tjPixelSize[pixelFormat] if the destination image is + * unpadded, or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line + * of the destination image should be padded to the nearest 32-bit boundary, as + * is the case for Windows bitmaps. You can also be clever and use the pitch + * parameter to skip lines, etc. Setting this parameter to 0 is the equivalent + * of setting it to width * #tjPixelSize[pixelFormat]. + * * @param height height (in pixels) of the source and destination images + * * @param pixelFormat pixel format of the destination image (see @ref TJPF - * "Pixel formats".) + * "Pixel formats".) + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1220,38 +1307,43 @@ DLLEXPORT tjhandle DLLCALL tjInitTransform(void); * source coefficients multiple times. * * @param handle a handle to a TurboJPEG transformer instance + * * @param jpegBuf pointer to a buffer containing the JPEG image to transform + * * @param jpegSize size of the JPEG image (in bytes) + * * @param n the number of transformed JPEG images to generate + * * @param dstBufs pointer to an array of n image buffers. dstBufs[i] - * will receive a JPEG image that has been transformed using the - * parameters in transforms[i]. TurboJPEG has the ability to - * reallocate the JPEG buffer to accommodate the size of the JPEG image. - * Thus, you can choose to: - * -# pre-allocate the JPEG buffer with an arbitrary size using - * #tjAlloc() and let TurboJPEG grow the buffer as needed, - * -# set dstBufs[i] to NULL to tell TurboJPEG to allocate the - * buffer for you, or - * -# pre-allocate the buffer to a "worst case" size determined by - * calling #tjBufSize() with the transformed or cropped width and - * height. This should ensure that the buffer never has to be - * re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) - * . - * If you choose option 1, dstSizes[i] should be set to - * the size of your pre-allocated buffer. In any case, unless you have - * set #TJFLAG_NOREALLOC, you should always check dstBufs[i] - * upon return from this function, as it may have changed. + * will receive a JPEG image that has been transformed using the parameters in + * transforms[i]. TurboJPEG has the ability to reallocate the JPEG + * buffer to accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and + * let TurboJPEG grow the buffer as needed, + * -# set dstBufs[i] to NULL to tell TurboJPEG to allocate the buffer + * for you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tjBufSize() with the transformed or cropped width and height. This should + * ensure that the buffer never has to be re-allocated (setting + * #TJFLAG_NOREALLOC guarantees this.) + * . + * If you choose option 1, dstSizes[i] should be set to the size of + * your pre-allocated buffer. In any case, unless you have set + * #TJFLAG_NOREALLOC, you should always check dstBufs[i] upon return + * from this function, as it may have changed. + * * @param dstSizes pointer to an array of n unsigned long variables that will - * receive the actual sizes (in bytes) of each transformed JPEG image. - * If dstBufs[i] points to a pre-allocated buffer, then - * dstSizes[i] should be set to the size of the buffer. Upon - * return, dstSizes[i] will contain the size of the JPEG image - * (in bytes.) + * receive the actual sizes (in bytes) of each transformed JPEG image. If + * dstBufs[i] points to a pre-allocated buffer, then + * dstSizes[i] should be set to the size of the buffer. Upon return, + * dstSizes[i] will contain the size of the JPEG image (in bytes.) + * * @param transforms pointer to an array of n #tjtransform structures, each of - * which specifies the transform parameters and/or cropping region for - * the corresponding transformed output image. + * which specifies the transform parameters and/or cropping region for the + * corresponding transformed output image. + * * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP - * "flags". + * "flags". * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1264,7 +1356,7 @@ DLLEXPORT int DLLCALL tjTransform(tjhandle handle, unsigned char *jpegBuf, * Destroy a TurboJPEG compressor, decompressor, or transformer instance. * * @param handle a handle to a TurboJPEG compressor, decompressor or - * transformer instance + * transformer instance * * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) */ @@ -1280,7 +1372,7 @@ DLLEXPORT int DLLCALL tjDestroy(tjhandle handle); * @param bytes the number of bytes to allocate * * @return a pointer to a newly-allocated buffer with the specified number of - * bytes + * bytes * * @sa tjFree() */