62 fileClock = time(
nullptr);
63 fileTime = localtime(&fileClock);
72 for (
i = 0;
i < 3;
i++) {
128 const char *filepath = (
const char *)byteStuff;
132 if (cineon ==
nullptr) {
134 printf(
"Cineon: Failed to malloc cineon file structure.\n");
143 cineon->
file =
nullptr;
145 if (fromMemory == 0) {
148 if (cineon->
file ==
nullptr) {
150 printf(
"Cineon: Failed to open file \"%s\".\n", filepath);
168 printf(
"Cineon: Not enough data for header in \"%s\".\n", byteStuff);
178 printf(
"Cineon: File is MSB.\n");
184 printf(
"Cineon: File is LSB.\n");
189 printf(
"Cineon: Bad magic number %lu in \"%s\".\n",
225 if (cineon->
depth == 1) {
231 else if (cineon->
depth == 3) {
252 printf(
"Cineon: Cineon image depth unsupported: %d\n", cineon->
depth);
325 cineon->
gamma = 1.7f;
348 printf(
"----------------------------\n");
354 const char *filepath,
int width,
int height,
int bitsPerSample,
const char *creator)
357 const char *shortFilename =
nullptr;
361 if (cineon ==
nullptr) {
363 printf(
"cineon: Failed to malloc cineon file structure.\n");
369 if (bitsPerSample != 10) {
371 printf(
"cineon: Only 10 bits Cineon are supported.\n");
377 cineon->
width = width;
395 cineon->
gamma = 1.7f;
398 if (shortFilename ==
nullptr) {
399 shortFilename = filepath;
406 if (cineon->
file ==
nullptr) {
408 printf(
"cineon: Couldn't open file %s\n", filepath);
416 if (fwrite(&header,
sizeof(header), 1, cineon->
file) == 0) {
418 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()
char * STRNCPY(char(&dst)[N], const char *src)
Read Guarded memory(de)allocation.
LogImageFile * cineonCreate(const char *filepath, int width, int height, int bitsPerSample, const char *creator)
void cineonSetVerbose(int verbosity)
LogImageFile * cineonOpen(const uchar *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
static size_t getRowLength(size_t width, const LogImageElement &logElement)
void logImageClose(LogImageFile *logImage)
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, uint 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]