21 #define JP2_FILEHEADER_SIZE 12
24 0x0, 0x0, 0x0, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A};
25 static const char J2K_HEAD[] = {0xFF, 0x4F, 0xFF, 0x51, 0x00};
68 return OPJ_CODEC_UNKNOWN;
81 FILE *stream = (FILE *)client_data;
82 fprintf(stream,
"[ERROR] %s", msg);
89 FILE *stream = (FILE *)client_data;
90 fprintf(stream,
"[WARNING] %s", msg);
97 static void info_callback(
const char *msg,
void *client_data)
99 FILE *stream = (FILE *)client_data;
100 fprintf(stream,
"[INFO] %s", msg);
104 #define PIXEL_LOOPER_BEGIN(_rect) \
105 for (y = h - 1; y != (unsigned int)(-1); y--) { \
106 for (i = y * w, i_next = (y + 1) * w; i < i_next; i++, _rect += 4) {
108 #define PIXEL_LOOPER_BEGIN_CHANNELS(_rect, _channels) \
109 for (y = h - 1; y != (unsigned int)(-1); y--) { \
110 for (i = y * w, i_next = (y + 1) * w; i < i_next; i++, _rect += _channels) {
112 #define PIXEL_LOOPER_END \
134 struct BufInfo *p_file = p_user_data;
135 OPJ_UINT32 l_nb_read;
137 if (p_file->
cur + p_nb_bytes < p_file->
buf + p_file->
len) {
138 l_nb_read = p_nb_bytes;
141 l_nb_read = (OPJ_UINT32)(p_file->
buf + p_file->
len - p_file->
cur);
143 memcpy(p_buffer, p_file->
cur, l_nb_read);
144 p_file->
cur += l_nb_read;
146 return l_nb_read ? l_nb_read : ((OPJ_SIZE_T)-1);
150 static OPJ_SIZE_T opj_write_from_buffer(
void *p_buffer, OPJ_SIZE_T p_nb_bytes,
void *p_user_data)
152 struct BufInfo *p_file = p_user_data;
153 memcpy(p_file->
cur, p_buffer, p_nb_bytes);
154 p_file->
cur += p_nb_bytes;
155 p_file->
len += p_nb_bytes;
162 struct BufInfo *p_file = p_user_data;
163 if (p_file->
cur + p_nb_bytes < p_file->
buf + p_file->
len) {
164 p_file->
cur += p_nb_bytes;
168 return (OPJ_OFF_T)-1;
173 struct BufInfo *p_file = p_user_data;
174 if (p_nb_bytes < p_file->
len) {
175 p_file->
cur = p_file->
buf + p_nb_bytes;
189 OPJ_BOOL p_is_read_stream)
191 opj_stream_t *l_stream = opj_stream_create(p_size, p_is_read_stream);
192 if (l_stream ==
NULL) {
196 opj_stream_set_user_data_length(l_stream, p_file->
len);
199 opj_stream_set_write_function(l_stream, opj_write_from_buffer);
215 FILE *f = p_user_data;
221 FILE *p_file = p_user_data;
222 OPJ_OFF_T file_length = 0;
224 fseek(p_file, 0, SEEK_END);
225 file_length = ftell(p_file);
226 fseek(p_file, 0, SEEK_SET);
228 return (OPJ_UINT64)file_length;
233 FILE *p_file = p_user_data;
234 OPJ_SIZE_T l_nb_read = fread(p_buffer, 1, p_nb_bytes, p_file);
235 return l_nb_read ? l_nb_read : (OPJ_SIZE_T)-1;
240 FILE *p_file = p_user_data;
241 return fwrite(p_buffer, 1, p_nb_bytes, p_file);
246 FILE *p_file = p_user_data;
247 if (fseek(p_file, p_nb_bytes, SEEK_CUR)) {
255 FILE *p_file = p_user_data;
256 if (fseek(p_file, p_nb_bytes, SEEK_SET)) {
269 OPJ_BOOL p_is_read_stream,
272 FILE *p_file =
BLI_fopen(filepath, p_is_read_stream ?
"rb" :
"wb");
273 if (p_file ==
NULL) {
277 opj_stream_t *l_stream = opj_stream_create(p_size, p_is_read_stream);
278 if (l_stream ==
NULL) {
299 OPJ_CODEC_FORMAT p_format,
316 &buf_wrapper, OPJ_J2K_STREAM_CHUNK_SIZE,
true);
318 opj_stream_destroy(stream);
327 filepath, OPJ_J2K_STREAM_CHUNK_SIZE,
true, &p_file);
332 if (fread(mem,
sizeof(mem), 1, p_file) !=
sizeof(mem)) {
333 opj_stream_destroy(stream);
337 fseek(p_file, 0, SEEK_SET);
341 opj_stream_destroy(stream);
346 const OPJ_CODEC_FORMAT
format,
350 if (
format == OPJ_CODEC_UNKNOWN) {
355 bool use_float =
false;
356 bool use_alpha =
false;
358 long signed_offsets[4] = {0, 0, 0, 0};
359 int float_divs[4] = {1, 1, 1, 1};
361 unsigned int i, i_next,
w, h,
planes;
368 opj_codec_t *codec =
NULL;
374 opj_set_default_decoder_parameters(&
parameters);
379 codec = opj_create_decompress(
format);
385 opj_set_info_handler(codec, info_callback, stderr);
389 if (opj_setup_decoder(codec, &
parameters) ==
false) {
393 if (opj_read_header(stream, codec, &
image) ==
false) {
394 printf(
"OpenJPEG error: failed to read the header\n");
399 if (opj_decode(codec, stream,
image) ==
false) {
400 fprintf(stderr,
"ERROR -> j2k_to_image: failed to decode image!\n");
405 fprintf(stderr,
"\nError: invalid raw image parameters\n");
410 h =
image->comps[0].h;
412 switch (
image->numcomps) {
432 if (
image->comps[i].prec > 8) {
436 if (
image->comps[i].sgnd) {
437 signed_offsets[i] = 1 << (
image->comps[i].prec - 1);
441 float_divs[i] = (1 <<
image->comps[i].prec) - 1;
450 ibuf->
ftype = IMB_FTYPE_JP2;
461 if (
image->numcomps < 3) {
463 a = (use_alpha) ?
image->comps[1].data :
NULL;
471 rect_float[3] = (
a[i] + signed_offsets[1]) / float_divs[1];
512 unsigned char *rect_uchar = (
unsigned char *)ibuf->
rect;
516 a = (use_alpha) ?
image->comps[1].data :
NULL;
522 rect_uchar[0] = rect_uchar[1] = rect_uchar[2] = (
r[i] + signed_offsets[0]);
523 rect_uchar[3] =
a[i] + signed_offsets[1];
529 rect_uchar[0] = rect_uchar[1] = rect_uchar[2] = (
r[i] + signed_offsets[0]);
544 rect_uchar[0] =
r[i] + signed_offsets[0];
545 rect_uchar[1] =
g[i] + signed_offsets[1];
546 rect_uchar[2] =
b[i] + signed_offsets[2];
547 rect_uchar[3] =
a[i] + signed_offsets[3];
553 rect_uchar[0] =
r[i] + signed_offsets[0];
554 rect_uchar[1] =
g[i] + signed_offsets[1];
555 rect_uchar[2] =
b[i] + signed_offsets[2];
571 opj_destroy_codec(codec);
575 opj_image_destroy(
image);
582 static opj_image_t *rawtoimage(
const char *filename,
584 raw_cparameters_t *raw_cp)
591 # define UPSAMPLE_8_TO_12(_val) ((_val << 4) | (_val & ((1 << 4) - 1)))
592 # define UPSAMPLE_8_TO_16(_val) ((_val << 8) + _val)
594 # define DOWNSAMPLE_FLOAT_TO_8BIT(_val) \
595 (_val) <= 0.0f ? 0 : ((_val) >= 1.0f ? 255 : (int)(255.0f * (_val)))
596 # define DOWNSAMPLE_FLOAT_TO_12BIT(_val) \
597 (_val) <= 0.0f ? 0 : ((_val) >= 1.0f ? 4095 : (int)(4095.0f * (_val)))
598 # define DOWNSAMPLE_FLOAT_TO_16BIT(_val) \
599 (_val) <= 0.0f ? 0 : ((_val) >= 1.0f ? 65535 : (int)(65535.0f * (_val)))
604 return (_val << 4) | (_val & ((1 << 4) - 1));
608 return (_val << 8) + _val;
613 return (_val) <= 0.0f ? 0 : ((_val) >= 1.0f ? 255 : (
int)(255.0f * (_val)));
617 return (_val) <= 0.0f ? 0 : ((_val) >= 1.0f ? 4095 : (
int)(4095.0f * (_val)));
621 return (_val) <= 0.0f ? 0 : ((_val) >= 1.0f ? 65535 : (
int)(65535.0f * (_val)));
636 #define CINEMA_24_CS 1302083
637 #define CINEMA_48_CS 651041
638 #define COMP_24_CS 1041666
639 #define COMP_48_CS 520833
647 POC[0].resno1 = numres - 1;
649 POC[0].prg1 = OPJ_CPRL;
651 POC[1].resno0 = numres - 1;
654 POC[1].resno1 = numres;
656 POC[1].prg1 = OPJ_CPRL;
702 case OPJ_CINEMA2K_24:
703 case OPJ_CINEMA2K_48:
707 if (!((
image->comps[0].w == 2048) || (
image->comps[0].h == 1080))) {
709 "Image coordinates %u x %u is not 2K compliant.\nJPEG Digital Cinema Profile-3 "
710 "(2K profile) compliance requires that at least one of coordinates match 2048 x "
721 case OPJ_CINEMA4K_24:
728 if (!((
image->comps[0].w == 4096) || (
image->comps[0].h == 2160))) {
730 "Image coordinates %u x %u is not 4K compliant.\nJPEG Digital Cinema Profile-4"
731 "(4K profile) compliance requires that at least one of coordinates match 4096 x "
748 case OPJ_CINEMA2K_24:
749 case OPJ_CINEMA4K_24:
750 for (i = 0; i <
parameters->tcp_numlayers; i++) {
752 if (img_fol->
rates[i] == 0) {
759 image->comps[0].prec)) /
775 case OPJ_CINEMA2K_48:
776 for (i = 0; i <
parameters->tcp_numlayers; i++) {
778 if (img_fol->
rates[i] == 0) {
785 image->comps[0].prec)) /
814 unsigned char *rect_uchar;
817 unsigned int subsampling_dx =
parameters->subsampling_dx;
818 unsigned int subsampling_dy =
parameters->subsampling_dy;
820 unsigned int i, i_next, numcomps,
w, h, prec;
823 OPJ_COLOR_SPACE color_space;
824 opj_image_cmptparm_t cmptparm[4];
843 if (ibuf->
x == 4096 || ibuf->
y == 2160) {
856 for (i = 0; i <
parameters->tcp_numlayers; i++) {
862 color_space = (ibuf->
foptions.
flag & JP2_YCC) ? OPJ_CLRSPC_SYCC : OPJ_CLRSPC_SRGB;
868 color_space = (ibuf->
foptions.
flag & JP2_YCC) ? OPJ_CLRSPC_SYCC : OPJ_CLRSPC_SRGB;
882 numcomps = (ibuf->
planes == 32) ? 4 : 3;
889 memset(&cmptparm, 0,
sizeof(opj_image_cmptparm_t[4]));
890 for (i = 0; i < numcomps; i++) {
891 cmptparm[i].prec = prec;
892 cmptparm[i].bpp = prec;
893 cmptparm[i].sgnd = 0;
894 cmptparm[i].dx = subsampling_dx;
895 cmptparm[i].dy = subsampling_dy;
900 image = opj_image_create(numcomps, &cmptparm[0], color_space);
902 printf(
"Error: opj_image_create() failed\n");
913 rect_uchar = (
unsigned char *)ibuf->
rect;
920 a = (numcomps == 4) ?
image->comps[3].data :
NULL;
933 if (channels_in_float == 4) {
943 else if (channels_in_float == 3) {
962 if (channels_in_float == 4) {
971 else if (channels_in_float == 3) {
991 if (channels_in_float == 4) {
1001 else if (channels_in_float == 3) {
1020 if (channels_in_float == 4) {
1029 else if (channels_in_float == 3) {
1048 if (numcomps == 4) {
1049 if (channels_in_float == 4) {
1059 else if (channels_in_float == 3) {
1078 if (channels_in_float == 4) {
1087 else if (channels_in_float == 3) {
1110 if (numcomps == 4) {
1112 r[i] = rect_uchar[0];
1113 g[i] = rect_uchar[1];
1114 b[i] = rect_uchar[2];
1115 a[i] = rect_uchar[3];
1121 r[i] = rect_uchar[0];
1122 g[i] = rect_uchar[1];
1123 b[i] = rect_uchar[2];
1130 if (numcomps == 4) {
1150 if (numcomps == 4) {
1178 if (img_fol.
rates) {
1190 filepath, OPJ_J2K_STREAM_CHUNK_SIZE,
false,
NULL);
1191 if (stream ==
NULL) {
1195 opj_stream_destroy(stream);
1208 opj_set_default_encoder_parameters(&
parameters);
1213 parameters.tcp_rates[0] = ((100 - quality) / 90.0f * 99.0f) + 1;
1220 opj_codec_t *codec =
NULL;
1225 OPJ_CODEC_FORMAT
format = OPJ_CODEC_JP2;
1233 codec = opj_create_compress(
format);
1239 opj_set_info_handler(codec, info_callback, stderr);
1247 if (opj_start_compress(codec,
image, stream) ==
false) {
1250 if (opj_encode(codec, stream) ==
false) {
1253 if (opj_end_compress(codec, stream) ==
false) {
1263 opj_destroy_codec(codec);
1268 opj_image_destroy(
image);
1272 fprintf(stderr,
"failed to encode image\n");
typedef float(TangentPoint)[2]
File and directory operations.
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
MINLINE void premul_to_straight_v4_v4(float straight[4], const float premul[4])
float linearrgb_to_srgb(float c)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
@ COLOR_ROLE_DEFAULT_BYTE
struct ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
void IMB_rect_from_float(struct ImBuf *ibuf)
Contains defines and structs used throughout the imbuf module.
@ IMB_COLORMANAGE_IS_DATA
Read Guarded memory(de)allocation.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void colorspace_set_default_role(char *colorspace, int size, int role)
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
#define PIXEL_LOOPER_BEGIN_CHANNELS(_rect, _channels)
static OPJ_SIZE_T opj_read_from_buffer(void *p_buffer, OPJ_SIZE_T p_nb_bytes, void *p_user_data)
bool imb_save_jp2_stream(struct ImBuf *ibuf, opj_stream_t *stream, int flags)
bool imb_save_jp2(struct ImBuf *ibuf, const char *filepath, int flags)
static void cinema_parameters(opj_cparameters_t *parameters)
static OPJ_CODEC_FORMAT format_from_header(const unsigned char mem[JP2_FILEHEADER_SIZE], const size_t size)
static opj_image_t * ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
static OPJ_SIZE_T opj_write_from_file(void *p_buffer, OPJ_SIZE_T p_nb_bytes, void *p_user_data)
ImBuf * imb_load_jp2_filepath(const char *filepath, int flags, char colorspace[IM_MAX_SPACE])
static OPJ_BOOL opj_seek_from_buffer(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 const char J2K_HEAD[]
BLI_INLINE int UPSAMPLE_8_TO_12(const unsigned char _val)
static opj_stream_t * opj_stream_create_from_buffer(struct BufInfo *p_file, OPJ_UINT32 p_size, OPJ_BOOL p_is_read_stream)
#define JP2_FILEHEADER_SIZE
BLI_INLINE int UPSAMPLE_8_TO_16(const unsigned char _val)
BLI_INLINE int DOWNSAMPLE_FLOAT_TO_16BIT(const float _val)
static void opj_read_from_buffer_free(void *UNUSED(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 void cinema_setup_encoder(opj_cparameters_t *parameters, opj_image_t *image, img_fol_t *img_fol)
static void warning_callback(const char *msg, void *client_data)
static float channel_colormanage_noop(float value)
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)
static OPJ_UINT64 opj_get_data_length_from_file(void *p_user_data)
bool imb_is_a_jp2(const unsigned char *buf, size_t size)
static OPJ_OFF_T opj_skip_from_file(OPJ_OFF_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)
ImBuf * imb_load_jp2(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
static bool check_jp2(const unsigned char *mem, const size_t size)
static int init_4K_poc(opj_poc_t *POC, int numres)
static void error_callback(const char *msg, void *client_data)
struct img_folder img_fol_t
static ImBuf * imb_load_jp2_stream(opj_stream_t *stream, OPJ_CODEC_FORMAT p_format, int flags, char colorspace[IM_MAX_SPACE])
BLI_INLINE int DOWNSAMPLE_FLOAT_TO_8BIT(const float _val)
static void opj_free_from_file(void *p_user_data)
static bool check_j2k(const unsigned char *mem, const size_t size)
#define PIXEL_LOOPER_BEGIN(_rect)
static const char JP2_HEAD[]
BLI_INLINE int DOWNSAMPLE_FLOAT_TO_12BIT(const float _val)
double parameters[NUM_PARAMETERS]
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)
const unsigned char * buf
const unsigned char * cur
ImbFormatOptions foptions
struct ColorSpace * float_colorspace