2023-05-31 16:19:06 +02:00
|
|
|
/* SPDX-FileCopyrightText: 1999-2001 David Hodson <hodsond@acm.org>.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2006-03-12 15:11:23 +01:00
|
|
|
|
2019-02-17 22:08:12 +01:00
|
|
|
/** \file
|
|
|
|
* \ingroup imbcineon
|
2019-02-17 21:21:50 +01:00
|
|
|
*
|
|
|
|
* Cineon image file format library routines.
|
2012-04-30 16:24:11 +02:00
|
|
|
*/
|
|
|
|
|
2006-03-12 15:11:23 +01:00
|
|
|
#include "cineonlib.h"
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
#include "logmemfile.h"
|
2006-03-12 15:11:23 +01:00
|
|
|
|
2023-07-22 03:27:25 +02:00
|
|
|
#include <cmath>
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cstring>
|
|
|
|
#include <ctime>
|
2020-03-19 09:33:03 +01:00
|
|
|
#include <sys/types.h>
|
2006-03-12 15:11:23 +01:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
#include "BLI_fileops.h"
|
2022-09-10 08:51:15 +02:00
|
|
|
#include "BLI_string.h"
|
2012-10-22 16:01:16 +02:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
#include "MEM_guardedalloc.h"
|
2006-03-12 15:11:23 +01:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
/*
|
|
|
|
* For debug purpose
|
|
|
|
*/
|
2006-03-12 15:11:23 +01:00
|
|
|
|
|
|
|
static int verbose = 0;
|
|
|
|
|
2012-12-18 02:52:18 +01:00
|
|
|
void cineonSetVerbose(int verbosity)
|
|
|
|
{
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
verbose = verbosity;
|
2006-03-12 15:11:23 +01:00
|
|
|
}
|
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
static void fillCineonMainHeader(LogImageFile *cineon,
|
|
|
|
CineonMainHeader *header,
|
2022-05-17 03:38:05 +02:00
|
|
|
const char *filepath,
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
const char *creator)
|
|
|
|
{
|
|
|
|
time_t fileClock;
|
2023-06-03 00:36:28 +02:00
|
|
|
tm *fileTime;
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
int i;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
memset(header, 0, sizeof(CineonMainHeader));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
/* --- File header --- */
|
|
|
|
header->fileHeader.magic_num = swap_uint(CINEON_FILE_MAGIC, cineon->isMSB);
|
|
|
|
header->fileHeader.offset = swap_uint(cineon->element[0].dataOffset, cineon->isMSB);
|
|
|
|
header->fileHeader.gen_hdr_size = swap_uint(
|
|
|
|
sizeof(CineonFileHeader) + sizeof(CineonImageHeader) + sizeof(CineonOriginationHeader),
|
|
|
|
cineon->isMSB);
|
|
|
|
header->fileHeader.ind_hdr_size = 0;
|
|
|
|
header->fileHeader.user_data_size = 0;
|
|
|
|
header->fileHeader.file_size = swap_uint(cineon->element[0].dataOffset +
|
|
|
|
cineon->height *
|
|
|
|
getRowLength(cineon->width, cineon->element[0]),
|
|
|
|
cineon->isMSB);
|
2022-09-10 08:51:15 +02:00
|
|
|
STRNCPY(header->fileHeader.version, "v4.5");
|
|
|
|
STRNCPY(header->fileHeader.file_name, filepath);
|
2023-05-02 11:32:27 +02:00
|
|
|
fileClock = time(nullptr);
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
fileTime = localtime(&fileClock);
|
|
|
|
strftime(header->fileHeader.creation_date, 12, "%Y:%m:%d", fileTime);
|
|
|
|
strftime(header->fileHeader.creation_time, 12, "%H:%M:%S%Z", fileTime);
|
|
|
|
header->fileHeader.creation_time[11] = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
/* --- Image header --- */
|
|
|
|
header->imageHeader.orientation = 0;
|
|
|
|
header->imageHeader.elements_per_image = cineon->depth;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
header->imageHeader.element[i].descriptor1 = 0;
|
|
|
|
header->imageHeader.element[i].descriptor2 = i;
|
|
|
|
header->imageHeader.element[i].bits_per_sample = cineon->element[0].bitsPerSample;
|
|
|
|
header->imageHeader.element[i].pixels_per_line = swap_uint(cineon->width, cineon->isMSB);
|
|
|
|
header->imageHeader.element[i].lines_per_image = swap_uint(cineon->height, cineon->isMSB);
|
|
|
|
header->imageHeader.element[i].ref_low_data = swap_uint(cineon->element[0].refLowData,
|
|
|
|
cineon->isMSB);
|
|
|
|
header->imageHeader.element[i].ref_low_quantity = swap_float(cineon->element[0].refLowQuantity,
|
|
|
|
cineon->isMSB);
|
|
|
|
header->imageHeader.element[i].ref_high_data = swap_uint(cineon->element[0].refHighData,
|
|
|
|
cineon->isMSB);
|
|
|
|
header->imageHeader.element[i].ref_high_quantity = swap_float(
|
|
|
|
cineon->element[0].refHighQuantity, cineon->isMSB);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
header->imageHeader.white_point_x = swap_float(0.0f, cineon->isMSB);
|
|
|
|
header->imageHeader.white_point_y = swap_float(0.0f, cineon->isMSB);
|
|
|
|
header->imageHeader.red_primary_x = swap_float(0.0f, cineon->isMSB);
|
|
|
|
header->imageHeader.red_primary_y = swap_float(0.0f, cineon->isMSB);
|
|
|
|
header->imageHeader.green_primary_x = swap_float(0.0f, cineon->isMSB);
|
|
|
|
header->imageHeader.green_primary_y = swap_float(0.0f, cineon->isMSB);
|
|
|
|
header->imageHeader.blue_primary_x = swap_float(0.0f, cineon->isMSB);
|
|
|
|
header->imageHeader.blue_primary_y = swap_float(0.0f, cineon->isMSB);
|
2022-09-10 08:51:15 +02:00
|
|
|
STRNCPY(header->imageHeader.label, creator);
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
header->imageHeader.interleave = 0;
|
|
|
|
header->imageHeader.data_sign = 0;
|
|
|
|
header->imageHeader.sense = 0;
|
|
|
|
header->imageHeader.line_padding = swap_uint(0, cineon->isMSB);
|
|
|
|
header->imageHeader.element_padding = swap_uint(0, cineon->isMSB);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
switch (cineon->element[0].packing) {
|
|
|
|
case 0:
|
|
|
|
header->imageHeader.packing = 0;
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
case 1:
|
|
|
|
header->imageHeader.packing = 5;
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
case 2:
|
|
|
|
header->imageHeader.packing = 6;
|
|
|
|
break;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
/* --- Origination header --- */
|
|
|
|
/* we leave it blank */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
/* --- Film header --- */
|
|
|
|
/* we leave it blank */
|
2006-03-12 15:11:23 +01:00
|
|
|
}
|
|
|
|
|
2022-09-13 08:29:06 +02:00
|
|
|
LogImageFile *cineonOpen(const uchar *byteStuff, int fromMemory, size_t bufferSize)
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
{
|
|
|
|
CineonMainHeader header;
|
2012-10-22 15:00:02 +02:00
|
|
|
LogImageFile *cineon = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
|
2022-05-17 03:38:05 +02:00
|
|
|
const char *filepath = (const char *)byteStuff;
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
int i;
|
2022-09-13 08:29:06 +02:00
|
|
|
uint dataOffset;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-05-02 11:32:27 +02:00
|
|
|
if (cineon == nullptr) {
|
2019-04-23 03:01:30 +02:00
|
|
|
if (verbose) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf("Cineon: Failed to malloc cineon file structure.\n");
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
2023-05-02 11:32:27 +02:00
|
|
|
return nullptr;
|
2006-03-12 15:11:23 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
/* zero the header */
|
|
|
|
memset(&header, 0, sizeof(CineonMainHeader));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-03-12 15:11:23 +01:00
|
|
|
/* for close routine */
|
2023-05-02 11:32:27 +02:00
|
|
|
cineon->file = nullptr;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
if (fromMemory == 0) {
|
2022-05-17 03:38:05 +02:00
|
|
|
/* byteStuff is then the filepath */
|
|
|
|
cineon->file = BLI_fopen(filepath, "rb");
|
2023-05-02 11:32:27 +02:00
|
|
|
if (cineon->file == nullptr) {
|
2019-04-23 03:01:30 +02:00
|
|
|
if (verbose) {
|
2022-05-17 03:38:05 +02:00
|
|
|
printf("Cineon: Failed to open file \"%s\".\n", filepath);
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
logImageClose(cineon);
|
2023-05-02 11:32:27 +02:00
|
|
|
return nullptr;
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
}
|
|
|
|
/* not used in this case */
|
2023-05-02 11:32:27 +02:00
|
|
|
cineon->memBuffer = nullptr;
|
|
|
|
cineon->memCursor = nullptr;
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->memBufferSize = 0;
|
2012-10-22 15:00:02 +02:00
|
|
|
}
|
|
|
|
else {
|
2022-09-13 08:29:06 +02:00
|
|
|
cineon->memBuffer = (uchar *)byteStuff;
|
|
|
|
cineon->memCursor = (uchar *)byteStuff;
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->memBufferSize = bufferSize;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
if (logimage_fread(&header, sizeof(header), 1, cineon) == 0) {
|
2019-04-23 03:01:30 +02:00
|
|
|
if (verbose) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf("Cineon: Not enough data for header in \"%s\".\n", byteStuff);
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
logImageClose(cineon);
|
2023-05-02 11:32:27 +02:00
|
|
|
return nullptr;
|
2006-03-12 15:11:23 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
/* endianness determination */
|
|
|
|
if (header.fileHeader.magic_num == swap_uint(CINEON_FILE_MAGIC, 1)) {
|
|
|
|
cineon->isMSB = 1;
|
2019-04-23 03:01:30 +02:00
|
|
|
if (verbose) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf("Cineon: File is MSB.\n");
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
2012-10-22 15:00:02 +02:00
|
|
|
}
|
|
|
|
else if (header.fileHeader.magic_num == CINEON_FILE_MAGIC) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->isMSB = 0;
|
2019-04-23 03:01:30 +02:00
|
|
|
if (verbose) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf("Cineon: File is LSB.\n");
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
2012-10-22 15:00:02 +02:00
|
|
|
}
|
|
|
|
else {
|
2019-03-18 04:13:06 +01:00
|
|
|
if (verbose) {
|
|
|
|
printf("Cineon: Bad magic number %lu in \"%s\".\n",
|
2023-05-02 12:09:09 +02:00
|
|
|
ulong(header.fileHeader.magic_num),
|
2019-03-18 04:13:06 +01:00
|
|
|
byteStuff);
|
|
|
|
}
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
logImageClose(cineon);
|
2023-05-02 11:32:27 +02:00
|
|
|
return nullptr;
|
2006-03-12 15:11:23 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->width = swap_uint(header.imageHeader.element[0].pixels_per_line, cineon->isMSB);
|
|
|
|
cineon->height = swap_uint(header.imageHeader.element[0].lines_per_image, cineon->isMSB);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-15 10:46:37 +01:00
|
|
|
if (cineon->width == 0 || cineon->height == 0) {
|
2019-04-23 03:01:30 +02:00
|
|
|
if (verbose) {
|
2013-03-15 10:46:37 +01:00
|
|
|
printf("Cineon: Wrong image dimension: %dx%d\n", cineon->width, cineon->height);
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
2013-03-15 10:46:37 +01:00
|
|
|
logImageClose(cineon);
|
2023-05-02 11:32:27 +02:00
|
|
|
return nullptr;
|
2013-03-15 10:46:37 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->depth = header.imageHeader.elements_per_image;
|
|
|
|
cineon->srcFormat = format_Cineon;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-23 03:01:30 +02:00
|
|
|
if (header.imageHeader.interleave == 0) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->numElements = 1;
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
|
|
|
else if (header.imageHeader.interleave == 2) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->numElements = header.imageHeader.elements_per_image;
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
else {
|
2019-04-23 03:01:30 +02:00
|
|
|
if (verbose) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf("Cineon: Data interleave not supported: %d\n", header.imageHeader.interleave);
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
2013-03-15 10:46:37 +01:00
|
|
|
logImageClose(cineon);
|
2023-05-02 11:32:27 +02:00
|
|
|
return nullptr;
|
2006-03-12 15:11:23 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
if (cineon->depth == 1) {
|
2022-01-06 03:54:52 +01:00
|
|
|
/* Gray-scale image. */
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->element[0].descriptor = descriptor_Luminance;
|
|
|
|
cineon->element[0].transfer = transfer_Linear;
|
|
|
|
cineon->element[0].depth = 1;
|
2006-03-12 15:11:23 +01:00
|
|
|
}
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
else if (cineon->depth == 3) {
|
2022-01-06 03:54:52 +01:00
|
|
|
/* RGB image. */
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
if (cineon->numElements == 1) {
|
|
|
|
cineon->element[0].descriptor = descriptor_RGB;
|
|
|
|
cineon->element[0].transfer = transfer_PrintingDensity;
|
|
|
|
cineon->element[0].depth = 3;
|
|
|
|
}
|
|
|
|
else if (cineon->numElements == 3) {
|
|
|
|
cineon->element[0].descriptor = descriptor_Red;
|
|
|
|
cineon->element[0].transfer = transfer_PrintingDensity;
|
|
|
|
cineon->element[0].depth = 1;
|
|
|
|
cineon->element[1].descriptor = descriptor_Green;
|
|
|
|
cineon->element[1].transfer = transfer_PrintingDensity;
|
|
|
|
cineon->element[1].depth = 1;
|
|
|
|
cineon->element[2].descriptor = descriptor_Blue;
|
|
|
|
cineon->element[2].transfer = transfer_PrintingDensity;
|
|
|
|
cineon->element[2].depth = 1;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
}
|
|
|
|
else {
|
2019-04-23 03:01:30 +02:00
|
|
|
if (verbose) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf("Cineon: Cineon image depth unsupported: %d\n", cineon->depth);
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
2013-03-15 10:46:37 +01:00
|
|
|
logImageClose(cineon);
|
2023-05-02 11:32:27 +02:00
|
|
|
return nullptr;
|
2006-03-12 15:11:23 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
dataOffset = swap_uint(header.fileHeader.offset, cineon->isMSB);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
for (i = 0; i < cineon->numElements; i++) {
|
|
|
|
cineon->element[i].bitsPerSample = header.imageHeader.element[i].bits_per_sample;
|
|
|
|
cineon->element[i].maxValue = powf(2, cineon->element[i].bitsPerSample) - 1.0f;
|
|
|
|
cineon->element[i].refLowData = swap_uint(header.imageHeader.element[i].ref_low_data,
|
|
|
|
cineon->isMSB);
|
|
|
|
cineon->element[i].refLowQuantity = swap_float(header.imageHeader.element[i].ref_low_quantity,
|
|
|
|
cineon->isMSB);
|
|
|
|
cineon->element[i].refHighData = swap_uint(header.imageHeader.element[i].ref_high_data,
|
|
|
|
cineon->isMSB);
|
|
|
|
cineon->element[i].refHighQuantity = swap_float(
|
|
|
|
header.imageHeader.element[i].ref_high_quantity, cineon->isMSB);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
switch (header.imageHeader.packing) {
|
|
|
|
case 0:
|
|
|
|
cineon->element[i].packing = 0;
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
case 5:
|
|
|
|
cineon->element[i].packing = 1;
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
case 6:
|
|
|
|
cineon->element[i].packing = 2;
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
default:
|
|
|
|
/* Not supported */
|
2019-04-23 03:01:30 +02:00
|
|
|
if (verbose) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf("Cineon: packing unsupported: %d\n", header.imageHeader.packing);
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
2013-03-15 10:46:37 +01:00
|
|
|
logImageClose(cineon);
|
2023-05-02 11:32:27 +02:00
|
|
|
return nullptr;
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-23 03:01:30 +02:00
|
|
|
if (cineon->element[i].refLowData == CINEON_UNDEFINED_U32) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->element[i].refLowData = 0;
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-23 03:01:30 +02:00
|
|
|
if (cineon->element[i].refHighData == CINEON_UNDEFINED_U32) {
|
2023-05-02 12:09:09 +02:00
|
|
|
cineon->element[i].refHighData = uint(cineon->element[i].maxValue);
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
if (cineon->element[i].refLowQuantity == CINEON_UNDEFINED_R32 ||
|
2023-07-22 03:27:25 +02:00
|
|
|
std::isnan(cineon->element[i].refLowQuantity))
|
2019-04-23 03:01:30 +02:00
|
|
|
{
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->element[i].refLowQuantity = 0.0f;
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
if (cineon->element[i].refHighQuantity == CINEON_UNDEFINED_R32 ||
|
2023-07-22 03:27:25 +02:00
|
|
|
std::isnan(cineon->element[i].refHighQuantity))
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
{
|
2019-04-23 03:01:30 +02:00
|
|
|
if (cineon->element[i].transfer == transfer_PrintingDensity) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->element[i].refHighQuantity = 2.048f;
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
|
|
|
else {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->element[i].refHighQuantity = cineon->element[i].maxValue;
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->element[i].dataOffset = dataOffset;
|
|
|
|
dataOffset += cineon->height * getRowLength(cineon->width, cineon->element[i]);
|
2006-03-12 15:11:23 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->referenceBlack = 95.0f / 1023.0f * cineon->element[0].maxValue;
|
|
|
|
cineon->referenceWhite = 685.0f / 1023.0f * cineon->element[0].maxValue;
|
|
|
|
cineon->gamma = 1.7f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-03-12 15:11:23 +01:00
|
|
|
if (verbose) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf("size %d x %d x %d elements\n", cineon->width, cineon->height, cineon->numElements);
|
|
|
|
for (i = 0; i < cineon->numElements; i++) {
|
|
|
|
printf(" Element %d:\n", i);
|
|
|
|
printf(" Bits per sample: %d\n", cineon->element[i].bitsPerSample);
|
|
|
|
printf(" Depth: %d\n", cineon->element[i].depth);
|
|
|
|
printf(" Transfer characteristics: %d\n", cineon->element[i].transfer);
|
|
|
|
printf(" Packing: %d\n", cineon->element[i].packing);
|
|
|
|
printf(" Descriptor: %d\n", cineon->element[i].descriptor);
|
2015-06-19 12:29:06 +02:00
|
|
|
printf(" Data offset: %d\n", cineon->element[i].dataOffset);
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf(" Reference low data: %u\n", cineon->element[i].refLowData);
|
|
|
|
printf(" Reference low quantity: %f\n", cineon->element[i].refLowQuantity);
|
|
|
|
printf(" Reference high data: %u\n", cineon->element[i].refHighData);
|
|
|
|
printf(" Reference high quantity: %f\n", cineon->element[i].refHighQuantity);
|
|
|
|
printf("\n");
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf("Gamma: %f\n", cineon->gamma);
|
|
|
|
printf("Reference black: %f\n", cineon->referenceBlack);
|
|
|
|
printf("Reference white: %f\n", cineon->referenceWhite);
|
2017-12-07 14:37:59 +01:00
|
|
|
printf("Orientation: %d\n", header.imageHeader.orientation);
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf("----------------------------\n");
|
|
|
|
}
|
2006-03-12 15:11:23 +01:00
|
|
|
return cineon;
|
|
|
|
}
|
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
LogImageFile *cineonCreate(
|
2022-05-17 03:38:05 +02:00
|
|
|
const char *filepath, int width, int height, int bitsPerSample, const char *creator)
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
{
|
|
|
|
CineonMainHeader header;
|
2023-05-02 11:32:27 +02:00
|
|
|
const char *shortFilename = nullptr;
|
2023-09-25 08:56:17 +02:00
|
|
|
// uchar pad[6044];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-10-22 15:00:02 +02:00
|
|
|
LogImageFile *cineon = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
|
2023-05-02 11:32:27 +02:00
|
|
|
if (cineon == nullptr) {
|
2019-04-23 03:01:30 +02:00
|
|
|
if (verbose) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf("cineon: Failed to malloc cineon file structure.\n");
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
2023-05-02 11:32:27 +02:00
|
|
|
return nullptr;
|
2006-03-12 15:11:23 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
/* Only 10 bits Cineon are supported */
|
|
|
|
if (bitsPerSample != 10) {
|
2019-04-23 03:01:30 +02:00
|
|
|
if (verbose) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf("cineon: Only 10 bits Cineon are supported.\n");
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
logImageClose(cineon);
|
2023-05-02 11:32:27 +02:00
|
|
|
return nullptr;
|
2006-03-12 15:11:23 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-03-12 15:11:23 +01:00
|
|
|
cineon->width = width;
|
|
|
|
cineon->height = height;
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
cineon->element[0].bitsPerSample = 10;
|
|
|
|
cineon->element[0].dataOffset = sizeof(CineonMainHeader);
|
|
|
|
cineon->element[0].maxValue = 1023;
|
|
|
|
cineon->isMSB = 1;
|
|
|
|
cineon->numElements = 1;
|
|
|
|
cineon->element[0].packing = 1;
|
|
|
|
cineon->depth = 3;
|
|
|
|
cineon->element[0].depth = 3;
|
|
|
|
cineon->element[0].descriptor = descriptor_RGB;
|
|
|
|
cineon->element[0].transfer = transfer_PrintingDensity;
|
|
|
|
cineon->element[0].refHighQuantity = 2.048f;
|
|
|
|
cineon->element[0].refLowQuantity = 0;
|
|
|
|
cineon->element[0].refLowData = 0;
|
|
|
|
cineon->element[0].refHighData = cineon->element[0].maxValue;
|
|
|
|
cineon->referenceWhite = 685.0f;
|
|
|
|
cineon->referenceBlack = 95.0f;
|
|
|
|
cineon->gamma = 1.7f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-05-17 04:33:20 +02:00
|
|
|
shortFilename = strrchr(filepath, PATHSEP_CHAR);
|
2023-05-02 11:32:27 +02:00
|
|
|
if (shortFilename == nullptr) {
|
2022-05-17 03:38:05 +02:00
|
|
|
shortFilename = filepath;
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
|
|
|
else {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
shortFilename++;
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-05-17 03:38:05 +02:00
|
|
|
cineon->file = BLI_fopen(filepath, "wb");
|
2023-05-02 11:32:27 +02:00
|
|
|
if (cineon->file == nullptr) {
|
2019-04-23 03:01:30 +02:00
|
|
|
if (verbose) {
|
2022-05-17 03:38:05 +02:00
|
|
|
printf("cineon: Couldn't open file %s\n", filepath);
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
logImageClose(cineon);
|
2023-05-02 11:32:27 +02:00
|
|
|
return nullptr;
|
2006-03-12 15:11:23 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
fillCineonMainHeader(cineon, &header, shortFilename, creator);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-03-12 15:11:23 +01:00
|
|
|
if (fwrite(&header, sizeof(header), 1, cineon->file) == 0) {
|
2019-04-23 03:01:30 +02:00
|
|
|
if (verbose) {
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
printf("cineon: Couldn't write image header\n");
|
2019-04-23 03:01:30 +02:00
|
|
|
}
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 14:49:00 +02:00
|
|
|
logImageClose(cineon);
|
2023-05-02 11:32:27 +02:00
|
|
|
return nullptr;
|
2006-03-12 15:11:23 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2006-03-12 15:11:23 +01:00
|
|
|
return cineon;
|
|
|
|
}
|