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

Data Structures

struct  tile
 
struct  color_image
 

Macros

#define GF_TILE_SIZE   512
 
#define SIMD_FOR   for
 
#define _mm_prefetch(where, hint)
 
#define INP_MEAN   0
 
#define GUIDE_MEAN_R   1
 
#define GUIDE_MEAN_G   2
 
#define GUIDE_MEAN_B   3
 
#define COV_R   0
 
#define COV_G   1
 
#define COV_B   2
 
#define VAR_RR   3
 
#define VAR_RG   4
 
#define VAR_RB   5
 
#define VAR_GG   6
 
#define VAR_BB   8
 
#define VAR_GB   7
 
#define A_RED   0
 
#define A_GREEN   1
 
#define A_BLUE   2
 
#define B   3
 

Typedefs

typedef struct tile tile
 
typedef struct color_image color_image
 

Functions

static color_image new_color_image (int width, int height, int ch)
 
static void free_color_image (color_image *img_p)
 
static float * get_color_pixel (color_image img, size_t i)
 
static void guided_filter_tiling (color_image imgg, gray_image img, gray_image img_out, tile target, const int w, const float eps, const float guide_weight, const float min, const float max)
 
static int compute_tile_height (const int height, const int w)
 
static int compute_tile_width (const int width, const int w)
 
void guided_filter (const float *const guide, const float *const in, float *const out, const int width, const int height, const int ch, const int w, const float sqrt_eps, const float guide_weight, const float min, const float max)
 

Macro Definition Documentation

◆ _mm_prefetch

#define _mm_prefetch (   where,
  hint 
)

◆ A_BLUE

#define A_BLUE   2

◆ A_GREEN

#define A_GREEN   1

◆ A_RED

#define A_RED   0

◆ B

#define B   3

◆ COV_B

#define COV_B   2

◆ COV_G

#define COV_G   1

◆ COV_R

#define COV_R   0

◆ GF_TILE_SIZE

#define GF_TILE_SIZE   512

◆ GUIDE_MEAN_B

#define GUIDE_MEAN_B   3

◆ GUIDE_MEAN_G

#define GUIDE_MEAN_G   2

◆ GUIDE_MEAN_R

#define GUIDE_MEAN_R   1

◆ INP_MEAN

#define INP_MEAN   0

◆ SIMD_FOR

#define SIMD_FOR   for

◆ VAR_BB

#define VAR_BB   8

◆ VAR_GB

#define VAR_GB   7

◆ VAR_GG

#define VAR_GG   6

◆ VAR_RB

#define VAR_RB   5

◆ VAR_RG

#define VAR_RG   4

◆ VAR_RR

#define VAR_RR   3

Typedef Documentation

◆ color_image

typedef struct color_image color_image

◆ tile

typedef struct tile tile

Function Documentation

◆ compute_tile_height()

static int compute_tile_height ( const int  height,
const int  w 
)
static

References GF_TILE_SIZE, height, and max_i().

Referenced by guided_filter().

◆ compute_tile_width()

static int compute_tile_width ( const int  width,
const int  w 
)
static

References GF_TILE_SIZE, max_i(), and width.

Referenced by guided_filter().

◆ free_color_image()

static void free_color_image ( color_image img_p)
inlinestatic

References color_image::data, and dt_free_align.

Referenced by guided_filter_tiling().

◆ get_color_pixel()

static float * get_color_pixel ( color_image  img,
size_t  i 
)
inlinestatic

◆ guided_filter()

void guided_filter ( const float *const  guide,
const float *const  in,
float *const  out,
const int  width,
const int  height,
const int  ch,
const int  w,
const float  sqrt_eps,
const float  guide_weight,
const float  min,
const float  max 
)

◆ guided_filter_tiling()

◆ new_color_image()

static color_image new_color_image ( int  width,
int  height,
int  ch 
)
inlinestatic
Todo:
: the code consuming color_image doesn't check if we actually allocated the buffer

References dt_alloc_align_float(), height, and width.

Referenced by guided_filter_tiling().