Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
interpolation.h File Reference
+ Include dependency graph for interpolation.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_interpolation
 
struct  dt_interpolation_cl_global_t
 

Typedefs

typedef float(* dt_interpolation_func) (float *taps, size_t num_taps, float width, float first_tap, float interval)
 
typedef struct dt_interpolation_cl_global_t dt_interpolation_cl_global_t
 

Enumerations

enum  dt_interpolation_type {
  DT_INTERPOLATION_FIRST = 0 ,
  DT_INTERPOLATION_BILINEAR = DT_INTERPOLATION_FIRST ,
  DT_INTERPOLATION_BICUBIC ,
  DT_INTERPOLATION_MITCHELL ,
  DT_INTERPOLATION_LAST ,
  DT_INTERPOLATION_DEFAULT = DT_INTERPOLATION_MITCHELL ,
  DT_INTERPOLATION_DEFAULT_WARP = DT_INTERPOLATION_MITCHELL ,
  DT_INTERPOLATION_USERPREF ,
  DT_INTERPOLATION_USERPREF_WARP
}
 

Functions

float dt_interpolation_compute_sample (const struct dt_interpolation *itor, const float *in, const float x, const float y, const int width, const int height, const int samplestride, const int linestride)
 
void dt_interpolation_compute_pixel4c (const struct dt_interpolation *itor, const float *in, float *out, const float x, const float y, const int width, const int height, const int linestride)
 
const struct dt_interpolationdt_interpolation_new (enum dt_interpolation_type type)
 
void dt_interpolation_resample (const struct dt_interpolation *itor, float *out, const dt_iop_roi_t *const roi_out, const float *const in, const dt_iop_roi_t *const roi_in)
 
void dt_interpolation_resample_roi (const struct dt_interpolation *itor, float *out, const dt_iop_roi_t *const roi_out, const float *const in, const dt_iop_roi_t *const roi_in)
 
dt_interpolation_cl_global_tdt_interpolation_init_cl_global (void)
 
void dt_interpolation_free_cl_global (dt_interpolation_cl_global_t *g)
 
int dt_interpolation_resample_cl (const struct dt_interpolation *itor, int devid, cl_mem dev_out, const dt_iop_roi_t *const roi_out, cl_mem dev_in, const dt_iop_roi_t *const roi_in)
 
int dt_interpolation_resample_roi_cl (const struct dt_interpolation *itor, int devid, cl_mem dev_out, const dt_iop_roi_t *const roi_out, cl_mem dev_in, const dt_iop_roi_t *const roi_in)
 
void dt_interpolation_resample_1c (const struct dt_interpolation *itor, float *out, const dt_iop_roi_t *const roi_out, const float *const in, const dt_iop_roi_t *const roi_in)
 
void dt_interpolation_resample_roi_1c (const struct dt_interpolation *itor, float *out, const dt_iop_roi_t *const roi_out, const float *const in, const dt_iop_roi_t *const roi_in)
 

Typedef Documentation

◆ dt_interpolation_cl_global_t

◆ dt_interpolation_func

typedef float(* dt_interpolation_func) (float *taps, size_t num_taps, float width, float first_tap, float interval)

Interpolation function

Definition at line 51 of file interpolation.h.

Enumeration Type Documentation

◆ dt_interpolation_type

Available interpolations

Enumerator
DT_INTERPOLATION_FIRST 

Helper for easy iteration on interpolators

DT_INTERPOLATION_BILINEAR 

Bilinear interpolation (aka tent filter)

DT_INTERPOLATION_BICUBIC 

Bicubic interpolation (Catmull-Rom, -0.5 parameter)

DT_INTERPOLATION_MITCHELL 

Mitchell-Netravali cubic (B=C=1/3), near halo-free

DT_INTERPOLATION_LAST 

Helper for easy iteration on interpolators

DT_INTERPOLATION_DEFAULT 
DT_INTERPOLATION_DEFAULT_WARP 
DT_INTERPOLATION_USERPREF 

can be specified so that user setting is chosen

DT_INTERPOLATION_USERPREF_WARP 

can be specified so that user setting is chosen

Definition at line 37 of file interpolation.h.

Function Documentation

◆ dt_interpolation_compute_pixel4c()

void dt_interpolation_compute_pixel4c ( const struct dt_interpolation itor,
const float *  in,
float *  out,
const float  x,
const float  y,
const int  width,
const int  height,
const int  linestride 
)

Compute an interpolated 4 component pixel.

This function computes a full 4 component pixel. This helps a bit speedwise as interpolation coordinates are supposed to be the same for all components. Thus we can share horizontal and vertical interpolation kernels across all components

NB: a pixel is to be four floats big in stride

Parameters
inPointer to the input image
outPointer to the output sample
itorinterpolator to be used
xX-Coordinate of the requested sample
yY-Coordinate of the requested sample
widthWidth of the input image
heightWidth of the input image
linestrideStride in number of pixels for complete line

Definition at line 491 of file interpolation.c.

References BORDER_CLAMP, DT_ALIGNED_ARRAY, dt_simd_set1(), dt_store_simd(), height, i, INTERPOLATION_BORDER_MODE, MAX_HALF_FILTER_WIDTH, MAX_KERNEL_REQ, out, width, dt_interpolation::width, and x.

Referenced by apply_global_distortion_map(), distort_mask(), process(), and process().

◆ dt_interpolation_compute_sample()

float dt_interpolation_compute_sample ( const struct dt_interpolation itor,
const float *  in,
const float  x,
const float  y,
const int  width,
const int  height,
const int  samplestride,
const int  linestride 
)

Compute a single interpolated sample.

This function computes a single interpolated sample. Implied costs are:

  • Horizontal filtering kernel computation
  • Vertical filtering kernel computation
  • Sample computation
Parameters
inInput image
itorinterpolator to be used
xX-Coordinate of the requested sample
yY-Coordinate of the requested sample
widthWidth of the input image
heightWidth of the input image
samplestrideStride in bytes for a sample
linestrideStride in bytes for complete line
Returns
computed sample

Definition at line 391 of file interpolation.c.

References BORDER_CLAMP, DT_ALIGNED_ARRAY, height, i, INTERPOLATION_BORDER_MODE, MAX_HALF_FILTER_WIDTH, MAX_KERNEL_REQ, r, width, dt_interpolation::width, and x.

Referenced by apply_global_distortion_map(), distort_mask(), and process().

◆ dt_interpolation_free_cl_global()

void dt_interpolation_free_cl_global ( dt_interpolation_cl_global_t g)

Definition at line 1068 of file interpolation.c.

References dt_free, dt_opencl_free_kernel(), g, and IS_NULL_PTR.

Referenced by dt_opencl_cleanup().

◆ dt_interpolation_init_cl_global()

dt_interpolation_cl_global_t * dt_interpolation_init_cl_global ( void  )

◆ dt_interpolation_new()

◆ dt_interpolation_resample()

void dt_interpolation_resample ( const struct dt_interpolation itor,
float *  out,
const dt_iop_roi_t *const  roi_out,
const float *const  in,
const dt_iop_roi_t *const  roi_in 
)

Image resampler.

Resamples the image "in" to "out" according to roi values. Here is the exact contract:

  • The resampling is isotropic (same for both x and y directions), represented by roi_out->scale
  • It generates roi_out->width samples horizontally whose positions span from roi_out->x to roi_out->x + roi_out->width - 1
  • It generates roi_out->height samples vertically whose positions span from roi_out->y to roi_out->y + roi_out->height - 1
Parameters
itor[in] Interpolator to use
out[out] Will hold the resampled image
roi_out[in] Region of interest of the resampled image
out_stride[in] Output line stride in bytes
in[in] Will hold the resampled image
roi_in[in] Region of interest of the original image
in_stride[in] Input line stride in bytes

Applies resampling (re-scaling) on full input and output buffers. roi_in and roi_out define the part of the buffers that is affected.

Definition at line 1027 of file interpolation.c.

References _interpolation_resample_plain(), and out.

Referenced by dt_interpolation_resample_roi(), dt_iop_clip_and_zoom(), and process().

◆ dt_interpolation_resample_1c()

void dt_interpolation_resample_1c ( const struct dt_interpolation itor,
float *  out,
const dt_iop_roi_t *const  roi_out,
const float *const  in,
const dt_iop_roi_t *const  roi_in 
)

Applies resampling (re-scaling) on full input and output buffers. roi_in and roi_out define the part of the buffers that is affected.

Definition at line 1404 of file interpolation.c.

References _interpolation_resample_1c_plain(), and out.

Referenced by dt_interpolation_resample_roi_1c().

◆ dt_interpolation_resample_cl()

int dt_interpolation_resample_cl ( const struct dt_interpolation itor,
const int  devid,
cl_mem  dev_out,
const dt_iop_roi_t *const  roi_out,
cl_mem  dev_in,
const dt_iop_roi_t *const  roi_in 
)

Image resampler OpenCL version.

Resamples the image "in" to "out" according to roi values. Here is the exact contract:

  • The resampling is isotropic (same for both x and y directions), represented by roi_out->scale
  • It generates roi_out->width samples horizontally whose positions span from roi_out->x to roi_out->x + roi_out->width - 1
  • It generates roi_out->height samples vertically whose positions span from roi_out->y to roi_out->y + roi_out->height - 1
Parameters
itor[in] Interpolator to use
devid[in] The device to run on
dev_out[out] Will hold the resampled image
roi_out[in] Region of interest of the resampled image
out_stride[in] Output line stride in bytes
dev_in[in] Will hold the resampled image
roi_in[in] Region of interest of the original image
in_stride[in] Input line stride in bytes

Applies resampling (re-scaling) on full input and output buffers. roi_in and roi_out define the part of the buffers that is affected.

Definition at line 1091 of file interpolation.c.

References _prepare_resampling_plan(), darktable, dt_opencl_copy_host_to_device_constant(), DT_OPENCL_DEFAULT_ERROR, dt_opencl_enqueue_copy_image(), dt_opencl_enqueue_kernel_2d_with_local(), dt_opencl_local_buffer_opt(), dt_opencl_release_mem_object(), dt_opencl_set_kernel_arg(), dt_pixelpipe_cache_free_align, error(), height, dt_iop_roi_t::height, dt_opencl_t::interpolation, IS_NULL_PTR, k, kernel(), dt_interpolation_cl_global_t::kernel_interpolation_resample, MAX, darktable_t::opencl, roundToNextPowerOfTwo(), ROUNDUP, ROUNDUPDWD, dt_iop_roi_t::scale, dt_opencl_local_buffer_t::sizey, width, dt_iop_roi_t::width, dt_iop_roi_t::x, dt_opencl_local_buffer_t::xoffset, and dt_iop_roi_t::y.

Referenced by _drawlayer_copy_or_resample_layer_roi(), dt_interpolation_resample_roi_cl(), and dt_iop_clip_and_zoom_cl().

◆ dt_interpolation_resample_roi()

void dt_interpolation_resample_roi ( const struct dt_interpolation itor,
float *  out,
const dt_iop_roi_t *const  roi_out,
const float *const  in,
const dt_iop_roi_t *const  roi_in 
)

Applies resampling (re-scaling) on a specific region-of-interest of an image. The input and output buffers hold exactly those roi's. roi_in and roi_out define the relative positions of the roi's within the full input and output image, respectively.

Definition at line 1041 of file interpolation.c.

References dt_interpolation_resample(), and out.

Referenced by dt_iop_clip_and_zoom_roi().

◆ dt_interpolation_resample_roi_1c()

void dt_interpolation_resample_roi_1c ( const struct dt_interpolation itor,
float *  out,
const dt_iop_roi_t *const  roi_out,
const float *const  in,
const dt_iop_roi_t *const  roi_in 
)

Applies resampling (re-scaling) on a specific region-of-interest of an image. The input and output buffers hold exactly those roi's. roi_in and roi_out define the relative positions of the roi's within the full input and output image, respectively.

Definition at line 1417 of file interpolation.c.

References dt_interpolation_resample_1c(), and out.

Referenced by distort_mask(), and dt_dev_distort_detail_mask().

◆ dt_interpolation_resample_roi_cl()

int dt_interpolation_resample_roi_cl ( const struct dt_interpolation itor,
const int  devid,
cl_mem  dev_out,
const dt_iop_roi_t *const  roi_out,
cl_mem  dev_in,
const dt_iop_roi_t *const  roi_in 
)

Applies resampling (re-scaling) on a specific region-of-interest of an image. The input and output buffers hold exactly those roi's. roi_in and roi_out define the relative positions of the roi's within the full input and output image, respectively.

Definition at line 1265 of file interpolation.c.

References dt_interpolation_resample_cl().

Referenced by dt_iop_clip_and_zoom_roi_cl().