forked from LASzip/LASzip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
laswriteitemcompressed_v3.hpp
244 lines (164 loc) · 5.8 KB
/
laswriteitemcompressed_v3.hpp
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
/*
===============================================================================
FILE: laswriteitemcompressed_v3.hpp
CONTENTS:
Native extension for compressing the *new* point types 6 to 10 of LAS 1.4
PROGRAMMERS:
[email protected] - https://rapidlasso.com
COPYRIGHT:
(c) 2007-2017, martin isenburg, rapidlasso - fast tools to catch reality
This is free software; you can redistribute and/or modify it under the
terms of the GNU Lesser General Licence as published by the Free Software
Foundation. See the COPYING file for more information.
This software is distributed WITHOUT ANY WARRANTY and without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CHANGE HISTORY:
28 August 2017 -- moving 'context' from global development hack to interface
22 August 2016 -- finalizing at Basecamp in Bonn during FOSS4g hackfest
23 February 2016 -- created at OSGeo Code Sprint in Paris to prototype
===============================================================================
*/
#ifndef LAS_WRITE_ITEM_COMPRESSED_V3_HPP
#define LAS_WRITE_ITEM_COMPRESSED_V3_HPP
#include "laswriteitem.hpp"
#include "arithmeticencoder.hpp"
#include "integercompressor.hpp"
#include "bytestreamout_array.hpp"
#include "laszip_common_v3.hpp"
class LASwriteItemCompressed_POINT14_v3 : public LASwriteItemCompressed
{
public:
LASwriteItemCompressed_POINT14_v3(ArithmeticEncoder* enc);
BOOL init(const U8* item, U32& context);
BOOL write(const U8* item, U32& context);
BOOL chunk_sizes();
BOOL chunk_bytes();
~LASwriteItemCompressed_POINT14_v3();
private:
/* not used as a encoder. just gives access to outstream */
ArithmeticEncoder* enc;
ByteStreamOutArray* outstream_channel_returns_XY;
ByteStreamOutArray* outstream_Z;
ByteStreamOutArray* outstream_classification;
ByteStreamOutArray* outstream_flags;
ByteStreamOutArray* outstream_intensity;
ByteStreamOutArray* outstream_scan_angle;
ByteStreamOutArray* outstream_user_data;
ByteStreamOutArray* outstream_point_source;
ByteStreamOutArray* outstream_gps_time;
ArithmeticEncoder* enc_channel_returns_XY;
ArithmeticEncoder* enc_Z;
ArithmeticEncoder* enc_classification;
ArithmeticEncoder* enc_flags;
ArithmeticEncoder* enc_intensity;
ArithmeticEncoder* enc_scan_angle;
ArithmeticEncoder* enc_user_data;
ArithmeticEncoder* enc_point_source;
ArithmeticEncoder* enc_gps_time;
BOOL changed_classification;
BOOL changed_flags;
BOOL changed_intensity;
BOOL changed_scan_angle;
BOOL changed_user_data;
BOOL changed_point_source;
BOOL changed_gps_time;
U32 num_bytes_channel_returns_XY;
U32 num_bytes_Z;
U32 num_bytes_classification;
U32 num_bytes_flags;
U32 num_bytes_intensity;
U32 num_bytes_scan_angle;
U32 num_bytes_user_data;
U32 num_bytes_point_source;
U32 num_bytes_gps_time;
U32 current_context;
LAScontextPOINT14 contexts[4];
BOOL createAndInitModelsAndCompressors(U32 context, const U8* item);
void write_gps_time(const U64I64F64 gps_time);
};
class LASwriteItemCompressed_RGB14_v3 : public LASwriteItemCompressed
{
public:
LASwriteItemCompressed_RGB14_v3(ArithmeticEncoder* enc);
BOOL init(const U8* item, U32& context);
BOOL write(const U8* item, U32& context);
BOOL chunk_sizes();
BOOL chunk_bytes();
~LASwriteItemCompressed_RGB14_v3();
private:
/* not used as a encoder. just gives access to outstream */
ArithmeticEncoder* enc;
ByteStreamOutArray* outstream_RGB;
ArithmeticEncoder* enc_RGB;
BOOL changed_RGB;
U32 num_bytes_RGB;
U32 current_context;
LAScontextRGB14 contexts[4];
BOOL createAndInitModelsAndCompressors(U32 context, const U8* item);
};
class LASwriteItemCompressed_RGBNIR14_v3 : public LASwriteItemCompressed
{
public:
LASwriteItemCompressed_RGBNIR14_v3(ArithmeticEncoder* enc);
BOOL init(const U8* item, U32& context);
BOOL write(const U8* item, U32& context);
BOOL chunk_sizes();
BOOL chunk_bytes();
~LASwriteItemCompressed_RGBNIR14_v3();
private:
/* not used as a encoder. just gives access to outstream */
ArithmeticEncoder* enc;
ByteStreamOutArray* outstream_RGB;
ByteStreamOutArray* outstream_NIR;
ArithmeticEncoder* enc_RGB;
ArithmeticEncoder* enc_NIR;
BOOL changed_RGB;
BOOL changed_NIR;
U32 num_bytes_RGB;
U32 num_bytes_NIR;
U32 current_context;
LAScontextRGBNIR14 contexts[4];
BOOL createAndInitModelsAndCompressors(U32 context, const U8* item);
};
class LASwriteItemCompressed_WAVEPACKET14_v3 : public LASwriteItemCompressed
{
public:
LASwriteItemCompressed_WAVEPACKET14_v3(ArithmeticEncoder* enc);
BOOL init(const U8* item, U32& context);
BOOL write(const U8* item, U32& context);
BOOL chunk_sizes();
BOOL chunk_bytes();
~LASwriteItemCompressed_WAVEPACKET14_v3();
private:
/* not used as a encoder. just gives access to outstream */
ArithmeticEncoder* enc;
ByteStreamOutArray* outstream_wavepacket;
ArithmeticEncoder* enc_wavepacket;
BOOL changed_wavepacket;
U32 num_bytes_wavepacket;
U32 current_context;
LAScontextWAVEPACKET14 contexts[4];
BOOL createAndInitModelsAndCompressors(U32 context, const U8* item);
};
class LASwriteItemCompressed_BYTE14_v3 : public LASwriteItemCompressed
{
public:
LASwriteItemCompressed_BYTE14_v3(ArithmeticEncoder* enc, U32 number);
BOOL init(const U8* item, U32& context);
BOOL write(const U8* item, U32& context);
BOOL chunk_sizes();
BOOL chunk_bytes();
~LASwriteItemCompressed_BYTE14_v3();
private:
/* not used as a encoder. just gives access to outstream */
ArithmeticEncoder* enc;
ByteStreamOutArray** outstream_Bytes;
ArithmeticEncoder** enc_Bytes;
U32* num_bytes_Bytes;
BOOL* changed_Bytes;
U32 current_context;
LAScontextBYTE14 contexts[4];
U32 number;
BOOL createAndInitModelsAndCompressors(U32 context, const U8* item);
};
#endif