Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
gamma.c File Reference
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "common/colorspaces_inline_conversions.h"
#include "common/opencl.h"
#include "control/control.h"
#include "develop/develop.h"
#include "gui/gtk.h"
#include "iop/iop_api.h"
+ Include dependency graph for gamma.c:

Go to the source code of this file.

Data Structures

struct  dt_iop_gamma_params_t
 This module converts float32 RGBA pixels to uint8 BGRA pixels, for GUI pipelines only (darkroom main preview and navigation thumbnail). It self-disables for export pipelines. More...
 
struct  dt_iop_gamma_global_data_t
 
struct  dt_iop_gamma_mask_preview_t
 Shared appearance of mask previews rendered by the display encoding module. More...
 

Typedefs

typedef struct dt_iop_gamma_params_t dt_iop_gamma_params_t
 This module converts float32 RGBA pixels to uint8 BGRA pixels, for GUI pipelines only (darkroom main preview and navigation thumbnail). It self-disables for export pipelines.
 
typedef struct dt_iop_gamma_global_data_t dt_iop_gamma_global_data_t
 
typedef enum dt_iop_gamma_kernel_mode_t dt_iop_gamma_kernel_mode_t
 
typedef enum dt_iop_gamma_false_color_t dt_iop_gamma_false_color_t
 
typedef struct dt_iop_gamma_mask_preview_t dt_iop_gamma_mask_preview_t
 Shared appearance of mask previews rendered by the display encoding module.
 

Enumerations

enum  dt_iop_gamma_kernel_mode_t {
  DT_IOP_GAMMA_KERNEL_COPY = 0 ,
  DT_IOP_GAMMA_KERNEL_MASK = 1 ,
  DT_IOP_GAMMA_KERNEL_CHANNEL_MONO = 2 ,
  DT_IOP_GAMMA_KERNEL_CHANNEL_FALSE_COLOR = 3
}
 
enum  dt_iop_gamma_false_color_t {
  DT_IOP_GAMMA_FALSE_COLOR_MONO = 0 ,
  DT_IOP_GAMMA_FALSE_COLOR_A = 1 ,
  DT_IOP_GAMMA_FALSE_COLOR_B = 2 ,
  DT_IOP_GAMMA_FALSE_COLOR_R = 3 ,
  DT_IOP_GAMMA_FALSE_COLOR_G = 4 ,
  DT_IOP_GAMMA_FALSE_COLOR_B_CH = 5 ,
  DT_IOP_GAMMA_FALSE_COLOR_C = 6 ,
  DT_IOP_GAMMA_FALSE_COLOR_LCH_H = 7 ,
  DT_IOP_GAMMA_FALSE_COLOR_HSL_H = 8 ,
  DT_IOP_GAMMA_FALSE_COLOR_JZ_HZ = 9
}
 

Functions

const char * name ()
 
int default_group ()
 
int flags ()
 
int default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
 
void input_format (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_buffer_dsc_t *dsc)
 
void output_format (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_buffer_dsc_t *dsc)
 
static void _write_pixel (const float *const restrict in, uint8_t *const restrict out, const dt_iop_gamma_mask_preview_t *const preview, const size_t pixel_index, const float alpha)
 Blend one linear RGB pixel with its mask checker and encode it for display.
 
 __OMP_DECLARE_SIMD__ (aligned(pixel:16) uniform(norm))
 
 __OMP_DECLARE_SIMD__ (aligned(XYZ, sRGB:16) uniform(norm))
 
static __DT_CLONE_TARGETS__ void _channel_display_monochrome (const float *const restrict in, uint8_t *const restrict out, const size_t buffsize, const float alpha, const dt_iop_gamma_mask_preview_t *const preview)
 
static __DT_CLONE_TARGETS__ void _channel_display_false_color (const float *const restrict in, uint8_t *const restrict out, const size_t buffsize, const float alpha, dt_dev_pixelpipe_display_mask_t channel, const dt_iop_gamma_mask_preview_t *const preview)
 
static __DT_CLONE_TARGETS__ void _mask_display (const float *const restrict in, uint8_t *const restrict out, const size_t buffsize, const float alpha, const dt_iop_gamma_mask_preview_t *const preview)
 
static __DT_CLONE_TARGETS__ void _copy_output (const float *const restrict in, uint8_t *const restrict out, const size_t buffsize)
 
int process (struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const void *const i, void *const o)
 
static int _false_color_channel_to_kernel_code (const dt_dev_pixelpipe_display_mask_t mask_display)
 
int process_cl (struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out)
 
void init_global (dt_iop_module_so_t *module)
 
void cleanup_global (dt_iop_module_so_t *module)
 
void init (dt_iop_module_t *module)
 
void init_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void cleanup_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void commit_params (dt_iop_module_t *self, dt_iop_params_t *params, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 

Typedef Documentation

◆ dt_iop_gamma_false_color_t

◆ dt_iop_gamma_global_data_t

◆ dt_iop_gamma_kernel_mode_t

◆ dt_iop_gamma_mask_preview_t

Shared appearance of mask previews rendered by the display encoding module.

The checker colors remain in linear RGB until they are blended with the image so this path matches module-authored previews that continue through display encoding.

◆ dt_iop_gamma_params_t

This module converts float32 RGBA pixels to uint8 BGRA pixels, for GUI pipelines only (darkroom main preview and navigation thumbnail). It self-disables for export pipelines.

Enumeration Type Documentation

◆ dt_iop_gamma_false_color_t

Enumerator
DT_IOP_GAMMA_FALSE_COLOR_MONO 
DT_IOP_GAMMA_FALSE_COLOR_A 
DT_IOP_GAMMA_FALSE_COLOR_B 
DT_IOP_GAMMA_FALSE_COLOR_R 
DT_IOP_GAMMA_FALSE_COLOR_G 
DT_IOP_GAMMA_FALSE_COLOR_B_CH 
DT_IOP_GAMMA_FALSE_COLOR_C 
DT_IOP_GAMMA_FALSE_COLOR_LCH_H 
DT_IOP_GAMMA_FALSE_COLOR_HSL_H 
DT_IOP_GAMMA_FALSE_COLOR_JZ_HZ 

Definition at line 84 of file gamma.c.

◆ dt_iop_gamma_kernel_mode_t

Enumerator
DT_IOP_GAMMA_KERNEL_COPY 
DT_IOP_GAMMA_KERNEL_MASK 
DT_IOP_GAMMA_KERNEL_CHANNEL_MONO 
DT_IOP_GAMMA_KERNEL_CHANNEL_FALSE_COLOR 

Definition at line 76 of file gamma.c.

Function Documentation

◆ __OMP_DECLARE_SIMD__() [1/2]

__OMP_DECLARE_SIMD__ ( aligned(pixel:16) uniform(norm)  )

Definition at line 182 of file gamma.c.

References factor, for_each_channel, and x.

◆ __OMP_DECLARE_SIMD__() [2/2]

__OMP_DECLARE_SIMD__ ( aligned(XYZ, sRGB:16) uniform(norm)  )

Definition at line 191 of file gamma.c.

References dt_XYZ_to_Rec709_D50(), sRGB, and XYZ.

◆ _channel_display_false_color()

◆ _channel_display_monochrome()

static __DT_CLONE_TARGETS__ void _channel_display_monochrome ( const float *const restrict  in,
uint8_t *const restrict  out,
const size_t  buffsize,
const float  alpha,
const dt_iop_gamma_mask_preview_t *const  preview 
)
static

Definition at line 199 of file gamma.c.

References __OMP_PARALLEL_FOR_SIMD__, _write_pixel(), and out.

Referenced by _channel_display_false_color(), and process().

◆ _copy_output()

static __DT_CLONE_TARGETS__ void _copy_output ( const float *const restrict  in,
uint8_t *const restrict  out,
const size_t  buffsize 
)
static

Definition at line 347 of file gamma.c.

References __OMP_PARALLEL_FOR_SIMD__, and out.

Referenced by process().

◆ _false_color_channel_to_kernel_code()

◆ _mask_display()

static __DT_CLONE_TARGETS__ void _mask_display ( const float *const restrict  in,
uint8_t *const restrict  out,
const size_t  buffsize,
const float  alpha,
const dt_iop_gamma_mask_preview_t *const  preview 
)
static

Definition at line 329 of file gamma.c.

References __OMP_PARALLEL_FOR_SIMD__, _write_pixel(), dt_iop_gamma_mask_preview_t::black_and_white, and out.

Referenced by process().

◆ _write_pixel()

static void _write_pixel ( const float *const restrict  in,
uint8_t *const restrict  out,
const dt_iop_gamma_mask_preview_t *const  preview,
const size_t  pixel_index,
const float  alpha 
)
inlinestatic

Blend one linear RGB pixel with its mask checker and encode it for display.

Definition at line 156 of file gamma.c.

References out, value, dt_iop_gamma_mask_preview_t::width, and x.

Referenced by _channel_display_false_color(), _channel_display_monochrome(), and _mask_display().

◆ cleanup_global()

◆ cleanup_pipe()

void cleanup_pipe ( struct dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

Definition at line 562 of file gamma.c.

◆ commit_params()

◆ default_colorspace()

int default_colorspace ( dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece 
)

Definition at line 114 of file gamma.c.

References IOP_CS_RGB_DISPLAY.

◆ default_group()

int default_group ( )

Definition at line 104 of file gamma.c.

References IOP_GROUP_TECHNICAL.

◆ flags()

int flags ( )

◆ init()

void init ( dt_iop_module_t module)

Definition at line 545 of file gamma.c.

◆ init_global()

void init_global ( dt_iop_module_so_t module)

◆ init_pipe()

void init_pipe ( struct dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

Definition at line 556 of file gamma.c.

References dt_dev_pixelpipe_iop_t::data, and dt_dev_pixelpipe_iop_t::data_size.

◆ input_format()

◆ name()

const char * name ( )

Definition at line 99 of file gamma.c.

◆ output_format()

◆ process()

◆ process_cl()