31 int width, height, depth;
37 if (
image ==
nullptr) {
38 printf(
"Cineon: error opening image.\n");
45 if (ibuf ==
nullptr) {
60 ibuf->
ftype = IMB_FTYPE_CINEON;
76 const uchar *rect_ptr;
82 printf(
"Cineon: only RGB/RGBA is supported, file: '%s'\n", filepath);
89 if (logImage ==
nullptr) {
90 printf(
"Cineon: error creating file.\n");
96 "fbuf in imb_save_dpx_cineon");
98 for (
y = 0;
y < ibuf->
y;
y++) {
99 float *dst_ptr = fbuf + (4 * (size_t(ibuf->
y -
y - 1) * size_t(ibuf->
x)));
100 const float *src_ptr = ibuf->
float_data() + (4 * (size_t(
y) * size_t(ibuf->
x)));
102 memcpy(dst_ptr, src_ptr, 4 * ibuf->
x *
sizeof(
float));
115 "fbuf in imb_save_dpx_cineon");
116 if (fbuf ==
nullptr) {
117 printf(
"Cineon: error allocating memory.\n");
122 for (
y = 0;
y < ibuf->
y;
y++) {
123 fbuf_ptr = fbuf + (4 * (size_t(ibuf->
y -
y - 1) * size_t(ibuf->
x)));
124 rect_ptr = byte_data + (4 * (size_t(
y) * size_t(ibuf->
x)));
125 for (
x = 0;
x < ibuf->
x;
x++) {
126 fbuf_ptr[0] =
float(rect_ptr[0]) / 255.0f;
127 fbuf_ptr[1] =
float(rect_ptr[1]) / 255.0f;
128 fbuf_ptr[2] =
float(rect_ptr[2]) / 255.0f;
129 fbuf_ptr[3] = has_alpha ? (
float(rect_ptr[3]) / 255.0f) : 1.0f;
Read Blender memory allocation and freeing.
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void logImageClose(LogImageFile *logImage)
int logImageIsCineon(const void *buffer, const uint size)
void logImageGetSize(const LogImageFile *logImage, int *width, int *height, int *depth)
void logImageSetVerbose(int verbosity)
ImBuf * imb_load_cineon(const uchar *mem, size_t size, ImBufFlags flags, ImFileColorSpace &r_colorspace)
LogImageFile * logImageOpenFromMemory(const uchar *buffer, uint size)
void IMB_freeImBuf(ImBuf *ibuf)
static ImBuf * imb_load_dpx_cineon(const uchar *mem, size_t size, ImBufFlags flags, ImFileColorSpace &r_colorspace)
LogImageFile * logImageCreate(const char *filepath, int width, int height, const char *creator)
void IMB_flipy(ImBuf *ibuf)
int logImageSetDataRGBA(LogImageFile *logImage, const float *data, int dataIsLinearRGB)
static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filepath)
ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, ImBufFlags flags)
void IMB_byte_from_float(ImBuf *ibuf)
bool imb_is_a_cineon(const uchar *mem, size_t size)
int logImageGetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB)
bool imb_save_cineon(ImBuf *buf, const char *filepath, ImBufFlags)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
const uint8_t * byte_data() const
const float * float_data() const
float * float_data_for_write()