Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
nn_model.h File Reference
#include <stddef.h>
#include "common/opencl.h"
Include dependency graph for nn_model.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DT_NN_CANCELLED   2
#define DT_NN_FUSION_FINEST   16
#define DT_NN_FUSION_COARSEST   64

Typedefs

typedef struct dt_nn_model_t dt_nn_model_t
typedef void *(* dt_nn_alloc_f) (size_t bytes, int long_lived)
typedef void(* dt_nn_free_f) (void *ptr)
typedef int(* dt_nn_cancel_f) (void)
typedef struct dt_nn_cl_t dt_nn_cl_t

Functions

void dt_nn_set_allocator (dt_nn_alloc_f alloc_fn, dt_nn_free_f free_fn)
void dt_nn_set_cancel (dt_nn_cancel_f cancel_fn)
dt_nn_model_t * dt_nn_model_load (const char *path, char *err, size_t err_len)
void dt_nn_model_free (dt_nn_model_t *model)
int dt_nn_model_in_channels (const dt_nn_model_t *model)
int dt_nn_model_out_channels (const dt_nn_model_t *model)
int dt_nn_model_bin (const dt_nn_model_t *model, const int is_xtrans)
int dt_nn_model_coarse_in_channels (const dt_nn_model_t *model)
int dt_nn_model_coarse_out_channels (const dt_nn_model_t *model)
int dt_nn_model_anchor (const dt_nn_model_t *model)
int dt_nn_model_alignment (const dt_nn_model_t *model)
float dt_nn_unet_scratch_per_px (const dt_nn_model_t *model)
float dt_nn_unet_scratch_per_px_cl (const dt_nn_model_t *model)
float dt_nn_unet_scratch_maxblock_per_px (const dt_nn_model_t *model)
size_t dt_nn_unet_scratch_bytes (const dt_nn_model_t *model, int width, int height)
int dt_nn_unet_apply (const dt_nn_model_t *model, const float *in, float *out, int width, int height)
int dt_nn_unet_apply_stage (const dt_nn_model_t *model, int stage, const float *in, float *out, int width, int height, int apply_residual)
void dt_nn_bin_planes (const float *planes, int pw, int ph, int bin, float *out_rgb, float *out_cnt)
void dt_nn_upsample_nearest (const float *in, int ch, int w, int h, int factor, float *out)
dt_nn_cl_t * dt_nn_cl_create (int program)
void dt_nn_cl_destroy (dt_nn_cl_t *cl)
int dt_nn_unet_apply_stage_cl (const dt_nn_model_t *model, int stage, dt_nn_cl_t *cl, int devid, cl_mem dev_in, cl_mem dev_out, int width, int height)

Macro Definition Documentation

◆ DT_NN_CANCELLED

#define DT_NN_CANCELLED   2

Definition at line 78 of file nn_model.h.

Referenced by _unet_forward(), _unet_forward_cl(), process(), and process_cl().

◆ DT_NN_FUSION_COARSEST

#define DT_NN_FUSION_COARSEST   64

◆ DT_NN_FUSION_FINEST

#define DT_NN_FUSION_FINEST   16

Definition at line 110 of file nn_model.h.

Referenced by _apply_low_band_anchor(), _fusion_levels(), _k_bilerp_add(), and _k_bin16_mdv().

Typedef Documentation

◆ dt_nn_alloc_f

typedef void *(* dt_nn_alloc_f) (size_t bytes, int long_lived)

Definition at line 65 of file nn_model.h.

◆ dt_nn_cancel_f

typedef int(* dt_nn_cancel_f) (void)

Definition at line 79 of file nn_model.h.

◆ dt_nn_cl_t

typedef struct dt_nn_cl_t dt_nn_cl_t

Definition at line 171 of file nn_model.h.

◆ dt_nn_free_f

typedef void(* dt_nn_free_f) (void *ptr)

Definition at line 66 of file nn_model.h.

◆ dt_nn_model_t

typedef struct dt_nn_model_t dt_nn_model_t

Definition at line 47 of file nn_model.h.

Function Documentation

◆ dt_nn_bin_planes()

void dt_nn_bin_planes ( const float * planes,
int pw,
int ph,
int bin,
float * out_rgb,
float * out_cnt )

Definition at line 1057 of file nn_model.c.

References i, and x.

Referenced by _k_bin_planes(), and main().

◆ dt_nn_cl_create()

dt_nn_cl_t * dt_nn_cl_create ( int program)

◆ dt_nn_cl_destroy()

void dt_nn_cl_destroy ( dt_nn_cl_t * cl)

◆ dt_nn_model_alignment()

int dt_nn_model_alignment ( const dt_nn_model_t * model)

Definition at line 468 of file nn_model.c.

References _lcm(), DT_NN_FUSION_COARSEST, and m.

Referenced by main(), process(), process_cl(), and tiling_callback().

◆ dt_nn_model_anchor()

int dt_nn_model_anchor ( const dt_nn_model_t * model)

Definition at line 450 of file nn_model.c.

References m.

Referenced by process(), and process_cl().

◆ dt_nn_model_bin()

int dt_nn_model_bin ( const dt_nn_model_t * model,
const int is_xtrans )

Definition at line 434 of file nn_model.c.

References m.

Referenced by main(), process(), process_cl(), and tiling_callback().

◆ dt_nn_model_coarse_in_channels()

int dt_nn_model_coarse_in_channels ( const dt_nn_model_t * model)

Definition at line 440 of file nn_model.c.

References m.

Referenced by commit_params(), and main().

◆ dt_nn_model_coarse_out_channels()

int dt_nn_model_coarse_out_channels ( const dt_nn_model_t * model)

Definition at line 445 of file nn_model.c.

References m.

Referenced by commit_params(), and main().

◆ dt_nn_model_free()

void dt_nn_model_free ( dt_nn_model_t * model)

Definition at line 413 of file nn_model.c.

References dt_nn_model_free_cl(), dt_pthread_mutex_destroy(), and m.

Referenced by cleanup_global(), main(), and main().

◆ dt_nn_model_in_channels()

int dt_nn_model_in_channels ( const dt_nn_model_t * model)

Definition at line 424 of file nn_model.c.

References m.

Referenced by commit_params(), main(), main(), process(), process_cl(), and tiling_callback().

◆ dt_nn_model_load()

dt_nn_model_t * dt_nn_model_load ( const char * path,
char * err,
size_t err_len )

◆ dt_nn_model_out_channels()

int dt_nn_model_out_channels ( const dt_nn_model_t * model)

Definition at line 429 of file nn_model.c.

References m.

Referenced by main(), and main().

◆ dt_nn_set_allocator()

void dt_nn_set_allocator ( dt_nn_alloc_f alloc_fn,
dt_nn_free_f free_fn )

Definition at line 77 of file nn_model.c.

References _nn_alloc_fn, and _nn_free_fn.

Referenced by cleanup_global(), and init_global().

◆ dt_nn_set_cancel()

void dt_nn_set_cancel ( dt_nn_cancel_f cancel_fn)

Definition at line 86 of file nn_model.c.

References _nn_cancel_fn.

Referenced by cleanup_global(), and init_global().

◆ dt_nn_unet_apply()

int dt_nn_unet_apply ( const dt_nn_model_t * model,
const float * in,
float * out,
int width,
int height )

Definition at line 1039 of file nn_model.c.

References _unet_forward(), height, in, m, out, and width.

Referenced by main().

◆ dt_nn_unet_apply_stage()

int dt_nn_unet_apply_stage ( const dt_nn_model_t * model,
int stage,
const float * in,
float * out,
int width,
int height,
int apply_residual )

Definition at line 1044 of file nn_model.c.

References _unet_forward(), height, in, m, out, and width.

Referenced by main(), main(), and process().

◆ dt_nn_unet_apply_stage_cl()

int dt_nn_unet_apply_stage_cl ( const dt_nn_model_t * model,
int stage,
dt_nn_cl_t * cl,
int devid,
cl_mem dev_in,
cl_mem dev_out,
int width,
int height )

Definition at line 1395 of file nn_model.c.

References _unet_forward_cl(), height, m, and width.

Referenced by main(), and process_cl().

◆ dt_nn_unet_scratch_bytes()

size_t dt_nn_unet_scratch_bytes ( const dt_nn_model_t * model,
int width,
int height )

Definition at line 744 of file nn_model.c.

References _unet_peak_floats(), height, m, NN_MIN, and width.

Referenced by main(), and process().

◆ dt_nn_unet_scratch_maxblock_per_px()

float dt_nn_unet_scratch_maxblock_per_px ( const dt_nn_model_t * model)

Definition at line 725 of file nn_model.c.

References m, and NN_MIN.

◆ dt_nn_unet_scratch_per_px()

float dt_nn_unet_scratch_per_px ( const dt_nn_model_t * model)

Definition at line 715 of file nn_model.c.

References _scratch_per_px(), and m.

Referenced by tiling_callback().

◆ dt_nn_unet_scratch_per_px_cl()

float dt_nn_unet_scratch_per_px_cl ( const dt_nn_model_t * model)

Definition at line 720 of file nn_model.c.

References _scratch_per_px(), and m.

Referenced by tiling_callback().

◆ dt_nn_upsample_nearest()

void dt_nn_upsample_nearest ( const float * in,
int ch,
int w,
int h,
int factor,
float * out )

Definition at line 1093 of file nn_model.c.

References ch, factor, in, out, and x.

Referenced by main(), and process().