Blender V2.61 - r43446
|
#include <stdio.h>
#include <setjmp.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "imbuf.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "IMB_metadata.h"
#include "IMB_filetype.h"
#include "jpeglib.h"
#include "jerror.h"
Go to the source code of this file.
Classes | |
struct | my_error_mgr |
struct | buffer_struct |
struct | my_source_mgr |
Defines | |
#define | IS_jpg(x) (x->ftype & JPG) |
#define | IS_stdjpg(x) ((x->ftype & JPG_MSK) == JPG_STD) |
#define | IS_vidjpg(x) ((x->ftype & JPG_MSK) == JPG_VID) |
#define | IS_jstjpg(x) ((x->ftype & JPG_MSK) == JPG_JST) |
#define | IS_maxjpg(x) ((x->ftype & JPG_MSK) == JPG_MAX) |
#define | MAKESTMT(stuff) do { stuff } while (0) |
#define | INPUT_VARS(cinfo) |
#define | INPUT_SYNC(cinfo) |
#define | INPUT_RELOAD(cinfo) |
#define | MAKE_BYTE_AVAIL(cinfo, action) |
#define | INPUT_BYTE(cinfo, V, action) |
#define | INPUT_2BYTES(cinfo, V, action) |
Typedefs | |
typedef struct my_error_mgr | my_error_mgr |
typedef my_error_mgr * | my_error_ptr |
typedef my_source_mgr * | my_src_ptr |
Functions | |
static void | jpeg_error (j_common_ptr cinfo) |
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, unsigned char *buffer, size_t size) |
static boolean | handle_app1 (j_decompress_ptr cinfo) |
static ImBuf * | ibJpegImageFromCinfo (struct jpeg_decompress_struct *cinfo, int flags) |
int | imb_is_a_jpeg (unsigned char *mem) |
ImBuf * | imb_load_jpeg (unsigned char *buffer, size_t size, int flags) |
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 int | save_stdjpeg (const char *name, struct ImBuf *ibuf) |
static int | save_vidjpeg (const char *name, struct ImBuf *ibuf) |
static int | save_jstjpeg (const char *name, struct ImBuf *ibuf) |
static int | save_maxjpeg (const char *name, struct ImBuf *ibuf) |
int | imb_savejpeg (struct ImBuf *ibuf, const char *name, int flags) |
Variables | |
static int | jpeg_default_quality |
static int | ibuf_ftype |
Definition in file jpeg.c.
#define INPUT_2BYTES | ( | cinfo, | |
V, | |||
action | |||
) |
MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ bytes_in_buffer--; \ V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \ MAKE_BYTE_AVAIL(cinfo,action); \ bytes_in_buffer--; \ V += GETJOCTET(*next_input_byte++); )
Definition at line 241 of file jpeg.c.
Referenced by handle_app1().
#define INPUT_BYTE | ( | cinfo, | |
V, | |||
action | |||
) |
MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ bytes_in_buffer--; \ V = GETJOCTET(*next_input_byte++); )
Definition at line 233 of file jpeg.c.
Referenced by handle_app1().
#define INPUT_RELOAD | ( | cinfo | ) |
#define INPUT_SYNC | ( | cinfo | ) |
( datasrc->next_input_byte = next_input_byte, \ datasrc->bytes_in_buffer = bytes_in_buffer )
Definition at line 209 of file jpeg.c.
Referenced by handle_app1().
#define INPUT_VARS | ( | cinfo | ) |
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 203 of file jpeg.c.
Referenced by handle_app1().
#define IS_jstjpg | ( | x | ) | ((x->ftype & JPG_MSK) == JPG_JST) |
Definition at line 53 of file jpeg.c.
Referenced by imb_savejpeg().
#define IS_maxjpg | ( | x | ) | ((x->ftype & JPG_MSK) == JPG_MAX) |
Definition at line 54 of file jpeg.c.
Referenced by imb_savejpeg().
#define IS_stdjpg | ( | x | ) | ((x->ftype & JPG_MSK) == JPG_STD) |
Definition at line 51 of file jpeg.c.
Referenced by imb_savejpeg().
#define MAKE_BYTE_AVAIL | ( | cinfo, | |
action | |||
) |
if (bytes_in_buffer == 0) { \ if (! (*datasrc->fill_input_buffer) (cinfo)) \ { action; } \ INPUT_RELOAD(cinfo); \ }
typedef struct my_error_mgr my_error_mgr |
typedef my_error_mgr* my_error_ptr |
typedef my_source_mgr* my_src_ptr |
static boolean fill_input_buffer | ( | j_decompress_ptr | cinfo | ) | [static] |
Definition at line 140 of file jpeg.c.
References my_source_mgr::pub, my_source_mgr::terminal, and TRUE.
Referenced by memory_source().
static boolean handle_app1 | ( | j_decompress_ptr | cinfo | ) | [static] |
Definition at line 251 of file jpeg.c.
References BIG_LONG, FALSE, i, ibuf_ftype, INPUT_2BYTES, INPUT_BYTE, INPUT_SYNC, INPUT_VARS, length(), and TRUE.
Referenced by ibJpegImageFromCinfo().
static ImBuf * ibJpegImageFromCinfo | ( | struct jpeg_decompress_struct * | cinfo, |
int | flags | ||
) | [static] |
Definition at line 274 of file jpeg.c.
References BLI_strdup(), ImBuf::depth, FALSE, ImBuf::flags, ImBuf::ftype, g, handle_app1(), IB_metadata, IB_PROFILE_SRGB, IB_rect, IB_test, ibuf_ftype, IMB_allocImBuf(), IMB_metadata_add_field(), JPG_MAX, JPG_STD, JPG_VID, MEM_freeN(), NULL, ImBuf::profile, ImBuf::rect, str, ImBuf::x, and ImBuf::y.
Referenced by imb_load_jpeg().
int imb_is_a_jpeg | ( | unsigned char * | mem | ) |
Definition at line 83 of file jpeg.c.
Referenced by imb_load_jpeg().
ImBuf* imb_load_jpeg | ( | unsigned char * | buffer, |
size_t | size, | ||
int | flags | ||
) | [read] |
Definition at line 445 of file jpeg.c.
References ibJpegImageFromCinfo(), imb_is_a_jpeg(), jpeg_error(), memory_source(), NULL, my_error_mgr::pub, and my_error_mgr::setjmp_buffer.
int imb_savejpeg | ( | struct ImBuf * | ibuf, |
const char * | name, | ||
int | flags | ||
) |
Definition at line 749 of file jpeg.c.
References ImBuf::flags, IS_jstjpg, IS_maxjpg, IS_stdjpg, save_jstjpeg(), save_maxjpeg(), save_stdjpeg(), and save_vidjpeg().
static int init_jpeg | ( | FILE * | outfile, |
struct jpeg_compress_struct * | cinfo, | ||
struct ImBuf * | ibuf | ||
) | [static] |
Definition at line 559 of file jpeg.c.
References ImBuf::ftype, jpeg_default_quality, ImBuf::planes, TRUE, ImBuf::x, and ImBuf::y.
Referenced by save_maxjpeg(), save_stdjpeg(), and save_vidjpeg().
static void init_source | ( | j_decompress_ptr | cinfo | ) | [static] |
Definition at line 134 of file jpeg.c.
Referenced by memory_source().
static void jpeg_error | ( | j_common_ptr | cinfo | ) | [static] |
Definition at line 101 of file jpeg.c.
References err, and my_error_mgr::setjmp_buffer.
Referenced by imb_load_jpeg(), save_maxjpeg(), save_stdjpeg(), and save_vidjpeg().
static void memory_source | ( | j_decompress_ptr | cinfo, |
unsigned char * | buffer, | ||
size_t | size | ||
) | [static] |
Definition at line 176 of file jpeg.c.
References my_source_mgr::buffer, fill_input_buffer(), init_source(), NULL, my_source_mgr::pub, my_source_mgr::size, skip_input_data(), and term_source().
Referenced by imb_load_jpeg().
static int save_jstjpeg | ( | const char * | name, |
struct ImBuf * | ibuf | ||
) | [static] |
Definition at line 679 of file jpeg.c.
References ImBuf::flags, ImBuf::ftype, IB_rect, IMB_allocImBuf(), IMB_freeImBuf(), IMB_rectcpy(), save_vidjpeg(), ImBuf::x, and ImBuf::y.
Referenced by imb_savejpeg().
static int save_maxjpeg | ( | const char * | name, |
struct ImBuf * | ibuf | ||
) | [static] |
Definition at line 710 of file jpeg.c.
References init_jpeg(), jpeg_default_quality, jpeg_error(), NULL, my_error_mgr::pub, my_error_mgr::setjmp_buffer, and write_jpeg().
Referenced by imb_savejpeg().
static int save_stdjpeg | ( | const char * | name, |
struct ImBuf * | ibuf | ||
) | [static] |
Definition at line 606 of file jpeg.c.
References init_jpeg(), jpeg_default_quality, jpeg_error(), NULL, my_error_mgr::pub, my_error_mgr::setjmp_buffer, and write_jpeg().
Referenced by imb_savejpeg().
static int save_vidjpeg | ( | const char * | name, |
struct ImBuf * | ibuf | ||
) | [static] |
Definition at line 640 of file jpeg.c.
References init_jpeg(), jpeg_default_quality, jpeg_error(), NULL, my_error_mgr::pub, my_error_mgr::setjmp_buffer, and write_jpeg().
Referenced by imb_savejpeg(), and save_jstjpeg().
static void skip_input_data | ( | j_decompress_ptr | cinfo, |
long | num_bytes | ||
) | [static] |
Definition at line 157 of file jpeg.c.
References my_source_mgr::pub.
Referenced by memory_source().
static void term_source | ( | j_decompress_ptr | cinfo | ) | [static] |
Definition at line 171 of file jpeg.c.
Referenced by memory_source().
static void write_jpeg | ( | struct jpeg_compress_struct * | cinfo, |
struct ImBuf * | ibuf | ||
) | [static] |
Definition at line 474 of file jpeg.c.
References BIG_LONG, ImBuf::ftype, ibuf_ftype, ImMetaData::key, MEM_freeN(), MEM_mallocN(), ImBuf::metadata, ImMetaData::next, NULL, ImBuf::rect, strlen(), TRUE, ImMetaData::value, ImBuf::x, and ImBuf::y.
Referenced by save_maxjpeg(), save_stdjpeg(), and save_vidjpeg().
int ibuf_ftype [static] |
Definition at line 81 of file jpeg.c.
Referenced by handle_app1(), ibJpegImageFromCinfo(), and write_jpeg().
int jpeg_default_quality [static] |
Definition at line 80 of file jpeg.c.
Referenced by init_jpeg(), save_maxjpeg(), save_stdjpeg(), and save_vidjpeg().