<trclass="memdesc:ga5ef3d169162ce77ce348e292a0b7477c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The number of chrominance subsampling options. <ahref="#ga5ef3d169162ce77ce348e292a0b7477c">More...</a><br/></td></tr>
<trclass="memdesc:ga7010a4402f54a45ba822ad8675a4655e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The number of pixel formats. <ahref="#ga7010a4402f54a45ba822ad8675a4655e">More...</a><br/></td></tr>
<trclass="memdesc:ga39f57a6fb02d9cf32e7b6890099b5a71"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The number of JPEG colorspaces. <ahref="#ga39f57a6fb02d9cf32e7b6890099b5a71">More...</a><br/></td></tr>
<trclass="memdesc:ga4ee4506c81177a06f77e2504a22efd2d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">When decompressing an image that was compressed using chrominance subsampling, use the fastest chrominance upsampling algorithm available in the underlying codec. <ahref="#ga4ee4506c81177a06f77e2504a22efd2d">More...</a><br/></td></tr>
<trclass="memdesc:gaabce235db80d3f698b27f36cbd453da2"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Use the fastest DCT/IDCT algorithm available in the underlying codec. <ahref="#gaabce235db80d3f698b27f36cbd453da2">More...</a><br/></td></tr>
<trclass="memdesc:gacb233cfd722d66d1ccbf48a7de81f0e0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Use the most accurate DCT/IDCT algorithm available in the underlying codec. <ahref="#gacb233cfd722d66d1ccbf48a7de81f0e0">More...</a><br/></td></tr>
<trclass="memdesc:ga519cfa4ef6c18d9e5b455fdf59306a3a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Immediately discontinue the current compression/decompression/transform operation if the underlying codec throws a warning (non-fatal error). <ahref="#ga519cfa4ef6c18d9e5b455fdf59306a3a">More...</a><br/></td></tr>
<trclass="memdesc:ga43b426750b46190a25d34a67ef76df1b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Use progressive entropy coding in JPEG images generated by the compression and transform functions. <ahref="#ga43b426750b46190a25d34a67ef76df1b">More...</a><br/></td></tr>
<trclass="memdesc:ga79bde1b4a3e2351e00887e47781b966e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The number of error codes. <ahref="#ga79bde1b4a3e2351e00887e47781b966e">More...</a><br/></td></tr>
<trclass="memdesc:ga0f6dbd18adf38b7d46ac547f0f4d562c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The number of transform operations. <ahref="#ga0f6dbd18adf38b7d46ac547f0f4d562c">More...</a><br/></td></tr>
<trclass="memdesc:ga50e03cb5ed115330e212417429600b00"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will cause <aclass="el"href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to return an error if the transform is not perfect. <ahref="#ga50e03cb5ed115330e212417429600b00">More...</a><br/></td></tr>
<trclass="memdesc:ga319826b7eb1583c0595bbe7b95428709"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will cause <aclass="el"href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to discard any partial MCU blocks that cannot be transformed. <ahref="#ga319826b7eb1583c0595bbe7b95428709">More...</a><br/></td></tr>
<trclass="memdesc:ga3acee7b48ade1b99e5588736007c2589"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will discard the color data in the input image and produce a grayscale output image. <ahref="#ga3acee7b48ade1b99e5588736007c2589">More...</a><br/></td></tr>
<trclass="memdesc:gafbf992bbf6e006705886333703ffab31"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will prevent <aclass="el"href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> 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.) <ahref="#gafbf992bbf6e006705886333703ffab31">More...</a><br/></td></tr>
<trclass="memdesc:gad2371c80674584ecc1a7d75e564cf026"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will enable progressive entropy coding in the output image generated by this particular transform. <ahref="#gad2371c80674584ecc1a7d75e564cf026">More...</a><br/></td></tr>
<trclass="memdesc:ga153b468cfb905d0de61706c838986fe8"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This option will prevent <aclass="el"href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from copying any extra markers (including EXIF and ICC profile data) from the source image to the output image. <ahref="#ga153b468cfb905d0de61706c838986fe8">More...</a><br/></td></tr>
<trclass="memdesc:ga0aba955473315e405295d978f0c16511"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Pad the given width to the nearest 32-bit boundary. <ahref="#ga0aba955473315e405295d978f0c16511">More...</a><br/></td></tr>
<trclass="memdesc:ga84878bb65404204743aa18cac02781df"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Compute the scaled value of <code>dimension</code> using the given scaling factor. <ahref="#ga84878bb65404204743aa18cac02781df">More...</a><br/></td></tr>
<trclass="memdesc:ga2de531af4e7e6c4f124908376b354866"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Transform operations for <aclass="el"href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a><ahref="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">More...</a><br/></td></tr>
<trclass="memitem:gafbdce0112fd78fd38efae841443a9bcf"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gafbdce0112fd78fd38efae841443a9bcf">tjCompress2</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags)</td></tr>
<trclass="memdesc:gafbdce0112fd78fd38efae841443a9bcf"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Compress an RGB, grayscale, or CMYK image into a JPEG image. <ahref="#gafbdce0112fd78fd38efae841443a9bcf">More...</a><br/></td></tr>
<trclass="memitem:ga7622a459b79aa1007e005b58783f875b"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga7622a459b79aa1007e005b58783f875b">tjCompressFromYUV</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int pad, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
<trclass="memdesc:ga7622a459b79aa1007e005b58783f875b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Compress a YUV planar image into a JPEG image. <ahref="#ga7622a459b79aa1007e005b58783f875b">More...</a><br/></td></tr>
<trclass="memitem:ga29ec5dfbd2d84b8724e951d6fa0d5d9e"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga29ec5dfbd2d84b8724e951d6fa0d5d9e">tjCompressFromYUVPlanes</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char **srcPlanes, int width, const int *strides, int height, int subsamp, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegQual, int flags)</td></tr>
<trclass="memdesc:ga29ec5dfbd2d84b8724e951d6fa0d5d9e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. <ahref="#ga29ec5dfbd2d84b8724e951d6fa0d5d9e">More...</a><br/></td></tr>
<trclass="memitem:ga67ac12fee79073242cb216e07c9f1f90"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT unsigned long </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90">tjBufSize</a> (int width, int height, int jpegSubsamp)</td></tr>
<trclass="memdesc:ga67ac12fee79073242cb216e07c9f1f90"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. <ahref="#ga67ac12fee79073242cb216e07c9f1f90">More...</a><br/></td></tr>
<trclass="memitem:ga2be2b9969d4df9ecce9b05deed273194"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT unsigned long </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194">tjBufSizeYUV2</a> (int width, int pad, int height, int subsamp)</td></tr>
<trclass="memdesc:ga2be2b9969d4df9ecce9b05deed273194"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters. <ahref="#ga2be2b9969d4df9ecce9b05deed273194">More...</a><br/></td></tr>
<trclass="memitem:gab4ab7b24f6e797d79abaaa670373961d"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT unsigned long </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d">tjPlaneSizeYUV</a> (int componentID, int width, int stride, int height, int subsamp)</td></tr>
<trclass="memdesc:gab4ab7b24f6e797d79abaaa670373961d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters. <ahref="#gab4ab7b24f6e797d79abaaa670373961d">More...</a><br/></td></tr>
<trclass="memitem:ga63fb66bb1e36c74008c4634360becbb1"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga63fb66bb1e36c74008c4634360becbb1">tjPlaneWidth</a> (int componentID, int width, int subsamp)</td></tr>
<trclass="memdesc:ga63fb66bb1e36c74008c4634360becbb1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The plane width of a YUV image plane with the given parameters. <ahref="#ga63fb66bb1e36c74008c4634360becbb1">More...</a><br/></td></tr>
<trclass="memitem:ga1a209696c6a80748f20e134b3c64789f"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga1a209696c6a80748f20e134b3c64789f">tjPlaneHeight</a> (int componentID, int height, int subsamp)</td></tr>
<trclass="memdesc:ga1a209696c6a80748f20e134b3c64789f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The plane height of a YUV image plane with the given parameters. <ahref="#ga1a209696c6a80748f20e134b3c64789f">More...</a><br/></td></tr>
<trclass="memitem:gac519b922cdf446e97d0cdcba513636bf"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gac519b922cdf446e97d0cdcba513636bf">tjEncodeYUV3</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int pad, int subsamp, int flags)</td></tr>
<trclass="memdesc:gac519b922cdf446e97d0cdcba513636bf"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Encode an RGB or grayscale image into a YUV planar image. <ahref="#gac519b922cdf446e97d0cdcba513636bf">More...</a><br/></td></tr>
<trclass="memitem:gae2d04c72457fe7f4d60cf78ab1b1feb1"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gae2d04c72457fe7f4d60cf78ab1b1feb1">tjEncodeYUVPlanes</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **dstPlanes, int *strides, int subsamp, int flags)</td></tr>
<trclass="memdesc:gae2d04c72457fe7f4d60cf78ab1b1feb1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes. <ahref="#gae2d04c72457fe7f4d60cf78ab1b1feb1">More...</a><br/></td></tr>
<trclass="memitem:ga0595681096bba7199cc6f3533cb25f77"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga0595681096bba7199cc6f3533cb25f77">tjDecompressHeader3</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, int *jpegSubsamp, int *jpegColorspace)</td></tr>
<trclass="memdesc:ga0595681096bba7199cc6f3533cb25f77"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieve information about a JPEG image without decompressing it. <ahref="#ga0595681096bba7199cc6f3533cb25f77">More...</a><br/></td></tr>
<trclass="memdesc:gac3854476006b10787bd128f7ede48057"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports. <ahref="#gac3854476006b10787bd128f7ede48057">More...</a><br/></td></tr>
<trclass="memitem:gae9eccef8b682a48f43a9117c231ed013"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gae9eccef8b682a48f43a9117c231ed013">tjDecompress2</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
<trclass="memdesc:gae9eccef8b682a48f43a9117c231ed013"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decompress a JPEG image to an RGB, grayscale, or CMYK image. <ahref="#gae9eccef8b682a48f43a9117c231ed013">More...</a><br/></td></tr>
<trclass="memitem:ga04d1e839ff9a0860dd1475cff78d3364"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga04d1e839ff9a0860dd1475cff78d3364">tjDecompressToYUV2</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pad, int height, int flags)</td></tr>
<trclass="memdesc:ga04d1e839ff9a0860dd1475cff78d3364"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decompress a JPEG image to a YUV planar image. <ahref="#ga04d1e839ff9a0860dd1475cff78d3364">More...</a><br/></td></tr>
<trclass="memitem:gaa59f901a5258ada5bd0185ad59368540"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gaa59f901a5258ada5bd0185ad59368540">tjDecompressToYUVPlanes</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, unsigned char **dstPlanes, int width, int *strides, int height, int flags)</td></tr>
<trclass="memdesc:gaa59f901a5258ada5bd0185ad59368540"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image planes. <ahref="#gaa59f901a5258ada5bd0185ad59368540">More...</a><br/></td></tr>
<trclass="memitem:ga70abbf38f77a26fd6da8813bef96f695"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga70abbf38f77a26fd6da8813bef96f695">tjDecodeYUV</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *srcBuf, int pad, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
<trclass="memdesc:ga70abbf38f77a26fd6da8813bef96f695"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decode a YUV planar image into an RGB or grayscale image. <ahref="#ga70abbf38f77a26fd6da8813bef96f695">More...</a><br/></td></tr>
<trclass="memitem:ga10e837c07fa9d25770565b237d3898d9"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga10e837c07fa9d25770565b237d3898d9">tjDecodeYUVPlanes</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char **srcPlanes, const int *strides, int subsamp, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
<trclass="memdesc:ga10e837c07fa9d25770565b237d3898d9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale image. <ahref="#ga10e837c07fa9d25770565b237d3898d9">More...</a><br/></td></tr>
<trclass="memdesc:ga928beff6ac248ceadf01089fc6b41957"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Create a new TurboJPEG transformer instance. <ahref="#ga928beff6ac248ceadf01089fc6b41957">More...</a><br/></td></tr>
<trclass="memitem:ga9cb8abf4cc91881e04a0329b2270be25"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25">tjTransform</a> (<aclass="el"href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, const unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, <aclass="el"href="structtjtransform.html">tjtransform</a> *transforms, int flags)</td></tr>
<trclass="memdesc:ga9cb8abf4cc91881e04a0329b2270be25"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Losslessly transform a JPEG image into another JPEG image. <ahref="#ga9cb8abf4cc91881e04a0329b2270be25">More...</a><br/></td></tr>
<trclass="memdesc:ga75f355fa27225ba1a4ee392c852394d2"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Destroy a TurboJPEG compressor, decompressor, or transformer instance. <ahref="#ga75f355fa27225ba1a4ee392c852394d2">More...</a><br/></td></tr>
<trclass="memdesc:gaec627dd4c5f30b7a775a7aea3bec5d83"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Allocate an image buffer for use with TurboJPEG. <ahref="#gaec627dd4c5f30b7a775a7aea3bec5d83">More...</a><br/></td></tr>
<trclass="memitem:gaffbd83c375e79f5db4b5c5d8ad4466e7"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT unsigned char * </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7">tjLoadImage</a> (const char *filename, int *width, int align, int *height, int *pixelFormat, int flags)</td></tr>
<trclass="memdesc:gaffbd83c375e79f5db4b5c5d8ad4466e7"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Load an uncompressed image from disk into memory. <ahref="#gaffbd83c375e79f5db4b5c5d8ad4466e7">More...</a><br/></td></tr>
<trclass="memitem:ga6f445b22d8933ae4815b3370a538d879"><tdclass="memItemLeft"align="right"valign="top">DLLEXPORT int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group___turbo_j_p_e_g.html#ga6f445b22d8933ae4815b3370a538d879">tjSaveImage</a> (const char *filename, unsigned char *buffer, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
<trclass="memdesc:ga6f445b22d8933ae4815b3370a538d879"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Save an uncompressed image from memory to disk. <ahref="#ga6f445b22d8933ae4815b3370a538d879">More...</a><br/></td></tr>
<trclass="memdesc:gaea863d2da0cdb609563aabdf9196514b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Free an image buffer previously allocated by TurboJPEG. <ahref="#gaea863d2da0cdb609563aabdf9196514b">More...</a><br/></td></tr>
<trclass="memdesc:ga1ead8574f9f39fbafc6b497124e7aafa"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns a descriptive error message explaining why the last command failed. <ahref="#ga1ead8574f9f39fbafc6b497124e7aafa">More...</a><br/></td></tr>
<trclass="memdesc:ga414feeffbf860ebd31c745df203de410"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns a code indicating the severity of the last error. <ahref="#ga414feeffbf860ebd31c745df203de410">More...</a><br/></td></tr>
<trclass="memdesc:ga9e61e7cd47a15a173283ba94e781308c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">MCU block width (in pixels) for a given level of chrominance subsampling. <ahref="#ga9e61e7cd47a15a173283ba94e781308c">More...</a><br/></td></tr>
<trclass="memdesc:gabd247bb9fecb393eca57366feb8327bf"><tdclass="mdescLeft"> </td><tdclass="mdescRight">MCU block height (in pixels) for a given level of chrominance subsampling. <ahref="#gabd247bb9fecb393eca57366feb8327bf">More...</a><br/></td></tr>
<trclass="memdesc:gadd9b446742ac8a3923f7992c7988fea8"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Red offset (in bytes) for a given pixel format. <ahref="#gadd9b446742ac8a3923f7992c7988fea8">More...</a><br/></td></tr>
<trclass="memdesc:ga82d6e35da441112a411da41923c0ba2f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Green offset (in bytes) for a given pixel format. <ahref="#ga82d6e35da441112a411da41923c0ba2f">More...</a><br/></td></tr>
<trclass="memdesc:ga84e2e35d3f08025f976ec1ec53693dea"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Blue offset (in bytes) for a given pixel format. <ahref="#ga84e2e35d3f08025f976ec1ec53693dea">More...</a><br/></td></tr>
<trclass="memdesc:ga5af0ab065feefd526debf1e20c43e837"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Alpha offset (in bytes) for a given pixel format. <ahref="#ga5af0ab065feefd526debf1e20c43e837">More...</a><br/></td></tr>
<trclass="memdesc:gad77cf8fe5b2bfd3cb3f53098146abb4c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Pixel size (in bytes) for a given pixel format. <ahref="#gad77cf8fe5b2bfd3cb3f53098146abb4c">More...</a><br/></td></tr>
<p>This API provides an interface for generating, decoding, and transforming planar YUV and JPEG images in memory.</p>
<p><aclass="anchor"id="YUVnotes"></a></p>
<h2>YUV Image Format Notes</h2>
<p>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.</p>
<p>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 width and height of each plane are determined by the image width, height, and level of chrominance subsampling. The luminance plane 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 luminance plane height 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 chrominance plane width is equal to the luminance plane width divided by the horizontal subsampling factor, and the chrominance plane height is equal to the luminance plane height divided by the vertical subsampling factor.</p>
<p>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. </p>
<p>Use the most accurate DCT/IDCT algorithm available in the underlying codec. </p>
<p>The default if this flag is not specified is implementation-specific. For example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast algorithm by default when compressing, because this has been shown to have only a very slight effect on accuracy, but it uses the accurate algorithm when decompressing, because this has been shown to have a larger effect. </p>
<p>Use the fastest DCT/IDCT algorithm available in the underlying codec. </p>
<p>The default if this flag is not specified is implementation-specific. For example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast algorithm by default when compressing, because this has been shown to have only a very slight effect on accuracy, but it uses the accurate algorithm when decompressing, because this has been shown to have a larger effect. </p>
<p>When decompressing an image that was compressed using chrominance subsampling, use the fastest chrominance upsampling algorithm available in the underlying codec. </p>
<p>The default is to use smooth upsampling, which creates a smooth transition between neighboring chrominance components in order to reduce upsampling artifacts in the decompressed image. </p>
<p>If passed to one of the JPEG compression or transform functions, this flag will cause those functions to generate an error if the JPEG image buffer is invalid or too small rather than attempting to allocate or reallocate that buffer. This reproduces the behavior of earlier versions of TurboJPEG. </p>
<p>Use progressive entropy coding in JPEG images generated by the compression and transform functions. </p>
<p>Progressive entropy coding will generally improve compression relative to baseline entropy coding (the default), but it will reduce compression and decompression performance considerably. </p>
<p>This option will prevent <aclass="el"href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from copying any extra markers (including EXIF and ICC profile data) from the source image to the output image. </p>
<p>See <aclass="el"href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> for more information. </p>
<p>This option will prevent <aclass="el"href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> 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.) </p>
<p>This option will cause <aclass="el"href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to return an error if the transform is not perfect. </p>
<p>Lossless transforms operate on MCU blocks, whose size depends on the level of chrominance subsampling used (see <aclass="el"href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c"title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a> and <aclass="el"href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf"title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>.) If the image's width or height is not evenly divisible by the MCU block size, then there will be partial MCU blocks on the right and/or bottom edges. It is not possible to move these partial MCU blocks to the top or left of the image, so any transform that would require that is "imperfect." If this option is not specified, then any partial MCU blocks that cannot be transformed will be left in place, which will create odd-looking strips on the right or bottom edge of the image. </p>
<p>This option will enable progressive entropy coding in the output image generated by this particular transform. </p>
<p>Progressive entropy coding will generally improve compression relative to baseline entropy coding (the default), but it will reduce compression and decompression performance considerably. </p>
<p>This option will cause <aclass="el"href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to discard any partial MCU blocks that cannot be transformed. </p>
<p>When compressing the JPEG image, the R, G, and B components in the source image are reordered into image planes, but no colorspace conversion or subsampling is performed. RGB JPEG images can be decompressed to any of the extended RGB pixel formats or grayscale, but they cannot be decompressed to YUV images. </p>
<p>YCbCr is not an absolute colorspace but rather a mathematical transformation of RGB designed solely for storage and transmission. YCbCr images must be converted to RGB before they can actually be displayed. In the YCbCr colorspace, the Y (luminance) component represents the black & white portion of the original image, and the Cb and Cr (chrominance) components represent the color portion of the original image. Originally, the analog equivalent of this transformation allowed the same signal to drive both black & white and color televisions, but JPEG images use YCbCr primarily because it allows the color data to be optionally subsampled for the purposes of reducing bandwidth or disk space. YCbCr is the most common JPEG colorspace, and YCbCr JPEG images can be compressed from and decompressed to any of the extended RGB pixel formats or grayscale, or they can be decompressed to YUV planar images. </p>
<p>The JPEG image retains only the luminance data (Y component), and any color data from the source image is discarded. Grayscale JPEG images can be compressed from and decompressed to any of the extended RGB pixel formats or grayscale, or they can be decompressed to YUV planar images. </p>
<p>When compressing the JPEG image, the C, M, Y, and K components in the source image are reordered into image planes, but no colorspace conversion or subsampling is performed. CMYK JPEG images can only be decompressed to CMYK pixels. </p>
<p>YCCK (AKA "YCbCrK") is not an absolute colorspace but rather a mathematical transformation of CMYK designed solely for storage and transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be reversibly transformed into YCCK, and as with YCbCr, the chrominance components in the YCCK pixels can be subsampled without incurring major perceptual loss. YCCK JPEG images can only be compressed from and decompressed to CMYK pixels. </p>
<p>The red, green, and blue components in the image are stored in 3-byte pixels in the order R, G, B from lowest to highest byte address within each pixel. </p>
<p>The red, green, and blue components in the image are stored in 3-byte pixels in the order B, G, R from lowest to highest byte address within each pixel. </p>
<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from lowest to highest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing. </p>
<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from lowest to highest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing. </p>
<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from highest to lowest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing. </p>
<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from highest to lowest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing. </p>
<p>This is the same as <aclass="el"href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01">TJPF_RGBX</a>, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel. </p>
<p>This is the same as <aclass="el"href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8">TJPF_BGRX</a>, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel. </p>
<p>This is the same as <aclass="el"href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af">TJPF_XBGR</a>, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel. </p>
<p>This is the same as <aclass="el"href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84">TJPF_XRGB</a>, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel. </p>
<p>Unlike RGB, which is an additive color model used primarily for display, CMYK (Cyan/Magenta/Yellow/Key) is a subtractive color model used primarily for printing. In the CMYK color model, the value of each color component typically corresponds to an amount of cyan, magenta, yellow, or black ink that is applied to a white background. In order to convert between CMYK and RGB, it is necessary to use a color management system (CMS.) A CMS will attempt to map colors within the printer's gamut to perceptually similar colors in the display's gamut and vice versa, but the mapping is typically not 1:1 or reversible, nor can it be defined with a simple formula. Thus, such a conversion is out of scope for a codec library. However, the TurboJPEG API allows for compressing CMYK pixels into a YCCK JPEG image (see <aclass="el"href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e"title="YCCK colorspace.">TJCS_YCCK</a>) and decompressing YCCK JPEG images into CMYK pixels. </p>
<p>Currently this is only used by <aclass="el"href="group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7"title="Load an uncompressed image from disk into memory.">tjLoadImage()</a>. </p>
<p>When pixels are converted from RGB to YCbCr (see <aclass="el"href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a7389b8f65bb387ffedce3efd0d78ec75"title="YCbCr colorspace.">TJCS_YCbCr</a>) or from CMYK to YCCK (see <aclass="el"href="group___turbo_j_p_e_g.html#gga4f83ad3368e0e29d1957be0efa7c3720a53839e0fe867b76b58d16b0a1a7c598e"title="YCCK colorspace.">TJCS_YCCK</a>) as part of the JPEG compression process, some of the Cb and Cr (chrominance) components can be discarded or averaged together to produce a smaller image with little perceptible loss of image clarity (the human eye is more sensitive to small changes in brightness than to small changes in color.) This is called "chrominance subsampling". </p>
<p>The JPEG or YUV image will contain one chrominance component for every 4x1 block of pixels in the source image. JPEG images compressed with 4:1:1 subsampling will be almost exactly the same size as those compressed with 4:2:0 subsampling, and in the aggregate, both subsampling methods produce approximately the same perceptual quality. However, 4:1:1 is better able to reproduce sharp horizontal features.</p>
<dlclass="section note"><dt>Note</dt><dd>4:1:1 subsampling is not fully accelerated in libjpeg-turbo. </dd></dl>
<p>Transform operations for <aclass="el"href="group___turbo_j_p_e_g.html#ga9cb8abf4cc91881e04a0329b2270be25"title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a></p>
<p>This transform is imperfect if there are any partial MCU blocks on the right edge (see <aclass="el"href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00"title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
<p>This transform is imperfect if there are any partial MCU blocks on the bottom edge (see <aclass="el"href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00"title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
<p>Transverse transpose image (flip/mirror along upper right to lower left axis.) This transform is imperfect if there are any partial MCU blocks in the image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00"title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
<p>This transform is imperfect if there are any partial MCU blocks on the bottom edge (see <aclass="el"href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00"title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
<p>This transform is imperfect if there are any partial MCU blocks in the image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00"title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
<p>Rotate image counter-clockwise by 90 degrees. </p>
<p>This transform is imperfect if there are any partial MCU blocks on the right edge (see <aclass="el"href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00"title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
<p>You should always use this function to allocate the JPEG destination buffer(s) for the compression and transform functions unless you are disabling automatic buffer (re)allocation (by setting <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>.)</p>
<dlclass="section see"><dt>See Also</dt><dd><aclass="el"href="group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b"title="Free an image buffer previously allocated by TurboJPEG.">tjFree()</a></dd></dl>
<p>The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. </p>
<p>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.</p>
<tr><tdclass="paramname">jpegSubsamp</td><td>the level of chrominance subsampling to be used when generating the JPEG image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>the maximum size of the buffer (in bytes) required to hold the image, or -1 if the arguments are out of bounds. </dd></dl>
<tr><tdclass="paramname">width</td><td>width (in pixels) of the image</td></tr>
<tr><tdclass="paramname">pad</td><td>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.)</td></tr>
<tr><tdclass="paramname">height</td><td>height (in pixels) of the image</td></tr>
<tr><tdclass="paramname">subsamp</td><td>level of chrominance subsampling in the image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>the size of the buffer (in bytes) required to hold the image, or -1 if the arguments are out of bounds. </dd></dl>
<tr><tdclass="paramname">width</td><td>width (in pixels) of the source image</td></tr>
<tr><tdclass="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><aclass="el"href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511"title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> 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 <code>width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><tdclass="paramname">height</td><td>height (in pixels) of the source image</td></tr>
<tr><tdclass="paramname">pixelFormat</td><td>pixel format of the source image (see <aclass="el"href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
<tr><tdclass="paramname">jpegBuf</td><td>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:<oltype="1">
<li>pre-allocate the JPEG buffer with an arbitrary size using <aclass="el"href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83"title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
<li>pre-allocate the buffer to a "worst case" size determined by calling <aclass="el"href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90"title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.)</li>
If you choose option 1, <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
<tr><tdclass="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
<tr><tdclass="paramname">jpegSubsamp</td><td>the level of chrominance subsampling to be used when generating the JPEG image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
<tr><tdclass="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
<tr><tdclass="paramname">flags</td><td>the bitwise OR of one or more of the <aclass="el"href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <aclass="el"href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410"title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
<tr><tdclass="paramname">srcBuf</td><td>pointer to an image buffer containing a YUV planar image to be compressed. The size of this buffer should match the value returned by <aclass="el"href="group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194"title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> 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 <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
<tr><tdclass="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <aclass="el"href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c"title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
<tr><tdclass="paramname">pad</td><td>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 <code>pad</code> should be set to 4.</td></tr>
<tr><tdclass="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see <aclass="el"href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf"title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
<tr><tdclass="paramname">subsamp</td><td>the level of chrominance subsampling used in the source image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
<tr><tdclass="paramname">jpegBuf</td><td>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:<oltype="1">
<li>pre-allocate the JPEG buffer with an arbitrary size using <aclass="el"href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83"title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
<li>pre-allocate the buffer to a "worst case" size determined by calling <aclass="el"href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90"title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.)</li>
If you choose option 1, <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
<tr><tdclass="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
<tr><tdclass="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
<tr><tdclass="paramname">flags</td><td>the bitwise OR of one or more of the <aclass="el"href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <aclass="el"href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410"title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
<tr><tdclass="paramname">srcPlanes</td><td>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. The size of each plane should match the value returned by <aclass="el"href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d"title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. Refer to <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
<tr><tdclass="paramname">width</td><td>width (in pixels) of the source image. If the width is not an even multiple of the MCU block width (see <aclass="el"href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c"title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
<tr><tdclass="paramname">strides</td><td>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 plane width (see <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane 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.</td></tr>
<tr><tdclass="paramname">height</td><td>height (in pixels) of the source image. If the height is not an even multiple of the MCU block height (see <aclass="el"href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf"title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
<tr><tdclass="paramname">subsamp</td><td>the level of chrominance subsampling used in the source image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
<tr><tdclass="paramname">jpegBuf</td><td>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:<oltype="1">
<li>pre-allocate the JPEG buffer with an arbitrary size using <aclass="el"href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83"title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
<li>pre-allocate the buffer to a "worst case" size determined by calling <aclass="el"href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90"title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a>. This should ensure that the buffer never has to be re-allocated (setting <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.)</li>
If you choose option 1, <code>*jpegSize</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>*jpegBuf</code> upon return from this function, as it may have changed.</td></tr>
<tr><tdclass="paramname">jpegSize</td><td>pointer to an unsigned long variable that holds the size of the JPEG image buffer. If <code>*jpegBuf</code> points to a pre-allocated buffer, then <code>*jpegSize</code> should be set to the size of the buffer. Upon return, <code>*jpegSize</code> will contain the size of the JPEG image (in bytes.) If <code>*jpegBuf</code> points to a JPEG image buffer that is being reused from a previous call to one of the JPEG compression functions, then <code>*jpegSize</code> is ignored.</td></tr>
<tr><tdclass="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best)</td></tr>
<tr><tdclass="paramname">flags</td><td>the bitwise OR of one or more of the <aclass="el"href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <aclass="el"href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410"title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
<p>Decode a YUV planar image into an RGB or grayscale image. </p>
<p>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.</p>
<tr><tdclass="paramname">srcBuf</td><td>pointer to an image buffer containing a YUV planar image to be decoded. The size of this buffer should match the value returned by <aclass="el"href="group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194"title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> 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 <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
<tr><tdclass="paramname">pad</td><td>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.)</td></tr>
<tr><tdclass="paramname">subsamp</td><td>the level of chrominance subsampling used in the YUV source image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
<tr><tdclass="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decoded image. This buffer should normally be <code>pitch * height</code> bytes in size, but the <code>dstBuf</code> pointer can also be used to decode into a specific region of a larger buffer.</td></tr>
<tr><tdclass="paramname">width</td><td>width (in pixels) of the source and destination images</td></tr>
<tr><tdclass="paramname">pitch</td><td>bytes per line in the destination image. Normally, this should be <code>width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the destination image is unpadded, or <code><aclass="el"href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511"title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> 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 <code>width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><tdclass="paramname">height</td><td>height (in pixels) of the source and destination images</td></tr>
<tr><tdclass="paramname">pixelFormat</td><td>pixel format of the destination image (see <aclass="el"href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
<tr><tdclass="paramname">flags</td><td>the bitwise OR of one or more of the <aclass="el"href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <aclass="el"href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410"title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
<p>Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale image. </p>
<p>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.</p>
<tr><tdclass="paramname">srcPlanes</td><td>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. The size of each plane should match the value returned by <aclass="el"href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d"title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> for the given image width, height, strides, and level of chrominance subsampling. Refer to <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
<tr><tdclass="paramname">strides</td><td>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 plane width (see <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane 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.</td></tr>
<tr><tdclass="paramname">subsamp</td><td>the level of chrominance subsampling used in the YUV source image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
<tr><tdclass="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decoded image. This buffer should normally be <code>pitch * height</code> bytes in size, but the <code>dstBuf</code> pointer can also be used to decode into a specific region of a larger buffer.</td></tr>
<tr><tdclass="paramname">width</td><td>width (in pixels) of the source and destination images</td></tr>
<tr><tdclass="paramname">pitch</td><td>bytes per line in the destination image. Normally, this should be <code>width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the destination image is unpadded, or <code><aclass="el"href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511"title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> 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 <code>width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><tdclass="paramname">height</td><td>height (in pixels) of the source and destination images</td></tr>
<tr><tdclass="paramname">pixelFormat</td><td>pixel format of the destination image (see <aclass="el"href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
<tr><tdclass="paramname">flags</td><td>the bitwise OR of one or more of the <aclass="el"href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <aclass="el"href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410"title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
<tr><tdclass="paramname">dstBuf</td><td>pointer to an image buffer that will receive the decompressed image. This buffer should normally be <code>pitch * scaledHeight</code> bytes in size, where <code>scaledHeight</code> can be determined by calling <aclass="el"href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df"title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED()</a> with the JPEG image height and one of the scaling factors returned by <aclass="el"href="group___turbo_j_p_e_g.html#gac3854476006b10787bd128f7ede48057"title="Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of Tur...">tjGetScalingFactors()</a>. The <code>dstBuf</code> pointer may also be used to decompress into a specific region of a larger buffer.</td></tr>
<tr><tdclass="paramname">width</td><td>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 <code>width</code> is set to 0, then only the height will be considered when determining the scaled image size.</td></tr>
<tr><tdclass="paramname">pitch</td><td>bytes per line in the destination image. Normally, this is <code>scaledWidth * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the decompressed image is unpadded, else <code><aclass="el"href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511"title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(scaledWidth * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> if each line of the decompressed image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. (NOTE: <code>scaledWidth</code> can be determined by calling <aclass="el"href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df"title="Compute the scaled value of dimension using the given scaling factor.">TJSCALED()</a> with the JPEG image width and one of the scaling factors returned by <aclass="el"href="group___turbo_j_p_e_g.html#gac3854476006b10787bd128f7ede48057"title="Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of Tur...">tjGetScalingFactors()</a>.) 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 <code>scaledWidth * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><tdclass="paramname">height</td><td>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 <code>height</code> is set to 0, then only the width will be considered when determining the scaled image size.</td></tr>
<tr><tdclass="paramname">pixelFormat</td><td>pixel format of the destination image (see <aclass="el"href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
<tr><tdclass="paramname">flags</td><td>the bitwise OR of one or more of the <aclass="el"href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <aclass="el"href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410"title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
<tr><tdclass="paramname">jpegSize</td><td>size of the JPEG image (in bytes)</td></tr>
<tr><tdclass="paramname">width</td><td>pointer to an integer variable that will receive the width (in pixels) of the JPEG image</td></tr>
<tr><tdclass="paramname">height</td><td>pointer to an integer variable that will receive the height (in pixels) of the JPEG image</td></tr>
<tr><tdclass="paramname">jpegSubsamp</td><td>pointer to an integer variable that will receive the level of chrominance subsampling used when the JPEG image was compressed (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
<tr><tdclass="paramname">jpegColorspace</td><td>pointer to an integer variable that will receive one of the JPEG colorspace constants, indicating the colorspace of the JPEG image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga4f83ad3368e0e29d1957be0efa7c3720">JPEG colorspaces</a>.)</td></tr>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <aclass="el"href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410"title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
<tr><tdclass="paramname">dstBuf</td><td>pointer to an image buffer that will receive the YUV image. Use <aclass="el"href="group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194"title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> 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 <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
<tr><tdclass="paramname">width</td><td>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 <code>width</code> 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 <aclass="el"href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c"title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
<tr><tdclass="paramname">pad</td><td>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, <code>pad</code> should be set to 4.</td></tr>
<tr><tdclass="paramname">height</td><td>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 <code>height</code> 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 <aclass="el"href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf"title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
<tr><tdclass="paramname">flags</td><td>the bitwise OR of one or more of the <aclass="el"href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <aclass="el"href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410"title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
<tr><tdclass="paramname">dstPlanes</td><td>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. Use <aclass="el"href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d"title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> to determine the appropriate size for each plane based on the scaled image width, scaled image height, strides, and level of chrominance subsampling. Refer to <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
<tr><tdclass="paramname">width</td><td>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 <code>width</code> 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 <aclass="el"href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c"title="MCU block width (in pixels) for a given level of chrominance subsampling.">tjMCUWidth</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
<tr><tdclass="paramname">strides</td><td>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 plane width (see <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective scaled plane 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.</td></tr>
<tr><tdclass="paramname">height</td><td>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 <code>height</code> 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 <aclass="el"href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf"title="MCU block height (in pixels) for a given level of chrominance subsampling.">tjMCUHeight</a>), then an intermediate buffer copy will be performed within TurboJPEG.</td></tr>
<tr><tdclass="paramname">flags</td><td>the bitwise OR of one or more of the <aclass="el"href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <aclass="el"href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410"title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) </dd></dl>
<p>Encode an RGB or grayscale image into a YUV planar image. </p>
<p>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.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
<tr><tdclass="paramname">width</td><td>width (in pixels) of the source image</td></tr>
<tr><tdclass="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><aclass="el"href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511"title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> 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 <code>width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><tdclass="paramname">height</td><td>height (in pixels) of the source image</td></tr>
<tr><tdclass="paramname">pixelFormat</td><td>pixel format of the source image (see <aclass="el"href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
<tr><tdclass="paramname">dstBuf</td><td>pointer to an image buffer that will receive the YUV image. Use <aclass="el"href="group___turbo_j_p_e_g.html#ga2be2b9969d4df9ecce9b05deed273194"title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV2()</a> 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 <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.)</td></tr>
<tr><tdclass="paramname">pad</td><td>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, <code>pad</code> should be set to 4.</td></tr>
<tr><tdclass="paramname">subsamp</td><td>the level of chrominance subsampling to be used when generating the YUV image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.) To generate images suitable for X Video, <code>subsamp</code> should be set to <aclass="el"href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737">TJSAMP_420</a>. This produces an image compatible with the I420 (AKA "YUV420P") format.</td></tr>
<tr><tdclass="paramname">flags</td><td>the bitwise OR of one or more of the <aclass="el"href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <aclass="el"href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410"title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
<p>Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image planes. </p>
<p>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.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">handle</td><td>a handle to a TurboJPEG compressor or transformer instance</td></tr>
<tr><tdclass="paramname">width</td><td>width (in pixels) of the source image</td></tr>
<tr><tdclass="paramname">pitch</td><td>bytes per line in the source image. Normally, this should be <code>width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code> if the image is unpadded, or <code><aclass="el"href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511"title="Pad the given width to the nearest 32-bit boundary.">TJPAD</a>(width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat])</code> 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 <code>width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><tdclass="paramname">height</td><td>height (in pixels) of the source image</td></tr>
<tr><tdclass="paramname">pixelFormat</td><td>pixel format of the source image (see <aclass="el"href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.)</td></tr>
<tr><tdclass="paramname">dstPlanes</td><td>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. Use <aclass="el"href="group___turbo_j_p_e_g.html#gab4ab7b24f6e797d79abaaa670373961d"title="The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters...">tjPlaneSizeYUV()</a> to determine the appropriate size for each plane based on the image width, height, strides, and level of chrominance subsampling. Refer to <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for more details.</td></tr>
<tr><tdclass="paramname">strides</td><td>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 plane width (see <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a>.) If <code>strides</code> is NULL, then the strides for all planes will be set to their respective plane 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.</td></tr>
<tr><tdclass="paramname">subsamp</td><td>the level of chrominance subsampling to be used when generating the YUV image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.) To generate images suitable for X Video, <code>subsamp</code> should be set to <aclass="el"href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737">TJSAMP_420</a>. This produces an image compatible with the I420 (AKA "YUV420P") format.</td></tr>
<tr><tdclass="paramname">flags</td><td>the bitwise OR of one or more of the <aclass="el"href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <aclass="el"href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410"title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
<p>You should always use this function to free JPEG destination buffer(s) that were automatically (re)allocated by the compression and transform functions or that were manually allocated using <aclass="el"href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83"title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a>.</p>
<dlclass="section see"><dt>See Also</dt><dd><aclass="el"href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83"title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a></dd></dl>
<tr><tdclass="paramname">handle</td><td>a handle to a TurboJPEG compressor, decompressor or transformer instance</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>a code indicating the severity of the last error. See <aclass="el"href="group___turbo_j_p_e_g.html#gafbc17cfa57d0d5d11fea35ac025950fe">Error codes</a>. </dd></dl>
<tr><tdclass="paramname">handle</td><td>a handle to a TurboJPEG compressor, decompressor, or transformer instance, or NULL if the error was generated by a global function (but note that retrieving the error message for a global function is not thread-safe.)</td></tr>
<dlclass="section return"><dt>Returns</dt><dd>a pointer to a list of fractional scaling factors, or NULL if an error is encountered (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) </dd></dl>
<dlclass="section return"><dt>Returns</dt><dd>a handle to the newly-created instance, or NULL if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) </dd></dl>
<dlclass="section return"><dt>Returns</dt><dd>a handle to the newly-created instance, or NULL if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) </dd></dl>
<dlclass="section return"><dt>Returns</dt><dd>a handle to the newly-created instance, or NULL if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) </dd></dl>
<p>Load an uncompressed image from disk into memory. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">filename</td><td>name of a file containing an uncompressed image in Windows BMP or PBMPLUS (PPM/PGM) format</td></tr>
<tr><tdclass="paramname">width</td><td>pointer to an integer variable that will receive the width (in pixels) of the uncompressed image</td></tr>
<tr><tdclass="paramname">align</td><td>row alignment of the image buffer to be returned (must be a power of 2.) For instance, setting this parameter to 4 will cause all rows in the image buffer to be padded to the nearest 32-bit boundary, and setting this parameter to 1 will cause all rows in the image buffer to be unpadded.</td></tr>
<tr><tdclass="paramname">height</td><td>pointer to an integer variable that will receive the height (in pixels) of the uncompressed image</td></tr>
<tr><tdclass="paramname">pixelFormat</td><td>pointer to an integer variable that specifies or will receive the pixel format of the uncompressed image buffer. The behavior of <aclass="el"href="group___turbo_j_p_e_g.html#gaffbd83c375e79f5db4b5c5d8ad4466e7"title="Load an uncompressed image from disk into memory.">tjLoadImage()</a> will vary depending on the value of <code>*pixelFormat</code> passed to the function:<ul>
<li><aclass="el"href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa84c1a6cead7952998e2fb895844a21ed">TJPF_UNKNOWN</a> : The uncompressed image buffer returned by the function will use the most optimal pixel format for the file type, and <code>*pixelFormat</code> will contain the ID of this pixel format upon successful return from the function.</li>
<li><aclass="el"href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a> : Only PGM files and 8-bit BMP files with a grayscale colormap can be loaded.</li>
<li><aclass="el"href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a> : The RGB or grayscale pixels stored in the file will be converted using a quick & dirty algorithm that is suitable only for testing purposes (proper conversion between CMYK and other formats requires a color management system.)</li>
<li>Other <aclass="el"href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">pixel formats</a> : The uncompressed image buffer will use the specified pixel format, and pixel format conversion will be performed if necessary.</li>
</ul>
</td></tr>
<tr><tdclass="paramname">flags</td><td>the bitwise OR of one or more of the <aclass="el"href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>a pointer to a newly-allocated buffer containing the uncompressed image, converted to the chosen pixel format and with the chosen row alignment, or NULL if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) This buffer should be freed using <aclass="el"href="group___turbo_j_p_e_g.html#gaea863d2da0cdb609563aabdf9196514b"title="Free an image buffer previously allocated by TurboJPEG.">tjFree()</a>. </dd></dl>
<tdclass="memname">DLLEXPORT int tjPlaneHeight </td>
<td>(</td>
<tdclass="paramtype">int </td>
<tdclass="paramname"><em>componentID</em>, </td>
</tr>
<tr>
<tdclass="paramkey"></td>
<td></td>
<tdclass="paramtype">int </td>
<tdclass="paramname"><em>height</em>, </td>
</tr>
<tr>
<tdclass="paramkey"></td>
<td></td>
<tdclass="paramtype">int </td>
<tdclass="paramname"><em>subsamp</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><divclass="memdoc">
<p>The plane height of a YUV image plane with the given parameters. </p>
<p>Refer to <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for a description of plane height.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">componentID</td><td>ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)</td></tr>
<tr><tdclass="paramname">height</td><td>height (in pixels) of the YUV image</td></tr>
<tr><tdclass="paramname">subsamp</td><td>level of chrominance subsampling in the image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>the plane height of a YUV image plane with the given parameters, or -1 if the arguments are out of bounds. </dd></dl>
<p>The size of the buffer (in bytes) required to hold a YUV image plane with the given parameters. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">componentID</td><td>ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)</td></tr>
<tr><tdclass="paramname">width</td><td>width (in pixels) of the YUV image. NOTE: this is the width of the whole image, not the plane width.</td></tr>
<tr><tdclass="paramname">stride</td><td>bytes per line in the image plane. Setting this to 0 is the equivalent of setting it to the plane width.</td></tr>
<tr><tdclass="paramname">height</td><td>height (in pixels) of the YUV image. NOTE: this is the height of the whole image, not the plane height.</td></tr>
<tr><tdclass="paramname">subsamp</td><td>level of chrominance subsampling in the image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>the size of the buffer (in bytes) required to hold the YUV image plane, or -1 if the arguments are out of bounds. </dd></dl>
<tdclass="memname">DLLEXPORT int tjPlaneWidth </td>
<td>(</td>
<tdclass="paramtype">int </td>
<tdclass="paramname"><em>componentID</em>, </td>
</tr>
<tr>
<tdclass="paramkey"></td>
<td></td>
<tdclass="paramtype">int </td>
<tdclass="paramname"><em>width</em>, </td>
</tr>
<tr>
<tdclass="paramkey"></td>
<td></td>
<tdclass="paramtype">int </td>
<tdclass="paramname"><em>subsamp</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><divclass="memdoc">
<p>The plane width of a YUV image plane with the given parameters. </p>
<p>Refer to <aclass="el"href="group___turbo_j_p_e_g.html#YUVnotes">YUV Image Format Notes</a> for a description of plane width.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">componentID</td><td>ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr)</td></tr>
<tr><tdclass="paramname">width</td><td>width (in pixels) of the YUV image</td></tr>
<tr><tdclass="paramname">subsamp</td><td>level of chrominance subsampling in the image (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>the plane width of a YUV image plane with the given parameters, or -1 if the arguments are out of bounds. </dd></dl>
<tdclass="memname">DLLEXPORT int tjSaveImage </td>
<td>(</td>
<tdclass="paramtype">const char * </td>
<tdclass="paramname"><em>filename</em>, </td>
</tr>
<tr>
<tdclass="paramkey"></td>
<td></td>
<tdclass="paramtype">unsigned char * </td>
<tdclass="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<tdclass="paramkey"></td>
<td></td>
<tdclass="paramtype">int </td>
<tdclass="paramname"><em>width</em>, </td>
</tr>
<tr>
<tdclass="paramkey"></td>
<td></td>
<tdclass="paramtype">int </td>
<tdclass="paramname"><em>pitch</em>, </td>
</tr>
<tr>
<tdclass="paramkey"></td>
<td></td>
<tdclass="paramtype">int </td>
<tdclass="paramname"><em>height</em>, </td>
</tr>
<tr>
<tdclass="paramkey"></td>
<td></td>
<tdclass="paramtype">int </td>
<tdclass="paramname"><em>pixelFormat</em>, </td>
</tr>
<tr>
<tdclass="paramkey"></td>
<td></td>
<tdclass="paramtype">int </td>
<tdclass="paramname"><em>flags</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><divclass="memdoc">
<p>Save an uncompressed image from memory to disk. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">filename</td><td>name of a file to which to save the uncompressed image. The image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, depending on the file extension.</td></tr>
<tr><tdclass="paramname">buffer</td><td>pointer to an image buffer containing RGB, grayscale, or CMYK pixels to be saved</td></tr>
<tr><tdclass="paramname">width</td><td>width (in pixels) of the uncompressed image</td></tr>
<tr><tdclass="paramname">pitch</td><td>bytes per line in the image buffer. Setting this parameter to 0 is the equivalent of setting it to <code>width * <aclass="el"href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c"title="Pixel size (in bytes) for a given pixel format.">tjPixelSize</a>[pixelFormat]</code>.</td></tr>
<tr><tdclass="paramname">height</td><td>height (in pixels) of the uncompressed image</td></tr>
<tr><tdclass="paramname">pixelFormat</td><td>pixel format of the image buffer (see <aclass="el"href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) If this parameter is set to <aclass="el"href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>, then the image will be stored in PGM or 8-bit (indexed color) BMP format. Otherwise, the image will be stored in PPM or 24-bit BMP format. If this parameter is set to <aclass="el"href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7f5100ec44c91994e243f1cf55553f8b">TJPF_CMYK</a>, then the CMYK pixels will be converted to RGB using a quick & dirty algorithm that is suitable only for testing (proper conversion between CMYK and other formats requires a color management system.)</td></tr>
<tr><tdclass="paramname">flags</td><td>the bitwise OR of one or more of the <aclass="el"href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a>.) </dd></dl>
<p>Lossless transforms work by moving the raw DCT 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.</p>
<tr><tdclass="paramname">dstBufs</td><td>pointer to an array of n image buffers. <code>dstBufs[i]</code> will receive a JPEG image that has been transformed using the parameters in <code>transforms[i]</code>. TurboJPEG has the ability to reallocate the JPEG buffer to accommodate the size of the JPEG image. Thus, you can choose to:<oltype="1">
<li>pre-allocate the JPEG buffer with an arbitrary size using <aclass="el"href="group___turbo_j_p_e_g.html#gaec627dd4c5f30b7a775a7aea3bec5d83"title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> and let TurboJPEG grow the buffer as needed,</li>
<li>pre-allocate the buffer to a "worst case" size determined by calling <aclass="el"href="group___turbo_j_p_e_g.html#ga67ac12fee79073242cb216e07c9f1f90"title="The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters...">tjBufSize()</a> with the transformed or cropped width and height. Under normal circumstances, this should ensure that the buffer never has to be re-allocated (setting <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> guarantees that it won't be.) Note, however, that there are some rare cases (such as transforming images with a large amount of embedded EXIF or ICC profile data) in which the output image will be larger than the worst-case size, and <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a> cannot be used in those cases.</li>
If you choose option 1, <code>dstSizes[i]</code> should be set to the size of your pre-allocated buffer. In any case, unless you have set <aclass="el"href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963"title="Disable buffer (re)allocation.">TJFLAG_NOREALLOC</a>, you should always check <code>dstBufs[i]</code> upon return from this function, as it may have changed.</td></tr>
<tr><tdclass="paramname">dstSizes</td><td>pointer to an array of n unsigned long variables that will receive the actual sizes (in bytes) of each transformed JPEG image. If <code>dstBufs[i]</code> points to a pre-allocated buffer, then <code>dstSizes[i]</code> should be set to the size of the buffer. Upon return, <code>dstSizes[i]</code> will contain the size of the JPEG image (in bytes.)</td></tr>
<tr><tdclass="paramname">transforms</td><td>pointer to an array of n <aclass="el"href="structtjtransform.html"title="Lossless transform.">tjtransform</a> structures, each of which specifies the transform parameters and/or cropping region for the corresponding transformed output image.</td></tr>
<tr><tdclass="paramname">flags</td><td>the bitwise OR of one or more of the <aclass="el"href="group___turbo_j_p_e_g.html#gacb233cfd722d66d1ccbf48a7de81f0e0">flags</a></td></tr>
<dlclass="section return"><dt>Returns</dt><dd>0 if successful, or -1 if an error occurred (see <aclass="el"href="group___turbo_j_p_e_g.html#ga1ead8574f9f39fbafc6b497124e7aafa"title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr2()</a> and <aclass="el"href="group___turbo_j_p_e_g.html#ga414feeffbf860ebd31c745df203de410"title="Returns a code indicating the severity of the last error.">tjGetErrorCode()</a>.) </dd></dl>
<p>Alpha offset (in bytes) for a given pixel format. </p>
<p>This specifies the number of bytes that the Alpha component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRA is stored in <code>char pixel[]</code>, then the alpha component will be <code>pixel[tjAlphaOffset[TJ_BGRA]]</code>. This will be -1 if the pixel format does not have an alpha component. </p>
<p>This specifies the number of bytes that the Blue component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the blue component will be <code>pixel[tjBlueOffset[TJ_BGRX]]</code>. This will be -1 if the pixel format does not have a blue component. </p>
<p>This specifies the number of bytes that the green component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the green component will be <code>pixel[tjGreenOffset[TJ_BGRX]]</code>. This will be -1 if the pixel format does not have a green component. </p>
<p>This specifies the number of bytes that the red component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the red component will be <code>pixel[tjRedOffset[TJ_BGRX]]</code>. This will be -1 if the pixel format does not have a red component. </p>