1 /* 2 =============================================================================== 3 4 FILE: lasreaditemcompressed_v1.hpp 5 6 CONTENTS: 7 8 Implementation of LASitemReadCompressed for *all* items (version 1). 9 10 PROGRAMMERS: 11 12 martin.isenburg@rapidlasso.com - http://rapidlasso.com 13 14 COPYRIGHT: 15 16 (c) 2007-2017, martin isenburg, rapidlasso - fast tools to catch reality 17 18 This is free software; you can redistribute and/or modify it under the 19 terms of the GNU Lesser General Licence as published by the Free Software 20 Foundation. See the COPYING file for more information. 21 22 This software is distributed WITHOUT ANY WARRANTY and without even the 23 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 24 25 CHANGE HISTORY: 26 27 28 August 2017 -- moving 'context' from global development hack to interface 28 6 September 2014 -- removed inheritance of EntropyEncoder and EntropyDecoder 29 10 January 2011 -- licensing change for LGPL release and liblas integration 30 7 December 2010 -- refactored after getting invited to KAUST in Saudi Arabia 31 32 =============================================================================== 33 */ 34 #ifndef LAS_READ_ITEM_COMPRESSED_V1_HPP 35 #define LAS_READ_ITEM_COMPRESSED_V1_HPP 36 37 #include "lasreaditem.hpp" 38 #include "arithmeticdecoder.hpp" 39 #include "integercompressor.hpp" 40 41 class LASreadItemCompressed_POINT10_v1 : public LASreadItemCompressed 42 { 43 public: 44 45 LASreadItemCompressed_POINT10_v1(ArithmeticDecoder* dec); 46 47 BOOL init(const U8* item, U32& context); // context is unused 48 void read(U8* item, U32& context); // context is unused 49 50 ~LASreadItemCompressed_POINT10_v1(); 51 52 private: 53 ArithmeticDecoder* dec; 54 U8 last_item[20]; 55 56 I32 last_x_diff[3]; 57 I32 last_y_diff[3]; 58 I32 last_incr; 59 IntegerCompressor* ic_dx; 60 IntegerCompressor* ic_dy; 61 IntegerCompressor* ic_z; 62 IntegerCompressor* ic_intensity; 63 IntegerCompressor* ic_scan_angle_rank; 64 IntegerCompressor* ic_point_source_ID; 65 ArithmeticModel* m_changed_values; 66 ArithmeticModel* m_bit_byte[256]; 67 ArithmeticModel* m_classification[256]; 68 ArithmeticModel* m_user_data[256]; 69 }; 70 71 class LASreadItemCompressed_GPSTIME11_v1 : public LASreadItemCompressed 72 { 73 public: 74 75 LASreadItemCompressed_GPSTIME11_v1(ArithmeticDecoder* dec); 76 77 BOOL init(const U8* item, U32& context); // context is unused 78 void read(U8* item, U32& context); // context is unused 79 80 ~LASreadItemCompressed_GPSTIME11_v1(); 81 82 private: 83 ArithmeticDecoder* dec; 84 U64I64F64 last_gpstime; 85 86 ArithmeticModel* m_gpstime_multi; 87 ArithmeticModel* m_gpstime_0diff; 88 IntegerCompressor* ic_gpstime; 89 I32 multi_extreme_counter; 90 I32 last_gpstime_diff; 91 }; 92 93 class LASreadItemCompressed_RGB12_v1 : public LASreadItemCompressed 94 { 95 public: 96 97 LASreadItemCompressed_RGB12_v1(ArithmeticDecoder* dec); 98 99 BOOL init(const U8* item, U32& context); // context is unused 100 void read(U8* item, U32& context); // context is unused 101 102 ~LASreadItemCompressed_RGB12_v1(); 103 104 private: 105 ArithmeticDecoder* dec; 106 U8* last_item; 107 108 ArithmeticModel* m_byte_used; 109 IntegerCompressor* ic_rgb; 110 }; 111 112 class LASreadItemCompressed_WAVEPACKET13_v1 : public LASreadItemCompressed 113 { 114 public: 115 116 LASreadItemCompressed_WAVEPACKET13_v1(ArithmeticDecoder* dec); 117 118 BOOL init(const U8* item, U32& context); // context is unused 119 void read(U8* item, U32& context); // context is unused 120 121 ~LASreadItemCompressed_WAVEPACKET13_v1(); 122 123 private: 124 ArithmeticDecoder* dec; 125 U8* last_item; 126 127 I32 last_diff_32; 128 U32 sym_last_offset_diff; 129 ArithmeticModel* m_packet_index; 130 ArithmeticModel* m_offset_diff[4]; 131 IntegerCompressor* ic_offset_diff; 132 IntegerCompressor* ic_packet_size; 133 IntegerCompressor* ic_return_point; 134 IntegerCompressor* ic_xyz; 135 }; 136 137 class LASreadItemCompressed_BYTE_v1 : public LASreadItemCompressed 138 { 139 public: 140 141 LASreadItemCompressed_BYTE_v1(ArithmeticDecoder* dec, U32 number); 142 143 BOOL init(const U8* item, U32& context); // context is unused 144 void read(U8* item, U32& context); // context is unused 145 146 ~LASreadItemCompressed_BYTE_v1(); 147 148 private: 149 ArithmeticDecoder* dec; 150 U32 number; 151 U8* last_item; 152 153 IntegerCompressor* ic_byte; 154 }; 155 156 #endif 157