[Liblas-commits] laszip: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Dec 21 15:25:37 EST 2010


changeset 80c637a74e7a in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=80c637a74e7a
summary: added LASzip struct to be used as VLR data

changeset 68e267d04b63 in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=68e267d04b63
summary: renaming to GPSTIME11, RGB12, and WAVEPACKET13

diffstat:

 include/laszip/laszip.hpp         |  87 ++++++++++++++++++++++++++++----------
 src/lasreaditemcompressed_v1.cpp  |  76 +++++++++++++++++++++++++++++----
 src/lasreaditemcompressed_v1.hpp  |  34 ++++++++++++--
 src/lasreaditemraw.hpp            |  25 +++++++++-
 src/lasreadpoint.cpp              |  24 +++++-----
 src/laswriteitemcompressed_v1.cpp |  78 ++++++++++++++++++++++++++++++----
 src/laswriteitemcompressed_v1.hpp |  34 ++++++++++++--
 src/laswriteitemraw.hpp           |  25 +++++++++-
 src/laswritepoint.cpp             |  24 +++++-----
 9 files changed, 319 insertions(+), 88 deletions(-)

diffs (truncated from 827 to 300 lines):

diff -r 9b06bc82ee1e -r 68e267d04b63 include/laszip/laszip.hpp
--- a/include/laszip/laszip.hpp	Mon Dec 20 19:33:42 2010 -0800
+++ b/include/laszip/laszip.hpp	Tue Dec 21 12:25:15 2010 -0800
@@ -49,6 +49,9 @@
 
 #if defined(_MSC_VER) && (_MSC_VER < 1300)
 #define LZ_WIN32_VC6
+typedef __int64   SIGNED_INT64;
+#else
+typedef long long SIGNED_INT64;
 #endif
 
 #define LASZIP_VERSION_MAJOR    1
@@ -56,14 +59,16 @@
 #define LASZIP_VERSION_REVISION 0
 
 #define LASZIP_COMPRESSION_NONE       0
-#define LASZIP_COMPRESSION_RANGE      1
-#define LASZIP_COMPRESSION_ARITHMETIC 2
+#define LASZIP_COMPRESSION_ARITHMETIC 1
+#define LASZIP_COMPRESSION_RANGE      2
+
+#define LASZIP_COMPRESSION_DEFAULT    1
 
 class LASitem
 {
 public:
 
-  enum Type { BYTE = 0, SHORT, INT, LONG, FLOAT, DOUBLE, POINT10, GPSTIME, RGB, WAVEPACKET } type;
+  enum Type { BYTE = 0, SHORT, INT, LONG, FLOAT, DOUBLE, POINT10, GPSTIME11, RGB12, WAVEPACKET13 } type;
   unsigned short size;
   unsigned short version;
 
@@ -76,18 +81,18 @@
         size = 20;
         version = 0;
         break;
-    case LASitem::GPSTIME:
-        type = LASitem::GPSTIME;
+    case LASitem::GPSTIME11:
+        type = LASitem::GPSTIME11;
         size = 8;
         version = 0;
         break;
-    case LASitem::RGB:
-        type = LASitem::RGB;
+    case LASitem::RGB12:
+        type = LASitem::RGB12;
         size = 6;
         version = 0;
         break;
-    case LASitem::WAVEPACKET:
-        type = LASitem::WAVEPACKET;
+    case LASitem::WAVEPACKET13:
+        type = LASitem::WAVEPACKET13;
         size = 29;
         version = 0;
         break;
@@ -110,13 +115,13 @@
     case POINT10:
       if (size != 20) return false;
       break;
-    case GPSTIME:
+    case GPSTIME11:
       if (size != 8) return false;
       break;
-    case RGB:
+    case RGB12:
       if (size != 6) return false;
       break;
-    case WAVEPACKET:
+    case WAVEPACKET13:
       if (size != 29) return false;
       break;
     case BYTE:
@@ -133,9 +138,9 @@
     switch (type)
     {
     case POINT10:
-    case GPSTIME:
-    case RGB:
-    case WAVEPACKET:
+    case GPSTIME11:
+    case RGB12:
+    case WAVEPACKET13:
     case BYTE:
       return true;
       break;
@@ -152,13 +157,13 @@
     case POINT10:
       if (size != 20) return false;
       break;
-    case GPSTIME:
+    case GPSTIME11:
       if (size != 8) return false;
       break;
-    case RGB:
+    case RGB12:
       if (size != 6) return false;
       break;
-    case WAVEPACKET:
+    case WAVEPACKET13:
       if (size != 29) return false;
       break;
     case BYTE:
@@ -177,13 +182,13 @@
     case POINT10:
       if (version > 1) return false;
       break;
-    case GPSTIME:
+    case GPSTIME11:
       if (version > 1) return false;
       break;
-    case RGB:
+    case RGB12:
       if (version > 1) return false;
       break;
-    case WAVEPACKET:
+    case WAVEPACKET13:
       if (version > 1) return false;
       break;
     case BYTE:
@@ -203,15 +208,15 @@
       if (size != 20) return false;
       if (version > 1) return false;
       break;
-    case GPSTIME:
+    case GPSTIME11:
       if (size != 8) return false;
       if (version > 1) return false;
       break;
-    case RGB:
+    case RGB12:
       if (size != 6) return false;
       if (version > 1) return false;
       break;
-    case WAVEPACKET:
+    case WAVEPACKET13:
       if (size != 29) return false;
       if (version > 1) return false;
       break;
@@ -226,6 +231,40 @@
   }
 };
 
+class LASzip
+{
+public:
+  unsigned int compression;
+  unsigned char version_major;
+  unsigned char version_minor;
+  unsigned short version_revision;
+  unsigned int options;
+  unsigned int num_items;
+  unsigned int num_chunks;  /* not used yet  ...               */ 
+  SIGNED_INT64 num_points;  /* not mandatory ... -1 if unknown */
+  SIGNED_INT64 num_bytes;   /* not mandatory ... -1 if unknown */
+  LASitem* items;
+
+  LASzip()
+  {
+    compression = 0;
+    version_major = 1;
+    version_minor = 0;
+    version_revision = 0;
+    options = 0;
+    num_items = 0;
+    num_chunks = 1;
+    num_points = -1;
+    num_bytes = -1;
+    items = 0;
+  }
+
+  ~LASzip()
+  {
+    if (items) delete [] items;
+  }
+};
+
 /*
 struct LASchunk
 {
diff -r 9b06bc82ee1e -r 68e267d04b63 src/lasreaditemcompressed_v1.cpp
--- a/src/lasreaditemcompressed_v1.cpp	Mon Dec 20 19:33:42 2010 -0800
+++ b/src/lasreaditemcompressed_v1.cpp	Tue Dec 21 12:25:15 2010 -0800
@@ -253,13 +253,13 @@
 
 /*
 ===============================================================================
-                       LASreadItemCompressed_GPSTIME_v1
+                       LASreadItemCompressed_GPSTIME11_v1
 ===============================================================================
 */
 
 #define LASZIP_GPSTIME_MULTIMAX 512
 
-LASreadItemCompressed_GPSTIME_v1::LASreadItemCompressed_GPSTIME_v1(EntropyDecoder* dec)
+LASreadItemCompressed_GPSTIME11_v1::LASreadItemCompressed_GPSTIME11_v1(EntropyDecoder* dec)
 {
   /* set decoder */
   assert(dec);
@@ -270,13 +270,13 @@
   ic_gpstime = new IntegerCompressor(dec, 32, 6); // 32 bits, 6 contexts
 }
 
-LASreadItemCompressed_GPSTIME_v1::~LASreadItemCompressed_GPSTIME_v1()
+LASreadItemCompressed_GPSTIME11_v1::~LASreadItemCompressed_GPSTIME11_v1()
 {
   dec->destroySymbolModel(m_gpstime_multi);
   delete ic_gpstime;
 }
 
-BOOL LASreadItemCompressed_GPSTIME_v1::init(const U8* item)
+BOOL LASreadItemCompressed_GPSTIME11_v1::init(const U8* item)
 {
   /* init state */
   last_gpstime_diff = 0;
@@ -292,7 +292,7 @@
   return TRUE;
 }
 
-inline BOOL LASreadItemCompressed_GPSTIME_v1::read(U8* item)
+inline BOOL LASreadItemCompressed_GPSTIME11_v1::read(U8* item)
 {
   I32 multi;
   if (last_gpstime_diff == 0) // if the last integer difference was zero
@@ -365,11 +365,11 @@
 
 /*
 ===============================================================================
-                       LASreadItemCompressed_RGB_v1
+                       LASreadItemCompressed_RGB12_v1
 ===============================================================================
 */
 
-LASreadItemCompressed_RGB_v1::LASreadItemCompressed_RGB_v1(EntropyDecoder* dec)
+LASreadItemCompressed_RGB12_v1::LASreadItemCompressed_RGB12_v1(EntropyDecoder* dec)
 {
   /* set decoder */
   assert(dec);
@@ -383,14 +383,14 @@
   last_item = new U8[6];
 }
 
-LASreadItemCompressed_RGB_v1::~LASreadItemCompressed_RGB_v1()
+LASreadItemCompressed_RGB12_v1::~LASreadItemCompressed_RGB12_v1()
 {
   dec->destroySymbolModel(m_byte_used);
   delete ic_rgb;
   delete [] last_item;
 }
 
-BOOL LASreadItemCompressed_RGB_v1::init(const U8* item)
+BOOL LASreadItemCompressed_RGB12_v1::init(const U8* item)
 {
   /* init state */
 
@@ -403,7 +403,7 @@
   return TRUE;
 }
 
-inline BOOL LASreadItemCompressed_RGB_v1::read(U8* item)
+inline BOOL LASreadItemCompressed_RGB12_v1::read(U8* item)
 {
   U32 i, sym = dec->decodeSymbol(m_byte_used);
   for (i = 0; i < 6; i++)
@@ -419,6 +419,62 @@
 
 /*
 ===============================================================================
+                       LASreadItemCompressed_WAVEPACKET13_v1
+===============================================================================
+*/
+
+LASreadItemCompressed_WAVEPACKET13_v1::LASreadItemCompressed_WAVEPACKET13_v1(EntropyDecoder* dec)
+{
+  /* set decoder */
+  assert(dec);
+  this->dec = dec;
+
+  /* create models and integer compressors */
+  m_packet_index = dec->createSymbolModel(256);
+  m_small_offset_diff = dec->createBitModel();
+  ic_offset_diff = new IntegerCompressor(dec, 32);
+  ic_return_point = new IntegerCompressor(dec, 32);
+  ic_xyz = new IntegerCompressor(dec, 32, 3);
+
+  /* create last item */
+  last_item = new U8[29];
+}
+
+LASreadItemCompressed_WAVEPACKET13_v1::~LASreadItemCompressed_WAVEPACKET13_v1()
+{
+  dec->destroySymbolModel(m_packet_index);
+  dec->destroyBitModel(m_small_offset_diff);
+  delete ic_offset_diff;
+  delete ic_return_point;
+  delete ic_xyz;
+  delete [] last_item;
+}


More information about the Liblas-commits mailing list