24 const uchar *mem,
size_t size,
int use_cineon,
int flags,
char colorspace[
IM_MAX_SPACE])
28 int width, height, depth;
36 if (image ==
nullptr) {
37 printf(
"DPX/Cineon: error opening image.\n");
44 if (ibuf ==
nullptr) {
59 ibuf->
ftype = use_cineon ? IMB_FTYPE_CINEON : IMB_FTYPE_DPX;
73 const uchar *rect_ptr;
74 int x,
y, depth, bitspersample, rvalue;
77 printf(
"DPX/Cineon: saving in memory is not supported.\n");
83 depth = (ibuf->
planes + 7) >> 3;
84 if (depth > 4 || depth < 3) {
85 printf(
"DPX/Cineon: unsupported depth: %d for file: '%s'\n", depth, filepath);
114 if (logImage ==
nullptr) {
115 printf(
"DPX/Cineon: error creating file.\n");
123 fbuf = (
float *)
MEM_mallocN(
sizeof(
float[4]) * ibuf->
x * ibuf->
y,
124 "fbuf in imb_save_dpx_cineon");
126 for (y = 0; y < ibuf->
y; y++) {
127 float *dst_ptr = fbuf + 4 * ((ibuf->
y - y - 1) * ibuf->
x);
130 memcpy(dst_ptr, src_ptr, 4 * ibuf->
x *
sizeof(
float));
142 fbuf = (
float *)
MEM_mallocN(
sizeof(
float[4]) * ibuf->
x * ibuf->
y,
143 "fbuf in imb_save_dpx_cineon");
144 if (fbuf ==
nullptr) {
145 printf(
"DPX/Cineon: error allocating memory.\n");
149 for (y = 0; y < ibuf->
y; y++) {
150 for (x = 0; x < ibuf->
x; x++) {
151 fbuf_ptr = fbuf + 4 * ((ibuf->
y - y - 1) * ibuf->
x + x);
153 fbuf_ptr[0] =
float(rect_ptr[0]) / 255.0f;
154 fbuf_ptr[1] =
float(rect_ptr[1]) / 255.0f;
155 fbuf_ptr[2] =
float(rect_ptr[2]) / 255.0f;
156 fbuf_ptr[3] = (depth == 4) ? (
float(rect_ptr[3]) / 255.0f) : 1.0f;
@ COLOR_ROLE_DEFAULT_FLOAT
void IMB_flipy(ImBuf *ibuf)
void IMB_rect_from_float(ImBuf *ibuf)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filepath, int use_cineon, int flags)
bool imb_save_cineon(ImBuf *buf, const char *filepath, int flags)
bool imb_is_a_cineon(const uchar *buf, size_t size)
ImBuf * imb_load_cineon(const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
static ImBuf * imb_load_dpx_cineon(const uchar *mem, size_t size, int use_cineon, int flags, char colorspace[IM_MAX_SPACE])
void colorspace_set_default_role(char *colorspace, int size, int role)
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)
draw_view in_light_buf[] float
struct ImBuf * IMB_allocImBuf(unsigned int, unsigned int, unsigned char, unsigned int)
void IMB_freeImBuf(ImBuf *)
int logImageIsCineon(const void *buffer, const uint size)
void logImageSetVerbose(int verbosity)
int logImageSetDataRGBA(LogImageFile *logImage, const float *data, int dataIsLinearRGB)
void logImageClose(LogImageFile *logImage)
LogImageFile * logImageCreate(const char *filepath, int cineon, int width, int height, int bitsPerSample, int isLogarithmic, int hasAlpha, int referenceWhite, int referenceBlack, float gamma, const char *creator)
int logImageGetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB)
LogImageFile * logImageOpenFromMemory(const uchar *buffer, uint size)
void logImageGetSize(const LogImageFile *logImage, int *width, int *height, int *depth)
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
ImBufFloatBuffer float_buffer
ImbFormatOptions foptions
ImBufByteBuffer byte_buffer