![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "colorprofiles/colorspaces.h"#include "common/image.h"#include "system/macros.h"#include "system/openmp.h"#include "system/target_clones.h"#include "system/mem_alloc.h"#include "system/simd.h"#include "common/logging.h"#include "common/times.h"#include "common/paths.h"#include "caches/pixelpipe_cache_alloc.h"#include "common/xmp_sidecar.h"#include "metadata/exif.h"#include "caches/image_cache.h"#include "history/history.h"#include "common/image_extensions.h"#include "imageio/imageio_core.h"#include "imageio/imageio_module.h"#include "imageio/imageio_jpeg.h"#include "imageio/imageio_pfm.h"#include "imageio/imageio_png.h"#include "imageio/imageio_pnm.h"#include "imageio/imageio_rawspeed.h"#include "imageio/imageio_libraw.h"#include "imageio/imageio_rgbe.h"#include "imageio/imageio_tiff.h"#include "caches/mipmap_cache.h"#include "common/styles.h"#include "common/conf.h"#include "control/user_message.h"#include "develop/develop.h"#include "develop/imageop.h"#include "develop/dev_history.h"#include <assert.h>#include <glib/gstdio.h>#include <inttypes.h>#include <math.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <strings.h>#include "imageio/imageio_profile.h"#include "control/signal.h"Go to the source code of this file.
Functions | |
| int | dt_imageio_large_thumbnail (const char *filename, uint8_t **buffer, int32_t *th_width, int32_t *th_height, dt_colorspaces_color_profile_type_t *color_space, const int width, const int height) |
| Load the thumbnail embedded into a RAW file having at least the size MAX(width, height) x MAX(width, height). | |
| gboolean | dt_imageio_crop_thumbnail (const dt_boundingbox_t box, uint8_t *const buffer, int32_t *width, int32_t *height) |
| Crop an 8-bit RGBA preview buffer in place to a normalized bounding box. | |
| gboolean | dt_imageio_has_mono_preview (const char *filename) |
| __DT_CLONE_TARGETS__ void | dt_imageio_flip_buffers (char *out, const char *in, const size_t bpp, const int wd, const int ht, const int fwd, const int fht, const int stride, const dt_image_orientation_t orientation) |
| void | dt_imageio_flip_buffers_ui8_to_float (float *out, const uint8_t *in, const float black, const float white, const int ch, const int wd, const int ht, const int fwd, const int fht, const int stride, const dt_image_orientation_t orientation) |
| static dt_imageio_retval_t | _decoder_reason (const dt_imageio_retval_t reason, const dt_imageio_retval_t ret) |
| dt_imageio_retval_t | dt_imageio_open_hdr (dt_image_t *img, const char *filename, dt_mipmap_buffer_t *buf) |
| gboolean | dt_imageio_is_raster (const char *filename) |
| gboolean | dt_imageio_is_raw (const char *filename) |
| int | dt_imageio_is_hdr (const char *filename) |
| static gboolean | _is_in_list (const char *elem, char *list) |
Is elem one of the comma-separated entries of list? | |
| gboolean | dt_imageio_is_handled_by_libraw (dt_image_t *img, const char *filename) |
| dt_imageio_retval_t | dt_imageio_open_raster (dt_image_t *img, const char *filename, dt_mipmap_buffer_t *buf) |
| dt_imageio_retval_t | dt_imageio_open_raw (dt_image_t *img, const char *filename, dt_mipmap_buffer_t *buf) |
| void | dt_imageio_to_fractional (float in, uint32_t *num, uint32_t *den) |
| int | dt_imageio_export (const int32_t imgid, const char *filename, dt_imageio_module_format_t *format, dt_imageio_module_data_t *format_params, const double scale_factor, const gboolean high_quality, const gboolean copy_metadata, const gboolean export_masks, dt_colorspaces_color_profile_type_t icc_type, const gchar *icc_filename, dt_iop_color_intent_t icc_intent, dt_imageio_module_storage_t *storage, dt_imageio_module_data_t *storage_params, int num, int total, dt_export_metadata_t *metadata) |
| gboolean | _apply_style_before_export (dt_develop_t *dev, const dt_imageio_module_data_t *format_params, const int32_t imgid) |
| void | _print_export_debug (dt_dev_pixelpipe_t *pipe, dt_imageio_module_data_t *format_params, const gboolean use_style) |
| void | _filter_pipeline (const char *filter, dt_dev_pixelpipe_t *pipe) |
| static gboolean | _get_export_size (const dt_dev_pixelpipe_t *pipe, const double scale_factor, double *scale, int width, int height, int *processed_width, int *processed_height) |
| void | _clamp_float_to_uint8 (const float *const inbuf, uint8_t *const outbuf, const size_t processed_width, const size_t processed_height) |
| void | _swap_byteorder_float_to_uint8 (const float *const restrict inbuf, uint8_t *const outbuf, const size_t processed_width, const size_t processed_height) |
| void | _export_final_buffer_to_uint16 (const float *const restrict inbuf, uint16_t *const outbuf, const size_t processed_width, const size_t processed_height) |
| static void | _export_convert_output (const float *const data, void *const outbuf, const int bpp, const size_t width, const size_t height, const gboolean display_byteorder, const gboolean thumbnail_export) |
Convert the pipeline's float RGBA output into outbuf, at the depth the format writes: 8 bits (in display byte order if asked), 16 bits, or float for any other depth. | |
| dt_imageio_retval_t | dt_imageio_export_with_flags (const int32_t imgid, const char *filename, dt_imageio_module_format_t *format, dt_imageio_module_data_t *format_params, const gboolean ignore_exif, const gboolean display_byteorder, const gboolean high_quality, const double scale_factor, const gboolean thumbnail_export, const gboolean ignore_history, const char *filter, const gboolean copy_metadata, const gboolean export_masks, dt_colorspaces_color_profile_type_t icc_type, const gchar *icc_filename, dt_iop_color_intent_t icc_intent, dt_imageio_module_storage_t *storage, dt_imageio_module_data_t *storage_params, int num, int total, dt_export_metadata_t *metadata, dt_atomic_int *shutdown) |
| dt_imageio_retval_t | dt_imageio_open (dt_image_t *img, const char *filename, dt_mipmap_buffer_t *buf) |
| dt_imageio_retval_t | dt_imageio_open_standalone (dt_image_t *img, const char *filename, dt_mipmap_buffer_t *buf) |
| Decode a file into a buffer the CALLER owns, with no cache involvement. | |
| void | dt_imageio_close_standalone (dt_mipmap_buffer_t *buf) |
| Release a buffer from dt_imageio_open_standalone(). NULL-safe, and safe to call on a buffer whose open failed. | |
| gboolean | dt_imageio_lookup_makermodel (const char *maker, const char *model, char *mk, int mk_len, char *md, int md_len, char *al, int al_len) |
| gboolean _apply_style_before_export | ( | dt_develop_t * | dev, |
| const dt_imageio_module_data_t * | format_params, | ||
| const int32_t | imgid ) |
Definition at line 627 of file imageio_core.c.
References dev, dt_control_alert(), dt_dev_pop_history_items(), dt_ioppr_check_iop_order(), dt_ioppr_update_for_style_items(), dt_style_item_free(), dt_styles_apply_style_item(), dt_styles_get_item_list(), FALSE, IS_NULL_PTR, dt_imageio_module_data_t::style, and TRUE.
Referenced by dt_imageio_export_with_flags().
| void _clamp_float_to_uint8 | ( | const float *const | inbuf, |
| uint8_t *const | outbuf, | ||
| const size_t | processed_width, | ||
| const size_t | processed_height ) |
Definition at line 764 of file imageio_core.c.
References __OMP_PARALLEL_FOR__, CLAMPF, for_four_channels, k, processed_height, and processed_width.
Referenced by _export_convert_output().
|
static |
Definition at line 356 of file imageio_core.c.
References DT_IMAGEIO_FILE_CORRUPTED, DT_IMAGEIO_IOERROR, DT_IMAGEIO_LOAD_FAILED, DT_IMAGEIO_UNSUPPORTED_CAMERA, and DT_IMAGEIO_UNSUPPORTED_FEATURE.
Referenced by dt_imageio_open(), dt_imageio_open_hdr(), dt_imageio_open_raster(), and dt_imageio_open_raw().
|
static |
Convert the pipeline's float RGBA output into outbuf, at the depth the format writes: 8 bits (in display byte order if asked), 16 bits, or float for any other depth.
A thumbnail export stores this buffer straight into the mipmap cache, and the thumbnail pipeline does not maintain a meaningful alpha contract across all modules: random zero/garbage alpha values would make valid RGB thumbnails render black in consumers that composite the mipmap buffer. So a thumbnail's alpha is forced opaque here, and its RGB left untouched.
Definition at line 806 of file imageio_core.c.
References __OMP_PARALLEL_FOR__, _clamp_float_to_uint8(), _export_final_buffer_to_uint16(), _swap_byteorder_float_to_uint8(), bpp, data, height, k, memcpy(), and width.
Referenced by dt_imageio_export_with_flags().
| void _export_final_buffer_to_uint16 | ( | const float *const restrict | inbuf, |
| uint16_t *const | outbuf, | ||
| const size_t | processed_width, | ||
| const size_t | processed_height ) |
Definition at line 788 of file imageio_core.c.
References __OMP_PARALLEL_FOR__, for_four_channels, k, processed_height, and processed_width.
Referenced by _export_convert_output().
| void _filter_pipeline | ( | const char * | filter, |
| dt_dev_pixelpipe_t * | pipe ) |
Definition at line 678 of file imageio_core.c.
References dt_dev_pixelpipe_disable_after(), dt_dev_pixelpipe_disable_before(), and pipe.
Referenced by dt_imageio_export_with_flags().
|
static |
Definition at line 689 of file imageio_core.c.
References double(), height, MIN, pipe, processed_height, processed_width, and width.
Referenced by dt_imageio_export_with_flags().
|
static |
Is elem one of the comma-separated entries of list?
| elem | the value to look for; NULL is never in any list. |
| list | a MUTABLE, comma-separated string. It is tokenised in place, so the caller's buffer is modified and must be a private copy. |
Definition at line 458 of file imageio_core.c.
References FALSE, IS_NULL_PTR, and TRUE.
Referenced by dt_imageio_is_handled_by_libraw().
| void _print_export_debug | ( | dt_dev_pixelpipe_t * | pipe, |
| dt_imageio_module_data_t * | format_params, | ||
| const gboolean | use_style ) |
Definition at line 653 of file imageio_core.c.
References DT_DEBUG_IMAGEIO, dt_get_debug_flags(), piece, pipe, and dt_imageio_module_data_t::style.
Referenced by dt_imageio_export_with_flags().
| void _swap_byteorder_float_to_uint8 | ( | const float *const restrict | inbuf, |
| uint8_t *const | outbuf, | ||
| const size_t | processed_width, | ||
| const size_t | processed_height ) |
Definition at line 774 of file imageio_core.c.
References __OMP_PARALLEL_FOR__, CLAMPF, k, processed_height, and processed_width.
Referenced by _export_convert_output().
| void dt_imageio_close_standalone | ( | dt_mipmap_buffer_t * | buf | ) |
Release a buffer from dt_imageio_open_standalone(). NULL-safe, and safe to call on a buffer whose open failed.
Definition at line 1204 of file imageio_core.c.
References dt_mipmap_buffer_t::buf, dt_mipmap_buffer_t::cache_entry, dt_cache_entry_free_detached(), and IS_NULL_PTR.
Referenced by _import_get_thumbnail(), and dt_imageio_open_standalone().
| gboolean dt_imageio_crop_thumbnail | ( | const dt_boundingbox_t | box, |
| uint8_t *const | buffer, | ||
| int32_t * | width, | ||
| int32_t * | height ) |
Crop an 8-bit RGBA preview buffer in place to a normalized bounding box.
Cameras that record selected framing (DNG DefaultUserCrop) still render their embedded previews from the full default-crop rectangle, so a preview taken straight out of the raw shows more than the photographer framed. This trims it back.
The box must be expressed in the buffer's own orientation. For previews read from a raw that is the un-oriented sensor frame (dt_image_get_usercrop()), because Ansel applies the EXIF rotation afterwards, when downscaling.
Only ever apply this to a preview embedded in the raw itself: a companion/sidecar JPEG is written by the camera at the framing it displayed and is already cropped.
| box | normalized (top, left, bottom, right); an identity box is a no-op |
| buffer | 8-bit RGBA pixels, compacted in place |
| width | in/out buffer width, updated to the cropped width |
| height | in/out buffer height, updated to the cropped height |
Definition at line 195 of file imageio_core.c.
References FALSE, height, IS_NULL_PTR, top, TRUE, and width.
Referenced by _import_get_thumbnail(), and _init_8().
| int dt_imageio_export | ( | const int32_t | imgid, |
| const char * | filename, | ||
| struct dt_imageio_module_format_t * | format, | ||
| struct dt_imageio_module_data_t * | format_params, | ||
| const double | scale_factor, | ||
| const gboolean | high_quality, | ||
| const gboolean | copy_metadata, | ||
| const gboolean | export_masks, | ||
| dt_colorspaces_color_profile_type_t | icc_type, | ||
| const gchar * | icc_filename, | ||
| dt_iop_color_intent_t | icc_intent, | ||
| dt_imageio_module_storage_t * | storage, | ||
| dt_imageio_module_data_t * | storage_params, | ||
| int | num, | ||
| int | total, | ||
| dt_export_metadata_t * | metadata ) |
Output size, for both functions below: with scale_factor > 0 the image is reduced by that factor (capped at 1); otherwise it is fitted in format_params->max_width x max_height, 0 x 0 meaning full size. Nothing is read from the export module's configuration: the size is the caller's, resolved once, so an export queued before a settings change keeps its own.
Definition at line 608 of file imageio_core.c.
References dt_imageio_export_with_flags(), FALSE, dt_imageio_module_format_t::mime, TRUE, and dt_imageio_module_format_t::write_image.
| dt_imageio_retval_t dt_imageio_export_with_flags | ( | const int32_t | imgid, |
| const char * | filename, | ||
| struct dt_imageio_module_format_t * | format, | ||
| struct dt_imageio_module_data_t * | format_params, | ||
| const gboolean | ignore_exif, | ||
| const gboolean | display_byteorder, | ||
| const gboolean | high_quality, | ||
| const double | scale_factor, | ||
| const gboolean | thumbnail_export, | ||
| const gboolean | ignore_history, | ||
| const char * | filter, | ||
| const gboolean | copy_metadata, | ||
| const gboolean | export_masks, | ||
| dt_colorspaces_color_profile_type_t | icc_type, | ||
| const gchar * | icc_filename, | ||
| dt_iop_color_intent_t | icc_intent, | ||
| dt_imageio_module_storage_t * | storage, | ||
| dt_imageio_module_data_t * | storage_params, | ||
| int | num, | ||
| int | total, | ||
| dt_export_metadata_t * | metadata, | ||
| dt_atomic_int * | shutdown ) |
| ignore_history | render the input image as no edit has touched it – history end 0, so every module with its default params and enabled state – instead of the image's history. |
Definition at line 850 of file imageio_core.c.
References _apply_style_before_export(), _export_convert_output(), _filter_pipeline(), _get_export_size(), _print_export_debug(), bpp, dt_imageio_module_format_t::bpp, dt_mipmap_buffer_t::buf, data, dev, DT_COLORSPACE_SRGB, dt_colorspaces_get_output_profile(), dt_control_signal_get_global(), DT_DEBUG_CONTROL_SIGNAL_RAISE, DT_DEBUG_IMAGEIO, dt_dev_backbuf_get_hash(), dt_dev_cleanup(), dt_dev_init(), dt_dev_load_image(), dt_dev_pixelpipe_cache_rdlock_entry(), dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_pixelpipe_cache_ref_entry_by_hash(), dt_dev_pixelpipe_cleanup(), dt_dev_pixelpipe_create_nodes(), dt_dev_pixelpipe_get_roi_out(), dt_dev_pixelpipe_has_shutdown(), dt_dev_pixelpipe_init_export(), dt_dev_pixelpipe_init_thumbnail(), dt_dev_pixelpipe_process(), dt_dev_pixelpipe_propagate_formats(), dt_dev_pixelpipe_set_icc(), dt_dev_pixelpipe_set_input(), dt_dev_pixelpipe_synch_all, dt_dev_set_history_end_ext(), dt_exif_read_blob(), dt_exif_xmp_attach_export(), dt_free, dt_get_times(), dt_image_full_path(), DT_IMAGEIO_ABORTED, DT_IMAGEIO_CACHE_FULL, DT_IMAGEIO_IOERROR, DT_IMAGEIO_OK, DT_IMAGEIO_PROCESSING_FAILED, dt_ioppr_resync_modules_order(), DT_MIPMAP_BLOCKING, dt_mipmap_cache_get, dt_mipmap_cache_release, DT_MIPMAP_FULL, DT_PATH_MAX, dt_pixelpipe_cache_alloc_align_cache, dt_pixelpipe_cache_free_align, dt_pixelpipe_cache_get_alloc_refusals(), dt_print(), dt_pthread_rwlock_unlock(), dt_pthread_rwlock_wrlock(), dt_show_times(), DT_SIGNAL_IMAGE_EXPORT_TMPFILE, error(), FALSE, dt_imageio_module_format_t::flags, FORMAT_FLAGS_NO_TMPFILE, FORMAT_FLAGS_SUPPORT_XMP, dt_imageio_module_data_t::height, dt_mipmap_buffer_t::height, height, IS_NULL_PTR, dt_mipmap_buffer_t::iscale, dt_imageio_module_format_t::levels, MAX, dt_imageio_module_data_t::max_height, dt_imageio_module_data_t::max_width, dt_imageio_module_format_t::mime, pipe, processed_height, processed_width, res, size, sRGB, dt_mipmap_buffer_t::status, status, dt_imageio_module_data_t::style, TRUE, dt_imageio_module_data_t::width, dt_mipmap_buffer_t::width, width, and dt_imageio_module_format_t::write_image.
Referenced by _export_image(), _export_pre_module_fullres_to_tiff(), _init_8(), dt_control_merge_hdr_job_run(), and dt_imageio_export().
| __DT_CLONE_TARGETS__ void dt_imageio_flip_buffers | ( | char * | out, |
| const char * | in, | ||
| const size_t | bpp, | ||
| const int | wd, | ||
| const int | ht, | ||
| const int | fwd, | ||
| const int | fht, | ||
| const int | stride, | ||
| const dt_image_orientation_t | orientation ) |
Definition at line 265 of file imageio_core.c.
References __OMP_PARALLEL_FOR__, bpp, i, in, memcpy(), ORIENTATION_FLIP_X, ORIENTATION_FLIP_Y, ORIENTATION_SWAP_XY, and out.
Referenced by _orient_scope_buf(), distort_mask(), dt_imageio_open_rawspeed(), and process().
| void dt_imageio_flip_buffers_ui8_to_float | ( | float * | out, |
| const uint8_t * | in, | ||
| const float | black, | ||
| const float | white, | ||
| const int | ch, | ||
| const int | wd, | ||
| const int | ht, | ||
| const int | fwd, | ||
| const int | fht, | ||
| const int | stride, | ||
| const dt_image_orientation_t | orientation ) |
Definition at line 306 of file imageio_core.c.
References __OMP_PARALLEL_FOR__, ch, i, in, k, ORIENTATION_FLIP_X, ORIENTATION_FLIP_Y, ORIENTATION_SWAP_XY, and out.
Referenced by dt_imageio_open_jpeg().
| gboolean dt_imageio_has_mono_preview | ( | const char * | filename | ) |
Definition at line 231 of file imageio_core.c.
References cleanup(), color_space, DT_DEBUG_IMAGEIO, dt_imageio_large_thumbnail(), dt_pixelpipe_cache_free_align, dt_print(), FALSE, in, IS_NULL_PTR, TRUE, and x.
| gboolean dt_imageio_is_handled_by_libraw | ( | dt_image_t * | img, |
| const char * | filename ) |
Definition at line 472 of file imageio_core.c.
References _is_in_list(), dt_conf_get_string(), DT_DEBUG_IMAGEIO, dt_free, dt_print(), dt_image_t::exif_maker, dt_image_t::exif_model, FALSE, and IS_NULL_PTR.
Referenced by dt_imageio_open_raw().
| int dt_imageio_is_hdr | ( | const char * | filename | ) |
Definition at line 435 of file imageio_core.c.
References dt_image_ext_is_hdr(), and FALSE.
Referenced by dt_imageio_open().
| gboolean dt_imageio_is_raster | ( | const char * | filename | ) |
Definition at line 419 of file imageio_core.c.
References dt_image_ext_is_ldr(), and FALSE.
Referenced by dt_imageio_open().
| gboolean dt_imageio_is_raw | ( | const char * | filename | ) |
Definition at line 427 of file imageio_core.c.
References dt_image_ext_is_raw(), and FALSE.
Referenced by dt_imageio_open().
| int dt_imageio_large_thumbnail | ( | const char * | filename, |
| uint8_t ** | buffer, | ||
| int32_t * | th_width, | ||
| int32_t * | th_height, | ||
| dt_colorspaces_color_profile_type_t * | color_space, | ||
| const int | width, | ||
| const int | height ) |
Load the thumbnail embedded into a RAW file having at least the size MAX(width, height) x MAX(width, height).
| filename | |
| buffer | returned image buffer (allocated) |
| th_width | returned actual width of the thumbnail |
| th_height | returned actual height of the thumbnail |
| color_space | returned color space found for the thumbnail |
| width | input target width. th_width will be at least this. |
| height | input target height th_height will be at least this. |
Definition at line 128 of file imageio_core.c.
References color_space, DT_COLORSPACE_SRGB, dt_exif_get_thumbnail(), dt_free, dt_imageio_jpeg_decompress(), dt_imageio_jpeg_decompress_header(), dt_imageio_tiff_decode_blob(), dt_pixelpipe_cache_alloc_align_cache, dt_pixelpipe_cache_free_align, error(), dt_imageio_jpeg_t::height, height, IS_NULL_PTR, MAX, res, dt_imageio_jpeg_t::width, and width.
Referenced by _get_image_buffer(), _import_get_thumbnail(), _init_8(), and dt_imageio_has_mono_preview().
| gboolean dt_imageio_lookup_makermodel | ( | const char * | maker, |
| const char * | model, | ||
| char * | mk, | ||
| int | mk_len, | ||
| char * | md, | ||
| int | md_len, | ||
| char * | al, | ||
| int | al_len ) |
Definition at line 1212 of file imageio_core.c.
References dt_libraw_lookup_makermodel(), dt_rawspeed_lookup_makermodel(), FALSE, maker, and model.
Referenced by dt_collection_get_makermodel(), and dt_image_refresh_makermodel().
| dt_imageio_retval_t dt_imageio_open | ( | dt_image_t * | img, |
| const char * | filename, | ||
| dt_mipmap_buffer_t * | buf ) |
Definition at line 1114 of file imageio_core.c.
References _decoder_reason(), dt_image_t::crop_height, dt_image_t::crop_width, dt_image_t::crop_x, dt_image_t::crop_y, dt_control_alert_once(), dt_control_log(), dt_image_buffer_resolve_flags(), DT_IMAGEIO_CACHE_FULL, DT_IMAGEIO_FILE_CORRUPTED, dt_imageio_is_hdr(), dt_imageio_is_raster(), dt_imageio_is_raw(), DT_IMAGEIO_OK, dt_imageio_open_hdr(), dt_imageio_open_raster(), dt_imageio_open_raw(), dt_image_t::height, dt_image_t::loader, LOADER_UNKNOWN, dt_image_t::p_height, dt_image_t::p_width, and dt_image_t::width.
Referenced by _generate_blocking(), and dt_imageio_open_standalone().
| dt_imageio_retval_t dt_imageio_open_hdr | ( | dt_image_t * | img, |
| const char * | filename, | ||
| dt_mipmap_buffer_t * | buf ) |
Definition at line 372 of file imageio_core.c.
References _decoder_reason(), DT_IMAGEIO_CACHE_FULL, DT_IMAGEIO_FILE_CORRUPTED, DT_IMAGEIO_OK, dt_imageio_open_avif(), dt_imageio_open_exr(), dt_imageio_open_heif(), dt_imageio_open_pfm(), dt_imageio_open_rgbe(), and IS_NULL_PTR.
Referenced by dt_imageio_open().
| dt_imageio_retval_t dt_imageio_open_raster | ( | dt_image_t * | img, |
| const char * | filename, | ||
| dt_mipmap_buffer_t * | buf ) |
Definition at line 505 of file imageio_core.c.
References _decoder_reason(), DT_IMAGEIO_CACHE_FULL, DT_IMAGEIO_FILE_CORRUPTED, DT_IMAGEIO_OK, dt_imageio_open_j2k(), dt_imageio_open_jpeg(), dt_imageio_open_png(), dt_imageio_open_pnm(), dt_imageio_open_tiff(), dt_imageio_open_webp(), and IS_NULL_PTR.
Referenced by dt_imageio_open().
| dt_imageio_retval_t dt_imageio_open_raw | ( | dt_image_t * | img, |
| const char * | filename, | ||
| dt_mipmap_buffer_t * | buf ) |
Definition at line 551 of file imageio_core.c.
References _decoder_reason(), DT_IMAGEIO_CACHE_FULL, DT_IMAGEIO_FILE_CORRUPTED, dt_imageio_is_handled_by_libraw(), DT_IMAGEIO_OK, dt_imageio_open_libraw(), dt_imageio_open_rawspeed(), and IS_NULL_PTR.
Referenced by dt_imageio_open().
| dt_imageio_retval_t dt_imageio_open_standalone | ( | dt_image_t * | img, |
| const char * | filename, | ||
| dt_mipmap_buffer_t * | buf ) |
Decode a file into a buffer the CALLER owns, with no cache involvement.
dt_imageio_open() writes into a dt_mipmap_buffer_t whose cache_entry the mipmap cache supplies and owns. A caller that just wants one image decoded once – the import dialog's preview, say – has no cache entry to give it, and used to fabricate a zeroed dt_cache_entry_t on its own stack, hand over its address, and free cache_entry.data itself. That is a caller assembling the cache's internal bookkeeping by hand in order to borrow the decoder, and it is why gui/import.c had to include the cache's substrate header.
This pair owns that bookkeeping instead. Nothing outside src/caches needs to know what a dt_cache_entry_t is.
| img | image metadata, filled by the decoder as with dt_imageio_open(). |
| filename | file to decode. |
| buf | receives the decoded image. Zeroed first; release with dt_imageio_close_standalone() whether this succeeds or fails. |
Definition at line 1186 of file imageio_core.c.
References dt_mipmap_buffer_t::cache_entry, dt_cache_entry_new_detached(), DT_IMAGEIO_CACHE_FULL, dt_imageio_close_standalone(), DT_IMAGEIO_LOAD_FAILED, DT_IMAGEIO_OK, dt_imageio_open(), DT_MIPMAP_FULL, IS_NULL_PTR, and dt_mipmap_buffer_t::size.
Referenced by _import_get_thumbnail().
| void dt_imageio_to_fractional | ( | float | in, |
| uint32_t * | num, | ||
| uint32_t * | den ) |
Definition at line 592 of file imageio_core.c.
References in.