Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/1241' into tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
hanatos committed Sep 26, 2016
2 parents 63dbcb3 + 73c9faf commit a4d29b0
Show file tree
Hide file tree
Showing 13 changed files with 864 additions and 1 deletion.
21 changes: 21 additions & 0 deletions data/darktableconfig.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,27 @@
<shortdescription>do high quality resampling during export</shortdescription>
<longdescription>the image will first be processed in full resolution, and downscaled at the very end. this can result in better quality sometimes, but will always be slower.</longdescription>
</dtconfig>
<dtconfig>
<name>darkroom/ui/rawoverexposed/mode</name>
<type>int</type>
<default>0</default>
<shortdescription/>
<longdescription/>
</dtconfig>
<dtconfig>
<name>darkroom/ui/rawoverexposed/colorscheme</name>
<type>int</type>
<default>0</default>
<shortdescription/>
<longdescription/>
</dtconfig>
<dtconfig>
<name>darkroom/ui/rawoverexposed/threshold</name>
<type>float</type>
<default>1.0</default>
<shortdescription/>
<longdescription/>
</dtconfig>
<dtconfig>
<name>darkroom/ui/overexposed/colorscheme</name>
<type>int</type>
Expand Down
110 changes: 110 additions & 0 deletions data/kernels/basic.cl
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,116 @@ overexposed (read_only image2d_t in, write_only image2d_t out, const int width,
}


/* kernel for the rawoverexposed plugin. */
kernel void
rawoverexposed_mark_cfa (
read_only image2d_t in, write_only image2d_t out, global float *pi,
const int width, const int height,
read_only image2d_t raw, const int raw_width, const int raw_height,
const unsigned int filters, global unsigned int *threshold,
global float *colors)
{
const int x = get_global_id(0);
const int y = get_global_id(1);

if(x >= width || y >= height) return;

const int piwidth = 2*width;
global float *ppi = pi + mad24(y, piwidth, 2*x);

const int raw_x = ppi[0];
const int raw_y = ppi[1];

if(raw_x < 0 || raw_y < 0 || raw_x >= raw_width || raw_y >= raw_height) return;

const uint raw_pixel = read_imageui(raw, sampleri, (int2)(raw_x, raw_y)).x;

const int c = FC(raw_y, raw_x, filters);

if(raw_pixel < threshold[c]) return;

float4 pixel = read_imagef(in, sampleri, (int2)(x, y));

global float *color = colors + mad24(4, c, 0);

// cfa color
pixel.x = color[0];
pixel.y = color[1];
pixel.z = color[2];

write_imagef (out, (int2)(x, y), pixel);
}

kernel void
rawoverexposed_mark_solid (
read_only image2d_t in, write_only image2d_t out, global float *pi,
const int width, const int height,
read_only image2d_t raw, const int raw_width, const int raw_height,
const unsigned int filters, global unsigned int *threshold,
const float4 solid_color)
{
const int x = get_global_id(0);
const int y = get_global_id(1);

if(x >= width || y >= height) return;

const int piwidth = 2*width;
global float *ppi = pi + mad24(y, piwidth, 2*x);

const int raw_x = ppi[0];
const int raw_y = ppi[1];

if(raw_x < 0 || raw_y < 0 || raw_x >= raw_width || raw_y >= raw_height) return;

const uint raw_pixel = read_imageui(raw, sampleri, (int2)(raw_x, raw_y)).x;

const int c = FC(raw_y, raw_x, filters);

if(raw_pixel < threshold[c]) return;

float4 pixel = read_imagef(in, sampleri, (int2)(x, y));

// solid color
pixel.xyz = solid_color.xyz;

write_imagef (out, (int2)(x, y), pixel);
}

kernel void
rawoverexposed_falsecolor (
read_only image2d_t in, write_only image2d_t out, global float *pi,
const int width, const int height,
read_only image2d_t raw, const int raw_width, const int raw_height,
const unsigned int filters, global unsigned int *threshold)
{
const int x = get_global_id(0);
const int y = get_global_id(1);

if(x >= width || y >= height) return;

const int piwidth = 2*width;
global float *ppi = pi + mad24(y, piwidth, 2*x);

const int raw_x = ppi[0];
const int raw_y = ppi[1];

if(raw_x < 0 || raw_y < 0 || raw_x >= raw_width || raw_y >= raw_height) return;

const uint raw_pixel = read_imageui(raw, sampleri, (int2)(raw_x, raw_y)).x;

const int c = FC(raw_y, raw_x, filters);

if(raw_pixel < threshold[c]) return;

float4 pixel = read_imagef(in, sampleri, (int2)(x, y));

// falsecolor
pixel[c] = 0.0;

write_imagef (out, (int2)(x, y), pixel);
}


/* kernel for the lowlight plugin. */
kernel void
lowlight (read_only image2d_t in, write_only image2d_t out, const int width, const int height,
Expand Down
1 change: 1 addition & 0 deletions po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ src/iop/lowlight.c
src/iop/lowpass.c
src/iop/monochrome.c
src/iop/nlmeans.c
src/iop/rawoverexposed.c
src/iop/overexposed.c
src/iop/profile_gamma.c
src/iop/rawdenoise.c
Expand Down
9 changes: 9 additions & 0 deletions src/develop/develop.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ void dt_dev_init(dt_develop_t *dev, int32_t gui_attached)

dev->proxy.exposure = NULL;

dev->rawoverexposed.enabled = FALSE;
dev->rawoverexposed.mode = dt_conf_get_int("darkroom/ui/rawoverexposed/mode");
dev->rawoverexposed.colorscheme = dt_conf_get_int("darkroom/ui/rawoverexposed/colorscheme");
dev->rawoverexposed.threshold = dt_conf_get_float("darkroom/ui/rawoverexposed/threshold");

dev->overexposed.enabled = FALSE;
dev->overexposed.colorscheme = dt_conf_get_int("darkroom/ui/overexposed/colorscheme");
dev->overexposed.lower = dt_conf_get_float("darkroom/ui/overexposed/lower");
Expand Down Expand Up @@ -152,6 +157,10 @@ void dt_dev_cleanup(dt_develop_t *dev)

g_list_free_full(dev->proxy.exposure, g_free);

dt_conf_set_int("darkroom/ui/rawoverexposed/mode", dev->rawoverexposed.mode);
dt_conf_set_int("darkroom/ui/rawoverexposed/colorscheme", dev->rawoverexposed.colorscheme);
dt_conf_set_float("darkroom/ui/rawoverexposed/threshold", dev->rawoverexposed.threshold);

dt_conf_set_int("darkroom/ui/overexposed/colorscheme", dev->overexposed.colorscheme);
dt_conf_set_float("darkroom/ui/overexposed/lower", dev->overexposed.lower);
dt_conf_set_float("darkroom/ui/overexposed/upper", dev->overexposed.upper);
Expand Down
25 changes: 25 additions & 0 deletions src/develop/develop.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ typedef enum dt_dev_overexposed_colorscheme_t
DT_DEV_OVEREXPOSED_PURPLEGREEN = 2
} dt_dev_overexposed_colorscheme_t;

typedef enum dt_dev_rawoverexposed_mode_t {
DT_DEV_RAWOVEREXPOSED_MODE_MARK_CFA = 0,
DT_DEV_RAWOVEREXPOSED_MODE_MARK_SOLID = 1,
DT_DEV_RAWOVEREXPOSED_MODE_FALSECOLOR = 2,
} dt_dev_rawoverexposed_mode_t;

typedef enum dt_dev_rawoverexposed_colorscheme_t {
DT_DEV_RAWOVEREXPOSED_RED = 0,
DT_DEV_RAWOVEREXPOSED_GREEN = 1,
DT_DEV_RAWOVEREXPOSED_BLUE = 2,
DT_DEV_RAWOVEREXPOSED_BLACK = 3
} dt_dev_rawoverexposed_colorscheme_t;

typedef enum dt_dev_histogram_type_t
{
DT_DEV_HISTOGRAM_LOGARITHMIC = 0,
Expand Down Expand Up @@ -195,6 +208,18 @@ typedef struct dt_develop_t
float upper;
} overexposed;

// for the raw overexposure indicator
struct
{
guint timeout;
GtkWidget *floating_window, *button; // yes, having gtk stuff in here is ugly. live with it.

gboolean enabled;
dt_dev_rawoverexposed_mode_t mode;
dt_dev_rawoverexposed_colorscheme_t colorscheme;
float threshold;
} rawoverexposed;

// the display profile related things (softproof, gamut check, profiles ...)
struct
{
Expand Down
6 changes: 6 additions & 0 deletions src/develop/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ typedef struct dt_iop_buffer_dsc_t
uint16_t raw_white_point;
} rawprepare;

struct
{
int enabled;
float coeffs[4];
} temperature;

/** sensor saturation, propagated through the operations */
float processed_maximum[4];
} dt_iop_buffer_dsc_t;
Expand Down
40 changes: 40 additions & 0 deletions src/dtgtk/paint.c
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,46 @@ void dtgtk_cairo_paint_overexposed(cairo_t *cr, gint x, gint y, gint w, gint h,
cairo_stroke(cr);
}

void dtgtk_cairo_paint_rawoverexposed(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags)
{
gint s = w < h ? w : h;
cairo_translate(cr, x + (w / 2.0) - (s / 2.0), y + (h / 2.0) - (s / 2.0));
cairo_scale(cr, s, s);

float line_width = 0.15;

cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
cairo_set_line_width(cr, line_width);

cairo_save(cr);

const double step = ((line_width / 2.0) + (1.0 - line_width) / 2.0);

// draw 4 CFA-like colored squares

cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 1.0); // red
cairo_rectangle(cr, (line_width / 2.0), (line_width / 2.0), step, step);
cairo_fill(cr);

cairo_set_source_rgba(cr, 0.0, 1.0, 0.0, 1.0); // green
cairo_rectangle(cr, step, (line_width / 2.0), step, step);
cairo_fill(cr);

cairo_set_source_rgba(cr, 0.0, 1.0, 0.0, 1.0); // green
cairo_rectangle(cr, (line_width / 2.0), step, step, step);
cairo_fill(cr);

cairo_set_source_rgba(cr, 0.0, 0.0, 1.0, 1.0); // blue
cairo_rectangle(cr, step, step, step, step);
cairo_fill(cr);

cairo_restore(cr);

/* outer rect */
cairo_rectangle(cr, (line_width / 2.0), (line_width / 2.0), 1.0 - line_width, 1.0 - line_width);
cairo_stroke(cr);
}

void dtgtk_cairo_paint_gamut_check(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags)
{
gint s = w < h ? w : h;
Expand Down
2 changes: 2 additions & 0 deletions src/dtgtk/paint.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ void dtgtk_cairo_paint_lock(cairo_t *cr, gint x, gint y, gint w, gint h, gint fl
void dtgtk_cairo_paint_check_mark(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags);
/** paint an over/under exposure icon */
void dtgtk_cairo_paint_overexposed(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags);
/** paint an raw over exposure icon */
void dtgtk_cairo_paint_rawoverexposed(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags);
/** paint a gamut check icon */
void dtgtk_cairo_paint_gamut_check(cairo_t *cr, gint x, gint y, gint w, gint h, gint flags);
/** paint a soft proofing icon */
Expand Down
1 change: 1 addition & 0 deletions src/iop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ add_iop(monochrome "monochrome.c" DEFAULT_VISIBLE)
add_iop(basecurve "basecurve.c" DEFAULT_VISIBLE)
add_iop(colorzones "colorzones.c")
add_iop(highlights "highlights.c")
add_iop(rawoverexposed "rawoverexposed.c")
add_iop(velvia "velvia.c")
add_iop(vignette "vignette.c" DEFAULT_VISIBLE)
add_iop(splittoning "splittoning.c")
Expand Down
Loading

0 comments on commit a4d29b0

Please sign in to comment.