| 1 |
|
| 2 |
#include "tiffiop.h" |
| 3 |
|
| 4 |
#if defined(HAVE_JPEGTURBO_DUAL_MODE_8_12) |
| 5 |
#define JPEG_DUAL_MODE_8_12 |
| 6 |
#endif |
| 7 |
|
| 8 |
#if defined(JPEG_DUAL_MODE_8_12) |
| 9 |
|
| 10 |
#define FROM_TIF_JPEG_12 |
| 11 |
|
| 12 |
#ifdef TIFFInitJPEG |
| 13 |
#undef TIFFInitJPEG |
| 14 |
#endif |
| 15 |
#define TIFFInitJPEG TIFFInitJPEG_12 |
| 16 |
|
| 17 |
#ifdef TIFFJPEGIsFullStripRequired |
| 18 |
#undef TIFFJPEGIsFullStripRequired |
| 19 |
#endif |
| 20 |
#define TIFFJPEGIsFullStripRequired TIFFJPEGIsFullStripRequired_12 |
| 21 |
|
| 22 |
int TIFFInitJPEG_12(TIFF *tif, int scheme); |
| 23 |
|
| 24 |
#if !defined(HAVE_JPEGTURBO_DUAL_MODE_8_12) |
| 25 |
#include LIBJPEG_12_PATH |
| 26 |
#endif |
| 27 |
|
| 28 |
#include "tif_jpeg.c" |
| 29 |
|
| 30 |
int TIFFReInitJPEG_12(TIFF *tif, const JPEGOtherSettings *otherSettings, |
| 31 |
int scheme, int is_encode) |
| 32 |
{ |
| 33 |
JPEGState *sp; |
| 34 |
uint8_t *new_tif_data; |
| 35 |
|
| 36 |
(void)scheme; |
| 37 |
assert(scheme == COMPRESSION_JPEG); |
| 38 |
|
| 39 |
new_tif_data = |
| 40 |
(uint8_t *)_TIFFreallocExt(tif, tif->tif_data, sizeof(JPEGState)); |
| 41 |
|
| 42 |
if (new_tif_data == NULL) |
| 43 |
{ |
| 44 |
TIFFErrorExtR(tif, "TIFFReInitJPEG_12", |
| 45 |
"No space for JPEG state block"); |
| 46 |
return 0; |
| 47 |
} |
| 48 |
|
| 49 |
tif->tif_data = new_tif_data; |
| 50 |
_TIFFmemset(tif->tif_data, 0, sizeof(JPEGState)); |
| 51 |
|
| 52 |
TIFFInitJPEGCommon(tif); |
| 53 |
|
| 54 |
sp = JState(tif); |
| 55 |
sp->otherSettings = *otherSettings; |
| 56 |
|
| 57 |
if (is_encode) |
| 58 |
return JPEGSetupEncode(tif); |
| 59 |
else |
| 60 |
return JPEGSetupDecode(tif); |
| 61 |
} |
| 62 |
|
| 63 |
#endif /* defined(JPEG_DUAL_MODE_8_12) */ |