Function turbojpeg_sys::tj3DecompressToYUV8
source · pub unsafe extern "C" fn tj3DecompressToYUV8(
handle: tjhandle,
jpegBuf: *const c_uchar,
jpegSize: size_t,
dstBuf: *mut c_uchar,
align: c_int
) -> c_int
Expand description
Decompress an 8-bit-per-sample JPEG image into an 8-bit-per-sample unified planar YUV image. This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of a packed-pixel image. The @ref TJPARAM “parameters” that describe the JPEG image will be set when this function returns.
@param handle handle to a TurboJPEG instance that has been initialized for decompression
@param jpegBuf pointer to a byte buffer containing the JPEG image to decompress
@param jpegSize size of the JPEG image (in bytes)
@param dstBuf pointer to a buffer that will receive the unified planar YUV decompressed image. Use #tj3YUVBufSize() to determine the appropriate size for this buffer based on the scaled JPEG width and height (see #TJSCALED(), #TJPARAM_JPEGWIDTH, #TJPARAM_JPEGHEIGHT, and #tj3SetScalingFactor()), row alignment, and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) 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 align row alignment (in bytes) of the YUV image (must be a power of
2.) Setting this parameter to n will cause each row in each plane of the
YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.)
To generate images suitable for X Video, align
should be set to 4.
@return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() and #tj3GetErrorCode().)