|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Transfer complete JBIG image planes through strip callbacks. More...
Functions | |
| static int | JBIGSetupDecode (TIFF *tif) |
| Require one strip for JBIG decoding. | |
| static int | JBIGDecode (TIFF *tif, uint8_t *buffer, tmsize_t size, uint16_t s) |
| Decode one complete JBIG plane into caller storage. | |
| static int | JBIGSetupEncode (TIFF *tif) |
| Require one strip for JBIG encoding. | |
| static int | JBIGCopyEncodedData (TIFF *tif, unsigned char *pp, size_t cc, uint16_t s) |
| Copy JBIG output fragments into the buffered raw stream. | |
| static void | JBIGOutputBie (unsigned char *buffer, size_t len, void *userData) |
| Reverse and forward a dependency-produced JBIG output fragment. | |
| static int | JBIGEncode (TIFF *tif, uint8_t *buffer, tmsize_t size, uint16_t s) |
| Encode a complete single-sample one-bit JBIG image plane. | |
| int | TIFFInitJBIG (TIFF *tif, int scheme) |
| Install single-strip JBIG callbacks and mutable raw-input policy. | |
Transfer complete JBIG image planes through strip callbacks.
|
static |
Copy JBIG output fragments into the buffered raw stream.
Requires positive usable raw capacity, coherent cursor/counts and a cc extent representable by tmsize_t. Copies borrowed bytes, advances cursors and flushes full buffers. I/O/diagnostic side effects can leave partial file data on failure. Does not retain input or transfer ownership.
| [in,out] | tif | Non-NULL live JBIG handle with coherent writable raw storage and validated single-strip geometry; serialise access. |
| [in] | pp | Borrowed readable dependency output of cc bytes, valid only during the call. |
| [in] | cc | Byte extent representable by tmsize_t with valid cursor additions. |
| [in] | s | Unused sample-plane argument. |
Definition at line 253 of file tif_jbig.c.
References _TIFFmemcpy(), tiff::tif_rawcc, tiff::tif_rawcp, tiff::tif_rawdatasize, and TIFFFlushData1().
Referenced by JBIGOutputBie().
Decode one complete JBIG plane into caller storage.
May reverse raw input bits in place and optionally update BIE length without checking that helper status. Creates a temporary dependency decoder, decodes all raw input and frees it on every ordinary exit. Dependency error clears requested output and diagnoses; a decoded image smaller than the request warns and zero-pads, while a larger image, one whose size is not representable as tmsize_t, or a missing decoded image is diagnosed and clears requested output before rejection. Success copies plane zero then consumes all raw bytes; failure can leave raw bytes reversed or output changed. No caller ownership transfer or direct client I/O.
| [in,out] | tif | Non-NULL live JBIG handle with coherent writable raw storage and validated single-strip geometry; serialise access. |
| [out] | buffer | Borrowed writable size-byte output, disjoint from raw input. |
| [in] | size | Nonnegative output byte extent; bytes beyond a shorter decoded plane are zeroed. |
| [in] | s | Unused sample-plane argument. |
Definition at line 98 of file tif_jbig.c.
References _TIFFmemcpy(), isFillOrder, TIFFDirectory::td_fillorder, tiff::tif_dir, tiff::tif_rawcc, tiff::tif_rawcp, TIFF_SSIZE_FORMAT, TIFF_TMSIZE_T_MAX, TIFFErrorExtR(), TIFFReverseBits(), and TIFFWarningExtR().
Referenced by TIFFInitJBIG().
Encode a complete single-sample one-bit JBIG image plane.
Validates bit depth, sample count and single-strip organisation, computes a checked complete-plane extent and rejects short input. Creates a temporary dependency encoder referencing caller bytes synchronously, emits data through JBIGOutputBie and frees encoder state. Caller input is not modified by this function. Output callback flush status is ignored, so encoder success does not prove successful payload writes. No caller ownership transfer; output/file changes are not transactional.
| [in,out] | tif | Non-NULL live JBIG handle with coherent writable raw storage; geometry is checked here. Serialise access. |
| [in] | buffer | Borrowed readable complete image plane of at least size bytes. |
| [in] | size | Byte count available in buffer; must be at least the complete plane size. |
| [in] | s | Unused sample-plane argument. |
Definition at line 334 of file tif_jbig.c.
References _TIFFCastUInt64ToSSize(), _TIFFMultiply64(), JBIGOutputBie(), tiff::tif_dir, TIFF_SSIZE_FORMAT, TIFFErrorExtR(), TIFFhowmany8_64, and TIFFNumberOfStrips().
Referenced by TIFFInitJBIG().
|
static |
Reverse and forward a dependency-produced JBIG output fragment.
Borrows writable dependency output and the handle context. Reverses bits when required then calls JBIGCopyEncodedData, ignoring its status because this void callback has no error channel. Flush failures can diagnose and mutate file/cache state without propagating to the outer encoder. No retained output pointer or ownership transfer.
| [in,out] | buffer | Borrowed mutable dependency-produced output of len bytes; not retained. |
| [in] | len | Mutable dependency output extent representable by tmsize_t. |
| [in,out] | userData | Borrowed live TIFF handle supplied to the dependency output callback. |
Definition at line 298 of file tif_jbig.c.
References isFillOrder, JBIGCopyEncodedData(), TIFFDirectory::td_fillorder, tiff::tif_dir, and TIFFReverseBits().
Referenced by JBIGEncode().
|
static |
Require one strip for JBIG decoding.
Checks the current logical strip count and diagnoses rejection. Does not validate every sample/geometry constraint, allocate, access payload or transfer ownership.
| [in] | tif | Non-NULL live JBIG handle whose strip count is checked. |
Definition at line 61 of file tif_jbig.c.
References TIFFErrorExtR(), and TIFFNumberOfStrips().
Referenced by TIFFInitJBIG().
|
static |
Require one strip for JBIG encoding.
Checks the strip count and diagnoses rejection. Does not itself validate sample depth, allocate or perform payload I/O. No ownership transfer.
| [in] | tif | Non-NULL live JBIG handle whose strip count is checked. |
Definition at line 223 of file tif_jbig.c.
References TIFFErrorExtR(), and TIFFNumberOfStrips().
Referenced by TIFFInitJBIG().
|
extern |
Install single-strip JBIG callbacks and mutable raw-input policy.
Requires cleaned-up previous codec state and COMPRESSION_JBIG. Sets NOBITREV, clears MAPPED, and detaches a previously mapped raw view while restoring owned-buffer policy. Does not free the mapping, allocate outer state or perform pixel I/O. Installs strip decode/encode and setup methods; no row or tile transfer support. No ownership transfer of caller storage.
| [in,out] | tif | Non-NULL handle whose previous codec state has been cleaned up; its flags, raw-buffer fields and methods are changed. Serialise access. |
| [in] | scheme | COMPRESSION_JBIG, asserted in debug builds. |
Definition at line 387 of file tif_jbig.c.
References COMPRESSION_JBIG, JBIGDecode(), JBIGEncode(), JBIGSetupDecode(), JBIGSetupEncode(), tiff::tif_decodestrip, tiff::tif_encodestrip, tiff::tif_flags, tiff::tif_rawdata, tiff::tif_rawdatasize, tiff::tif_setupdecode, tiff::tif_setupencode, TIFF_BUFFERMMAP, TIFF_MYBUFFER, and TIFF_NOBITREV.