LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
Macros | Functions
tif_color.c File Reference

Convert Lab, XYZ, and YCbCr colour components. More...

#include "tiffiop.h"
#include <math.h>
Include dependency graph for tif_color.c:

Go to the source code of this file.

Macros

#define RINT(R)   ((uint32_t)((R) > 0 ? ((R) + 0.5f) : ((R) - 0.5f)))
 Round a nonnegative table value to an unsigned channel.
 
#define SHIFT   16
 Select sixteen fractional bits for YCbCr contributions.
 
#define FIX(x)   ((int32_t)((double)(x) * (1L << SHIFT) + 0.5))
 Convert a bounded coefficient to fixed-point form.
 
#define ONE_HALF   ((int32_t)(1 << (SHIFT - 1)))
 Represent a half-unit rounding bias in fixed-point form.
 
#define Code2V(c, RB, RW, CR)
 Scale a code between reference black and white endpoints.
 
#define CLAMP(f, min, max)    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
 Clamp a value and map NaN to the lower bound.
 
#define HICLAMP(f, max)   ((f) > (max) ? (max) : (f))
 Apply only an upper bound.
 
#define LumaRed   luma[0]
 Read the red coefficient from the local luma array.
 
#define LumaGreen   luma[1]
 Read the green coefficient from the local luma array.
 
#define LumaBlue   luma[2]
 Read the blue coefficient from the local luma array.
 

Functions

TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW 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 TIFFCIELab16ToXYZ (TIFFCIELabToRGB *cielab, uint32_t l, int32_t a, int32_t b, float *X, float *Y, float *Z)
 Convert 16-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 TIFFCIELabToRGBInit (TIFFCIELabToRGB *cielab, const TIFFDisplay *display, float *refWhite)
 Initialise caller-owned CIE Lab conversion tables and reference white.
 
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.
 
static float CLAMPw (float v, float vmin, float vmax)
 Clamp a finite coefficient to an inclusive interval.
 
int TIFFYCbCrToRGBInit (TIFFYCbCrToRGB *ycbcr, float *luma, float *refBlackWhite)
 Initialise caller-allocated 8-bit YCbCr conversion tables.
 

Detailed Description

Convert Lab, XYZ, and YCbCr colour components.

Definition in file tif_color.c.