33 ImageSpec config, spec;
35 ReadContext ctx{mem, size,
"dpx", IMB_FTYPE_DPX, flags};
51 int bits_per_sample = 8;
63 const TypeDesc data_format = bits_per_sample == 8 ? TypeDesc::UINT8 : TypeDesc::UINT16;
68 const float max_value =
powf(2, bits_per_sample) - 1.0f;
69 file_spec.attribute(
"oiio:BitsPerSample", bits_per_sample);
70 file_spec.attribute(
"dpx:WhiteLevel", 685.0f / 1023.0f * max_value);
71 file_spec.attribute(
"dpx:BlackLevel", 95.0f / 1023.0f * max_value);
72 file_spec.attribute(
"dpx:HighData", max_value);
73 file_spec.attribute(
"dpx:LowData", 0);
74 file_spec.attribute(
"dpx:LowQuantity", 0.0f);
78 file_spec.attribute(
"dpx:Transfer",
"Printing density");
79 file_spec.attribute(
"dpx:HighQuantity", 2.048f);
82 file_spec.attribute(
"dpx:Transfer",
"Linear");
83 file_spec.attribute(
"dpx:HighQuantity", max_value);
86 if (
ELEM(bits_per_sample, 8, 16)) {
87 file_spec.attribute(
"dpx:Packing",
"Packed");
90 file_spec.attribute(
"dpx:Packing",
"Filled, method A");
92 return {ctx, file_spec};
bool imb_oiio_write(const WriteContext &ctx, const char *filepath, const ImageSpec &file_spec)
ImBuf * imb_oiio_read(const ReadContext &ctx, const ImageSpec &config, ImFileColorSpace &r_colorspace, ImageSpec &r_newspec)
bool imb_oiio_check(const uchar *mem, size_t mem_size, const char *file_format)
ImageSpec imb_create_write_spec(const WriteContext &ctx, int file_channels, TypeDesc data_format)
WriteContext imb_create_write_context(const char *file_format, const ImBuf *ibuf, ImBufFlags flags, bool prefer_float)
Vector< uint8_t > imb_oiio_write_buffer(const WriteContext &ctx, const ImageSpec &file_spec)
bool imb_is_a_dpx(const uchar *mem, size_t size)
const char * imb_file_extensions_dpx[]
Vector< uint8_t > imb_save_buffer_dpx(ImBuf *ibuf, ImBufFlags flags)
static std::tuple< WriteContext, ImageSpec > prepare_save_dpx(ImBuf *ibuf, ImBufFlags flags)
ImBuf * imb_load_dpx(const uchar *mem, size_t size, ImBufFlags flags, ImFileColorSpace &r_colorspace)
bool imb_save_dpx(ImBuf *ibuf, const char *filepath, ImBufFlags flags)
const char * imb_file_extensions_cineon[]
ImbFormatOptions foptions
int color_mode_channels_get() const