LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
tif_jpeg_12.c
Go to the documentation of this file.
1
8#include "tiffiop.h"
9
10#if defined(HAVE_JPEGTURBO_DUAL_MODE_8_12)
18#define JPEG_DUAL_MODE_8_12
19#endif
20
21#if defined(JPEG_DUAL_MODE_8_12)
22
30#define FROM_TIF_JPEG_12
31
32#ifdef TIFFInitJPEG
33#undef TIFFInitJPEG
34#endif
42#define TIFFInitJPEG TIFFInitJPEG_12
43
44#ifdef TIFFJPEGIsFullStripRequired
45#undef TIFFJPEGIsFullStripRequired
46#endif
54#define TIFFJPEGIsFullStripRequired TIFFJPEGIsFullStripRequired_12
55
73int TIFFInitJPEG_12(TIFF *tif, int scheme);
74
75#if !defined(HAVE_JPEGTURBO_DUAL_MODE_8_12)
76#include LIBJPEG_12_PATH
77#endif
78
79#include "tif_jpeg.c"
80
81int TIFFReInitJPEG_12(TIFF *tif, const JPEGOtherSettings *otherSettings,
82 int scheme, int is_encode)
83{
84 JPEGState *sp;
85 uint8_t *new_tif_data;
86
87 (void)scheme;
88 assert(scheme == COMPRESSION_JPEG);
89
90 new_tif_data =
91 (uint8_t *)_TIFFreallocExt(tif, tif->tif_data, sizeof(JPEGState));
92
93 if (new_tif_data == NULL)
94 {
95 TIFFErrorExtR(tif, "TIFFReInitJPEG_12",
96 "No space for JPEG state block");
97 return 0;
98 }
99
100 tif->tif_data = new_tif_data;
101 _TIFFmemset(tif->tif_data, 0, sizeof(JPEGState));
102
104
105 sp = JState(tif);
106 sp->otherSettings = *otherSettings;
107
108 if (is_encode)
109 return JPEGSetupEncode(tif);
110 else
111 return JPEGSetupDecode(tif);
112}
113
114#endif /* defined(JPEG_DUAL_MODE_8_12) */
#define JState(tif)
Borrow the handle-owned JPEG state.
Definition tif_jpeg.c:519
int TIFFReInitJPEG_12(TIFF *tif, const JPEGOtherSettings *otherSettings, int scheme, int is_encode)
Replace JPEG state with the twelve-bit ABI and restore saved options.
static int JPEGSetupEncode(TIFF *tif)
Initialise JPEG compression parameters tables and output manager.
Definition tif_jpeg.c:3508
static int JPEGSetupDecode(TIFF *tif)
Initialise JPEG decompression tables sampling and source managers.
Definition tif_jpeg.c:2346
static void TIFFInitJPEGCommon(TIFF *tif)
Install common JPEG callbacks defaults and handle backlink.
Definition tif_jpeg.c:4680
void * _TIFFreallocExt(TIFF *tif, void *p, tmsize_t s)
Resize a handle-aware block or release it for a nonpositive size.
Definition tif_open.c:257
void TIFFErrorExtR(TIFF *tif, const char *module, const char *fmt,...)
Dispatch a error diagnostic to the configured handlers.
Definition tif_error.c:112
void _TIFFmemset(void *p, int v, tmsize_t c)
Fill a byte range with one repeated byte.
Definition tif_unix.c:495
#define COMPRESSION_JPEG
JPEG DCT compression (introduced after TIFF 6.0).
Definition tiff.h:318
Preserve ABI-independent JPEG options and saved parent hooks.
Definition tif_jpeg.c:61
Own the leading libjpeg ABI context managers and TIFF transfer state.
Definition tif_jpeg.c:434
JPEGOtherSettings otherSettings
Owned settings/table pointers and borrowed parent hooks retained across ABI reinitialisation.
Definition tif_jpeg.c:501
Hold private state for one open TIFF library instance.
Definition tiffiop.h:389
uint8_t * tif_data
Codec-private storage; allocation and cleanup follow the selected codec.
Definition tiffiop.h:675
Bridge libjpeg error frames managers and JPEG-in-TIFF transfers.
Declare private library state, callbacks, and implementation helpers.