Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
lut3d.c File Reference
#include "common/darktable.h"
#include "common/lut3d.h"
#include <math.h>
+ Include dependency graph for common/lut3d.c:

Functions

static void _prepare_lut_input (const float *const input, float normalized[3], float residual[3], float rgbd[3], int rgbi[3], const uint16_t level, const float safe_normalization)
 
static __attribute__ ((always_inline))
 
__DT_CLONE_TARGETS__ void dt_lut3d_tetrahedral_interp (const float *const in, float *const out, const size_t pixel_nb, const float *const restrict clut, const uint16_t level, const float normalization)
 
__DT_CLONE_TARGETS__ void dt_lut3d_trilinear_interp (const float *const in, float *const out, const size_t pixel_nb, const float *const restrict clut, const uint16_t level, const float normalization)
 
__DT_CLONE_TARGETS__ void dt_lut3d_pyramid_interp (const float *const in, float *const out, const size_t pixel_nb, const float *const restrict clut, const uint16_t level, const float normalization)
 
void dt_lut3d_apply (const float *const in, float *const out, const size_t pixel_nb, const float *const clut, const uint16_t level, const float normalization, const dt_lut3d_interpolation_t interpolation)
 Apply one interpolation model over a packed RGB CLUT.
 

Function Documentation

◆ __attribute__()

static __attribute__ ( (always_inline)  )
inlinestatic

The LUT only samples the unit RGB cube. Outside that domain, extend the mapping by keeping the boundary deformation and adding back the part of the input that lies beyond the cube. This keeps identity LUTs truly neutral and avoids artificial clipping when the surrounding profile transform produces values slightly outside [0, 1].

◆ _prepare_lut_input()

static void _prepare_lut_input ( const float *const  input,
float  normalized[3],
float  residual[3],
float  rgbd[3],
int  rgbi[3],
const uint16_t  level,
const float  safe_normalization 
)
inlinestatic

◆ dt_lut3d_apply()

void dt_lut3d_apply ( const float *  in,
float *  out,
size_t  pixel_nb,
const float *  clut,
uint16_t  level,
float  normalization,
dt_lut3d_interpolation_t  interpolation 
)

Apply one interpolation model over a packed RGB CLUT.

The interpolation always happens in the normalized [0, 1] lattice domain. normalization lets callers map scene-referred RGB into that domain before lookup and restore the white level afterwards without rescaling the whole buffer in separate passes.

All modules using a dense RGB CLUT should go through this shared runtime so file-backed LUTs and procedurally-generated LUTs only differ by how they author the lattice values, not by how they traverse the cells.

References DT_LUT3D_INTERP_PYRAMID, DT_LUT3D_INTERP_TETRAHEDRAL, DT_LUT3D_INTERP_TRILINEAR, dt_lut3d_pyramid_interp(), dt_lut3d_tetrahedral_interp(), dt_lut3d_trilinear_interp(), and out.

Referenced by dt_colorrings_apply_rgb_lut(), and process().

◆ dt_lut3d_pyramid_interp()

__DT_CLONE_TARGETS__ void dt_lut3d_pyramid_interp ( const float *const  in,
float *const  out,
const size_t  pixel_nb,
const float *const restrict  clut,
const uint16_t  level,
const float  normalization 
)

References __OMP_PARALLEL_FOR__, _prepare_lut_input(), k, and out.

Referenced by dt_lut3d_apply().

◆ dt_lut3d_tetrahedral_interp()

__DT_CLONE_TARGETS__ void dt_lut3d_tetrahedral_interp ( const float *const  in,
float *const  out,
const size_t  pixel_nb,
const float *const restrict  clut,
const uint16_t  level,
const float  normalization 
)

References __OMP_PARALLEL_FOR__, _prepare_lut_input(), k, and out.

Referenced by dt_lut3d_apply().

◆ dt_lut3d_trilinear_interp()

__DT_CLONE_TARGETS__ void dt_lut3d_trilinear_interp ( const float *const  in,
float *const  out,
const size_t  pixel_nb,
const float *const restrict  clut,
const uint16_t  level,
const float  normalization 
)

References __OMP_PARALLEL_FOR__, _prepare_lut_input(), i, k, and out.

Referenced by dt_lut3d_apply().