[Liblas-commits] laszip: adding laszip version 2.0

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Mar 22 14:11:29 EDT 2011


details:   http://hg.liblas.orglaszip/rev/a17305a3bc31
changeset: 189:a17305a3bc31
user:      isenburg
date:      Tue Mar 22 10:59:57 2011 -0700
description:
adding laszip version 2.0
Subject: laszip: adding laszip version 2.0

details:   http://hg.liblas.orglaszip/rev/73dfa7531f76
changeset: 190:73dfa7531f76
user:      isenburg
date:      Tue Mar 22 11:06:35 2011 -0700
description:
adding laszip version 2.0
Subject: laszip: adding laszip version 2.0

details:   http://hg.liblas.orglaszip/rev/c3a657c107ab
changeset: 191:c3a657c107ab
user:      isenburg
date:      Tue Mar 22 11:07:35 2011 -0700
description:
adding laszip version 2.0
Subject: laszip: adding laszip version 2.0

details:   http://hg.liblas.orglaszip/rev/1d31ecdb3794
changeset: 192:1d31ecdb3794
user:      isenburg
date:      Tue Mar 22 11:19:47 2011 -0700
description:
adding laszip version 2.0
Subject: laszip: adding laszip version 2.0

details:   http://hg.liblas.orglaszip/rev/0c4a753ccf5f
changeset: 193:0c4a753ccf5f
user:      isenburg
date:      Tue Mar 22 11:21:12 2011 -0700
description:
adding laszip version 2.0
Subject: laszip: adding laszip version 2.0

details:   http://hg.liblas.orglaszip/rev/a255003d4ca7
changeset: 194:a255003d4ca7
user:      isenburg
date:      Tue Mar 22 11:22:22 2011 -0700
description:
adding laszip version 2.0

diffstat:

 include/laszip/laszip.hpp         |   40 ++-
 src/Makefile.am                   |    2 +
 src/lasreaditemcompressed_v1.cpp  |   30 +-
 src/lasreadpoint.cpp              |   19 +
 src/lasreadpoint.hpp              |    2 +-
 src/laswriteitemcompressed_v1.cpp |   42 +---
 src/laswritepoint.cpp             |   86 ++++++--
 src/laszip.cpp                    |  382 +++++++++++++++++++------------------
 tools/laszippertest.cpp           |   22 +-
 9 files changed, 325 insertions(+), 300 deletions(-)

diffs (truncated from 947 to 300 lines):

diff -r e185f18858f4 -r a255003d4ca7 include/laszip/laszip.hpp
--- a/include/laszip/laszip.hpp	Tue Mar 22 10:24:29 2011 -0700
+++ b/include/laszip/laszip.hpp	Tue Mar 22 11:22:22 2011 -0700
@@ -1,13 +1,13 @@
-/*
-===============================================================================
-
-  FILE:  laszip.hpp
-  
-  CONTENTS:
-  
+/*
+===============================================================================
+
+  FILE:  laszip.hpp
+  
+  CONTENTS:
+  
     Contains LASitem and LASchunk structs as well as the IDs of the currently
-    supported entropy coding scheme
-
+    supported entropy coding scheme
+
   PROGRAMMERS:
   
     martin.isenburg at gmail.com
@@ -25,13 +25,14 @@
   
   CHANGE HISTORY:
   
+    20 March 2011 -- incrementing LASZIP_VERSION to 2.0 for improved compression
     10 January 2011 -- licensing change for LGPL release and liblas integration
     12 December 2010 -- refactored from lasdefinitions after movies with silke
-  
-===============================================================================
-*/
-#ifndef LASZIP_HPP
-#define LASZIP_HPP
+  
+===============================================================================
+*/
+#ifndef LASZIP_HPP
+#define LASZIP_HPP
 
 #if defined(_MSC_VER) && (_MSC_VER < 1300)
 #define LZ_WIN32_VC6
@@ -40,10 +41,9 @@
 typedef long long SIGNED_INT64;
 #endif
 
-
-#define LASZIP_VERSION_MAJOR    1
+#define LASZIP_VERSION_MAJOR    2
 #define LASZIP_VERSION_MINOR    0
-#define LASZIP_VERSION_REVISION 1
+#define LASZIP_VERSION_REVISION 0
 
 #include "laszipexport.hpp"
 
@@ -61,6 +61,8 @@
   bool supported_version() const;
   bool supported() const;
 
+  const char* get_name() const;
+
 public:
   unsigned short size;
   unsigned short version;
@@ -74,7 +76,9 @@
   {
     POINT_BY_POINT_RAW        = 0,
     POINT_BY_POINT_ARITHMETIC = 1,
+    POINT_BY_POINT_ARITHMETIC_V2 = 2, // temporary fix
     DEFAULT_COMPRESSION       = POINT_BY_POINT_ARITHMETIC,
+    DEFAULT_COMPRESSION_V2    = POINT_BY_POINT_ARITHMETIC_V2, // temporary fix
     DEFAULT_RAW               = POINT_BY_POINT_RAW
   };
 
@@ -101,4 +105,4 @@
 }; 
 */
 
-#endif
+#endif
diff -r e185f18858f4 -r a255003d4ca7 src/Makefile.am
--- a/src/Makefile.am	Tue Mar 22 10:24:29 2011 -0700
+++ b/src/Makefile.am	Tue Mar 22 11:22:22 2011 -0700
@@ -9,6 +9,8 @@
 						integercompressor.cpp \
 						laswriteitemcompressed_v1.cpp \
 						lasreaditemcompressed_v1.cpp \
+						laswriteitemcompressed_v2.cpp \
+						lasreaditemcompressed_v2.cpp \
 						laswritepoint.cpp \
 						lasreadpoint.cpp \
 						laszip.cpp \
diff -r e185f18858f4 -r a255003d4ca7 src/lasreaditemcompressed_v1.cpp
--- a/src/lasreaditemcompressed_v1.cpp	Tue Mar 22 10:24:29 2011 -0700
+++ b/src/lasreaditemcompressed_v1.cpp	Tue Mar 22 11:22:22 2011 -0700
@@ -33,7 +33,6 @@
 
 #include <assert.h>
 #include <string.h>
-#include <stdio.h>
 
 /*
 ===============================================================================
@@ -173,18 +172,15 @@
       median_y = last_y_diff[1];
   }
 
-  // copy point from last point
-  memcpy(item, last_item, 20);
-
   // decompress x y z coordinates
   I32 x_diff = ic_dx->decompress(median_x);
-  ((LASpoint10*)item)->x += x_diff;
+  ((LASpoint10*)last_item)->x += x_diff;
   // we use the number k of bits corrector bits to switch contexts
   U32 k_bits = ic_dx->getK();
   I32 y_diff = ic_dy->decompress(median_y, (k_bits < 19 ? k_bits : 19));
-  ((LASpoint10*)item)->y += y_diff;
+  ((LASpoint10*)last_item)->y += y_diff;
   k_bits = (k_bits + ic_dy->getK())/2;
-  ((LASpoint10*)item)->z = ic_z->decompress(((LASpoint10*)last_item)->z, (k_bits < 19 ? k_bits : 19));
+  ((LASpoint10*)last_item)->z = ic_z->decompress(((LASpoint10*)last_item)->z, (k_bits < 19 ? k_bits : 19));
 
   // decompress which other values have changed
   I32 changed_values = dec->decodeSymbol(m_changed_values);
@@ -194,7 +190,7 @@
     // decompress the intensity if it has changed
     if (changed_values & 32)
     {
-      ((LASpoint10*)item)->intensity = (U16)ic_intensity->decompress(((LASpoint10*)last_item)->intensity);
+      ((LASpoint10*)last_item)->intensity = (U16)ic_intensity->decompress(((LASpoint10*)last_item)->intensity);
     }
 
     // decompress the edge_of_flight_line, scan_direction_flag, ... if it has changed
@@ -205,7 +201,7 @@
         m_bit_byte[last_item[14]] = dec->createSymbolModel(256);
         dec->initSymbolModel(m_bit_byte[last_item[14]]);
       }
-      item[14] = (U8)dec->decodeSymbol(m_bit_byte[last_item[14]]);
+      last_item[14] = (U8)dec->decodeSymbol(m_bit_byte[last_item[14]]);
     }
 
     // decompress the classification ... if it has changed
@@ -216,13 +212,13 @@
         m_classification[last_item[15]] = dec->createSymbolModel(256);
         dec->initSymbolModel(m_classification[last_item[15]]);
       }
-      item[15] = (U8)dec->decodeSymbol(m_classification[last_item[15]]);
+      last_item[15] = (U8)dec->decodeSymbol(m_classification[last_item[15]]);
     }
     
     // decompress the scan_angle_rank ... if it has changed
     if (changed_values & 4)
     {
-      item[16] = (U8)ic_scan_angle_rank->decompress(last_item[16], k_bits < 3);
+      last_item[16] = (U8)ic_scan_angle_rank->decompress(last_item[16], k_bits < 3);
     }
 
     // decompress the user_data ... if it has changed
@@ -233,13 +229,13 @@
         m_user_data[last_item[17]] = dec->createSymbolModel(256);
         dec->initSymbolModel(m_user_data[last_item[17]]);
       }
-      item[17] = (U8)dec->decodeSymbol(m_user_data[last_item[17]]);
+      last_item[17] = (U8)dec->decodeSymbol(m_user_data[last_item[17]]);
     }
 
     // decompress the point_source_ID ... if it has changed
     if (changed_values & 1)
     {
-      ((LASpoint10*)item)->point_source_ID = (U16)ic_point_source_ID->decompress(((LASpoint10*)last_item)->point_source_ID);
+      ((LASpoint10*)last_item)->point_source_ID = (U16)ic_point_source_ID->decompress(((LASpoint10*)last_item)->point_source_ID);
     }
   }
 
@@ -250,7 +246,7 @@
   if (last_incr > 2) last_incr = 0;
 
   // copy the last point
-  memcpy(last_item, item, 20);
+  memcpy(item, last_item, 20);
   return TRUE;
 }
 
@@ -411,15 +407,15 @@
 {
   U32 sym = dec->decodeSymbol(m_byte_used);
   if (sym & (1 << 0)) ((U16*)item)[0] = (U16)ic_rgb->decompress(((U16*)last_item)[0]&255, 0);
-  else ((U16*)item)[0] = ((U16*)last_item)[0]&0xFF;
+  else ((U16*)item)[0] = (U16)(((U16*)last_item)[0]&0xFF);
   if (sym & (1 << 1)) ((U16*)item)[0] |= (((U16)ic_rgb->decompress(((U16*)last_item)[0]>>8, 1)) << 8);
   else ((U16*)item)[0] |= (((U16*)last_item)[0]&0xFF00);
   if (sym & (1 << 2)) ((U16*)item)[1] = (U16)ic_rgb->decompress(((U16*)last_item)[1]&255, 2);
-  else ((U16*)item)[1] = ((U16*)last_item)[1]&0xFF;
+  else ((U16*)item)[1] = (U16)(((U16*)last_item)[1]&0xFF);
   if (sym & (1 << 3)) ((U16*)item)[1] |= (((U16)ic_rgb->decompress(((U16*)last_item)[1]>>8, 3)) << 8);
   else ((U16*)item)[1] |= (((U16*)last_item)[1]&0xFF00);
   if (sym & (1 << 4)) ((U16*)item)[2] = (U16)ic_rgb->decompress(((U16*)last_item)[2]&255, 4);
-  else ((U16*)item)[2] = ((U16*)last_item)[2]&0xFF;
+  else ((U16*)item)[2] = (U16)(((U16*)last_item)[2]&0xFF);
   if (sym & (1 << 5)) ((U16*)item)[2] |= (((U16)ic_rgb->decompress(((U16*)last_item)[2]>>8, 5)) << 8);
   else ((U16*)item)[2] |= (((U16*)last_item)[2]&0xFF00);
   memcpy(last_item, item, 6);
diff -r e185f18858f4 -r a255003d4ca7 src/lasreadpoint.cpp
--- a/src/lasreadpoint.cpp	Tue Mar 22 10:24:29 2011 -0700
+++ b/src/lasreadpoint.cpp	Tue Mar 22 11:22:22 2011 -0700
@@ -34,6 +34,7 @@
 #include "arithmeticdecoder.hpp"
 #include "lasreaditemraw.hpp"
 #include "lasreaditemcompressed_v1.hpp"
+#include "lasreaditemcompressed_v2.hpp"
 
 #include <string.h>
 
@@ -64,6 +65,7 @@
     dec = 0;
     break;
   case LASzip::POINT_BY_POINT_ARITHMETIC:
+  case LASzip::POINT_BY_POINT_ARITHMETIC_V2: // temporary fix
     dec = new ArithmeticDecoder();
     break;
   default:
@@ -123,18 +125,24 @@
       case LASitem::POINT10:
         if (items[i].version == 1)
           readers_compressed[i] = new LASreadItemCompressed_POINT10_v1(dec);
+        else if (items[i].version == 2)
+          readers_compressed[i] = new LASreadItemCompressed_POINT10_v2(dec);
         else
           return FALSE;
         break;
       case LASitem::GPSTIME11:
         if (items[i].version == 1)
           readers_compressed[i] = new LASreadItemCompressed_GPSTIME11_v1(dec);
+        else if (items[i].version == 2)
+          readers_compressed[i] = new LASreadItemCompressed_GPSTIME11_v2(dec);
         else
           return FALSE;
         break;
       case LASitem::RGB12:
         if (items[i].version == 1)
           readers_compressed[i] = new LASreadItemCompressed_RGB12_v1(dec);
+        else if (items[i].version == 2)
+          readers_compressed[i] = new LASreadItemCompressed_RGB12_v2(dec);
         else
           return FALSE;
         break;
@@ -147,6 +155,8 @@
       case LASitem::BYTE:
         if (items[i].version == 1)
           readers_compressed[i] = new LASreadItemCompressed_BYTE_v1(dec, items[i].size);
+        else if (items[i].version == 2)
+          readers_compressed[i] = new LASreadItemCompressed_BYTE_v2(dec, items[i].size);
         else
           return FALSE;
         break;
@@ -201,6 +211,15 @@
   return TRUE;
 }
 
+BOOL LASreadPoint::done()
+{
+  if (readers == readers_compressed)
+  {
+    dec->done();
+  }
+  return TRUE;
+}
+
 LASreadPoint::~LASreadPoint()
 {
   U32 i;
diff -r e185f18858f4 -r a255003d4ca7 src/lasreadpoint.hpp
--- a/src/lasreadpoint.hpp	Tue Mar 22 10:24:29 2011 -0700
+++ b/src/lasreadpoint.hpp	Tue Mar 22 11:22:22 2011 -0700
@@ -53,7 +53,7 @@
 
   BOOL init(ByteStreamIn* instream);
   BOOL read(U8* const * point);
-  BOOL done() {return TRUE;};
+  BOOL done();
 
 private:
   ByteStreamIn* instream;
diff -r e185f18858f4 -r a255003d4ca7 src/laswriteitemcompressed_v1.cpp
--- a/src/laswriteitemcompressed_v1.cpp	Tue Mar 22 10:24:29 2011 -0700
+++ b/src/laswriteitemcompressed_v1.cpp	Tue Mar 22 11:22:22 2011 -0700
@@ -55,7 +55,7 @@
   U8 user_data;
   U16 point_source_ID;
 };
-
+
 LASwriteItemCompressed_POINT10_v1::LASwriteItemCompressed_POINT10_v1(EntropyEncoder* enc)
 {
   U32 i;


More information about the Liblas-commits mailing list