|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
The decode-only old-style JPEG codec reconstructs a single dependency stream. More...
Data Structures | |
| struct | OJPEGState |
| Own old-style JPEG reconstruction tables buffers and dependency sessions. More... | |
Macros | |
| #define | SETJMP(jbuf) setjmp(jbuf) |
| Save the calling environment for a later LONGJMP (plain setjmp). | |
| #define | LONGJMP(jbuf, code) longjmp(jbuf, code) |
| Jump back to the frame saved by SETJMP (plain longjmp); never returns. | |
| #define | JMP_BUF jmp_buf |
| Type used to store the libjpeg error jump frame. | |
| #define | OJPEG_BUFFER 2048 |
| Capacity in bytes of the embedded input and synthetic marker buffers. | |
| #define | JPEG_MARKER_SOF0 0xC0 |
| JPEG SOF0 (baseline DCT start-of-frame) marker code. | |
| #define | JPEG_MARKER_SOF1 0xC1 |
| JPEG SOF1 (extended sequential DCT start-of-frame) marker code. | |
| #define | JPEG_MARKER_SOF3 0xC3 |
| JPEG SOF3 (lossless start-of-frame) marker code. | |
| #define | JPEG_MARKER_DHT 0xC4 |
| JPEG DHT (define Huffman table) marker code. | |
| #define | JPEG_MARKER_RST0 0XD0 |
| JPEG RST0 (restart) marker code. | |
| #define | JPEG_MARKER_SOI 0xD8 |
| JPEG SOI (start of image) marker code. | |
| #define | JPEG_MARKER_EOI 0xD9 |
| JPEG EOI (end of image) marker code. | |
| #define | JPEG_MARKER_SOS 0xDA |
| JPEG SOS (start of scan) marker code. | |
| #define | JPEG_MARKER_DQT 0xDB |
| JPEG DQT (define quantization table) marker code. | |
| #define | JPEG_MARKER_DRI 0xDD |
| JPEG DRI (define restart interval) marker code. | |
| #define | JPEG_MARKER_APP0 0xE0 |
| JPEG APP0 marker code; APP0..APP15 are this value plus 0..15. | |
| #define | JPEG_MARKER_COM 0xFE |
| JPEG COM (comment) marker code. | |
| #define | FIELD_OJPEG_JPEGINTERCHANGEFORMAT (FIELD_CODEC + 0) |
| TIFFField field bit for the codec-private JpegInterchangeFormat tag. | |
| #define | FIELD_OJPEG_JPEGINTERCHANGEFORMATLENGTH (FIELD_CODEC + 1) |
| TIFFField field bit for the codec-private JpegInterchangeFormatLength tag. | |
| #define | FIELD_OJPEG_JPEGQTABLES (FIELD_CODEC + 2) |
| TIFFField field bit for the codec-private JpegQTables tag. | |
| #define | FIELD_OJPEG_JPEGDCTABLES (FIELD_CODEC + 3) |
| TIFFField field bit for the codec-private JpegDcTables tag. | |
| #define | FIELD_OJPEG_JPEGACTABLES (FIELD_CODEC + 4) |
| TIFFField field bit for the codec-private JpegAcTables tag. | |
| #define | FIELD_OJPEG_JPEGPROC (FIELD_CODEC + 5) |
| TIFFField field bit for the codec-private JpegProc tag. | |
| #define | FIELD_OJPEG_JPEGRESTARTINTERVAL (FIELD_CODEC + 6) |
| TIFFField field bit for the codec-private JpegRestartInterval tag. | |
Typedefs | |
| typedef struct jpeg_source_mgr | tiff_ojpeg_source_mgr |
| Alias for the libjpeg source-manager structure. | |
| typedef struct jpeg_error_mgr | tiff_ojpeg_error_mgr |
| Alias for the libjpeg error-manager structure. | |
| typedef struct jpeg_common_struct | tiff_ojpeg_common_struct |
| Alias for the libjpeg common context structure. | |
| typedef struct jpeg_decompress_struct | tiff_ojpeg_decompress_struct |
| Alias for the libjpeg decompressor context structure. | |
Enumerations | |
| enum | OJPEGStateInBufferSource { osibsNotSetYet , osibsJpegInterchangeFormat , osibsStrile , osibsEof } |
| Source of the bytes currently read into the input buffer. More... | |
| enum | OJPEGStateOutState { ososSoi , ososQTable0 , ososQTable1 , ososQTable2 , ososQTable3 , ososDcTable0 , ososDcTable1 , ososDcTable2 , ososDcTable3 , ososAcTable0 , ososAcTable1 , ososAcTable2 , ososAcTable3 , ososDri , ososSof , ososSos , ososCompressed , ososRst , ososEoi } |
| Next item to emit in the reconstructed JPEG stream. More... | |
Functions | |
| static int | jpeg_create_decompress_encap (OJPEGState *sp, tiff_ojpeg_decompress_struct *cinfo) |
| Trap dependency fatal errors while attempting to create a decompressor. | |
| static int | jpeg_read_header_encap (OJPEGState *sp, tiff_ojpeg_decompress_struct *cinfo, uint8_t require_image) |
| Trap dependency fatal errors while attempting to read a JPEG header. | |
| static int | jpeg_start_decompress_encap (OJPEGState *sp, tiff_ojpeg_decompress_struct *cinfo) |
| Trap dependency fatal errors while attempting to start decompression. | |
| static int | jpeg_read_scanlines_encap (OJPEGState *sp, tiff_ojpeg_decompress_struct *cinfo, void *scanlines, uint32_t max_lines) |
| Trap dependency fatal errors while attempting to read scanlines. | |
| static int | jpeg_read_raw_data_encap (OJPEGState *sp, tiff_ojpeg_decompress_struct *cinfo, void *data, uint32_t max_lines) |
| Trap dependency fatal errors while attempting to read component planes. | |
| static void | jpeg_encap_unwind (TIFF *tif) |
| Jump to the active old-style JPEG dependency wrapper. | |
| static int | OJPEGVGetField (TIFF *tif, uint32_t tag, va_list ap) |
| Retrieve old-style JPEG metadata or delegate to the parent getter. | |
| static int | OJPEGVSetField (TIFF *tif, uint32_t tag, va_list ap) |
| Cache old-style JPEG tag values or delegate to the parent setter. | |
| static void | OJPEGPrintDir (TIFF *tif, FILE *fd, long flags) |
| Print cached old-style JPEG fields before the optional parent printer. | |
| static int | OJPEGFixupTags (TIFF *tif) |
| Accept the old-style JPEG directory without eager fixups. | |
| static int | OJPEGSetupDecode (TIFF *tif) |
| Warn that old-style JPEG compression is deprecated. | |
| static int | OJPEGPreDecode (TIFF *tif, uint16_t s) |
| Position a reconstructed JPEG session at the requested strile and plane. | |
| static int | OJPEGPreDecodeSkipRaw (TIFF *tif) |
| Decode and discard one strile in raw mode. | |
| static int | OJPEGPreDecodeSkipScanlines (TIFF *tif) |
| Decode and discard one strile in scanlines mode. | |
| static int | OJPEGDecode (TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s) |
| Decode complete output rows from the active old-style JPEG session. | |
| static int | OJPEGDecodeRaw (TIFF *tif, uint8_t *buf, tmsize_t cc) |
| Decode complete subsampled clump rows. | |
| static int | OJPEGDecodeScanlines (TIFF *tif, uint8_t *buf, tmsize_t cc) |
| Decode complete ordinary sample rows. | |
| static void | OJPEGPostDecode (TIFF *tif, uint8_t *buf, tmsize_t cc) |
| Advance the cached strile count and end a completed plane session. | |
| static int | OJPEGSetupEncode (TIFF *tif) |
| Reject unsupported old-style JPEG encoding. | |
| static int | OJPEGPreEncode (TIFF *tif, uint16_t s) |
| Reject unsupported old-style JPEG encoding. | |
| static int | OJPEGEncode (TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s) |
| Reject unsupported old-style JPEG encoding. | |
| static int | OJPEGPostEncode (TIFF *tif) |
| Reject unsupported old-style JPEG encoding. | |
| static void | OJPEGCleanup (TIFF *tif) |
| Release old-style JPEG state and restore parent methods. | |
| static void | OJPEGSubsamplingCorrect (TIFF *tif) |
| Probe and reconcile old-style JPEG subsampling once. | |
| static int | OJPEGReadHeaderInfo (TIFF *tif) |
| Validate geometry and cache the first old-style JPEG scan position. | |
| static int | OJPEGReadSecondarySos (TIFF *tif, uint16_t s) |
| Locate and cache a later separate-plane scan header. | |
| static int | OJPEGWriteHeaderInfo (TIFF *tif) |
| Start libjpeg with a synthesized old-style JPEG input header. | |
| static void | OJPEGLibjpegSessionAbort (TIFF *tif) |
| Destroy the active old-style JPEG dependency session. | |
| static int | OJPEGReadHeaderInfoSec (TIFF *tif) |
| Parse a bounded interchange/strile JPEG header or synthesize it from tags. | |
| static int | OJPEGReadHeaderInfoSecStreamDri (TIFF *tif) |
| Parse and cache a JPEG restart interval. | |
| static int | OJPEGReadHeaderInfoSecStreamDqt (TIFF *tif) |
| Capture eight-bit JPEG quantisation table markers. | |
| static int | OJPEGReadHeaderInfoSecStreamDht (TIFF *tif) |
| Capture a JPEG Huffman marker in its selected table slot. | |
| static int | OJPEGReadHeaderInfoSecStreamSof (TIFF *tif, uint8_t marker_id) |
| Validate a JPEG frame and cache its component selectors. | |
| static int | OJPEGReadHeaderInfoSecStreamSos (TIFF *tif) |
| Validate and cache a JPEG scan component header. | |
| static int | OJPEGReadHeaderInfoSecTablesQTable (TIFF *tif) |
| Build quantisation markers from TIFF table-offset tags. | |
| static int | OJPEGReadHeaderInfoSecTablesDcTable (TIFF *tif) |
| Build DC Huffman markers from TIFF table-offset tags. | |
| static int | OJPEGReadHeaderInfoSecTablesAcTable (TIFF *tif) |
| Build AC Huffman markers from TIFF table-offset tags. | |
| static int | OJPEGReadBufferFill (OJPEGState *sp) |
| Refill the old-style JPEG input window across interchange and strile extents. | |
| static int | OJPEGReadByte (OJPEGState *sp, uint8_t *byte) |
| Consume one buffered byte. | |
| static int | OJPEGReadBytePeek (OJPEGState *sp, uint8_t *byte) |
| Peek at the next buffered byte. | |
| static void | OJPEGReadByteAdvance (OJPEGState *sp) |
| Consume one already buffered byte. | |
| static int | OJPEGReadWord (OJPEGState *sp, uint16_t *word) |
| Consume a big-endian sixteen-bit word. | |
| static int | OJPEGReadBlock (OJPEGState *sp, uint16_t len, void *mem) |
| Copy a positive byte block from the input stream. | |
| static void | OJPEGReadSkip (OJPEGState *sp, uint16_t len) |
| Skip up to a bounded input extent without fetching skipped bytes. | |
| static int | OJPEGWriteStream (TIFF *tif, void **mem, uint32_t *len) |
| Produce the next borrowed chunk of reconstructed decoder input. | |
| static void | OJPEGWriteStreamSoi (TIFF *tif, void **mem, uint32_t *len) |
| Produce a Soi reconstruction chunk. | |
| static void | OJPEGWriteStreamQTable (TIFF *tif, uint8_t table_index, void **mem, uint32_t *len) |
| Produce a QTable reconstruction chunk. | |
| static void | OJPEGWriteStreamDcTable (TIFF *tif, uint8_t table_index, void **mem, uint32_t *len) |
| Produce a DcTable reconstruction chunk. | |
| static void | OJPEGWriteStreamAcTable (TIFF *tif, uint8_t table_index, void **mem, uint32_t *len) |
| Produce a AcTable reconstruction chunk. | |
| static void | OJPEGWriteStreamDri (TIFF *tif, void **mem, uint32_t *len) |
| Produce a Dri reconstruction chunk. | |
| static void | OJPEGWriteStreamSof (TIFF *tif, void **mem, uint32_t *len) |
| Produce a Sof reconstruction chunk. | |
| static void | OJPEGWriteStreamSos (TIFF *tif, void **mem, uint32_t *len) |
| Produce a Sos reconstruction chunk. | |
| static int | OJPEGWriteStreamCompressed (TIFF *tif, void **mem, uint32_t *len) |
| Produce a Compressed reconstruction chunk. | |
| static void | OJPEGWriteStreamRst (TIFF *tif, void **mem, uint32_t *len) |
| Produce a Rst reconstruction chunk. | |
| static void | OJPEGWriteStreamEoi (TIFF *tif, void **mem, uint32_t *len) |
| Produce a Eoi reconstruction chunk. | |
| static void | OJPEGLibjpegJpegErrorMgrOutputMessage (tiff_ojpeg_common_struct *cinfo) |
| Route a dependency message through the handle warning handler. | |
| static void | OJPEGLibjpegJpegErrorMgrErrorExit (tiff_ojpeg_common_struct *cinfo) |
| Report a fatal dependency error and unwind the active wrapper. | |
| static void | OJPEGLibjpegJpegSourceMgrInitSource (tiff_ojpeg_decompress_struct *cinfo) |
| Accept the dependency source initialization. | |
| static boolean | OJPEGLibjpegJpegSourceMgrFillInputBuffer (tiff_ojpeg_decompress_struct *cinfo) |
| Supply the next reconstructed JPEG chunk to libjpeg. | |
| static void | OJPEGLibjpegJpegSourceMgrSkipInputData (tiff_ojpeg_decompress_struct *cinfo, long num_bytes) |
| Reject an unexpected dependency skip request. | |
| static boolean | OJPEGLibjpegJpegSourceMgrResyncToRestart (tiff_ojpeg_decompress_struct *cinfo, int desired) |
| Reject an unexpected dependency restart resynchronization request. | |
| static void | OJPEGLibjpegJpegSourceMgrTermSource (tiff_ojpeg_decompress_struct *cinfo) |
| Accept the dependency source termination. | |
| int | TIFFInitOJPEG (TIFF *tif, int scheme) |
| Install the decode-only old-style JPEG codec. | |
Variables | |
| static const TIFFField | ojpegFields [] |
| Describe legacy JPEG tags merged into the handle. | |
The decode-only old-style JPEG codec reconstructs a single dependency stream.
| #define FIELD_OJPEG_JPEGACTABLES (FIELD_CODEC + 4) |
TIFFField field bit for the codec-private JpegAcTables tag.
Set by OJPEGVSetField when the tag is stored; tested with TIFFFieldSet by OJPEGPrintDir.
Definition at line 343 of file tif_ojpeg.c.
| #define FIELD_OJPEG_JPEGDCTABLES (FIELD_CODEC + 3) |
TIFFField field bit for the codec-private JpegDcTables tag.
Set by OJPEGVSetField when the tag is stored; tested with TIFFFieldSet by OJPEGPrintDir.
Definition at line 335 of file tif_ojpeg.c.
| #define FIELD_OJPEG_JPEGINTERCHANGEFORMAT (FIELD_CODEC + 0) |
TIFFField field bit for the codec-private JpegInterchangeFormat tag.
Set by OJPEGVSetField when the tag is stored; tested with TIFFFieldSet by OJPEGPrintDir.
Definition at line 310 of file tif_ojpeg.c.
| #define FIELD_OJPEG_JPEGINTERCHANGEFORMATLENGTH (FIELD_CODEC + 1) |
TIFFField field bit for the codec-private JpegInterchangeFormatLength tag.
Set by OJPEGVSetField when the tag is stored; tested with TIFFFieldSet by OJPEGPrintDir.
Definition at line 319 of file tif_ojpeg.c.
| #define FIELD_OJPEG_JPEGPROC (FIELD_CODEC + 5) |
TIFFField field bit for the codec-private JpegProc tag.
Set by OJPEGVSetField when the tag is stored; tested with TIFFFieldSet by OJPEGPrintDir.
Definition at line 351 of file tif_ojpeg.c.
| #define FIELD_OJPEG_JPEGQTABLES (FIELD_CODEC + 2) |
TIFFField field bit for the codec-private JpegQTables tag.
Set by OJPEGVSetField when the tag is stored; tested with TIFFFieldSet by OJPEGPrintDir.
Definition at line 327 of file tif_ojpeg.c.
| #define FIELD_OJPEG_JPEGRESTARTINTERVAL (FIELD_CODEC + 6) |
TIFFField field bit for the codec-private JpegRestartInterval tag.
Set by OJPEGVSetField when the tag is stored; tested with TIFFFieldSet by OJPEGPrintDir.
Definition at line 359 of file tif_ojpeg.c.
| #define JMP_BUF jmp_buf |
Type used to store the libjpeg error jump frame.
Expands to jmp_buf; used for OJPEGState::exit_jmpbuf, which SETJMP fills and LONGJMP unwinds to. Not used when LIBJPEG_ENCAP_EXTERNAL is defined.
Definition at line 192 of file tif_ojpeg.c.
| #define JPEG_MARKER_APP0 0xE0 |
JPEG APP0 marker code; APP0..APP15 are this value plus 0..15.
Marker code byte following 0xFF. Application segments are skipped when parsing.
Definition at line 293 of file tif_ojpeg.c.
| #define JPEG_MARKER_COM 0xFE |
JPEG COM (comment) marker code.
Marker code byte following 0xFF. Comment segments are skipped when parsing.
Definition at line 301 of file tif_ojpeg.c.
| #define JPEG_MARKER_DHT 0xC4 |
JPEG DHT (define Huffman table) marker code.
Marker code byte following 0xFF; parsed from the stream and used as the marker of the stored Huffman tables, whether taken from the stream or from the JpegDcTables/JpegAcTables tags.
Definition at line 237 of file tif_ojpeg.c.
| #define JPEG_MARKER_DQT 0xDB |
JPEG DQT (define quantization table) marker code.
Marker code byte following 0xFF; parsed from the stream and used as the marker of the stored quantization tables, whether taken from the stream or from the JpegQTables tag.
Definition at line 277 of file tif_ojpeg.c.
| #define JPEG_MARKER_DRI 0xDD |
JPEG DRI (define restart interval) marker code.
Marker code byte following 0xFF; parsed from the stream and written by OJPEGWriteStreamDri.
Definition at line 285 of file tif_ojpeg.c.
| #define JPEG_MARKER_EOI 0xD9 |
JPEG EOI (end of image) marker code.
Marker code byte following 0xFF; written by OJPEGWriteStreamEoi.
Definition at line 260 of file tif_ojpeg.c.
| #define JPEG_MARKER_RST0 0XD0 |
JPEG RST0 (restart) marker code.
Marker code byte following 0xFF. RST0..RST7 are written as JPEG_MARKER_RST0 + restart_index by OJPEGWriteStreamRst.
Definition at line 245 of file tif_ojpeg.c.
| #define JPEG_MARKER_SOF0 0xC0 |
JPEG SOF0 (baseline DCT start-of-frame) marker code.
Marker code byte following 0xFF. Parsed by OJPEGReadHeaderInfoSecStreamSof and used as the SOF marker of the synthetic stream when the stream has no SOF marker.
Definition at line 212 of file tif_ojpeg.c.
| #define JPEG_MARKER_SOF1 0xC1 |
JPEG SOF1 (extended sequential DCT start-of-frame) marker code.
Marker code byte following 0xFF; parsed by OJPEGReadHeaderInfoSecStreamSof.
Definition at line 220 of file tif_ojpeg.c.
| #define JPEG_MARKER_SOF3 0xC3 |
JPEG SOF3 (lossless start-of-frame) marker code.
Marker code byte following 0xFF; passed to OJPEGReadHeaderInfoSecStreamSof.
Definition at line 228 of file tif_ojpeg.c.
| #define JPEG_MARKER_SOI 0xD8 |
JPEG SOI (start of image) marker code.
Marker code byte following 0xFF; skipped when parsing and written by OJPEGWriteStreamSoi.
Definition at line 253 of file tif_ojpeg.c.
| #define JPEG_MARKER_SOS 0xDA |
JPEG SOS (start of scan) marker code.
Marker code byte following 0xFF. Ends header parsing and is written by OJPEGWriteStreamSos.
Definition at line 268 of file tif_ojpeg.c.
| #define LONGJMP | ( | jbuf, | |
| code | |||
| ) | longjmp(jbuf, code) |
Jump back to the frame saved by SETJMP (plain longjmp); never returns.
Expands to longjmp(jbuf, code). Used only by jpeg_encap_unwind(), with sp->exit_jmpbuf and code 1; control resumes in the jpeg_*_encap wrapper that filled the buffer, which then returns 0. The behaviour is undefined if that wrapper has already returned.
| [in] | jbuf | JMP_BUF filled by a still-active SETJMP. |
| [in] | code | Value SETJMP returns after the jump (0 is turned into 1 by longjmp). |
Definition at line 184 of file tif_ojpeg.c.
| #define OJPEG_BUFFER 2048 |
Capacity in bytes of the embedded input and synthetic marker buffers.
Sizes OJPEGState::in_buffer and OJPEGState::out_buffer. Must be at most 65535 because buffer counters are uint16_t, and at least as large as the largest synthetic marker (checked by asserts in the OJPEGWrite* routines).
Definition at line 201 of file tif_ojpeg.c.
| #define SETJMP | ( | jbuf | ) | setjmp(jbuf) |
Save the calling environment for a later LONGJMP (plain setjmp).
Expands to setjmp(jbuf), evaluating jbuf once. Used as the controlling expression of an if in each jpeg_*_encap wrapper on sp->exit_jmpbuf; the saved frame is valid only until that wrapper returns.
| [out] | jbuf | JMP_BUF lvalue that receives the saved environment. |
Definition at line 169 of file tif_ojpeg.c.
| typedef struct jpeg_common_struct tiff_ojpeg_common_struct |
Alias for the libjpeg common context structure.
Parameter type of the error-manager callbacks; its client_data points to the owning TIFF handle.
Definition at line 422 of file tif_ojpeg.c.
| typedef struct jpeg_decompress_struct tiff_ojpeg_decompress_struct |
Alias for the libjpeg decompressor context structure.
Embedded in OJPEGState as libjpeg_jpeg_decompress_struct; the libjpeg session it holds is destroyed by OJPEGLibjpegSessionAbort.
Definition at line 430 of file tif_ojpeg.c.
| typedef struct jpeg_error_mgr tiff_ojpeg_error_mgr |
Alias for the libjpeg error-manager structure.
Embedded in OJPEGState as libjpeg_jpeg_error_mgr.
Definition at line 413 of file tif_ojpeg.c.
| typedef struct jpeg_source_mgr tiff_ojpeg_source_mgr |
Alias for the libjpeg source-manager structure.
Embedded in OJPEGState as libjpeg_jpeg_source_mgr; its callbacks feed libjpeg the reconstructed stream produced by OJPEGWriteStream.
Definition at line 405 of file tif_ojpeg.c.
Source of the bytes currently read into the input buffer.
Stored in OJPEGState::in_buffer_source and advanced by OJPEGReadBufferFill from the interchange-format extent to the striles.
Definition at line 439 of file tif_ojpeg.c.
| enum OJPEGStateOutState |
Next item to emit in the reconstructed JPEG stream.
Stored in OJPEGState::out_state. OJPEGWriteStream emits items in declaration order, skipping absent tables.
Definition at line 458 of file tif_ojpeg.c.
|
static |
Trap dependency fatal errors while attempting to create a decompressor.
Requires cinfo->err and cinfo->client_data to be set; libjpeg clears the rest of the context, so the source manager is installed after this call succeeds. Sets sp->exit_jmpbuf with SETJMP and calls jpeg_create_decompress(); a libjpeg fatal error returns here through jpeg_encap_unwind. Any state libjpeg allocated before the error remains in cinfo.
| [in,out] | sp | Codec state whose exit_jmpbuf holds the jump frame. |
| [in,out] | cinfo | libjpeg decompressor context, normally sp->libjpeg_jpeg_decompress_struct. |
Definition at line 4047 of file tif_ojpeg.c.
References OJPEGState::exit_jmpbuf, and SETJMP.
Referenced by OJPEGWriteHeaderInfo().
|
static |
Jump to the active old-style JPEG dependency wrapper.
Requires a live synchronous encapsulation jump frame for this handle on the same thread. Performs a nonlocal return; never returns normally, frees no state and supplies no additional diagnostic. An external encapsulation build must provide the corresponding implementation.
| [in] | tif | Handle whose codec state identifies the active wrapper frame. |
Definition at line 4120 of file tif_ojpeg.c.
References OJPEGState::exit_jmpbuf, LONGJMP, and tiff::tif_data.
Referenced by OJPEGLibjpegJpegErrorMgrErrorExit(), OJPEGLibjpegJpegSourceMgrFillInputBuffer(), OJPEGLibjpegJpegSourceMgrResyncToRestart(), and OJPEGLibjpegJpegSourceMgrSkipInputData().
|
static |
Trap dependency fatal errors while attempting to read a JPEG header.
Requires a context created by jpeg_create_decompress_encap with the source manager installed. Sets sp->exit_jmpbuf with SETJMP and calls jpeg_read_header(); a libjpeg fatal error returns here through jpeg_encap_unwind. The libjpeg return value is discarded. State libjpeg changed before an error remains in cinfo.
| [in,out] | sp | Codec state whose exit_jmpbuf holds the jump frame. |
| [in,out] | cinfo | libjpeg decompressor context, normally sp->libjpeg_jpeg_decompress_struct. |
| [in] | require_image | Nonzero requires an image header rather than tables only. |
Definition at line 4061 of file tif_ojpeg.c.
References OJPEGState::exit_jmpbuf, and SETJMP.
Referenced by OJPEGWriteHeaderInfo().
|
static |
Trap dependency fatal errors while attempting to read component planes.
Requires a context created by jpeg_create_decompress_encap with the source manager installed. Sets sp->exit_jmpbuf with SETJMP and calls jpeg_read_raw_data(); a libjpeg fatal error returns here through jpeg_encap_unwind. The libjpeg return value is discarded. State libjpeg changed before an error remains in cinfo.
| [in,out] | sp | Codec state whose exit_jmpbuf holds the jump frame. |
| [in,out] | cinfo | libjpeg decompressor context, normally sp->libjpeg_jpeg_decompress_struct. |
| [out] | data | Borrowed dependency-compatible writable component/row arrays and storage for max_lines rows. |
| [in] | max_lines | Number of rows to read; the codec passes subsampling_ver * 8 (one MCU row). |
Definition at line 4105 of file tif_ojpeg.c.
References OJPEGState::exit_jmpbuf, and SETJMP.
Referenced by OJPEGDecodeRaw(), and OJPEGPreDecodeSkipRaw().
|
static |
Trap dependency fatal errors while attempting to read scanlines.
Requires a context created by jpeg_create_decompress_encap with the source manager installed. Sets sp->exit_jmpbuf with SETJMP and calls jpeg_read_scanlines(); a libjpeg fatal error returns here through jpeg_encap_unwind. The libjpeg return value is discarded. State libjpeg changed before an error remains in cinfo.
| [in,out] | sp | Codec state whose exit_jmpbuf holds the jump frame. |
| [in,out] | cinfo | libjpeg decompressor context, normally sp->libjpeg_jpeg_decompress_struct. |
| [out] | scanlines | Borrowed dependency-compatible writable row-pointer array and sample storage for max_lines rows. |
| [in] | max_lines | Maximum number of rows to read; the codec always passes 1. |
Definition at line 4090 of file tif_ojpeg.c.
References OJPEGState::exit_jmpbuf, and SETJMP.
Referenced by OJPEGDecodeScanlines(), and OJPEGPreDecodeSkipScanlines().
|
static |
Trap dependency fatal errors while attempting to start decompression.
Requires a context created by jpeg_create_decompress_encap with the source manager installed. Sets sp->exit_jmpbuf with SETJMP and calls jpeg_start_decompress(); a libjpeg fatal error returns here through jpeg_encap_unwind. The libjpeg return value is discarded. State libjpeg changed before an error remains in cinfo.
| [in,out] | sp | Codec state whose exit_jmpbuf holds the jump frame. |
| [in,out] | cinfo | libjpeg decompressor context, normally sp->libjpeg_jpeg_decompress_struct. |
Definition at line 4076 of file tif_ojpeg.c.
References OJPEGState::exit_jmpbuf, and SETJMP.
Referenced by OJPEGWriteHeaderInfo().
|
static |
Release old-style JPEG state and restore parent methods.
Restores saved tag/print hooks and default compression methods, aborts an active dependency session, frees all owned table blobs, combined conversion storage, pointer arrays and skip buffer, then clears tif_data. Interior component views borrow the combined buffer and are not freed separately. Invalidates every borrowed table/state view; caller handle remains live.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 1859 of file tif_ojpeg.c.
References _TIFFfreeExt(), _TIFFSetDefaultCompressionState(), OJPEGState::actable, OJPEGState::dctable, OJPEGState::libjpeg_session_active, OJPEGLibjpegSessionAbort(), OJPEGState::printdir, TIFFTagMethods::printdir, OJPEGState::qtable, OJPEGState::skip_buffer, OJPEGState::subsampling_convert_ycbcrbuf, OJPEGState::subsampling_convert_ycbcrimage, tiff::tif_data, tiff::tif_tagmethods, TIFFTagMethods::vgetfield, OJPEGState::vgetparent, TIFFTagMethods::vsetfield, and OJPEGState::vsetparent.
Referenced by TIFFInitOJPEG().
Decode complete output rows from the active old-style JPEG session.
Requires nonnegative cc, a writable cc-byte buffer and valid setup with nonzero bytes_per_line. Dispatches raw clump or scanline mode. On failed dispatch, invalid/inactive session or latched raw error, zeroes the entire requested buffer. Dependency/cursor progress and diagnostics remain; no caller buffer retention or ownership transfer. A positive result does not validate discarded dependency row-count results.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [out] | buf | Writable output of cc bytes. |
| [in] | cc | Number of bytes to decode; unless it is a positive multiple of bytes_per_line the raw or scanline decoder fails. |
| [in] | s | Sample index; unused (the plane is selected by OJPEGPreDecode). |
Definition at line 1546 of file tif_ojpeg.c.
References OJPEGDecodeRaw(), OJPEGDecodeScanlines(), tiff::tif_data, and TIFFErrorExtR().
Referenced by TIFFInitOJPEG().
Decode complete subsampled clump rows.
Requires a live raw-mode session. Rejects cc not divisible by bytes_per_line with an error, and returns 0 without a diagnostic for cc <= 0. Reads MCU planes as needed and interleaves subsampled Y/Cb/Cr clumps, advancing conversion state. A trapped dependency failure latches error_in_raw_data_decoding. Partial output/cursor changes survive failure here; OJPEGDecode clears output when propagating failure. Borrows caller output synchronously; no ownership transfer.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [out] | buf | Writable output of cc bytes. |
| [in] | cc | Number of bytes to decode; zero is returned unless it is a positive multiple of bytes_per_line. |
Definition at line 1616 of file tif_ojpeg.c.
References jpeg_read_raw_data_encap(), tiff::tif_data, and TIFFErrorExtR().
Referenced by OJPEGDecode().
Decode complete ordinary sample rows.
Requires a live scanline session. Rejects cc not divisible by bytes_per_line with an error, and returns 0 without a diagnostic for cc <= 0. Requests one row at a time and advances output by bytes_per_line; the encapsulation discards dependency row counts. Partial output/cursor changes survive failure here; OJPEGDecode clears output when propagating failure. Borrows caller output synchronously; no ownership transfer.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [out] | buf | Writable output of cc bytes. |
| [in] | cc | Number of bytes to decode; zero is returned unless it is a positive multiple of bytes_per_line. |
Definition at line 1701 of file tif_ojpeg.c.
References jpeg_read_scanlines_encap(), tiff::tif_data, and TIFFErrorExtR().
Referenced by OJPEGDecode().
Reject unsupported old-style JPEG encoding.
Always reports an error recommending new-style JPEG compression.
| [in] | tif | Handle used for the error report. |
| [in] | buf | Unused. |
| [in] | cc | Unused. |
| [in] | s | Unused. |
Definition at line 1815 of file tif_ojpeg.c.
References TIFFErrorExtR().
Referenced by TIFFInitOJPEG().
|
static |
Accept the old-style JPEG directory without eager fixups.
No-op compatibility hook; does not inspect input, allocate or alter metadata.
| [in] | tif | Unused. |
Definition at line 1322 of file tif_ojpeg.c.
Referenced by TIFFInitOJPEG().
|
static |
Report a fatal dependency error and unwind the active wrapper.
Formats a stack message, diagnoses through the borrowed handle and calls jpeg_encap_unwind. Requires an active wrapper frame; no ordinary return or automatic codec cleanup.
| [in] | cinfo | libjpeg context whose error manager formats the message and whose client_data is the TIFF handle. |
Definition at line 4157 of file tif_ojpeg.c.
References jpeg_encap_unwind(), and TIFFErrorExtR().
Referenced by OJPEGWriteHeaderInfo().
|
static |
Route a dependency message through the handle warning handler.
Requires cinfo->client_data to borrow the live TIFF handle. Formats into temporary stack storage and synchronously emits a warning. No retained string, ownership transfer or status result.
| [in] | cinfo | libjpeg context whose error manager formats the message and whose client_data is the TIFF handle. |
Definition at line 4139 of file tif_ojpeg.c.
References TIFFWarningExtR().
Referenced by OJPEGWriteHeaderInfo().
|
static |
Supply the next reconstructed JPEG chunk to libjpeg.
Calls OJPEGWriteStream and assigns its borrowed storage to the source manager. On failure diagnoses premature input and unwinds the active wrapper. Can read/seek; dependency must consume the chunk before the next refill/cleanup. Does not allocate a caller-owned result.
| [in,out] | cinfo | libjpeg context whose client_data is the TIFF handle; its source manager (sp->libjpeg_jpeg_source_mgr) receives the chunk. |
Definition at line 4195 of file tif_ojpeg.c.
References jpeg_encap_unwind(), OJPEGState::libjpeg_jpeg_source_mgr, OJPEGWriteStream(), tiff::tif_data, and TIFFErrorExtR().
Referenced by OJPEGWriteHeaderInfo().
|
static |
Accept the dependency source initialization.
No-op callback; cinfo is unused. Does not allocate, perform I/O, free borrowed input or transfer ownership.
| [in] | cinfo | Unused. |
Definition at line 4175 of file tif_ojpeg.c.
Referenced by OJPEGWriteHeaderInfo().
|
static |
Reject an unexpected dependency restart resynchronization request.
Ignores the requested count/marker, diagnoses an unexpected error and unwinds the active wrapper. Performs no recovery or ownership transfer; requires a live wrapper frame.
| [in] | cinfo | libjpeg context whose client_data is the TIFF handle. |
| [in] | desired | Unused desired restart marker. |
Definition at line 4250 of file tif_ojpeg.c.
References jpeg_encap_unwind(), and TIFFErrorExtR().
Referenced by OJPEGWriteHeaderInfo().
|
static |
Reject an unexpected dependency skip request.
Ignores the requested count/marker, diagnoses an unexpected error and unwinds the active wrapper. Performs no recovery or ownership transfer; requires a live wrapper frame.
| [in] | cinfo | libjpeg context whose client_data is the TIFF handle. |
| [in] | num_bytes | Unused dependency skip request. |
Definition at line 4223 of file tif_ojpeg.c.
References jpeg_encap_unwind(), and TIFFErrorExtR().
Referenced by OJPEGWriteHeaderInfo().
|
static |
Accept the dependency source termination.
No-op callback; cinfo is unused. Does not allocate, perform I/O, free borrowed input or transfer ownership.
| [in] | cinfo | Unused. |
Definition at line 4273 of file tif_ojpeg.c.
Referenced by OJPEGWriteHeaderInfo().
|
static |
Destroy the active old-style JPEG dependency session.
Requires an active session, calls jpeg_destroy and clears the active flag. Invalidates dependency-owned views; retains outer codec tables/buffers for reuse or cleanup. No independent error status.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 2442 of file tif_ojpeg.c.
References OJPEGState::libjpeg_jpeg_decompress_struct, OJPEGState::libjpeg_session_active, and tiff::tif_data.
Referenced by OJPEGCleanup(), OJPEGPostDecode(), and OJPEGPreDecode().
Advance the cached strile count and end a completed plane session.
Ignores buf and cc and assumes each call completed a whole strile. Requires nonzero stripsperimage and a live session when reaching the plane boundary; destroys that session and clears writeheader_done. This existing assumption is invalid for scanline-by-scanline calls and can abort decoding prematurely (issue 337). No caller buffer access or ownership transfer.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [in] | buf | Unused. |
| [in] | cc | Unused. |
Definition at line 1743 of file tif_ojpeg.c.
References OJPEGState::libjpeg_session_active, OJPEGLibjpegSessionAbort(), TIFFDirectory::td_stripsperimage, tiff::tif_data, tiff::tif_dir, OJPEGState::write_curstrile, and OJPEGState::writeheader_done.
Referenced by TIFFInitOJPEG().
|
static |
Reject unsupported old-style JPEG encoding.
Always reports an error recommending new-style JPEG compression.
| [in] | tif | Handle used for the error report. |
Definition at line 1836 of file tif_ojpeg.c.
References TIFFErrorExtR().
Referenced by TIFFInitOJPEG().
|
static |
Position a reconstructed JPEG session at the requested strile and plane.
Lazily corrects sampling and reads headers, restores cached SOS input snapshots and restarts a session for backward/plane changes. Requires a valid sample/strile with at most three components and representable geometry. Forward positioning decodes/discards intervening striles; this is sequential reconstruction rather than independent strile decoding. Can seek/read, allocate and replace dependency state; failures leave partial state for cleanup. Sets decoder_ok on success.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [in] | s | Sample (plane) index: 0 for contiguous data, 0..2 for separate planes; selects the cached scan in sos_end. |
Definition at line 1368 of file tif_ojpeg.c.
References OJPEGState::decoder_ok, OJPEGState::in_buffer_cur, OJPEGState::in_buffer_file_pos, OJPEGState::in_buffer_file_pos_log, OJPEGState::in_buffer_file_togo, OJPEGState::in_buffer_next_strile, OJPEGState::in_buffer_source, OJPEGState::in_buffer_togo, isTiled, OJPEGState::libjpeg_jpeg_query_style, OJPEGState::libjpeg_session_active, OJPEGState::log, OJPEGLibjpegSessionAbort(), OJPEGPreDecodeSkipRaw(), OJPEGPreDecodeSkipScanlines(), OJPEGReadHeaderInfo(), OJPEGReadSecondarySos(), OJPEGSubsamplingCorrect(), OJPEGWriteHeaderInfo(), OJPEGState::plane_sample_offset, OJPEGState::readheader_done, OJPEGState::sos_end, OJPEGState::subsampling_convert_state, OJPEGState::subsamplingcorrect_done, TIFFDirectory::td_curstrip, TIFFDirectory::td_curtile, TIFFDirectory::td_stripsperimage, tiff::tif_data, tiff::tif_dir, OJPEGState::write_cursample, OJPEGState::write_curstrile, and OJPEGState::writeheader_done.
Referenced by TIFFInitOJPEG().
|
static |
Decode and discard one strile in raw mode.
Consumes complete raw MCU row groups into codec-owned conversion planes, retaining any partially consumed group. Requires an active raw-mode session and nonzero conversion geometry. Clears error_in_raw_data_decoding when it completes a partially consumed group. Does not allocate; a libjpeg failure is not latched in error_in_raw_data_decoding, and partial advancement remains.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 1451 of file tif_ojpeg.c.
References OJPEGState::error_in_raw_data_decoding, jpeg_read_raw_data_encap(), OJPEGState::libjpeg_jpeg_decompress_struct, OJPEGState::lines_per_strile, OJPEGState::subsampling_convert_clines, OJPEGState::subsampling_convert_state, OJPEGState::subsampling_convert_ycbcrimage, OJPEGState::subsampling_ver, and tiff::tif_data.
Referenced by OJPEGPreDecode().
|
static |
Decode and discard one strile in scanlines mode.
Lazily allocates a codec-owned bytes_per_line skip buffer and decodes lines_per_strile rows into it. Requires an active scanline session. The skip buffer is kept for later calls; partial advancement remains on failure.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 1502 of file tif_ojpeg.c.
References _TIFFmallocExt(), jpeg_read_scanlines_encap(), tiff::tif_data, and TIFFErrorExtR().
Referenced by OJPEGPreDecode().
|
static |
Reject unsupported old-style JPEG encoding.
Always reports an error recommending new-style JPEG compression.
| [in] | tif | Handle used for the error report. |
| [in] | s | Unused. |
Definition at line 1793 of file tif_ojpeg.c.
References TIFFErrorExtR().
Referenced by TIFFInitOJPEG().
|
static |
Print cached old-style JPEG fields before the optional parent printer.
Writes selected metadata to the borrowed FILE, synchronously invokes the saved parent and ignores stream error status. No pixel decoding, allocation or ownership transfer.
| [in] | tif | Handle whose codec state supplies the printed values. |
| [in,out] | fd | Borrowed writable FILE, retained by caller. |
| [in] | flags | Print flags forwarded to parent. |
Definition at line 1270 of file tif_ojpeg.c.
References OJPEGState::actable_offset, OJPEGState::actable_offset_count, OJPEGState::dctable_offset, OJPEGState::dctable_offset_count, FIELD_OJPEG_JPEGACTABLES, FIELD_OJPEG_JPEGDCTABLES, FIELD_OJPEG_JPEGINTERCHANGEFORMAT, FIELD_OJPEG_JPEGINTERCHANGEFORMATLENGTH, FIELD_OJPEG_JPEGPROC, FIELD_OJPEG_JPEGQTABLES, FIELD_OJPEG_JPEGRESTARTINTERVAL, OJPEGState::jpeg_interchange_format, OJPEGState::jpeg_interchange_format_length, OJPEGState::jpeg_proc, OJPEGState::printdir, OJPEGState::qtable_offset, OJPEGState::qtable_offset_count, OJPEGState::restart_interval, tiff::tif_data, and TIFFFieldSet.
Referenced by TIFFInitOJPEG().
|
static |
Copy a positive byte block from the input stream.
Requires len greater than zero and mem writable for len bytes. Can refill repeatedly; failure retains partial output and consumed bytes. Caller owns result storage; no retained caller pointer. Read failures may be diagnosed by lower layers; no rollback.
| [in,out] | sp | Codec state whose input window is consumed and refilled as needed. |
| [in] | len | Number of bytes to copy; must be positive (asserted). |
| [out] | mem | Destination of at least len writable bytes. |
Definition at line 3541 of file tif_ojpeg.c.
References _TIFFmemcpy(), OJPEGState::in_buffer_cur, OJPEGState::in_buffer_togo, and OJPEGReadBufferFill().
Referenced by OJPEGReadHeaderInfoSecStreamDht(), and OJPEGReadHeaderInfoSecStreamDqt().
|
static |
Refill the old-style JPEG input window across interchange and strile extents.
Requires no unread bytes. Traverses normalized interchange data then bounded strile offsets/counts, skipping empty offsets and clamping lengths to file size. Zero bytecount uses remaining file extent. Can fetch strile metadata, seek and read; seek status is not checked separately and positive short reads are accepted. Maintains embedded storage/cursors without transferring ownership.
| [in,out] | sp | Codec state whose input window, source and extent cursors are updated. |
Definition at line 3334 of file tif_ojpeg.c.
References OJPEGState::file_size, OJPEGState::in_buffer, OJPEGState::in_buffer_cur, OJPEGState::in_buffer_file_pos, OJPEGState::in_buffer_file_pos_log, OJPEGState::in_buffer_file_togo, OJPEGState::in_buffer_next_strile, OJPEGState::in_buffer_source, OJPEGState::in_buffer_strile_count, OJPEGState::in_buffer_togo, OJPEGState::jpeg_interchange_format, OJPEGState::jpeg_interchange_format_length, OJPEG_BUFFER, osibsEof, osibsJpegInterchangeFormat, osibsNotSetYet, osibsStrile, OJPEGState::tif, TIFFGetStrileByteCountWithErr(), TIFFGetStrileOffsetWithErr(), TIFFReadFile, and TIFFSeekFile.
Referenced by OJPEGReadBlock(), OJPEGReadByte(), OJPEGReadBytePeek(), and OJPEGWriteStreamCompressed().
|
static |
Consume one buffered byte.
Refills as needed and advances input; assigns byte only after success. Caller owns result storage; no retained caller pointer. Read failures may be diagnosed by lower layers; no rollback.
| [in,out] | sp | Codec state whose input window is consumed and refilled as needed. |
| [out] | byte | Non-NULL caller-owned byte result. |
Definition at line 3441 of file tif_ojpeg.c.
References OJPEGState::in_buffer_cur, OJPEGState::in_buffer_togo, and OJPEGReadBufferFill().
Referenced by OJPEGReadHeaderInfoSec(), OJPEGReadHeaderInfoSecStreamSof(), OJPEGReadHeaderInfoSecStreamSos(), OJPEGReadSecondarySos(), and OJPEGReadWord().
|
static |
Consume one already buffered byte.
Requires in_buffer_togo greater than zero, asserted in debug builds. Advances the embedded cursor/count without refilling, allocation, diagnostics or ownership transfer.
| [in,out] | sp | Codec state whose input cursor and count are advanced. |
Definition at line 3492 of file tif_ojpeg.c.
References OJPEGState::in_buffer_cur, and OJPEGState::in_buffer_togo.
Referenced by OJPEGReadHeaderInfoSec().
|
static |
Peek at the next buffered byte.
May refill and perform client I/O but leaves the returned byte unconsumed; assigns byte only after success. Caller owns result storage; no retained caller pointer. Read failures may be diagnosed by lower layers; no rollback.
| [in,out] | sp | Codec state whose input window may be refilled; the cursor is not advanced. |
| [out] | byte | Non-NULL caller-owned byte result. |
Definition at line 3469 of file tif_ojpeg.c.
References OJPEGState::in_buffer_cur, OJPEGState::in_buffer_togo, and OJPEGReadBufferFill().
Referenced by OJPEGReadHeaderInfoSec().
|
static |
Validate geometry and cache the first old-style JPEG scan position.
Accepts SamplesPerPixel 1 or 3 and contiguous/separate planes; sample precision is checked only when the stream has an SOF marker. For multi-strile images, validates sampling factors (1, 2 or 4) and strile/MCU alignment, and replaces the cached restart interval (including a JpegRestartInterval tag value) with the per-strile MCU count, which a stream DRI marker may override. Reads stream or offset-tag tables, caches SOS state and marks readheader_done. Requires valid nonzero strile geometry. Allocated tables remain codec-owned; client position and partial caches persist on failure.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 2037 of file tif_ojpeg.c.
References _TIFFMultiply32(), isTiled, OJPEGReadHeaderInfoSec(), PLANARCONFIG_CONTIG, TIFFDirectory::td_imagelength, TIFFDirectory::td_imagewidth, TIFFDirectory::td_planarconfig, TIFFDirectory::td_rowsperstrip, TIFFDirectory::td_samplesperpixel, TIFFDirectory::td_tilelength, TIFFDirectory::td_tilewidth, tiff::tif_data, tiff::tif_dir, TIFFErrorExtR(), and TIFFhowmany_32_maxuint_compat.
Referenced by OJPEGPreDecode().
|
static |
Parse a bounded interchange/strile JPEG header or synthesize it from tags.
Normalizes invalid/out-of-file interchange extents, initializes input traversal, dispatches marker parsers and skips APP/COM payloads. Probe mode may stop after SOF/SOS without full parsing. Missing SOF falls back to offset-tag tables and synthesized baseline component headers. Can allocate, read/seek and replace cached tables; no position restore or rollback on failure.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 2469 of file tif_ojpeg.c.
References JPEG_MARKER_APP0, JPEG_MARKER_COM, JPEG_MARKER_DHT, JPEG_MARKER_DQT, JPEG_MARKER_DRI, JPEG_MARKER_SOF0, JPEG_MARKER_SOF1, JPEG_MARKER_SOF3, JPEG_MARKER_SOI, JPEG_MARKER_SOS, OJPEGReadByte(), OJPEGReadByteAdvance(), OJPEGReadBytePeek(), OJPEGReadHeaderInfoSecStreamDht(), OJPEGReadHeaderInfoSecStreamDqt(), OJPEGReadHeaderInfoSecStreamDri(), OJPEGReadHeaderInfoSecStreamSof(), OJPEGReadHeaderInfoSecStreamSos(), OJPEGReadHeaderInfoSecTablesAcTable(), OJPEGReadHeaderInfoSecTablesDcTable(), OJPEGReadHeaderInfoSecTablesQTable(), OJPEGReadSkip(), OJPEGReadWord(), osibsNotSetYet, TIFFDirectory::td_nstrips, tiff::tif_data, tiff::tif_dir, TIFFErrorExtR(), and TIFFGetFileSize.
Referenced by OJPEGReadHeaderInfo(), and OJPEGSubsamplingCorrect().
|
static |
Capture a JPEG Huffman marker in its selected table slot.
Copies the complete marker into an owned length-prefixed blob, validates the first class/slot and replaces the old DC/AC slot. Retains the existing assumption that one marker describes one table. Probe mode skips the payload. Failure frees the new temporary blob but preserves consumed input and earlier changes.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 2736 of file tif_ojpeg.c.
References _TIFFfreeExt(), _TIFFmallocExt(), JPEG_MARKER_DHT, OJPEGReadBlock(), OJPEGReadSkip(), OJPEGReadWord(), tiff::tif_data, and TIFFErrorExtR().
Referenced by OJPEGReadHeaderInfoSec().
|
static |
Capture eight-bit JPEG quantisation table markers.
Validates marker length and table slot 0..3, allocates owned length-prefixed marker blobs and replaces each previous slot only after reading that table. Probe mode skips payload instead. Earlier table replacements and input progress remain if a later table fails; temporary failed blobs are freed. No caller ownership transfer.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 2657 of file tif_ojpeg.c.
References _TIFFfreeExt(), _TIFFmallocExt(), JPEG_MARKER_DQT, OJPEGReadBlock(), OJPEGReadSkip(), OJPEGReadWord(), tiff::tif_data, and TIFFErrorExtR().
Referenced by OJPEGReadHeaderInfoSec().
|
static |
Parse and cache a JPEG restart interval.
Consumes a big-endian length and interval, requires marker length four, diagnoses a bad length and stores the interval after both reads. A short read fails without a codec diagnostic. No allocation; input progress remains on failure.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 2621 of file tif_ojpeg.c.
References OJPEGReadWord(), tiff::tif_data, and TIFFErrorExtR().
Referenced by OJPEGReadHeaderInfoSec().
|
static |
Validate a JPEG frame and cache its component selectors.
Requires supported marker_id and bounded component count consistent with the image outside probe mode. Validates eight-bit precision, dimensions and sampling; probe mode instead discovers factors and can force dependency desubsampling. Reads/cache assignments are incremental, with selected diagnostics suppressed during probing. No allocation or ownership transfer.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [in] | marker_id | Supported SOF marker code. |
Definition at line 2833 of file tif_ojpeg.c.
References OJPEGReadByte(), OJPEGReadSkip(), OJPEGReadWord(), tiff::tif_data, and TIFFErrorExtR().
Referenced by OJPEGReadHeaderInfoSec().
|
static |
Validate and cache a JPEG scan component header.
Requires non-probe mode, a parsed frame and valid plane/component bounds at most three. Validates scan length/count, stores component/table selectors and skips the final three spectral/approximation bytes without validating them. Partial cache/input changes survive failure; no allocation.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 3018 of file tif_ojpeg.c.
References OJPEGReadByte(), OJPEGReadSkip(), OJPEGReadWord(), tiff::tif_data, and TIFFErrorExtR().
Referenced by OJPEGReadHeaderInfoSec(), and OJPEGReadSecondarySos().
|
static |
Build AC Huffman markers from TIFF table-offset tags.
Requires one to three valid components. Reports a missing first offset with an error. Reads client data directly at offsets, builds owned length-prefixed marker blobs and caches selectors, reusing adjacent equal/omitted offsets. Non-adjacent duplicates can be rejected. Seek return status is not checked separately; a short read fails without a codec diagnostic. Frees a failed temporary blob, retains earlier replacements and leaves file position changed.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 3247 of file tif_ojpeg.c.
References _TIFFfreeExt(), _TIFFmallocExt(), JPEG_MARKER_DHT, tiff::tif_data, TIFFErrorExtR(), TIFFReadFile, and TIFFSeekFile.
Referenced by OJPEGReadHeaderInfoSec().
|
static |
Build DC Huffman markers from TIFF table-offset tags.
Requires one to three valid components. Reports a missing first offset with an error. Reads client data directly at offsets, builds owned length-prefixed marker blobs and caches selectors, reusing adjacent equal/omitted offsets. Non-adjacent duplicates can be rejected. Seek return status is not checked separately; a short read fails without a codec diagnostic. Frees a failed temporary blob, retains earlier replacements and leaves file position changed.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 3160 of file tif_ojpeg.c.
References _TIFFfreeExt(), _TIFFmallocExt(), JPEG_MARKER_DHT, tiff::tif_data, TIFFErrorExtR(), TIFFReadFile, and TIFFSeekFile.
Referenced by OJPEGReadHeaderInfoSec().
|
static |
Build quantisation markers from TIFF table-offset tags.
Requires one to three valid components. Reports a missing first offset with an error. Reads client data directly at offsets, builds owned length-prefixed marker blobs and caches selectors, reusing adjacent equal/omitted offsets. Non-adjacent duplicates can be rejected. Seek return status is not checked separately; a short read fails without a codec diagnostic. Frees a failed temporary blob, retains earlier replacements and leaves file position changed.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 3084 of file tif_ojpeg.c.
References _TIFFfreeExt(), _TIFFmallocExt(), JPEG_MARKER_DQT, tiff::tif_data, TIFFErrorExtR(), TIFFReadFile, and TIFFSeekFile.
Referenced by OJPEGReadHeaderInfoSec().
|
static |
Locate and cache a later separate-plane scan header.
Requires sample s in 1..2 and valid preceding snapshots. Restores nearest known scan, scans markers and caches each subsequent SOS stream position; can seek/read and change plane offsets. Cached positions and partial progress persist on failure; no caller ownership transfer.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [in] | s | Separate-plane sample index in 1..2 (asserted). |
Definition at line 2155 of file tif_ojpeg.c.
References OJPEGState::in_buffer_cur, OJPEGState::in_buffer_file_pos, OJPEGState::in_buffer_file_pos_log, OJPEGState::in_buffer_file_togo, OJPEGState::in_buffer_next_strile, OJPEGState::in_buffer_source, OJPEGState::in_buffer_togo, JPEG_MARKER_SOS, OJPEGState::log, OJPEGReadByte(), OJPEGReadHeaderInfoSecStreamSos(), OJPEGState::plane_sample_offset, OJPEGState::sos_end, and tiff::tif_data.
Referenced by OJPEGPreDecode().
|
static |
Skip up to a bounded input extent without fetching skipped bytes.
Consumes buffered data first, then advances file-window offsets and marks repositioning required. An oversized skip silently exhausts the available extent. No immediate client read, allocation, status result or ownership transfer.
| [in,out] | sp | Codec state whose input window and file extent cursors are advanced. |
| [in] | len | Number of bytes to skip; clamped to the remaining extent. |
Definition at line 3582 of file tif_ojpeg.c.
References OJPEGState::in_buffer_cur, OJPEGState::in_buffer_file_pos, OJPEGState::in_buffer_file_pos_log, OJPEGState::in_buffer_file_togo, and OJPEGState::in_buffer_togo.
Referenced by OJPEGReadHeaderInfoSec(), OJPEGReadHeaderInfoSecStreamDht(), OJPEGReadHeaderInfoSecStreamDqt(), OJPEGReadHeaderInfoSecStreamSof(), and OJPEGReadHeaderInfoSecStreamSos().
|
static |
Consume a big-endian sixteen-bit word.
Reads two bytes; after the first succeeds, word already contains its high byte, so second-byte failure leaves a partial result. Caller owns result storage; no retained caller pointer. Read failures may be diagnosed by lower layers; no rollback.
| [in,out] | sp | Codec state whose input window is consumed and refilled as needed. |
| [out] | word | Non-NULL caller-owned word result; can be partial on failure. |
Definition at line 3514 of file tif_ojpeg.c.
References OJPEGReadByte().
Referenced by OJPEGReadHeaderInfoSec(), OJPEGReadHeaderInfoSecStreamDht(), OJPEGReadHeaderInfoSecStreamDqt(), OJPEGReadHeaderInfoSecStreamDri(), OJPEGReadHeaderInfoSecStreamSof(), and OJPEGReadHeaderInfoSecStreamSos().
|
static |
Warn that old-style JPEG compression is deprecated.
Emits a per-handle warning recommending modern JPEG; no dependency creation, pixel I/O or ownership transfer.
| [in] | tif | Handle used for the warning. |
Definition at line 1338 of file tif_ojpeg.c.
References TIFFWarningExtR().
Referenced by TIFFInitOJPEG().
|
static |
Reject unsupported old-style JPEG encoding.
Always reports an error recommending new-style JPEG compression.
| [in] | tif | Handle used for the error report. |
Definition at line 1774 of file tif_ojpeg.c.
References TIFFErrorExtR().
Referenced by TIFFInitOJPEG().
|
static |
Probe and reconcile old-style JPEG subsampling once.
Called once, from OJPEGVGetField (YCbCrSubsampling) or OJPEGPreDecode, and sets subsamplingcorrect_done. Only the codec-cached values sp->subsampling_hor, sp->subsampling_ver and sp->subsampling_force_desubsampling_inside_decompression change; td_ycbcrsubsampling in the directory is not modified.
If SamplesPerPixel is not 3 or Photometric is neither YCbCr nor ITULAB, no input is read: the factors are set to 1x1 and the force flag is cleared, with a warning if the YCbCrSubsampling tag was set. Otherwise the stream header is parsed once by OJPEGReadHeaderInfoSec in sampling-only mode (sp->subsamplingcorrect set), which stops at the first SOF or SOS marker and suppresses most diagnostics; its result is ignored. The first SOF component's factors replace the cached ones, and factors other than 1, 2 or 4, or chroma factors other than 1x1, set the force flag, in which case the cached factors become 1x1 and libjpeg upsamples. Warns when the stream factors differ from the tag (or the 2x2 default) and when horizontal is less than vertical. The probe seeks and reads the file and leaves the input cursor wherever it stopped (a DRI marker before the SOF also sets restart_interval); OJPEGReadHeaderInfo parses the header again later.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 1932 of file tif_ojpeg.c.
References OJPEGReadHeaderInfoSec(), PHOTOMETRIC_ITULAB, PHOTOMETRIC_YCBCR, TIFFDirectory::td_photometric, TIFFDirectory::td_samplesperpixel, tiff::tif_data, tiff::tif_dir, and TIFFWarningExtR().
Referenced by OJPEGPreDecode(), and OJPEGVGetField().
|
static |
Retrieve old-style JPEG metadata or delegate to the parent getter.
IFOFFSET/IFBYTECOUNT consume uint64_t*. YCBCRSUBSAMPLING consumes two uint16_t*; on the first query it runs OJPEGSubsamplingCorrect, which can seek and read the stream header, and it returns the codec-cached factors rather than the directory's td_ycbcrsubsampling, which is not updated. Q/DC/AC table tags consume uint32_t* count then const void** pointing to the embedded uint64_t offset arrays in the codec state; the pointer is valid until the codec state is freed. PROC/RESTART consume uint16_t*. Other tags are passed to the parent getter.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [in] | tag | Handled old-style JPEG/related tag or parent-delegated identifier. |
| [in,out] | ap | Live tag-specific va_list cursor, consumed synchronously without retention. |
Definition at line 1105 of file tif_ojpeg.c.
References OJPEGState::actable_offset, OJPEGState::actable_offset_count, OJPEGState::dctable_offset, OJPEGState::dctable_offset_count, OJPEGState::jpeg_interchange_format, OJPEGState::jpeg_interchange_format_length, OJPEGState::jpeg_proc, OJPEGSubsamplingCorrect(), OJPEGState::qtable_offset, OJPEGState::qtable_offset_count, OJPEGState::restart_interval, OJPEGState::subsampling_hor, OJPEGState::subsampling_ver, OJPEGState::subsamplingcorrect_done, tiff::tif_data, TIFFTAG_JPEGACTABLES, TIFFTAG_JPEGDCTABLES, TIFFTAG_JPEGIFBYTECOUNT, TIFFTAG_JPEGIFOFFSET, TIFFTAG_JPEGPROC, TIFFTAG_JPEGQTABLES, TIFFTAG_JPEGRESTARTINTERVAL, TIFFTAG_YCBCRSUBSAMPLING, and OJPEGState::vgetparent.
Referenced by TIFFInitOJPEG().
|
static |
Cache old-style JPEG tag values or delegate to the parent setter.
IFOFFSET/IFBYTECOUNT consume uint64_t. SUBSAMPLING consumes two uint16_vap promoted values, narrows to eight bits and updates directory sampling. Q/DC/AC table tags consume uint32_t count: nonzero counts must be at most three, then a borrowed uint64_t* is copied; zero consumes no pointer and preserves prior count. PROC/RESTART consume uint16_vap and narrow to eight/sixteen bits. Marks field/dirty after assignment; later lookup failure need not roll back cached values. Retains no caller storage.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [in] | tag | Handled old-style JPEG/related tag or parent-delegated identifier. |
| [in,out] | ap | Live tag-specific va_list cursor, consumed synchronously without retention. |
Definition at line 1169 of file tif_ojpeg.c.
References _TIFFField::field_bit, TIFFDirectory::td_ycbcrsubsampling, tiff::tif_data, tiff::tif_dir, tiff::tif_flags, TIFF_DIRTYDIRECT, TIFFErrorExtR(), TIFFFieldWithTag(), TIFFSetFieldBit, TIFFTAG_JPEGACTABLES, TIFFTAG_JPEGDCTABLES, TIFFTAG_JPEGIFBYTECOUNT, TIFFTAG_JPEGIFOFFSET, TIFFTAG_JPEGPROC, TIFFTAG_JPEGQTABLES, TIFFTAG_JPEGRESTARTINTERVAL, and TIFFTAG_YCBCRSUBSAMPLING.
Referenced by TIFFInitOJPEG().
|
static |
Start libjpeg with a synthesized old-style JPEG input header.
This builds decoder input, not a TIFF output stream. Rejects a previously active failed session, installs managers, creates the dependency decompressor and chooses raw subsampled or ordinary scanlines. Allocates checked conversion storage and row-pointer views in raw mode, validates dependency width/sampling, and starts decoding. Tiny malformed tile layouts retain existing conversion limitations; failed setup can retain an active session/owned buffers for cleanup. No caller storage retention.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
Definition at line 2231 of file tif_ojpeg.c.
References _TIFFcallocExt(), _TIFFmallocExt(), _TIFFMultiply32(), FALSE, jpeg_create_decompress_encap(), jpeg_read_header_encap(), jpeg_start_decompress_encap(), OJPEGLibjpegJpegErrorMgrErrorExit(), OJPEGLibjpegJpegErrorMgrOutputMessage(), OJPEGLibjpegJpegSourceMgrFillInputBuffer(), OJPEGLibjpegJpegSourceMgrInitSource(), OJPEGLibjpegJpegSourceMgrResyncToRestart(), OJPEGLibjpegJpegSourceMgrSkipInputData(), OJPEGLibjpegJpegSourceMgrTermSource(), ososSoi, tiff::tif_data, and TIFFErrorExtR().
Referenced by OJPEGPreDecode().
|
static |
Produce the next borrowed chunk of reconstructed decoder input.
Advances the output state through synthetic markers, owned table blobs and client compressed input. Skips absent tables internally. Can read/seek and diagnose through refill. Returns pointers into embedded buffers or owned tables, valid until next producer/refill, table replacement or cleanup; consume synchronously and never free them. Does not write TIFF output. Outputs need not be assigned on failure.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [out] | mem | Set to the start of the produced chunk on success. |
| [out] | len | Set to 0 on entry, then to the nonzero chunk length on success; not preserved on failure. |
Definition at line 3629 of file tif_ojpeg.c.
References OJPEGWriteStreamAcTable(), OJPEGWriteStreamCompressed(), OJPEGWriteStreamDcTable(), OJPEGWriteStreamDri(), OJPEGWriteStreamEoi(), OJPEGWriteStreamQTable(), OJPEGWriteStreamRst(), OJPEGWriteStreamSof(), OJPEGWriteStreamSoi(), OJPEGWriteStreamSos(), ososAcTable0, ososAcTable1, ososAcTable2, ososAcTable3, ososCompressed, ososDcTable0, ososDcTable1, ososDcTable2, ososDcTable3, ososDri, ososEoi, ososQTable0, ososQTable1, ososQTable2, ososQTable3, ososRst, ososSof, ososSoi, ososSos, OJPEGState::out_state, and tiff::tif_data.
Referenced by OJPEGLibjpegJpegSourceMgrFillInputBuffer().
|
static |
Produce a AcTable reconstruction chunk.
Borrows the selected AC Huffman marker blob, omitting its stored length prefix. An absent table advances state without assigning outputs. Requires table_index in 0..3. The chunk points into the stored table and is valid until the table is replaced or the codec is cleaned up.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [in] | table_index | Table slot in 0..3. |
| [out] | mem | Set to the stored marker when the table is present; otherwise unchanged. |
| [out] | len | Set to the marker length when the table is present; otherwise unchanged. |
Definition at line 3803 of file tif_ojpeg.c.
References OJPEGState::actable, OJPEGState::out_state, and tiff::tif_data.
Referenced by OJPEGWriteStream().
|
static |
Produce a Compressed reconstruction chunk.
Refills input if needed, exposes the unread window and consumes it logically. At strile boundaries selects restart or EOI output. Can seek/read and fail; output arguments are not assigned on failure. The chunk points into in_buffer and is valid until the next refill. Does not allocate.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [out] | mem | Set to the unread part of in_buffer on success. |
| [out] | len | Set to the number of unread bytes on success. |
Definition at line 3963 of file tif_ojpeg.c.
References OJPEGState::in_buffer_cur, OJPEGState::in_buffer_file_togo, OJPEGState::in_buffer_next_strile, OJPEGState::in_buffer_source, OJPEGState::in_buffer_strile_count, OJPEGState::in_buffer_togo, OJPEGReadBufferFill(), osibsEof, osibsJpegInterchangeFormat, osibsNotSetYet, osibsStrile, ososEoi, ososRst, OJPEGState::out_state, and tiff::tif_data.
Referenced by OJPEGWriteStream().
|
static |
Produce a DcTable reconstruction chunk.
Borrows the selected DC Huffman marker blob, omitting its stored length prefix. An absent table advances state without assigning outputs. Requires table_index in 0..3. The chunk points into the stored table and is valid until the table is replaced or the codec is cleaned up.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [in] | table_index | Table slot in 0..3. |
| [out] | mem | Set to the stored marker when the table is present; otherwise unchanged. |
| [out] | len | Set to the marker length when the table is present; otherwise unchanged. |
Definition at line 3773 of file tif_ojpeg.c.
References OJPEGState::dctable, OJPEGState::out_state, and tiff::tif_data.
Referenced by OJPEGWriteStream().
|
static |
Produce a Dri reconstruction chunk.
Writes a DRI marker for the cached restart interval into out_buffer, or emits nothing when the interval is 0, and advances to frame output. The chunk is valid until the next producer overwrites out_buffer.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [out] | mem | Set to sp->out_buffer when a DRI marker is emitted; otherwise unchanged. |
| [out] | len | Set to 6 when a DRI marker is emitted; otherwise unchanged. |
Definition at line 3831 of file tif_ojpeg.c.
References JPEG_MARKER_DRI, OJPEG_BUFFER, OJPEGState::out_buffer, OJPEGState::out_state, OJPEGState::restart_interval, and tiff::tif_data.
Referenced by OJPEGWriteStream().
|
static |
Produce a Eoi reconstruction chunk.
Writes EOI into out_buffer without advancing to a further state. The chunk is valid until the next producer overwrites out_buffer.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [out] | mem | Set to sp->out_buffer, which holds the marker. |
| [out] | len | Set to the marker length in bytes. |
Definition at line 4036 of file tif_ojpeg.c.
References JPEG_MARKER_EOI, OJPEG_BUFFER, OJPEGState::out_buffer, and tiff::tif_data.
Referenced by OJPEGWriteStream().
|
static |
Produce a QTable reconstruction chunk.
Borrows the selected quantisation marker blob, omitting its stored length prefix. An absent table advances state without assigning outputs. Requires table_index in 0..3. The chunk points into the stored table and is valid until the table is replaced or the codec is cleaned up.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [in] | table_index | Table slot in 0..3. |
| [out] | mem | Set to the stored marker when the table is present; otherwise unchanged. |
| [out] | len | Set to the marker length when the table is present; otherwise unchanged. |
Definition at line 3743 of file tif_ojpeg.c.
References OJPEGState::out_state, OJPEGState::qtable, and tiff::tif_data.
Referenced by OJPEGWriteStream().
|
static |
Produce a Rst reconstruction chunk.
Writes the next cyclic RST0..RST7 marker into out_buffer and returns to compressed input. The chunk is valid until the next producer overwrites out_buffer.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [out] | mem | Set to sp->out_buffer, which holds the marker. |
| [out] | len | Set to the marker length in bytes. |
Definition at line 4010 of file tif_ojpeg.c.
References JPEG_MARKER_RST0, OJPEG_BUFFER, ososCompressed, OJPEGState::out_buffer, OJPEGState::out_state, OJPEGState::restart_index, and tiff::tif_data.
Referenced by OJPEGWriteStream().
|
static |
Produce a Sof reconstruction chunk.
Emits cached eight-bit frame/component geometry with representable marker dimensions and at most three components into out_buffer, then advances to SOS. The chunk is valid until the next producer overwrites out_buffer.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [out] | mem | Set to sp->out_buffer, which holds the marker. |
| [out] | len | Set to the marker length in bytes. |
Definition at line 3863 of file tif_ojpeg.c.
References OJPEG_BUFFER, OJPEGState::out_buffer, OJPEGState::out_state, OJPEGState::plane_sample_offset, OJPEGState::samples_per_pixel_per_plane, OJPEGState::sof_c, OJPEGState::sof_hv, OJPEGState::sof_marker_id, OJPEGState::sof_tq, OJPEGState::sof_x, OJPEGState::sof_y, and tiff::tif_data.
Referenced by OJPEGWriteStream().
|
static |
Produce a Soi reconstruction chunk.
Writes SOI into out_buffer and advances to the quantisation tables. The chunk is valid until the next producer overwrites out_buffer.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [out] | mem | Set to sp->out_buffer, which holds the marker. |
| [out] | len | Set to the marker length in bytes. |
Definition at line 3715 of file tif_ojpeg.c.
References JPEG_MARKER_SOI, OJPEG_BUFFER, OJPEGState::out_buffer, OJPEGState::out_state, and tiff::tif_data.
Referenced by OJPEGWriteStream().
|
static |
Produce a Sos reconstruction chunk.
Writes an SOS marker with the current plane scan selectors into out_buffer, requiring valid plane/component bounds, then advances to compressed input. The chunk is valid until the next producer overwrites out_buffer.
| [in,out] | tif | Non-NULL live handle with compatible old-style JPEG state and directory; serialise access. |
| [out] | mem | Set to sp->out_buffer, which holds the marker. |
| [out] | len | Set to the marker length in bytes. |
Definition at line 3914 of file tif_ojpeg.c.
References JPEG_MARKER_SOS, OJPEG_BUFFER, OJPEGState::out_buffer, OJPEGState::out_state, OJPEGState::plane_sample_offset, OJPEGState::samples_per_pixel_per_plane, OJPEGState::sos_cs, OJPEGState::sos_tda, and tiff::tif_data.
Referenced by OJPEGWriteStream().
|
extern |
Install the decode-only old-style JPEG codec.
Requires COMPRESSION_OJPEG and previous codec cleanup. Merges fields, allocates zeroed Ext state, preserves parent tag/print hooks and installs codec methods. Sets NOREADRAW because this decoder reads its own interchange/strile stream. Defaults to baseline process and 2x2 sampling; the 2x2 YCbCrSubsampling is set through the parent setter before the codec tag methods are installed, so it is not marked as an explicit codec tag, and its status is ignored. Allocation/field failures diagnose; installed state remains handle-owned until cleanup.
| [in,out] | tif | Non-NULL handle whose previous codec state has been cleaned up; receives the new codec state. Serialise access. |
| [in] | scheme | COMPRESSION_OJPEG, asserted in debug builds. |
Definition at line 1020 of file tif_ojpeg.c.
References _TIFFmallocExt(), _TIFFmemset(), _TIFFMergeFields(), COMPRESSION_OJPEG, OJPEGCleanup(), OJPEGDecode(), OJPEGEncode(), ojpegFields, OJPEGFixupTags(), OJPEGPostDecode(), OJPEGPostEncode(), OJPEGPreDecode(), OJPEGPreEncode(), OJPEGPrintDir(), OJPEGSetupDecode(), OJPEGSetupEncode(), OJPEGVGetField(), OJPEGVSetField(), TIFFTagMethods::printdir, tiff::tif_cleanup, tiff::tif_data, tiff::tif_decoderow, tiff::tif_decodestrip, tiff::tif_decodetile, tiff::tif_encoderow, tiff::tif_encodestrip, tiff::tif_encodetile, tiff::tif_fixuptags, tiff::tif_flags, tiff::tif_postdecode, tiff::tif_postencode, tiff::tif_predecode, tiff::tif_preencode, tiff::tif_setupdecode, tiff::tif_setupencode, tiff::tif_tagmethods, TIFF_NOREADRAW, TIFFArrayCount, TIFFErrorExtR(), TIFFSetField(), TIFFTAG_YCBCRSUBSAMPLING, TIFFTagMethods::vgetfield, and TIFFTagMethods::vsetfield.
|
static |
Describe legacy JPEG tags merged into the handle.
Immutable library-lifetime metadata merged into a handle; no caller ownership transfer.
Definition at line 368 of file tif_ojpeg.c.
Referenced by TIFFInitOJPEG().