Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/cineon/cineon_dpx.c
| Show All 33 Lines | |||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| static struct ImBuf *imb_load_dpx_cineon(const unsigned char *mem, | static struct ImBuf *imb_load_dpx_cineon(const unsigned char *mem, | ||||
| size_t size, | size_t size, | ||||
| int use_cineon, | int use_cineon, | ||||
| int flags, | eImBufFlags flags, | ||||
| char colorspace[IM_MAX_SPACE]) | char colorspace[IM_MAX_SPACE]) | ||||
| { | { | ||||
| ImBuf *ibuf; | ImBuf *ibuf; | ||||
| LogImageFile *image; | LogImageFile *image; | ||||
| int width, height, depth; | int width, height, depth; | ||||
| colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_FLOAT); | colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_FLOAT); | ||||
| Show All 28 Lines | static struct ImBuf *imb_load_dpx_cineon(const unsigned char *mem, | ||||
| if (flags & IB_alphamode_detect) { | if (flags & IB_alphamode_detect) { | ||||
| ibuf->flags |= IB_alphamode_premul; | ibuf->flags |= IB_alphamode_premul; | ||||
| } | } | ||||
| return ibuf; | return ibuf; | ||||
| } | } | ||||
| static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon, int flags) | static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon, eImBufFlags flags) | ||||
| { | { | ||||
| LogImageFile *logImage; | LogImageFile *logImage; | ||||
| float *fbuf; | float *fbuf; | ||||
| float *fbuf_ptr; | float *fbuf_ptr; | ||||
| unsigned char *rect_ptr; | unsigned char *rect_ptr; | ||||
| int x, y, depth, bitspersample, rvalue; | int x, y, depth, bitspersample, rvalue; | ||||
| if (flags & IB_mem) { | if (flags & IB_mem) { | ||||
| ▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | else { | ||||
| rvalue = (logImageSetDataRGBA(logImage, fbuf, 0) == 0); | rvalue = (logImageSetDataRGBA(logImage, fbuf, 0) == 0); | ||||
| MEM_freeN(fbuf); | MEM_freeN(fbuf); | ||||
| } | } | ||||
| logImageClose(logImage); | logImageClose(logImage); | ||||
| return rvalue; | return rvalue; | ||||
| } | } | ||||
| int imb_save_cineon(struct ImBuf *buf, const char *myfile, int flags) | int imb_save_cineon(struct ImBuf *buf, const char *myfile, eImBufFlags flags) | ||||
| { | { | ||||
| return imb_save_dpx_cineon(buf, myfile, 1, flags); | return imb_save_dpx_cineon(buf, myfile, 1, flags); | ||||
| } | } | ||||
| int imb_is_cineon(const unsigned char *buf) | int imb_is_cineon(const unsigned char *buf) | ||||
| { | { | ||||
| return logImageIsCineon(buf); | return logImageIsCineon(buf); | ||||
| } | } | ||||
| ImBuf *imb_load_cineon(const unsigned char *mem, | ImBuf *imb_load_cineon(const unsigned char *mem, | ||||
| size_t size, | size_t size, | ||||
| int flags, | eImBufFlags flags, | ||||
| char colorspace[IM_MAX_SPACE]) | char colorspace[IM_MAX_SPACE]) | ||||
| { | { | ||||
| if (imb_is_cineon(mem)) { | if (imb_is_cineon(mem)) { | ||||
| return imb_load_dpx_cineon(mem, size, 1, flags, colorspace); | return imb_load_dpx_cineon(mem, size, 1, flags, colorspace); | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| int imb_save_dpx(struct ImBuf *buf, const char *myfile, int flags) | int imb_save_dpx(struct ImBuf *buf, const char *myfile, eImBufFlags flags) | ||||
| { | { | ||||
| return imb_save_dpx_cineon(buf, myfile, 0, flags); | return imb_save_dpx_cineon(buf, myfile, 0, flags); | ||||
| } | } | ||||
| int imb_is_dpx(const unsigned char *buf) | int imb_is_dpx(const unsigned char *buf) | ||||
| { | { | ||||
| return logImageIsDpx(buf); | return logImageIsDpx(buf); | ||||
| } | } | ||||
| ImBuf *imb_load_dpx(const unsigned char *mem, | ImBuf *imb_load_dpx(const unsigned char *mem, | ||||
| size_t size, | size_t size, | ||||
| int flags, | eImBufFlags flags, | ||||
| char colorspace[IM_MAX_SPACE]) | char colorspace[IM_MAX_SPACE]) | ||||
| { | { | ||||
| if (imb_is_dpx(mem)) { | if (imb_is_dpx(mem)) { | ||||
| return imb_load_dpx_cineon(mem, size, 0, flags, colorspace); | return imb_load_dpx_cineon(mem, size, 0, flags, colorspace); | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||