Blender V5.3
format_jp2.cc File Reference
#include "MEM_guardedalloc.h"
#include "BLI_array.hh"
#include "BLI_fileops.hh"
#include "BLI_threads.hh"
#include "IMB_colormanagement.hh"
#include "IMB_filetype.hh"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "CLG_log.h"
#include "openjpeg.h"
#include <algorithm>
#include <cstring>

Go to the source code of this file.

Classes

struct  blender::img_fol_t
struct  blender::BufInfo

Namespaces

namespace  blender
 BMesh Iterators.

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
#define CINEMA_48_CS   651041
#define COMP_24_CS   1041666
#define COMP_48_CS   520833

Functions

static bool blender::check_jp2 (const uchar *mem, const size_t size)
static bool blender::check_j2k (const uchar *mem, const size_t size)
static OPJ_CODEC_FORMAT blender::format_from_header (const uchar mem[JP2_FILEHEADER_SIZE], const size_t size)
static void blender::error_callback (const char *msg, void *)
static void blender::warning_callback (const char *msg, void *)
static void blender::info_callback (const char *msg, void *)
static const int * blender::jp2_component_at_size (const opj_image_comp_t &comp, const uint w, const uint h, Array< int > &r_buffer)
static ImBuf * blender::imb_load_jp2_stream (opj_stream_t *stream, OPJ_CODEC_FORMAT p_format, ImBufFlags flags, ImFileColorSpace &r_colorspace)
BLI_INLINE int blender::UPSAMPLE_8_TO_12 (const uchar _val)
BLI_INLINE int blender::UPSAMPLE_8_TO_16 (const uchar _val)
BLI_INLINE int blender::DOWNSAMPLE_FLOAT_TO_8BIT (const float _val)
BLI_INLINE int blender::DOWNSAMPLE_FLOAT_TO_12BIT (const float _val)
BLI_INLINE int blender::DOWNSAMPLE_FLOAT_TO_16BIT (const float _val)
static int blender::init_4K_poc (opj_poc_t *POC, int numres)
static void blender::cinema_parameters (opj_cparameters_t *parameters)
static void blender::cinema_setup_encoder (opj_cparameters_t *parameters, opj_image_t *image, img_fol_t *img_fol)
static float blender::channel_colormanage_noop (float value)
static opj_image_t * blender::ibuftoimage (ImBuf *ibuf, opj_cparameters_t *parameters)
bool blender::imb_save_jp2_stream (ImBuf *ibuf, opj_stream_t *stream, ImBufFlags flags)
Buffer Stream
static void blender::opj_read_from_buffer_free (void *)
static OPJ_SIZE_T blender::opj_read_from_buffer (void *p_buffer, OPJ_SIZE_T p_nb_bytes, void *p_user_data)
static OPJ_OFF_T blender::opj_skip_from_buffer (OPJ_OFF_T p_nb_bytes, void *p_user_data)
static OPJ_BOOL blender::opj_seek_from_buffer (OPJ_OFF_T p_nb_bytes, void *p_user_data)
static opj_stream_t * blender::opj_stream_create_from_buffer (BufInfo *p_file, OPJ_UINT32 p_size, OPJ_BOOL p_is_read_stream)
File Stream
static void blender::opj_free_from_file (void *p_user_data)
static OPJ_UINT64 blender::opj_get_data_length_from_file (void *p_user_data)
static OPJ_SIZE_T blender::opj_read_from_file (void *p_buffer, OPJ_SIZE_T p_nb_bytes, void *p_user_data)
static OPJ_SIZE_T blender::opj_write_from_file (void *p_buffer, OPJ_SIZE_T p_nb_bytes, void *p_user_data)
static OPJ_OFF_T blender::opj_skip_from_file (OPJ_OFF_T p_nb_bytes, void *p_user_data)
static OPJ_BOOL blender::opj_seek_from_file (OPJ_OFF_T p_nb_bytes, void *p_user_data)
static opj_stream_t * blender::opj_stream_create_from_file (const char *filepath, OPJ_UINT32 p_size, OPJ_BOOL p_is_read_stream, FILE **r_file)

Variables

static CLG_LogRef blender::LOG = {"image.openjpeg"}
static const char blender::JP2_HEAD []
static const char blender::J2K_HEAD [] = {0xFF, 0x4F, 0xFF, 0x51, 0x00}

Format: JP2 (#IMB_FTYPE_JP2)

const char * blender::imb_file_extensions_jp2 [] = {".jp2", ".j2c", nullptr}
bool blender::imb_is_a_jp2 (const uchar *buf, size_t size)
ImBuf * blender::imb_load_jp2 (const uchar *mem, size_t size, ImBufFlags flags, ImFileColorSpace &r_colorspace)
bool blender::imb_save_jp2 (ImBuf *ibuf, const char *filepath, ImBufFlags flags)

Macro Definition Documentation

◆ CINEMA_24_CS

#define CINEMA_24_CS   1302083

Definition at line 663 of file format_jp2.cc.

Referenced by blender::cinema_setup_encoder().

◆ CINEMA_48_CS

#define CINEMA_48_CS   651041

Definition at line 664 of file format_jp2.cc.

Referenced by blender::cinema_setup_encoder().

◆ COMP_24_CS

#define COMP_24_CS   1041666

Definition at line 665 of file format_jp2.cc.

Referenced by blender::cinema_setup_encoder().

◆ COMP_48_CS

#define COMP_48_CS   520833

Definition at line 666 of file format_jp2.cc.

Referenced by blender::cinema_setup_encoder().

◆ JP2_FILEHEADER_SIZE

#define JP2_FILEHEADER_SIZE   12

Definition at line 33 of file format_jp2.cc.

Referenced by blender::format_from_header(), and blender::imb_load_jp2().

◆ PIXEL_LOOPER_BEGIN

#define PIXEL_LOOPER_BEGIN ( _rect)
Value:
for (y = h - 1; y != uint(-1); y--) { \
for (i = y * w, i_next = (y + 1) * w; i < i_next; i++, _rect += 4) {
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119

Definition at line 112 of file format_jp2.cc.

Referenced by blender::ibuftoimage(), and blender::imb_load_jp2_stream().

◆ PIXEL_LOOPER_BEGIN_CHANNELS

#define PIXEL_LOOPER_BEGIN_CHANNELS ( _rect,
_channels )
Value:
for (y = h - 1; y != uint(-1); y--) { \
for (i = y * w, i_next = (y + 1) * w; i < i_next; i++, _rect += _channels) {

Definition at line 116 of file format_jp2.cc.

Referenced by blender::ibuftoimage().

◆ PIXEL_LOOPER_END

#define PIXEL_LOOPER_END
Value:
} \
} \
(void)0

Definition at line 120 of file format_jp2.cc.

Referenced by blender::ibuftoimage(), and blender::imb_load_jp2_stream().