LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables

The decode-only old-style JPEG codec reconstructs a single dependency stream. More...

Collaboration diagram for Old-style JPEG reconstruction:

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.
 

Detailed Description

The decode-only old-style JPEG codec reconstructs a single dependency stream.

Macro Definition Documentation

◆ FIELD_OJPEG_JPEGACTABLES

#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.

◆ FIELD_OJPEG_JPEGDCTABLES

#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.

◆ FIELD_OJPEG_JPEGINTERCHANGEFORMAT

#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.

◆ FIELD_OJPEG_JPEGINTERCHANGEFORMATLENGTH

#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.

◆ FIELD_OJPEG_JPEGPROC

#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.

◆ FIELD_OJPEG_JPEGQTABLES

#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.

◆ FIELD_OJPEG_JPEGRESTARTINTERVAL

#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.

◆ JMP_BUF

#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.

◆ JPEG_MARKER_APP0

#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.

◆ JPEG_MARKER_COM

#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.

◆ JPEG_MARKER_DHT

#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.

◆ JPEG_MARKER_DQT

#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.

◆ JPEG_MARKER_DRI

#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.

◆ JPEG_MARKER_EOI

#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.

◆ JPEG_MARKER_RST0

#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.

◆ JPEG_MARKER_SOF0

#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.

◆ JPEG_MARKER_SOF1

#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.

◆ JPEG_MARKER_SOF3

#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.

◆ JPEG_MARKER_SOI

#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.

◆ JPEG_MARKER_SOS

#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.

◆ LONGJMP

#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.

Parameters
[in]jbufJMP_BUF filled by a still-active SETJMP.
[in]codeValue SETJMP returns after the jump (0 is turned into 1 by longjmp).

Definition at line 184 of file tif_ojpeg.c.

◆ OJPEG_BUFFER

#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.

◆ SETJMP

#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.

Parameters
[out]jbufJMP_BUF lvalue that receives the saved environment.
Returns
0 when called directly; the nonzero LONGJMP code (always 1 in this file) when control returns here through LONGJMP.

Definition at line 169 of file tif_ojpeg.c.

Typedef Documentation

◆ tiff_ojpeg_common_struct

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.

◆ tiff_ojpeg_decompress_struct

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.

◆ tiff_ojpeg_error_mgr

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.

◆ tiff_ojpeg_source_mgr

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.

Enumeration Type Documentation

◆ OJPEGStateInBufferSource

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.

Enumerator
osibsNotSetYet 

No input extent selected yet.

osibsJpegInterchangeFormat 

Read bytes from the interchange-format extent.

osibsStrile 

Read bytes from the current strip or tile extent.

osibsEof 

No further input extents remain.

Definition at line 439 of file tif_ojpeg.c.

◆ OJPEGStateOutState

Next item to emit in the reconstructed JPEG stream.

Stored in OJPEGState::out_state. OJPEGWriteStream emits items in declaration order, skipping absent tables.

Enumerator
ososSoi 

Emit the synthetic start-of-image marker.

ososQTable0 

Emit quantisation table slot 0 when present.

ososQTable1 

Emit quantisation table slot 1 when present.

ososQTable2 

Emit quantisation table slot 2 when present.

ososQTable3 

Emit quantisation table slot 3 when present.

ososDcTable0 

Emit DC Huffman table slot 0 when present.

ososDcTable1 

Emit DC Huffman table slot 1 when present.

ososDcTable2 

Emit DC Huffman table slot 2 when present.

ososDcTable3 

Emit DC Huffman table slot 3 when present.

ososAcTable0 

Emit AC Huffman table slot 0 when present.

ososAcTable1 

Emit AC Huffman table slot 1 when present.

ososAcTable2 

Emit AC Huffman table slot 2 when present.

ososAcTable3 

Emit AC Huffman table slot 3 when present.

ososDri 

Emit the cached restart interval.

ososSof 

Emit the reconstructed frame header.

ososSos 

Emit the current scan header.

ososCompressed 

Borrow the next compressed input chunk.

ososRst 

Emit the next cyclic restart marker.

ososEoi 

Emit the synthetic end-of-image marker.

Definition at line 458 of file tif_ojpeg.c.

Function Documentation

◆ jpeg_create_decompress_encap()

static int jpeg_create_decompress_encap ( OJPEGState *  sp,
tiff_ojpeg_decompress_struct *  cinfo 
)
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.

Parameters
[in,out]spCodec state whose exit_jmpbuf holds the jump frame.
[in,out]cinfolibjpeg decompressor context, normally sp->libjpeg_jpeg_decompress_struct.
Returns
One if the dependency returns normally, zero after a fatal error jump; not the dependency operation result or row count.

Definition at line 4047 of file tif_ojpeg.c.

References OJPEGState::exit_jmpbuf, and SETJMP.

Referenced by OJPEGWriteHeaderInfo().

Here is the caller graph for this function:

◆ jpeg_encap_unwind()

static void jpeg_encap_unwind ( TIFF *  tif)
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.

Parameters
[in]tifHandle 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().

Here is the caller graph for this function:

◆ jpeg_read_header_encap()

static int jpeg_read_header_encap ( OJPEGState *  sp,
tiff_ojpeg_decompress_struct *  cinfo,
uint8_t  require_image 
)
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.

Parameters
[in,out]spCodec state whose exit_jmpbuf holds the jump frame.
[in,out]cinfolibjpeg decompressor context, normally sp->libjpeg_jpeg_decompress_struct.
[in]require_imageNonzero requires an image header rather than tables only.
Returns
One if the dependency returns normally, zero after a fatal error jump; not the dependency operation result or row count.

Definition at line 4061 of file tif_ojpeg.c.

References OJPEGState::exit_jmpbuf, and SETJMP.

Referenced by OJPEGWriteHeaderInfo().

Here is the caller graph for this function:

◆ jpeg_read_raw_data_encap()

static int jpeg_read_raw_data_encap ( OJPEGState *  sp,
tiff_ojpeg_decompress_struct *  cinfo,
void *  data,
uint32_t  max_lines 
)
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.

Parameters
[in,out]spCodec state whose exit_jmpbuf holds the jump frame.
[in,out]cinfolibjpeg decompressor context, normally sp->libjpeg_jpeg_decompress_struct.
[out]dataBorrowed dependency-compatible writable component/row arrays and storage for max_lines rows.
[in]max_linesNumber of rows to read; the codec passes subsampling_ver * 8 (one MCU row).
Returns
One if the dependency returns normally, zero after a fatal error jump; not the dependency operation result or row count.

Definition at line 4105 of file tif_ojpeg.c.

References OJPEGState::exit_jmpbuf, and SETJMP.

Referenced by OJPEGDecodeRaw(), and OJPEGPreDecodeSkipRaw().

Here is the caller graph for this function:

◆ jpeg_read_scanlines_encap()

static int jpeg_read_scanlines_encap ( OJPEGState *  sp,
tiff_ojpeg_decompress_struct *  cinfo,
void *  scanlines,
uint32_t  max_lines 
)
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.

Parameters
[in,out]spCodec state whose exit_jmpbuf holds the jump frame.
[in,out]cinfolibjpeg decompressor context, normally sp->libjpeg_jpeg_decompress_struct.
[out]scanlinesBorrowed dependency-compatible writable row-pointer array and sample storage for max_lines rows.
[in]max_linesMaximum number of rows to read; the codec always passes 1.
Returns
One if the dependency returns normally, zero after a fatal error jump; not the dependency operation result or row count.

Definition at line 4090 of file tif_ojpeg.c.

References OJPEGState::exit_jmpbuf, and SETJMP.

Referenced by OJPEGDecodeScanlines(), and OJPEGPreDecodeSkipScanlines().

Here is the caller graph for this function:

◆ jpeg_start_decompress_encap()

static int jpeg_start_decompress_encap ( OJPEGState *  sp,
tiff_ojpeg_decompress_struct *  cinfo 
)
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.

Parameters
[in,out]spCodec state whose exit_jmpbuf holds the jump frame.
[in,out]cinfolibjpeg decompressor context, normally sp->libjpeg_jpeg_decompress_struct.
Returns
One if the dependency returns normally, zero after a fatal error jump; not the dependency operation result or row count.

Definition at line 4076 of file tif_ojpeg.c.

References OJPEGState::exit_jmpbuf, and SETJMP.

Referenced by OJPEGWriteHeaderInfo().

Here is the caller graph for this function:

◆ OJPEGCleanup()

static void OJPEGCleanup ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGDecode()

static int OJPEGDecode ( TIFF *  tif,
uint8_t *  buf,
tmsize_t  cc,
uint16_t  s 
)
static

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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[out]bufWritable output of cc bytes.
[in]ccNumber of bytes to decode; unless it is a positive multiple of bytes_per_line the raw or scanline decoder fails.
[in]sSample index; unused (the plane is selected by OJPEGPreDecode).
Returns
One on wrapper completion, zero on detected failure with requested output cleared.

Definition at line 1546 of file tif_ojpeg.c.

References OJPEGDecodeRaw(), OJPEGDecodeScanlines(), tiff::tif_data, and TIFFErrorExtR().

Referenced by TIFFInitOJPEG().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGDecodeRaw()

static int OJPEGDecodeRaw ( TIFF *  tif,
uint8_t *  buf,
tmsize_t  cc 
)
static

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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[out]bufWritable output of cc bytes.
[in]ccNumber of bytes to decode; zero is returned unless it is a positive multiple of bytes_per_line.
Returns
One after decoding cc bytes, zero on an invalid cc or if libjpeg reports a fatal error; partial output remains.

Definition at line 1616 of file tif_ojpeg.c.

References jpeg_read_raw_data_encap(), tiff::tif_data, and TIFFErrorExtR().

Referenced by OJPEGDecode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGDecodeScanlines()

static int OJPEGDecodeScanlines ( TIFF *  tif,
uint8_t *  buf,
tmsize_t  cc 
)
static

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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[out]bufWritable output of cc bytes.
[in]ccNumber of bytes to decode; zero is returned unless it is a positive multiple of bytes_per_line.
Returns
One after decoding cc bytes, zero on an invalid cc or if libjpeg reports a fatal error; partial output remains.

Definition at line 1701 of file tif_ojpeg.c.

References jpeg_read_scanlines_encap(), tiff::tif_data, and TIFFErrorExtR().

Referenced by OJPEGDecode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGEncode()

static int OJPEGEncode ( TIFF *  tif,
uint8_t *  buf,
tmsize_t  cc,
uint16_t  s 
)
static

Reject unsupported old-style JPEG encoding.

Always reports an error recommending new-style JPEG compression.

Parameters
[in]tifHandle used for the error report.
[in]bufUnused.
[in]ccUnused.
[in]sUnused.
Returns
Zero unconditionally.

Definition at line 1815 of file tif_ojpeg.c.

References TIFFErrorExtR().

Referenced by TIFFInitOJPEG().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGFixupTags()

static int OJPEGFixupTags ( TIFF *  tif)
static

Accept the old-style JPEG directory without eager fixups.

No-op compatibility hook; does not inspect input, allocate or alter metadata.

Parameters
[in]tifUnused.
Returns
One unconditionally.

Definition at line 1322 of file tif_ojpeg.c.

Referenced by TIFFInitOJPEG().

Here is the caller graph for this function:

◆ OJPEGLibjpegJpegErrorMgrErrorExit()

static void OJPEGLibjpegJpegErrorMgrErrorExit ( tiff_ojpeg_common_struct *  cinfo)
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.

Parameters
[in]cinfolibjpeg 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGLibjpegJpegErrorMgrOutputMessage()

static void OJPEGLibjpegJpegErrorMgrOutputMessage ( tiff_ojpeg_common_struct *  cinfo)
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.

Parameters
[in]cinfolibjpeg 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGLibjpegJpegSourceMgrFillInputBuffer()

static boolean OJPEGLibjpegJpegSourceMgrFillInputBuffer ( tiff_ojpeg_decompress_struct *  cinfo)
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.

Parameters
[in,out]cinfolibjpeg context whose client_data is the TIFF handle; its source manager (sp->libjpeg_jpeg_source_mgr) receives the chunk.
Returns
One after assigning input; failure leaves by nonlocal jump.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGLibjpegJpegSourceMgrInitSource()

static void OJPEGLibjpegJpegSourceMgrInitSource ( tiff_ojpeg_decompress_struct *  cinfo)
static

Accept the dependency source initialization.

No-op callback; cinfo is unused. Does not allocate, perform I/O, free borrowed input or transfer ownership.

Parameters
[in]cinfoUnused.

Definition at line 4175 of file tif_ojpeg.c.

Referenced by OJPEGWriteHeaderInfo().

Here is the caller graph for this function:

◆ OJPEGLibjpegJpegSourceMgrResyncToRestart()

static boolean OJPEGLibjpegJpegSourceMgrResyncToRestart ( tiff_ojpeg_decompress_struct *  cinfo,
int  desired 
)
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.

Parameters
[in]cinfolibjpeg context whose client_data is the TIFF handle.
[in]desiredUnused desired restart marker.
Returns
Zero only as an unreachable fallback; ordinary failure leaves by nonlocal jump.

Definition at line 4250 of file tif_ojpeg.c.

References jpeg_encap_unwind(), and TIFFErrorExtR().

Referenced by OJPEGWriteHeaderInfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGLibjpegJpegSourceMgrSkipInputData()

static void OJPEGLibjpegJpegSourceMgrSkipInputData ( tiff_ojpeg_decompress_struct *  cinfo,
long  num_bytes 
)
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.

Parameters
[in]cinfolibjpeg context whose client_data is the TIFF handle.
[in]num_bytesUnused dependency skip request.

Definition at line 4223 of file tif_ojpeg.c.

References jpeg_encap_unwind(), and TIFFErrorExtR().

Referenced by OJPEGWriteHeaderInfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGLibjpegJpegSourceMgrTermSource()

static void OJPEGLibjpegJpegSourceMgrTermSource ( tiff_ojpeg_decompress_struct *  cinfo)
static

Accept the dependency source termination.

No-op callback; cinfo is unused. Does not allocate, perform I/O, free borrowed input or transfer ownership.

Parameters
[in]cinfoUnused.

Definition at line 4273 of file tif_ojpeg.c.

Referenced by OJPEGWriteHeaderInfo().

Here is the caller graph for this function:

◆ OJPEGLibjpegSessionAbort()

static void OJPEGLibjpegSessionAbort ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-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().

Here is the caller graph for this function:

◆ OJPEGPostDecode()

static void OJPEGPostDecode ( TIFF *  tif,
uint8_t *  buf,
tmsize_t  cc 
)
static

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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[in]bufUnused.
[in]ccUnused.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGPostEncode()

static int OJPEGPostEncode ( TIFF *  tif)
static

Reject unsupported old-style JPEG encoding.

Always reports an error recommending new-style JPEG compression.

Parameters
[in]tifHandle used for the error report.
Returns
Zero unconditionally.

Definition at line 1836 of file tif_ojpeg.c.

References TIFFErrorExtR().

Referenced by TIFFInitOJPEG().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGPreDecode()

static int OJPEGPreDecode ( TIFF *  tif,
uint16_t  s 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[in]sSample (plane) index: 0 for contiguous data, 0..2 for separate planes; selects the cached scan in sos_end.
Returns
One on completion, zero on detected malformed input, allocation or dependency/I/O failure; partial state and client effects remain.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGPreDecodeSkipRaw()

static int OJPEGPreDecodeSkipRaw ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
Returns
One on completion, zero if libjpeg reports a fatal error.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGPreDecodeSkipScanlines()

static int OJPEGPreDecodeSkipScanlines ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
Returns
One on completion, zero on allocation failure or if libjpeg reports a fatal error.

Definition at line 1502 of file tif_ojpeg.c.

References _TIFFmallocExt(), jpeg_read_scanlines_encap(), tiff::tif_data, and TIFFErrorExtR().

Referenced by OJPEGPreDecode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGPreEncode()

static int OJPEGPreEncode ( TIFF *  tif,
uint16_t  s 
)
static

Reject unsupported old-style JPEG encoding.

Always reports an error recommending new-style JPEG compression.

Parameters
[in]tifHandle used for the error report.
[in]sUnused.
Returns
Zero unconditionally.

Definition at line 1793 of file tif_ojpeg.c.

References TIFFErrorExtR().

Referenced by TIFFInitOJPEG().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGPrintDir()

static void OJPEGPrintDir ( TIFF *  tif,
FILE *  fd,
long  flags 
)
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.

Parameters
[in]tifHandle whose codec state supplies the printed values.
[in,out]fdBorrowed writable FILE, retained by caller.
[in]flagsPrint 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().

Here is the caller graph for this function:

◆ OJPEGReadBlock()

static int OJPEGReadBlock ( OJPEGState *  sp,
uint16_t  len,
void *  mem 
)
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.

Parameters
[in,out]spCodec state whose input window is consumed and refilled as needed.
[in]lenNumber of bytes to copy; must be positive (asserted).
[out]memDestination of at least len writable bytes.
Returns
One after complete output, zero on refill/read failure.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadBufferFill()

static int OJPEGReadBufferFill ( OJPEGState *  sp)
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.

Parameters
[in,out]spCodec state whose input window, source and extent cursors are updated.
Returns
One with nonempty input, zero at EOF or detected read/metadata failure.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadByte()

static int OJPEGReadByte ( OJPEGState *  sp,
uint8_t *  byte 
)
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.

Parameters
[in,out]spCodec state whose input window is consumed and refilled as needed.
[out]byteNon-NULL caller-owned byte result.
Returns
One after complete output, zero on refill/read failure.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadByteAdvance()

static void OJPEGReadByteAdvance ( OJPEGState *  sp)
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.

Parameters
[in,out]spCodec 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().

Here is the caller graph for this function:

◆ OJPEGReadBytePeek()

static int OJPEGReadBytePeek ( OJPEGState *  sp,
uint8_t *  byte 
)
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.

Parameters
[in,out]spCodec state whose input window may be refilled; the cursor is not advanced.
[out]byteNon-NULL caller-owned byte result.
Returns
One after complete output, zero on refill/read failure.

Definition at line 3469 of file tif_ojpeg.c.

References OJPEGState::in_buffer_cur, OJPEGState::in_buffer_togo, and OJPEGReadBufferFill().

Referenced by OJPEGReadHeaderInfoSec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadHeaderInfo()

static int OJPEGReadHeaderInfo ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
Returns
One on completion, zero on unsupported SamplesPerPixel or sampling/strile geometry, malformed header data, allocation or read failure; partial state and file position changes remain.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadHeaderInfoSec()

static int OJPEGReadHeaderInfoSec ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
Returns
One on completion (in sampling-only mode, once an SOF or SOS marker is reached), zero on a malformed or unknown marker, allocation or read failure; partial state and file position changes remain.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadHeaderInfoSecStreamDht()

static int OJPEGReadHeaderInfoSecStreamDht ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
Returns
One on completion, zero on a malformed marker, allocation failure or short read; earlier table replacements and input progress remain.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadHeaderInfoSecStreamDqt()

static int OJPEGReadHeaderInfoSecStreamDqt ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
Returns
One on completion, zero on a malformed marker, allocation failure or short read; earlier table replacements and input progress remain.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadHeaderInfoSecStreamDri()

static int OJPEGReadHeaderInfoSecStreamDri ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
Returns
One on success, zero on a bad marker length or a short read.

Definition at line 2621 of file tif_ojpeg.c.

References OJPEGReadWord(), tiff::tif_data, and TIFFErrorExtR().

Referenced by OJPEGReadHeaderInfoSec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadHeaderInfoSecStreamSof()

static int OJPEGReadHeaderInfoSecStreamSof ( TIFF *  tif,
uint8_t  marker_id 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[in]marker_idSupported SOF marker code.
Returns
One on success, zero on an invalid or unsupported frame header or a short read.

Definition at line 2833 of file tif_ojpeg.c.

References OJPEGReadByte(), OJPEGReadSkip(), OJPEGReadWord(), tiff::tif_data, and TIFFErrorExtR().

Referenced by OJPEGReadHeaderInfoSec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadHeaderInfoSecStreamSos()

static int OJPEGReadHeaderInfoSecStreamSos ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
Returns
One on success, zero on a malformed SOS marker (diagnosed) or a short read (no codec diagnostic).

Definition at line 3018 of file tif_ojpeg.c.

References OJPEGReadByte(), OJPEGReadSkip(), OJPEGReadWord(), tiff::tif_data, and TIFFErrorExtR().

Referenced by OJPEGReadHeaderInfoSec(), and OJPEGReadSecondarySos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadHeaderInfoSecTablesAcTable()

static int OJPEGReadHeaderInfoSecTablesAcTable ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
Returns
One on success; zero on a missing or duplicated offset or allocation failure (diagnosed), or on a short read (not diagnosed).

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadHeaderInfoSecTablesDcTable()

static int OJPEGReadHeaderInfoSecTablesDcTable ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
Returns
One on success; zero on a missing or duplicated offset or allocation failure (diagnosed), or on a short read (not diagnosed).

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadHeaderInfoSecTablesQTable()

static int OJPEGReadHeaderInfoSecTablesQTable ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
Returns
One on success; zero on a missing or duplicated offset or allocation failure (diagnosed), or on a short read (not diagnosed).

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadSecondarySos()

static int OJPEGReadSecondarySos ( TIFF *  tif,
uint16_t  s 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[in]sSeparate-plane sample index in 1..2 (asserted).
Returns
One on success, zero on a short read or a malformed SOS marker; does not allocate.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGReadSkip()

static void OJPEGReadSkip ( OJPEGState *  sp,
uint16_t  len 
)
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.

Parameters
[in,out]spCodec state whose input window and file extent cursors are advanced.
[in]lenNumber 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().

Here is the caller graph for this function:

◆ OJPEGReadWord()

static int OJPEGReadWord ( OJPEGState *  sp,
uint16_t *  word 
)
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.

Parameters
[in,out]spCodec state whose input window is consumed and refilled as needed.
[out]wordNon-NULL caller-owned word result; can be partial on failure.
Returns
One after complete output, zero on refill/read failure.

Definition at line 3514 of file tif_ojpeg.c.

References OJPEGReadByte().

Referenced by OJPEGReadHeaderInfoSec(), OJPEGReadHeaderInfoSecStreamDht(), OJPEGReadHeaderInfoSecStreamDqt(), OJPEGReadHeaderInfoSecStreamDri(), OJPEGReadHeaderInfoSecStreamSof(), and OJPEGReadHeaderInfoSecStreamSos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGSetupDecode()

static int OJPEGSetupDecode ( TIFF *  tif)
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.

Parameters
[in]tifHandle used for the warning.
Returns
One unconditionally.

Definition at line 1338 of file tif_ojpeg.c.

References TIFFWarningExtR().

Referenced by TIFFInitOJPEG().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGSetupEncode()

static int OJPEGSetupEncode ( TIFF *  tif)
static

Reject unsupported old-style JPEG encoding.

Always reports an error recommending new-style JPEG compression.

Parameters
[in]tifHandle used for the error report.
Returns
Zero unconditionally.

Definition at line 1774 of file tif_ojpeg.c.

References TIFFErrorExtR().

Referenced by TIFFInitOJPEG().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGSubsamplingCorrect()

static void OJPEGSubsamplingCorrect ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGVGetField()

static int OJPEGVGetField ( TIFF *  tif,
uint32_t  tag,
va_list  ap 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[in]tagHandled old-style JPEG/related tag or parent-delegated identifier.
[in,out]apLive tag-specific va_list cursor, consumed synchronously without retention.
Returns
One for a handled tag, otherwise parent status.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGVSetField()

static int OJPEGVSetField ( TIFF *  tif,
uint32_t  tag,
va_list  ap 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[in]tagHandled old-style JPEG/related tag or parent-delegated identifier.
[in,out]apLive tag-specific va_list cursor, consumed synchronously without retention.
Returns
One after handled tag bookkeeping, zero on rejected count/field lookup, otherwise parent status.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGWriteHeaderInfo()

static int OJPEGWriteHeaderInfo ( TIFF *  tif)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
Returns
One once decompression has started; zero if a session from an earlier attempt is still active, on allocation failure or size overflow, on a libjpeg fatal error, or when libjpeg reports a width or sampling mismatch. An active session and buffers are left for cleanup.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGWriteStream()

static int OJPEGWriteStream ( TIFF *  tif,
void **  mem,
uint32_t *  len 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[out]memSet to the start of the produced chunk on success.
[out]lenSet to 0 on entry, then to the nonzero chunk length on success; not preserved on failure.
Returns
One after producing a chunk, zero on compressed-input 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGWriteStreamAcTable()

static void OJPEGWriteStreamAcTable ( TIFF *  tif,
uint8_t  table_index,
void **  mem,
uint32_t *  len 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[in]table_indexTable slot in 0..3.
[out]memSet to the stored marker when the table is present; otherwise unchanged.
[out]lenSet 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().

Here is the caller graph for this function:

◆ OJPEGWriteStreamCompressed()

static int OJPEGWriteStreamCompressed ( TIFF *  tif,
void **  mem,
uint32_t *  len 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[out]memSet to the unread part of in_buffer on success.
[out]lenSet to the number of unread bytes on success.
Returns
One on success, zero if refilling the input buffer fails (seek or read failure, or no more input), with no codec diagnostic.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OJPEGWriteStreamDcTable()

static void OJPEGWriteStreamDcTable ( TIFF *  tif,
uint8_t  table_index,
void **  mem,
uint32_t *  len 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[in]table_indexTable slot in 0..3.
[out]memSet to the stored marker when the table is present; otherwise unchanged.
[out]lenSet 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().

Here is the caller graph for this function:

◆ OJPEGWriteStreamDri()

static void OJPEGWriteStreamDri ( TIFF *  tif,
void **  mem,
uint32_t *  len 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[out]memSet to sp->out_buffer when a DRI marker is emitted; otherwise unchanged.
[out]lenSet 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().

Here is the caller graph for this function:

◆ OJPEGWriteStreamEoi()

static void OJPEGWriteStreamEoi ( TIFF *  tif,
void **  mem,
uint32_t *  len 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[out]memSet to sp->out_buffer, which holds the marker.
[out]lenSet 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().

Here is the caller graph for this function:

◆ OJPEGWriteStreamQTable()

static void OJPEGWriteStreamQTable ( TIFF *  tif,
uint8_t  table_index,
void **  mem,
uint32_t *  len 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[in]table_indexTable slot in 0..3.
[out]memSet to the stored marker when the table is present; otherwise unchanged.
[out]lenSet 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().

Here is the caller graph for this function:

◆ OJPEGWriteStreamRst()

static void OJPEGWriteStreamRst ( TIFF *  tif,
void **  mem,
uint32_t *  len 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[out]memSet to sp->out_buffer, which holds the marker.
[out]lenSet 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().

Here is the caller graph for this function:

◆ OJPEGWriteStreamSof()

static void OJPEGWriteStreamSof ( TIFF *  tif,
void **  mem,
uint32_t *  len 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[out]memSet to sp->out_buffer, which holds the marker.
[out]lenSet 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().

Here is the caller graph for this function:

◆ OJPEGWriteStreamSoi()

static void OJPEGWriteStreamSoi ( TIFF *  tif,
void **  mem,
uint32_t *  len 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[out]memSet to sp->out_buffer, which holds the marker.
[out]lenSet 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().

Here is the caller graph for this function:

◆ OJPEGWriteStreamSos()

static void OJPEGWriteStreamSos ( TIFF *  tif,
void **  mem,
uint32_t *  len 
)
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.

Parameters
[in,out]tifNon-NULL live handle with compatible old-style JPEG state and directory; serialise access.
[out]memSet to sp->out_buffer, which holds the marker.
[out]lenSet 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().

Here is the caller graph for this function:

◆ TIFFInitOJPEG()

int TIFFInitOJPEG ( TIFF *  tif,
int  scheme 
)
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.

Parameters
[in,out]tifNon-NULL handle whose previous codec state has been cleaned up; receives the new codec state. Serialise access.
[in]schemeCOMPRESSION_OJPEG, asserted in debug builds.
Returns
One after installation, zero on field/allocation failure.

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.

Here is the call graph for this function:

Variable Documentation

◆ ojpegFields

const TIFFField ojpegFields[]
static
Initial value:
= {
FIELD_OJPEG_JPEGINTERCHANGEFORMAT, TRUE, FALSE, "JpegInterchangeFormat",
NULL},
"JpegInterchangeFormatLength", NULL},
"JpegQTables", NULL},
"JpegDcTables", NULL},
"JpegAcTables", NULL},
FIELD_OJPEG_JPEGPROC, FALSE, FALSE, "JpegProc", NULL},
FIELD_OJPEG_JPEGRESTARTINTERVAL, FALSE, FALSE, "JpegRestartInterval",
NULL},
}
@ TIFF_SETGET_UINT64
Unsigned 64-bit scalar storage.
Definition tif_dir.h:752
@ TIFF_SETGET_UINT16
Unsigned 16-bit scalar storage.
Definition tif_dir.h:744
@ TIFF_SETGET_C32_UINT64
Unsigned 64-bit array with 32-bit explicit count.
Definition tif_dir.h:828
#define FIELD_OJPEG_JPEGACTABLES
TIFFField field bit for the codec-private JpegAcTables tag.
Definition tif_ojpeg.c:343
#define FIELD_OJPEG_JPEGINTERCHANGEFORMATLENGTH
TIFFField field bit for the codec-private JpegInterchangeFormatLength tag.
Definition tif_ojpeg.c:319
#define FIELD_OJPEG_JPEGPROC
TIFFField field bit for the codec-private JpegProc tag.
Definition tif_ojpeg.c:351
#define FIELD_OJPEG_JPEGQTABLES
TIFFField field bit for the codec-private JpegQTables tag.
Definition tif_ojpeg.c:327
#define FIELD_OJPEG_JPEGDCTABLES
TIFFField field bit for the codec-private JpegDcTables tag.
Definition tif_ojpeg.c:335
#define FIELD_OJPEG_JPEGRESTARTINTERVAL
TIFFField field bit for the codec-private JpegRestartInterval tag.
Definition tif_ojpeg.c:359
#define FIELD_OJPEG_JPEGINTERCHANGEFORMAT
TIFFField field bit for the codec-private JpegInterchangeFormat tag.
Definition tif_ojpeg.c:310
#define TRUE
Represent the legacy internal true value.
Definition tiffiop.h:131
#define FALSE
Represent the legacy internal false value.
Definition tiffiop.h:136
#define TIFF_VARIABLE2
Mark a variable-length field with a 32-bit count convention.
Definition tiffio.h:1310
#define TIFFTAG_JPEGDCTABLES
TIFF tag: DCT table offsets (introduced in TIFF 6.0).
Definition tiff.h:723
#define TIFFTAG_JPEGQTABLES
TIFF tag: Q matrix offsets (introduced in TIFF 6.0).
Definition tiff.h:721
#define TIFFTAG_JPEGIFBYTECOUNT
TIFF tag: JFIF stream length (introduced in TIFF 6.0).
Definition tiff.h:713
#define TIFFTAG_JPEGACTABLES
TIFF tag: AC coefficient offsets (introduced in TIFF 6.0).
Definition tiff.h:725
#define TIFFTAG_JPEGRESTARTINTERVAL
TIFF tag: Restart interval length (introduced in TIFF 6.0).
Definition tiff.h:715
#define TIFFTAG_JPEGIFOFFSET
TIFF tag: Pointer to SOI marker (introduced in TIFF 6.0).
Definition tiff.h:711
#define TIFFTAG_JPEGPROC
TIFF tag: JPEG processing algorithm (introduced in TIFF 6.0).
Definition tiff.h:705
@ TIFF_SHORT
Unsigned 16-bit integer.
Definition tiff.h:237
@ TIFF_LONG8
BigTIFF unsigned 64-bit integer.
Definition tiff.h:259

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().