#include <setjmp.h>
#include <stdio.h>
#include "MEM_guardedalloc.h"
#include "BLI_fileops.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_idprop.h"
#include "DNA_ID.h"
#include "IMB_filetype.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "IMB_metadata.h"
#include "imbuf.h"
#include "jerror.h"
#include "jpeglib.h"
#include "IMB_colormanagement.h"
#include "IMB_colormanagement_intern.h"
Go to the source code of this file.
|
| static void | jpeg_error (j_common_ptr cinfo) ATTR_NORETURN |
| |
| static void | init_source (j_decompress_ptr cinfo) |
| |
| static boolean | fill_input_buffer (j_decompress_ptr cinfo) |
| |
| static void | skip_input_data (j_decompress_ptr cinfo, long num_bytes) |
| |
| static void | term_source (j_decompress_ptr cinfo) |
| |
| static void | memory_source (j_decompress_ptr cinfo, const unsigned char *buffer, size_t size) |
| |
| static boolean | handle_app1 (j_decompress_ptr cinfo) |
| |
| static ImBuf * | ibJpegImageFromCinfo (struct jpeg_decompress_struct *cinfo, int flags) |
| |
| bool | imb_is_a_jpeg (const unsigned char *mem, const size_t size) |
| |
| | BLI_STATIC_ASSERT (sizeof(struct NeoGeo_Word)==4, "Must be 4 bytes") |
| |
| ImBuf * | imb_load_jpeg (const unsigned char *buffer, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
| |
| static void | write_jpeg (struct jpeg_compress_struct *cinfo, struct ImBuf *ibuf) |
| |
| static int | init_jpeg (FILE *outfile, struct jpeg_compress_struct *cinfo, struct ImBuf *ibuf) |
| |
| static bool | save_stdjpeg (const char *name, struct ImBuf *ibuf) |
| |
| bool | imb_savejpeg (struct ImBuf *ibuf, const char *filepath, int flags) |
| |
◆ INPUT_2BYTES
| #define INPUT_2BYTES |
( |
|
cinfo, |
|
|
|
V, |
|
|
|
action |
|
) |
| |
Value:
V = ((unsigned int)GETJOCTET(*next_input_byte++)) << 8; \
MAKE_BYTE_AVAIL(cinfo, action); \
bytes_in_buffer--; \
V += GETJOCTET(*next_input_byte++);)
#define MAKE_BYTE_AVAIL(cinfo, action)
Definition at line 221 of file jpeg.c.
◆ INPUT_BYTE
| #define INPUT_BYTE |
( |
|
cinfo, |
|
|
|
V, |
|
|
|
action |
|
) |
| MAKESTMT(MAKE_BYTE_AVAIL(cinfo, action); bytes_in_buffer--; V = GETJOCTET(*next_input_byte++);) |
◆ INPUT_RELOAD
| #define INPUT_RELOAD |
( |
|
cinfo | ) |
(next_input_byte = datasrc->next_input_byte, bytes_in_buffer = datasrc->bytes_in_buffer) |
◆ INPUT_SYNC
| #define INPUT_SYNC |
( |
|
cinfo | ) |
(datasrc->next_input_byte = next_input_byte, datasrc->bytes_in_buffer = bytes_in_buffer) |
◆ INPUT_VARS
| #define INPUT_VARS |
( |
|
cinfo | ) |
|
Value: struct jpeg_source_mgr *datasrc = (cinfo)->src; \
const JOCTET *next_input_byte = datasrc->next_input_byte; \
size_t bytes_in_buffer = datasrc->bytes_in_buffer
Definition at line 186 of file jpeg.c.
◆ MAKE_BYTE_AVAIL
| #define MAKE_BYTE_AVAIL |
( |
|
cinfo, |
|
|
|
action |
|
) |
| |
Value: if (bytes_in_buffer == 0) { \
if (!(*datasrc->fill_input_buffer)(cinfo)) { \
action; \
} \
INPUT_RELOAD(cinfo); \
} \
(void)0
Definition at line 203 of file jpeg.c.
◆ MAKESTMT
| #define MAKESTMT |
( |
|
stuff | ) |
|
Value: do { \
stuff \
} while (0)
Definition at line 181 of file jpeg.c.
◆ my_error_mgr
◆ my_error_ptr
◆ my_src_ptr
◆ BLI_STATIC_ASSERT()
| BLI_STATIC_ASSERT |
( |
sizeof(struct NeoGeo_Word) |
= =4, |
|
|
"Must be 4 bytes" |
|
|
) |
| |
◆ fill_input_buffer()
| static boolean fill_input_buffer |
( |
j_decompress_ptr |
cinfo | ) |
|
|
static |
◆ handle_app1()
| static boolean handle_app1 |
( |
j_decompress_ptr |
cinfo | ) |
|
|
static |
◆ ibJpegImageFromCinfo()
| static ImBuf * ibJpegImageFromCinfo |
( |
struct jpeg_decompress_struct * |
cinfo, |
|
|
int |
flags |
|
) |
| |
|
static |
Definition at line 264 of file jpeg.c.
References BLI_strdupn(), buffer, ImBuf::flags, ImBuf::foptions, ImBuf::ftype, handle_app1(), IB_metadata, IB_rect, IB_test, ibuf_quality, IMB_allocImBuf(), IMB_FTYPE_JPG, IMB_metadata_ensure(), IMB_metadata_set_field(), jpeg_default_quality, MEM_freeN, ImBuf::metadata, MIN2, NULL, ImBuf::ppm, ImbFormatOptions::quality, r, ImBuf::rect, str, STRPREFIX, x, ImBuf::x, y, and ImBuf::y.
Referenced by imb_load_jpeg().
◆ imb_is_a_jpeg()
| bool imb_is_a_jpeg |
( |
const unsigned char * |
mem, |
|
|
const size_t |
size |
|
) |
| |
◆ imb_load_jpeg()
| ImBuf* imb_load_jpeg |
( |
const unsigned char * |
buffer, |
|
|
size_t |
size, |
|
|
int |
flags, |
|
|
char |
colorspace[IM_MAX_SPACE] |
|
) |
| |
Definition at line 437 of file jpeg.c.
References buffer, COLOR_ROLE_DEFAULT_BYTE, colorspace_set_default_role(), ibJpegImageFromCinfo(), IM_MAX_SPACE, imb_is_a_jpeg(), jpeg_error(), memory_source(), NULL, my_error_mgr::pub, my_error_mgr::setjmp_buffer, and size().
◆ imb_savejpeg()
| bool imb_savejpeg |
( |
struct ImBuf * |
ibuf, |
|
|
const char * |
filepath, |
|
|
int |
flags |
|
) |
| |
◆ init_jpeg()
| static int init_jpeg |
( |
FILE * |
outfile, |
|
|
struct jpeg_compress_struct * |
cinfo, |
|
|
struct ImBuf * |
ibuf |
|
) |
| |
|
static |
◆ init_source()
| static void init_source |
( |
j_decompress_ptr |
cinfo | ) |
|
|
static |
◆ jpeg_error()
| static void jpeg_error |
( |
j_common_ptr |
cinfo | ) |
|
|
static |
◆ memory_source()
| static void memory_source |
( |
j_decompress_ptr |
cinfo, |
|
|
const unsigned char * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
static |
◆ save_stdjpeg()
| static bool save_stdjpeg |
( |
const char * |
name, |
|
|
struct ImBuf * |
ibuf |
|
) |
| |
|
static |
◆ skip_input_data()
| static void skip_input_data |
( |
j_decompress_ptr |
cinfo, |
|
|
long |
num_bytes |
|
) |
| |
|
static |
◆ term_source()
| static void term_source |
( |
j_decompress_ptr |
cinfo | ) |
|
|
static |
◆ write_jpeg()
| static void write_jpeg |
( |
struct jpeg_compress_struct * |
cinfo, |
|
|
struct ImBuf * |
ibuf |
|
) |
| |
|
static |
Definition at line 472 of file jpeg.c.
References ARRAY_SIZE, BLI_snprintf(), buffer, IDProperty::data, ListBase::first, ImBuf::foptions, IDPropertyData::group, IDP_String, IDP_STRING, IDProperty::len, MEM_freeN, MEM_mallocN, ImBuf::metadata, IDProperty::name, IDProperty::next, NULL, ImbFormatOptions::quality, NeoGeo_Word::quality, ImBuf::rect, STREQ, IDProperty::type, x, ImBuf::x, y, and ImBuf::y.
Referenced by save_stdjpeg().
◆ ibuf_quality
◆ jpeg_default_quality
| const uchar jpeg_default_quality = 75 |
|
static |