Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
webp.c File Reference
#include "bauhaus/bauhaus.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 <stdio.h>
#include <stdlib.h>
#include <webp/encode.h>
#include <webp/mux.h>
+ Include dependency graph for webp.c:

Data Structures

struct  dt_imageio_webp_t
 
struct  dt_imageio_webp_gui_data_t
 

Macros

#define _stringify(a)   #a
 
#define stringify(a)   _stringify(a)
 

Typedefs

typedef struct dt_imageio_webp_t dt_imageio_webp_t
 
typedef struct dt_imageio_webp_gui_data_t dt_imageio_webp_gui_data_t
 

Enumerations

enum  comp_type_t {
  webp_lossy = 0 ,
  webp_lossless = 1
}
 
enum  hint_t {
  hint_default ,
  hint_picture ,
  hint_photo ,
  hint_graphic
}
 

Functions

const char * get_error_str (int err)
 
void init (dt_imageio_module_format_t *self)
 
void cleanup (dt_imageio_module_format_t *self)
 
int write_image (dt_imageio_module_data_t *webp, 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)
 
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)
 
int set_params (dt_imageio_module_format_t *self, const void *params, const int size)
 
void free_params (dt_imageio_module_format_t *self, dt_imageio_module_data_t *params)
 
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)
 
const char * name ()
 
static void compression_changed (GtkWidget *widget, gpointer user_data)
 
static void quality_changed (GtkWidget *slider, gpointer user_data)
 
static void hint_combobox_changed (GtkWidget *widget, 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)
 
int flags (dt_imageio_module_data_t *data)
 

Variables

static const char *const EncoderError []
 

Macro Definition Documentation

◆ _stringify

#define _stringify (   a)    #a

◆ stringify

#define stringify (   a)    _stringify(a)

Typedef Documentation

◆ dt_imageio_webp_gui_data_t

◆ dt_imageio_webp_t

Enumeration Type Documentation

◆ comp_type_t

Enumerator
webp_lossy 
webp_lossless 

◆ hint_t

enum hint_t
Enumerator
hint_default 
hint_picture 
hint_photo 
hint_graphic 

Function Documentation

◆ bpp()

int bpp ( dt_imageio_module_data_t p)

◆ cleanup()

void cleanup ( dt_imageio_module_format_t self)

◆ compression_changed()

static void compression_changed ( GtkWidget *  widget,
gpointer  user_data 
)
static

◆ extension()

const char * extension ( dt_imageio_module_data_t data)

◆ flags()

int flags ( dt_imageio_module_data_t data)
Todo:
(jinxos): support embedded ICC

References FORMAT_FLAGS_SUPPORT_XMP.

◆ free_params()

void free_params ( dt_imageio_module_format_t self,
dt_imageio_module_data_t params 
)

◆ get_error_str()

const char * get_error_str ( int  err)

References EncoderError.

Referenced by write_image().

◆ get_params()

◆ gui_cleanup()

◆ gui_init()

◆ gui_reset()

◆ hint_combobox_changed()

static void hint_combobox_changed ( GtkWidget *  widget,
gpointer  user_data 
)
static

References dt_bauhaus_combobox_get(), and dt_conf_set_int().

Referenced by gui_init().

◆ init()

◆ legacy_params()

◆ levels()

int levels ( dt_imageio_module_data_t p)

References IMAGEIO_INT8, and IMAGEIO_RGB.

◆ mime()

const char * mime ( dt_imageio_module_data_t data)
Todo:
: revisit this when IANA makes it official.

◆ name()

const char * name ( )

◆ params_size()

size_t params_size ( dt_imageio_module_format_t self)

◆ quality_changed()

static void quality_changed ( GtkWidget *  slider,
gpointer  user_data 
)
static

References dt_bauhaus_slider_get(), and dt_conf_set_int().

Referenced by gui_init().

◆ set_params()

◆ write_image()

int write_image ( dt_imageio_module_data_t webp,
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 
)

Variable Documentation

◆ EncoderError

const char* const EncoderError[]
static
Initial value:
= {
"ok",
"out_of_memory: out of memory allocating objects",
"bitstream_out_of_memory: out of memory re-allocating byte buffer",
"null_parameter: null parameter passed to function",
"invalid_configuration: configuration is invalid",
"bad_dimension: bad picture dimension. maximum width and height "
"allowed is " "WEBP_MAX_DIMENSION" " pixels.",
"partition0_overflow: partition #0 is too big to fit 512k.\n"
"to reduce the size of this partition, try using less segments "
"with the -segments option, and eventually reduce the number of "
"header bits using -partition_limit. more details are available "
"in the manual (`man cwebp`)",
"partition_overflow: partition is too big to fit 16M",
"bad_write: picture writer returned an i/o error",
"file_too_big: file would be too big to fit in 4G",
"user_abort: encoding abort requested by user"
}

Referenced by get_error_str().