MCPcopy Create free account
hub / github.com/LAStools/LAStools / read

Method read

LASzip/src/lasreaditemcompressed_v4.cpp:709–1002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

707}
708
709inline void LASreadItemCompressed_POINT14_v4::read(U8* item, U32& context)
710{
711 // get last
712
713 U8* last_item = contexts[current_context].last_item;
714
715 ////////////////////////////////////////
716 // decompress returns_XY layer
717 ////////////////////////////////////////
718
719 // create single (3) / first (1) / last (2) / intermediate (0) context from last point return
720
721 I32 lpr = (((LASpoint14*)last_item)->return_number == 1 ? 1 : 0); // first?
722 lpr += (((LASpoint14*)last_item)->return_number >= ((LASpoint14*)last_item)->number_of_returns ? 2 : 0); // last?
723
724 // add info whether the GPS time changed in the last return to the context
725
726 lpr += (((LASpoint14*)last_item)->gps_time_change ? 4 : 0);
727
728 // decompress which values have changed with last point return context
729
730 I32 changed_values = dec_channel_returns_XY->decodeSymbol(contexts[current_context].m_changed_values[lpr]);
731
732 // if scanner channel has changed
733
734 if (changed_values & (1 << 6))
735 {
736 U32 diff = dec_channel_returns_XY->decodeSymbol(contexts[current_context].m_scanner_channel); // curr = last + (sym + 1)
737 U32 scanner_channel = (current_context + diff + 1) % 4;
738 // maybe create and init entropy models and integer compressors
739 if (contexts[scanner_channel].unused)
740 {
741 // create and init entropy models and integer decompressors
742 createAndInitModelsAndDecompressors(scanner_channel, contexts[current_context].last_item);
743 }
744 // switch context to current scanner channel
745 current_context = scanner_channel;
746
747 // get last for new context
748 last_item = contexts[current_context].last_item;
749 ((LASpoint14*)last_item)->scanner_channel = scanner_channel;
750 }
751 context = current_context; // the POINT14 reader sets context for all other items
752
753 // determine changed attributes
754
755 BOOL point_source_change = (changed_values & (1 << 5) ? TRUE : FALSE);
756 BOOL gps_time_change = (changed_values & (1 << 4) ? TRUE : FALSE);
757 BOOL scan_angle_change = (changed_values & (1 << 3) ? TRUE : FALSE);
758
759 // get last return counts
760
761 U32 last_n = ((LASpoint14*)last_item)->number_of_returns;
762 U32 last_r = ((LASpoint14*)last_item)->return_number;
763
764 // if number of returns is different we decompress it
765
766 U32 n;

Callers

nothing calls this directly

Calls 9

decompressMethod · 0.80
getKMethod · 0.80
decodeSymbolMethod · 0.45
createSymbolModelMethod · 0.45
initSymbolModelMethod · 0.45
getMethod · 0.45
addMethod · 0.45
readInt64Method · 0.45
packMethod · 0.45

Tested by

no test coverage detected