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

Go to the source code of this file.

Typedefs

typedef enum dt_hl_cfa_t dt_hl_cfa_t
 

Enumerations

enum  dt_hl_cfa_t {
  HL_CFA_BAYER = 0 ,
  HL_CFA_XTRANS ,
  HL_CFA_PASSTHROUGH
}
 

Functions

static dt_hl_cfa_t _hl_cfa_strategy (const uint32_t filters)
 
void _interpolate_and_mask (const float *const restrict input, float *const restrict interpolated, float *const restrict clipping_mask, const dt_aligned_pixel_t clips_in, const dt_aligned_pixel_t det_scale, const dt_aligned_pixel_t white_balance, const uint32_t filters, const size_t width, const size_t height)
 
void _compute_laplacian_normalization (const float *const restrict input, const dt_iop_roi_t *const roi_in, const uint32_t filters, const uint8_t(*const xtrans)[6], dt_aligned_pixel_t normalization)
 
void _build_xtrans_bilinear_lookup (int32_t lookup[6][6][32], const dt_iop_roi_t *const roi_in, const uint8_t(*const xtrans)[6])
 
void _interpolate_and_mask_xtrans (const float *const restrict input, float *const restrict interpolated, float *const restrict clipping_mask, const dt_aligned_pixel_t clips, const dt_aligned_pixel_t white_balance, const dt_iop_roi_t *const roi_in, const int32_t lookup[6][6][32], const uint8_t(*const xtrans)[6], const size_t width, const size_t height)
 
void _interpolate_and_mask_passthrough (const float *const restrict input, float *const restrict interpolated, float *const restrict clipping_mask, const dt_aligned_pixel_t clips, const dt_aligned_pixel_t white_balance, const size_t width, const size_t height)
 
void _remosaic_and_replace (const float *const restrict input, const float *const restrict input_raw, const float *const restrict interpolated, const float *const restrict clipping_mask, float *const restrict output, const dt_aligned_pixel_t white_balance, const dt_aligned_pixel_t clips, const int clip_is_floor, const uint32_t filters, const size_t width, const size_t height)
 
void _remosaic_and_replace_passthrough (const float *const restrict input, const float *const restrict input_raw, const float *const restrict interpolated, const float *const restrict clipping_mask, float *const restrict output, const dt_aligned_pixel_t white_balance, const dt_aligned_pixel_t clips, const int clip_is_floor, const size_t width, const size_t height)
 
void _remosaic_and_replace_xtrans (const float *const restrict input, const float *const restrict input_raw, const float *const restrict interpolated, const float *const restrict clipping_mask, float *const restrict output, const dt_aligned_pixel_t white_balance, const dt_aligned_pixel_t clips, const int clip_is_floor, const dt_iop_roi_t *const roi_in, const uint8_t(*const xtrans)[6], const size_t width, const size_t height)
 

Typedef Documentation

◆ dt_hl_cfa_t

typedef enum dt_hl_cfa_t dt_hl_cfa_t

Enumeration Type Documentation

◆ dt_hl_cfa_t

Enumerator
HL_CFA_BAYER 
HL_CFA_XTRANS 
HL_CFA_PASSTHROUGH 

Definition at line 66 of file gather.h.

Function Documentation

◆ _build_xtrans_bilinear_lookup()

void _build_xtrans_bilinear_lookup ( int32_t  lookup[6][6][32],
const dt_iop_roi_t *const  roi_in,
const uint8_t(*)  xtrans[6] 
)

Build the X-Trans bilinear interpolation lookup for the current ROI phase.

The lookup keeps the contributing 3x3 neighbours explicit for each position of the 6x6 X-Trans period so CPU and OpenCL guided-laplacian paths start from the same simple bilinear reconstruction.

Definition at line 277 of file gather.c.

References __OMP_PARALLEL_FOR__, color, f, FCxtrans(), lookup(), row, weight(), and x.

Referenced by process_harmonic(), process_harmonic_cl(), process_laplacian(), and process_laplacian_xtrans_cl().

◆ _compute_laplacian_normalization()

void _compute_laplacian_normalization ( const float *const restrict  input,
const dt_iop_roi_t *const  roi_in,
const uint32_t  filters,
const uint8_t(*)  xtrans[6],
dt_aligned_pixel_t  normalization 
)

Compute channel normalization factors from the current raw ROI.

Guided Laplacians only needs a relative RGB normalization before the temporary bilinear reconstruction. Using the average measured value of each CFA color in the current tile keeps the normalization explicit and local to the data being reconstructed, instead of relying on the white balance declared upstream.

Definition at line 223 of file gather.c.

References __OMP_PARALLEL_FOR__, ALPHA, BLUE, FC(), FCxtrans(), GREEN, dt_iop_roi_t::height, i, RED, value, and dt_iop_roi_t::width.

Referenced by process_harmonic(), process_harmonic_cl(), and process_laplacian().

◆ _hl_cfa_strategy()

static dt_hl_cfa_t _hl_cfa_strategy ( const uint32_t  filters)
inlinestatic

Definition at line 74 of file gather.h.

References HL_CFA_BAYER, HL_CFA_PASSTHROUGH, and HL_CFA_XTRANS.

Referenced by process_harmonic(), and process_laplacian().

◆ _interpolate_and_mask()

void _interpolate_and_mask ( const float *const restrict  input,
float *const restrict  interpolated,
float *const restrict  clipping_mask,
const dt_aligned_pixel_t  clips_in,
const dt_aligned_pixel_t  det_scale,
const dt_aligned_pixel_t  white_balance,
const uint32_t  filters,
const size_t  width,
const size_t  height 
)

Definition at line 67 of file gather.c.

References __OMP_PARALLEL_FOR__, B, BLUE, FC(), for_each_channel, for_four_channels, GREEN, height, i, k, R, RED, RGB, and width.

Referenced by process_harmonic(), and process_laplacian().

◆ _interpolate_and_mask_passthrough()

void _interpolate_and_mask_passthrough ( const float *const restrict  input,
float *const restrict  interpolated,
float *const restrict  clipping_mask,
const dt_aligned_pixel_t  clips,
const dt_aligned_pixel_t  white_balance,
const size_t  width,
const size_t  height 
)

Non-raw / sRAW gather: copy the already-demosaiced 4-channel RGB through and build clip masks.

The passthrough counterpart of _interpolate_and_mask: for already-RGB input there is nothing to demosaic, so each channel is passed through (normalized by white_balance) and flagged clipped against clips[]. The knee never runs in this mode, so clips is the plain detection threshold (no det_scale band override). input/interpolated/clipping_mask are all 4-channel here.

Definition at line 424 of file gather.c.

References __OMP_PARALLEL_FOR__, B, BLUE, for_each_channel, GREEN, height, i, k, R, RED, RGB, and width.

Referenced by process_harmonic(), and process_laplacian().

◆ _interpolate_and_mask_xtrans()

void _interpolate_and_mask_xtrans ( const float *const restrict  input,
float *const restrict  interpolated,
float *const restrict  clipping_mask,
const dt_aligned_pixel_t  clips,
const dt_aligned_pixel_t  white_balance,
const dt_iop_roi_t *const  roi_in,
const int32_t  lookup[6][6][32],
const uint8_t(*)  xtrans[6],
const size_t  width,
const size_t  height 
)

Bilinearly demosaic the X-Trans raw mosaic and record clipped colors.

Guided Laplacians operates on temporary RGB data. For X-Trans we use the same lightweight bilinear neighbourhood as the linear VNG stage so the diffusion begins from a simple and explicit reconstruction.

Definition at line 317 of file gather.c.

References __OMP_PARALLEL_FOR__, ALPHA, BLUE, color, f, FCxtrans(), for_each_channel, GREEN, height, i, k, lookup(), MAX, MIN, RED, RGB, value, width, and x.

Referenced by process_harmonic(), and process_laplacian().

◆ _remosaic_and_replace()

void _remosaic_and_replace ( const float *const restrict  input,
const float *const restrict  input_raw,
const float *const restrict  interpolated,
const float *const restrict  clipping_mask,
float *const restrict  output,
const dt_aligned_pixel_t  white_balance,
const dt_aligned_pixel_t  clips,
const int  clip_is_floor,
const uint32_t  filters,
const size_t  width,
const size_t  height 
)

Definition at line 457 of file gather.c.

References __OMP_PARALLEL_FOR__, ALPHA, FC(), height, i, and width.

Referenced by process_harmonic(), and process_laplacian().

◆ _remosaic_and_replace_passthrough()

void _remosaic_and_replace_passthrough ( const float *const restrict  input,
const float *const restrict  input_raw,
const float *const restrict  interpolated,
const float *const restrict  clipping_mask,
float *const restrict  output,
const dt_aligned_pixel_t  white_balance,
const dt_aligned_pixel_t  clips,
const int  clip_is_floor,
const size_t  width,
const size_t  height 
)

Non-raw / sRAW scatter: composite the reconstructed RGB straight back, per channel.

The passthrough counterpart of _remosaic_and_replace. There is no CFA to scatter onto, so each channel composites with its OWN clip mask (a non-raw pixel carries all three colours, so an unclipped channel must keep its measured value while only clipped channels take the reconstruction). input/input_raw/interpolated/clipping_mask/output are all 4-channel; the ALPHA slot is passed through unchanged. clip_is_floor keeps the CFA floor semantics.

Definition at line 514 of file gather.c.

References __OMP_PARALLEL_FOR__, ALPHA, for_each_channel, height, i, and width.

Referenced by process_harmonic(), and process_laplacian().

◆ _remosaic_and_replace_xtrans()

void _remosaic_and_replace_xtrans ( const float *const restrict  input,
const float *const restrict  input_raw,
const float *const restrict  interpolated,
const float *const restrict  clipping_mask,
float *const restrict  output,
const dt_aligned_pixel_t  white_balance,
const dt_aligned_pixel_t  clips,
const int  clip_is_floor,
const dt_iop_roi_t *const  roi_in,
const uint8_t(*)  xtrans[6],
const size_t  width,
const size_t  height 
)

Reproject the reconstructed RGB back onto the X-Trans mosaic.

Definition at line 488 of file gather.c.

References __OMP_PARALLEL_FOR__, ALPHA, FCxtrans(), height, i, and width.

Referenced by process_harmonic(), and process_laplacian().