|
Blender V4.3
|
#include "MEM_guardedalloc.h"#include "BLI_fileops.h"#include "IMB_colormanagement.hh"#include "IMB_filetype.hh"#include "IMB_imbuf.hh"#include "IMB_imbuf_types.hh"#include "openjpeg.h"#include <cstring>Go to the source code of this file.
Classes | |
| struct | img_fol_t |
| struct | BufInfo |
Macros | |
| #define | JP2_FILEHEADER_SIZE 12 |
| #define | PIXEL_LOOPER_BEGIN(_rect) |
| #define | PIXEL_LOOPER_BEGIN_CHANNELS(_rect, _channels) |
| #define | PIXEL_LOOPER_END |
| #define | CINEMA_24_CS 1302083 /* Code-stream length for 24fps. */ |
| #define | CINEMA_48_CS 651041 /* Code-stream length for 48fps. */ |
| #define | COMP_24_CS 1041666 /* Maximum size per color component for 2K & 4K @ 24fps. */ |
| #define | COMP_48_CS 520833 /* Maximum size per color component for 2K @ 48fps. */ |
Functions | |
| static bool | check_jp2 (const uchar *mem, const size_t size) |
| static bool | check_j2k (const uchar *mem, const size_t size) |
| static OPJ_CODEC_FORMAT | format_from_header (const uchar mem[JP2_FILEHEADER_SIZE], const size_t size) |
| bool | imb_is_a_jp2 (const uchar *buf, size_t size) |
| static void | error_callback (const char *msg, void *client_data) |
| static void | warning_callback (const char *msg, void *client_data) |
| static void | info_callback (const char *msg, void *client_data) |
| static ImBuf * | imb_load_jp2_stream (opj_stream_t *stream, OPJ_CODEC_FORMAT p_format, int flags, char colorspace[IM_MAX_SPACE]) |
| ImBuf * | imb_load_jp2 (const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) |
| ImBuf * | imb_load_jp2_filepath (const char *filepath, int flags, char colorspace[IM_MAX_SPACE]) |
| BLI_INLINE int | UPSAMPLE_8_TO_12 (const uchar _val) |
| BLI_INLINE int | UPSAMPLE_8_TO_16 (const uchar _val) |
| BLI_INLINE int | DOWNSAMPLE_FLOAT_TO_8BIT (const float _val) |
| BLI_INLINE int | DOWNSAMPLE_FLOAT_TO_12BIT (const float _val) |
| BLI_INLINE int | DOWNSAMPLE_FLOAT_TO_16BIT (const float _val) |
| static int | init_4K_poc (opj_poc_t *POC, int numres) |
| static void | cinema_parameters (opj_cparameters_t *parameters) |
| static void | cinema_setup_encoder (opj_cparameters_t *parameters, opj_image_t *image, img_fol_t *img_fol) |
| static float | channel_colormanage_noop (float value) |
| static opj_image_t * | ibuftoimage (ImBuf *ibuf, opj_cparameters_t *parameters) |
| bool | imb_save_jp2_stream (ImBuf *ibuf, opj_stream_t *stream, int flags) |
| bool | imb_save_jp2 (ImBuf *ibuf, const char *filepath, int flags) |
Buffer Stream | |
| static void | opj_read_from_buffer_free (void *) |
| static OPJ_SIZE_T | opj_read_from_buffer (void *p_buffer, OPJ_SIZE_T p_nb_bytes, void *p_user_data) |
| static OPJ_OFF_T | opj_skip_from_buffer (OPJ_OFF_T p_nb_bytes, void *p_user_data) |
| static OPJ_BOOL | opj_seek_from_buffer (OPJ_OFF_T p_nb_bytes, void *p_user_data) |
| static opj_stream_t * | opj_stream_create_from_buffer (BufInfo *p_file, OPJ_UINT32 p_size, OPJ_BOOL p_is_read_stream) |
File Stream | |
| static void | opj_free_from_file (void *p_user_data) |
| static OPJ_UINT64 | opj_get_data_length_from_file (void *p_user_data) |
| static OPJ_SIZE_T | opj_read_from_file (void *p_buffer, OPJ_SIZE_T p_nb_bytes, void *p_user_data) |
| static OPJ_SIZE_T | opj_write_from_file (void *p_buffer, OPJ_SIZE_T p_nb_bytes, void *p_user_data) |
| static OPJ_OFF_T | opj_skip_from_file (OPJ_OFF_T p_nb_bytes, void *p_user_data) |
| static OPJ_BOOL | opj_seek_from_file (OPJ_OFF_T p_nb_bytes, void *p_user_data) |
| static opj_stream_t * | opj_stream_create_from_file (const char *filepath, OPJ_UINT32 p_size, OPJ_BOOL p_is_read_stream, FILE **r_file) |
Variables | |
| static const char | JP2_HEAD [] |
| static const char | J2K_HEAD [] = {0xFF, 0x4F, 0xFF, 0x51, 0x00} |
| #define CINEMA_24_CS 1302083 /* Code-stream length for 24fps. */ |
Definition at line 629 of file jp2.cc.
Referenced by cinema_setup_encoder().
| #define CINEMA_48_CS 651041 /* Code-stream length for 48fps. */ |
Definition at line 630 of file jp2.cc.
Referenced by cinema_setup_encoder().
Definition at line 631 of file jp2.cc.
Referenced by cinema_setup_encoder().
Definition at line 632 of file jp2.cc.
Referenced by cinema_setup_encoder().
| #define JP2_FILEHEADER_SIZE 12 |
Definition at line 22 of file jp2.cc.
Referenced by imb_load_jp2(), and imb_load_jp2_filepath().
| #define PIXEL_LOOPER_BEGIN | ( | _rect | ) |
Definition at line 104 of file jp2.cc.
Referenced by ibuftoimage(), and imb_load_jp2_stream().
| #define PIXEL_LOOPER_BEGIN_CHANNELS | ( | _rect, | |
| _channels ) |
| #define PIXEL_LOOPER_END |
Definition at line 112 of file jp2.cc.
Referenced by ibuftoimage(), and imb_load_jp2_stream().
Definition at line 800 of file jp2.cc.
Referenced by ibuftoimage().
|
static |
Definition at line 51 of file jp2.cc.
References false, and J2K_HEAD.
Referenced by format_from_header(), and imb_is_a_jp2().
|
static |
Definition at line 43 of file jp2.cc.
References false, and JP2_HEAD.
Referenced by format_from_header(), and imb_is_a_jp2().
|
static |
|
static |
Definition at line 687 of file jp2.cc.
References CINEMA_24_CS, CINEMA_48_CS, COMP_24_CS, COMP_48_CS, float, init_4K_poc(), parameters, and img_fol_t::rates.
Referenced by ibuftoimage().
| BLI_INLINE int DOWNSAMPLE_FLOAT_TO_12BIT | ( | const float | _val | ) |
| BLI_INLINE int DOWNSAMPLE_FLOAT_TO_16BIT | ( | const float | _val | ) |
| BLI_INLINE int DOWNSAMPLE_FLOAT_TO_8BIT | ( | const float | _val | ) |
|
static |
|
static |
Definition at line 59 of file jp2.cc.
References check_j2k(), and check_jp2().
Referenced by imb_load_jp2(), and imb_load_jp2_filepath().
|
static |
Definition at line 805 of file jp2.cc.
References b, ImBuf::byte_buffer, channel_colormanage_noop(), ImBuf::channels, cinema_parameters(), cinema_setup_encoder(), ImBuf::colormanage_flag, ImBufFloatBuffer::colorspace, ImBufByteBuffer::data, ImBufFloatBuffer::data, DOWNSAMPLE_FLOAT_TO_12BIT(), DOWNSAMPLE_FLOAT_TO_16BIT(), DOWNSAMPLE_FLOAT_TO_8BIT(), ImbFormatOptions::flag, float, ImBuf::float_buffer, ImBuf::foptions, image(), IMB_COLORMANAGE_IS_DATA, linearrgb_to_srgb(), MEM_freeN(), MEM_mallocN, parameters, PIXEL_LOOPER_BEGIN, PIXEL_LOOPER_BEGIN_CHANNELS, PIXEL_LOOPER_END, ImBuf::planes, premul_to_straight_v4_v4(), printf, img_fol_t::rates, UPSAMPLE_8_TO_12(), UPSAMPLE_8_TO_16(), w(), ImBuf::x, ImBuf::y, and y.
Referenced by imb_save_jp2_stream().
| bool imb_is_a_jp2 | ( | const uchar * | buf, |
| size_t | size ) |
Definition at line 71 of file jp2.cc.
References check_j2k(), and check_jp2().
Definition at line 302 of file jp2.cc.
References BufInfo::buf, BufInfo::cur, format_from_header(), imb_load_jp2_stream(), JP2_FILEHEADER_SIZE, BufInfo::len, and opj_stream_create_from_buffer().
Definition at line 317 of file jp2.cc.
References format_from_header(), imb_load_jp2_stream(), JP2_FILEHEADER_SIZE, and opj_stream_create_from_file().
|
static |
Definition at line 340 of file jp2.cc.
References b, ImBuf::byte_buffer, COLOR_ROLE_DEFAULT_BYTE, colorspace_set_default_role(), ImBufByteBuffer::data, ImBufFloatBuffer::data, error_callback, ImbFormatOptions::flag, float, ImBuf::float_buffer, ImBuf::foptions, ImBuf::ftype, IB_rect, IB_rectfloat, IM_MAX_SPACE, IMB_allocImBuf(), IMB_rect_from_float(), info_callback(), parameters, PIXEL_LOOPER_BEGIN, PIXEL_LOOPER_END, printf, w(), warning_callback(), and y.
Referenced by imb_load_jp2(), and imb_load_jp2_filepath().
Definition at line 1183 of file jp2.cc.
References imb_save_jp2_stream(), and opj_stream_create_from_file().
Definition at line 1196 of file jp2.cc.
References error_callback, ImbFormatOptions::flag, ImBuf::foptions, ibuftoimage(), info_callback(), parameters, ImbFormatOptions::quality, and warning_callback().
Referenced by imb_save_jp2().
|
static |
sample debug callback expecting no client object
Definition at line 97 of file jp2.cc.
Referenced by imb_load_jp2_stream(), and imb_save_jp2_stream().
Definition at line 634 of file jp2.cc.
Referenced by cinema_setup_encoder().
|
static |
Definition at line 212 of file jp2.cc.
Referenced by opj_stream_create_from_file().
|
static |
Definition at line 218 of file jp2.cc.
Referenced by opj_stream_create_from_file().
|
static |
Definition at line 132 of file jp2.cc.
References BufInfo::buf, BufInfo::cur, and BufInfo::len.
Referenced by opj_stream_create_from_buffer().
|
static |
Definition at line 127 of file jp2.cc.
Referenced by opj_stream_create_from_buffer().
|
static |
Definition at line 230 of file jp2.cc.
Referenced by opj_stream_create_from_file().
|
static |
Definition at line 171 of file jp2.cc.
References BufInfo::buf, BufInfo::cur, BufInfo::len, and len.
Referenced by opj_stream_create_from_buffer().
|
static |
Definition at line 252 of file jp2.cc.
Referenced by opj_stream_create_from_file().
|
static |
Definition at line 160 of file jp2.cc.
References BufInfo::buf, BufInfo::cur, and BufInfo::len.
Referenced by opj_stream_create_from_buffer().
|
static |
Definition at line 243 of file jp2.cc.
Referenced by opj_stream_create_from_file().
|
static |
Stream wrapper for memory buffer (would be nice if this was supported by the API).
Definition at line 186 of file jp2.cc.
References BufInfo::len, opj_read_from_buffer(), opj_read_from_buffer_free(), opj_seek_from_buffer(), and opj_skip_from_buffer().
Referenced by imb_load_jp2().
|
static |
Stream wrapper for memory file (would be nice if this was supported by the API).
Definition at line 266 of file jp2.cc.
References BLI_fopen(), opj_free_from_file(), opj_get_data_length_from_file(), opj_read_from_file(), opj_seek_from_file(), opj_skip_from_file(), and opj_write_from_file().
Referenced by imb_load_jp2_filepath(), and imb_save_jp2().
|
static |
Definition at line 237 of file jp2.cc.
Referenced by opj_stream_create_from_file().
| BLI_INLINE int UPSAMPLE_8_TO_12 | ( | const uchar | _val | ) |
Definition at line 595 of file jp2.cc.
Referenced by ibuftoimage().
| BLI_INLINE int UPSAMPLE_8_TO_16 | ( | const uchar | _val | ) |
Definition at line 599 of file jp2.cc.
Referenced by ibuftoimage().
|
static |
sample warning callback expecting a FILE* client object
Definition at line 87 of file jp2.cc.
Referenced by imb_load_jp2_stream(), and imb_save_jp2_stream().
|
static |
Definition at line 26 of file jp2.cc.
Referenced by check_j2k().
|
static |
Definition at line 24 of file jp2.cc.
Referenced by check_jp2().