Losslessly transform a JPEG image into another JPEG image. 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.
@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. <tt>dstBufsi</tt>
will receive a JPEG image that has been transformed using the
parameters in <tt>transformsi</tt>. 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 <tt>dstBufsi</tt> 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, <tt>dstSizesi</tt> should be set to
the size of your pre-allocated buffer. In any case, unless you have
set #TJFLAG_NOREALLOC, you should always check <tt>dstBufsi</tt>
upon return from this function, as it may have changed.
@param dstSizes pointer to an array of n ulong variables that will
receive the actual sizes (in bytes) of each transformed JPEG image.
If <tt>dstBufsi</tt> points to a pre-allocated buffer, then
<tt>dstSizesi</tt> should be set to the size of the buffer. Upon
return, <tt>dstSizesi</tt> 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.
@param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
"flags".
@return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
Losslessly transform a JPEG image into another JPEG image. 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.
@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. <tt>dstBufsi</tt> will receive a JPEG image that has been transformed using the parameters in <tt>transformsi</tt>. 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 <tt>dstBufsi</tt> 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, <tt>dstSizesi</tt> should be set to the size of your pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC, you should always check <tt>dstBufsi</tt> upon return from this function, as it may have changed. @param dstSizes pointer to an array of n ulong variables that will receive the actual sizes (in bytes) of each transformed JPEG image. If <tt>dstBufsi</tt> points to a pre-allocated buffer, then <tt>dstSizesi</tt> should be set to the size of the buffer. Upon return, <tt>dstSizesi</tt> 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. @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP "flags".
@return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)