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
 

Typedefs

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

Enumerations

enum  dt_interpolation_type {
  DT_INTERPOLATION_FIRST = 0 ,
  DT_INTERPOLATION_BILINEAR = DT_INTERPOLATION_FIRST ,
  DT_INTERPOLATION_BICUBIC ,
  DT_INTERPOLATION_LANCZOS2 ,
  DT_INTERPOLATION_LANCZOS3 ,
  DT_INTERPOLATION_LAST ,
  DT_INTERPOLATION_DEFAULT = DT_INTERPOLATION_BILINEAR ,
  DT_INTERPOLATION_DEFAULT_WARP = DT_INTERPOLATION_BICUBIC ,
  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)
 
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_func

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

Interpolation function

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 (with -0.5 parameter)

DT_INTERPOLATION_LANCZOS2 

Lanczos interpolation (with 2 lobes)

DT_INTERPOLATION_LANCZOS3 

Lanczos interpolation (with 3 lobes)

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

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

References _clip(), _compute_upsampling_kernel(), _prepare_tap_boundaries(), BORDER_CLAMP, copy_pixel(), DT_ALIGNED_ARRAY, for_each_channel, height, INTERPOLATION_BORDER_MODE, MAX_HALF_FILTER_WIDTH, MAX_KERNEL_REQ, width, and dt_interpolation::width.

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

References _clip(), _compute_upsampling_kernel(), _prepare_tap_boundaries(), BORDER_CLAMP, DT_ALIGNED_ARRAY, height, INTERPOLATION_BORDER_MODE, MAX_HALF_FILTER_WIDTH, MAX_KERNEL_REQ, width, and dt_interpolation::width.

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

◆ 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.

References _interpolation_resample_plain().

Referenced by dt_interpolation_resample_roi(), and dt_iop_clip_and_zoom().

◆ 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.

References _interpolation_resample_1c_plain().

Referenced by dt_interpolation_resample_roi_1c().

◆ 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.

References dt_interpolation_resample(), dt_iop_roi_t::x, and dt_iop_roi_t::y.

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.

References dt_interpolation_resample_1c(), dt_iop_roi_t::x, and dt_iop_roi_t::y.

Referenced by distort_mask().