Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
highlights.c File Reference
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "bauhaus/bauhaus.h"
#include "common/box_filters.h"
#include "common/bspline.h"
#include "common/opencl.h"
#include "common/imagebuf.h"
#include "common/fast_guided_filter.h"
#include "control/control.h"
#include "develop/develop.h"
#include "develop/imageop.h"
#include "develop/imageop_math.h"
#include "develop/imageop_gui.h"
#include "develop/noise_generator.h"
#include "develop/tiling.h"
#include "gui/gtk.h"
#include "iop/iop_api.h"
#include <gtk/gtk.h>
#include <inttypes.h>
+ Include dependency graph for highlights.c:

Data Structures

struct  dt_iop_highlights_params_t
 
struct  dt_iop_highlights_gui_data_t
 
struct  dt_iop_highlights_global_data_t
 

Macros

#define MAX_NUM_SCALES   12
 
#define DS_FACTOR   4
 
#define DEBUG_DUMP_PFM   0
 
#define SQRT3   1.7320508075688772935274463415058723669L
 
#define SQRT12   3.4641016151377545870548926830117447339L
 

Typedefs

typedef enum dt_iop_highlights_mode_t dt_iop_highlights_mode_t
 
typedef enum dt_atrous_wavelets_scales_t dt_atrous_wavelets_scales_t
 
typedef struct dt_iop_highlights_params_t dt_iop_highlights_params_t
 
typedef struct dt_iop_highlights_gui_data_t dt_iop_highlights_gui_data_t
 
typedef dt_iop_highlights_params_t dt_iop_highlights_data_t
 
typedef struct dt_iop_highlights_global_data_t dt_iop_highlights_global_data_t
 
typedef enum diffuse_reconstruct_variant_t diffuse_reconstruct_variant_t
 

Enumerations

enum  dt_iop_highlights_mode_t {
  DT_IOP_HIGHLIGHTS_CLIP = 0 ,
  DT_IOP_HIGHLIGHTS_LCH = 1 ,
  DT_IOP_HIGHLIGHTS_INPAINT = 2 ,
  DT_IOP_HIGHLIGHTS_LAPLACIAN = 3
}
 
enum  dt_atrous_wavelets_scales_t {
  WAVELETS_1_SCALE = 0 ,
  WAVELETS_2_SCALE = 1 ,
  WAVELETS_3_SCALE = 2 ,
  WAVELETS_4_SCALE = 3 ,
  WAVELETS_5_SCALE = 4 ,
  WAVELETS_6_SCALE = 5 ,
  WAVELETS_7_SCALE = 6 ,
  WAVELETS_8_SCALE = 7 ,
  WAVELETS_9_SCALE = 8 ,
  WAVELETS_10_SCALE = 9 ,
  WAVELETS_11_SCALE = 10 ,
  WAVELETS_12_SCALE = 11
}
 
enum  diffuse_reconstruct_variant_t {
  DIFFUSE_RECONSTRUCT_RGB = 0 ,
  DIFFUSE_RECONSTRUCT_CHROMA
}
 
enum  wavelets_scale_t {
  ANY_SCALE = 1 << 0 ,
  FIRST_SCALE = 1 << 1 ,
  LAST_SCALE = 1 << 2
}
 

Functions

const char * name ()
 
const char ** description (struct dt_iop_module_t *self)
 
int default_group ()
 
int flags ()
 
int default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
int legacy_params (dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version)
 
void tiling_callback (struct dt_iop_module_t *self, struct dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *roi_in, const dt_iop_roi_t *roi_out, struct dt_develop_tiling_t *tiling)
 
static float interp_pix_xtrans (const int ratio_next, const ssize_t offset_next, const float clip0, const float clip_next, const float *const in, const float *const ratios)
 
static void interpolate_color_xtrans (const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, int dim, int dir, int other, const float *const clip, const uint8_t(*const xtrans)[6], const int pass)
 
static void interpolate_color (const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_out, int dim, int dir, int other, const float *clip, const uint32_t filters, const int pass)
 
static void process_lch_bayer (dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const float clip)
 
static void process_lch_xtrans (dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const float clip)
 
static void _interpolate_and_mask (const float *const restrict input, float *const restrict interpolated, float *const restrict clipping_mask, const dt_aligned_pixel_t clips, const dt_aligned_pixel_t wb, const uint32_t filters, const size_t width, const size_t height)
 
static void _remosaic_and_replace (const float *const restrict input, const float *const restrict interpolated, const float *const restrict clipping_mask, float *const restrict output, const dt_aligned_pixel_t wb, const uint32_t filters, const size_t width, const size_t height)
 
static uint8_t scale_type (const int s, const int scales)
 
static void guide_laplacians (const float *const restrict high_freq, const float *const restrict low_freq, const float *const restrict clipping_mask, float *const restrict output, const size_t width, const size_t height, const int mult, const float noise_level, const int salt, const uint8_t scale, const float radius_sq)
 
static void heat_PDE_diffusion (const float *const restrict high_freq, const float *const restrict low_freq, const float *const restrict clipping_mask, float *const restrict output, const size_t width, const size_t height, const int mult, const uint8_t scale, const float first_order_factor)
 
static gint wavelets_process (const float *const restrict in, float *const restrict reconstructed, const float *const restrict clipping_mask, const size_t width, const size_t height, const int scales, float *const restrict HF, float *const restrict LF_odd, float *const restrict LF_even, const diffuse_reconstruct_variant_t variant, const float noise_level, const int salt, const float first_order_factor)
 
static void process_laplacian_bayer (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const restrict ivoid, void *const restrict ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const dt_aligned_pixel_t clips)
 
static void process_clip (dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const float clip)
 
static void process_visualize (dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const uint32_t filters, dt_iop_highlights_data_t *data)
 
void process (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
 
void commit_params (struct dt_iop_module_t *self, dt_iop_params_t *p1, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void init_global (dt_iop_module_so_t *module)
 
void cleanup_global (dt_iop_module_so_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 gui_changed (dt_iop_module_t *self, GtkWidget *w, void *previous)
 
void gui_update (struct dt_iop_module_t *self)
 
void reload_defaults (dt_iop_module_t *module)
 
static void _visualize_callback (GtkWidget *quad, gpointer user_data)
 
void gui_focus (struct dt_iop_module_t *self, gboolean in)
 
void gui_init (struct dt_iop_module_t *self)
 

Macro Definition Documentation

◆ DEBUG_DUMP_PFM

#define DEBUG_DUMP_PFM   0

◆ DS_FACTOR

#define DS_FACTOR   4

◆ MAX_NUM_SCALES

#define MAX_NUM_SCALES   12

◆ SQRT12

#define SQRT12   3.4641016151377545870548926830117447339L

◆ SQRT3

#define SQRT3   1.7320508075688772935274463415058723669L

Typedef Documentation

◆ diffuse_reconstruct_variant_t

◆ dt_atrous_wavelets_scales_t

◆ dt_iop_highlights_data_t

◆ dt_iop_highlights_global_data_t

◆ dt_iop_highlights_gui_data_t

◆ dt_iop_highlights_mode_t

◆ dt_iop_highlights_params_t

Enumeration Type Documentation

◆ diffuse_reconstruct_variant_t

Enumerator
DIFFUSE_RECONSTRUCT_RGB 
DIFFUSE_RECONSTRUCT_CHROMA 

◆ dt_atrous_wavelets_scales_t

Enumerator
WAVELETS_1_SCALE 
WAVELETS_2_SCALE 
WAVELETS_3_SCALE 
WAVELETS_4_SCALE 
WAVELETS_5_SCALE 
WAVELETS_6_SCALE 
WAVELETS_7_SCALE 
WAVELETS_8_SCALE 
WAVELETS_9_SCALE 
WAVELETS_10_SCALE 
WAVELETS_11_SCALE 
WAVELETS_12_SCALE 

◆ dt_iop_highlights_mode_t

Enumerator
DT_IOP_HIGHLIGHTS_CLIP 
DT_IOP_HIGHLIGHTS_LCH 
DT_IOP_HIGHLIGHTS_INPAINT 
DT_IOP_HIGHLIGHTS_LAPLACIAN 

◆ wavelets_scale_t

Enumerator
ANY_SCALE 
FIRST_SCALE 
LAST_SCALE 

Function Documentation

◆ _interpolate_and_mask()

static void _interpolate_and_mask ( const float *const restrict  input,
float *const restrict  interpolated,
float *const restrict  clipping_mask,
const dt_aligned_pixel_t  clips,
const dt_aligned_pixel_t  wb,
const uint32_t  filters,
const size_t  width,
const size_t  height 
)
static

References B, BLUE, FC(), for_each_channel, GREEN, height, R, RED, sqf(), and width.

Referenced by process_laplacian_bayer().

◆ _remosaic_and_replace()

static void _remosaic_and_replace ( const float *const restrict  input,
const float *const restrict  interpolated,
const float *const restrict  clipping_mask,
float *const restrict  output,
const dt_aligned_pixel_t  wb,
const uint32_t  filters,
const size_t  width,
const size_t  height 
)
static

References ALPHA, FC(), height, and width.

Referenced by process_laplacian_bayer().

◆ _visualize_callback()

◆ cleanup_global()

◆ cleanup_pipe()

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

◆ commit_params()

◆ default_colorspace()

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

References IOP_CS_RAW.

◆ default_group()

int default_group ( )

References IOP_GROUP_REPAIR.

◆ description()

const char ** description ( struct dt_iop_module_t self)

◆ flags()

int flags ( )

◆ gui_changed()

◆ gui_focus()

◆ gui_init()

◆ gui_update()

◆ guide_laplacians()

static void guide_laplacians ( const float *const restrict  high_freq,
const float *const restrict  low_freq,
const float *const restrict  clipping_mask,
float *const restrict  output,
const size_t  width,
const size_t  height,
const int  mult,
const float  noise_level,
const int  salt,
const uint8_t  scale,
const float  radius_sq 
)
inlinestatic

◆ heat_PDE_diffusion()

static void heat_PDE_diffusion ( const float *const restrict  high_freq,
const float *const restrict  low_freq,
const float *const restrict  clipping_mask,
float *const restrict  output,
const size_t  width,
const size_t  height,
const int  mult,
const uint8_t  scale,
const float  first_order_factor 
)
inlinestatic

◆ init_global()

◆ init_pipe()

◆ interp_pix_xtrans()

static float interp_pix_xtrans ( const int  ratio_next,
const ssize_t  offset_next,
const float  clip0,
const float  clip_next,
const float *const  in,
const float *const  ratios 
)
inlinestatic

◆ interpolate_color()

static void interpolate_color ( const void *const  ivoid,
void *const  ovoid,
const dt_iop_roi_t *const  roi_out,
int  dim,
int  dir,
int  other,
const float *  clip,
const uint32_t  filters,
const int  pass 
)
inlinestatic

References FC(), dt_iop_roi_t::height, and dt_iop_roi_t::width.

Referenced by process().

◆ interpolate_color_xtrans()

static void interpolate_color_xtrans ( const void *const  ivoid,
void *const  ovoid,
const dt_iop_roi_t *const  roi_in,
const dt_iop_roi_t *const  roi_out,
int  dim,
int  dir,
int  other,
const float *const  clip,
const uint8_t(*)  xtrans[6],
const int  pass 
)
inlinestatic

◆ legacy_params()

◆ name()

const char * name ( )

Referenced by wavelets_process().

◆ process()

◆ process_clip()

static void process_clip ( dt_dev_pixelpipe_iop_t piece,
const void *const  ivoid,
void *const  ovoid,
const dt_iop_roi_t *const  roi_in,
const dt_iop_roi_t *const  roi_out,
const float  clip 
)
static

◆ process_laplacian_bayer()

◆ process_lch_bayer()

static void process_lch_bayer ( dt_iop_module_t self,
dt_dev_pixelpipe_iop_t piece,
const void *const  ivoid,
void *const  ovoid,
const dt_iop_roi_t *const  roi_in,
const dt_iop_roi_t *const  roi_out,
const float  clip 
)
static

◆ process_lch_xtrans()

static void process_lch_xtrans ( dt_iop_module_t self,
dt_dev_pixelpipe_iop_t piece,
const void *const  ivoid,
void *const  ovoid,
const dt_iop_roi_t *const  roi_in,
const dt_iop_roi_t *const  roi_out,
const float  clip 
)
static

◆ process_visualize()

static void process_visualize ( dt_dev_pixelpipe_iop_t piece,
const void *const  ivoid,
void *const  ovoid,
const dt_iop_roi_t *const  roi_in,
const dt_iop_roi_t *const  roi_out,
const uint32_t  filters,
dt_iop_highlights_data_t data 
)
static

◆ reload_defaults()

◆ scale_type()

static uint8_t scale_type ( const int  s,
const int  scales 
)
static

References ANY_SCALE, FIRST_SCALE, and LAST_SCALE.

Referenced by wavelets_process().

◆ tiling_callback()

◆ wavelets_process()

static gint wavelets_process ( const float *const restrict  in,
float *const restrict  reconstructed,
const float *const restrict  clipping_mask,
const size_t  width,
const size_t  height,
const int  scales,
float *const restrict  HF,
float *const restrict  LF_odd,
float *const restrict  LF_even,
const diffuse_reconstruct_variant_t  variant,
const float  noise_level,
const int  salt,
const float  first_order_factor 
)
inlinestatic