Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
jpeg.c File Reference
#include "bauhaus/bauhaus.h"
#include "common/colorspaces.h"
#include "common/darktable.h"
#include "common/exif.h"
#include "common/imageio.h"
#include "common/imageio_module.h"
#include "control/conf.h"
#include "imageio/format/imageio_format_api.h"
#include "gui/gtk.h"
#include <inttypes.h>
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <jpeglib.h>
+ Include dependency graph for jpeg.c:

Go to the source code of this file.

Data Structures

struct  dt_imageio_jpeg_t
 
struct  dt_imageio_jpeg_gui_data_t
 
struct  dt_imageio_jpeg_error_mgr
 

Macros

#define ICC_MARKER   (JPEG_APP0 + 2) /* JPEG marker code for ICC */
 
#define ICC_OVERHEAD_LEN   14 /* size of non-profile data in APP2 */
 
#define MAX_BYTES_IN_MARKER   65533 /* maximum data len of a JPEG marker */
 
#define MAX_DATA_BYTES_IN_MARKER   (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
 

Typedefs

typedef struct dt_imageio_jpeg_t dt_imageio_jpeg_t
 
typedef struct dt_imageio_jpeg_gui_data_t dt_imageio_jpeg_gui_data_t
 
typedef struct dt_imageio_jpeg_error_mgrdt_imageio_jpeg_error_ptr
 

Functions

static void dt_imageio_jpeg_error_exit (j_common_ptr cinfo)
 
static void write_icc_profile (j_compress_ptr cinfo, const JOCTET *icc_data_ptr, unsigned int icc_data_len)
 
int write_image (dt_imageio_module_data_t *jpg_tmp, const char *filename, const void *in_tmp, dt_colorspaces_color_profile_type_t over_type, const char *over_filename, void *exif, int exif_len, int32_t imgid, int num, int total, struct dt_dev_pixelpipe_t *pipe, const gboolean export_masks)
 
static int __attribute__ ((__unused__))
 
int read_image (dt_imageio_module_data_t *jpg_tmp, uint8_t *out)
 
size_t params_size (dt_imageio_module_format_t *self)
 
voidlegacy_params (dt_imageio_module_format_t *self, const void *const old_params, const size_t old_params_size, const int old_version, const int new_version, size_t *new_size)
 
voidget_params (dt_imageio_module_format_t *self)
 
void free_params (dt_imageio_module_format_t *self, dt_imageio_module_data_t *params)
 
int set_params (dt_imageio_module_format_t *self, const void *params, const int size)
 
int bpp (dt_imageio_module_data_t *p)
 
int levels (dt_imageio_module_data_t *p)
 
const char * mime (dt_imageio_module_data_t *data)
 
const char * extension (dt_imageio_module_data_t *data)
 
int flags (dt_imageio_module_data_t *data)
 
void init (dt_imageio_module_format_t *self)
 
void cleanup (dt_imageio_module_format_t *self)
 
const char * name ()
 
static void quality_changed (GtkWidget *slider, gpointer user_data)
 
void gui_init (dt_imageio_module_format_t *self)
 
void gui_cleanup (dt_imageio_module_format_t *self)
 
void gui_reset (dt_imageio_module_format_t *self)
 

Variables

struct dt_imageio_jpeg_error_mgr dt_imageio_jpeg_error_mgr
 

Macro Definition Documentation

◆ ICC_MARKER

#define ICC_MARKER   (JPEG_APP0 + 2) /* JPEG marker code for ICC */

Definition at line 110 of file jpeg.c.

◆ ICC_OVERHEAD_LEN

#define ICC_OVERHEAD_LEN   14 /* size of non-profile data in APP2 */

Definition at line 111 of file jpeg.c.

◆ MAX_BYTES_IN_MARKER

#define MAX_BYTES_IN_MARKER   65533 /* maximum data len of a JPEG marker */

Definition at line 112 of file jpeg.c.

◆ MAX_DATA_BYTES_IN_MARKER

#define MAX_DATA_BYTES_IN_MARKER   (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)

Definition at line 113 of file jpeg.c.

Typedef Documentation

◆ dt_imageio_jpeg_error_ptr

Definition at line 88 of file jpeg.c.

◆ dt_imageio_jpeg_gui_data_t

◆ dt_imageio_jpeg_t

Function Documentation

◆ __attribute__()

◆ bpp()

int bpp ( dt_imageio_module_data_t p)

Definition at line 535 of file jpeg.c.

◆ cleanup()

void cleanup ( dt_imageio_module_format_t self)

Definition at line 564 of file jpeg.c.

◆ dt_imageio_jpeg_error_exit()

static void dt_imageio_jpeg_error_exit ( j_common_ptr  cinfo)
static

Definition at line 90 of file jpeg.c.

References dt_imageio_jpeg_error_mgr::setjmp_buffer.

Referenced by __attribute__(), read_image(), and write_image().

◆ extension()

const char * extension ( dt_imageio_module_data_t data)

Definition at line 550 of file jpeg.c.

◆ flags()

int flags ( dt_imageio_module_data_t data)

Definition at line 555 of file jpeg.c.

References FORMAT_FLAGS_SUPPORT_XMP.

◆ free_params()

void free_params ( dt_imageio_module_format_t self,
dt_imageio_module_data_t params 
)

Definition at line 521 of file jpeg.c.

References dt_free.

◆ get_params()

void * get_params ( dt_imageio_module_format_t self)

Definition at line 512 of file jpeg.c.

References d, dt_conf_get_int(), and dt_imageio_jpeg_t::quality.

◆ gui_cleanup()

void gui_cleanup ( dt_imageio_module_format_t self)

Definition at line 605 of file jpeg.c.

References dt_free, and dt_imageio_module_format_t::gui_data.

◆ gui_init()

◆ gui_reset()

◆ init()

void init ( dt_imageio_module_format_t self)

Definition at line 560 of file jpeg.c.

◆ legacy_params()

void * legacy_params ( dt_imageio_module_format_t self,
const void *const  old_params,
const size_t  old_params_size,
const int  old_version,
const int  new_version,
size_t *  new_size 
)

Definition at line 473 of file jpeg.c.

References f, dt_imageio_jpeg_t::global, height, dt_imageio_module_data_t::max_width, n, and width.

◆ levels()

int levels ( dt_imageio_module_data_t p)

Definition at line 540 of file jpeg.c.

References IMAGEIO_INT8, and IMAGEIO_RGB.

◆ mime()

const char * mime ( dt_imageio_module_data_t data)

Definition at line 545 of file jpeg.c.

◆ name()

const char * name ( )

Definition at line 572 of file jpeg.c.

◆ params_size()

size_t params_size ( dt_imageio_module_format_t self)

Definition at line 468 of file jpeg.c.

◆ quality_changed()

static void quality_changed ( GtkWidget slider,
gpointer  user_data 
)
static

Definition at line 577 of file jpeg.c.

References dt_bauhaus_slider_get(), and dt_conf_set_int().

Referenced by gui_init().

◆ read_image()

◆ set_params()

int set_params ( dt_imageio_module_format_t self,
const void params,
const int  size 
)

Definition at line 526 of file jpeg.c.

References d, dt_bauhaus_slider_set(), g, dt_imageio_module_format_t::gui_data, and size.

◆ write_icc_profile()

static void write_icc_profile ( j_compress_ptr  cinfo,
const JOCTET *  icc_data_ptr,
unsigned int  icc_data_len 
)
static

Definition at line 124 of file jpeg.c.

References ICC_MARKER, ICC_OVERHEAD_LEN, and MAX_DATA_BYTES_IN_MARKER.

Referenced by write_image().

◆ write_image()

Variable Documentation

◆ dt_imageio_jpeg_error_mgr