From: DRC Date: Sun, 10 Aug 2014 20:12:17 +0000 (+0000) Subject: Clean up and consolidate notes regarding the YUV image format. This also corrects... X-Git-Tag: 1.3.90~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=493be61707c0337664bdb1ad1ac352ffb1423697;p=libjpeg-turbo Clean up and consolidate notes regarding the YUV image format. This also corrects a factual error regarding the padding of the luminance plane-- because we now support 4:1:1, the component width is not necessarily padded to the nearest multiple of 2 if horizontal subsampling is used. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1342 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 e379326..eff285e 100644 --- a/doc/html/group___turbo_j_p_e_g.html +++ b/doc/html/group___turbo_j_p_e_g.html @@ -302,7 +302,11 @@ Variables

Detailed Description

TurboJPEG API.

This API provides an interface for generating, decoding, and transforming planar YUV and JPEG images in memory.

-
Note
Technically, the JPEG format uses the YCbCr colorspace (which is technically not a colorspace but a color transform), but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.
+

+

YUV Image Format Notes

+

Technically, the JPEG format uses the YCbCr colorspace (which is technically not a colorspace but a color transform), but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an image format consisting of Y, Cb, and Cr image planes.

+

Each plane is simply a 2D array of bytes, each byte representing the value of one of the components (Y, Cb, or Cr) at a particular location in the image. The "component width" and "component height" of each plane are determined by the image width, height, and level of chrominance subsampling. For the luminance plane, the component width is the image width padded to the nearest multiple of the horizontal subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the component height of the luminance plane is the image height padded to the nearest multiple of the vertical subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or grayscale.) This is irrespective of any additional padding that may be specified as an argument to the various YUV functions. The component width of the chrominance planes is equal to the component width of the luminance plane divided by the horizontal subsampling factor, and the component height of the chrominance planes is equal to the component height of the luminance plane divided by the vertical subsampling factor.

+

For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 18 x 35 bytes. If you specify a line padding of 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 20 x 35 bytes.

Macro Definition Documentation

@@ -1070,14 +1074,13 @@ If you choose option 1, *jpegSize should be set to the size of your

Compress a YUV planar image into a JPEG image.

-
Note
If the width or height of the YUV image is not an even multiple of the MCU block size (see tjMCUWidth and tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
Parameters
- - + + - +
handlea handle to a TurboJPEG compressor or transformer instance
srcBufpointer to an image buffer containing a YUV planar image to be compressed. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the buffer, and the size of each plane is determined by the specified width, height, padding, and level of chrominance subsampling. If the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane should be padded to the nearest multiple of 2 (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.) This is irrespective of any additional padding specified in the pad parameter.
widthwidth (in pixels) of the source image
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
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. @@ -1168,11 +1171,11 @@ If you choose option 1, *jpegSize should be set to the size of your

    Decode a YUV planar image into an RGB or grayscale image.

    -

    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. The Y, U (Cb), and V (Cr) image planes should be stored sequentially in the source buffer, and the size of each plane is determined by the width and height of the source image, as well as the specified padding and level of chrominance subsampling. If the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane should be padded to the nearest multiple of 2 in the input image (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.)

    +

    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
    - + @@ -1405,17 +1408,16 @@ If you choose option 1, *jpegSize should be set to the size of your

    Decompress a JPEG image to a YUV planar image.

    -

    This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image. The structure of the planes in this image is the same as in the images generated by tjEncodeYUV3().

    -
    Note
    If the width or height of the JPEG image is not an even multiple of the MCU block size (see tjMCUWidth and tjMCUHeight), then an intermediate buffer copy will be performed within TurboJPEG.
    +

    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
    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.
    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.
    - - + + - +
    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.
    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.
    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.
    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.
    @@ -1522,7 +1524,7 @@ If you choose option 1, *jpegSize should be set to the size of your

    Encode an RGB or grayscale image into a YUV planar image.

    -

    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. The Y, U (Cb), and V (Cr) image planes are stored sequentially into the destination buffer, and the size of each plane is determined by the width and height of the source image, as well as the specified padding and level of chrominance subsampling. If the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane is padded to the nearest multiple of 2 in the output image (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.)

    +

    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
    @@ -1531,7 +1533,7 @@ If you choose option 1, *jpegSize should be set to the size of your - + diff --git a/java/doc/index-all.html b/java/doc/index-all.html index fa92e3c..a976556 100644 --- a/java/doc/index-all.html +++ b/java/doc/index-all.html @@ -857,7 +857,7 @@
     
    YUVImage - Class in org.libjpegturbo.turbojpeg
    -
    This class encapsulates a YUV planar image buffer and the metadata +
    This class encapsulates a YUV planar image and the metadata associated with it.
    YUVImage(int, int, int, int) - Constructor for class org.libjpegturbo.turbojpeg.YUVImage
    diff --git a/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html b/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html index 13e6160..3e7a6e8 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html +++ b/java/doc/org/libjpegturbo/turbojpeg/YUVImage.html @@ -94,7 +94,7 @@
    public class YUVImage
     extends java.lang.Object
    -
    This class encapsulates a YUV planar image buffer and the metadata +
    This class encapsulates a YUV planar image and the metadata associated with it. The TurboJPEG API allows both the JPEG compression and decompression pipelines to be split into stages: YUV encode, compress from YUV, decompress to YUV, and YUV decode. A YUVImage instance @@ -105,18 +105,28 @@ extends java.lang.Object Technically, the JPEG format uses the YCbCr colorspace (which technically is not a "colorspace" but rather a "color transform"), but per the convention of the digital video community, the TurboJPEG API uses "YUV" to refer to an - image format consisting of Y, Cb, and Cr image planes. In this image - format, the Y, Cb (U), and Cr (V) planes are stored sequentially in the same - image buffer, and the size of each plane is determined by the image width, - height, line padding, and level of chrominance subsampling. If the - chrominance components are subsampled along the horizontal dimension, then - the width of the luminance plane would be padded to the nearest multiple of - 2 (same goes for the height of the luminance plane, if the chrominance - components are subsampled along the vertical dimension.) For instance, if - the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the - luminance plane would be 36 x 35 bytes, and each of the chrominance planes - would be 18 x 35 bytes. If you specify, for instance, a line padding of 4 - bytes on top of this, then the luminance plane would be 36 x 35 bytes, and + image format consisting of Y, Cb, and Cr image planes. +

    + Each plane is simply a 2D array of bytes, each byte representing the value + of one of the components at a particular location in the image. The + "component width" and "component height" of each plane are determined by the + image width, height, and level of chrominance subsampling. For the + luminance plane, the component width is the image width padded to the + nearest multiple of the horizontal subsampling factor (2 in the case of + 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or + grayscale.) Similarly, the component height of the luminance plane is the + image height padded to the nearest multiple of the vertical subsampling + factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or + grayscale.) The component width of the chrominance planes is equal to the + component width of the luminance plane divided by the horizontal subsampling + factor, and the component height of the chrominance planes is equal to the + component height of the luminance plane divided by the vertical subsampling + factor. +

    + For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is + used, then the luminance plane would be 36 x 35 bytes, and each of the + chrominance planes would be 18 x 35 bytes. If you specify a line padding of + 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and each of the chrominance planes would be 20 x 35 bytes.

    @@ -372,9 +382,10 @@ extends java.lang.Object
    Create a YUVImage instance from an existing YUV planar image buffer.
    Parameters:
    yuvImage - image buffer that contains or will contain YUV planar - image data. See above for a description of the image - format. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for this - buffer.
    width - width (in pixels) of the YUV image
    pad - the line padding used in the YUV image buffer. For + image data. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for + this buffer. The Y, U (Cb), and V (Cr) image planes are stored + sequentially in the buffer (see above for a description + of the image format.)
    width - width (in pixels) of the YUV image
    pad - the line padding used in the YUV image buffer. For instance, if each line in each plane of the buffer is padded to the nearest multiple of 4 bytes, then pad should be set to 4.
    height - height (in pixels) of the YUV image
    subsamp - the level of chrominance subsampling used in the YUV image (one of TJ.SAMP_*)
    @@ -405,9 +416,10 @@ extends java.lang.Object
    Assign an existing YUV planar image buffer to this YUVImage instance.
    Parameters:
    yuvImage - image buffer that contains or will contain YUV planar - image data. See above for a description of the image - format. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for this - buffer.
    width - width (in pixels) of the YUV image
    pad - the line padding used in the YUV image buffer. For + image data. Use TJ.bufSizeYUV(int, int, int, int) to determine the minimum size for + this buffer. The Y, U (Cb), and V (Cr) image planes are stored + sequentially in the buffer (see above for a description + of the image format.)
    width - width (in pixels) of the YUV image
    pad - the line padding used in the YUV image buffer. For instance, if each line in each plane of the buffer is padded to the nearest multiple of 4 bytes, then pad should be set to 4.
    height - height (in pixels) of the YUV image
    subsamp - the level of chrominance subsampling used in the YUV image (one of TJ.SAMP_*)
    diff --git a/java/doc/org/libjpegturbo/turbojpeg/package-summary.html b/java/doc/org/libjpegturbo/turbojpeg/package-summary.html index c5e2f7d..ea36057 100644 --- a/java/doc/org/libjpegturbo/turbojpeg/package-summary.html +++ b/java/doc/org/libjpegturbo/turbojpeg/package-summary.html @@ -127,7 +127,7 @@
    diff --git a/java/org/libjpegturbo/turbojpeg/YUVImage.java b/java/org/libjpegturbo/turbojpeg/YUVImage.java index 619b0c3..27b1b70 100644 --- a/java/org/libjpegturbo/turbojpeg/YUVImage.java +++ b/java/org/libjpegturbo/turbojpeg/YUVImage.java @@ -29,7 +29,7 @@ package org.libjpegturbo.turbojpeg; /** - * This class encapsulates a YUV planar image buffer and the metadata + * This class encapsulates a YUV planar image and the metadata * associated with it. The TurboJPEG API allows both the JPEG compression and * decompression pipelines to be split into stages: YUV encode, compress from * YUV, decompress to YUV, and YUV decode. A YUVImage instance @@ -40,18 +40,28 @@ package org.libjpegturbo.turbojpeg; * Technically, the JPEG format uses the YCbCr colorspace (which technically is * not a "colorspace" but rather a "color transform"), but per the convention * of the digital video community, the TurboJPEG API uses "YUV" to refer to an - * image format consisting of Y, Cb, and Cr image planes. In this image - * format, the Y, Cb (U), and Cr (V) planes are stored sequentially in the same - * image buffer, and the size of each plane is determined by the image width, - * height, line padding, and level of chrominance subsampling. If the - * chrominance components are subsampled along the horizontal dimension, then - * the width of the luminance plane would be padded to the nearest multiple of - * 2 (same goes for the height of the luminance plane, if the chrominance - * components are subsampled along the vertical dimension.) For instance, if - * the source image is 35 x 35 pixels and 4:2:2 subsampling is used, then the - * luminance plane would be 36 x 35 bytes, and each of the chrominance planes - * would be 18 x 35 bytes. If you specify, for instance, a line padding of 4 - * bytes on top of this, then the luminance plane would be 36 x 35 bytes, and + * image format consisting of Y, Cb, and Cr image planes. + *

    + * Each plane is simply a 2D array of bytes, each byte representing the value + * of one of the components at a particular location in the image. The + * "component width" and "component height" of each plane are determined by the + * image width, height, and level of chrominance subsampling. For the + * luminance plane, the component width is the image width padded to the + * nearest multiple of the horizontal subsampling factor (2 in the case of + * 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or + * grayscale.) Similarly, the component height of the luminance plane is the + * image height padded to the nearest multiple of the vertical subsampling + * factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or + * grayscale.) The component width of the chrominance planes is equal to the + * component width of the luminance plane divided by the horizontal subsampling + * factor, and the component height of the chrominance planes is equal to the + * component height of the luminance plane divided by the vertical subsampling + * factor. + *

    + * For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is + * used, then the luminance plane would be 36 x 35 bytes, and each of the + * chrominance planes would be 18 x 35 bytes. If you specify a line padding of + * 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and * each of the chrominance planes would be 20 x 35 bytes. */ public class YUVImage { @@ -83,9 +93,10 @@ public class YUVImage { * buffer. * * @param yuvImage image buffer that contains or will contain YUV planar - * image data. See {@link YUVImage above} for a description of the image - * format. Use {@link TJ#bufSizeYUV} to determine the minimum size for this - * buffer. + * image data. Use {@link TJ#bufSizeYUV} to determine the minimum size for + * this buffer. The Y, U (Cb), and V (Cr) image planes are stored + * sequentially in the buffer (see {@link YUVImage above} for a description + * of the image format.) * * @param width width (in pixels) of the YUV image * @@ -108,9 +119,10 @@ public class YUVImage { * instance. * * @param yuvImage image buffer that contains or will contain YUV planar - * image data. See {@link YUVImage above} for a description of the image - * format. Use {@link TJ#bufSizeYUV} to determine the minimum size for this - * buffer. + * image data. Use {@link TJ#bufSizeYUV} to determine the minimum size for + * this buffer. The Y, U (Cb), and V (Cr) image planes are stored + * sequentially in the buffer (see {@link YUVImage above} for a description + * of the image format.) * * @param width width (in pixels) of the YUV image * diff --git a/turbojpeg.h b/turbojpeg.h index 0c66341..36ede71 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -42,10 +42,36 @@ * TurboJPEG API. This API provides an interface for generating, decoding, and * transforming planar YUV and JPEG images in memory. * - * @note Technically, the JPEG format uses the YCbCr colorspace (which is - * technically not a colorspace but a color transform), but per the convention - * of the digital video community, the TurboJPEG API uses "YUV" to refer to an - * image format consisting of Y, Cb, and Cr image planes. + * @anchor YUVnotes + * YUV Image Format Notes + * ---------------------- + * Technically, the JPEG format uses the YCbCr colorspace (which is technically + * not a colorspace but a color transform), but per the convention of the + * digital video community, the TurboJPEG API uses "YUV" to refer to an image + * format consisting of Y, Cb, and Cr image planes. + * + * Each plane is simply a 2D array of bytes, each byte representing the value + * of one of the components (Y, Cb, or Cr) at a particular location in the + * image. The "component width" and "component height" of each plane are + * determined by the image width, height, and level of chrominance subsampling. + * For the luminance plane, the component width is the image width padded to + * the nearest multiple of the horizontal subsampling factor (2 in the case of + * 4:2:0 and 4:2:2, 4 in the case of 4:1:1, 1 in the case of 4:4:4 or + * grayscale.) Similarly, the component height of the luminance plane is the + * image height padded to the nearest multiple of the vertical subsampling + * factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 or + * grayscale.) This is irrespective of any additional padding that may be + * specified as an argument to the various YUV functions. The component width + * of the chrominance planes is equal to the component width of the luminance + * plane divided by the horizontal subsampling factor, and the component height + * of the chrominance planes is equal to the component height of the luminance + * plane divided by the vertical subsampling factor. + * + * For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is + * used, then the luminance plane would be 36 x 35 bytes, and each of the + * chrominance planes would be 18 x 35 bytes. If you specify a line padding of + * 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and + * each of the chrominance planes would be 20 x 35 bytes. * * @{ */ @@ -641,27 +667,22 @@ DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, /** * Compress a YUV planar image into a JPEG image. * - * @note If the width or height of the YUV image is not an even multiple of the - * MCU block size (see #tjMCUWidth and #tjMCUHeight), then an intermediate - * buffer copy will be performed within TurboJPEG. - * * @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 Y, U (Cb), and V (Cr) image planes should be - * stored sequentially in the buffer, and the size of each plane - * is determined by the specified width, height, padding, and level of - * chrominance subsampling. If the chrominance components are - * subsampled along the horizontal dimension, then the width of the - * luminance plane should be padded to the nearest multiple of 2 (same - * goes for the height of the luminance plane, if the chrominance - * components are subsampled along the vertical dimension.) This is - * irrespective of any additional padding specified in the pad - * parameter. - * @param width width (in pixels) of the source image + * @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".) + * @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. * @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. - * @param height height (in pixels) of the source 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. * @param subsamp the level of chrominance subsampling used in the source * image (see @ref TJSAMP "Chrominance subsampling options".) * @param jpegBuf address of a pointer to an image buffer that will receive the @@ -742,14 +763,7 @@ DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2(int width, int pad, int height, * Encode an RGB or grayscale image into a YUV planar image. 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. The Y, U (Cb), and V (Cr) image planes are stored sequentially - * into the destination buffer, and the size of each plane is determined by the - * width and height of the source image, as well as the specified padding and - * level of chrominance subsampling. If the chrominance components are - * subsampled along the horizontal dimension, then the width of the luminance - * plane is padded to the nearest multiple of 2 in the output image (same goes - * for the height of the luminance plane, if the chrominance components are - * subsampled along the vertical dimension.) + * process. * * @param handle a handle to a TurboJPEG compressor or transformer instance * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels @@ -768,7 +782,9 @@ DLLEXPORT unsigned long DLLCALL tjBufSizeYUV2(int width, int pad, int height, * @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. + * 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 @@ -885,12 +901,7 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, /** * Decompress a JPEG image to a YUV planar image. This function performs JPEG * decompression but leaves out the color conversion step, so a planar YUV - * image is generated instead of an RGB image. The structure of the planes in - * this image is the same as in the images generated by #tjEncodeYUV3(). - * - * @note If the width or height of the JPEG image is not an even multiple of - * the MCU block size (see #tjMCUWidth and #tjMCUHeight), then an intermediate - * buffer copy will be performed within TurboJPEG. + * 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 @@ -898,13 +909,17 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, * @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. + * 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. + * 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 @@ -914,7 +929,9 @@ DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, * 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. + * 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". * @@ -929,20 +946,15 @@ DLLEXPORT int DLLCALL tjDecompressToYUV2(tjhandle handle, * Decode a YUV planar image into an RGB or grayscale image. 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. The Y, U (Cb), and V (Cr) image planes should be stored - * sequentially in the source buffer, and the size of each plane is determined - * by the width and height of the source image, as well as the specified - * padding and level of chrominance subsampling. If the chrominance components - * are subsampled along the horizontal dimension, then the width of the - * luminance plane should be padded to the nearest multiple of 2 in the input - * image (same goes for the height of the luminance plane, if the chrominance - * components are subsampled along the vertical dimension.) + * 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. + * 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.)

    handlea handle to a TurboJPEG compressor or transformer instance
    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.
    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.
    YUVImage -
    This class encapsulates a YUV planar image buffer and the metadata +
    This class encapsulates a YUV planar image and the metadata associated with it.