Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
imageio_jpeg.h File Reference
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <jpeglib.h>
#include "common/colorspaces.h"
#include "common/image.h"
#include "common/mipmap_cache.h"
+ Include dependency graph for imageio_jpeg.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_imageio_jpeg_t
 

Typedefs

typedef struct dt_imageio_jpeg_t dt_imageio_jpeg_t
 

Functions

int dt_imageio_jpeg_decompress_header (const void *in, size_t length, dt_imageio_jpeg_t *jpg)
 
int dt_imageio_jpeg_decompress (dt_imageio_jpeg_t *jpg, uint8_t *out)
 
int dt_imageio_jpeg_compress (const uint8_t *in, uint8_t *out, const int width, const int height, const int quality)
 
int dt_imageio_jpeg_write (const char *filename, const uint8_t *in, const int width, const int height, const int quality, const void *exif, int exif_len)
 
int dt_imageio_jpeg_write_with_icc_profile (const char *filename, const uint8_t *in, const int width, const int height, const int quality, const void *exif, int exif_len, int32_t imgid)
 
int dt_imageio_jpeg_read_header (const char *filename, dt_imageio_jpeg_t *jpg)
 
int dt_imageio_jpeg_read (dt_imageio_jpeg_t *jpg, uint8_t *out)
 
int dt_imageio_jpeg_read_profile (dt_imageio_jpeg_t *jpg, uint8_t **out)
 
dt_colorspaces_color_profile_type_t dt_imageio_jpeg_read_color_space (dt_imageio_jpeg_t *jpg)
 
dt_imageio_retval_t dt_imageio_open_jpeg (dt_image_t *img, const char *filename, dt_mipmap_buffer_t *buf)
 

Typedef Documentation

◆ dt_imageio_jpeg_t

Function Documentation

◆ dt_imageio_jpeg_compress()

int dt_imageio_jpeg_compress ( const uint8_t *  in,
uint8_t *  out,
const int  width,
const int  height,
const int  quality 
)

compresses in to out buffer with given quality (0..100). out buffer must be large enough. returns actual data length.

Todo:
: find out why this function is not used anymore. Where do we compress ???

References dt_imageio_jpeg_t::dest, dt_alloc_align, dt_free_align, dt_imageio_jpeg_empty_output_buffer(), dt_imageio_jpeg_error_exit(), dt_imageio_jpeg_init_destination(), dt_imageio_jpeg_term_destination(), height, dt_imageio_jpeg_error_mgr::pub, dt_imageio_jpeg_error_mgr::setjmp_buffer, TRUE, and width.

◆ dt_imageio_jpeg_decompress()

int dt_imageio_jpeg_decompress ( dt_imageio_jpeg_t jpg,
uint8_t *  out 
)

◆ dt_imageio_jpeg_decompress_header()

◆ dt_imageio_jpeg_read()

int dt_imageio_jpeg_read ( dt_imageio_jpeg_t jpg,
uint8_t *  out 
)

◆ dt_imageio_jpeg_read_color_space()

dt_colorspaces_color_profile_type_t dt_imageio_jpeg_read_color_space ( dt_imageio_jpeg_t jpg)

return the color space of the image, this only distinguishs between sRGB, AdobeRGB and unknown. used for mipmaps

References dt_imageio_jpeg_t::dinfo, DT_COLORSPACE_DISPLAY, dt_exif_get_color_space(), and EXIF_MARKER.

Referenced by _load_jpg(), and dt_mipmap_cache_allocate_dynamic().

◆ dt_imageio_jpeg_read_header()

int dt_imageio_jpeg_read_header ( const char *  filename,
dt_imageio_jpeg_t jpg 
)

◆ dt_imageio_jpeg_read_profile()

int dt_imageio_jpeg_read_profile ( dt_imageio_jpeg_t jpg,
uint8_t **  out 
)

reads the color profile attached to the jpeg, closes file.

References dt_imageio_jpeg_t::dinfo, dt_imageio_jpeg_t::f, and read_icc_profile().

Referenced by dt_image_find_best_color_profile().

◆ dt_imageio_jpeg_write()

int dt_imageio_jpeg_write ( const char *  filename,
const uint8_t *  in,
const int  width,
const int  height,
const int  quality,
const void exif,
int  exif_len 
)

write jpeg to file, with exif if not NULL.

References dt_imageio_jpeg_write_with_icc_profile(), height, and width.

Referenced by dt_mipmap_cache_deallocate_dynamic().

◆ dt_imageio_jpeg_write_with_icc_profile()

int dt_imageio_jpeg_write_with_icc_profile ( const char *  filename,
const uint8_t *  in,
const int  width,
const int  height,
const int  quality,
const void exif,
int  exif_len,
int32_t  imgid 
)

◆ dt_imageio_open_jpeg()