DD::Image::Linear Class Reference

Static Public Member Functions

static float from_byte (float f)
 
static void from_byte (float *, const uchar *, int W, int delta=1)
 
static void from_short (float *, const U16 *, int W, int bits=16, int delta=1)
 
static void from_float (float *, const float *, int W, int delta=1)
 
static float to_byte (float f)
 
static void to_byte (uchar *, const float *, int W, int delta=1)
 
static void to_short (U16 *, const float *, int W, int bits=16, int delta=1)
 
static void to_float (float *, const float *, int W, int delta=1)
 
static void to_float_cust (float *dst, const float *src, int W, unsigned int destDelta=1, unsigned int srcDelta=1)
 
static float fromFloat (float v)
 
static float fromFloatFast (float v)
 
static float toFloat (float v)
 
static float toFloatFast (float v)
 

Detailed Description

This class is designed to resemble the interface to the class LUT, but simply multiplies or divides by 255. This can be done more efficiently than the lookup tables in the class LUT, which was designed for gamma functions that take longer to calculate.

Member Function Documentation

void Linear::from_byte ( float *  buf,
const uchar *  from,
int  W,
int  delta = 1 
)
static

Converts W bytes to float by dividing them by 255. delta is the distance between the source bytes to allow them to be in an interlaced buffer.

void Linear::from_short ( float *  buf,
const U16 *  from,
int  W,
int  bits = 16,
int  delta = 1 
)
static

Converts W 16-bit samples to float by dividing them by 2^n-1. delta is the distance between the source words to allow them to be in an interlaced buffer.

Referenced by DD::Image::Reader::from_short(), and DD::Image::LUT::from_short().

void Linear::to_byte ( uchar *  buf,
const float *  from,
int  W,
int  delta = 1 
)
static

Converts W floats to bytes by doing clamp(float)*255. Error diffusion is applied so that a much smoother and more accurate representation of the original values is stored, getting rid of posterizing effects.

W is the number of pixels to convert. delta is the distance between the output bytes (useful for interlacing them into a buffer for screen display).

The input and output buffers must not overlap in memory.

References DD::Image::end(), and fast_rint().

void Linear::to_short ( U16 *  buf,
const float *  from,
int  W,
int  bits = 16,
int  delta = 1 
)
static

Converts W floats to clamp(float)*(2^n-1) and stores the result in buf. delta is the distance apart to store the results, allowing the output buffer to be interlaced.

This should do error diffusion but that is not yet implemented.

References fast_rint().

Referenced by DD::Image::Writer::to_short(), and DD::Image::LUT::to_short().



©2021 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk