63 fileClock =
time(
nullptr);
64 fileTime = localtime(&fileClock);
73 for (i = 0; i < 3; i++) {
129 const char *filepath = (
const char *)byteStuff;
133 if (cineon ==
nullptr) {
135 printf(
"Cineon: Failed to malloc cineon file structure.\n");
144 cineon->
file =
nullptr;
146 if (fromMemory == 0) {
149 if (cineon->
file ==
nullptr) {
151 printf(
"Cineon: Failed to open file \"%s\".\n", filepath);
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",
226 if (cineon->
depth == 1) {
232 else if (cineon->
depth == 3) {
253 printf(
"Cineon: Cineon image depth unsupported: %d\n", cineon->
depth);
326 cineon->
gamma = 1.7f;
331 printf(
" Element %d:\n", i);
349 printf(
"----------------------------\n");
355 const char *filepath,
int width,
int height,
int bitsPerSample,
const char *creator)
358 const char *shortFilename =
nullptr;
362 if (cineon ==
nullptr) {
364 printf(
"cineon: Failed to malloc cineon file structure.\n");
370 if (bitsPerSample != 10) {
372 printf(
"cineon: Only 10 bits Cineon are supported.\n");
378 cineon->
width = width;
396 cineon->
gamma = 1.7f;
399 if (shortFilename ==
nullptr) {
400 shortFilename = filepath;
407 if (cineon->
file ==
nullptr) {
409 printf(
"cineon: Couldn't open file %s\n", filepath);
417 if (fwrite(&header,
sizeof(header), 1, cineon->
file) == 0) {
419 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()
#define STRNCPY(dst, 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]