File: XnDeviceFileReaderBC.h

package info (click to toggle)
openni-sensor-pointclouds 5.1.0.41.9-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,648 kB
  • sloc: cpp: 34,881; ansic: 14,901; sh: 245; python: 155; makefile: 93; xml: 8
file content (397 lines) | stat: -rw-r--r-- 14,346 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
/****************************************************************************
*                                                                           *
*  PrimeSense Sensor 5.x Alpha                                              *
*  Copyright (C) 2011 PrimeSense Ltd.                                       *
*                                                                           *
*  This file is part of PrimeSense Sensor.                                  *
*                                                                           *
*  PrimeSense Sensor is free software: you can redistribute it and/or modify*
*  it under the terms of the GNU Lesser General Public License as published *
*  by the Free Software Foundation, either version 3 of the License, or     *
*  (at your option) any later version.                                      *
*                                                                           *
*  PrimeSense Sensor is distributed in the hope that it will be useful,     *
*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the             *
*  GNU Lesser General Public License for more details.                      *
*                                                                           *
*  You should have received a copy of the GNU Lesser General Public License *
*  along with PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>.*
*                                                                           *
****************************************************************************/
#ifndef _XN_DEVICE_FILE_READER_BC_H_
#define _XN_DEVICE_FILE_READER_BC_H_

//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include "XnDeviceFile.h"

#define _XN_IO_BC
#include <XnStream.h>

//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
#pragma pack (push, 1)

typedef struct XnPackedStreamProperties
{
	XnStreamDepthCompressionFormat StreamDepthCompressionFormat;
	XnStreamImageCompressionFormat StreamImageCompressionFormat;
	XnStreamMiscCompressionFormat StreamMiscCompressionFormat;
	XnStreamAudioCompressionFormat StreamAudioCompressionFormat;
} XnPackedStreamProperties;

typedef struct XnPackedStreamPropertiesV1
{
	XnStreamDepthCompressionFormat StreamDepthCompressionFormat;
	XnStreamImageCompressionFormat StreamImageCompressionFormat;
	XnStreamMiscCompressionFormat StreamMiscCompressionFormat;
} XnPackedStreamPropertiesV1;

typedef XnPackedStreamPropertiesV1 XnPackedStreamPropertiesV2;

typedef struct XnPackedStreamFrameHeaderV1
{
	XnUInt32 nCompDepthBufferSize;
	XnUInt32 nCompImageBufferSize;
	XnUInt32 nCompMiscBufferSize;
} XnPackedStreamFrameHeaderV1;

typedef XnPackedStreamFrameHeaderV1 XnPackedStreamFrameHeaderV2;

typedef struct XnPackedStreamFrameHeaderV3
{
	XnUInt32 nCompDepthBufferSize;
	XnUInt32 nCompImageBufferSize;
	XnUInt32 nCompMiscBufferSize;
	XnUInt32 nCompAudioBufferSize;
} XnPackedStreamFrameHeaderV3;

typedef struct XnShift2DepthStruct 
{
	/** True if shift-to-depth params are available. */
	XnBool		bShift2DepthData;
	XnUInt32	nConstShift;
	XnUInt32	nPixelSizeFactor;
	/** The maximum possible shift value from this device. */
	XnUInt32	nMaxShiftValue;
	/** The maximum possible depth from this device (as opposed to a cut-off). */
	XnUInt32	nMaxDepthValue;
	XnUInt32	nParamCoeff;
	XnUInt32	nShiftScale;
} XnShift2DepthStruct;

typedef struct XnStreamPropertiesV3
{
	/** A bit mask of Xiron stream flags. */
	XN_STREAM_FLAGS_TYPE	nStreamFlags;

	/** The number of frames in this Xiron stream. */
	XnUInt32				nNumOfFrames;

	/** The number of frames per second. Legal values are: 15-60.*/
	XnUInt8				nDepthFramesPerSecond;
	XnUInt8				nImageFramesPerSecond;

	/** Padding. */
	XnUInt16				nReserved;

	/** The depth buffer format. */
	XnStreamDepthFormat		DepthFormat;
	/** The depth X resolution. Legal values are: 160-640 and must be a multiple of 4. */
	XnUInt16				nDepthXRes;
	/** The depth Y resolution. Legal values are: 120-512 and must be a multiple of 4. */
	XnUInt16				nDepthYRes;
	/** The depth buffer size in bytes. OpenDevice will automatically update this field to the correct size.*/
	XnUInt32				nDepthBufferSize;
	/** The depth buffer element size in bits. */
	XnUInt32				nDepthTypeBitSize;

	/** The minimum depth value in the depth buffer. */
	XnDepthPixel			nDepthMinValue;
	/** The maximum depth value in the depth buffer. */
	XnDepthPixel			nDepthMaxValue;
	/** The value that represents no-sample in the depth buffer. */
	XnDepthPixel			nDepthNoSampleValue;
	/** The value that represents shadow in the depth buffer. */
	XnDepthPixel			nDepthShadowValue;

	/** The image buffer format. */
	XnStreamImageFormat		ImageFormat;
	/** The image X resolution. Legal values are: 160-640 and must be a multiply of 4. */
	XnUInt16				nImageXRes;
	/** The image Y resolution. Legal values are: 120-512 and must be a multiply of 4. */
	XnUInt16				nImageYRes;
	/** The image buffer size in bytes. OpenDevice will automatically update this field to the correct size.*/
	XnUInt32				nImageBufferSize;
	/** The image buffer element size in bits. */
	XnUInt32				nImageTypeBitSize;

	/** The audio buffer format. */
	XnStreamAudioFormat		AudioFormat;
	/** The number of audio channels. */
	XnUInt8				nAudioNumOfChannels;

	/** Padding. */
	XnUInt8				nReserved2;
	XnUInt16				nReserved3;

	/** The audio sample rate. */
	XnSampleRate		nAudioSampleRate;
	/** The audio buffer size in bytes. OpenDevice will automatically update this field to the correct size.*/
	XnUInt32				nAudioBufferSize;
	/** Audio read mode. */
	XnAudioReadMode			AudioReadMode;
	/** When AudioReadMode is XN_AUDIO_READ_STREAM, this member is the number of bytes that will be read each time. */
	XnUInt32				nAudioReadChunkSize;

	/** The miscellaneous buffer format. */
	XnStreamMiscFormat		MiscFormat;
	/** The miscellaneous buffer size in bytes. OpenDevice will automatically update this field to the correct size.*/
	XnUInt32				nMiscBufferSize;
	/** The miscellaneous buffer element size in bits. */
	XnUInt32				nMiscTypeBitSize;

	/** The zero plane distance in depth units. */
	XnDepthPixel			nZeroPlaneDistance;

	/** Padding. */
	XnUInt16				nReserved4;

	/** The zero plane pixel size */
	XnFloat				fZeroPlanePixelSize;
	/** The distance between the emitter and the Depth Cmos */
	XnFloat				fEmitterDCmosDistance;

	/** Information relevant for Shift2Depth */
	XnShift2DepthStruct		Shift2DepthData;

} XnStreamPropertiesV3;

#pragma pack (pop)

typedef struct XnStreamPropertiesV2
{
	/** A bit mask of Xiron stream flags. */
	XN_STREAM_FLAGS_TYPE	nStreamFlags;

	/** The number of frames in this Xiron stream. */
	XnUInt32				nNumOfFrames;
	/** The number of frames per second. Legal values are: 15-60.*/
	XnUInt8				nDepthFramesPerSecond;
	XnUInt8				nImageFramesPerSecond;

	/** The depth buffer format. */
	XnStreamDepthFormat		DepthFormat;
	/** The depth X resolution. Legal values are: 160-640 and must be a multiple of 4. */
	XnUInt16				nDepthXRes;
	/** The depth Y resolution. Legal values are: 120-512 and must be a multiple of 4. */
	XnUInt16				nDepthYRes;
	/** The depth buffer size in bytes. OpenDevice will automatically update this field to the correct size.*/
	XnUInt32				nDepthBufferSize;
	/** The depth buffer element size in bits. */
	XnUInt32				nDepthTypeBitSize;

	/** The minimum depth value in the depth buffer. */
	XnDepthPixel			nDepthMinValue;
	/** The maximum depth value in the depth buffer. */
	XnDepthPixel			nDepthMaxValue;
	/** The value that represents no-sample in the depth buffer. */
	XnDepthPixel			nDepthNoSampleValue;
	/** The value that represents shadow in the depth buffer. */
	XnDepthPixel			nDepthShadowValue;

	/** The image buffer format. */
	XnStreamImageFormat		ImageFormat;
	/** The image X resolution. Legal values are: 160-640 and must be a multiply of 4. */
	XnUInt16				nImageXRes;
	/** The image Y resolution. Legal values are: 120-512 and must be a multiply of 4. */
	XnUInt16				nImageYRes;
	/** The image buffer size in bytes. OpenDevice will automatically update this field to the correct size.*/
	XnUInt32				nImageBufferSize;
	/** The image buffer element size in bits. */
	XnUInt32				nImageTypeBitSize;

	/** The miscellaneous buffer format. */
	XnStreamMiscFormat		MiscFormat;
	/** The miscellaneous buffer size in bytes. OpenDevice will automatically update this field to the correct size.*/
	XnUInt32				nMiscBufferSize;
	/** The miscellaneous buffer element size in bits. */
	XnUInt32				nMiscTypeBitSize;

	/** The zero plane distance in depth units. */
	XnDepthPixel			nZeroPlaneDistance;
	/** The zero plane pixel size */
	XnFloat				fZeroPlanePixelSize;
	/** The distance between the emitter and the Depth Cmos */
	XnFloat				fEmitterDCmosDistance;

	/** Information relevant for Shift2Depth */
	struct {
		XnBool		bShift2DepthData;
		XnUInt32	nConstShift;
		XnUInt32	nPixelSizeFactor;
		XnUInt32	nMaxShiftValue;
		XnUInt32	nMaxDepthValue;
		XnUInt32	nParamCoeff;
		XnUInt32	nShiftScale;
	} Shift2DepthData;

} XnStreamPropertiesV2;

typedef struct XnStreamPropertiesV1
{
	/** A bit mask of Xiron stream flags. */
	XN_STREAM_FLAGS_TYPE	nStreamFlags;

	/** The number of frames in this Xiron stream. */
	XnUInt32				nNumOfFrames;
	/** The number of frames per second. Legal values are: 15-60.*/
	XnUInt8				nFramesPerSecond;

	/** The depth buffer format. */
	XnStreamDepthFormat		DepthFormat;
	/** The depth X resolution. Legal values are: 160-640 and must be a multiple of 4. */
	XnUInt16				nDepthXRes;
	/** The depth Y resolution. Legal values are: 120-512 and must be a multiple of 4. */
	XnUInt16				nDepthYRes;
	/** The depth buffer size in bytes. OpenDevice will automatically update this field to the correct size.*/
	XnUInt32				nDepthBufferSize;
	/** The depth buffer element size in bits. */
	XnUInt32				nDepthTypeBitSize;

	/** The minimum depth value in the depth buffer. */
	XnDepthPixel			nDepthMinValue;
	/** The maximum depth value in the depth buffer. */
	XnDepthPixel			nDepthMaxValue;
	/** The value that represents no-sample in the depth buffer. */
	XnDepthPixel			nDepthNoSampleValue;
	/** The value that represents shadow in the depth buffer. */
	XnDepthPixel			nDepthShadowValue;

	/** The image buffer format. */
	XnStreamImageFormat		ImageFormat;
	/** The image X resolution. Legal values are: 160-640 and must be a multiply of 4. */
	XnUInt16				nImageXRes;
	/** The image Y resolution. Legal values are: 120-512 and must be a multiply of 4. */
	XnUInt16				nImageYRes;
	/** The image buffer size in bytes. OpenDevice will automatically update this field to the correct size.*/
	XnUInt32				nImageBufferSize;
	/** The image buffer element size in bits. */
	XnUInt32				nImageTypeBitSize;

	/** The miscellaneous buffer format. */
	XnStreamMiscFormat		MiscFormat;
	/** The miscellaneous buffer size in bytes. OpenDevice will automatically update this field to the correct size.*/
	XnUInt32				nMiscBufferSize;
	/** The miscellaneous buffer element size in bits. */
	XnUInt32				nMiscTypeBitSize;

	/** The zero plane distance in depth units. */
	XnDepthPixel			nZeroPlaneDistance;
	/** The zero plane pixel size */
	XnFloat				fZeroPlanePixelSize;
} XnStreamPropertiesV1;

/**
  * Describes the Xiron stream frame properties.
  * Every single frame of the stream should have one defined.
  */
typedef struct XnStreamFramePropertiesV2
{
	union
	{
		/** Backward compatibility - general ID equals the Depth Frame ID */
		XnUInt32	nFrameID;
		/** The frame id of this stream frame. */
		XnUInt32	nDepthFrameID;
	};
	XnUInt32	nImageFrameID;

	union
	{
		/** Backward compatibility - general TimeStamp equals the Depth Frame ID */
		XnUInt64	nTimeStamp;
		/** The creation time of this stream frame. */
		XnUInt64	nDepthTimeStamp;
	};

	XnUInt64	nImageTimeStamp;
} XnStreamFramePropertiesV2;

typedef struct XnStreamFramePropertiesV1
{
	/** The frame id of this stream frame. */
	XnUInt32	nFrameID;

	/** The creation time of this stream frame. */
	XnUInt64	nTimeStamp;
} XnStreamFramePropertiesV1;

typedef struct XnDeviceFileHeaderV3
{
	XnChar cpMagic[XN_DEVICE_FILE_MAGIC_LEN];
	XnUInt16 nMajorVersion;
	XnUInt16 nMinorVersion;
	XnStreamProperties StreamProperties;
	XnPackedStreamProperties PackedStreamProperties;
} XnDeviceFileHeaderV3;

typedef struct XnDeviceFileHeaderV2
{
	XnChar cpMagic[XN_DEVICE_FILE_MAGIC_LEN];
	XnStreamPropertiesV2 StreamProperties;
	XnPackedStreamPropertiesV2 PackedStreamProperties;
} XnDeviceFileHeaderV2;

typedef struct XnDeviceFileHeaderV1
{
	XnChar cpMagic[XN_DEVICE_FILE_MAGIC_LEN];
	XnStreamPropertiesV1 StreamProperties;
	XnPackedStreamPropertiesV1 PackedStreamProperties;
} XnDeviceFileHeaderV1;

typedef struct XnDeviceFileFrameHeaderV3
{
	XnUInt32 nPackedStreamSize;
	XnUInt32 nReserved;
	XnStreamFrameProperties FrameProperties;
} XnDeviceFileFrameHeaderV3;

typedef struct XnDeviceFileFrameHeaderV2
{
	XnUInt32 nPackedStreamSize;
	XnStreamFramePropertiesV2 FrameProperties;
} XnDeviceFileFrameHeaderV2;

typedef struct XnDeviceFileFrameHeaderV1
{
	XnUInt32 nPackedStreamSize;
	XnStreamFramePropertiesV1 FrameProperties;
} XnDeviceFileFrameHeaderV1;

typedef struct XnFileBCData
{
	XN_FILE_HANDLE	FileHandle;

	XnUInt32	nFramePos;

	XnPackedStreamProperties	PackedStreamProperties;
	XnUInt8*					pPackedStreamBuffer;
	XnUInt32					nPackedStreamBufferSize;

	XnStreamPropertiesV3		StreamProperties;
} XnFileBCData;

typedef struct XnDeviceFileHeader
{
	XnChar cpMagic[XN_DEVICE_FILE_MAGIC_LEN];
	XnUInt16 nMajorVersion;
	XnUInt16 nMinorVersion;
	XnStreamProperties StreamProperties;
	XnPackedStreamProperties PackedStreamProperties;
} XnDeviceFileHeader;

#endif //_XN_DEVICE_FILE_READER_BC_H_