00001 //----------------------------------------------------------------------------- 00002 // 00003 // ImageLib Sources 00004 // Copyright (C) 2000-2009 by Denton Woods 00005 // Last modified: 02/26/2009 00006 // 00007 // Filename: src-IL/include/il_dpx.h 00008 // 00009 // Description: Reads from a Digital Picture Exchange (.dpx) file. 00010 // Specifications for this format were found at 00011 // http://www.cineon.com/ff_draft.php and 00012 // http://www.fileformat.info/format/dpx/. 00013 // 00014 //----------------------------------------------------------------------------- 00015 00016 00017 #ifndef DPX_H 00018 #define DPX_H 00019 00020 #include "il_internal.h" 00021 00022 00023 #ifdef _WIN32 00024 #pragma pack(push, packed_struct, 1) 00025 #endif 00026 typedef struct R32 00027 { 00028 ILubyte r, g, b, a; 00029 } IL_PACKSTRUCT R32; 00030 #ifdef _WIN32 00031 #pragma pack(pop, packed_struct) 00032 #endif 00033 00034 00035 typedef struct DPX_FILE_INFO 00036 { 00037 ILuint MagicNum; /* magic number 0x53445058 (SDPX) or 0x58504453 (XPDS) */ 00038 ILuint Offset; /* offset to image data in bytes */ 00039 ILbyte Vers[8]; /* which header format version is being used (v1.0)*/ 00040 ILuint FileSize; /* file size in bytes */ 00041 ILuint DittoKey; /* read time short cut - 0 = same, 1 = new */ 00042 ILuint GenHdrSize; /* generic header length in bytes */ 00043 ILuint IndHdrSize; /* industry header length in bytes */ 00044 ILuint UserDataSize; /* user-defined data length in bytes */ 00045 ILbyte FileName[100]; /* image file name */ 00046 ILbyte CreateTime[24]; /* file creation date "yyyy:mm:dd:hh:mm:ss:LTZ" */ 00047 ILbyte Creator[100]; /* file creator's name */ 00048 ILbyte Project[200]; /* project name */ 00049 ILbyte Copyright[200]; /* right to use or copyright info */ 00050 ILuint Key; /* encryption ( FFFFFFFF = unencrypted ) */ 00051 ILbyte Reserved[104]; /* reserved field TBD (need to pad) */ 00052 } DPX_FILE_INFO; 00053 00054 typedef struct DPX_IMAGE_ELEMENT 00055 { 00056 ILuint DataSign; /* data sign (0 = unsigned, 1 = signed ) */ 00057 /* "Core set images are unsigned" */ 00058 ILuint RefLowData; /* reference low data code value */ 00059 R32 RefLowQuantity; /* reference low quantity represented */ 00060 ILuint RefHighData; /* reference high data code value */ 00061 R32 RefHighQuantity;/* reference high quantity represented */ 00062 ILubyte Descriptor; /* descriptor for image element */ 00063 ILubyte Transfer; /* transfer characteristics for element */ 00064 ILubyte Colorimetric; /* colormetric specification for element */ 00065 ILubyte BitSize; /* bit size for element */ 00066 ILushort Packing; /* packing for element */ 00067 ILushort Encoding; /* encoding for element */ 00068 ILuint DataOffset; /* offset to data of element */ 00069 ILuint EolPadding; /* end of line padding used in element */ 00070 ILuint EoImagePadding; /* end of image padding used in element */ 00071 ILbyte Description[32];/* description of element */ 00072 } DPX_IMAGE_ELEMENT; /* NOTE THERE ARE EIGHT OF THESE */ 00073 00074 00075 typedef struct DPX_IMAGE_INFO 00076 { 00077 ILushort Orientation; /* image orientation */ 00078 ILushort NumElements; /* number of image elements */ 00079 ILuint Width; /* or x value */ 00080 ILuint Height; /* or y value, per element */ 00081 DPX_IMAGE_ELEMENT ImageElement[8]; 00082 ILubyte reserved[52]; /* reserved for future use (padding) */ 00083 } DPX_IMAGE_INFO; 00084 00085 00086 typedef struct DPX_IMAGE_ORIENT 00087 { 00088 ILuint XOffset; /* X offset */ 00089 ILuint YOffset; /* Y offset */ 00090 R32 XCenter; /* X center */ 00091 R32 YCenter; /* Y center */ 00092 ILuint XOrigSize; /* X original size */ 00093 ILuint YOrigSize; /* Y original size */ 00094 ILbyte FileName[100]; /* source image file name */ 00095 ILbyte CreationTime[24]; /* source image creation date and time */ 00096 ILbyte InputDev[32]; /* input device name */ 00097 ILbyte InputSerial[32]; /* input device serial number */ 00098 ILushort Border[4]; /* border validity (XL, XR, YT, YB) */ 00099 ILuint PixelAspect[2]; /* pixel aspect ratio (H:V) */ 00100 ILubyte Reserved[28]; /* reserved for future use (padding) */ 00101 } DPX_IMAGE_ORIENT; 00102 00103 00104 typedef struct DPX_MOTION_PICTURE_HEAD 00105 { 00106 ILbyte film_mfg_id[2]; /* film manufacturer ID code (2 digits from film edge code) */ 00107 ILbyte film_type[2]; /* file type (2 digits from film edge code) */ 00108 ILbyte offset[2]; /* offset in perfs (2 digits from film edge code)*/ 00109 ILbyte prefix[6]; /* prefix (6 digits from film edge code) */ 00110 ILbyte count[4]; /* count (4 digits from film edge code)*/ 00111 ILbyte format[32]; /* format (i.e. academy) */ 00112 ILuint frame_position; /* frame position in sequence */ 00113 ILuint sequence_len; /* sequence length in frames */ 00114 ILuint held_count; /* held count (1 = default) */ 00115 R32 frame_rate; /* frame rate of original in frames/sec */ 00116 R32 shutter_angle; /* shutter angle of camera in degrees */ 00117 ILbyte frame_id[32]; /* frame identification (i.e. keyframe) */ 00118 ILbyte slate_info[100]; /* slate information */ 00119 ILubyte reserved[56]; /* reserved for future use (padding) */ 00120 } DPX_MOTION_PICTURE_HEAD; 00121 00122 00123 typedef struct DPX_TELEVISION_HEAD 00124 { 00125 ILuint tim_code; /* SMPTE time code */ 00126 ILuint userBits; /* SMPTE user bits */ 00127 ILubyte interlace; /* interlace ( 0 = noninterlaced, 1 = 2:1 interlace*/ 00128 ILubyte field_num; /* field number */ 00129 ILubyte video_signal; /* video signal standard (table 4)*/ 00130 ILubyte unused; /* used for byte alignment only */ 00131 R32 hor_sample_rate; /* horizontal sampling rate in Hz */ 00132 R32 ver_sample_rate; /* vertical sampling rate in Hz */ 00133 R32 frame_rate; /* temporal sampling rate or frame rate in Hz */ 00134 R32 time_offset; /* time offset from sync to first pixel */ 00135 R32 gamma; /* gamma value */ 00136 R32 black_level; /* black level code value */ 00137 R32 black_gain; /* black gain */ 00138 R32 break_point; /* breakpoint */ 00139 R32 white_level; /* reference white level code value */ 00140 R32 integration_times; /* integration time(s) */ 00141 ILubyte reserved[76]; /* reserved for future use (padding) */ 00142 } DPX_TELEVISION_HEAD; 00143 00144 00145 // For checking and reading 00146 ILboolean iIsValidDpx(void); 00147 //ILboolean iCheckDpx(DPXHEAD *Header); 00148 ILboolean iLoadDpxInternal(void); 00149 00150 #endif//PCX_H