Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
image_cache.c File Reference
#include "common/image_cache.h"
#include "common/colorlabels.h"
#include "common/darktable.h"
#include "common/debug.h"
#include "common/exif.h"
#include "common/image.h"
#include "common/datetime.h"
#include "control/conf.h"
#include "control/control.h"
#include "control/jobs.h"
#include "control/signal.h"
#include "develop/develop.h"
#include <sqlite3.h>
#include <inttypes.h>
#include <math.h>
+ Include dependency graph for image_cache.c:

Functions

static void _image_cache_stmt_mutex_ensure (void)
 
static uint64_t _image_cache_self_hash (const dt_image_t *img)
 
static void _image_cache_lock_init (dt_image_t *img)
 
static void _image_cache_write_history_hash (const dt_image_t *img)
 
static sqlite3_stmt * _image_cache_get_stmt (void)
 
void dt_image_from_stmt (dt_image_t *img, sqlite3_stmt *stmt)
 
static void _image_cache_reload_from_db (dt_image_t *img, const uint32_t imgid)
 
void dt_image_cache_allocate (void *data, dt_cache_entry_t *entry)
 
void dt_image_cache_deallocate (void *data, dt_cache_entry_t *entry)
 
void dt_image_cache_init (dt_image_cache_t *cache)
 
void dt_image_cache_cleanup (dt_image_cache_t *cache)
 
void dt_image_cache_print (dt_image_cache_t *cache)
 
dt_image_tdt_image_cache_get (dt_image_cache_t *cache, const int32_t imgid, char mode)
 
dt_image_tdt_image_cache_testget (dt_image_cache_t *cache, const int32_t imgid, char mode)
 
dt_image_tdt_image_cache_get_reload (dt_image_cache_t *cache, const int32_t imgid, char mode)
 
int dt_image_invalid (const dt_image_t *img)
 
int dt_image_cache_seed (dt_image_cache_t *cache, const dt_image_t *img)
 
static void _image_cache_info_changed_reload_callback (gpointer instance, gpointer imgs, gpointer user_data)
 
void dt_image_cache_connect_info_changed_first (const struct dt_control_signal_t *ctlsig)
 
void dt_image_cache_read_release (dt_image_cache_t *cache, const dt_image_t *img)
 
void dt_image_cache_write_release (dt_image_cache_t *cache, dt_image_t *img, dt_image_cache_write_mode_t mode)
 
void dt_image_cache_remove (dt_image_cache_t *cache, const int32_t imgid)
 
void dt_image_cache_set_export_timestamp (dt_image_cache_t *cache, const int32_t imgid)
 
void dt_image_cache_set_print_timestamp (dt_image_cache_t *cache, const int32_t imgid)
 

Variables

static sqlite3_stmt * _image_cache_load_stmt = NULL
 
static sqlite3_stmt * _image_cache_write_history_hash_stmt = NULL
 
static dt_pthread_mutex_t _image_cache_stmt_mutex
 
static gsize _image_cache_stmt_mutex_inited = 0
 

Function Documentation

◆ _image_cache_get_stmt()

static sqlite3_stmt * _image_cache_get_stmt ( void  )
static

◆ _image_cache_info_changed_reload_callback()

static void _image_cache_info_changed_reload_callback ( gpointer  instance,
gpointer  imgs,
gpointer  user_data 
)
static

◆ _image_cache_lock_init()

static void _image_cache_lock_init ( dt_image_t img)
inlinestatic

◆ _image_cache_reload_from_db()

◆ _image_cache_self_hash()

◆ _image_cache_stmt_mutex_ensure()

static void _image_cache_stmt_mutex_ensure ( void  )
inlinestatic

◆ _image_cache_write_history_hash()

◆ dt_image_cache_allocate()

◆ dt_image_cache_cleanup()

◆ dt_image_cache_connect_info_changed_first()

void dt_image_cache_connect_info_changed_first ( const struct dt_control_signal_t ctlsig)

◆ dt_image_cache_deallocate()

void dt_image_cache_deallocate ( void data,
dt_cache_entry_t entry 
)

◆ dt_image_cache_get()

dt_image_t * dt_image_cache_get ( dt_image_cache_t cache,
const int32_t  imgid,
char  mode 
)

References _image_cache_lock_init(), ASAN_UNPOISON_MEMORY_REGION, dt_image_cache_t::cache, dt_image_t::cache_entry, dt_cache_entry_t::data, dt_cache_get, dt_cache_release, and dt_image_invalid().

Referenced by __attribute__(), _add_thumbnail_at_rowid(), _colorlabels_execute(), _deflicker_prepare_histogram(), _dt_dev_refresh_image_storage(), _ensure_has_txt_flag(), _exif_xmp_append_history_hash(), _generate_blocking(), _get_base_value(), _get_image_copy(), _history_load_and_apply_apply(), _history_snapshot_undo_restore(), _image_duplicate_with_version(), _image_has_txt_flag(), _image_import_internal(), _image_set_monochrome_flag(), _init_8(), _init_expansion(), _init_f(), _jump_to(), _mipmap_cache_disk_hash_matches(), _pop_undo_execute(), _print_button_clicked(), _ratings_apply_to_image(), _remove_preset_flag(), _set_datetime(), _set_location(), _setup_selected_images_list(), _write_mipmap_to_disk(), checkreadimage(), checkwriteimage(), dt_colorspaces_get_input_profile_from_image(), dt_control_export_job_run(), dt_control_gpx_apply_job_run(), dt_control_merge_hdr_process(), dt_control_refresh_exif_run(), dt_dev_load_image(), dt_dev_read_history_ext(), dt_dev_write_history_ext(), dt_exif_read_blob(), dt_focus_draw_clusters(), dt_grouping_add_grouped_images(), dt_grouping_add_to_group(), dt_grouping_change_representative(), dt_grouping_get_group_images(), dt_grouping_get_image_group(), dt_grouping_remove_from_group(), dt_history_hash_set_mipmap(), dt_image_cache_set_export_timestamp(), dt_image_cache_set_print_timestamp(), dt_image_find_best_color_profile(), dt_image_full_path(), dt_image_get_datetime(), dt_image_get_location(), dt_image_get_orientation(), dt_image_local_copy_reset(), dt_image_local_copy_set(), dt_image_read_duplicates(), dt_image_remove(), dt_image_rename(), dt_image_set_flip(), dt_image_write_sidecar_file(), dt_preview_window_spawn(), dt_ratings_get(), dt_thumbtable_info_debug_assert_matches_cache(), dt_view_image_get_surface(), finalize_store(), get_group(), group_with(), gui_changed(), image_set_rawcrops(), load_xmp_callback(), main(), store(), try_enter(), update_preview_cb(), update_profile_list(), and write_image().

◆ dt_image_cache_get_reload()

◆ dt_image_cache_init()

◆ dt_image_cache_print()

void dt_image_cache_print ( dt_image_cache_t cache)

◆ dt_image_cache_read_release()

void dt_image_cache_read_release ( dt_image_cache_t cache,
const dt_image_t img 
)

References _image_cache_self_hash(), dt_image_cache_t::cache, dt_image_t::cache_entry, dt_cache_release, dt_image_t::id, and dt_image_t::self_hash.

Referenced by __attribute__(), _add_thumbnail_at_rowid(), _colorlabels_execute(), _deflicker_prepare_histogram(), _dt_dev_refresh_image_storage(), _dt_image_info_changed_callback(), _exif_xmp_append_history_hash(), _get_base_value(), _get_image_copy(), _image_cache_info_changed_reload_callback(), _image_duplicate_with_version(), _image_has_txt_flag(), _image_set_monochrome_flag(), _init_8(), _init_expansion(), _init_f(), _jump_to(), _mipmap_cache_disk_hash_matches(), _print_button_clicked(), _setup_selected_images_list(), _write_mipmap_to_disk(), dt_colorspaces_get_input_profile_from_image(), dt_control_export_job_run(), dt_control_gpx_apply_job_run(), dt_control_merge_hdr_process(), dt_dev_read_history_ext(), dt_exif_read_blob(), dt_focus_draw_clusters(), dt_grouping_add_grouped_images(), dt_grouping_change_representative(), dt_grouping_get_group_images(), dt_grouping_get_image_group(), dt_grouping_remove_from_group(), dt_image_full_path(), dt_image_get_datetime(), dt_image_get_location(), dt_image_get_orientation(), dt_image_local_copy_reset(), dt_image_local_copy_set(), dt_image_read_duplicates(), dt_image_remove(), dt_image_rename(), dt_preview_window_spawn(), dt_ratings_get(), dt_thumbtable_info_debug_assert_matches_cache(), dt_view_image_get_surface(), finalize_store(), get_group(), group_with(), image_set_rawcrops(), load_xmp_callback(), releasereadimage(), store(), try_enter(), update_preview_cb(), and update_profile_list().

◆ dt_image_cache_remove()

void dt_image_cache_remove ( dt_image_cache_t cache,
const int32_t  imgid 
)

◆ dt_image_cache_seed()

◆ dt_image_cache_set_export_timestamp()

void dt_image_cache_set_export_timestamp ( dt_image_cache_t cache,
const int32_t  imgid 
)

◆ dt_image_cache_set_print_timestamp()

void dt_image_cache_set_print_timestamp ( dt_image_cache_t cache,
const int32_t  imgid 
)

◆ dt_image_cache_testget()

◆ dt_image_cache_write_release()

void dt_image_cache_write_release ( dt_image_cache_t cache,
dt_image_t img,
dt_image_cache_write_mode_t  mode 
)
Todo:
: that a memory leak ?

References _image_cache_self_hash(), _image_cache_write_history_hash(), dt_image_cache_t::cache, dt_image_t::cache_entry, dt_image_t::change_timestamp, dt_image_t::color_labels, dt_image_t::colorspace, dt_image_t::d65_color_matrix, darktable, dt_image_t::datetime, darktable_t::db, dt_cache_release, dt_colorlabels_set_labels(), dt_control_save_xmp(), dt_database_get(), dt_datetime_gtimespan_to_local(), dt_datetime_now_to_gtimespan(), DT_DEBUG_CONTROL_SIGNAL_RAISE, DT_DEBUG_SQLITE3_BIND_BLOB, DT_DEBUG_SQLITE3_BIND_DOUBLE, DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_BIND_INT64, DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, DT_IMAGE_CACHE_MINIMAL, DT_IMAGE_CACHE_SAFE, dt_image_film_roll_name(), dt_image_get_xmp_mode(), dt_image_get_xmp_rating_from_flags(), DT_IMAGE_HAS_WAV, dt_image_is_hdr(), DT_IMAGE_LOCAL_COPY, dt_image_local_copy_paths_from_fullpath(), dt_image_monochrome_flags(), dt_image_use_monochrome_workflow(), DT_SIGNAL_IMAGE_INFO_CHANGED, DT_VIEW_REJECT, dt_image_geoloc_t::elevation, dt_image_t::exif_aperture, dt_image_t::exif_crop, dt_image_t::exif_datetime_taken, dt_image_t::exif_exposure, dt_image_t::exif_exposure_bias, dt_image_t::exif_focal_length, dt_image_t::exif_focus_distance, dt_image_t::exif_iso, dt_image_t::exif_lens, dt_image_t::exif_maker, dt_image_t::exif_model, dt_image_t::export_timestamp, FALSE, dt_image_t::filename, dt_image_t::film_id, dt_image_t::filmroll, dt_image_t::flags, flip(), dt_image_t::folder, dt_image_t::fullpath, dt_image_t::geoloc, dt_image_t::group_id, dt_image_t::has_audio, dt_image_t::has_localcopy, dt_image_t::height, dt_image_t::id, dt_image_t::import_timestamp, dt_image_t::is_bw, dt_image_t::is_bw_flow, dt_image_t::is_hdr, dt_image_geoloc_t::latitude, dt_image_t::legacy_flip, dt_image_t::local_copy_legacy_path, dt_image_t::local_copy_path, dt_image_geoloc_t::longitude, dt_image_t::orientation, PATH_MAX, dt_image_t::print_timestamp, dt_image_t::rating, dt_image_t::raw_black_level, dt_image_t::raw_white_point, dt_image_t::self_hash, darktable_t::signals, and dt_image_t::width.

Referenced by _colorlabels_execute(), _ensure_has_txt_flag(), _generate_blocking(), _history_load_and_apply_apply(), _history_snapshot_undo_restore(), _image_import_internal(), _image_set_monochrome_flag(), _pop_undo_execute(), _ratings_apply_to_image(), _remove_preset_flag(), _set_datetime(), _set_location(), dt_control_refresh_exif_run(), dt_dev_load_image(), dt_dev_write_history_ext(), dt_grouping_add_to_group(), dt_grouping_change_representative(), dt_grouping_remove_from_group(), dt_history_hash_set_mipmap(), dt_image_cache_set_export_timestamp(), dt_image_cache_set_print_timestamp(), dt_image_find_best_color_profile(), dt_image_local_copy_reset(), dt_image_local_copy_set(), dt_image_read_duplicates(), dt_image_rename(), dt_image_set_flip(), dt_image_write_sidecar_file(), gui_changed(), image_set_rawcrops(), main(), releasewriteimage(), and write_image().

◆ dt_image_from_stmt()

void dt_image_from_stmt ( dt_image_t img,
sqlite3_stmt *  stmt 
)

References dt_image_t::change_timestamp, dt_image_t::color_labels, dt_image_t::colorspace, dt_image_t::d65_color_matrix, dt_image_t::datetime, dt_datetime_gtimespan_to_local(), dt_image_film_roll_name(), dt_image_get_xmp_rating_from_flags(), DT_IMAGE_HAS_WAV, dt_image_is_hdr(), DT_IMAGE_LOCAL_COPY, dt_image_local_copy_paths_from_fullpath(), dt_image_monochrome_flags(), dt_image_refresh_makermodel(), dt_image_use_monochrome_workflow(), DT_VIEW_REJECT, dt_image_geoloc_t::elevation, dt_image_t::exif_aperture, dt_image_t::exif_crop, dt_image_t::exif_datetime_taken, dt_image_t::exif_exposure, dt_image_t::exif_exposure_bias, dt_image_t::exif_focal_length, dt_image_t::exif_focus_distance, dt_image_t::exif_inited, dt_image_t::exif_iso, dt_image_t::exif_lens, dt_image_t::exif_maker, dt_image_t::exif_model, dt_image_t::export_timestamp, FALSE, dt_image_t::filename, dt_image_t::film_id, dt_image_t::filmroll, dt_image_t::flags, dt_image_t::folder, dt_image_t::fullpath, dt_image_t::geoloc, dt_image_t::group_id, dt_image_t::group_members, dt_image_t::has_audio, dt_image_t::has_localcopy, dt_image_t::height, dt_image_t::history_hash, dt_image_t::history_items, dt_image_t::id, dt_image_t::import_timestamp, dt_image_t::is_bw, dt_image_t::is_bw_flow, dt_image_t::is_hdr, dt_image_geoloc_t::latitude, dt_image_t::legacy_flip, dt_image_t::local_copy_legacy_path, dt_image_t::local_copy_path, dt_image_geoloc_t::longitude, maker, dt_image_t::mipmap_hash, model, dt_image_t::orientation, dt_image_t::print_timestamp, dt_image_t::rating, dt_image_t::raw_black_level, dt_image_t::raw_white_point, dt_image_t::version, and dt_image_t::width.

Referenced by _dt_collection_lut(), and _image_cache_reload_from_db().

◆ dt_image_invalid()

int dt_image_invalid ( const dt_image_t img)

Variable Documentation

◆ _image_cache_load_stmt

sqlite3_stmt* _image_cache_load_stmt = NULL
static

◆ _image_cache_stmt_mutex

◆ _image_cache_stmt_mutex_inited

gsize _image_cache_stmt_mutex_inited = 0
static

◆ _image_cache_write_history_hash_stmt

sqlite3_stmt* _image_cache_write_history_hash_stmt = NULL
static