67 for (i = 0; i < 256; i++)
70 m_classification[i] = 0;
82 dec->destroySymbolModel(m_changed_values);
84 dec->destroySymbolModel(m_scan_angle_rank[0]);
85 dec->destroySymbolModel(m_scan_angle_rank[1]);
86 delete ic_point_source_ID;
87 for (i = 0; i < 256; i++)
89 if (m_bit_byte[i]) dec->destroySymbolModel(m_bit_byte[i]);
90 if (m_classification[i]) dec->destroySymbolModel(m_classification[i]);
91 if (m_user_data[i]) dec->destroySymbolModel(m_user_data[i]);
103 for (i=0; i < 16; i++)
105 last_x_diff_median5[i].init();
106 last_y_diff_median5[i].init();
107 last_intensity[i] = 0;
108 last_height[i/2] = 0;
112 dec->initSymbolModel(m_changed_values);
113 ic_intensity->initDecompressor();
114 dec->initSymbolModel(m_scan_angle_rank[0]);
115 dec->initSymbolModel(m_scan_angle_rank[1]);
116 ic_point_source_ID->initDecompressor();
117 for (i = 0; i < 256; i++)
119 if (m_bit_byte[i]) dec->initSymbolModel(m_bit_byte[i]);
120 if (m_classification[i]) dec->initSymbolModel(m_classification[i]);
121 if (m_user_data[i]) dec->initSymbolModel(m_user_data[i]);
123 ic_dx->initDecompressor();
124 ic_dy->initDecompressor();
125 ic_z->initDecompressor();
128 memcpy(last_item, item, 20);
144 I32 changed_values = dec->decodeSymbol(m_changed_values);
149 if (changed_values & 32)
151 if (m_bit_byte[last_item[14]] == 0)
153 m_bit_byte[last_item[14]] = dec->createSymbolModel(256);
154 dec->initSymbolModel(m_bit_byte[last_item[14]]);
156 last_item[14] = (
U8)dec->decodeSymbol(m_bit_byte[last_item[14]]);
160 n = ((
LASpoint10*)last_item)->number_of_returns_of_given_pulse;
165 if (changed_values & 16)
167 ((
LASpoint10*)last_item)->intensity = (
U16)ic_intensity->decompress(last_intensity[m], (m < 3 ? m : 3));
168 last_intensity[m] = ((
LASpoint10*)last_item)->intensity;
172 ((
LASpoint10*)last_item)->intensity = last_intensity[m];
176 if (changed_values & 8)
178 if (m_classification[last_item[15]] == 0)
180 m_classification[last_item[15]] = dec->createSymbolModel(256);
181 dec->initSymbolModel(m_classification[last_item[15]]);
183 last_item[15] = (
U8)dec->decodeSymbol(m_classification[last_item[15]]);
187 if (changed_values & 4)
190 last_item[16] =
U8_FOLD(val + last_item[16]);
194 if (changed_values & 2)
196 if (m_user_data[last_item[17]] == 0)
198 m_user_data[last_item[17]] = dec->createSymbolModel(256);
199 dec->initSymbolModel(m_user_data[last_item[17]]);
201 last_item[17] = (
U8)dec->decodeSymbol(m_user_data[last_item[17]]);
205 if (changed_values & 1)
207 ((
LASpoint10*)last_item)->point_source_ID = (
U16)ic_point_source_ID->decompress(((
LASpoint10*)last_item)->point_source_ID);
213 n = ((
LASpoint10*)last_item)->number_of_returns_of_given_pulse;
219 median = last_x_diff_median5[m].get();
220 diff = ic_dx->decompress(median, n==1);
222 last_x_diff_median5[m].add(diff);
225 median = last_y_diff_median5[m].get();
226 k_bits = ic_dx->getK();
227 diff = ic_dy->decompress(median, (n==1) + ( k_bits < 20 ?
U32_ZERO_BIT_0(k_bits) : 20 ));
229 last_y_diff_median5[m].add(diff);
232 k_bits = (ic_dx->getK() + ic_dy->getK()) / 2;
233 ((
LASpoint10*)last_item)->z = ic_z->decompress(last_height[l], (n==1) + (k_bits < 18 ?
U32_ZERO_BIT_0(k_bits) : 18));
237 memcpy(item, last_item, 20);
246 #define LASZIP_GPSTIME_MULTI 500 247 #define LASZIP_GPSTIME_MULTI_MINUS -10 248 #define LASZIP_GPSTIME_MULTI_UNCHANGED (LASZIP_GPSTIME_MULTI - LASZIP_GPSTIME_MULTI_MINUS + 1) 249 #define LASZIP_GPSTIME_MULTI_CODE_FULL (LASZIP_GPSTIME_MULTI - LASZIP_GPSTIME_MULTI_MINUS + 2) 251 #define LASZIP_GPSTIME_MULTI_TOTAL (LASZIP_GPSTIME_MULTI - LASZIP_GPSTIME_MULTI_MINUS + 6) 266 dec->destroySymbolModel(m_gpstime_multi);
267 dec->destroySymbolModel(m_gpstime_0diff);
275 last_gpstime_diff[0] = 0;
276 last_gpstime_diff[1] = 0;
277 last_gpstime_diff[2] = 0;
278 last_gpstime_diff[3] = 0;
279 multi_extreme_counter[0] = 0;
280 multi_extreme_counter[1] = 0;
281 multi_extreme_counter[2] = 0;
282 multi_extreme_counter[3] = 0;
285 dec->initSymbolModel(m_gpstime_multi);
286 dec->initSymbolModel(m_gpstime_0diff);
287 ic_gpstime->initDecompressor();
290 last_gpstime[0].u64 = *((
U64*)item);
291 last_gpstime[1].u64 = 0;
292 last_gpstime[2].u64 = 0;
293 last_gpstime[3].u64 = 0;
300 if (last_gpstime_diff[last] == 0)
302 multi = dec->decodeSymbol(m_gpstime_0diff);
305 last_gpstime_diff[last] = ic_gpstime->decompress(0, 0);
306 last_gpstime[last].i64 += last_gpstime_diff[last];
307 multi_extreme_counter[last] = 0;
312 last_gpstime[next].u64 = ic_gpstime->decompress((
I32)(last_gpstime[last].u64 >> 32), 8);
313 last_gpstime[next].u64 = last_gpstime[next].u64 << 32;
314 last_gpstime[next].u64 |= dec->readInt();
316 last_gpstime_diff[last] = 0;
317 multi_extreme_counter[last] = 0;
321 last = (last+multi-2)&3;
327 multi = dec->decodeSymbol(m_gpstime_multi);
330 last_gpstime[last].i64 += ic_gpstime->decompress(last_gpstime_diff[last], 1);;
331 multi_extreme_counter[last] = 0;
338 gpstime_diff = ic_gpstime->decompress(0, 7);
339 multi_extreme_counter[last]++;
340 if (multi_extreme_counter[last] > 3)
342 last_gpstime_diff[last] = gpstime_diff;
343 multi_extreme_counter[last] = 0;
349 gpstime_diff = ic_gpstime->decompress(multi*last_gpstime_diff[last], 2);
351 gpstime_diff = ic_gpstime->decompress(multi*last_gpstime_diff[last], 3);
356 multi_extreme_counter[last]++;
357 if (multi_extreme_counter[last] > 3)
359 last_gpstime_diff[last] = gpstime_diff;
360 multi_extreme_counter[last] = 0;
368 gpstime_diff = ic_gpstime->decompress(multi*last_gpstime_diff[last], 5);
373 multi_extreme_counter[last]++;
374 if (multi_extreme_counter[last] > 3)
376 last_gpstime_diff[last] = gpstime_diff;
377 multi_extreme_counter[last] = 0;
381 last_gpstime[last].i64 += gpstime_diff;
386 last_gpstime[next].u64 = ic_gpstime->decompress((
I32)(last_gpstime[last].u64 >> 32), 8);
387 last_gpstime[next].u64 = last_gpstime[next].u64 << 32;
388 last_gpstime[next].u64 |= dec->readInt();
390 last_gpstime_diff[last] = 0;
391 multi_extreme_counter[last] = 0;
399 *((
I64*)item) = last_gpstime[last].i64;
426 dec->destroySymbolModel(m_byte_used);
427 dec->destroySymbolModel(m_rgb_diff_0);
428 dec->destroySymbolModel(m_rgb_diff_1);
429 dec->destroySymbolModel(m_rgb_diff_2);
430 dec->destroySymbolModel(m_rgb_diff_3);
431 dec->destroySymbolModel(m_rgb_diff_4);
432 dec->destroySymbolModel(m_rgb_diff_5);
440 dec->initSymbolModel(m_byte_used);
441 dec->initSymbolModel(m_rgb_diff_0);
442 dec->initSymbolModel(m_rgb_diff_1);
443 dec->initSymbolModel(m_rgb_diff_2);
444 dec->initSymbolModel(m_rgb_diff_3);
445 dec->initSymbolModel(m_rgb_diff_4);
446 dec->initSymbolModel(m_rgb_diff_5);
449 memcpy(last_item, item, 6);
457 U32 sym = dec->decodeSymbol(m_byte_used);
460 corr = dec->decodeSymbol(m_rgb_diff_0);
465 ((
U16*)item)[0] = last_item[0]&0xFF;
469 corr = dec->decodeSymbol(m_rgb_diff_1);
470 ((
U16*)item)[0] |= (((
U16)
U8_FOLD(corr + (last_item[0]>>8))) << 8);
474 ((
U16*)item)[0] |= (last_item[0]&0xFF00);
478 diff = (((
U16*)item)[0]&0x00FF) - (last_item[0]&0x00FF);
481 corr = dec->decodeSymbol(m_rgb_diff_2);
486 ((
U16*)item)[1] = last_item[1]&0xFF;
490 corr = dec->decodeSymbol(m_rgb_diff_4);
491 diff = (diff + ((((
U16*)item)[1]&0x00FF) - (last_item[1]&0x00FF))) / 2;
496 ((
U16*)item)[2] = last_item[2]&0xFF;
498 diff = (((
U16*)item)[0]>>8) - (last_item[0]>>8);
501 corr = dec->decodeSymbol(m_rgb_diff_3);
506 ((
U16*)item)[1] |= (last_item[1]&0xFF00);
510 corr = dec->decodeSymbol(m_rgb_diff_5);
511 diff = (diff + ((((
U16*)item)[1]>>8) - (last_item[1]>>8))) / 2;
516 ((
U16*)item)[2] |= (last_item[2]&0xFF00);
521 ((
U16*)item)[1] = ((
U16*)item)[0];
522 ((
U16*)item)[2] = ((
U16*)item)[0];
524 memcpy(last_item, item, 6);
541 this->number = number;
544 m_byte =
new EntropyModel*[number];
545 for (i = 0; i < number; i++)
551 last_item =
new U8[number];
557 for (i = 0; i < number; i++)
559 dec->destroySymbolModel(m_byte[i]);
571 for (i = 0; i < number; i++)
573 dec->initSymbolModel(m_byte[i]);
577 memcpy(last_item, item, number);
585 for (i = 0; i < number; i++)
587 value = last_item[i] + dec->decodeSymbol(m_byte[i]);
590 memcpy(last_item, item, number);
LASreadItemCompressed_RGB12_v2(EntropyDecoder *dec)
LASreadItemCompressed_GPSTIME11_v2(EntropyDecoder *dec)
~LASreadItemCompressed_GPSTIME11_v2()
BOOL init(const U8 *item)
BOOL init(const U8 *item)
#define LASZIP_GPSTIME_MULTI_MINUS
#define U32_ZERO_BIT_0(n)
#define LASZIP_GPSTIME_MULTI_TOTAL
#define LASZIP_GPSTIME_MULTI_UNCHANGED
U8 number_of_returns_of_given_pulse
LASreadItemCompressed_POINT10_v2(EntropyDecoder *dec)
#define LASZIP_GPSTIME_MULTI_CODE_FULL
LASreadItemCompressed_BYTE_v2(EntropyDecoder *dec, U32 number)
#define LASZIP_GPSTIME_MULTI
BOOL init(const U8 *item)
~LASreadItemCompressed_POINT10_v2()
~LASreadItemCompressed_RGB12_v2()
virtual EntropyModel * createSymbolModel(U32 n)=0
const U8 number_return_map[8][8]
const U8 number_return_level[8][8]
BOOL init(const U8 *item)
~LASreadItemCompressed_BYTE_v2()