laplacian, DFT and Poisson routines More...
#include <stdlib.h>#include <math.h>#include <float.h>#include <fftw3.h>#include "retinex_pde_lib.h"
Go to the source code of this file.
Defines | |
| #define | M_PI 3.14159265358979323846 |
Functions | |
| static float * | discrete_laplacian_threshold (float *data_out, const float *data_in, size_t nx, size_t ny, float t) |
| compute the discrete laplacian of a 2D array with a threshold | |
| static double * | cos_table (size_t size) |
| compute a cosinus table | |
| static float * | retinex_poisson_dct (float *data, size_t nx, size_t ny, double m) |
| perform a Poisson PDE in the Fourier DCT space | |
| float * | retinex_pde (float *data, size_t nx, size_t ny, float t) |
| retinex PDE implementation | |
laplacian, DFT and Poisson routines
Definition in file retinex_pde_lib.c.
| #define M_PI 3.14159265358979323846 |
macro definition for Pi
Definition at line 36 of file retinex_pde_lib.c.
| static double* cos_table | ( | size_t | size | ) | [static] |
compute a cosinus table
Allocate and fill a table of n values cos(i Pi / n) for i in [0..n[.
| size | the table size |
Definition at line 147 of file retinex_pde_lib.c.

| static float* discrete_laplacian_threshold | ( | float * | data_out, | |
| const float * | data_in, | |||
| size_t | nx, | |||
| size_t | ny, | |||
| float | t | |||
| ) | [static] |
compute the discrete laplacian of a 2D array with a threshold
This function computes the discrete laplacian, ie
. On the border, differences with "outside of the array" are 0. If the absolute value of difference is < t, 0 is used instead.
This step takes a significant part of the computation time, and needs to be fast. In that case, we observed that (with our compiler and architecture):
| data_out | output array | |
| data_in | input array | |
| nx,ny | array size | |
| t | threshold |
Definition at line 71 of file retinex_pde_lib.c.

| float* retinex_pde | ( | float * | data, | |
| size_t | nx, | |||
| size_t | ny, | |||
| float | t | |||
| ) |
retinex PDE implementation
This function solves the Retinex PDE equation with forward and backward DCT.
The input array is processed as follow:
; | data | input/output array | |
| nx,ny | dimension | |
| t | retinex threshold |
Definition at line 268 of file retinex_pde_lib.c.


| static float* retinex_poisson_dct | ( | float * | data, | |
| size_t | nx, | |||
| size_t | ny, | |||
| double | m | |||
| ) | [static] |
perform a Poisson PDE in the Fourier DCT space
if
, 
When this function is successively used on arrays of identical size, the trigonometric computation is redundant and could be kept in memory for a faster code. However, in our use case, the speedup is marginal and we prefer to recompute this data and keep the code simple.
| data | the dct complex coefficients, of size nx x ny | |
| nx,ny | data array size | |
| m | global multiplication parameter (DCT normalization) |
Definition at line 190 of file retinex_pde_lib.c.


1.7.1