2012-02-29 23:01:28 +08:00
|
|
|
|
|
|
|
#include "tiffiop.h"
|
|
|
|
|
2024-03-22 09:08:16 +08:00
|
|
|
#if defined(HAVE_JPEGTURBO_DUAL_MODE_8_12)
|
|
|
|
#define JPEG_DUAL_MODE_8_12
|
|
|
|
#endif
|
|
|
|
|
2012-02-29 23:01:28 +08:00
|
|
|
#if defined(JPEG_DUAL_MODE_8_12)
|
|
|
|
|
2024-03-22 09:08:16 +08:00
|
|
|
#define FROM_TIF_JPEG_12
|
|
|
|
|
|
|
|
#ifdef TIFFInitJPEG
|
|
|
|
#undef TIFFInitJPEG
|
|
|
|
#endif
|
|
|
|
#define TIFFInitJPEG TIFFInitJPEG_12
|
2017-12-08 20:47:54 +08:00
|
|
|
|
2024-03-22 09:08:16 +08:00
|
|
|
#ifdef TIFFJPEGIsFullStripRequired
|
|
|
|
#undef TIFFJPEGIsFullStripRequired
|
|
|
|
#endif
|
|
|
|
#define TIFFJPEGIsFullStripRequired TIFFJPEGIsFullStripRequired_12
|
2012-02-29 23:01:28 +08:00
|
|
|
|
2024-03-22 09:08:16 +08:00
|
|
|
int TIFFInitJPEG_12(TIFF *tif, int scheme);
|
2012-02-29 23:01:28 +08:00
|
|
|
|
2024-03-22 09:08:16 +08:00
|
|
|
#if !defined(HAVE_JPEGTURBO_DUAL_MODE_8_12)
|
|
|
|
#include LIBJPEG_12_PATH
|
|
|
|
#endif
|
2012-02-29 23:01:28 +08:00
|
|
|
|
2024-03-22 09:08:16 +08:00
|
|
|
#include "tif_jpeg.c"
|
2012-02-29 23:01:28 +08:00
|
|
|
|
2024-03-22 09:08:16 +08:00
|
|
|
int TIFFReInitJPEG_12(TIFF *tif, const JPEGOtherSettings *otherSettings,
|
|
|
|
int scheme, int is_encode)
|
2012-02-29 23:01:28 +08:00
|
|
|
{
|
2024-03-22 09:08:16 +08:00
|
|
|
JPEGState *sp;
|
|
|
|
uint8_t *new_tif_data;
|
2012-02-29 23:01:28 +08:00
|
|
|
|
2024-03-22 09:08:16 +08:00
|
|
|
(void)scheme;
|
2012-02-29 23:01:28 +08:00
|
|
|
assert(scheme == COMPRESSION_JPEG);
|
|
|
|
|
2024-03-22 09:08:16 +08:00
|
|
|
new_tif_data =
|
|
|
|
(uint8_t *)_TIFFreallocExt(tif, tif->tif_data, sizeof(JPEGState));
|
|
|
|
|
|
|
|
if (new_tif_data == NULL)
|
|
|
|
{
|
|
|
|
TIFFErrorExtR(tif, "TIFFReInitJPEG_12",
|
|
|
|
"No space for JPEG state block");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
tif->tif_data = new_tif_data;
|
|
|
|
_TIFFmemset(tif->tif_data, 0, sizeof(JPEGState));
|
|
|
|
|
|
|
|
TIFFInitJPEGCommon(tif);
|
|
|
|
|
2012-02-29 23:01:28 +08:00
|
|
|
sp = JState(tif);
|
2024-03-22 09:08:16 +08:00
|
|
|
sp->otherSettings = *otherSettings;
|
|
|
|
|
|
|
|
if (is_encode)
|
2012-02-29 23:01:28 +08:00
|
|
|
return JPEGSetupEncode(tif);
|
|
|
|
else
|
|
|
|
return JPEGSetupDecode(tif);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* defined(JPEG_DUAL_MODE_8_12) */
|