|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Implement SGILog luminance and LogLuv row compression and translation. More...
#include "tiffiop.h"#include <limits.h>#include <math.h>#include <stdio.h>#include <stdlib.h>#include <time.h>#include "uvcode.h"Go to the source code of this file.
Data Structures | |
| struct | logLuvState |
| Own SGILog translation pixels and selected format conversion. More... | |
Macros | |
| #define | DecoderState(tif) ((LogLuvState *)(tif)->tif_data) |
| Borrow handle-owned SGILog decode state. | |
| #define | EncoderState(tif) ((LogLuvState *)(tif)->tif_data) |
| Borrow handle-owned SGILog encode state. | |
| #define | SGILOGDATAFMT_UNKNOWN -1 |
| Mark a user representation not yet inferred. | |
| #define | MINRUN 4 /* minimum run length */ |
| Choose four pixels as the minimum byte-plane run. | |
| #define | M_LN2 0.69314718055994530942 |
| Supply the natural logarithm of two when absent. | |
| #define | M_PI 3.14159265358979323846 |
| Supply pi when absent. | |
| #define | TIFF_RAND_MAX 32767 |
| Limit SGILog pseudo-random output to fifteen bits. | |
| #define | NANGLES 100 |
| Partition the gamut perimeter into one hundred hue angles. | |
| #define | uv2ang(u, v) |
| Map finite chromaticity to a bounded hue lookup angle. | |
| #define | PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f)) |
| Combine directory format fields for a local inference switch. | |
| #define | PACK(a, b) (((a) << 3) | (b)) |
| Combine directory format fields for a local inference switch. | |
Typedefs | |
| typedef struct logLuvState | LogLuvState |
| Name the SGILog codec-owned translation state. | |
Functions | |
| static int | LogLuvReserve (TIFF *tif, uint8_t **opp, tmsize_t *occ, tmsize_t need) |
Flush the raw data buffer when fewer than need bytes remain. | |
| static int | LogLuvFits (TIFF *tif, const char *module, const uint8_t *op, tmsize_t need) |
Verify that need bytes fit before the raw buffer end. | |
| static void | L16toL16 (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Copy encoded luminance words from staging to native caller bytes. | |
| static void | L16fromL16 (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Copy native caller luminance words into staging. | |
| static void | LuvRawToRaw (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Copy packed LogLuv words from staging to native caller bytes. | |
| static void | LuvRawFromRaw (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Copy native caller LogLuv words into staging. | |
| static int | LogL16Decode (TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s) |
| Decode two compressed luminance byte planes and translate one row. | |
| static int | LogLuvDecode24 (TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s) |
| Decode three stored bytes per packed colour pixel and translate one row. | |
| static int | LogLuvDecode32 (TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s) |
| Decode four compressed colour byte planes and translate one row. | |
| static int | LogLuvDecodeStrip (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s) |
| Decode complete SGILog strip rows through the selected row callback. | |
| static int | LogLuvDecodeTile (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s) |
| Decode complete SGILog tile rows through the selected row callback. | |
| static int | LogL16Encode (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s) |
| Translate one input row and emit luminance byte-plane runs. | |
| static int | LogLuvEncode24 (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s) |
| Translate one input row and emit three-byte packed colour pixels. | |
| static int | LogLuvEncode32 (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s) |
| Translate one input row and emit colour byte-plane runs. | |
| static int | LogLuvEncodeStrip (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s) |
| Encode complete SGILog strip rows through the selected row callback. | |
| static int | LogLuvEncodeTile (TIFF *tif, uint8_t *bp, tmsize_t cc, uint16_t s) |
| Encode complete SGILog tile rows through the selected row callback. | |
| static uint32_t | _TIFFRand (void) |
| Advance the shared SGILog pseudo-random dither generator. | |
| static int | tiff_itrunc (double x, int m) |
| Quantise a finite value with optional shared random dithering. | |
| double | LogL16toY (int p16) |
| Decode 16-bit logarithmic luminance to a linear value. | |
| int | LogL16fromY (double Y, int em) |
| Encode linear luminance as a 16-bit logarithmic value. | |
| static float | LogLuvLoadFloatNativeUnaligned (const uint8_t *cp) |
| Read one native-order float through unaligned bytes. | |
| static void | LogLuvStoreFloatNativeUnaligned (uint8_t *cp, float v) |
| Write one native-order float through unaligned bytes. | |
| static int16_t | LogLuvLoad16NativeUnaligned (const uint8_t *cp) |
| Read one native-order signed sixteen-bit value through unaligned bytes. | |
| static void | LogLuvStore16NativeUnaligned (uint8_t *cp, int16_t v) |
| Write one native-order signed sixteen-bit value through unaligned bytes. | |
| static uint32_t | LogLuvLoad32NativeUnaligned (const uint8_t *cp) |
| Read one native-order unsigned thirty-two-bit value through unaligned bytes. | |
| static void | LogLuvStore32NativeUnaligned (uint8_t *cp, uint32_t v) |
| Write one native-order unsigned thirty-two-bit value through unaligned bytes. | |
| static void | L16toY (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Convert staged LogL16 values to native float luminance. | |
| static void | L16toGry (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Convert staged LogL16 values to clipped gamma-two grayscale bytes. | |
| static void | L16fromY (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Quantise native float luminance into staged LogL16 codes. | |
| void | XYZtoRGB24 (float *xyz, uint8_t *rgb) |
| Convert a linear XYZ triplet to display RGB bytes. | |
| double | LogL10toY (int p10) |
| Decode 10-bit logarithmic luminance to a linear value. | |
| int | LogL10fromY (double Y, int em) |
| Encode linear luminance as a 10-bit logarithmic value. | |
| static int | oog_encode (double u, double v) |
| Map out-of-gamut chromaticity to a hue-matched boundary bin. | |
| int | uv_encode (double u, double v, int em) |
| Encode chromaticity using the irregular LogLuv quantisation table. | |
| 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. | |
| uint32_t | LogLuv24fromXYZ (float *XYZ, int em) |
| Encode linear XYZ as one packed 24-bit LogLuv pixel. | |
| static void | Luv24toXYZ (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Convert staged LogLuv24 codes to native float XYZ triplets. | |
| static void | Luv24toLuv48 (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Convert staged LogLuv24 codes to native signed Luv triplets. | |
| static void | Luv24toRGB (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Convert staged LogLuv24 codes to clipped gamma-two RGB bytes. | |
| static void | Luv24fromXYZ (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Quantise native float XYZ triplets into LogLuv24 staging. | |
| static void | Luv24fromLuv48 (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Quantise native signed Luv triplets into LogLuv24 staging. | |
| void | LogLuv32toXYZ (uint32_t p, float *XYZ) |
| Decode one packed 32-bit LogLuv pixel to linear XYZ. | |
| uint32_t | LogLuv32fromXYZ (float *XYZ, int em) |
| Encode linear XYZ as one packed 32-bit LogLuv pixel. | |
| static void | Luv32toXYZ (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Convert staged LogLuv32 codes to native float XYZ triplets. | |
| static void | Luv32toLuv48 (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Convert staged LogLuv32 codes to native signed Luv triplets. | |
| static void | Luv32toRGB (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Convert staged LogLuv32 codes to clipped gamma-two RGB bytes. | |
| static void | Luv32fromXYZ (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Quantise native float XYZ triplets into LogLuv32 staging. | |
| static void | Luv32fromLuv48 (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Quantise native signed Luv triplets into LogLuv32 staging. | |
| static void | _logLuvNop (LogLuvState *sp, uint8_t *op, tmsize_t n) |
| Perform no SGILog pixel translation. | |
| static int | LogL16GuessDataFmt (TIFFDirectory *td) |
| Infer grayscale SGILog input format from directory fields. | |
| static tmsize_t | multiply_ms (TIFF *tif, const char *module, tmsize_t m1, tmsize_t m2) |
| Multiply translation-buffer extents with signed-size checking. | |
| static int | LogL16InitState (TIFF *tif) |
| Validate grayscale SGILog format and allocate translation pixels. | |
| static int | LogLuvGuessDataFmt (TIFFDirectory *td) |
| Infer colour SGILog input format from directory fields. | |
| static int | LogLuvInitState (TIFF *tif) |
| Validate contiguous LogLuv format and allocate packed translation pixels. | |
| static int | LogLuvFixupTags (TIFF *tif) |
| Accept SGILog tag fixup without changes. | |
| static int | LogLuvSetupDecode (TIFF *tif) |
| Select SGILog row decoding and application-format conversion. | |
| static int | LogLuvSetupEncode (TIFF *tif) |
| Select SGILog row encoding and input conversion. | |
| static void | LogLuvClose (TIFF *tif) |
| Normalise encoded SGILog directory sample metadata before writing. | |
| static void | LogLuvCleanup (TIFF *tif) |
| Restore SGILog tag methods and release translation/codec state. | |
| static int | LogLuvVSetField (TIFF *tif, uint32_t tag, va_list ap) |
| Set SGILog user format or dithering and update representation metadata. | |
| static int | LogLuvVGetField (TIFF *tif, uint32_t tag, va_list ap) |
| Retrieve SGILog user format or delegate another tag query. | |
| int | TIFFInitSGILog (TIFF *tif, int scheme) |
| Allocate SGILog codec state and install row dispatch and tag hooks. | |
Variables | |
| static const TIFFField | LogLuvFields [] |
| Define SGILog user format and encoding-method pseudo-tags. | |
Implement SGILog luminance and LogLuv row compression and translation.
Definition in file tif_luv.c.