17 #include <sys/types.h>
63 fileTime = localtime(&fileClock);
72 for (i = 0; i < 3; i++) {
129 const char *filepath = (
const char *)byteStuff;
131 unsigned int dataOffset;
133 if (cineon ==
NULL) {
135 printf(
"Cineon: Failed to malloc cineon file structure.\n");
146 if (fromMemory == 0) {
151 printf(
"Cineon: Failed to open file \"%s\".\n", filepath);
162 cineon->
memBuffer = (
unsigned char *)byteStuff;
163 cineon->
memCursor = (
unsigned char *)byteStuff;
169 printf(
"Cineon: Not enough data for header in \"%s\".\n", byteStuff);
179 printf(
"Cineon: File is MSB.\n");
185 printf(
"Cineon: File is LSB.\n");
190 printf(
"Cineon: Bad magic number %lu in \"%s\".\n",
203 printf(
"Cineon: Wrong image dimension: %dx%d\n", cineon->
width, cineon->
height);
226 if (cineon->
depth == 1) {
232 else if (cineon->
depth == 3) {
253 printf(
"Cineon: Cineon image depth unsupported: %d\n", cineon->
depth);
324 cineon->
gamma = 1.7f;
329 printf(
" Element %d:\n", i);
332 printf(
" Transfer characteristics: %d\n", cineon->
element[i].
transfer);
343 printf(
"Gamma: %f\n", cineon->
gamma);
347 printf(
"----------------------------\n");
353 const char *filepath,
int width,
int height,
int bitsPerSample,
const char *creator)
356 const char *shortFilename =
NULL;
360 if (cineon ==
NULL) {
362 printf(
"cineon: Failed to malloc cineon file structure.\n");
368 if (bitsPerSample != 10) {
370 printf(
"cineon: Only 10 bits Cineon are supported.\n");
394 cineon->
gamma = 1.7f;
397 if (shortFilename ==
NULL) {
398 shortFilename = filepath;
407 printf(
"cineon: Couldn't open file %s\n", filepath);
415 if (fwrite(&header,
sizeof(header), 1, cineon->
file) == 0) {
417 printf(
"cineon: Couldn't write image header\n");
File and directory operations.
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_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 width
Read Guarded memory(de)allocation.
void cineonSetVerbose(int verbosity)
LogImageFile * cineonCreate(const char *filepath, int width, int height, int bitsPerSample, const char *creator)
LogImageFile * cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t bufferSize)
static void fillCineonMainHeader(LogImageFile *cineon, CineonMainHeader *header, const char *filepath, const char *creator)
#define CINEON_FILE_MAGIC
#define CINEON_UNDEFINED_U32
#define CINEON_UNDEFINED_R32
void logImageClose(LogImageFile *logImage)
size_t getRowLength(size_t width, LogImageElement logElement)
BLI_INLINE float swap_float(float x, int swap)
@ transfer_PrintingDensity
BLI_INLINE unsigned int swap_uint(unsigned int x, int swap)
int logimage_fread(void *buffer, size_t size, unsigned int count, LogImageFile *logFile)
void *(* MEM_mallocN)(size_t len, const char *str)
CineonFileHeader fileHeader
CineonImageHeader imageHeader
unsigned char * memBuffer
unsigned char * memCursor
LogImageElement element[8]