Skip to content
Permalink
Browse files

Timelapse stuff for 2.2.0rc2

  • Loading branch information...
fhrtms committed Dec 11, 2016
1 parent a696cbd commit d82610a9cd7ae6a6b5474ee593745ee14b0631e1
@@ -8849,6 +8849,18 @@ msgstr "Gruppe auflösen"
msgid "remove selected images from the group"
msgstr "Ausgewählte Bilder aus der Gruppe entfernen"

#: ../src/libs/image.c:223
msgid "timelapse"
msgstr "Zeitraffer"

#: ../src/libs/image.c:223
msgid "create timelapse"
msgstr "Zeitraffer erstellen"

#: ../src/libs/image.c:226
msgid "group selected images as timelapse"
msgstr "ausgewählte Bilder als Zeitraffer Zussammenfassen"

#: ../src/libs/image.c:293
msgctxt "accel"
msgid "remove from collection"
@@ -146,7 +146,8 @@ static gboolean _migrate_schema(dt_database_t *db, int version)
"raw_auto_bright_threshold REAL, raw_black INTEGER, raw_maximum INTEGER, "
"caption VARCHAR, description VARCHAR, license VARCHAR, sha1sum CHAR(40), "
"orientation INTEGER, histogram BLOB, lightmap BLOB, longitude REAL, "
"latitude REAL, color_matrix BLOB, colorspace INTEGER, version INTEGER, max_version INTEGER)",
"latitude REAL, color_matrix BLOB, colorspace INTEGER, version INTEGER, max_version INTEGER, "
"average_brightness REAL, timelapse_keyframe INTEGER, exposure_correction REAL)", /* timelapse stuff */
NULL, NULL, NULL);
_SQLITE3_EXEC(db->handle, "CREATE INDEX main.images_group_id_index ON images (group_id)", NULL, NULL, NULL);
_SQLITE3_EXEC(db->handle, "CREATE INDEX main.images_film_id_index ON images (film_id)", NULL, NULL, NULL);
@@ -633,6 +634,50 @@ static int _upgrade_library_schema_step(dt_database_t *db, int version)
// 11 -> 12 move presets, styles and tags over to the data database
sqlite3_exec(db->handle, "BEGIN TRANSACTION", NULL, NULL, NULL);

// add some timelapse stuff
/*if(sqlite3_exec(db->handle, "ALTER TABLE images ADD COLUMN average_brightness REAL", NULL, NULL, NULL) != SQLITE_OK)
{
fprintf(stderr, "[init] can't add `average_brightness' column to database\n");
fprintf(stderr, "[init] %s\n", sqlite3_errmsg(db->handle));
sqlite3_exec(db->handle, "ROLLBACK TRANSACTION", NULL, NULL, NULL);
return version;
}
if(sqlite3_exec(db->handle, "UPDATE images SET average_brightness = -1", NULL, NULL, NULL) != SQLITE_OK)
{
fprintf(stderr, "[init] can't initialize `average_brightness' with NULL\n");
fprintf(stderr, "[init] %s\n", sqlite3_errmsg(db->handle));
sqlite3_exec(db->handle, "ROLLBACK TRANSACTION", NULL, NULL, NULL);
return version;
}
if(sqlite3_exec(db->handle, "ALTER TABLE images ADD COLUMN timelapse_keyframe INTEGER", NULL, NULL, NULL) != SQLITE_OK)
{
fprintf(stderr, "[init] can't add `timelapse_keyframe' column to database\n");
fprintf(stderr, "[init] %s\n", sqlite3_errmsg(db->handle));
sqlite3_exec(db->handle, "ROLLBACK TRANSACTION", NULL, NULL, NULL);
return version;
}
if(sqlite3_exec(db->handle, "UPDATE images SET timelapse_keyframe = 0", NULL, NULL, NULL) != SQLITE_OK)
{
fprintf(stderr, "[init] can't initialize `timelapse_keyframe' with 0\n");
fprintf(stderr, "[init] %s\n", sqlite3_errmsg(db->handle));
sqlite3_exec(db->handle, "ROLLBACK TRANSACTION", NULL, NULL, NULL);
return version;
}
if(sqlite3_exec(db->handle, "ALTER TABLE images ADD COLUMN exposure_correction REAL", NULL, NULL, NULL) != SQLITE_OK)
{
fprintf(stderr, "[init] can't add `exposure_correction' column to database\n");
fprintf(stderr, "[init] %s\n", sqlite3_errmsg(db->handle));
sqlite3_exec(db->handle, "ROLLBACK TRANSACTION", NULL, NULL, NULL);
return version;
}
if(sqlite3_exec(db->handle, "UPDATE images SET exposure_correction = 0", NULL, NULL, NULL) != SQLITE_OK)
{
fprintf(stderr, "[init] can't initialize `exposure_correction' with 0\n");
fprintf(stderr, "[init] %s\n", sqlite3_errmsg(db->handle));
sqlite3_exec(db->handle, "ROLLBACK TRANSACTION", NULL, NULL, NULL);
return version;
}*/

////////////// presets
#undef FINALIZE
#define FINALIZE \
@@ -1082,7 +1127,8 @@ static void _create_library_schema(dt_database_t *db)
"caption VARCHAR, description VARCHAR, license VARCHAR, sha1sum CHAR(40), "
"orientation INTEGER, histogram BLOB, lightmap BLOB, longitude REAL, "
"latitude REAL, altitude REAL, color_matrix BLOB, colorspace INTEGER, version INTEGER, "
"max_version INTEGER, write_timestamp INTEGER, history_end INTEGER)",
"max_version INTEGER, write_timestamp INTEGER, history_end INTEGER, "
"average_brightness REAL, timelapse_keyframe INTEGER, exposure_correction REAL)", /* timelapse stuff */
NULL, NULL, NULL);
sqlite3_exec(db->handle, "CREATE INDEX main.images_group_id_index ON images (group_id)", NULL, NULL, NULL);
sqlite3_exec(db->handle, "CREATE INDEX main.images_film_id_index ON images (film_id)", NULL, NULL, NULL);
@@ -1014,6 +1014,9 @@ void dt_image_init(dt_image_t *img)
img->raw_black_level = 0;
for(uint8_t i = 0; i < 4; i++) img->raw_black_level_separate[i] = 0;
img->raw_white_point = 16384; // 2^14
img->average_brightness = -1; /* timelapse stuff */
img->timelapse_keyframe = 0; /* timelapse stuff */
img->exposure_correction = -1; /* timelapse stuff */
img->d65_color_matrix[0] = NAN;
img->profile = NULL;
img->profile_size = 0;
@@ -70,6 +70,8 @@ typedef enum
DT_IMAGE_HAS_WAV = 8192,
// image is a bayer pattern with 4 colors (e.g., CYGM or RGBE)
DT_IMAGE_4BAYER = 16384,
// image is keyframe in timelapse
DT_IMAGE_TIMELAPSE_KEYFRAME = 16384
} dt_image_flags_t;

typedef enum dt_image_colorspace_t
@@ -181,6 +183,11 @@ typedef struct dt_image_t
float wb_coeffs[4];
/* convenience pointer back into the image cache, so we can return dt_image_t* there directly. */
struct dt_cache_entry_t *cache_entry;

/* timelapse stuff */
long double average_brightness;
int timelapse_keyframe;
double exposure_correction;
} dt_image_t;

// image buffer operations:
@@ -41,7 +41,7 @@ void dt_image_cache_allocate(void *data, dt_cache_entry_t *entry)
"SELECT id, group_id, film_id, width, height, filename, maker, model, lens, exposure, "
"aperture, iso, focal_length, datetime_taken, flags, crop, orientation, focus_distance, "
"raw_parameters, longitude, latitude, altitude, color_matrix, colorspace, version, raw_black, "
"raw_maximum FROM main.images WHERE id = ?1",
"raw_maximum, average_brightness, timelapse_keyframe, exposure_correction FROM main.images WHERE id = ?1", /* added timelapse stuff */
-1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, entry->key);
if(sqlite3_step(stmt) == SQLITE_ROW)
@@ -101,6 +101,9 @@ void dt_image_cache_allocate(void *data, dt_cache_entry_t *entry)
img->raw_black_level = sqlite3_column_int(stmt, 25);
for(uint8_t i = 0; i < 4; i++) img->raw_black_level_separate[i] = 0;
img->raw_white_point = sqlite3_column_int(stmt, 26);
img->average_brightness = sqlite3_column_double(stmt, 27); /* timelapse stuff */
img->timelapse_keyframe = sqlite3_column_double(stmt, 28); /* timelapse stuff */
img->exposure_correction = sqlite3_column_double(stmt, 29); /* timelapse stuff */

// buffer size?
if(img->flags & DT_IMAGE_LDR)
@@ -219,7 +222,7 @@ void dt_image_cache_write_release(dt_image_cache_t *cache, dt_image_t *img, dt_i
"focus_distance = ?10, film_id = ?11, datetime_taken = ?12, flags = ?13, "
"crop = ?14, orientation = ?15, raw_parameters = ?16, group_id = ?17, longitude = ?18, "
"latitude = ?19, altitude = ?20, color_matrix = ?21, colorspace = ?22, raw_black = ?23, "
"raw_maximum = ?24 WHERE id = ?25",
"raw_maximum = ?24, average_brightness = ?25, timelapse_keyframe = ?26, exposure_correction = ?27 WHERE id = ?28", /* added timelapse stuff */
-1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, img->width);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, img->height);
@@ -245,7 +248,10 @@ void dt_image_cache_write_release(dt_image_cache_t *cache, dt_image_t *img, dt_i
DT_DEBUG_SQLITE3_BIND_INT(stmt, 22, img->colorspace);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 23, img->raw_black_level);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 24, img->raw_white_point);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 25, img->id);
DT_DEBUG_SQLITE3_BIND_DOUBLE(stmt, 25, img->average_brightness); /* timelapse stuff */
DT_DEBUG_SQLITE3_BIND_INT(stmt, 26, img->timelapse_keyframe); /* timelapse stuff */
DT_DEBUG_SQLITE3_BIND_INT(stmt, 27, img->exposure_correction); /* timelapse stuff */
DT_DEBUG_SQLITE3_BIND_INT(stmt, 28, img->id);
int rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) fprintf(stderr, "[image_cache_write_release] sqlite3 error %d\n", rc);
sqlite3_finalize(stmt);
@@ -860,6 +860,21 @@ void dt_control_set_dev_zoom(dt_dev_zoom_t value)
dt_pthread_mutex_unlock(&(darktable.control->global_mutex));
}

// some timelapse stuff
dt_dev_timelapse_t dt_control_get_dev_timelapse()
{
//dt_pthread_mutex_lock(&(darktable.control->global_mutex));
dt_dev_timelapse_t result = darktable.control->dev_timelapse;
//dt_pthread_mutex_unlock(&(darktable.control->global_mutex));
return result;
}
void dt_control_set_dev_timelapse(dt_dev_timelapse_t value)
{
dt_pthread_mutex_lock(&(darktable.control->global_mutex));
darktable.control->dev_timelapse = value;
dt_pthread_mutex_unlock(&(darktable.control->global_mutex));
}


// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
// vim: shiftwidth=2 expandtab tabstop=2 cindent
@@ -54,6 +54,7 @@ typedef enum dt_control_gui_mode_t
DT_PRINT,
#endif
DT_KNIGHT,
DT_TIMELAPSE,
DT_MODE_NONE
} dt_control_gui_mode_t;

@@ -118,7 +119,8 @@ typedef struct dt_control_accels_t
GtkAccelKey filmstrip_forward, filmstrip_back, lighttable_up, lighttable_down, lighttable_right,
lighttable_left, lighttable_center, lighttable_preview, lighttable_preview_display_focus,
lighttable_preview_sticky, lighttable_preview_sticky_focus, lighttable_preview_sticky_exit,
global_sideborders, global_header, darkroom_preview, slideshow_start;
global_sideborders, global_header, darkroom_preview, slideshow_start,
timelapse_up, timelapse_down, timelapse_right, timelapse_left; /* timelapse stuff */

} dt_control_accels_t;

@@ -157,6 +159,9 @@ typedef struct dt_control_t
int history_start;
int32_t mouse_over_id;

// some timelapse stuff
dt_dev_timelapse_t dev_timelapse;

// TODO: move these to some darkroom struct
// synchronized navigation
float dev_zoom_x, dev_zoom_y, dev_zoom_scale;
@@ -262,6 +267,10 @@ void dt_control_set_dev_closeup(int value);
dt_dev_zoom_t dt_control_get_dev_zoom();
void dt_control_set_dev_zoom(dt_dev_zoom_t value);

// some timelapse stuff
dt_dev_timelapse_t dt_control_get_dev_timelapse();
void dt_control_set_dev_timelapse(dt_dev_timelapse_t value);

static inline int32_t dt_ctl_get_num_procs()
{
#ifdef _OPENMP
@@ -24,6 +24,13 @@

#include <inttypes.h>

// some timelapse stuff
typedef enum dt_dev_timelapse_t
{
DT_TIMELASE_NONE = 0,
DT_TIMELASE_RESET_AVERAGE_BRIGHTNESS = 1,
} dt_dev_timelapse_t;

typedef enum dt_dev_zoom_t
{
DT_ZOOM_FIT = 0,
@@ -113,6 +113,22 @@ static dt_signal_description _signal_description[DT_SIGNAL_COUNT] = {
{ "dt-camera-detected", NULL, NULL, G_TYPE_NONE, g_cclosure_marshal_VOID__VOID, 0,
NULL, NULL, FALSE }, // DT_SIGNAL_CAMERA_DETECTED,

// some timelapse stuff
{ "dt-timelapse-reset", NULL, NULL, G_TYPE_NONE, g_cclosure_marshal_VOID__VOID, 0,
NULL, NULL, FALSE }, // DT_SIGNAL_TIMELAPSE_RESET,
{ "dt-timelapse-initialize", NULL, NULL, G_TYPE_NONE, g_cclosure_marshal_VOID__VOID, 0,
NULL, NULL, FALSE }, // DT_SIGNAL_TIMELAPSE_INITIALIZE,
{ "dt-timelapse-equalize", NULL, NULL, G_TYPE_NONE, g_cclosure_marshal_VOID__VOID, 0,
NULL, NULL, FALSE }, // DT_SIGNAL_TIMELAPSE_EQUALIZE,
{ "dt-timelapse-reset-region", NULL, NULL, G_TYPE_NONE, g_cclosure_marshal_VOID__VOID, 0,
NULL, NULL, FALSE }, // DT_SIGNAL_TIMELAPSE_RESET_REGION,
{ "dt-timelapse-set-region", NULL, NULL, G_TYPE_NONE, g_cclosure_marshal_VOID__VOID, 0,
NULL, NULL, FALSE }, // DT_SIGNAL_TIMELAPSE_SET_REGION,
{ "dt-timelapse-set-exposure-gain-start", NULL, NULL, G_TYPE_NONE, g_cclosure_marshal_VOID__UINT, 0,
NULL, NULL, FALSE }, // DT_SIGNAL_TIMELAPSE_SET_EXPOSURE_GAIN_START,
{ "dt-timelapse-set-exposure-gain-end", NULL, NULL, G_TYPE_NONE, g_cclosure_marshal_VOID__UINT, 0,
NULL, NULL, FALSE }, // DT_SIGNAL_TIMELAPSE_SET_EXPOSURE_GAIN_END,

};

static GType _signal_type;
@@ -160,6 +160,17 @@ typedef enum dt_signal_t
* */
DT_SIGNAL_CAMERA_DETECTED,

/** some timelapse stuff \brief This signal is raised when clicking the read frames button in timlapse module
no return
* */
DT_SIGNAL_TIMELAPSE_RESET,
DT_SIGNAL_TIMELAPSE_INITIALIZE,
DT_SIGNAL_TIMELAPSE_EQUALIZE,
DT_SIGNAL_TIMELAPSE_RESET_REGION,
DT_SIGNAL_TIMELAPSE_SET_REGION,
DT_SIGNAL_TIMELAPSE_SET_EXPOSURE_GAIN_START,
DT_SIGNAL_TIMELAPSE_SET_EXPOSURE_GAIN_END,

/* do not touch !*/
DT_SIGNAL_COUNT
} dt_signal_t;
@@ -150,6 +150,15 @@ static void key_accel_changed(GtkAccelMap *object, gchar *accel_path, guint acce
// darkroom
dt_accel_path_view(path, sizeof(path), "darkroom", "full preview");
gtk_accel_map_lookup_entry(path, &darktable.control->accels.darkroom_preview);
// some timelapse stuff
dt_accel_path_view(path, sizeof(path), "timelapse", "scroll up");
gtk_accel_map_lookup_entry(path, &darktable.control->accels.timelapse_up);
dt_accel_path_view(path, sizeof(path), "timelapse", "scroll down");
gtk_accel_map_lookup_entry(path, &darktable.control->accels.timelapse_down);
dt_accel_path_view(path, sizeof(path), "timelapse", "scroll left");
gtk_accel_map_lookup_entry(path, &darktable.control->accels.timelapse_left);
dt_accel_path_view(path, sizeof(path), "timelapse", "scroll right");
gtk_accel_map_lookup_entry(path, &darktable.control->accels.timelapse_right);


// Global
@@ -36,6 +36,7 @@ typedef enum dt_gui_view_switch_t
DT_GUI_VIEW_SWITCH_TO_DARKROOM,
DT_GUI_VIEW_SWITCH_TO_MAP,
DT_GUI_VIEW_SWITCH_TO_SLIDESHOW,
DT_GUI_VIEW_SWITCH_TO_TIMELAPSE,
DT_GUI_VIEW_SWITCH_TO_PRINT
} dt_gui_view_switch_to_t;

@@ -20,7 +20,7 @@ add_custom_target(
)

# The modules
set(MODULES import export copy_history styles tagging image select collect recentcollect metadata metadata_view navigation histogram history snapshots modulelist modulegroups backgroundjobs colorpicker masks session)
set(MODULES import export copy_history timelapse_export styles tagging image select collect recentcollect metadata metadata_view navigation histogram history snapshots modulelist modulegroups backgroundjobs colorpicker masks session)

# The tools
set(MODULES ${MODULES} viewswitcher)
@@ -39,6 +39,7 @@ set(MODULES ${MODULES} global_toolbox)
add_library(import MODULE "import.c")
add_library(export MODULE "export.c")
add_library(copy_history MODULE "copy_history.c")
add_library(timelapse_export MODULE "timelapse_export.c")
add_library(styles MODULE "styles.c")
add_library(image MODULE "image.c")
add_library(tagging MODULE "tagging.c")
@@ -43,7 +43,7 @@ typedef struct dt_lib_image_t
{
GtkWidget *rotate_cw_button, *rotate_ccw_button, *remove_button, *delete_button, *create_hdr_button,
*duplicate_button, *reset_button, *move_button, *copy_button, *group_button, *ungroup_button,
*cache_button, *uncache_button;
*cache_button, *uncache_button, *timelapse_button;
} dt_lib_image_t;

const char *name(dt_lib_module_t *self)
@@ -131,6 +131,10 @@ static void button_clicked(GtkWidget *widget, gpointer user_data)
dt_control_set_local_copy_images();
else if(i == 13)
dt_control_reset_local_copy_images();
else if(i == 14)
_group_helper_function();
else if(i == 15)
_ungroup_helper_function();
}

static const char* _image_get_delete_button_label()
@@ -271,6 +275,14 @@ void gui_init(dt_lib_module_t *self)
gtk_grid_attach(grid, button, 2, line, 2, 1);
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(button_clicked), GINT_TO_POINTER(11));

// some timelapse stuff
button = gtk_button_new_with_label(_("timelapse"));
d->timelapse_button = button;
g_object_set(G_OBJECT(button), "tooltip-text",
_("group selected images as timelapse"), (char *)NULL);
gtk_grid_attach(grid, button, 0, line, 2, 1);
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(button_clicked), GINT_TO_POINTER(14));

/* connect preference changed signal */
dt_control_signal_connect(
darktable.signals,
@@ -300,6 +312,8 @@ void init_key_accels(dt_lib_module_t *self)
// Grouping keys
dt_accel_register_lib(self, NC_("accel", "group"), GDK_KEY_g, GDK_CONTROL_MASK);
dt_accel_register_lib(self, NC_("accel", "ungroup"), GDK_KEY_g, GDK_CONTROL_MASK | GDK_SHIFT_MASK);
// Timelapse keys
dt_accel_register_lib(self, NC_("accel", "timelapse"), GDK_KEY_g, GDK_CONTROL_MASK);
}

void connect_key_accels(dt_lib_module_t *self)
@@ -316,6 +330,8 @@ void connect_key_accels(dt_lib_module_t *self)
// Grouping keys
dt_accel_connect_button_lib(self, "group", d->group_button);
dt_accel_connect_button_lib(self, "ungroup", d->ungroup_button);
// Timelapse keys
dt_accel_connect_button_lib(self, "timelapse", d->timelapse_button);
}

#ifdef USE_LUA
Oops, something went wrong.

1 comment on commit d82610a

@otterz

This comment has been minimized.

Copy link

commented on d82610a Feb 3, 2019

Hi,

are there any plans to contribute this to the upstream project?
I saw you using this feature on youtube. It would be really nice if you could give this changes to upstream.

Please sign in to comment.
You can’t perform that action at this time.