Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
noiseprofiles.c File Reference
#include <json-glib/json-glib.h>
#include "system/macros.h"
#include "system/mem_alloc.h"
#include "common/logging.h"
#include "common/paths.h"
#include "common/noiseprofiles.h"
#include "common/file_location.h"
#include "control/user_message.h"
+ Include dependency graph for noiseprofiles.c:

Go to the source code of this file.

Macros

#define DT_NOISE_PROFILE_VERSION   0
 
#define _ERROR(...)
 

Functions

void dt_noiseprofile_set_path (const char *alternative)
 
static gboolean dt_noiseprofile_verify (JsonParser *parser)
 
static JsonParser * _noiseprofile_load (const char *alternative)
 
int is_member (gchar **names, char *name)
 
static gint _sort_by_iso (gconstpointer a, gconstpointer b)
 
static JsonParser * _get_parser_locked (void)
 
void dt_noiseprofile_cleanup (void)
 
GList * dt_noiseprofile_get_matching (const dt_image_t *cimg)
 
void dt_noiseprofile_free (gpointer data)
 
void dt_noiseprofile_interpolate (const dt_noiseprofile_t *const p1, const dt_noiseprofile_t *const p2, dt_noiseprofile_t *out)
 

Variables

const dt_noiseprofile_t dt_noiseprofile_generic = {N_("generic poissonian"), "", "", 0, {0.0001f, 0.0001f, 0.0001}, {0.0f, 0.0f, 0.0f}}
 
static GMutex _noiseprofiles_parser_mutex
 
static JsonParser * _noiseprofiles_parser = NULL
 
static gboolean _noiseprofiles_tried = FALSE
 
static char * _noiseprofiles_alternative = NULL
 

Macro Definition Documentation

◆ _ERROR

#define _ERROR (   ...)
Value:
{\
dt_print(DT_DEBUG_CONTROL, "[noiseprofile] error: " );\
dt_print(DT_DEBUG_CONTROL, __VA_ARGS__);\
dt_print(DT_DEBUG_CONTROL, "\n");\
valid = FALSE;\
goto end;\
}
#define FALSE
Definition ashift_lsd.c:158
@ DT_DEBUG_CONTROL
Definition logging.h:52

Definition at line 130 of file noiseprofiles.c.

◆ DT_NOISE_PROFILE_VERSION

#define DT_NOISE_PROFILE_VERSION   0

Definition at line 37 of file noiseprofiles.c.

Function Documentation

◆ _get_parser_locked()

static JsonParser * _get_parser_locked ( void  )
static

◆ _noiseprofile_load()

static JsonParser * _noiseprofile_load ( const char *  alternative)
static
Todo:
: shall we cache the content? for now this looks fast enough(TM)

Definition at line 65 of file noiseprofiles.c.

References dt_concat_path_file(), dt_control_log(), DT_DEBUG_CONTROL, dt_loc_get_datadir(), dt_loc_get_user_config_dir(), dt_noiseprofile_verify(), DT_PATH_MAX, dt_print(), error(), and IS_NULL_PTR.

Referenced by _get_parser_locked().

◆ _sort_by_iso()

static gint _sort_by_iso ( gconstpointer  a,
gconstpointer  b 
)
static

Definition at line 122 of file noiseprofiles.c.

References dt_noiseprofile_t::iso.

Referenced by dt_noiseprofile_get_matching().

◆ dt_noiseprofile_cleanup()

void dt_noiseprofile_cleanup ( void  )

drops the parsed profiles, if any.

Definition at line 269 of file noiseprofiles.c.

References _noiseprofiles_alternative, _noiseprofiles_parser, _noiseprofiles_parser_mutex, _noiseprofiles_tried, dt_free, and FALSE.

Referenced by dt_cleanup().

◆ dt_noiseprofile_free()

void dt_noiseprofile_free ( gpointer  data)

◆ dt_noiseprofile_get_matching()

◆ dt_noiseprofile_interpolate()

void dt_noiseprofile_interpolate ( const dt_noiseprofile_t *const  p1,
const dt_noiseprofile_t *const  p2,
dt_noiseprofile_t out 
)

◆ dt_noiseprofile_set_path()

void dt_noiseprofile_set_path ( const char *  alternative)

Point the module at an alternative noiseprofiles.json (–noiseprofiles). The file is parsed lazily, on the first dt_noiseprofile_get_matching() call – never at startup.

Definition at line 57 of file noiseprofiles.c.

References _noiseprofiles_alternative, and dt_free.

Referenced by dt_init().

◆ dt_noiseprofile_verify()

static gboolean dt_noiseprofile_verify ( JsonParser *  parser)
static

◆ is_member()

int is_member ( gchar **  names,
char *  name 
)

Definition at line 111 of file noiseprofiles.c.

References name, and names.

Referenced by dt_noiseprofile_get_matching(), and dt_noiseprofile_verify().

Variable Documentation

◆ _noiseprofiles_alternative

char* _noiseprofiles_alternative = NULL
static

◆ _noiseprofiles_parser

JsonParser* _noiseprofiles_parser = NULL
static

Definition at line 53 of file noiseprofiles.c.

Referenced by _get_parser_locked(), and dt_noiseprofile_cleanup().

◆ _noiseprofiles_parser_mutex

GMutex _noiseprofiles_parser_mutex
static

Definition at line 40 of file noiseprofiles.c.

Referenced by dt_noiseprofile_cleanup(), and dt_noiseprofile_get_matching().

◆ _noiseprofiles_tried

gboolean _noiseprofiles_tried = FALSE
static

Definition at line 54 of file noiseprofiles.c.

Referenced by _get_parser_locked(), and dt_noiseprofile_cleanup().

◆ dt_noiseprofile_generic

const dt_noiseprofile_t dt_noiseprofile_generic = {N_("generic poissonian"), "", "", 0, {0.0001f, 0.0001f, 0.0001}, {0.0f, 0.0f, 0.0f}}