OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C)2009-2011 D. R. Commander. All Rights Reserved. | 2 * Copyright (C)2009-2011 D. R. Commander. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
6 * | 6 * |
7 * - Redistributions of source code must retain the above copyright notice, | 7 * - Redistributions of source code must retain the above copyright notice, |
8 * this list of conditions and the following disclaimer. | 8 * this list of conditions and the following disclaimer. |
9 * - Redistributions in binary form must reproduce the above copyright notice, | 9 * - Redistributions in binary form must reproduce the above copyright notice, |
10 * this list of conditions and the following disclaimer in the documentation | 10 * this list of conditions and the following disclaimer in the documentation |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 /** | 308 /** |
309 * This option will enable lossless cropping. See #tjTransform() for more | 309 * This option will enable lossless cropping. See #tjTransform() for more |
310 * information. | 310 * information. |
311 */ | 311 */ |
312 #define TJXOPT_CROP 4 | 312 #define TJXOPT_CROP 4 |
313 /** | 313 /** |
314 * This option will discard the color data in the input image and produce | 314 * This option will discard the color data in the input image and produce |
315 * a grayscale output image. | 315 * a grayscale output image. |
316 */ | 316 */ |
317 #define TJXOPT_GRAY 8 | 317 #define TJXOPT_GRAY 8 |
| 318 /** |
| 319 * This option will prevent #tjTransform() from outputting a JPEG image for |
| 320 * this particular transform (this can be used in conjunction with a custom |
| 321 * filter to capture the transformed DCT coefficients without transcoding |
| 322 * them.) |
| 323 */ |
| 324 #define TJXOPT_NOOUTPUT 16 |
318 | 325 |
319 | 326 |
320 /** | 327 /** |
321 * Scaling factor | 328 * Scaling factor |
322 */ | 329 */ |
323 typedef struct | 330 typedef struct |
324 { | 331 { |
325 /** | 332 /** |
326 * Numerator | 333 * Numerator |
327 */ | 334 */ |
(...skipping 27 matching lines...) Expand all Loading... |
355 /** | 362 /** |
356 * The height of the cropping region. Setting this to 0 is the equivalent of | 363 * The height of the cropping region. Setting this to 0 is the equivalent of |
357 * setting it to the height of the source JPEG image - y. | 364 * setting it to the height of the source JPEG image - y. |
358 */ | 365 */ |
359 int h; | 366 int h; |
360 } tjregion; | 367 } tjregion; |
361 | 368 |
362 /** | 369 /** |
363 * Lossless transform | 370 * Lossless transform |
364 */ | 371 */ |
365 typedef struct | 372 typedef struct tjtransform |
366 { | 373 { |
367 /** | 374 /** |
368 * Cropping region | 375 * Cropping region |
369 */ | 376 */ |
370 tjregion r; | 377 tjregion r; |
371 /** | 378 /** |
372 * One of the @ref TJXOP "transform operations" | 379 * One of the @ref TJXOP "transform operations" |
373 */ | 380 */ |
374 int op; | 381 int op; |
375 /** | 382 /** |
376 * The bitwise OR of one of more of the @ref TJXOPT_CROP "transform options" | 383 * The bitwise OR of one of more of the @ref TJXOPT_CROP "transform options" |
377 */ | 384 */ |
378 int options; | 385 int options; |
| 386 /** |
| 387 * Arbitrary data that can be accessed within the body of the callback |
| 388 * function |
| 389 */ |
| 390 void *data; |
| 391 /** |
| 392 * A callback function that can be used to modify the DCT coefficients |
| 393 * after they are losslessly transformed but before they are transcoded to a |
| 394 * new JPEG file. This allows for custom filters or other transformations to |
| 395 * be applied in the frequency domain. |
| 396 * |
| 397 * @param coeffs pointer to an array of transformed DCT coefficients. (NOTE: |
| 398 * this pointer is not guaranteed to be valid once the callback |
| 399 * returns, so applications wishing to hand off the DCT coefficients |
| 400 * to another function or library should make a copy of them within |
| 401 * the body of the callback.) |
| 402 * @param arrayRegion #tjregion structure containing the width and height of |
| 403 * the array pointed to by <tt>coeffs</tt> as well as its offset |
| 404 * relative to the component plane. TurboJPEG implementations may |
| 405 * choose to split each component plane into multiple DCT coefficient |
| 406 * arrays and call the callback function once for each array. |
| 407 * @param planeRegion #tjregion structure containing the width and height of |
| 408 * the component plane to which <tt>coeffs</tt> belongs |
| 409 * @param componentID ID number of the component plane to which |
| 410 * <tt>coeffs</tt> belongs (Y, Cb, and Cr have, respectively, ID's of |
| 411 * 0, 1, and 2 in typical JPEG images.) |
| 412 * @param transformID ID number of the transformed image to which |
| 413 * <tt>coeffs</tt> belongs. This is the same as the index of the |
| 414 * transform in the transforms array that was passed to |
| 415 * #tjTransform(). |
| 416 * @param transform a pointer to a #tjtransform structure that specifies the |
| 417 * parameters and/or cropping region for this transform |
| 418 * |
| 419 * @return 0 if the callback was successful, or -1 if an error occurred. |
| 420 */ |
| 421 int (*customFilter)(short *coeffs, tjregion arrayRegion, |
| 422 tjregion planeRegion, int componentIndex, int transformIndex, |
| 423 struct tjtransform *transform); |
379 } tjtransform; | 424 } tjtransform; |
380 | 425 |
381 /** | 426 /** |
382 * TurboJPEG instance handle | 427 * TurboJPEG instance handle |
383 */ | 428 */ |
384 typedef void* tjhandle; | 429 typedef void* tjhandle; |
385 | 430 |
386 | 431 |
387 /** | 432 /** |
388 * Pad the given width to the nearest 32-bit boundary | 433 * Pad the given width to the nearest 32-bit boundary |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 | 860 |
816 /** | 861 /** |
817 * @} | 862 * @} |
818 */ | 863 */ |
819 | 864 |
820 #ifdef __cplusplus | 865 #ifdef __cplusplus |
821 } | 866 } |
822 #endif | 867 #endif |
823 | 868 |
824 #endif | 869 #endif |
OLD | NEW |