Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
locallaplacian.c File Reference
#include "common/darktable.h"
#include "common/locallaplacian.h"
#include "common/math.h"
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
+ Include dependency graph for locallaplacian.c:

Macros

#define max_levels   30
 
#define num_gamma   6
 
#define debug_dump_PFM(f, b, w, h)
 
#define LL_FILL(fallback)
 

Functions

static int dl (int size, const int level)
 
static float ll_expand_gaussian (const float *const coarse, const int i, const int j, const int wd, const int ht)
 
static void ll_fill_boundary1 (float *const input, const int wd, const int ht)
 
static void ll_fill_boundary2 (float *const input, const int wd, const int ht)
 
static void pad_by_replication (float *buf, const uint32_t w, const uint32_t h, const uint32_t padding)
 
static void gauss_expand (const float *const input, float *const fine, const int wd, const int ht)
 
static void gauss_reduce (const float *const input, float *const coarse, const int wd, const int ht)
 
static float * ll_pad_input (const float *const input, const int wd, const int ht, const int max_supp, int *wd2, int *ht2, local_laplacian_boundary_t *b)
 
static float ll_laplacian (const float *const coarse, const float *const fine, const int i, const int j, const int wd, const int ht)
 
static float curve_scalar (const float x, const float g, const float sigma, const float shadows, const float highlights, const float clarity)
 
void apply_curve (float *const out, const float *const in, const uint32_t w, const uint32_t h, const uint32_t padding, const float g, const float sigma, const float shadows, const float highlights, const float clarity)
 
void local_laplacian_internal (const float *const input, float *const out, const int wd, const int ht, const float sigma, const float shadows, const float highlights, const float clarity, const int use_sse2, local_laplacian_boundary_t *b)
 
size_t local_laplacian_memory_use (const int width, const int height)
 
size_t local_laplacian_singlebuffer_size (const int width, const int height)
 

Macro Definition Documentation

◆ debug_dump_PFM

#define debug_dump_PFM (   f,
  b,
  w,
 
)

◆ LL_FILL

#define LL_FILL (   fallback)
Value:
do {\
float isx = ((i - max_supp) + b->roi->x)/b->roi->scale;\
float isy = ((j - max_supp) + b->roi->y)/b->roi->scale;\
if(isx < 0 || isy >= b->buf->width\
|| isy < 0 || isy >= b->buf->height)\
out[*wd2*j+i] = (fallback);\
else\
{\
int px = CLAMP(isx / (float)b->buf->width * b->wd + (b->pwd-b->wd)/2, 0, b->pwd-1);\
int py = CLAMP(isy / (float)b->buf->height * b->ht + (b->pht-b->ht)/2, 0, b->pht-1);\
\
out[*wd2*j+i] = b->pad0[b->pwd*py+px];\
} } while(0)

◆ max_levels

#define max_levels   30

◆ num_gamma

#define num_gamma   6

Function Documentation

◆ apply_curve()

void apply_curve ( float *const  out,
const float *const  in,
const uint32_t  w,
const uint32_t  h,
const uint32_t  padding,
const float  g,
const float  sigma,
const float  shadows,
const float  highlights,
const float  clarity 
)

◆ curve_scalar()

static float curve_scalar ( const float  x,
const float  g,
const float  sigma,
const float  shadows,
const float  highlights,
const float  clarity 
)
inlinestatic

References CLAMPS.

Referenced by apply_curve().

◆ dl()

static int dl ( int  size,
const int  level 
)
inlinestatic

◆ gauss_expand()

static void gauss_expand ( const float *const  input,
float *const  fine,
const int  wd,
const int  ht 
)
inlinestatic

◆ gauss_reduce()

static void gauss_reduce ( const float *const  input,
float *const  coarse,
const int  wd,
const int  ht 
)
inlinestatic

References ll_fill_boundary1().

Referenced by local_laplacian_internal().

◆ ll_expand_gaussian()

static float ll_expand_gaussian ( const float *const  coarse,
const int  i,
const int  j,
const int  wd,
const int  ht 
)
inlinestatic

Referenced by gauss_expand(), and ll_laplacian().

◆ ll_fill_boundary1()

static void ll_fill_boundary1 ( float *const  input,
const int  wd,
const int  ht 
)
inlinestatic

Referenced by gauss_reduce().

◆ ll_fill_boundary2()

static void ll_fill_boundary2 ( float *const  input,
const int  wd,
const int  ht 
)
inlinestatic

Referenced by gauss_expand().

◆ ll_laplacian()

static float ll_laplacian ( const float *const  coarse,
const float *const  fine,
const int  i,
const int  j,
const int  wd,
const int  ht 
)
inlinestatic

References CLAMPS, and ll_expand_gaussian().

Referenced by local_laplacian_internal().

◆ ll_pad_input()

static float * ll_pad_input ( const float *const  input,
const int  wd,
const int  ht,
const int  max_supp,
int *  wd2,
int *  ht2,
local_laplacian_boundary_t b 
)
inlinestatic
Todo:
: linear interpolation?
Todo:
: linear interpolation?
Todo:
: linear interpolation?
Todo:
: linear interpolation?

References dt_alloc_align_float(), LL_FILL, and pad_by_replication().

Referenced by local_laplacian_internal().

◆ local_laplacian_internal()

void local_laplacian_internal ( const float *const  input,
float *const  out,
const int  wd,
const int  ht,
const float  sigma,
const float  shadows,
const float  highlights,
const float  clarity,
const int  use_sse2,
local_laplacian_boundary_t b 
)

◆ local_laplacian_memory_use()

size_t local_laplacian_memory_use ( const int  width,
const int  height 
)

References dl(), height, max_levels, MIN, num_gamma, and width.

Referenced by tiling_callback().

◆ local_laplacian_singlebuffer_size()

size_t local_laplacian_singlebuffer_size ( const int  width,
const int  height 
)

References dl(), height, max_levels, MIN, and width.

Referenced by tiling_callback().

◆ pad_by_replication()

static void pad_by_replication ( float *  buf,
const uint32_t  w,
const uint32_t  h,
const uint32_t  padding 
)
static

Referenced by apply_curve(), and ll_pad_input().