Ansel 0.0
A darktable fork - bloat + design vision
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
imageio_jpeg.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2009-2020 darktable developers.
4
5 darktable is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 darktable is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with darktable. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#include <inttypes.h>
22#include <stdio.h>
23#include <stdlib.h>
24// this fixes a rather annoying, long time bug in libjpeg :(
25#undef HAVE_STDLIB_H
26#undef HAVE_STDDEF_H
27#include <jpeglib.h>
28#undef HAVE_STDLIB_H
29#undef HAVE_STDDEF_H
30
31#include "common/colorspaces.h"
32#include "common/image.h"
33#include "common/mipmap_cache.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39typedef struct dt_imageio_jpeg_t
40{
42 struct jpeg_source_mgr src;
43 struct jpeg_destination_mgr dest;
44 struct jpeg_decompress_struct dinfo;
45 struct jpeg_compress_struct cinfo;
46 FILE *f;
48
50int dt_imageio_jpeg_decompress_header(const void *in, size_t length, dt_imageio_jpeg_t *jpg);
52int dt_imageio_jpeg_decompress(dt_imageio_jpeg_t *jpg, uint8_t *out);
55int dt_imageio_jpeg_compress(const uint8_t *in, uint8_t *out, const int width, const int height,
56 const int quality);
57
59int dt_imageio_jpeg_write(const char *filename, const uint8_t *in, const int width, const int height,
60 const int quality, const void *exif, int exif_len);
62int dt_imageio_jpeg_write_with_icc_profile(const char *filename, const uint8_t *in, const int width,
63 const int height, const int quality, const void *exif, int exif_len,
64 int32_t imgid);
66int dt_imageio_jpeg_read_header(const char *filename, dt_imageio_jpeg_t *jpg);
68int dt_imageio_jpeg_read(dt_imageio_jpeg_t *jpg, uint8_t *out);
70int dt_imageio_jpeg_read_profile(dt_imageio_jpeg_t *jpg, uint8_t **out);
73
76
77#ifdef __cplusplus
78}
79#endif
80
81// clang-format off
82// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
83// vim: shiftwidth=2 expandtab tabstop=2 cindent
84// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
85// clang-format on
int width
Definition bilateral.h:1
int height
Definition bilateral.h:1
dt_colorspaces_color_profile_type_t
Definition colorspaces.h:61
dt_imageio_retval_t
Definition common/image.h:37
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)
Definition imageio_jpeg.c:498
int dt_imageio_jpeg_read_profile(dt_imageio_jpeg_t *jpg, uint8_t **out)
Definition imageio_jpeg.c:710
struct dt_imageio_jpeg_t dt_imageio_jpeg_t
int dt_imageio_jpeg_read(dt_imageio_jpeg_t *jpg, uint8_t *out)
Definition imageio_jpeg.c:640
int dt_imageio_jpeg_read_header(const char *filename, dt_imageio_jpeg_t *jpg)
Definition imageio_jpeg.c:570
dt_imageio_retval_t dt_imageio_open_jpeg(dt_image_t *img, const char *filename, dt_mipmap_buffer_t *buf)
Definition imageio_jpeg.c:730
dt_colorspaces_color_profile_type_t dt_imageio_jpeg_read_color_space(dt_imageio_jpeg_t *jpg)
Definition imageio_jpeg.c:719
int dt_imageio_jpeg_decompress_header(const void *in, size_t length, dt_imageio_jpeg_t *jpg)
Definition imageio_jpeg.c:122
int dt_imageio_jpeg_compress(const uint8_t *in, uint8_t *out, const int width, const int height, const int quality)
Definition imageio_jpeg.c:267
int dt_imageio_jpeg_decompress(dt_imageio_jpeg_t *jpg, uint8_t *out)
Definition imageio_jpeg.c:199
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)
Definition imageio_jpeg.c:564
Definition common/image.h:195
Definition imageio_jpeg.h:40
FILE * f
Definition imageio_jpeg.h:46
struct jpeg_decompress_struct dinfo
Definition imageio_jpeg.h:44
int height
Definition imageio_jpeg.h:41
struct jpeg_compress_struct cinfo
Definition imageio_jpeg.h:45
int width
Definition imageio_jpeg.h:41
struct jpeg_source_mgr src
Definition imageio_jpeg.h:42
struct jpeg_destination_mgr dest
Definition imageio_jpeg.h:43
Definition mipmap_cache.h:58