DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C)2009-2011 D. R. Commander. All Rights Reserved. |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 3 | * |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are met: |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 6 | * |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 7 | * - Redistributions of source code must retain the above copyright notice, |
| 8 | * this list of conditions and the following disclaimer. |
| 9 | * - Redistributions in binary form must reproduce the above copyright notice, |
| 10 | * this list of conditions and the following disclaimer in the documentation |
| 11 | * and/or other materials provided with the distribution. |
| 12 | * - Neither the name of the libjpeg-turbo Project nor the names of its |
| 13 | * contributors may be used to endorse or promote products derived from this |
| 14 | * software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", |
| 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
| 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 26 | * POSSIBILITY OF SUCH DAMAGE. |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 27 | */ |
| 28 | |
DRC | 3a1bb35 | 2011-05-24 09:15:44 +0000 | [diff] [blame] | 29 | #ifndef __TURBOJPEG_H__ |
| 30 | #define __TURBOJPEG_H__ |
| 31 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 32 | #if defined(_WIN32) && defined(DLLDEFINE) |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 33 | #define DLLEXPORT __declspec(dllexport) |
| 34 | #else |
| 35 | #define DLLEXPORT |
| 36 | #endif |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 37 | #define DLLCALL |
| 38 | |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 39 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 40 | /** |
| 41 | * @addtogroup TurboJPEG |
| 42 | * TurboJPEG API. This API provides an interface for generating, decoding, and |
| 43 | * transforming planar YUV and JPEG images in memory. |
| 44 | * |
| 45 | * @{ |
| 46 | */ |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 47 | |
DRC | 0a32519 | 2011-03-02 09:22:41 +0000 | [diff] [blame] | 48 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 49 | /** |
| 50 | * The number of chrominance subsampling options |
| 51 | */ |
| 52 | #define TJ_NUMSAMP 5 |
DRC | fbb6747 | 2010-11-24 04:02:37 +0000 | [diff] [blame] | 53 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 54 | /** |
| 55 | * Chrominance subsampling options. |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 56 | * When an image is converted from the RGB to the YCbCr colorspace as part of |
| 57 | * the JPEG compression process, some of the Cb and Cr (chrominance) components |
| 58 | * can be discarded or averaged together to produce a smaller image with little |
| 59 | * perceptible loss of image clarity (the human eye is more sensitive to small |
| 60 | * changes in brightness than small changes in color.) This is called |
| 61 | * "chrominance subsampling". |
| 62 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 63 | enum TJSAMP |
DRC | 109a578 | 2011-03-01 09:53:07 +0000 | [diff] [blame] | 64 | { |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 65 | /** |
| 66 | * 4:4:4 chrominance subsampling (no chrominance subsampling). The JPEG or |
| 67 | * YUV image will contain one chrominance component for every pixel in the |
| 68 | * source image. |
| 69 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 70 | TJSAMP_444=0, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 71 | /** |
| 72 | * 4:2:2 chrominance subsampling. The JPEG or YUV image will contain one |
| 73 | * chrominance component for every 2x1 block of pixels in the source image. |
| 74 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 75 | TJSAMP_422, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 76 | /** |
| 77 | * 4:2:0 chrominance subsampling. The JPEG or YUV image will contain one |
| 78 | * chrominance component for every 2x2 block of pixels in the source image. |
| 79 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 80 | TJSAMP_420, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 81 | /** |
| 82 | * Grayscale. The JPEG or YUV image will contain no chrominance components. |
| 83 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 84 | TJSAMP_GRAY, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 85 | /** |
| 86 | * 4:4:0 chrominance subsampling. The JPEG or YUV image will contain one |
| 87 | * chrominance component for every 1x2 block of pixels in the source image. |
| 88 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 89 | TJSAMP_440 |
DRC | 890f1e0 | 2011-02-26 22:02:37 +0000 | [diff] [blame] | 90 | }; |
| 91 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 92 | /** |
| 93 | * MCU block width (in pixels) for a given level of chrominance subsampling. |
| 94 | * MCU block sizes: |
| 95 | * - 8x8 for no subsampling or grayscale |
| 96 | * - 16x8 for 4:2:2 |
| 97 | * - 8x16 for 4:4:0 |
| 98 | * - 16x16 for 4:2:0 |
| 99 | */ |
| 100 | static const int tjMCUWidth[TJ_NUMSAMP] = {8, 16, 16, 8, 8}; |
DRC | 890f1e0 | 2011-02-26 22:02:37 +0000 | [diff] [blame] | 101 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 102 | /** |
| 103 | * MCU block height (in pixels) for a given level of chrominance subsampling. |
| 104 | * MCU block sizes: |
| 105 | * - 8x8 for no subsampling or grayscale |
| 106 | * - 16x8 for 4:2:2 |
| 107 | * - 8x16 for 4:4:0 |
| 108 | * - 16x16 for 4:2:0 |
| 109 | */ |
| 110 | static const int tjMCUHeight[TJ_NUMSAMP] = {8, 8, 16, 8, 16}; |
| 111 | |
| 112 | |
| 113 | /** |
| 114 | * The number of pixel formats |
| 115 | */ |
DRC | 67ce3b2 | 2011-12-19 02:21:03 +0000 | [diff] [blame] | 116 | #define TJ_NUMPF 11 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 117 | |
| 118 | /** |
| 119 | * Pixel formats |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 120 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 121 | enum TJPF |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 122 | { |
| 123 | /** |
| 124 | * RGB pixel format. The red, green, and blue components in the image are |
| 125 | * stored in 3-byte pixels in the order R, G, B from lowest to highest byte |
| 126 | * address within each pixel. |
| 127 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 128 | TJPF_RGB=0, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 129 | /** |
| 130 | * BGR pixel format. The red, green, and blue components in the image are |
| 131 | * stored in 3-byte pixels in the order B, G, R from lowest to highest byte |
| 132 | * address within each pixel. |
| 133 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 134 | TJPF_BGR, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 135 | /** |
| 136 | * RGBX pixel format. The red, green, and blue components in the image are |
| 137 | * stored in 4-byte pixels in the order R, G, B from lowest to highest byte |
DRC | 67ce3b2 | 2011-12-19 02:21:03 +0000 | [diff] [blame] | 138 | * address within each pixel. The X component is ignored when compressing |
| 139 | * and undefined when decompressing. |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 140 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 141 | TJPF_RGBX, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 142 | /** |
| 143 | * BGRX pixel format. The red, green, and blue components in the image are |
| 144 | * stored in 4-byte pixels in the order B, G, R from lowest to highest byte |
DRC | 67ce3b2 | 2011-12-19 02:21:03 +0000 | [diff] [blame] | 145 | * address within each pixel. The X component is ignored when compressing |
| 146 | * and undefined when decompressing. |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 147 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 148 | TJPF_BGRX, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 149 | /** |
| 150 | * XBGR pixel format. The red, green, and blue components in the image are |
| 151 | * stored in 4-byte pixels in the order R, G, B from highest to lowest byte |
DRC | 67ce3b2 | 2011-12-19 02:21:03 +0000 | [diff] [blame] | 152 | * address within each pixel. The X component is ignored when compressing |
| 153 | * and undefined when decompressing. |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 154 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 155 | TJPF_XBGR, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 156 | /** |
| 157 | * XRGB pixel format. The red, green, and blue components in the image are |
| 158 | * stored in 4-byte pixels in the order B, G, R from highest to lowest byte |
DRC | 67ce3b2 | 2011-12-19 02:21:03 +0000 | [diff] [blame] | 159 | * address within each pixel. The X component is ignored when compressing |
| 160 | * and undefined when decompressing. |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 161 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 162 | TJPF_XRGB, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 163 | /** |
| 164 | * Grayscale pixel format. Each 1-byte pixel represents a luminance |
| 165 | * (brightness) level from 0 to 255. |
| 166 | */ |
DRC | 67ce3b2 | 2011-12-19 02:21:03 +0000 | [diff] [blame] | 167 | TJPF_GRAY, |
| 168 | /** |
| 169 | * RGBA pixel format. This is the same as @ref TJPF_RGBX, except that when |
| 170 | * decompressing, the X component is guaranteed to be 0xFF, which can be |
| 171 | * interpreted as an opaque alpha channel. |
| 172 | */ |
| 173 | TJPF_RGBA, |
| 174 | /** |
| 175 | * BGRA pixel format. This is the same as @ref TJPF_BGRX, except that when |
| 176 | * decompressing, the X component is guaranteed to be 0xFF, which can be |
| 177 | * interpreted as an opaque alpha channel. |
| 178 | */ |
| 179 | TJPF_BGRA, |
| 180 | /** |
| 181 | * ABGR pixel format. This is the same as @ref TJPF_XBGR, except that when |
| 182 | * decompressing, the X component is guaranteed to be 0xFF, which can be |
| 183 | * interpreted as an opaque alpha channel. |
| 184 | */ |
| 185 | TJPF_ABGR, |
| 186 | /** |
| 187 | * ARGB pixel format. This is the same as @ref TJPF_XRGB, except that when |
| 188 | * decompressing, the X component is guaranteed to be 0xFF, which can be |
| 189 | * interpreted as an opaque alpha channel. |
| 190 | */ |
| 191 | TJPF_ARGB |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 192 | }; |
| 193 | |
| 194 | /** |
| 195 | * Red offset (in bytes) for a given pixel format. This specifies the number |
| 196 | * of bytes that the red component is offset from the start of the pixel. For |
| 197 | * instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>, |
| 198 | * then the red component will be <tt>pixel[tjRedOffset[TJ_BGRX]]</tt>. |
| 199 | */ |
DRC | 67ce3b2 | 2011-12-19 02:21:03 +0000 | [diff] [blame] | 200 | static const int tjRedOffset[TJ_NUMPF] = {0, 2, 0, 2, 3, 1, 0, 0, 2, 3, 1}; |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 201 | /** |
| 202 | * Green offset (in bytes) for a given pixel format. This specifies the number |
| 203 | * of bytes that the green component is offset from the start of the pixel. |
| 204 | * For instance, if a pixel of format TJ_BGRX is stored in |
| 205 | * <tt>char pixel[]</tt>, then the green component will be |
| 206 | * <tt>pixel[tjGreenOffset[TJ_BGRX]]</tt>. |
| 207 | */ |
DRC | 67ce3b2 | 2011-12-19 02:21:03 +0000 | [diff] [blame] | 208 | static const int tjGreenOffset[TJ_NUMPF] = {1, 1, 1, 1, 2, 2, 0, 1, 1, 2, 2}; |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 209 | /** |
| 210 | * Blue offset (in bytes) for a given pixel format. This specifies the number |
| 211 | * of bytes that the Blue component is offset from the start of the pixel. For |
| 212 | * instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>, |
| 213 | * then the blue component will be <tt>pixel[tjBlueOffset[TJ_BGRX]]</tt>. |
| 214 | */ |
DRC | 67ce3b2 | 2011-12-19 02:21:03 +0000 | [diff] [blame] | 215 | static const int tjBlueOffset[TJ_NUMPF] = {2, 0, 2, 0, 1, 3, 0, 2, 0, 1, 3}; |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 216 | |
| 217 | /** |
| 218 | * Pixel size (in bytes) for a given pixel format. |
| 219 | */ |
DRC | 67ce3b2 | 2011-12-19 02:21:03 +0000 | [diff] [blame] | 220 | static const int tjPixelSize[TJ_NUMPF] = {3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4}; |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 221 | |
| 222 | |
| 223 | /** |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 224 | * The uncompressed source/destination image is stored in bottom-up (Windows, |
| 225 | * OpenGL) order, not top-down (X11) order. |
| 226 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 227 | #define TJFLAG_BOTTOMUP 2 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 228 | /** |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 229 | * Turn off CPU auto-detection and force TurboJPEG to use MMX code (IPP and |
| 230 | * 32-bit libjpeg-turbo versions only.) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 231 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 232 | #define TJFLAG_FORCEMMX 8 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 233 | /** |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 234 | * Turn off CPU auto-detection and force TurboJPEG to use SSE code (32-bit IPP |
| 235 | * and 32-bit libjpeg-turbo versions only) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 236 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 237 | #define TJFLAG_FORCESSE 16 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 238 | /** |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 239 | * Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (32-bit IPP |
| 240 | * and 32-bit libjpeg-turbo versions only) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 241 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 242 | #define TJFLAG_FORCESSE2 32 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 243 | /** |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 244 | * Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (64-bit IPP |
| 245 | * version only) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 246 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 247 | #define TJFLAG_FORCESSE3 128 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 248 | /** |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 249 | * Use fast, inaccurate chrominance upsampling routines in the JPEG |
| 250 | * decompressor (libjpeg and libjpeg-turbo versions only) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 251 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 252 | #define TJFLAG_FASTUPSAMPLE 256 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 253 | /** |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 254 | * Disable buffer (re)allocation. If passed to #tjCompress2() or |
| 255 | * #tjTransform(), this flag will cause those functions to generate an error if |
| 256 | * the JPEG image buffer is invalid or too small rather than attempting to |
| 257 | * allocate or reallocate that buffer. This reproduces the behavior of earlier |
| 258 | * versions of TurboJPEG. |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 259 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 260 | #define TJFLAG_NOREALLOC 1024 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 261 | |
| 262 | |
| 263 | /** |
| 264 | * Number of transform operations |
| 265 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 266 | #define TJ_NUMXOP 8 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 267 | |
| 268 | /** |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 269 | * Transform operations for #tjTransform() |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 270 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 271 | enum TJXOP |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 272 | { |
| 273 | /** |
| 274 | * Do not transform the position of the image pixels |
| 275 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 276 | TJXOP_NONE=0, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 277 | /** |
| 278 | * Flip (mirror) image horizontally. This transform is imperfect if there |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 279 | * are any partial MCU blocks on the right edge (see #TJXOPT_PERFECT.) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 280 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 281 | TJXOP_HFLIP, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 282 | /** |
| 283 | * Flip (mirror) image vertically. This transform is imperfect if there are |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 284 | * any partial MCU blocks on the bottom edge (see #TJXOPT_PERFECT.) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 285 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 286 | TJXOP_VFLIP, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 287 | /** |
| 288 | * Transpose image (flip/mirror along upper left to lower right axis.) This |
| 289 | * transform is always perfect. |
| 290 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 291 | TJXOP_TRANSPOSE, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 292 | /** |
| 293 | * Transverse transpose image (flip/mirror along upper right to lower left |
| 294 | * axis.) This transform is imperfect if there are any partial MCU blocks in |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 295 | * the image (see #TJXOPT_PERFECT.) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 296 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 297 | TJXOP_TRANSVERSE, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 298 | /** |
| 299 | * Rotate image clockwise by 90 degrees. This transform is imperfect if |
| 300 | * there are any partial MCU blocks on the bottom edge (see |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 301 | * #TJXOPT_PERFECT.) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 302 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 303 | TJXOP_ROT90, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 304 | /** |
| 305 | * Rotate image 180 degrees. This transform is imperfect if there are any |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 306 | * partial MCU blocks in the image (see #TJXOPT_PERFECT.) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 307 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 308 | TJXOP_ROT180, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 309 | /** |
| 310 | * Rotate image counter-clockwise by 90 degrees. This transform is imperfect |
| 311 | * if there are any partial MCU blocks on the right edge (see |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 312 | * #TJXOPT_PERFECT.) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 313 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 314 | TJXOP_ROT270 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 315 | }; |
| 316 | |
| 317 | |
| 318 | /** |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 319 | * This option will cause #tjTransform() to return an error if the transform is |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 320 | * not perfect. Lossless transforms operate on MCU blocks, whose size depends |
| 321 | * on the level of chrominance subsampling used (see #tjMCUWidth |
| 322 | * and #tjMCUHeight.) If the image's width or height is not evenly divisible |
| 323 | * by the MCU block size, then there will be partial MCU blocks on the right |
| 324 | * and/or bottom edges. It is not possible to move these partial MCU blocks to |
| 325 | * the top or left of the image, so any transform that would require that is |
| 326 | * "imperfect." If this option is not specified, then any partial MCU blocks |
| 327 | * that cannot be transformed will be left in place, which will create |
| 328 | * odd-looking strips on the right or bottom edge of the image. |
| 329 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 330 | #define TJXOPT_PERFECT 1 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 331 | /** |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 332 | * This option will cause #tjTransform() to discard any partial MCU blocks that |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 333 | * cannot be transformed. |
| 334 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 335 | #define TJXOPT_TRIM 2 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 336 | /** |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 337 | * This option will enable lossless cropping. See #tjTransform() for more |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 338 | * information. |
| 339 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 340 | #define TJXOPT_CROP 4 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 341 | /** |
| 342 | * This option will discard the color data in the input image and produce |
| 343 | * a grayscale output image. |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 344 | */ |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 345 | #define TJXOPT_GRAY 8 |
DRC | 7bf04d3 | 2011-09-17 00:18:31 +0000 | [diff] [blame] | 346 | /** |
| 347 | * This option will prevent #tjTransform() from outputting a JPEG image for |
| 348 | * this particular transform (this can be used in conjunction with a custom |
| 349 | * filter to capture the transformed DCT coefficients without transcoding |
| 350 | * them.) |
| 351 | */ |
| 352 | #define TJXOPT_NOOUTPUT 16 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 353 | |
| 354 | |
| 355 | /** |
| 356 | * Scaling factor |
| 357 | */ |
DRC | 0a07969 | 2011-03-02 09:27:49 +0000 | [diff] [blame] | 358 | typedef struct |
| 359 | { |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 360 | /** |
| 361 | * Numerator |
| 362 | */ |
| 363 | int num; |
| 364 | /** |
| 365 | * Denominator |
| 366 | */ |
| 367 | int denom; |
| 368 | } tjscalingfactor; |
| 369 | |
| 370 | /** |
| 371 | * Cropping region |
| 372 | */ |
| 373 | typedef struct |
| 374 | { |
| 375 | /** |
| 376 | * The left boundary of the cropping region. This must be evenly divisible |
| 377 | * by the MCU block width (see #tjMCUWidth.) |
| 378 | */ |
| 379 | int x; |
| 380 | /** |
| 381 | * The upper boundary of the cropping region. This must be evenly divisible |
| 382 | * by the MCU block height (see #tjMCUHeight.) |
| 383 | */ |
| 384 | int y; |
| 385 | /** |
| 386 | * The width of the cropping region. Setting this to 0 is the equivalent of |
| 387 | * setting it to the width of the source JPEG image - x. |
| 388 | */ |
| 389 | int w; |
| 390 | /** |
| 391 | * The height of the cropping region. Setting this to 0 is the equivalent of |
| 392 | * setting it to the height of the source JPEG image - y. |
| 393 | */ |
| 394 | int h; |
DRC | 0a07969 | 2011-03-02 09:27:49 +0000 | [diff] [blame] | 395 | } tjregion; |
| 396 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 397 | /** |
| 398 | * Lossless transform |
| 399 | */ |
DRC | f546711 | 2011-09-20 05:02:19 +0000 | [diff] [blame] | 400 | typedef struct tjtransform |
DRC | 0a07969 | 2011-03-02 09:27:49 +0000 | [diff] [blame] | 401 | { |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 402 | /** |
| 403 | * Cropping region |
| 404 | */ |
| 405 | tjregion r; |
| 406 | /** |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 407 | * One of the @ref TJXOP "transform operations" |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 408 | */ |
| 409 | int op; |
| 410 | /** |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 411 | * The bitwise OR of one of more of the @ref TJXOPT_CROP "transform options" |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 412 | */ |
| 413 | int options; |
DRC | 7bf04d3 | 2011-09-17 00:18:31 +0000 | [diff] [blame] | 414 | /** |
DRC | f546711 | 2011-09-20 05:02:19 +0000 | [diff] [blame] | 415 | * Arbitrary data that can be accessed within the body of the callback |
| 416 | * function |
| 417 | */ |
| 418 | void *data; |
| 419 | /** |
DRC | 7bf04d3 | 2011-09-17 00:18:31 +0000 | [diff] [blame] | 420 | * A callback function that can be used to modify the DCT coefficients |
| 421 | * after they are losslessly transformed but before they are transcoded to a |
| 422 | * new JPEG file. This allows for custom filters or other transformations to |
| 423 | * be applied in the frequency domain. |
| 424 | * |
DRC | f546711 | 2011-09-20 05:02:19 +0000 | [diff] [blame] | 425 | * @param coeffs pointer to an array of transformed DCT coefficients. (NOTE: |
| 426 | * this pointer is not guaranteed to be valid once the callback |
| 427 | * returns, so applications wishing to hand off the DCT coefficients |
| 428 | * to another function or library should make a copy of them within |
| 429 | * the body of the callback.) |
| 430 | * @param arrayRegion #tjregion structure containing the width and height of |
DRC | f69dc28 | 2011-09-20 18:20:43 +0000 | [diff] [blame] | 431 | * the array pointed to by <tt>coeffs</tt> as well as its offset |
| 432 | * relative to the component plane. TurboJPEG implementations may |
| 433 | * choose to split each component plane into multiple DCT coefficient |
| 434 | * arrays and call the callback function once for each array. |
DRC | f546711 | 2011-09-20 05:02:19 +0000 | [diff] [blame] | 435 | * @param planeRegion #tjregion structure containing the width and height of |
| 436 | * the component plane to which <tt>coeffs</tt> belongs |
| 437 | * @param componentID ID number of the component plane to which |
| 438 | * <tt>coeffs</tt> belongs (Y, Cb, and Cr have, respectively, ID's of |
| 439 | * 0, 1, and 2 in typical JPEG images.) |
| 440 | * @param transformID ID number of the transformed image to which |
| 441 | * <tt>coeffs</tt> belongs. This is the same as the index of the |
| 442 | * transform in the transforms array that was passed to |
| 443 | * #tjTransform(). |
| 444 | * @param transform a pointer to a #tjtransform structure that specifies the |
| 445 | * parameters and/or cropping region for this transform |
DRC | 7bf04d3 | 2011-09-17 00:18:31 +0000 | [diff] [blame] | 446 | * |
| 447 | * @return 0 if the callback was successful, or -1 if an error occurred. |
| 448 | */ |
| 449 | int (*customFilter)(short *coeffs, tjregion arrayRegion, |
DRC | f546711 | 2011-09-20 05:02:19 +0000 | [diff] [blame] | 450 | tjregion planeRegion, int componentIndex, int transformIndex, |
| 451 | struct tjtransform *transform); |
DRC | 0a07969 | 2011-03-02 09:27:49 +0000 | [diff] [blame] | 452 | } tjtransform; |
| 453 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 454 | /** |
| 455 | * TurboJPEG instance handle |
| 456 | */ |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 457 | typedef void* tjhandle; |
| 458 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 459 | |
| 460 | /** |
| 461 | * Pad the given width to the nearest 32-bit boundary |
| 462 | */ |
| 463 | #define TJPAD(width) (((width)+3)&(~3)) |
| 464 | |
| 465 | /** |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 466 | * Compute the scaled value of <tt>dimension</tt> using the given scaling |
| 467 | * factor. This macro performs the integer equivalent of <tt>ceil(dimension * |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 468 | * scalingFactor)</tt>. |
| 469 | */ |
| 470 | #define TJSCALED(dimension, scalingFactor) ((dimension * scalingFactor.num \ |
| 471 | + scalingFactor.denom - 1) / scalingFactor.denom) |
| 472 | |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 473 | |
| 474 | #ifdef __cplusplus |
| 475 | extern "C" { |
| 476 | #endif |
| 477 | |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 478 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 479 | /** |
| 480 | * Create a TurboJPEG compressor instance. |
| 481 | * |
| 482 | * @return a handle to the newly-created instance, or NULL if an error |
| 483 | * occurred (see #tjGetErrorStr().) |
| 484 | */ |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 485 | DLLEXPORT tjhandle DLLCALL tjInitCompress(void); |
| 486 | |
| 487 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 488 | /** |
| 489 | * Compress an RGB or grayscale image into a JPEG image. |
| 490 | * |
| 491 | * @param handle a handle to a TurboJPEG compressor or transformer instance |
| 492 | * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels |
| 493 | * to be compressed |
| 494 | * @param width width (in pixels) of the source image |
| 495 | * @param pitch bytes per line of the source image. Normally, this should be |
| 496 | * <tt>width * #tjPixelSize[pixelFormat]</tt> if the image is unpadded, |
| 497 | * or <tt>#TJPAD(width * #tjPixelSize[pixelFormat])</tt> if each line of |
| 498 | * the image is padded to the nearest 32-bit boundary, as is the case |
| 499 | * for Windows bitmaps. You can also be clever and use this parameter |
| 500 | * to skip lines, etc. Setting this parameter to 0 is the equivalent of |
| 501 | * setting it to <tt>width * #tjPixelSize[pixelFormat]</tt>. |
| 502 | * @param height height (in pixels) of the source image |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 503 | * @param pixelFormat pixel format of the source image (see @ref TJPF |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 504 | * "Pixel formats".) |
| 505 | * @param jpegBuf address of a pointer to an image buffer that will receive the |
| 506 | * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer |
| 507 | * to accommodate the size of the JPEG image. Thus, you can choose to: |
DRC | 6b76f75 | 2011-05-24 16:52:47 +0000 | [diff] [blame] | 508 | * -# pre-allocate the JPEG buffer with an arbitrary size using |
| 509 | * #tjAlloc() and let TurboJPEG grow the buffer as needed, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 510 | * -# set <tt>*jpegBuf</tt> to NULL to tell TurboJPEG to allocate the |
| 511 | * buffer for you, or |
| 512 | * -# pre-allocate the buffer to a "worst case" size determined by |
DRC | 9b49f0e | 2011-07-12 03:17:23 +0000 | [diff] [blame] | 513 | * calling #tjBufSize(). This should ensure that the buffer never has |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 514 | * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 515 | * . |
DRC | ff78e37 | 2011-05-24 10:17:32 +0000 | [diff] [blame] | 516 | * If you choose option 1, <tt>*jpegSize</tt> should be set to the |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 517 | * size of your pre-allocated buffer. In any case, unless you have |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 518 | * set #TJFLAG_NOREALLOC, you should always check <tt>*jpegBuf</tt> upon |
| 519 | * return from this function, as it may have changed. |
DRC | 80803ae | 2011-12-15 13:12:59 +0000 | [diff] [blame] | 520 | * @param jpegSize pointer to an unsigned long variable that holds the size of |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 521 | * the JPEG image buffer. If <tt>*jpegBuf</tt> points to a |
| 522 | * pre-allocated buffer, then <tt>*jpegSize</tt> should be set to the |
| 523 | * size of the buffer. Upon return, <tt>*jpegSize</tt> will contain the |
| 524 | * size of the JPEG image (in bytes.) |
| 525 | * @param jpegSubsamp the level of chrominance subsampling to be used when |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 526 | * generating the JPEG image (see @ref TJSAMP |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 527 | * "Chrominance subsampling options".) |
| 528 | * @param jpegQual the image quality of the generated JPEG image (1 = worst, |
| 529 | 100 = best) |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 530 | * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP |
| 531 | * "flags". |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 532 | * |
| 533 | * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 534 | */ |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 535 | DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf, |
| 536 | int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf, |
| 537 | unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags); |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 538 | |
DRC | b28fc57 | 2011-02-22 06:41:29 +0000 | [diff] [blame] | 539 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 540 | /** |
| 541 | * The maximum size of the buffer (in bytes) required to hold a JPEG image with |
DRC | 9b49f0e | 2011-07-12 03:17:23 +0000 | [diff] [blame] | 542 | * the given parameters. The number of bytes returned by this function is |
| 543 | * larger than the size of the uncompressed source image. The reason for this |
| 544 | * is that the JPEG format uses 16-bit coefficients, and it is thus possible |
| 545 | * for a very high-quality JPEG image with very high frequency content to |
| 546 | * expand rather than compress when converted to the JPEG format. Such images |
| 547 | * represent a very rare corner case, but since there is no way to predict the |
| 548 | * size of a JPEG image prior to compression, the corner case has to be |
| 549 | * handled. |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 550 | * |
| 551 | * @param width width of the image (in pixels) |
| 552 | * @param height height of the image (in pixels) |
DRC | 9b49f0e | 2011-07-12 03:17:23 +0000 | [diff] [blame] | 553 | * @param jpegSubsamp the level of chrominance subsampling to be used when |
| 554 | * generating the JPEG image (see @ref TJSAMP |
| 555 | * "Chrominance subsampling options".) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 556 | * |
| 557 | * @return the maximum size of the buffer (in bytes) required to hold the |
| 558 | * image, or -1 if the arguments are out of bounds. |
| 559 | */ |
DRC | 9b49f0e | 2011-07-12 03:17:23 +0000 | [diff] [blame] | 560 | DLLEXPORT unsigned long DLLCALL tjBufSize(int width, int height, |
| 561 | int jpegSubsamp); |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 562 | |
DRC | b28fc57 | 2011-02-22 06:41:29 +0000 | [diff] [blame] | 563 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 564 | /** |
| 565 | * The size of the buffer (in bytes) required to hold a YUV planar image with |
| 566 | * the given parameters. |
| 567 | * |
| 568 | * @param width width of the image (in pixels) |
| 569 | * @param height height of the image (in pixels) |
DRC | 9b49f0e | 2011-07-12 03:17:23 +0000 | [diff] [blame] | 570 | * @param subsamp level of chrominance subsampling in the image (see |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 571 | * @ref TJSAMP "Chrominance subsampling options".) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 572 | * |
| 573 | * @return the size of the buffer (in bytes) required to hold the image, or |
| 574 | * -1 if the arguments are out of bounds. |
| 575 | */ |
DRC | 9b49f0e | 2011-07-12 03:17:23 +0000 | [diff] [blame] | 576 | DLLEXPORT unsigned long DLLCALL tjBufSizeYUV(int width, int height, |
| 577 | int subsamp); |
DRC | f3cf973 | 2011-02-22 00:16:14 +0000 | [diff] [blame] | 578 | |
DRC | b28fc57 | 2011-02-22 06:41:29 +0000 | [diff] [blame] | 579 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 580 | /** |
| 581 | * Encode an RGB or grayscale image into a YUV planar image. This function |
| 582 | * uses the accelerated color conversion routines in TurboJPEG's underlying |
| 583 | * codec to produce a planar YUV image that is suitable for X Video. |
| 584 | * Specifically, if the chrominance components are subsampled along the |
| 585 | * horizontal dimension, then the width of the luminance plane is padded to 2 |
| 586 | * in the output image (same goes for the height of the luminance plane, if the |
| 587 | * chrominance components are subsampled along the vertical dimension.) Also, |
| 588 | * each line of each plane in the output image is padded to 4 bytes. Although |
| 589 | * this will work with any subsampling option, it is really only useful in |
| 590 | * combination with TJ_420, which produces an image compatible with the I420 |
| 591 | * (AKA "YUV420P") format. |
| 592 | * |
| 593 | * @param handle a handle to a TurboJPEG compressor or transformer instance |
| 594 | * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels |
| 595 | * to be encoded |
| 596 | * @param width width (in pixels) of the source image |
| 597 | * @param pitch bytes per line of the source image. Normally, this should be |
| 598 | * <tt>width * #tjPixelSize[pixelFormat]</tt> if the image is unpadded, |
| 599 | * or <tt>#TJPAD(width * #tjPixelSize[pixelFormat])</tt> if each line of |
| 600 | * the image is padded to the nearest 32-bit boundary, as is the case |
| 601 | * for Windows bitmaps. You can also be clever and use this parameter |
| 602 | * to skip lines, etc. Setting this parameter to 0 is the equivalent of |
| 603 | * setting it to <tt>width * #tjPixelSize[pixelFormat]</tt>. |
| 604 | * @param height height (in pixels) of the source image |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 605 | * @param pixelFormat pixel format of the source image (see @ref TJPF |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 606 | * "Pixel formats".) |
DRC | 80803ae | 2011-12-15 13:12:59 +0000 | [diff] [blame] | 607 | * @param dstBuf pointer to an image buffer that will receive the YUV image. |
DRC | 9b49f0e | 2011-07-12 03:17:23 +0000 | [diff] [blame] | 608 | * Use #tjBufSizeYUV() to determine the appropriate size for this buffer |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 609 | * based on the image width, height, and level of chrominance |
| 610 | * subsampling. |
| 611 | * @param subsamp the level of chrominance subsampling to be used when |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 612 | * generating the YUV image (see @ref TJSAMP |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 613 | * "Chrominance subsampling options".) |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 614 | * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP |
| 615 | * "flags". |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 616 | * |
| 617 | * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) |
DRC | 8424160 | 2011-02-25 02:08:23 +0000 | [diff] [blame] | 618 | */ |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 619 | DLLEXPORT int DLLCALL tjEncodeYUV2(tjhandle handle, |
| 620 | unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, |
| 621 | unsigned char *dstBuf, int subsamp, int flags); |
DRC | 8424160 | 2011-02-25 02:08:23 +0000 | [diff] [blame] | 622 | |
| 623 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 624 | /** |
| 625 | * Create a TurboJPEG decompressor instance. |
| 626 | * |
| 627 | * @return a handle to the newly-created instance, or NULL if an error |
| 628 | * occurred (see #tjGetErrorStr().) |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 629 | */ |
| 630 | DLLEXPORT tjhandle DLLCALL tjInitDecompress(void); |
| 631 | |
| 632 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 633 | /** |
| 634 | * Retrieve information about a JPEG image without decompressing it. |
| 635 | * |
| 636 | * @param handle a handle to a TurboJPEG decompressor or transformer instance |
| 637 | * @param jpegBuf pointer to a buffer containing a JPEG image |
| 638 | * @param jpegSize size of the JPEG image (in bytes) |
DRC | 80803ae | 2011-12-15 13:12:59 +0000 | [diff] [blame] | 639 | * @param width pointer to an integer variable that will receive the width (in |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 640 | * pixels) of the JPEG image |
DRC | 80803ae | 2011-12-15 13:12:59 +0000 | [diff] [blame] | 641 | * @param height pointer to an integer variable that will receive the height |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 642 | * (in pixels) of the JPEG image |
DRC | 80803ae | 2011-12-15 13:12:59 +0000 | [diff] [blame] | 643 | * @param jpegSubsamp pointer to an integer variable that will receive the |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 644 | * level of chrominance subsampling used when compressing the JPEG image |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 645 | * (see @ref TJSAMP "Chrominance subsampling options".) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 646 | * |
| 647 | * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 648 | */ |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 649 | DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle handle, |
| 650 | unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, |
| 651 | int *jpegSubsamp); |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 652 | |
| 653 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 654 | /** |
| 655 | * Returns a list of fractional scaling factors that the JPEG decompressor in |
| 656 | * this implementation of TurboJPEG supports. |
| 657 | * |
| 658 | * @param numscalingfactors pointer to an integer variable that will receive |
| 659 | * the number of elements in the list |
| 660 | * |
| 661 | * @return a pointer to a list of fractional scaling factors, or NULL if an |
| 662 | * error is encountered (see #tjGetErrorStr().) |
DRC | b28fc57 | 2011-02-22 06:41:29 +0000 | [diff] [blame] | 663 | */ |
DRC | 109a578 | 2011-03-01 09:53:07 +0000 | [diff] [blame] | 664 | DLLEXPORT tjscalingfactor* DLLCALL tjGetScalingFactors(int *numscalingfactors); |
DRC | b28fc57 | 2011-02-22 06:41:29 +0000 | [diff] [blame] | 665 | |
| 666 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 667 | /** |
| 668 | * Decompress a JPEG image to an RGB or grayscale image. |
| 669 | * |
| 670 | * @param handle a handle to a TurboJPEG decompressor or transformer instance |
| 671 | * @param jpegBuf pointer to a buffer containing the JPEG image to decompress |
| 672 | * @param jpegSize size of the JPEG image (in bytes) |
DRC | 80803ae | 2011-12-15 13:12:59 +0000 | [diff] [blame] | 673 | * @param dstBuf pointer to an image buffer that will receive the decompressed |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 674 | * image. This buffer should normally be <tt>pitch * scaledHeight</tt> |
| 675 | * bytes in size, where <tt>scaledHeight</tt> can be determined by |
| 676 | * calling #TJSCALED() with the JPEG image height and one of the scaling |
| 677 | * factors returned by #tjGetScalingFactors(). The dstBuf pointer may |
| 678 | * also be used to decompress into a specific region of a larger buffer. |
| 679 | * @param width desired width (in pixels) of the destination image. If this is |
| 680 | * smaller than the width of the JPEG image being decompressed, then |
| 681 | * TurboJPEG will use scaling in the JPEG decompressor to generate the |
| 682 | * largest possible image that will fit within the desired width. If |
| 683 | * width is set to 0, then only the height will be considered when |
| 684 | * determining the scaled image size. |
| 685 | * @param pitch bytes per line of the destination image. Normally, this is |
| 686 | * <tt>scaledWidth * #tjPixelSize[pixelFormat]</tt> if the decompressed |
| 687 | * image is unpadded, else <tt>#TJPAD(scaledWidth * |
| 688 | * #tjPixelSize[pixelFormat])</tt> if each line of the decompressed |
| 689 | * image is padded to the nearest 32-bit boundary, as is the case for |
| 690 | * Windows bitmaps. (NOTE: <tt>scaledWidth</tt> can be determined by |
| 691 | * calling #TJSCALED() with the JPEG image width and one of the scaling |
| 692 | * factors returned by #tjGetScalingFactors().) You can also be clever |
| 693 | * and use the pitch parameter to skip lines, etc. Setting this |
| 694 | * parameter to 0 is the equivalent of setting it to <tt>scaledWidth |
| 695 | * * #tjPixelSize[pixelFormat]</tt>. |
| 696 | * @param height desired height (in pixels) of the destination image. If this |
| 697 | * is smaller than the height of the JPEG image being decompressed, then |
| 698 | * TurboJPEG will use scaling in the JPEG decompressor to generate the |
| 699 | * largest possible image that will fit within the desired height. If |
| 700 | * height is set to 0, then only the width will be considered when |
| 701 | * determining the scaled image size. |
| 702 | * @param pixelFormat pixel format of the destination image (see @ref |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 703 | * TJPF "Pixel formats".) |
| 704 | * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP |
| 705 | * "flags". |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 706 | * |
| 707 | * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) |
| 708 | */ |
| 709 | DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, |
| 710 | unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, |
| 711 | int width, int pitch, int height, int pixelFormat, int flags); |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 712 | |
| 713 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 714 | /** |
| 715 | * Decompress a JPEG image to a YUV planar image. This function performs JPEG |
| 716 | * decompression but leaves out the color conversion step, so a planar YUV |
| 717 | * image is generated instead of an RGB image. The padding of the planes in |
| 718 | * this image is the same as the images generated by #tjEncodeYUV2(). Note |
| 719 | * that, if the width or height of the image is not an even multiple of the MCU |
| 720 | * block size (see #tjMCUWidth and #tjMCUHeight), then an intermediate buffer |
| 721 | * copy will be performed within TurboJPEG. |
| 722 | * |
| 723 | * @param handle a handle to a TurboJPEG decompressor or transformer instance |
| 724 | * @param jpegBuf pointer to a buffer containing the JPEG image to decompress |
| 725 | * @param jpegSize size of the JPEG image (in bytes) |
DRC | 80803ae | 2011-12-15 13:12:59 +0000 | [diff] [blame] | 726 | * @param dstBuf pointer to an image buffer that will receive the YUV image. |
DRC | 9b49f0e | 2011-07-12 03:17:23 +0000 | [diff] [blame] | 727 | * Use #tjBufSizeYUV to determine the appropriate size for this buffer |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 728 | * based on the image width, height, and level of subsampling. |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 729 | * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP |
| 730 | * "flags". |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 731 | * |
| 732 | * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) |
| 733 | */ |
| 734 | DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle handle, |
| 735 | unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, |
| 736 | int flags); |
DRC | 8424160 | 2011-02-25 02:08:23 +0000 | [diff] [blame] | 737 | |
| 738 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 739 | /** |
| 740 | * Create a new TurboJPEG transformer instance. |
| 741 | * |
| 742 | * @return a handle to the newly-created instance, or NULL if an error |
| 743 | * occurred (see #tjGetErrorStr().) |
| 744 | */ |
DRC | 890f1e0 | 2011-02-26 22:02:37 +0000 | [diff] [blame] | 745 | DLLEXPORT tjhandle DLLCALL tjInitTransform(void); |
| 746 | |
| 747 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 748 | /** |
| 749 | * Losslessly transform a JPEG image into another JPEG image. Lossless |
| 750 | * transforms work by moving the raw coefficients from one JPEG image structure |
| 751 | * to another without altering the values of the coefficients. While this is |
| 752 | * typically faster than decompressing the image, transforming it, and |
| 753 | * re-compressing it, lossless transforms are not free. Each lossless |
| 754 | * transform requires reading and Huffman decoding all of the coefficients in |
| 755 | * the source image, regardless of the size of the destination image. Thus, |
| 756 | * this function provides a means of generating multiple transformed images |
| 757 | * from the same source or of applying multiple transformations simultaneously, |
| 758 | * in order to eliminate the need to read the source coefficients multiple |
| 759 | * times. |
| 760 | * |
| 761 | * @param handle a handle to a TurboJPEG transformer instance |
| 762 | * @param jpegBuf pointer to a buffer containing the JPEG image to transform |
| 763 | * @param jpegSize size of the JPEG image (in bytes) |
| 764 | * @param n the number of transformed JPEG images to generate |
| 765 | * @param dstBufs pointer to an array of n image buffers. <tt>dstBufs[i]</tt> |
| 766 | * will receive a JPEG image that has been transformed using the |
| 767 | * parameters in <tt>transforms[i]</tt>. TurboJPEG has the ability to |
| 768 | * reallocate the JPEG buffer to accommodate the size of the JPEG image. |
| 769 | * Thus, you can choose to: |
DRC | 6b76f75 | 2011-05-24 16:52:47 +0000 | [diff] [blame] | 770 | * -# pre-allocate the JPEG buffer with an arbitrary size using |
| 771 | * #tjAlloc() and let TurboJPEG grow the buffer as needed, |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 772 | * -# set <tt>dstBufs[i]</tt> to NULL to tell TurboJPEG to allocate the |
| 773 | * buffer for you, or |
| 774 | * -# pre-allocate the buffer to a "worst case" size determined by |
DRC | 9b49f0e | 2011-07-12 03:17:23 +0000 | [diff] [blame] | 775 | * calling #tjBufSize() with the cropped width and height. This should |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 776 | * ensure that the buffer never has to be re-allocated (setting |
| 777 | * #TJFLAG_NOREALLOC guarantees this.) |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 778 | * . |
DRC | ff78e37 | 2011-05-24 10:17:32 +0000 | [diff] [blame] | 779 | * If you choose option 1, <tt>dstSizes[i]</tt> should be set to |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 780 | * the size of your pre-allocated buffer. In any case, unless you have |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 781 | * set #TJFLAG_NOREALLOC, you should always check <tt>dstBufs[i]</tt> |
| 782 | * upon return from this function, as it may have changed. |
DRC | 80803ae | 2011-12-15 13:12:59 +0000 | [diff] [blame] | 783 | * @param dstSizes pointer to an array of n unsigned long variables that will |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 784 | * receive the actual sizes (in bytes) of each transformed JPEG image. |
| 785 | * If <tt>dstBufs[i]</tt> points to a pre-allocated buffer, then |
| 786 | * <tt>dstSizes[i]</tt> should be set to the size of the buffer. Upon |
| 787 | * return, <tt>dstSizes[i]</tt> will contain the size of the JPEG image |
| 788 | * (in bytes.) |
| 789 | * @param transforms pointer to an array of n tjtransform structures, each of |
| 790 | * which specifies the transform parameters and/or cropping region for |
| 791 | * the corresponding transformed output image. |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 792 | * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP |
| 793 | * "flags". |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 794 | * |
| 795 | * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) |
| 796 | */ |
| 797 | DLLEXPORT int DLLCALL tjTransform(tjhandle handle, unsigned char *jpegBuf, |
| 798 | unsigned long jpegSize, int n, unsigned char **dstBufs, |
| 799 | unsigned long *dstSizes, tjtransform *transforms, int flags); |
DRC | 890f1e0 | 2011-02-26 22:02:37 +0000 | [diff] [blame] | 800 | |
| 801 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 802 | /** |
| 803 | * Destroy a TurboJPEG compressor, decompressor, or transformer instance. |
| 804 | * |
| 805 | * @param handle a handle to a TurboJPEG compressor, decompressor or |
| 806 | * transformer instance |
| 807 | * |
| 808 | * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().) |
| 809 | */ |
| 810 | DLLEXPORT int DLLCALL tjDestroy(tjhandle handle); |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 811 | |
| 812 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 813 | /** |
DRC | 6b76f75 | 2011-05-24 16:52:47 +0000 | [diff] [blame] | 814 | * Allocate an image buffer for use with TurboJPEG. You should always use |
| 815 | * this function to allocate the JPEG destination buffer(s) for #tjCompress2() |
| 816 | * and #tjTransform() unless you are disabling automatic buffer |
| 817 | * (re)allocation (by setting #TJFLAG_NOREALLOC.) |
| 818 | * |
| 819 | * @param bytes the number of bytes to allocate |
| 820 | * |
| 821 | * @return a pointer to a newly-allocated buffer with the specified number of |
| 822 | * bytes |
DRC | d441107 | 2011-05-24 17:00:15 +0000 | [diff] [blame] | 823 | * |
| 824 | * @sa tjFree() |
DRC | 6b76f75 | 2011-05-24 16:52:47 +0000 | [diff] [blame] | 825 | */ |
| 826 | DLLEXPORT unsigned char* DLLCALL tjAlloc(int bytes); |
| 827 | |
| 828 | |
| 829 | /** |
| 830 | * Free an image buffer previously allocated by TurboJPEG. You should always |
| 831 | * use this function to free JPEG destination buffer(s) that were automatically |
| 832 | * (re)allocated by #tjCompress2() or #tjTransform() or that were manually |
| 833 | * allocated using #tjAlloc(). |
| 834 | * |
| 835 | * @param buffer address of the buffer to free |
DRC | d441107 | 2011-05-24 17:00:15 +0000 | [diff] [blame] | 836 | * |
| 837 | * @sa tjAlloc() |
DRC | 6b76f75 | 2011-05-24 16:52:47 +0000 | [diff] [blame] | 838 | */ |
| 839 | DLLEXPORT void DLLCALL tjFree(unsigned char *buffer); |
| 840 | |
| 841 | |
| 842 | /** |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 843 | * Returns a descriptive error message explaining why the last command failed. |
| 844 | * |
| 845 | * @return a descriptive error message explaining why the last command failed. |
| 846 | */ |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 847 | DLLEXPORT char* DLLCALL tjGetErrorStr(void); |
| 848 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 849 | |
| 850 | /* Backward compatibility functions and macros (nothing to see here) */ |
| 851 | #define NUMSUBOPT TJ_NUMSAMP |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 852 | #define TJ_444 TJSAMP_444 |
| 853 | #define TJ_422 TJSAMP_422 |
| 854 | #define TJ_420 TJSAMP_420 |
| 855 | #define TJ_411 TJSAMP_420 |
| 856 | #define TJ_GRAYSCALE TJSAMP_GRAY |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 857 | |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 858 | #define TJ_BGR 1 |
| 859 | #define TJ_BOTTOMUP TJFLAG_BOTTOMUP |
| 860 | #define TJ_FORCEMMX TJFLAG_FORCEMMX |
| 861 | #define TJ_FORCESSE TJFLAG_FORCESSE |
| 862 | #define TJ_FORCESSE2 TJFLAG_FORCESSE2 |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 863 | #define TJ_ALPHAFIRST 64 |
DRC | 25b995a | 2011-05-21 15:34:54 +0000 | [diff] [blame] | 864 | #define TJ_FORCESSE3 TJFLAG_FORCESSE3 |
| 865 | #define TJ_FASTUPSAMPLE TJFLAG_FASTUPSAMPLE |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 866 | #define TJ_YUV 512 |
| 867 | |
DRC | 9b49f0e | 2011-07-12 03:17:23 +0000 | [diff] [blame] | 868 | DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height); |
| 869 | |
| 870 | DLLEXPORT unsigned long DLLCALL TJBUFSIZEYUV(int width, int height, |
| 871 | int jpegSubsamp); |
| 872 | |
DRC | 9b28def | 2011-05-21 14:37:15 +0000 | [diff] [blame] | 873 | DLLEXPORT int DLLCALL tjCompress(tjhandle handle, unsigned char *srcBuf, |
| 874 | int width, int pitch, int height, int pixelSize, unsigned char *dstBuf, |
| 875 | unsigned long *compressedSize, int jpegSubsamp, int jpegQual, int flags); |
| 876 | |
| 877 | DLLEXPORT int DLLCALL tjEncodeYUV(tjhandle handle, |
| 878 | unsigned char *srcBuf, int width, int pitch, int height, int pixelSize, |
| 879 | unsigned char *dstBuf, int subsamp, int flags); |
| 880 | |
| 881 | DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle handle, |
| 882 | unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height); |
| 883 | |
| 884 | DLLEXPORT int DLLCALL tjDecompress(tjhandle handle, |
| 885 | unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, |
| 886 | int width, int pitch, int height, int pixelSize, int flags); |
| 887 | |
| 888 | |
| 889 | /** |
| 890 | * @} |
| 891 | */ |
| 892 | |
DRC | 2e7b76b | 2009-04-03 12:04:24 +0000 | [diff] [blame] | 893 | #ifdef __cplusplus |
| 894 | } |
| 895 | #endif |
DRC | 3a1bb35 | 2011-05-24 09:15:44 +0000 | [diff] [blame] | 896 | |
| 897 | #endif |