![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "colorprofiles/colorspaces.h"#include "imageio_tiff.h"#include "system/macros.h"#include "system/mem_alloc.h"#include "common/logging.h"#include "caches/pixelpipe_cache_alloc.h"#include "metadata/exif.h"#include "develop/develop.h"#include <inttypes.h>#include <memory.h>#include <stdio.h>#include <strings.h>#include <tiffio.h>
Include dependency graph for imageio_tiff.c:Go to the source code of this file.
Data Structures | |
| struct | tiff_t |
| union | fp32_t |
| struct | _tiff_blob_t |
Macros | |
| #define | LAB_CONVERSION_PROFILE DT_COLORSPACE_LIN_REC2020 |
Typedefs | |
| typedef struct tiff_t | tiff_t |
| typedef union fp32_t | fp32_t |
| typedef struct _tiff_blob_t | _tiff_blob_t |
Functions | |
| static float | _half_to_float (uint16_t h) |
| static int | _read_chunky_8 (tiff_t *t) |
| static int | _read_chunky_16 (tiff_t *t) |
| static int | _read_chunky_h (tiff_t *t) |
| static int | _read_chunky_f (tiff_t *t) |
| static int | _read_chunky_8_Lab (tiff_t *t, uint16_t photometric) |
| static int | _read_chunky_16_Lab (tiff_t *t, uint16_t photometric) |
| static void | _warning_error_handler (const char *type, const char *module, const char *fmt, va_list ap) |
| static void | _warning_handler (const char *module, const char *fmt, va_list ap) |
| static void | _error_handler (const char *module, const char *fmt, va_list ap) |
| dt_imageio_retval_t | dt_imageio_open_tiff (dt_image_t *img, const char *filename, dt_mipmap_buffer_t *mbuf) |
| int | dt_imageio_tiff_read_profile (const char *filename, uint8_t **out) |
| static tmsize_t | _blob_read (thandle_t handle, void *buffer, tmsize_t size) |
| static tmsize_t | _blob_write (thandle_t handle, void *buffer, tmsize_t size) |
| static toff_t | _blob_seek (thandle_t handle, toff_t offset, int whence) |
| static int | _blob_close (thandle_t handle) |
| static toff_t | _blob_size (thandle_t handle) |
| static int | _blob_map (thandle_t handle, void **base, toff_t *size) |
| static void | _blob_unmap (thandle_t handle, void *base, toff_t size) |
| gboolean | dt_imageio_tiff_decode_blob (const uint8_t *const blob, const size_t bufsize, uint8_t **out, int32_t *width, int32_t *height) |
| Decode a TIFF held in memory into 8-bit RGBx, for the previews raw files embed. | |
| #define LAB_CONVERSION_PROFILE DT_COLORSPACE_LIN_REC2020 |
Definition at line 51 of file imageio_tiff.c.
| typedef struct _tiff_blob_t _tiff_blob_t |
|
static |
Definition at line 630 of file imageio_tiff.c.
Referenced by dt_imageio_tiff_decode_blob().
|
static |
Definition at line 642 of file imageio_tiff.c.
Referenced by dt_imageio_tiff_decode_blob().
|
static |
Definition at line 588 of file imageio_tiff.c.
References _tiff_blob_t::data, n, _tiff_blob_t::pos, size, and _tiff_blob_t::size.
Referenced by dt_imageio_tiff_decode_blob().
|
static |
Definition at line 608 of file imageio_tiff.c.
References _tiff_blob_t::pos, and _tiff_blob_t::size.
Referenced by dt_imageio_tiff_decode_blob().
|
static |
Definition at line 635 of file imageio_tiff.c.
Referenced by dt_imageio_tiff_decode_blob().
Definition at line 647 of file imageio_tiff.c.
Referenced by dt_imageio_tiff_decode_blob().
|
static |
Definition at line 603 of file imageio_tiff.c.
Referenced by dt_imageio_tiff_decode_blob().
|
static |
Definition at line 349 of file imageio_tiff.c.
References _warning_error_handler().
Referenced by dt_imageio_open_tiff(), and dt_imageio_tiff_decode_blob().
|
inlinestatic |
Definition at line 73 of file imageio_tiff.c.
References fp32_t::f, and fp32_t::u.
Referenced by _read_chunky_h().
|
inlinestatic |
Definition at line 134 of file imageio_tiff.c.
References i, out, row, and t.
Referenced by dt_imageio_open_tiff().
|
inlinestatic |
Definition at line 280 of file imageio_tiff.c.
References DT_COLORSPACE_LAB, dt_colorspaces_get_profile(), DT_PROFILE_ROLE_ANY, DT_PROFILE_ROLE_MONITOR, DT_PROFILE_ROLE_OUTPUT, i, Lab, LAB_CONVERSION_PROFILE, out, dt_colorspaces_color_profile_t::profile, row, and t.
Referenced by dt_imageio_open_tiff().
|
inlinestatic |
Definition at line 102 of file imageio_tiff.c.
References i, out, row, and t.
Referenced by dt_imageio_open_tiff().
|
inlinestatic |
Definition at line 227 of file imageio_tiff.c.
References DT_COLORSPACE_LAB, dt_colorspaces_get_profile(), DT_PROFILE_ROLE_ANY, DT_PROFILE_ROLE_MONITOR, DT_PROFILE_ROLE_OUTPUT, i, Lab, LAB_CONVERSION_PROFILE, out, dt_colorspaces_color_profile_t::profile, row, and t.
Referenced by dt_imageio_open_tiff().
|
inlinestatic |
Definition at line 196 of file imageio_tiff.c.
References i, out, row, and t.
Referenced by dt_imageio_open_tiff().
|
inlinestatic |
Definition at line 165 of file imageio_tiff.c.
References _half_to_float(), i, out, row, and t.
Referenced by dt_imageio_open_tiff().
|
static |
Definition at line 334 of file imageio_tiff.c.
References type.
Referenced by _error_handler(), and _warning_handler().
|
static |
Definition at line 341 of file imageio_tiff.c.
References _warning_error_handler(), DT_DEBUG_IMAGEIO, and dt_get_debug_flags().
Referenced by dt_imageio_open_tiff(), and dt_imageio_tiff_decode_blob().
| dt_imageio_retval_t dt_imageio_open_tiff | ( | dt_image_t * | img, |
| const char * | filename, | ||
| dt_mipmap_buffer_t * | mbuf | ||
| ) |
Definition at line 354 of file imageio_tiff.c.
References _error_handler(), _read_chunky_16(), _read_chunky_16_Lab(), _read_chunky_8(), _read_chunky_8_Lab(), _read_chunky_f(), _read_chunky_h(), _warning_handler(), DT_DEBUG_IMAGEIO, dt_exif_read(), dt_free, DT_IMAGE_HDR, DT_IMAGE_LDR, DT_IMAGEIO_CACHE_FULL, DT_IMAGEIO_FILE_CORRUPTED, DT_IMAGEIO_OK, dt_mipmap_cache_alloc(), dt_print(), dt_image_t::exif_inited, tiff_t::image, IOP_CS_LAB, IOP_CS_RGB, IS_NULL_PTR, LOADER_TIFF, t, TYPE_FLOAT, and void().
Referenced by dt_imageio_open_raster().
| gboolean dt_imageio_tiff_decode_blob | ( | const uint8_t * | blob, |
| size_t | bufsize, | ||
| uint8_t ** | out, | ||
| int32_t * | width, | ||
| int32_t * | height | ||
| ) |
Decode a TIFF held in memory into 8-bit RGBx, for the previews raw files embed.
Raws that do not embed a JPEG preview embed a TIFF one – every DNG written by Adobe's converter does, as do Phase One IIQ, Hasselblad 3FR and film scanners. This is the only decoder those previews need; libtiff reads a blob through TIFFClientOpen just as well as a file.
| blob | Encoded TIFF bytes. Not retained. |
| bufsize | Length of blob. |
| out | On success, receives a freshly allocated buffer of 4 bytes per pixel, laid out R, G, B, unused – the layout the JPEG preview path also produces. The caller owns it and must release it with dt_pixelpipe_cache_free_align(). Untouched on failure. |
| width | Receives the decoded width. Untouched on failure. |
| height | Receives the decoded height. Untouched on failure. |
Definition at line 651 of file imageio_tiff.c.
References _blob_close(), _blob_map(), _blob_read(), _blob_seek(), _blob_size(), _blob_unmap(), _blob_write(), _error_handler(), _warning_handler(), _tiff_blob_t::data, DT_DEBUG_IMAGEIO, dt_pixelpipe_cache_alloc_align_cache, dt_pixelpipe_cache_free_align, dt_print(), FALSE, height, i, IS_NULL_PTR, out, TRUE, and width.
Referenced by dt_imageio_large_thumbnail().
| int dt_imageio_tiff_read_profile | ( | const char * | filename, |
| uint8_t ** | out | ||
| ) |
Definition at line 517 of file imageio_tiff.c.
References dt_colorspaces_get_profile(), dt_free, DT_PROFILE_ROLE_MONITOR, DT_PROFILE_ROLE_OUTPUT, IS_NULL_PTR, LAB_CONVERSION_PROFILE, out, and dt_colorspaces_color_profile_t::profile.
Referenced by dt_image_find_best_color_profile().