75 for (i = 0; i < 256; i++)
78 m_classification[i] = 0;
91 delete ic_scan_angle_rank;
92 delete ic_point_source_ID;
93 dec->destroySymbolModel(m_changed_values);
94 for (i = 0; i < 256; i++)
96 if (m_bit_byte[i]) dec->destroySymbolModel(m_bit_byte[i]);
97 if (m_classification[i]) dec->destroySymbolModel(m_classification[i]);
98 if (m_user_data[i]) dec->destroySymbolModel(m_user_data[i]);
107 last_x_diff[0] = last_x_diff[1] = last_x_diff[2] = 0;
108 last_y_diff[0] = last_y_diff[1] = last_y_diff[2] = 0;
112 ic_dx->initDecompressor();
113 ic_dy->initDecompressor();
114 ic_z->initDecompressor();
115 ic_intensity->initDecompressor();
116 ic_scan_angle_rank->initDecompressor();
117 ic_point_source_ID->initDecompressor();
118 dec->initSymbolModel(m_changed_values);
119 for (i = 0; i < 256; i++)
121 if (m_bit_byte[i]) dec->initSymbolModel(m_bit_byte[i]);
122 if (m_classification[i]) dec->initSymbolModel(m_classification[i]);
123 if (m_user_data[i]) dec->initSymbolModel(m_user_data[i]);
127 memcpy(last_item, item, 20);
136 if (last_x_diff[0] < last_x_diff[1])
138 if (last_x_diff[1] < last_x_diff[2])
139 median_x = last_x_diff[1];
140 else if (last_x_diff[0] < last_x_diff[2])
141 median_x = last_x_diff[2];
143 median_x = last_x_diff[0];
147 if (last_x_diff[0] < last_x_diff[2])
148 median_x = last_x_diff[0];
149 else if (last_x_diff[1] < last_x_diff[2])
150 median_x = last_x_diff[2];
152 median_x = last_x_diff[1];
156 if (last_y_diff[0] < last_y_diff[1])
158 if (last_y_diff[1] < last_y_diff[2])
159 median_y = last_y_diff[1];
160 else if (last_y_diff[0] < last_y_diff[2])
161 median_y = last_y_diff[2];
163 median_y = last_y_diff[0];
167 if (last_y_diff[0] < last_y_diff[2])
168 median_y = last_y_diff[0];
169 else if (last_y_diff[1] < last_y_diff[2])
170 median_y = last_y_diff[2];
172 median_y = last_y_diff[1];
176 I32 x_diff = ic_dx->decompress(median_x);
179 U32 k_bits = ic_dx->getK();
180 I32 y_diff = ic_dy->decompress(median_y, (k_bits < 19 ? k_bits : 19));
182 k_bits = (k_bits + ic_dy->getK())/2;
183 ((
LASpoint10*)last_item)->z = ic_z->decompress(((
LASpoint10*)last_item)->
z, (k_bits < 19 ? k_bits : 19));
186 I32 changed_values = dec->decodeSymbol(m_changed_values);
191 if (changed_values & 32)
197 if (changed_values & 16)
199 if (m_bit_byte[last_item[14]] == 0)
201 m_bit_byte[last_item[14]] = dec->createSymbolModel(256);
202 dec->initSymbolModel(m_bit_byte[last_item[14]]);
204 last_item[14] = (
U8)dec->decodeSymbol(m_bit_byte[last_item[14]]);
208 if (changed_values & 8)
210 if (m_classification[last_item[15]] == 0)
212 m_classification[last_item[15]] = dec->createSymbolModel(256);
213 dec->initSymbolModel(m_classification[last_item[15]]);
215 last_item[15] = (
U8)dec->decodeSymbol(m_classification[last_item[15]]);
219 if (changed_values & 4)
221 last_item[16] = (
U8)ic_scan_angle_rank->decompress(last_item[16], k_bits < 3);
225 if (changed_values & 2)
227 if (m_user_data[last_item[17]] == 0)
229 m_user_data[last_item[17]] = dec->createSymbolModel(256);
230 dec->initSymbolModel(m_user_data[last_item[17]]);
232 last_item[17] = (
U8)dec->decodeSymbol(m_user_data[last_item[17]]);
236 if (changed_values & 1)
243 last_x_diff[last_incr] = x_diff;
244 last_y_diff[last_incr] = y_diff;
246 if (last_incr > 2) last_incr = 0;
249 memcpy(item, last_item, 20);
258 #define LASZIP_GPSTIME_MULTIMAX 512 273 dec->destroySymbolModel(m_gpstime_multi);
274 dec->destroySymbolModel(m_gpstime_0diff);
281 last_gpstime_diff = 0;
282 multi_extreme_counter = 0;
285 dec->initSymbolModel(m_gpstime_multi);
286 dec->initSymbolModel(m_gpstime_0diff);
287 ic_gpstime->initDecompressor();
290 last_gpstime.u64 = *((
U64*)item);
297 if (last_gpstime_diff == 0)
299 multi = dec->decodeSymbol(m_gpstime_0diff);
302 last_gpstime_diff = ic_gpstime->decompress(0, 0);
303 last_gpstime.i64 += last_gpstime_diff;
307 last_gpstime.u64 = dec->readInt64();
312 multi = dec->decodeSymbol(m_gpstime_multi);
319 gpstime_diff = ic_gpstime->decompress(last_gpstime_diff, 1);
320 last_gpstime_diff = gpstime_diff;
321 multi_extreme_counter = 0;
325 gpstime_diff = ic_gpstime->decompress(last_gpstime_diff/4, 2);
326 multi_extreme_counter++;
327 if (multi_extreme_counter > 3)
329 last_gpstime_diff = gpstime_diff;
330 multi_extreme_counter = 0;
335 gpstime_diff = ic_gpstime->decompress(multi*last_gpstime_diff, 3);
339 gpstime_diff = ic_gpstime->decompress(multi*last_gpstime_diff, 4);
343 gpstime_diff = ic_gpstime->decompress(multi*last_gpstime_diff, 5);
346 multi_extreme_counter++;
347 if (multi_extreme_counter > 3)
349 last_gpstime_diff = gpstime_diff;
350 multi_extreme_counter = 0;
354 last_gpstime.i64 += gpstime_diff;
358 last_gpstime.u64 = dec->readInt64();
361 *((
I64*)item) = last_gpstime.i64;
381 last_item =
new U8[6];
386 dec->destroySymbolModel(m_byte_used);
396 dec->initSymbolModel(m_byte_used);
397 ic_rgb->initDecompressor();
400 memcpy(last_item, item, 6);
406 U32 sym = dec->decodeSymbol(m_byte_used);
407 if (sym & (1 << 0)) ((
U16*)item)[0] = (
U16)ic_rgb->decompress(((
U16*)last_item)[0]&255, 0);
408 else ((
U16*)item)[0] = (
U16)(((
U16*)last_item)[0]&0xFF);
409 if (sym & (1 << 1)) ((
U16*)item)[0] |= (((
U16)ic_rgb->decompress(((
U16*)last_item)[0]>>8, 1)) << 8);
410 else ((
U16*)item)[0] |= (((
U16*)last_item)[0]&0xFF00);
411 if (sym & (1 << 2)) ((
U16*)item)[1] = (
U16)ic_rgb->decompress(((
U16*)last_item)[1]&255, 2);
412 else ((
U16*)item)[1] = (
U16)(((
U16*)last_item)[1]&0xFF);
413 if (sym & (1 << 3)) ((
U16*)item)[1] |= (((
U16)ic_rgb->decompress(((
U16*)last_item)[1]>>8, 3)) << 8);
414 else ((
U16*)item)[1] |= (((
U16*)last_item)[1]&0xFF00);
415 if (sym & (1 << 4)) ((
U16*)item)[2] = (
U16)ic_rgb->decompress(((
U16*)last_item)[2]&255, 4);
416 else ((
U16*)item)[2] = (
U16)(((
U16*)last_item)[2]&0xFF);
417 if (sym & (1 << 5)) ((
U16*)item)[2] |= (((
U16)ic_rgb->decompress(((
U16*)last_item)[2]>>8, 5)) << 8);
418 else ((
U16*)item)[2] |= (((
U16*)last_item)[2]&0xFF00);
419 memcpy(last_item, item, 6);
456 last_item =
new U8[28];
461 dec->destroySymbolModel(m_packet_index);
462 dec->destroyBitModel(m_offset_diff[0]);
463 dec->destroyBitModel(m_offset_diff[1]);
464 dec->destroyBitModel(m_offset_diff[2]);
465 dec->destroyBitModel(m_offset_diff[3]);
466 delete ic_offset_diff;
467 delete ic_packet_size;
468 delete ic_return_point;
477 sym_last_offset_diff = 0;
480 dec->initSymbolModel(m_packet_index);
481 dec->initSymbolModel(m_offset_diff[0]);
482 dec->initSymbolModel(m_offset_diff[1]);
483 dec->initSymbolModel(m_offset_diff[2]);
484 dec->initSymbolModel(m_offset_diff[3]);
485 ic_offset_diff->initDecompressor();
486 ic_packet_size->initDecompressor();
487 ic_return_point->initDecompressor();
488 ic_xyz->initDecompressor();
492 memcpy(last_item, item, 28);
498 item[0] = (
U8)(dec->decodeSymbol(m_packet_index));
501 sym_last_offset_diff = dec->decodeSymbol(m_offset_diff[sym_last_offset_diff]);
503 if (sym_last_offset_diff == 0)
507 else if (sym_last_offset_diff == 1)
511 else if (sym_last_offset_diff == 2)
513 last_diff_32 = ic_offset_diff->decompress(last_diff_32);
525 memcpy(last_item, item, 28);
540 this->number = number;
546 last_item =
new U8[number];
560 ic_byte->initDecompressor();
563 memcpy(last_item, item, number);
570 for (i = 0; i < number; i++)
572 item[i] = (
U8)(ic_byte->decompress(last_item[i], i));
574 memcpy(last_item, item, number);
LASreadItemCompressed_RGB12_v1(EntropyDecoder *dec)
~LASreadItemCompressed_RGB12_v1()
BOOL init(const U8 *item)
LASreadItemCompressed_BYTE_v1(EntropyDecoder *dec, U32 number)
BOOL init(const U8 *item)
U8 number_of_returns_of_given_pulse
LASreadItemCompressed_GPSTIME11_v1(EntropyDecoder *dec)
~LASreadItemCompressed_GPSTIME11_v1()
~LASreadItemCompressed_WAVEPACKET13_v1()
LASreadItemCompressed_WAVEPACKET13_v1(EntropyDecoder *dec)
virtual EntropyModel * createSymbolModel(U32 n)=0
BOOL init(const U8 *item)
~LASreadItemCompressed_BYTE_v1()
#define LASZIP_GPSTIME_MULTIMAX
BOOL init(const U8 *item)
BOOL init(const U8 *item)
LASreadItemCompressed_POINT10_v1(EntropyDecoder *dec)
~LASreadItemCompressed_POINT10_v1()