|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Convert sample representations and colour components. More...
Modules | |
| LogL and LogLuv representations | |
| Convert logarithmic luminance chromaticity and XYZ representations. | |
Functions | |
| void | TIFFSwabShort (uint16_t *wp) |
| Reverse the byte order of one value. | |
| void | TIFFSwabLong (uint32_t *lp) |
| Reverse the byte order of one value. | |
| void | TIFFSwabLong8 (uint64_t *lp) |
| Reverse the byte order of one value. | |
| void | TIFFSwabFloat (float *fp) |
| Reverse the byte order of one value. | |
| void | TIFFSwabDouble (double *dp) |
| Reverse the byte order of one value. | |
| void | TIFFSwabArrayOfShort (uint16_t *wp, tmsize_t n) |
| Reverse the byte order of each array element. | |
| void | TIFFSwabArrayOfTriples (uint8_t *tp, tmsize_t n) |
| Reverse the byte order of each array element. | |
| void | TIFFSwabArrayOfLong (uint32_t *lp, tmsize_t n) |
| Reverse the byte order of each array element. | |
| void | TIFFSwabArrayOfLong8 (uint64_t *lp, tmsize_t n) |
| Reverse the byte order of each array element. | |
| void | TIFFSwabArrayOfFloat (float *fp, tmsize_t n) |
| Reverse the byte order of each array element. | |
| void | TIFFSwabArrayOfDouble (double *dp, tmsize_t n) |
| Reverse the byte order of each array element. | |
| void | TIFFReverseBits (uint8_t *cp, tmsize_t n) |
| Reverse the bit order within each byte of a buffer. | |
| const unsigned char * | TIFFGetBitRevTable (int reversed) |
| Select the immutable byte reversal or identity lookup table. | |
| int | TIFFCIELabToRGBInit (TIFFCIELabToRGB *cielab, const TIFFDisplay *display, float *refWhite) |
| Initialise caller-owned CIE Lab conversion tables and reference white. | |
| void | TIFFCIELabToXYZ (TIFFCIELabToRGB *cielab, uint32_t l, int32_t a, int32_t b, float *X, float *Y, float *Z) |
| Convert 8-bit TIFF CIE L*a*b* samples to XYZ. | |
| void | TIFFXYZToRGB (TIFFCIELabToRGB *cielab, float X, float Y, float Z, uint32_t *r, uint32_t *g, uint32_t *b) |
| Convert XYZ tristimulus values to display RGB channels. | |
| int | TIFFYCbCrToRGBInit (TIFFYCbCrToRGB *ycbcr, float *luma, float *refBlackWhite) |
| Initialise caller-allocated 8-bit YCbCr conversion tables. | |
| void | TIFFYCbCrtoRGB (TIFFYCbCrToRGB *ycbcr, uint32_t Y, int32_t Cb, int32_t Cr, uint32_t *r, uint32_t *g, uint32_t *b) |
| Convert an 8-bit YCbCr sample triplet to clipped RGB. | |
Convert sample representations and colour components.
|
extern |
Initialise caller-owned CIE Lab conversion tables and reference white.
Copies display and white-point values into the supplied complete structure and fills embedded gamma tables. Allocates no storage and retains no input pointers. Requires finite, physically usable coefficients, positive gammas and nonzero usable table steps; inputs are not validated. Current implementation computes all three table steps from the red-channel luminance endpoints. No I/O or diagnostics; caller owns and releases the state.
| [out] | cielab | Non-NULL writable full conversion structure, disjoint from inputs. |
| [in] | display | Non-NULL borrowed display description copied during the call. |
| [in] | refWhite | Borrowed three-float XYZ reference-white array; positive Y. |
Definition at line 162 of file tif_color.c.
References _TIFFmemcpy(), TIFFCIELabToRGB::bstep, CIELABTORGB_TABLE_RANGE, TIFFDisplay::d_gammaB, TIFFDisplay::d_gammaG, TIFFDisplay::d_gammaR, TIFFDisplay::d_Vrwb, TIFFDisplay::d_Vrwg, TIFFDisplay::d_Vrwr, TIFFDisplay::d_Y0R, TIFFDisplay::d_YCR, TIFFCIELabToRGB::display, TIFFCIELabToRGB::gstep, TIFFCIELabToRGB::range, TIFFCIELabToRGB::rstep, TIFFCIELabToRGB::X0, TIFFCIELabToRGB::Y0, TIFFCIELabToRGB::Yb2b, TIFFCIELabToRGB::Yg2g, TIFFCIELabToRGB::Yr2r, and TIFFCIELabToRGB::Z0.
Referenced by initCIELabConversion().
|
extern |
Convert 8-bit TIFF CIE L*a*b* samples to XYZ.
Uses the stored reference white and the piecewise Lab inverse transform. Delegates to TIFFCIELab16ToXYZ() after unsigned luminance scaling by 257 and signed chrominance scaling by 256; out-of-range inputs are not checked and can overflow signed arithmetic. Writes outputs without allocation, I/O, diagnostics, or ownership transfer. Supply finite valid conversion state; this void interface has no error status.
| [in] | cielab | Non-NULL caller-owned state initialised by TIFFCIELabToRGBInit(); retained by caller. |
| [in] | l | Unsigned luminance in 0..255. |
| [in] | a | Signed chrominance in -128..127. |
| [in] | b | Signed chrominance with the same scale/range as a. |
| [out] | X | Non-NULL caller-owned output slot; must not alias the conversion state. |
| [out] | Y | Non-NULL caller-owned output slot; must not alias the conversion state. |
| [out] | Z | Non-NULL caller-owned output slot; must not alias the conversion state. |
Definition at line 50 of file tif_color.c.
References TIFFCIELab16ToXYZ().
Referenced by putcontig8bitCIELab8().
|
extern |
Select the immutable byte reversal or identity lookup table.
Returns static library storage with 256 byte-indexed entries. Keep it read-only and do not free it; valid while the library is loaded. No allocation, mutation, I/O, diagnostics, or failure path.
| [in] | reversed | Nonzero selects reversed bits; zero selects identity. |
Definition at line 325 of file tif_swab.c.
References TIFFBitRevTable, and TIFFNoBitRevTable.
|
extern |
Reverse the bit order within each byte of a buffer.
Byte order is unchanged. Applies the immutable reversal table in place. No allocation, I/O, diagnostics, bounds checking, or ownership transfer; zero length performs no accesses.
| [in,out] | cp | Borrowed writable storage for n bytes. |
| [in] | n | Nonnegative byte count. |
Definition at line 330 of file tif_swab.c.
References TIFFBitRevTable.
Referenced by JBIGDecode(), JBIGOutputBie(), TIFFFillStrip(), TIFFFillStripPartial(), TIFFFillTile(), TIFFFlushData1(), TIFFReadEncodedStrip(), TIFFReadEncodedTile(), TIFFReadFromUserBuffer(), TIFFWriteEncodedStrip(), and TIFFWriteEncodedTile().
|
extern |
Reverse the byte order of each array element.
Swaps bytes in place without interpreting numeric values. No allocation, I/O, diagnostics, bounds checks, or ownership transfer occurs. Caller retains storage; overlapping concurrent access requires external synchronisation. Zero array counts perform no accesses.
| [in,out] | dp | Borrowed writable array of n elements with the declared type alignment; each element spans 8 bytes. |
| [in] | n | Nonnegative element count, not a byte count; storage must cover every element. |
Definition at line 228 of file tif_swab.c.
Referenced by _TIFFSwab64BitData(), and TIFFWriteDirectoryTagCheckedDoubleArray().
|
extern |
Reverse the byte order of each array element.
Swaps bytes in place without interpreting numeric values. No allocation, I/O, diagnostics, bounds checks, or ownership transfer occurs. Caller retains storage; overlapping concurrent access requires external synchronisation. Zero array counts perform no accesses.
| [in,out] | fp | Borrowed writable array of n elements with the declared type alignment; each element spans 4 bytes. |
| [in] | n | Nonnegative element count, not a byte count; storage must cover every element. |
Definition at line 186 of file tif_swab.c.
Referenced by TIFFWriteDirectoryTagCheckedFloatArray().
|
extern |
Reverse the byte order of each array element.
Swaps bytes in place without interpreting numeric values. No allocation, I/O, diagnostics, bounds checks, or ownership transfer occurs. Caller retains storage; overlapping concurrent access requires external synchronisation. Zero array counts perform no accesses.
| [in,out] | lp | Borrowed writable array of n elements with the declared type alignment; each element spans 4 bytes. |
| [in] | n | Nonnegative element count, not a byte count; storage must cover every element. |
Definition at line 123 of file tif_swab.c.
Referenced by _TIFFReadDirEntryCheckedRational(), _TIFFRewriteField(), _TIFFSwab32BitData(), swabHorDiff32(), TIFFFetchNormalTag(), TIFFFetchSubjectDistance(), TIFFReadDirEntryCheckedSrational(), TIFFReadDirEntryDoubleArray(), TIFFReadDirEntryFloatArray(), TIFFReadDirEntryLongArray(), TIFFReadDirEntrySlongArray(), TIFFWriteDirectoryTagCheckedIfdArray(), TIFFWriteDirectoryTagCheckedLongArray(), TIFFWriteDirectoryTagCheckedRationalArray(), TIFFWriteDirectoryTagCheckedRationalDoubleArray(), TIFFWriteDirectoryTagCheckedSlongArray(), TIFFWriteDirectoryTagCheckedSrationalArray(), and TIFFWriteDirectoryTagCheckedSrationalDoubleArray().
|
extern |
Reverse the byte order of each array element.
Swaps bytes in place without interpreting numeric values. No allocation, I/O, diagnostics, bounds checks, or ownership transfer occurs. Caller retains storage; overlapping concurrent access requires external synchronisation. Zero array counts perform no accesses.
| [in,out] | lp | Borrowed writable array of n elements with the declared type alignment; each element spans 8 bytes. |
| [in] | n | Nonnegative element count, not a byte count; storage must cover every element. |
Definition at line 144 of file tif_swab.c.
Referenced by _TIFFRewriteField(), swabHorDiff64(), TIFFReadDirEntryDoubleArray(), TIFFReadDirEntryFloatArray(), TIFFReadDirEntryIfd8Array(), TIFFReadDirEntryLong8ArrayWithLimit(), TIFFReadDirEntrySlong8Array(), TIFFWriteDirectoryTagCheckedIfd8Array(), TIFFWriteDirectoryTagCheckedLong8Array(), and TIFFWriteDirectoryTagCheckedSlong8Array().
|
extern |
Reverse the byte order of each array element.
Swaps bytes in place without interpreting numeric values. No allocation, I/O, diagnostics, bounds checks, or ownership transfer occurs. Caller retains storage; overlapping concurrent access requires external synchronisation. Zero array counts perform no accesses.
| [in,out] | wp | Borrowed writable array of n elements with the declared type alignment; each element spans 2 bytes. |
| [in] | n | Nonnegative element count, not a byte count; storage must cover every element. |
Definition at line 87 of file tif_swab.c.
Referenced by _TIFFRewriteField(), _TIFFSwab16BitData(), PixarLogDecode(), swabHorDiff16(), TIFFReadDirEntryShortArray(), TIFFReadDirEntrySshortArray(), TIFFWriteDirectoryTagCheckedShortArray(), and TIFFWriteDirectoryTagCheckedSshortArray().
|
extern |
Reverse the byte order of each array element.
Swaps bytes in place without interpreting numeric values. For triples, exchanges the first and third bytes of each three-byte group. No allocation, I/O, diagnostics, bounds checks, or ownership transfer occurs. Caller retains storage; overlapping concurrent access requires external synchronisation. Zero array counts perform no accesses.
| [in,out] | tp | Borrowed writable array of n elements with the declared type alignment; each element spans 3 bytes. |
| [in] | n | Nonnegative element count, not a byte count; storage must cover every element. |
Definition at line 105 of file tif_swab.c.
Referenced by _TIFFSwab24BitData().
|
extern |
Reverse the byte order of one value.
Swaps bytes in place without interpreting numeric values. No allocation, I/O, diagnostics, bounds checks, or ownership transfer occurs. Caller retains storage; overlapping concurrent access requires external synchronisation. Zero array counts perform no accesses.
| [in,out] | dp | Borrowed writable single value with the declared type alignment; each element spans 8 bytes. |
Definition at line 207 of file tif_swab.c.
|
extern |
Reverse the byte order of one value.
Swaps bytes in place without interpreting numeric values. No allocation, I/O, diagnostics, bounds checks, or ownership transfer occurs. Caller retains storage; overlapping concurrent access requires external synchronisation. Zero array counts perform no accesses.
| [in,out] | fp | Borrowed writable single value with the declared type alignment; each element spans 4 bytes. |
Definition at line 171 of file tif_swab.c.
|
extern |
Reverse the byte order of one value.
Swaps bytes in place without interpreting numeric values. No allocation, I/O, diagnostics, bounds checks, or ownership transfer occurs. Caller retains storage; overlapping concurrent access requires external synchronisation. Zero array counts perform no accesses.
| [in,out] | lp | Borrowed writable single value with the declared type alignment; each element spans 4 bytes. |
Definition at line 51 of file tif_swab.c.
Referenced by _TIFFPartialReadStripArray(), _TIFFReadDirEntryCheckedRational(), _TIFFRewriteField(), EvaluateIFDdatasizeReading(), TIFFAdvanceDirectory(), TIFFClientOpenExt(), TIFFFetchDirectory(), TIFFFetchSubjectDistance(), TIFFLinkDirectory(), TIFFReadDirEntryArrayWithLimit(), TIFFReadDirEntryByteArray(), TIFFReadDirEntryCheckedDouble(), TIFFReadDirEntryCheckedFloat(), TIFFReadDirEntryCheckedLong(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryCheckedSlong(), TIFFReadDirEntryCheckedSlong8(), TIFFReadDirEntryCheckedSrational(), TIFFReadDirEntryDoubleArray(), TIFFReadDirEntryFloatArray(), TIFFReadDirEntryIfd8Array(), TIFFReadDirEntryLong8ArrayWithLimit(), TIFFReadDirEntryLongArray(), TIFFReadDirEntrySbyteArray(), TIFFReadDirEntryShortArray(), TIFFReadDirEntrySlong8Array(), TIFFReadDirEntrySlongArray(), TIFFReadDirEntrySshortArray(), TIFFRewriteDirectorySec(), TIFFUnlinkDirectory(), TIFFWriteDirectorySec(), TIFFWriteDirectoryTagCheckedLong(), TIFFWriteDirectoryTagCheckedRational(), and TIFFWriteDirectoryTagData().
|
extern |
Reverse the byte order of one value.
Swaps bytes in place without interpreting numeric values. No allocation, I/O, diagnostics, bounds checks, or ownership transfer occurs. Caller retains storage; overlapping concurrent access requires external synchronisation. Zero array counts perform no accesses.
| [in,out] | lp | Borrowed writable single value with the declared type alignment; each element spans 8 bytes. |
Definition at line 66 of file tif_swab.c.
Referenced by _TIFFPartialReadStripArray(), _TIFFRewriteField(), EvaluateIFDdatasizeReading(), TIFFAdvanceDirectory(), TIFFClientOpenExt(), TIFFFetchDirectory(), TIFFLinkDirectory(), TIFFReadDirEntryArrayWithLimit(), TIFFReadDirEntryByteArray(), TIFFReadDirEntryCheckedDouble(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryCheckedSlong8(), TIFFReadDirEntryDoubleArray(), TIFFReadDirEntryFloatArray(), TIFFReadDirEntryLong8ArrayWithLimit(), TIFFReadDirEntryLongArray(), TIFFReadDirEntrySbyteArray(), TIFFReadDirEntryShortArray(), TIFFReadDirEntrySlong8Array(), TIFFReadDirEntrySlongArray(), TIFFReadDirEntrySshortArray(), TIFFRewriteDirectorySec(), TIFFUnlinkDirectory(), TIFFWriteDirectorySec(), and TIFFWriteDirectoryTagData().
|
extern |
Reverse the byte order of one value.
Swaps bytes in place without interpreting numeric values. No allocation, I/O, diagnostics, bounds checks, or ownership transfer occurs. Caller retains storage; overlapping concurrent access requires external synchronisation. Zero array counts perform no accesses.
| [in,out] | wp | Borrowed writable single value with the declared type alignment; each element spans 2 bytes. |
Definition at line 39 of file tif_swab.c.
Referenced by _TIFFPartialReadStripArray(), _TIFFRewriteField(), TIFFAdvanceDirectory(), TIFFClientOpenExt(), TIFFFetchDirectory(), TIFFLinkDirectory(), TIFFReadDirEntryByteArray(), TIFFReadDirEntryCheckedShort(), TIFFReadDirEntryCheckedSshort(), TIFFReadDirEntryDoubleArray(), TIFFReadDirEntryFloatArray(), TIFFReadDirEntryLong8ArrayWithLimit(), TIFFReadDirEntryLongArray(), TIFFReadDirEntrySbyteArray(), TIFFReadDirEntryShortArray(), TIFFReadDirEntrySlong8Array(), TIFFReadDirEntrySlongArray(), TIFFReadDirEntrySshortArray(), TIFFRewriteDirectorySec(), TIFFWriteDirectorySec(), and TIFFWriteDirectoryTagCheckedShort().
|
extern |
Convert XYZ tristimulus values to display RGB channels.
Multiplies the display matrix, clips luminosities, indexes gamma tables, rounds, and caps channels at configured display white values. Requires finite inputs and valid positive table steps; malformed state/NaNs are not generally rejected. No allocation, I/O, diagnostics, or ownership transfer; output slots remain caller-owned and must not alias state.
| [in] | cielab | Non-NULL caller-owned state initialised by TIFFCIELabToRGBInit(); retained by caller. |
| [in] | X | Finite tristimulus component in the configured reference-white scale. |
| [in] | Y | Finite tristimulus component in the configured reference-white scale. |
| [in] | Z | Finite tristimulus component in the configured reference-white scale. |
| [out] | r | Non-NULL writable display-channel result. |
| [out] | g | Non-NULL writable display-channel result. |
| [out] | b | Non-NULL writable display-channel result. |
Definition at line 112 of file tif_color.c.
References TIFFCIELabToRGB::bstep, TIFFDisplay::d_mat, TIFFDisplay::d_Vrwb, TIFFDisplay::d_Vrwg, TIFFDisplay::d_Vrwr, TIFFDisplay::d_Y0B, TIFFDisplay::d_Y0G, TIFFDisplay::d_Y0R, TIFFDisplay::d_YCB, TIFFDisplay::d_YCG, TIFFDisplay::d_YCR, TIFFCIELabToRGB::display, TIFFCIELabToRGB::gstep, TIFFCIELabToRGB::range, RINT, TIFFCIELabToRGB::rstep, TIFFmax, TIFFmin, TIFFCIELabToRGB::Yb2b, TIFFCIELabToRGB::Yg2g, and TIFFCIELabToRGB::Yr2r.
Referenced by putcontig8bitCIELab16(), and putcontig8bitCIELab8().
|
extern |
Convert an 8-bit YCbCr sample triplet to clipped RGB.
Clamps inputs to 0..255, combines initialised fixed-point contribution tables, and clips all outputs to 0..255. No allocation, I/O, diagnostics, state mutation, or ownership transfer. Output slots must not alias the conversion state; state and tables must remain live throughout.
| [in] | ycbcr | Non-NULL caller-owned state and trailing tables initialised by TIFFYCbCrToRGBInit(). |
| [in] | Y | Unsigned luminance, capped at 255. |
| [in] | Cb | Blue chroma code, clamped to 0..255. |
| [in] | Cr | Red chroma code, clamped to 0..255. |
| [out] | r | Non-NULL caller-owned channel result in 0..255. |
| [out] | g | Non-NULL caller-owned channel result in 0..255. |
| [out] | b | Non-NULL caller-owned channel result in 0..255. |
Definition at line 289 of file tif_color.c.
References TIFFYCbCrToRGB::Cb_b_tab, TIFFYCbCrToRGB::Cb_g_tab, CLAMP, TIFFYCbCrToRGB::Cr_g_tab, TIFFYCbCrToRGB::Cr_r_tab, HICLAMP, SHIFT, and TIFFYCbCrToRGB::Y_tab.
Referenced by putseparate8bitYCbCr11tile().
|
extern |
Initialise caller-allocated 8-bit YCbCr conversion tables.
Lays out biased clamp and contribution tables after the structure in the same allocation. See TIFFYCbCrToRGB for the required extra capacity and alignment; sizeof the structure alone is insufficient. Copies coefficients into computed tables without retaining input pointers. Requires finite usable coefficients/reference endpoints; clamps contribution ranges but does not provide comprehensive validation. No allocation, I/O, diagnostics, or ownership transfer. Do not free individual table pointers.
| [out] | ycbcr | Non-NULL suitably aligned writable structure plus all trailing table storage, disjoint from inputs. |
| [in] | luma | Borrowed three-float red/green/blue luma weights; green must support finite division. |
| [in] | refBlackWhite | Borrowed six-float Y/Cb/Cr black-white endpoint pairs. |
Definition at line 354 of file tif_color.c.
References _TIFFmemset(), TIFFYCbCrToRGB::Cb_b_tab, TIFFYCbCrToRGB::Cb_g_tab, CLAMP, TIFFYCbCrToRGB::clamptab, CLAMPw(), Code2V, TIFFYCbCrToRGB::Cr_g_tab, TIFFYCbCrToRGB::Cr_r_tab, FIX, LumaBlue, LumaGreen, LumaRed, ONE_HALF, SHIFT, TIFFroundup_32, and TIFFYCbCrToRGB::Y_tab.
Referenced by initYCbCrConversion().