Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
iop_profile.c File Reference
#include "common/colorspaces.h"
#include "common/darktable.h"
#include "common/iop_profile.h"
#include "common/debug.h"
#include "common/matrices.h"
#include "develop/imageop.h"
#include "develop/imageop_math.h"
#include "develop/pixelpipe.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ Include dependency graph for iop_profile.c:

Macros

#define DT_IOPPR_LUT_SAMPLES   0x10000
 

Functions

static void _mark_as_nonmatrix_profile (dt_iop_order_iccprofile_info_t *const profile_info)
 
static void _clear_lut_curves (dt_iop_order_iccprofile_info_t *const profile_info)
 
static void _transform_from_to_rgb_lab_lcms2 (const float *const image_in, float *const image_out, const int width, const int height, const dt_colorspaces_color_profile_type_t type, const char *filename, const int intent, const int direction)
 
static void _transform_rgb_to_rgb_lcms2 (const float *const image_in, float *const image_out, const int width, const int height, const dt_colorspaces_color_profile_type_t type_from, const char *filename_from, const dt_colorspaces_color_profile_type_t type_to, const char *filename_to, const int intent)
 
static void _transform_lcms2 (struct dt_iop_module_t *self, const float *const image_in, float *const image_out, const int width, const int height, const int cst_from, const int cst_to, int *converted_cst, const dt_iop_order_iccprofile_info_t *const profile_info)
 
static void _transform_lcms2_rgb (const float *const image_in, float *const image_out, const int width, const int height, const dt_iop_order_iccprofile_info_t *const profile_info_from, const dt_iop_order_iccprofile_info_t *const profile_info_to)
 
static int _init_unbounded_coeffs (float *const lutr, float *const lutg, float *const lutb, float *const unbounded_coeffsr, float *const unbounded_coeffsg, float *const unbounded_coeffsb, const int lutsize)
 
static void _apply_tonecurves (const float *const image_in, float *const image_out, const int width, const int height, const float *const restrict lutr, const float *const restrict lutg, const float *const restrict lutb, const float *const restrict unbounded_coeffsr, const float *const restrict unbounded_coeffsg, const float *const restrict unbounded_coeffsb, const int lutsize)
 
static void _transform_rgb_to_lab_matrix (const float *const restrict image_in, float *const restrict image_out, const int width, const int height, const dt_iop_order_iccprofile_info_t *const profile_info)
 
static void _transform_lab_to_rgb_matrix (const float *const image_in, float *const image_out, const int width, const int height, const dt_iop_order_iccprofile_info_t *const profile_info)
 
static void _transform_matrix_rgb (const float *const restrict image_in, float *const restrict image_out, const int width, const int height, const dt_iop_order_iccprofile_info_t *const profile_info_from, const dt_iop_order_iccprofile_info_t *const profile_info_to)
 
static void _transform_matrix (struct dt_iop_module_t *self, const float *const restrict image_in, float *const restrict image_out, const int width, const int height, const dt_iop_colorspace_type_t cst_from, const dt_iop_colorspace_type_t cst_to, dt_iop_colorspace_type_t *converted_cst, const dt_iop_order_iccprofile_info_t *const profile_info)
 
void dt_ioppr_init_profile_info (dt_iop_order_iccprofile_info_t *profile_info, const int lutsize)
 
void dt_ioppr_cleanup_profile_info (dt_iop_order_iccprofile_info_t *profile_info)
 
static int dt_ioppr_generate_profile_info (dt_iop_order_iccprofile_info_t *profile_info, const int type, const char *filename, const int intent)
 
dt_iop_order_iccprofile_info_tdt_ioppr_get_profile_info_from_list (struct dt_develop_t *dev, const dt_colorspaces_color_profile_type_t profile_type, const char *profile_filename)
 
dt_iop_order_iccprofile_info_tdt_ioppr_add_profile_info_to_list (struct dt_develop_t *dev, const dt_colorspaces_color_profile_type_t profile_type, const char *profile_filename, const int intent)
 
dt_iop_order_iccprofile_info_tdt_ioppr_get_iop_work_profile_info (struct dt_iop_module_t *module, GList *iop_list)
 
dt_iop_order_iccprofile_info_tdt_ioppr_set_pipe_work_profile_info (struct dt_develop_t *dev, struct dt_dev_pixelpipe_t *pipe, const dt_colorspaces_color_profile_type_t type, const char *filename, const int intent)
 
dt_iop_order_iccprofile_info_tdt_ioppr_set_pipe_input_profile_info (struct dt_develop_t *dev, struct dt_dev_pixelpipe_t *pipe, const dt_colorspaces_color_profile_type_t type, const char *filename, const int intent, const dt_colormatrix_t matrix_in)
 
dt_iop_order_iccprofile_info_tdt_ioppr_set_pipe_output_profile_info (struct dt_develop_t *dev, struct dt_dev_pixelpipe_t *pipe, const dt_colorspaces_color_profile_type_t type, const char *filename, const int intent)
 
dt_iop_order_iccprofile_info_tdt_ioppr_get_pipe_work_profile_info (struct dt_dev_pixelpipe_t *pipe)
 
dt_iop_order_iccprofile_info_tdt_ioppr_get_pipe_input_profile_info (struct dt_dev_pixelpipe_t *pipe)
 
dt_iop_order_iccprofile_info_tdt_ioppr_get_pipe_output_profile_info (struct dt_dev_pixelpipe_t *pipe)
 
dt_iop_order_iccprofile_info_tdt_ioppr_get_pipe_current_profile_info (dt_iop_module_t *module, struct dt_dev_pixelpipe_t *pipe)
 
void dt_ioppr_get_work_profile_type (struct dt_develop_t *dev, dt_colorspaces_color_profile_type_t *profile_type, const char **profile_filename)
 
void dt_ioppr_get_export_profile_type (struct dt_develop_t *dev, dt_colorspaces_color_profile_type_t *profile_type, const char **profile_filename)
 
__DT_CLONE_TARGETS__ void dt_ioppr_transform_image_colorspace (struct dt_iop_module_t *self, const float *const image_in, float *const image_out, const int width, const int height, const int cst_from, const int cst_to, int *converted_cst, const dt_iop_order_iccprofile_info_t *const profile_info)
 
__DT_CLONE_TARGETS__ void dt_ioppr_transform_image_colorspace_rgb (const float *const restrict image_in, float *const restrict image_out, const int width, const int height, const dt_iop_order_iccprofile_info_t *const profile_info_from, const dt_iop_order_iccprofile_info_t *const profile_info_to, const char *message)
 

Macro Definition Documentation

◆ DT_IOPPR_LUT_SAMPLES

#define DT_IOPPR_LUT_SAMPLES   0x10000

Function Documentation

◆ _apply_tonecurves()

static void _apply_tonecurves ( const float *const  image_in,
float *const  image_out,
const int  width,
const int  height,
const float *const restrict  lutr,
const float *const restrict  lutg,
const float *const restrict  lutb,
const float *const restrict  unbounded_coeffsr,
const float *const restrict  unbounded_coeffsg,
const float *const restrict  unbounded_coeffsb,
const int  lutsize 
)
inlinestatic

◆ _clear_lut_curves()

◆ _init_unbounded_coeffs()

static int _init_unbounded_coeffs ( float *const  lutr,
float *const  lutg,
float *const  lutb,
float *const  unbounded_coeffsr,
float *const  unbounded_coeffsg,
float *const  unbounded_coeffsb,
const int  lutsize 
)
inlinestatic

◆ _mark_as_nonmatrix_profile()

static void _mark_as_nonmatrix_profile ( dt_iop_order_iccprofile_info_t *const  profile_info)
static

Note : we do not use finite-math-only and fast-math because divisions by zero are not manually avoided in the code fp-contract=fast enables hardware-accelerated Fused Multiply-Add the rest is loop reorganization and vectorization optimization

References dt_iop_order_iccprofile_info_t::matrix_in, dt_iop_order_iccprofile_info_t::matrix_in_transposed, dt_iop_order_iccprofile_info_t::matrix_out, and dt_iop_order_iccprofile_info_t::matrix_out_transposed.

Referenced by dt_ioppr_generate_profile_info(), and dt_ioppr_init_profile_info().

◆ _transform_from_to_rgb_lab_lcms2()

static void _transform_from_to_rgb_lab_lcms2 ( const float *const  image_in,
float *const  image_out,
const int  width,
const int  height,
const dt_colorspaces_color_profile_type_t  type,
const char *  filename,
const int  intent,
const int  direction 
)
static

◆ _transform_lab_to_rgb_matrix()

static void _transform_lab_to_rgb_matrix ( const float *const  image_in,
float *const  image_out,
const int  width,
const int  height,
const dt_iop_order_iccprofile_info_t *const  profile_info 
)
inlinestatic

◆ _transform_lcms2()

static void _transform_lcms2 ( struct dt_iop_module_t self,
const float *const  image_in,
float *const  image_out,
const int  width,
const int  height,
const int  cst_from,
const int  cst_to,
int *  converted_cst,
const dt_iop_order_iccprofile_info_t *const  profile_info 
)
static

◆ _transform_lcms2_rgb()

static void _transform_lcms2_rgb ( const float *const  image_in,
float *const  image_out,
const int  width,
const int  height,
const dt_iop_order_iccprofile_info_t *const  profile_info_from,
const dt_iop_order_iccprofile_info_t *const  profile_info_to 
)
inlinestatic

◆ _transform_matrix()

static void _transform_matrix ( struct dt_iop_module_t self,
const float *const restrict  image_in,
float *const restrict  image_out,
const int  width,
const int  height,
const dt_iop_colorspace_type_t  cst_from,
const dt_iop_colorspace_type_t  cst_to,
dt_iop_colorspace_type_t converted_cst,
const dt_iop_order_iccprofile_info_t *const  profile_info 
)
inlinestatic

◆ _transform_matrix_rgb()

◆ _transform_rgb_to_lab_matrix()

static void _transform_rgb_to_lab_matrix ( const float *const restrict  image_in,
float *const restrict  image_out,
const int  width,
const int  height,
const dt_iop_order_iccprofile_info_t *const  profile_info 
)
inlinestatic

◆ _transform_rgb_to_rgb_lcms2()

static void _transform_rgb_to_rgb_lcms2 ( const float *const  image_in,
float *const  image_out,
const int  width,
const int  height,
const dt_colorspaces_color_profile_type_t  type_from,
const char *  filename_from,
const dt_colorspaces_color_profile_type_t  type_to,
const char *  filename_to,
const int  intent 
)
static

◆ dt_ioppr_add_profile_info_to_list()

dt_iop_order_iccprofile_info_t * dt_ioppr_add_profile_info_to_list ( struct dt_develop_t dev,
const dt_colorspaces_color_profile_type_t  profile_type,
const char *  profile_filename,
const int  intent 
)

◆ dt_ioppr_cleanup_profile_info()

void dt_ioppr_cleanup_profile_info ( dt_iop_order_iccprofile_info_t profile_info)

must be called when done with profile_info

References dt_free_align, dt_iop_order_iccprofile_info_t::lut_in, and dt_iop_order_iccprofile_info_t::lut_out.

Referenced by dt_dev_cleanup().

◆ dt_ioppr_generate_profile_info()

◆ dt_ioppr_get_export_profile_type()

void dt_ioppr_get_export_profile_type ( struct dt_develop_t dev,
dt_colorspaces_color_profile_type_t profile_type,
const char **  profile_filename 
)

returns the current setting of the export profile on colorout iop

References darktable, DT_COLORSPACE_NONE, darktable_t::iop, dt_develop_t::iop, dt_iop_module_so_t::op, and dt_iop_module_t::params.

◆ dt_ioppr_get_iop_work_profile_info()

◆ dt_ioppr_get_pipe_current_profile_info()

◆ dt_ioppr_get_pipe_input_profile_info()

◆ dt_ioppr_get_pipe_output_profile_info()

◆ dt_ioppr_get_pipe_work_profile_info()

◆ dt_ioppr_get_profile_info_from_list()

dt_iop_order_iccprofile_info_t * dt_ioppr_get_profile_info_from_list ( struct dt_develop_t dev,
dt_colorspaces_color_profile_type_t  profile_type,
const char *  profile_filename 
)

returns the profile info from dev profiles info list that matches (profile_type, profile_filename) NULL if not found

References dt_develop_t::allprofile_info, dt_iop_order_iccprofile_info_t::filename, and dt_iop_order_iccprofile_info_t::type.

Referenced by dt_ioppr_add_profile_info_to_list().

◆ dt_ioppr_get_work_profile_type()

void dt_ioppr_get_work_profile_type ( struct dt_develop_t dev,
dt_colorspaces_color_profile_type_t profile_type,
const char **  profile_filename 
)

returns the current setting of the work profile on colorin iop

References darktable, DT_COLORSPACE_NONE, darktable_t::iop, dt_develop_t::iop, dt_iop_module_so_t::op, and dt_iop_module_t::params.

Referenced by dt_ioppr_get_iop_work_profile_info().

◆ dt_ioppr_init_profile_info()

◆ dt_ioppr_set_pipe_input_profile_info()

◆ dt_ioppr_set_pipe_output_profile_info()

◆ dt_ioppr_set_pipe_work_profile_info()

dt_iop_order_iccprofile_info_t * dt_ioppr_set_pipe_work_profile_info ( struct dt_develop_t dev,
struct dt_dev_pixelpipe_t pipe,
const dt_colorspaces_color_profile_type_t  type,
const char *  filename,
const int  intent 
)

set the work profile (type, filename) on the pipe, should be called on process*() if matrix cannot be generated it default to linear rec 2020 returns the actual profile that has been set

References DT_COLORSPACE_LIN_REC2020, dt_ioppr_add_profile_info_to_list(), dt_iop_order_iccprofile_info_t::matrix_in, dt_iop_order_iccprofile_info_t::matrix_out, type, and dt_dev_pixelpipe_t::work_profile_info.

Referenced by commit_params().

◆ dt_ioppr_transform_image_colorspace()

__DT_CLONE_TARGETS__ void dt_ioppr_transform_image_colorspace ( struct dt_iop_module_t self,
const float *const  image_in,
float *const  image_out,
const int  width,
const int  height,
const int  cst_from,
const int  cst_to,
int *  converted_cst,
const dt_iop_order_iccprofile_info_t *const  profile_info 
)

◆ dt_ioppr_transform_image_colorspace_rgb()

__DT_CLONE_TARGETS__ void dt_ioppr_transform_image_colorspace_rgb ( const float *const restrict  image_in,
float *const restrict  image_out,
const int  width,
const int  height,
const dt_iop_order_iccprofile_info_t *const  profile_info_from,
const dt_iop_order_iccprofile_info_t *const  profile_info_to,
const char *  message 
)