MCPcopy Create free account
hub / github.com/LASzip/LASzip / write

Method write

src/laswriteitemcompressed_v2.cpp:139–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139inline BOOL LASwriteItemCompressed_POINT10_v2::write(const U8* item, U32& context)
140{
141 U32 r = ((const LASpoint10*)item)->return_number;
142 U32 n = ((const LASpoint10*)item)->number_of_returns_of_given_pulse;
143 U32 m = number_return_map[n][r];
144 U32 l = number_return_level[n][r];
145 U32 k_bits;
146 I32 median, diff;
147
148 // compress which other values have changed
149 I32 changed_values = (((last_item[14] != item[14]) << 5) | // bit_byte
150 ((last_intensity[m] != ((const LASpoint10*)item)->intensity) << 4) |
151 ((last_item[15] != item[15]) << 3) | // classification
152 ((last_item[16] != item[16]) << 2) | // scan_angle_rank
153 ((last_item[17] != item[17]) << 1) | // user_data
154 (((LASpoint10*)last_item)->point_source_ID != ((const LASpoint10*)item)->point_source_ID));
155
156 enc->encodeSymbol(m_changed_values, changed_values);
157
158 // compress the bit_byte (edge_of_flight_line, scan_direction_flag, returns, ...) if it has changed
159 if (changed_values & 32)
160 {
161 if (m_bit_byte[last_item[14]] == 0)
162 {
163 m_bit_byte[last_item[14]] = enc->createSymbolModel(256);
164 enc->initSymbolModel(m_bit_byte[last_item[14]]);
165 }
166 enc->encodeSymbol(m_bit_byte[last_item[14]], item[14]);
167 }
168
169 // compress the intensity if it has changed
170 if (changed_values & 16)
171 {
172 ic_intensity->compress(last_intensity[m], ((const LASpoint10*)item)->intensity, (m < 3 ? m : 3));
173 last_intensity[m] = ((const LASpoint10*)item)->intensity;
174 }
175
176 // compress the classification ... if it has changed
177 if (changed_values & 8)
178 {
179 if (m_classification[last_item[15]] == 0)
180 {
181 m_classification[last_item[15]] = enc->createSymbolModel(256);
182 enc->initSymbolModel(m_classification[last_item[15]]);
183 }
184 enc->encodeSymbol(m_classification[last_item[15]], item[15]);
185 }
186
187 // compress the scan_angle_rank ... if it has changed
188 if (changed_values & 4)
189 {
190 enc->encodeSymbol(m_scan_angle_rank[((const LASpoint10*)item)->scan_direction_flag], U8_FOLD(item[16]-last_item[16]));
191 }
192
193 // compress the user_data ... if it has changed
194 if (changed_values & 2)
195 {
196 if (m_user_data[last_item[17]] == 0)

Callers

nothing calls this directly

Calls 8

compressMethod · 0.80
getMethod · 0.80
getKMethod · 0.80
encodeSymbolMethod · 0.45
createSymbolModelMethod · 0.45
initSymbolModelMethod · 0.45
addMethod · 0.45
writeIntMethod · 0.45

Tested by

no test coverage detected