66 fileClock =
time(
nullptr);
67 fileTime = localtime(&fileClock);
127 const char *filepath = (
const char *)byteStuff;
130 if (dpx ==
nullptr) {
132 printf(
"DPX: Failed to malloc dpx file structure.\n");
143 if (fromMemory == 0) {
146 if (dpx->
file ==
nullptr) {
148 printf(
"DPX: Failed to open file \"%s\".\n", filepath);
166 printf(
"DPX: Not enough data for header in \"%s\".\n", byteStuff);
176 printf(
"DPX: File is MSB.\n");
182 printf(
"DPX: File is LSB.\n");
258 printf(
"DPX: Unsupported image depth: %d\n", dpx->
depth);
267 printf(
"DPX: Unsupported bitsPerSample for elements %d: %d\n",
294 printf(
"DPX: Image header is corrupted.\n");
387 printf(
" Element %d:\n", i);
405 printf(
"----------------------------\n");
422 const char *shortFilename =
nullptr;
426 if (dpx ==
nullptr) {
428 printf(
"DPX: Failed to malloc dpx file structure.\n");
441 switch (bitsPerSample) {
455 printf(
"DPX: bitsPerSample not supported: %d\n", bitsPerSample);
472 if (isLogarithmic == 0) {
485 if (referenceWhite > 0) {
492 if (referenceBlack > 0) {
507 if (shortFilename ==
nullptr) {
508 shortFilename = filepath;
516 if (dpx->
file ==
nullptr) {
518 printf(
"DPX: Couldn't open file %s\n", filepath);
526 if (fwrite(&header,
sizeof(header), 1, dpx->
file) == 0) {
528 printf(
"DPX: Couldn't write image header\n");
536 memset(&
pad, 0, 6044);
537 if (fwrite(&
pad, 6044, 1, dpx->
file) == 0) {
539 printf(
"DPX: 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.
int pad[32 - sizeof(int)]
void dpxSetVerbose(int verbosity)
static void fillDpxMainHeader(LogImageFile *dpx, DpxMainHeader *header, const char *filename, const char *creator)
LogImageFile * dpxCreate(const char *filepath, int width, int height, int bitsPerSample, int hasAlpha, int isLogarithmic, int referenceWhite, int referenceBlack, float gamma, const char *creator)
LogImageFile * dpxOpen(const uchar *byteStuff, int fromMemory, size_t bufferSize)
#define DPX_UNDEFINED_U32
#define DPX_UNDEFINED_R32
#define IS_DPX_UNDEFINED_R32(x)
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 short swap_ushort(unsigned short x, int swap)
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)
DpxTelevisionHeader televisionHeader
DpxImageHeader imageHeader
unsigned char * memBuffer
unsigned char * memCursor
LogImageElement element[8]