Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/chart/colorchart.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static int strinc(char *label, size_t buffer_size)
return 1;
}

void set_color(box_t *box, dt_colorspaces_color_profile_type_t color_space, float c0, float c1, float c2)
void checker_set_color(box_t *box, dt_colorspaces_color_profile_type_t color_space, float c0, float c1, float c2)
{
box->color_space = color_space;
box->color[0] = c0;
Expand Down Expand Up @@ -487,7 +487,7 @@ chart_t *parse_cht(const char *filename)
float c1 = parse_double(&c);
if(c - line >= len) ERROR;
float c2 = parse_double(&c);
set_color(box, color_space, c0, c1, c2);
checker_set_color(box, color_space, c0, c1, c2);
}
if(n_colors != 0) ERROR;
}
Expand Down Expand Up @@ -599,7 +599,7 @@ int parse_it8(const char *filename, chart_t *chart)
goto error;
}

set_color(box, color_space, cmsIT8GetDataDbl(hIT8, key, columns[0]), cmsIT8GetDataDbl(hIT8, key, columns[1]),
checker_set_color(box, color_space, cmsIT8GetDataDbl(hIT8, key, columns[0]), cmsIT8GetDataDbl(hIT8, key, columns[1]),
cmsIT8GetDataDbl(hIT8, key, columns[2]));
}

Expand Down
2 changes: 1 addition & 1 deletion src/chart/colorchart.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ typedef struct chart_t
void free_chart(chart_t *chart);
chart_t *parse_cht(const char *filename);
int parse_it8(const char *filename, chart_t *chart);
void set_color(box_t *box, dt_colorspaces_color_profile_type_t color_space, float c0, float c1, float c2);
void checker_set_color(box_t *box, dt_colorspaces_color_profile_type_t color_space, float c0, float c1, float c2);

// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
// vim: shiftwidth=2 expandtab tabstop=2 cindent
Expand Down
6 changes: 6 additions & 0 deletions src/chart/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ typedef struct image_t
int get_homography(const point_t *source, const point_t *target, double *h);
point_t apply_homography(point_t p, const double *h);

static inline double apply_homography_scaling(point_t p, const double *h)
{
const double s = p.x * h[2 * 3 + 0] + p.y * h[2 * 3 + 1] + h[2 * 3 + 2];
return s;
}

// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
// vim: shiftwidth=2 expandtab tabstop=2 cindent
// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces
Expand Down
4 changes: 2 additions & 2 deletions src/chart/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ static void collect_source_patches_foreach(gpointer key, gpointer value, gpointe

get_xyz_sample_from_image(&self->source, self->source.shrink, box, xyz);

set_color(patch, DT_COLORSPACE_XYZ, xyz[0] * 100.0, xyz[1] * 100.0, xyz[2] * 100.0);
checker_set_color(patch, DT_COLORSPACE_XYZ, xyz[0] * 100.0, xyz[1] * 100.0, xyz[2] * 100.0);
}

static void collect_reference_patches_foreach(gpointer key, gpointer value, gpointer user_data)
Expand All @@ -1484,7 +1484,7 @@ static void collect_reference_patches_foreach(gpointer key, gpointer value, gpoi

get_xyz_sample_from_image(&self->reference, self->reference.shrink, patch, xyz);

set_color(patch, DT_COLORSPACE_XYZ, xyz[0] * 100.0, xyz[1] * 100.0, xyz[2] * 100.0);
checker_set_color(patch, DT_COLORSPACE_XYZ, xyz[0] * 100.0, xyz[1] * 100.0, xyz[2] * 100.0);
}

static box_t *find_patch(GHashTable *table, gpointer key)
Expand Down
318 changes: 318 additions & 0 deletions src/common/colorchecker.h

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions src/common/colorspaces_inline_conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,29 @@ static inline void dt_Lab_to_XYZ(const float Lab[3], float XYZ[3])
}


#ifdef _OPENMP
#pragma omp declare simd aligned(xyY, XYZ:16)
#endif
static inline void dt_XYZ_to_xyY(const float XYZ[3], float xyY[3])
{
const float sum = XYZ[0] + XYZ[1] + XYZ[2];
xyY[0] = XYZ[0] / sum;
xyY[1] = XYZ[1] / sum;
xyY[2] = XYZ[1];
}


#ifdef _OPENMP
#pragma omp declare simd aligned(xyY, XYZ:16)
#endif
static inline void dt_xyY_to_XYZ(const float xyY[3], float XYZ[3])
{
XYZ[0] = xyY[2] * xyY[0] / xyY[1];
XYZ[1] = xyY[2];
XYZ[2] = xyY[2] * (1.f - xyY[0] - xyY[1]) / xyY[1];
}


#ifdef _OPENMP
#pragma omp declare simd aligned(xyY, uvY:16)
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/iop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ endif(GMIC_FOUND)
add_iop(toneequal "toneequal.c" DEFAULT_VISIBLE)
add_iop(filmicrgb "filmicrgb.c")
add_iop(negadoctor "negadoctor.c")
add_iop(channelmixerrgb "channelmixerrgb.c")
add_iop(channelmixerrgb "channelmixerrgb.c" "../chart/common.c")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong. The second parameter is a flag (DEFAULT_VISIBLE) to set the default visibility of the module. I don't think you need to add "../chart/common.c" here at all as it is not an iop. If the file is to be compiler it should be added into src/CMakeFile.list.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is ok, I was wrong sorry for the noise.


if(Rsvg2_FOUND)
add_iop(watermark "watermark.c")
Expand Down
Loading