1 /* 2 =============================================================================== 3 4 FILE: laswriteitemcompressed_v1.hpp 5 6 CONTENTS: 7 8 Implementation of LASitemWriteCompressed 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 12 December 2010 -- refactored after watching two movies with silke 31 32 =============================================================================== 33 */ 34 #ifndef LAS_WRITE_ITEM_COMPRESSED_V1_HPP 35 #define LAS_WRITE_ITEM_COMPRESSED_V1_HPP 36 37 #include "laswriteitem.hpp" 38 #include "arithmeticencoder.hpp" 39 #include "integercompressor.hpp" 40 41 class LASwriteItemCompressed_POINT10_v1 : public LASwriteItemCompressed 42 { 43 public: 44 45 LASwriteItemCompressed_POINT10_v1(ArithmeticEncoder* enc); 46 47 BOOL init(const U8* item, U32& context); 48 BOOL write(const U8* item, U32& context); 49 50 ~LASwriteItemCompressed_POINT10_v1(); 51 52 private: 53 ArithmeticEncoder* enc; 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 LASwriteItemCompressed_GPSTIME11_v1 : public LASwriteItemCompressed 72 { 73 public: 74 75 LASwriteItemCompressed_GPSTIME11_v1(ArithmeticEncoder* enc); 76 77 BOOL init(const U8* item, U32& context); 78 BOOL write(const U8* item, U32& context); 79 80 ~LASwriteItemCompressed_GPSTIME11_v1(); 81 82 private: 83 ArithmeticEncoder* enc; 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 LASwriteItemCompressed_RGB12_v1 : public LASwriteItemCompressed 94 { 95 public: 96 97 LASwriteItemCompressed_RGB12_v1(ArithmeticEncoder* enc); 98 99 BOOL init(const U8* item, U32& context); 100 BOOL write(const U8* item, U32& context); 101 102 ~LASwriteItemCompressed_RGB12_v1(); 103 104 private: 105 ArithmeticEncoder* enc; 106 U8* last_item; 107 108 ArithmeticModel* m_byte_used; 109 IntegerCompressor* ic_rgb; 110 }; 111 112 class LASwriteItemCompressed_WAVEPACKET13_v1 : public LASwriteItemCompressed 113 { 114 public: 115 116 LASwriteItemCompressed_WAVEPACKET13_v1(ArithmeticEncoder* enc); 117 118 BOOL init(const U8* item, U32& context); 119 BOOL write(const U8* item, U32& context); 120 121 ~LASwriteItemCompressed_WAVEPACKET13_v1(); 122 123 private: 124 ArithmeticEncoder* enc; 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 LASwriteItemCompressed_BYTE_v1 : public LASwriteItemCompressed 138 { 139 public: 140 141 LASwriteItemCompressed_BYTE_v1(ArithmeticEncoder* enc, U32 number); 142 143 BOOL init(const U8* item, U32& context); 144 BOOL write(const U8* item, U32& context); 145 146 ~LASwriteItemCompressed_BYTE_v1(); 147 148 private: 149 ArithmeticEncoder* enc; 150 U32 number; 151 U8* last_item; 152 153 IntegerCompressor* ic_byte; 154 }; 155 156 #endif 157