|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Convert logarithmic luminance chromaticity and XYZ representations. More...
Functions | |
| double | LogL16toY (int p16) |
| Decode 16-bit logarithmic luminance to a linear value. | |
| double | LogL10toY (int p10) |
| Decode 10-bit logarithmic luminance to a linear value. | |
| void | XYZtoRGB24 (float *xyz, uint8_t *rgb) |
| Convert a linear XYZ triplet to display RGB bytes. | |
| int | uv_decode (double *up, double *vp, int c) |
| Decode a quantised chromaticity index to a bin-centre pair. | |
| void | LogLuv24toXYZ (uint32_t p, float *XYZ) |
| Decode one packed 24-bit LogLuv pixel to linear XYZ. | |
| void | LogLuv32toXYZ (uint32_t p, float *XYZ) |
| Decode one packed 32-bit LogLuv pixel to linear XYZ. | |
| int | LogL16fromY (double Y, int em) |
| Encode linear luminance as a 16-bit logarithmic value. | |
| int | LogL10fromY (double Y, int em) |
| Encode linear luminance as a 10-bit logarithmic value. | |
| int | uv_encode (double u, double v, int em) |
| Encode chromaticity using the irregular LogLuv quantisation table. | |
| uint32_t | LogLuv24fromXYZ (float *XYZ, int em) |
| Encode linear XYZ as one packed 24-bit LogLuv pixel. | |
| uint32_t | LogLuv32fromXYZ (float *XYZ, int em) |
| Encode linear XYZ as one packed 32-bit LogLuv pixel. | |
Convert logarithmic luminance chromaticity and XYZ representations.
|
extern |
Encode linear luminance as a 10-bit logarithmic value.
Saturates Y>=15.742 to 1023 and Y<=0.00024283 to zero; quantises the intermediate log2 range. Requires finite Y; NaN can reach an invalid integer conversion. SGILOGENCODE_NODITHER truncates deterministically; other method values use the shared pseudo-random dither state. Serialise dithering across threads; state is seeded from time on first use and is not caller-owned. C++ defaults em to SGILOGENCODE_NODITHER. No allocation, TIFF handle access, client I/O, diagnostics, retained pointers, or ownership transfer occurs. There is no separate error status unless stated.
| [in] | Y | Finite linear luminance; LogL16 supports signed values, LogL10 clips low/nonpositive values to zero. |
| [in] | em | Encoding method, normally SGILOGENCODE_NODITHER or SGILOGENCODE_RANDITHER. |
Definition at line 1567 of file tif_luv.c.
References tiff_itrunc().
Referenced by LogLuv24fromXYZ().
|
extern |
Decode 10-bit logarithmic luminance to a linear value.
Requires a code in 0..1023; zero returns zero, otherwise returns the bin-centre exponential. Does not mask or range-check arbitrary int input. No allocation, TIFF handle access, client I/O, diagnostics, retained pointers, or ownership transfer occurs. There is no separate error status unless stated.
| [in] | p10 | Encoded 10-bit luminance code in 0..1023. |
Definition at line 1557 of file tif_luv.c.
References M_LN2.
Referenced by LogLuv24toXYZ().
|
extern |
Encode linear luminance as a 16-bit logarithmic value.
Saturates magnitudes at approximately 1.8371976e19, maps magnitudes below approximately 5.4136769e-20 to zero, and quantises log2 magnitude with its sign. Negative encodings can be returned as sign-extended int values; inspect the low sixteen bits rather than interpreting a negative result as an error. SGILOGENCODE_NODITHER truncates deterministically; other method values use the shared pseudo-random dither state. Serialise dithering across threads; state is seeded from time on first use and is not caller-owned. C++ defaults em to SGILOGENCODE_NODITHER. No allocation, TIFF handle access, client I/O, diagnostics, retained pointers, or ownership transfer occurs. There is no separate error status unless stated.
| [in] | Y | Finite linear luminance; LogL16 supports signed values, LogL10 clips low/nonpositive values to zero. |
| [in] | em | Encoding method, normally SGILOGENCODE_NODITHER or SGILOGENCODE_RANDITHER. |
Definition at line 1213 of file tif_luv.c.
References tiff_itrunc().
Referenced by L16fromY(), and LogLuv32fromXYZ().
|
extern |
Decode 16-bit logarithmic luminance to a linear value.
Uses the low fifteen magnitude bits and bit fifteen as sign; zero magnitude returns zero, otherwise returns the bin-centre exponential with its encoded sign. No allocation, TIFF handle access, client I/O, diagnostics, retained pointers, or ownership transfer occurs. There is no separate error status unless stated.
| [in] | p16 | Encoded signed LogL16 luminance; only the low sixteen bits are used, with bit fifteen as the sign. |
Definition at line 1199 of file tif_luv.c.
References M_LN2.
Referenced by L16toGry(), L16toY(), and LogLuv32toXYZ().
|
extern |
Encode linear XYZ as one packed 24-bit LogLuv pixel.
Encodes luminance and derives u-prime/v-prime from X+15Y+3Z. Zero encoded luminance or nonpositive sum uses neutral chromaticity. Uses the irregular chromaticity table and hue-preserving perimeter fallback; serialise its first-use initialisation. SGILOGENCODE_NODITHER truncates deterministically; other method values use the shared pseudo-random dither state. Serialise dithering across threads; state is seeded from time on first use and is not caller-owned. C++ defaults em to SGILOGENCODE_NODITHER. No allocation, TIFF handle access, client I/O, diagnostics, retained pointers, or ownership transfer occurs. There is no separate error status unless stated.
| [in] | XYZ | Borrowed readable three-float finite XYZ triplet; arithmetic/quantisation must remain representable. |
| [in] | em | Quantisation/dithering method; C++ defaults to no dither. |
Definition at line 1750 of file tif_luv.c.
References LogL10fromY(), SGILOGENCODE_NODITHER, U_NEU, uv_encode(), and V_NEU.
Referenced by Luv24fromXYZ().
|
extern |
Decode one packed 24-bit LogLuv pixel to linear XYZ.
Extracts ten-bit luminance and fourteen-bit table chromaticity from the low twenty-four bits; invalid chromaticity codes use the neutral pair. Nonpositive luminance produces an all-zero triplet; positive luminance converts bin-centre chromaticity to XYZ. This is quantised representation conversion, not exact round-trip recovery. No allocation, TIFF handle access, client I/O, diagnostics, retained pointers, or ownership transfer occurs. There is no separate error status unless stated.
| [in] | p | Packed 24-bit LogLuv code in the low twenty-four bits; upper eight bits ignored. |
| [out] | XYZ | Non-NULL caller-owned writable three-float result. |
Definition at line 1720 of file tif_luv.c.
References LogL10toY(), U_NEU, uv_decode(), and V_NEU.
Referenced by Luv24toRGB(), and Luv24toXYZ().
|
extern |
Encode linear XYZ as one packed 32-bit LogLuv pixel.
Encodes luminance and derives u-prime/v-prime from X+15Y+3Z. Zero encoded luminance or nonpositive sum uses neutral chromaticity. Quantises scaled chromaticity components and clips codes to 0..255; signed luminance codes are retained in the high word. SGILOGENCODE_NODITHER truncates deterministically; other method values use the shared pseudo-random dither state. Serialise dithering across threads; state is seeded from time on first use and is not caller-owned. C++ defaults em to SGILOGENCODE_NODITHER. No allocation, TIFF handle access, client I/O, diagnostics, retained pointers, or ownership transfer occurs. There is no separate error status unless stated.
| [in] | XYZ | Borrowed readable three-float finite XYZ triplet; arithmetic/quantisation must remain representable. |
| [in] | em | Quantisation/dithering method; C++ defaults to no dither. |
Definition at line 1995 of file tif_luv.c.
References LogL16fromY(), tiff_itrunc(), U_NEU, UVSCALE, and V_NEU.
Referenced by Luv32fromXYZ().
|
extern |
Decode one packed 32-bit LogLuv pixel to linear XYZ.
Extracts signed sixteen-bit luminance and two eight-bit chromaticity components scaled by UVSCALE. Nonpositive luminance produces an all-zero triplet; positive luminance converts bin-centre chromaticity to XYZ. This is quantised representation conversion, not exact round-trip recovery. No allocation, TIFF handle access, client I/O, diagnostics, retained pointers, or ownership transfer occurs. There is no separate error status unless stated.
| [in] | p | Packed 32-bit LogLuv code: signed 16-bit LogL in the high word, 8-bit u and v codes in the low word. |
| [out] | XYZ | Non-NULL caller-owned writable three-float result. |
Definition at line 1970 of file tif_luv.c.
References LogL16toY(), and UVSCALE.
Referenced by Luv32toRGB(), and Luv32toXYZ().
|
extern |
Decode a quantised chromaticity index to a bin-centre pair.
Rejects c outside 0..UV_NDIVS-1 before writing outputs; binary-searches the immutable uv_row table and returns u-prime/v-prime bin centres. Output slots must be separate and non-NULL. No allocation, TIFF handle access, client I/O, diagnostics, retained pointers, or ownership transfer occurs. There is no separate error status unless stated.
| [out] | up | Caller-owned u-prime result; unchanged on invalid code. |
| [out] | vp | Caller-owned v-prime result; unchanged on invalid code. |
| [in] | c | Quantised chromaticity code, valid range 0..16288. |
Definition at line 1686 of file tif_luv.c.
References ustart, UV_NDIVS, UV_NVS, uv_row, UV_SQSIZ, and UV_VSTART.
Referenced by LogLuv24toXYZ(), and Luv24toLuv48().
|
extern |
Encode chromaticity using the irregular LogLuv quantisation table.
Maps NaN coordinates to neutral chromaticity, then selects a table bin. Out-of-gamut values map to a hue-indexed perimeter bin through a lazily initialised shared table. Require finite coordinates after NaN handling and representable quantisation arithmetic; infinities are not generally safe. Serialise first-use perimeter-table initialisation and dithering across threads. SGILOGENCODE_NODITHER truncates deterministically; other method values use the shared pseudo-random dither state. Serialise dithering across threads; state is seeded from time on first use and is not caller-owned. C++ defaults em to SGILOGENCODE_NODITHER. No allocation, TIFF handle access, client I/O, diagnostics, retained pointers, or ownership transfer occurs. There is no separate error status unless stated.
| [in] | u | Finite CIE u-prime coordinate. |
| [in] | v | Finite CIE v-prime coordinate. |
| [in] | em | Quantisation/dithering method; C++ default is no dither. |
Definition at line 1655 of file tif_luv.c.
References ncum, nus, oog_encode(), tiff_itrunc(), U_NEU, ustart, UV_NVS, uv_row, UV_SQSIZ, UV_VSTART, and V_NEU.
Referenced by LogLuv24fromXYZ(), and Luv24fromLuv48().
|
extern |
Convert a linear XYZ triplet to display RGB bytes.
Uses fixed CCIR-709 primary coefficients, clips each linear channel to 0..1 and applies an approximate gamma of two via square root. Requires finite XYZ inputs and disjoint input/output storage. This display transform loses precision and clips out-of-range colours. No allocation, TIFF handle access, client I/O, diagnostics, retained pointers, or ownership transfer occurs. There is no separate error status unless stated.
| [in] | xyz | Borrowed readable three-float XYZ triplet. |
| [out] | rgb | Borrowed writable three-byte RGB triplet. |
Definition at line 1537 of file tif_luv.c.
Referenced by Luv24toRGB(), and Luv32toRGB().