18 #define DPX_C_MAGIC 0x53445058
19 #define DPX_C_MAGIC_BE 0x58504453
20 #define DPX_C_VERSION "V1.0"
21 #define DPX_C_UNDEFINED_FLOAT 0xffffffff
23 #define SWAP16(e,v) ((e) ? htons(v) : (v))
24 #define SWAP32(e,v) ((e) ? htonl(v) : (v))
25 #define SWAPR32(e,v) ((e) ? htonf(v) : (v))
26 #define UNSWAP16(e,v) ((e) ? ntohs(v) : (v))
27 #define UNSWAP32(e,v) ((e) ? ntohl(v) : (v))
28 #define UNSWAPR32(e,v) ((e) ? ntohf(v) : (v))
30 #define DPX_VALID(p) \
31 ((p) && (((p)->file_info.magic_num==DPX_C_MAGIC) || \
32 ((p)->file_info.magic_num==DPX_C_MAGIC_BE)))
34 #define DPX_IS_BE(p) \
35 ((p) && ((p)->file_info.magic_num == DPX_C_MAGIC_BE))
37 #define DPX_C_IMAGE_ELEM_DESC_RGB 50
38 #define DPX_C_IMAGE_ELEM_DESC_RGBA 51
39 #define DPX_C_IMAGE_ELEM_DESC_ARGB 52
40 #define DPX_C_IMAGE_ELEM_DESC_422 100
41 #define DPX_C_IMAGE_ELEM_DESC_444 102
178 #ifdef NTV4_RAID_SUPPORT
179 uint8_t reserved[2048];
192 #define FLD_OFFET( TYPE,field) \
193 ((uint32_t)(&(((TYPE *)0)->field)))
195 #define DPX_GET_U32(hdr,fld) \
197 dpx_get_u32(&(hdr)->fld,DPX_IS_BE(hdr)) : \
200 #define DPX_SET_U32(hdr,fld,val) \
202 if ( DPX_VALID(hdr)) \
203 dpx_set_u32(&(hdr)->fld,DPX_IS_BE(hdr),val); \
207 #define DPX_GET_R32(hdr,fld) \
209 dpx_get_r32(&(hdr)->fld,DPX_IS_BE(hdr)) : \
212 #define DPX_SET_R32(hdr,fld,val) \
214 if ( DPX_VALID(hdr)) \
215 dpx_set_r32(&(hdr)->fld,DPX_IS_BE(hdr),val); \
218 #define DPX_GET_U16(hdr,fld) \
220 dpx_get_u16(&(hdr)->fld,DPX_IS_BE(hdr)) : \
223 #define DPX_SET_U16(hdr,fld,val) \
225 if ( DPX_VALID(hdr)) \
226 dpx_set_u16(&(hdr)->fld,DPX_IS_BE(hdr),val); \
230 #define DPX_GET_U8(hdr,fld) \
231 DPX_VALID(hdr) ? (hdr)->fld : (uint8_t)(-1)
234 #define DPX_SET_U8(hdr,fld,val) \
235 if ( DPX_VALID(hdr)) \
238 #define DPX_SET_TEXT(hdr,fld,buf,len) \
239 if ( DPX_VALID(hdr)) \
240 memcpy((void*)&((hdr)->fld),(const void*)buf,len)
243 #define DPX_GET_TEXT(hdr,fld,buf,len) \
245 memcpy((void*)buf,(const void*)&((hdr)->fld),len) : \
246 memset((void*)buf,0xff,len)
257 void init(uint32_t endianness);
262 std::string get_fi_time_stamp()
const;
263 void set_fi_time_stamp();
265 void set_s2_tcframe(uint32_t frame);
266 size_t get_s2_tcframe()
const;
268 uint32_t get_s2_filenumber()
const;
269 void set_s2_filenumber(uint32_t fr);
271 void set_s2_ids(uint8_t rid, uint8_t sid, uint8_t tid);
272 void get_s2_ids(uint8_t *rid, uint8_t *sid, uint8_t *tid)
const;
274 size_t get_file_size();
275 size_t get_generic_hdr_size();
276 size_t get_industry_hdr_size();
277 size_t get_user_hdr_size();
281 size_t get_fi_image_offset()
const;
282 void set_fi_image_offset(
size_t offs );
284 size_t get_fi_file_size()
const;
285 void set_fi_file_size(
size_t offs );
287 std::string get_fi_version()
const;
288 void set_fi_version(
const std::string& str);
290 std::string get_fi_file_name()
const;
291 void set_fi_file_name(
const std::string& str);
293 std::string get_fi_creator()
const;
294 void set_fi_creator(
const std::string& str);
296 std::string get_fi_create_time()
const;
297 void set_fi_create_time(
const std::string& str);
299 std::string get_fi_project()
const;
300 void set_fi_project(
const std::string& str);
302 std::string get_fi_copyright()
const;
303 void set_fi_copyright(
const std::string& str);
306 void set_ii_orientation(uint16_t orientation );
307 uint16_t get_ii_orientation()
const;
309 void set_ii_element_number(uint16_t element_number );
310 uint16_t get_ii_element_number()
const;
312 void set_ii_pixels(uint32_t pixels );
313 size_t get_ii_pixels()
const;
315 void set_ii_lines(uint32_t lines );
316 size_t get_ii_lines(
void )
const;
321 uint32_t expectedSize = -1;
322 if (get_ie_descriptor() == 50)
324 if ( get_ie_bit_size() == 10 )
325 expectedSize = (uint32_t)(get_ii_pixels() * get_ii_lines() * 4);
327 expectedSize = (uint32_t)(get_ii_pixels() * get_ii_lines() * 6);
329 else if (get_ie_descriptor() == 100)
331 if (get_ii_pixels() % 48 == 0)
332 expectedSize = (uint32_t)(get_ii_pixels() * get_ii_lines() * 8 / 3);
334 expectedSize = (uint32_t)(((get_ii_pixels()/48+1)*48) * get_ii_lines() * 8 / 3);
352 void set_ie_data_sign (uint32_t sign,
int i=0);
353 size_t get_ie_data_sign(
int i = 0);
355 void set_ie_ref_low_data(uint32_t data,
int i=0);
356 size_t get_ie_ref_low_data(
int i = 0)
const;
358 void set_ie_ref_high_data(uint32_t data,
int i=0);
359 size_t get_ie_ref_high_data(
int i = 0)
const;
361 void set_ie_ref_low_quantity(
float data,
int i=0);
362 float get_ie_ref_low_quantity(
int i = 0)
const;
364 void set_ie_ref_high_quantity(
float data,
int i=0);
365 float get_ie_ref_high_quantity(
int i = 0)
const;
367 void set_ie_descriptor(uint8_t desc,
int i = 0);
368 uint8_t get_ie_descriptor(
int i = 0)
const;
370 void set_ie_transfer(uint8_t trans,
int i = 0);
371 uint8_t get_ie_transfer(
int i = 0)
const;
373 void set_ie_colorimetric(uint8_t c,
int i = 0);
374 uint8_t get_ie_colorimetric(
int i = 0)
const;
376 void set_ie_bit_size(uint8_t bits,
int i = 0);
377 uint8_t get_ie_bit_size(
int i = 0)
const;
379 void set_ie_packing(uint16_t pack,
int i = 0);
380 uint16_t get_ie_packing (
int i = 0)
const;
382 void set_ie_encoding(uint16_t enc,
int i = 0);
383 uint16_t get_ie_encoding(
int i = 0)
const;
385 void set_ie_data_offset(uint32_t offs,
int i = 0);
386 uint32_t get_ie_data_offset (
int i = 0)
const;
388 void set_ie_eol_padding(uint32_t padding,
int i = 0);
389 uint32_t get_ie_eol_padding(
int i = 0)
const;
391 void set_ie_eo_image_padding(uint32_t padding,
int i = 0);
392 uint32_t get_ie_eo_image_padding(
int i = 0)
const;
394 std::string get_ie_description(
int i=0)
const;
395 void set_ie_description(
const std::string& str,
int i = 0);
398 std::string get_is_filename()
const;
399 void set_is_filename(
const std::string& str);
401 std::string get_is_creation_time()
const;
402 void set_is_creation_time(
const std::string& str);
404 std::string get_is_input_device()
const;
405 void set_is_input_device(
const std::string& str);
407 std::string get_is_input_serial()
const;
408 void set_is_input_serial(
const std::string& str);
411 std::string get_film_mfg_id()
const;
412 void set_film_mfg_id(
const std::string& str);
414 std::string get_film_type()
const;
415 void set_film_type(
const std::string& str);
417 std::string get_film_offset()
const;
418 void set_film_offset(
const std::string& str);
420 std::string get_film_prefix()
const;
421 void set_film_prefix(
const std::string& str);
423 std::string get_film_count()
const;
424 void set_film_count(
const std::string& str);
426 std::string get_film_format()
const;
427 void set_film_format(
const std::string& str);
429 size_t get_film_frame_position()
const;
430 void set_film_frame_position(
size_t pos );
432 size_t get_film_sequence_len()
const;
433 void set_film_sequence_len(
size_t len );
435 size_t get_film_held_count()
const;
436 void set_film_held_count(
size_t count );
438 float get_film_frame_rate ()
const;
439 void set_film_frame_rate (
float len );
441 float get_film_shutter_angle()
const;
442 void set_film_shutter_angle(
float );
444 std::string get_film_frame_id()
const;
445 void set_film_frame_id(
const std::string& str);
447 std::string get_film_slate_info()
const;
448 void set_film_slate_info(
const std::string& str);
451 size_t get_tv_timecode()
const;
452 void set_tv_timecode(
size_t tc);
454 size_t get_tv_userbits()
const;
455 void set_tv_userbits(
size_t tc);
457 float get_tv_frame_rate()
const;
458 void set_tv_frame_rate(
float fr);
460 uint8_t get_tv_interlace()
const;
461 void set_tv_interlace(uint8_t interlace);