Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
christte committed Oct 18, 2012
2 parents 38c0da3 + 9619c93 commit 7126b1d
Show file tree
Hide file tree
Showing 38 changed files with 3,161 additions and 2,071 deletions.
5 changes: 3 additions & 2 deletions data/darktableconfig.dtd
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!ELEMENT dtconfiglist (dtconfig)*>
<!ELEMENT dtconfig (name,type,default,shortdescription?,longdescription?)>
<!ELEMENT dtconfig (name,type,default,capability?,shortdescription?,longdescription?)>
<!ATTLIST dtconfig
prefs (core|gui) #IMPLIED
capability CDATA #IMPLIED
>
<!ELEMENT name (#PCDATA)>
<!ELEMENT type (#PCDATA|enum)*>
Expand All @@ -13,4 +14,4 @@
<!ELEMENT option (#PCDATA)>
<!ELEMENT default (#PCDATA)>
<!ELEMENT shortdescription (#PCDATA)>
<!ELEMENT longdescription (#PCDATA)>
<!ELEMENT longdescription (#PCDATA)>
2 changes: 1 addition & 1 deletion data/darktableconfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<shortdescription>write sidecar file for each image</shortdescription>
<longdescription>these redundant files can later be re-imported into a different database, preserving your changes to the image.</longdescription>
</dtconfig>
<dtconfig prefs="core">
<dtconfig prefs="core" capability="opencl">
<name>opencl</name>
<type>bool</type>
<default>true</default>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
</sect4>

<sect4><title>Usage</title>
<para>A bilateral filter is an edge-preserving noise reduction filter. The intensity values at each pixel in an image are replaced by a weighted average of intensity values from nearby pixels.
The weights - based on a Gaussian distribution - depend not only on Euclidean distance but also on the range differences (differences in color intensities). Bilateral denoise preserves sharp edges.
As denoising is resource hungry it slows down pixelpipe processing significantly; it makes sense to activate this module late in your workflow.
<para>This module reduces noise in your image but preserves sharp edges. This is accomplished by averaging pixels with their neighbors, taking into account not only the geometric distance but
also the distance on the range scale, i.e. differences in color intensities. As denoising is a resource hungry process, it slows down pixelpipe processing significantly; consider to activate
this module late in your workflow.
</para>
<sect5><title>Radius</title>
<para>Set the spatial extent of the gaussian blur.</para>
Expand Down
6 changes: 3 additions & 3 deletions doc/usermanual/darkroom/modules/correction/denoise_nlm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
</sect4>

<sect4><title>Usage</title>
<para>Non-local means is an image denoising process based on non-local averaging of pixels in an image. The amount of weighting for a pixel is based on the degree of similarity between
a small patch centered around that pixel and the small patch centered around the pixel being denoised. As denoising is resource hungry it slows down pixelpipe processing significantly;
it makes sense to activate this module late in your workflow.
<para>This module reduces noise in your image but preserves structures. This is accomplished by averaging a pixel with other pixels in the image. The weight of averaging
depends on the similarity of the pixels surroundings with the surrounding of the one pixel to be denoised. As denoising is a resource hungry process, it slows down pixelpipe processing significantly;
consider to activate this module late in your workflow.
</para>
<sect5><title>Patch size</title>
<para>The size of the patch.</para>
Expand Down
4,345 changes: 2,676 additions & 1,669 deletions po/ja.po

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ endif()
#
# Find all other required libraries for building
#
find_package(Glib 2.26 REQUIRED)
find_package(Glib 2.24 REQUIRED)
include_directories(${Glib_INCLUDE_DIRS})
list(APPEND LIBS ${Glib_LIBRARIES})
add_definitions(${Glib_DEFINITIONS})
Expand Down
34 changes: 22 additions & 12 deletions src/bauhaus/bauhaus.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,18 +326,24 @@ dt_bauhaus_popup_motion_notify(GtkWidget *widget, GdkEventMotion *event, gpointe
gtk_widget_queue_draw(darktable.bauhaus->popup_area);
dt_bauhaus_widget_t *w = darktable.bauhaus->current;
int width = darktable.bauhaus->popup_window->allocation.width, height = darktable.bauhaus->popup_window->allocation.height;
// coordinate transform is in vain because we're only ever called after a button release.
// that means the system is always the one of the popup.
// that also means that we can't have hovering combobox entries while still holding the button. :(
const float ex = event->x;
const float ey = event->y;

switch(w->type)
{
case DT_BAUHAUS_COMBOBOX:
darktable.bauhaus->mouse_x = event->x;
darktable.bauhaus->mouse_y = event->y;
darktable.bauhaus->mouse_x = ex;
darktable.bauhaus->mouse_y = ey;
break;
case DT_BAUHAUS_SLIDER:
{
dt_bauhaus_slider_data_t *d = &w->data.slider;
const float mouse_off = get_slider_line_offset(
d->oldpos, d->scale, event->x/width,
event->y/height, GTK_WIDGET(w)->allocation.height/(float)height,
d->oldpos, d->scale, ex/width,
ey/height, GTK_WIDGET(w)->allocation.height/(float)height,
widget->allocation.width);
if(!darktable.bauhaus->change_active)
{
Expand All @@ -349,8 +355,8 @@ dt_bauhaus_popup_motion_notify(GtkWidget *widget, GdkEventMotion *event, gpointe
if(darktable.bauhaus->change_active)
{
// remember mouse position for motion effects in draw
darktable.bauhaus->mouse_x = event->x;
darktable.bauhaus->mouse_y = event->y;
darktable.bauhaus->mouse_x = ex;
darktable.bauhaus->mouse_y = ey;
dt_bauhaus_slider_set_normalized(w, d->oldpos + mouse_off);
}
}
Expand Down Expand Up @@ -385,12 +391,16 @@ dt_bauhaus_popup_button_release(GtkWidget *widget, GdkEventButton *event, gpoint
{
if(darktable.bauhaus->current &&
(darktable.bauhaus->current->type == DT_BAUHAUS_COMBOBOX) &&
(event->button == 1) &&
(event->y > GTK_WIDGET(darktable.bauhaus->current)->allocation.height))
(event->button == 1) && // only accept left mouse click
(dt_get_wtime() - darktable.bauhaus->opentime >= 0.250f)) // default gtk timeout for double-clicks
{
// only accept left mouse click
darktable.bauhaus->end_mouse_x = event->x;
darktable.bauhaus->end_mouse_y = event->y;
// event might be in wrong system, transform ourselves:
gint wx, wy, x, y;
gdk_window_get_origin (gtk_widget_get_window(darktable.bauhaus->popup_window), &wx, &wy);
GdkDisplay *display = gdk_display_get_default();
gdk_display_get_pointer(display, NULL, &x, &y, NULL);
darktable.bauhaus->end_mouse_x = x - wx;
darktable.bauhaus->end_mouse_y = y - wy;
dt_bauhaus_widget_accept(darktable.bauhaus->current);
dt_bauhaus_hide_popup();
}
Expand Down Expand Up @@ -1055,7 +1065,7 @@ dt_bauhaus_draw_baseline(dt_bauhaus_widget_t *w, cairo_t *cr)
const float htm = 0.0f, htM = ht;
#else
// pos of baseline
const float htm = ht*(darktable.bauhaus->label_font_size + 0.1f);
const float htm = ht*(darktable.bauhaus->label_font_size + 0.15f);
const float htM = ht*0.2f; // thickness of baseline
#endif

Expand Down
52 changes: 52 additions & 0 deletions src/common/darktable.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ int dt_init(int argc, char *argv[], const int init_gui)
// FIXME: move there into dt_database_t
dt_pthread_mutex_init(&(darktable.db_insert), NULL);
dt_pthread_mutex_init(&(darktable.plugin_threadsafe), NULL);
dt_pthread_mutex_init(&(darktable.capabilities_threadsafe), NULL);
darktable.control = (dt_control_t *)malloc(sizeof(dt_control_t));
memset(darktable.control, 0, sizeof(dt_control_t));
if(init_gui)
Expand All @@ -604,6 +605,9 @@ int dt_init(int argc, char *argv[], const int init_gui)
/* initialize sellection */
darktable.selection = dt_selection_new();

/* capabilities set to NULL */
darktable.capabilities = NULL;

darktable.opencl = (dt_opencl_t *)malloc(sizeof(dt_opencl_t));
memset(darktable.opencl, 0, sizeof(dt_opencl_t));
dt_opencl_init(darktable.opencl, argc, argv);
Expand Down Expand Up @@ -760,8 +764,11 @@ void dt_cleanup()

dt_bauhaus_cleanup();

dt_capabilities_cleanup();

dt_pthread_mutex_destroy(&(darktable.db_insert));
dt_pthread_mutex_destroy(&(darktable.plugin_threadsafe));
dt_pthread_mutex_destroy(&(darktable.capabilities_threadsafe));

dt_exif_cleanup();
#ifdef HAVE_GEGL
Expand Down Expand Up @@ -851,6 +858,51 @@ void dt_configure_defaults()
}
}


int dt_capabilities_check(char *capability)
{
GList *capabilities = darktable.capabilities;

while(capabilities)
{
if(!strcmp(capabilities->data, capability))
{
return TRUE;
}
capabilities = g_list_next(capabilities);
}
return FALSE;
}


void dt_capabilities_add(char *capability)
{
dt_pthread_mutex_lock(&darktable.capabilities_threadsafe);

if(!dt_capabilities_check(capability))
darktable.capabilities = g_list_append(darktable.capabilities, capability);

dt_pthread_mutex_unlock(&darktable.capabilities_threadsafe);
}


void dt_capabilities_remove(char *capability)
{
dt_pthread_mutex_lock(&darktable.capabilities_threadsafe);

darktable.capabilities = g_list_remove(darktable.capabilities, capability);

dt_pthread_mutex_unlock(&darktable.capabilities_threadsafe);
}


void dt_capabilities_cleanup()
{
while(darktable.capabilities)
darktable.capabilities = g_list_delete_link(darktable.capabilities, darktable.capabilities);
}


// 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-space on;
6 changes: 6 additions & 0 deletions src/common/darktable.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ typedef struct darktable_t
int32_t unmuted;
GList *iop;
GList *collection_listeners;
GList *capabilities;
struct dt_conf_t *conf;
struct dt_develop_t *develop;
struct dt_lib_t *lib;
Expand All @@ -180,6 +181,7 @@ typedef struct darktable_t
struct dt_blendop_t *blendop;
dt_pthread_mutex_t db_insert;
dt_pthread_mutex_t plugin_threadsafe;
dt_pthread_mutex_t capabilities_threadsafe;
char *progname;
char *datadir;
char *plugindir;
Expand All @@ -205,6 +207,10 @@ void dt_print(dt_debug_thread_t thread, const char *msg, ...);
void dt_gettime_t(char *datetime, time_t t);
void dt_gettime(char *datetime);
void *dt_alloc_align(size_t alignment, size_t size);
int dt_capabilities_check(char *capability);
void dt_capabilities_add(char *capability);
void dt_capabilities_remove(char *capability);
void dt_capabilities_cleanup();

static inline double dt_get_wtime(void)
{
Expand Down
22 changes: 13 additions & 9 deletions src/common/film.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,36 +259,36 @@ dt_film_import_blocking(const char *dirname, const int blocking)
{
char datetime[20];
dt_gettime(datetime);
#if 0
#if 0
/* Should we use one for the whole app? */
GVolumeMonitor *gv_monitor;
gv_monitor = g_volume_monitor_get ();

GList *mounts;
mounts = g_volume_monitor_get_mounts(gv_monitor);

gchar *mount_name = NULL;
if (mounts != NULL)
{
GFile *mount_gfile;
GMount *filmroll_mount;
GError *error = NULL;
gchar *filmroll_path;

filmroll_mount = g_file_find_enclosing_mount(g_file_new_for_path(dirname), NULL, &error);
if (!error)
/* We are considering that the only error is that there is no mount
* because the filmroll added is in a local drive */
{
filmroll_path = g_file_get_path((g_mount_get_default_location(filmroll_mount)));

for (int i=0; i < g_list_length (mounts); i++)
{
gchar *p;

mount_gfile = g_mount_get_default_location((GMount *)g_list_nth_data(mounts, i));
p = g_file_get_path(mount_gfile);

if (g_strcmp0(p, filmroll_path))
{
mount_name = g_mount_get_name(g_list_nth_data(mounts, i));
Expand All @@ -310,7 +310,7 @@ dt_film_import_blocking(const char *dirname, const int blocking)
}
else
mount_name = g_strdup("Local");
#endif
#endif
/* insert a new film roll into database */
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
// "insert into film_rolls (id, datetime_accessed, folder, external_drive) values "
Expand All @@ -323,13 +323,13 @@ dt_film_import_blocking(const char *dirname, const int blocking)
SQLITE_STATIC);
// DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 3, mount_name, strlen(mount_name),
// SQLITE_STATIC);

rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE)
fprintf(stderr, "[film_import] failed to insert film roll! %s\n",
sqlite3_errmsg(dt_database_get(darktable.db)));
sqlite3_finalize(stmt);

// if (mount_name != NULL) g_free (mount_name);

/* requery for filmroll and fetch new id */
Expand Down Expand Up @@ -449,6 +449,7 @@ void dt_film_import1(dt_film_t *film)
if(!cfr || g_strcmp0(cfr->dirname, cdn) != 0)
{

#if GLIB_CHECK_VERSION (2, 26, 0)
/* check if we can find a gpx data file to be auto applied
to images in the jsut imported filmroll */
g_dir_rewind(cfr->dir);
Expand All @@ -464,6 +465,7 @@ void dt_film_import1(dt_film_t *film)
g_free(gpx_file);
}
}
#endif

/* cleanup previously imported filmroll*/
if(cfr && cfr!=film)
Expand Down Expand Up @@ -492,6 +494,7 @@ void dt_film_import1(dt_film_t *film)
dt_control_backgroundjobs_destroy(darktable.control, jid);
dt_control_signal_raise(darktable.signals , DT_SIGNAL_FILMROLLS_CHANGED);

#if GLIB_CHECK_VERSION (2, 26, 0)
/* check if we can find a gpx data file to be auto applied
to images in the just imported filmroll */
g_dir_rewind(cfr->dir);
Expand All @@ -507,6 +510,7 @@ void dt_film_import1(dt_film_t *film)
g_free(gpx_file);
}
}
#endif

}

Expand Down
2 changes: 2 additions & 0 deletions src/common/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ void dt_image_synch_all_xmp(const gchar *pathname)
}
}

#if GLIB_CHECK_VERSION (2, 26, 0)
void dt_image_add_time_offset(const int imgid, const long int offset)
{
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, imgid);
Expand Down Expand Up @@ -915,6 +916,7 @@ void dt_image_add_time_offset(const int imgid, const long int offset)
dt_image_cache_read_release(darktable.image_cache, cimg);
g_free(datetime);
}
#endif

// 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
2 changes: 2 additions & 0 deletions src/common/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,10 @@ void dt_image_write_sidecar_file(int imgid);
void dt_image_synch_xmp(const int selected);
void dt_image_synch_all_xmp(const gchar *pathname);

#if GLIB_CHECK_VERSION (2, 26, 0)
// add an offset to the exif_datetime_taken field
void dt_image_add_time_offset(const int imgid, const long int offset);
#endif

#endif
// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
Expand Down
5 changes: 3 additions & 2 deletions src/common/nvidia_gpus.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,9 @@ static const char *nvidia_gpus[] = {
"GeForce 9200M GS","1.1",
"GeForce 9100M G","1.1",
"GeForce 8400M GT","1.1",
"GeForce G105M","1.1"};
static const int num_nvidia_gpus = 217;
"GeForce G105M","1.1",
"ION","1.0"};
static const int num_nvidia_gpus = 218;

int dt_nvidia_gpu_supports_sm_20(const char *model)
{
Expand Down
1 change: 1 addition & 0 deletions src/common/opencl.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ void dt_opencl_init(dt_opencl_t *cl, const int argc, char *argv[])
dt_print(DT_DEBUG_OPENCL, "[opencl_init] initial status of opencl enabled flag is %s.\n", cl->enabled ? "ON" : "OFF");
if(cl->inited)
{
dt_capabilities_add("opencl");
cl->bilateral = dt_bilateral_init_cl_global();
cl->gaussian = dt_gaussian_init_cl_global();
}
Expand Down
Loading

0 comments on commit 7126b1d

Please sign in to comment.