diff options
author | dcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db> | 2011-09-17 00:18:31 +0000 |
---|---|---|
committer | dcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db> | 2011-09-17 00:18:31 +0000 |
commit | 845cd1f100f21bd0ccee0e11f96baa17ca09cba3 (patch) | |
tree | d7dfd2622933bdcba53e73c7d6737cf01be3fc12 /turbojpeg.h | |
parent | 48b741d676253ba79fce0d135fbb5f2be49e4e0a (diff) |
Implement a custom DCT filter callback for lossless transforms
git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@703 632fc199-4ca6-4c93-a231-07263d6284db
Diffstat (limited to 'turbojpeg.h')
-rw-r--r-- | turbojpeg.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/turbojpeg.h b/turbojpeg.h index e4c5779..f0c542c 100644 --- a/turbojpeg.h +++ b/turbojpeg.h @@ -315,6 +315,13 @@ enum TJXOP * a grayscale output image. */ #define TJXOPT_GRAY 8 +/** + * This option will prevent #tjTransform() from outputting a JPEG image for + * this particular transform (this can be used in conjunction with a custom + * filter to capture the transformed DCT coefficients without transcoding + * them.) + */ +#define TJXOPT_NOOUTPUT 16 /** @@ -376,6 +383,34 @@ typedef struct * The bitwise OR of one of more of the @ref TJXOPT_CROP "transform options" */ int options; + /** + * A callback function that can be used to modify the DCT coefficients + * after they are losslessly transformed but before they are transcoded to a + * new JPEG file. This allows for custom filters or other transformations to + * be applied in the frequency domain. + * + * @param coeffs pointer to an array of 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.) + * @param arrayRegion region structure containing the width and height of the + * DCT coefficient array 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 region structure containing the width and height of the + * component plane to which this DCT coefficient array belongs + * @param componentIndex the component plane to which this DCT coefficient + * array belongs (Y, Cb, and Cr are, respectively, 0, 1, and 2 in + * typical JPEG images.) + * @param transformIndex the transformed image to which this DCT coefficient + * array belongs + * + * @return 0 if the callback was successful, or -1 if an error occurred. + */ + int (*customFilter)(short *coeffs, tjregion arrayRegion, + tjregion planeRegion, int componentIndex, int transformIndex); } tjtransform; /** |