Libmpo  Build #33
A WIP library to decode and encode MPO (multiple picture object) files
 All Data Structures Files Functions Variables Enumerations Enumerator
mpo.h
Go to the documentation of this file.
1 #ifndef MPO_H_INCLUDED
2 #define MPO_H_INCLUDED
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <jpeglib.h>
6 
7 
8 #include <stdint.h>
9 #include <stdbool.h>
10 
11 #ifdef NDEBUG
12 #define mpo_printf(args...) ((void)0)
13 #else
14 #define mpo_printf(args...) printf(args)
15 #endif
16 
24 typedef enum
25 {
26  MPF_BYTE = 1,
27  MPF_ASCII = 2,
28  MPF_SHORT = 3,
29  MPF_LONG = 4,
32  MPF_SLONG = 9,
34 }
36 
37 
38 typedef uint8_t MPFByte; /* 1 byte */
39 typedef int8_t MPFSByte; /* 1 byte */
40 typedef char * MPFAscii;
41 typedef uint16_t MPFShort; /* 2 bytes */
42 typedef int16_t MPFSShort; /* 2 bytes */
43 typedef uint32_t MPFLong; /* 4 bytes */
44 typedef int32_t MPFSLong; /* 4 bytes */
45 typedef struct {MPFLong numerator; MPFLong denominator;} MPFRational;
46 typedef unsigned char MPFUndefined; /* 1 byte */
47 typedef struct {MPFSLong numerator; MPFSLong denominator;} MPFSRational;
48 
49 typedef struct
50 {
51  MPFByte * buffer;
52  long _cur;
53  long _size;
54 }
55 MPFbuffer;
56 
57 typedef MPFbuffer * MPFbuffer_ptr;
58 
64 typedef enum{ MPF_LITTLE_ENDIAN = 0x49492A00,
65  MPF_BIG_ENDIAN = 0x4D4D002A }MPExt_ByteOrder;
66 
72 typedef enum
73 {
74  /*MP Index IFD*/
75 
76 
79  MPTag_MPFVersion = 0xB000,
81  MPTag_MPEntry = 0xB002,
83 
84 
87  //TODO : implement those tags
91 
94 
117  MPTag_YawAngle = 0xb20b,
121  MPTag_RollAngle = 0xb20d,
122 
124 }MPExt_MPTags;
125 
126 typedef union
127 {
128  INT32 value;
129  struct {
130  unsigned int MPTypeCode:24;
131  unsigned int imgType:3;
132  unsigned int reserved:2;
133  unsigned int representativeImage:1;
134  unsigned int dependentChild:1;
135  unsigned int dependentParent:1;
136  } data;
137 }
139 
140 
148 typedef enum
149 {
157  MPType_Baseline =0x30000
158 }
160 
161 typedef struct
162 {
163  MPFShort type;
164  MPFLong EntriesTabLength;
165  MPFLong dataOffset;
167 
168 typedef struct
169 {
170  MPExt_IndividualImageAttr individualImgAttr;
171  MPFLong size;
172  MPFLong offset;
173  MPFShort dependentImageEntry1;
174  MPFShort dependentImageEntry2;
175 } MPExt_MPEntry;
176 
182 typedef struct
183 {
187  MPFLong IndividualNum;
188 
191 
195  MPFLong PanOrientation;
207 
211  MPFLong BaseViewpointNum;
212  MPFSRational ConvergenceAngle;
213  MPFRational BaselineLength;
214  MPFSRational VerticalDivergence;
216 
219 
226 
230 
238 
242  boolean is_specified[MPTag_RollAngle-MPTag_IndividualNum+1];
244 
245 #define ATTR_IS_SPECIFIED(attr,tag) ((attr).is_specified[(tag)-MPTag_IndividualNum])
246 
247 
248 typedef struct
249 {
250  MPFUndefined MPF_identifier[4];
254  /*MP Index IFD*/
255  INT16 count;
256  char version[4];
257  MPFLong numberOfImages;
258  MPFLong currentEntry;
260  MPFLong nextIFDOffset;
262  MPFShort count_attr_IFD;
267 } MPExt_Data;
268 
269 typedef struct
270 {
272  struct jpeg_compress_struct *cinfo;
273  JOCTET ** images_data;
275 
276 
277 bool MPExtReadMPF (MPFbuffer_ptr b,MPExt_Data *data,int isFirstImage);
278 
279 char isLittleEndian();
280 void destroyMPF_Data(MPExt_Data *data);
281 
282 
283 
284 #endif // MPO_H_INCLUDED
Definition: mpo.h:26
MPExt_MPEntryIndexFields EntryIndex
Definition: mpo.h:259
MPFSRational AxisDistanceY
Distance to the Horizontal axis of the Target Object.
Definition: mpo.h:222
Definition: mpo.h:28
MPExt_ByteOrder byte_order
Definition: mpo.h:252
Definition: mpo.h:49
MPExt_Data * APP02
Definition: mpo.h:271
Definition: mpo.h:101
MPFRational PanOverlapV
Panorama Scanning Orientation.
Definition: mpo.h:205
Definition: mpo.h:45
MPExt_MPEntry * MPentry
Definition: mpo.h:265
MPFSRational YawAngle
Vertical axis angle.
Definition: mpo.h:232
Definition: mpo.h:155
MPFLong numberOfImages
Definition: mpo.h:257
MPFRational PanOverlapH
Panorama Scanning Orientation.
Definition: mpo.h:200
Definition: mpo.h:113
Definition: mpo.h:99
Definition: mpo.h:121
Definition: mpo.h:89
Definition: mpo.h:248
Definition: mpo.h:107
Definition: mpo.h:103
Definition: mpo.h:81
Definition: mpo.h:33
Definition: mpo.h:150
Definition: mpo.h:27
Definition: mpo.h:161
MPFSRational PitchAngle
Horizontal axis angle.
Definition: mpo.h:234
Definition: mpo.h:154
JOCTET ** images_data
Definition: mpo.h:273
Definition: mpo.h:152
Individual image tags (attributes)
Definition: mpo.h:95
Definition: mpo.h:126
MPFLong IndividualNum
Number of the Individual Image.
Definition: mpo.h:187
MPFLong first_IFD_offset
Definition: mpo.h:253
Definition: mpo.h:29
MPExt_MPTags
Definition: mpo.h:72
Definition: mpo.h:30
Definition: mpo.h:88
Definition: mpo.h:111
Definition: mpo.h:115
Definition: mpo.h:156
Definition: mpo.h:32
Definition: mpo.h:151
Definition: mpo.h:105
Definition: mpo.h:182
MPExt_ImageAttr attributes
Definition: mpo.h:263
Definition: mpo.h:79
Definition: mpo.h:109
Definition: mpo.h:157
MPFShort count_attr_IFD
Definition: mpo.h:262
size_t start_of_offset
Definition: mpo.h:251
Definition: mpo.h:153
MPFVal_types
Definition: mpo.h:24
Definition: mpo.h:168
Definition: mpo.h:117
MPFLong PanOrientation
Panorama Scanning Orientation.
Definition: mpo.h:195
Definition: mpo.h:269
MPFSRational RollAngle
Collimation axis angle.
Definition: mpo.h:236
MPFSRational AxisDistanceZ
Distance to the Collimation axis of the Target Object.
Definition: mpo.h:224
Definition: mpo.h:31
MPExt_MPType
Definition: mpo.h:148
MPExt_ByteOrder
Definition: mpo.h:64
Definition: mpo.h:80
Definition: mpo.h:47
MPFSRational AxisDistanceX
Distance to the Vertical axis of the Target Object.
Definition: mpo.h:220
INT16 count
Definition: mpo.h:255
MPFLong nextIFDOffset
Definition: mpo.h:260
Definition: mpo.h:119
Definition: mpo.h:97