[Liblas-commits] laszip: pull-merge

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Jan 12 16:57:13 EST 2011


details:   http://hg.liblas.orglaszip/rev/d464a9150b13
changeset: 143:d464a9150b13
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Wed Jan 12 13:55:19 2011 -0800
description:
pull-merge

diffstat:

 include/laszip/export.hpp         |  23 -----------
 include/laszip/laszipexport.hpp   |  23 +++++++++++
 src/CMakeLists.txt                |   2 +-
 src/lasreaditemcompressed_v1.cpp  |   1 +
 src/laswriteitemcompressed_v1.cpp |   1 +
 src/laswritepoint.cpp             |  76 ++++++++++++++++++++------------------
 tools/laszippertest.cpp           |  45 ++++++++++++++++++----
 7 files changed, 101 insertions(+), 70 deletions(-)

diffs (truncated from 377 to 300 lines):

diff -r cd0c52aa33c2 -r d464a9150b13 include/laszip/export.hpp
--- a/include/laszip/export.hpp	Wed Jan 12 13:28:11 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/* DLL export definitions for LASzip */
-
-#ifndef LASZIPEXPORT_H
-#define LASZIPEXPORT_H
-
-#ifndef LASZIP_DLL
-#if (defined(_MSC_VER) || defined __CYGWIN__) && !defined(LAS_DISABLE_DLL)
-    #if defined(LASZIP_DLL_EXPORT)
-    #   define LASZIP_DLL   __declspec(dllexport)
-    #elif defined(LASZIP_DLL_IMPORT)
-    #   define LASZIP_DLL   __declspec(dllimport)
-    #endif
-#else
-    #  if defined(USE_GCC_VISIBILITY_FLAG)
-    #    define LASZIP_DLL     __attribute__ ((visibility("default")))
-    #  else
-    #    define LASZIP_DLL
-    #  endif
-#endif
-#endif
-
-
-#endif
diff -r cd0c52aa33c2 -r d464a9150b13 include/laszip/laszipexport.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/laszip/laszipexport.hpp	Wed Jan 12 13:55:19 2011 -0800
@@ -0,0 +1,23 @@
+/* DLL export definitions for LASzip */
+
+#ifndef LASZIPEXPORT_H
+#define LASZIPEXPORT_H
+
+#ifndef LASZIP_DLL
+#if (defined(_MSC_VER) || defined __CYGWIN__) && !defined(LAS_DISABLE_DLL)
+    #if defined(LASZIP_DLL_EXPORT)
+    #   define LASZIP_DLL   __declspec(dllexport)
+    #elif defined(LASZIP_DLL_IMPORT)
+    #   define LASZIP_DLL   __declspec(dllimport)
+    #endif
+#else
+    #  if defined(USE_GCC_VISIBILITY_FLAG)
+    #    define LASZIP_DLL     __attribute__ ((visibility("default")))
+    #  else
+    #    define LASZIP_DLL
+    #  endif
+#endif
+#endif
+
+
+#endif
diff -r cd0c52aa33c2 -r d464a9150b13 src/CMakeLists.txt
--- a/src/CMakeLists.txt	Wed Jan 12 13:28:11 2011 -0800
+++ b/src/CMakeLists.txt	Wed Jan 12 13:55:19 2011 -0800
@@ -9,7 +9,7 @@
 set(LASZIP_HEADERS_DIR ../include/laszip)
 
 set(LASZIP_HPP
-  ${LASZIP_HEADERS_DIR}/export.hpp
+  ${LASZIP_HEADERS_DIR}/laszipexport.hpp
   ${LASZIP_HEADERS_DIR}/laszip.hpp
   ${LASZIP_HEADERS_DIR}/laszipper.hpp
   ${LASZIP_HEADERS_DIR}/lasunzipper.hpp
diff -r cd0c52aa33c2 -r d464a9150b13 src/lasreaditemcompressed_v1.cpp
--- a/src/lasreaditemcompressed_v1.cpp	Wed Jan 12 13:28:11 2011 -0800
+++ b/src/lasreaditemcompressed_v1.cpp	Wed Jan 12 13:55:19 2011 -0800
@@ -290,6 +290,7 @@
 LASreadItemCompressed_GPSTIME11_v1::~LASreadItemCompressed_GPSTIME11_v1()
 {
   dec->destroySymbolModel(m_gpstime_multi);
+  dec->destroySymbolModel(m_gpstime_0diff);
   delete ic_gpstime;
 }
 
diff -r cd0c52aa33c2 -r d464a9150b13 src/laswriteitemcompressed_v1.cpp
--- a/src/laswriteitemcompressed_v1.cpp	Wed Jan 12 13:28:11 2011 -0800
+++ b/src/laswriteitemcompressed_v1.cpp	Wed Jan 12 13:55:19 2011 -0800
@@ -292,6 +292,7 @@
 LASwriteItemCompressed_GPSTIME11_v1::~LASwriteItemCompressed_GPSTIME11_v1()
 {
   enc->destroySymbolModel(m_gpstime_multi);
+  enc->destroySymbolModel(m_gpstime_0diff);
   delete ic_gpstime;
 }
 
diff -r cd0c52aa33c2 -r d464a9150b13 src/laswritepoint.cpp
--- a/src/laswritepoint.cpp	Wed Jan 12 13:28:11 2011 -0800
+++ b/src/laswritepoint.cpp	Wed Jan 12 13:55:19 2011 -0800
@@ -16,40 +16,40 @@
  *
  ****************************************************************************/
 
-/*
-===============================================================================
-
-  FILE:  laswritepoint.cpp
-  
-  CONTENTS:
-  
-    see corresponding header file
-  
-  PROGRAMMERS:
-  
-    martin isenburg at cs.unc.edu
-  
-  COPYRIGHT:
-  
-    copyright (C) 2007-10  martin isenburg at cs.unc.edu
-    
-    This software is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  
-  CHANGE HISTORY:
-  
-    see corresponding header file
-  
-===============================================================================
-*/
-
-#include "laswritepoint.hpp"
+/*
+===============================================================================
+
+  FILE:  laswritepoint.cpp
+  
+  CONTENTS:
+  
+    see corresponding header file
+  
+  PROGRAMMERS:
+  
+    martin isenburg at cs.unc.edu
+  
+  COPYRIGHT:
+  
+    copyright (C) 2007-10  martin isenburg at cs.unc.edu
+    
+    This software is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  
+  CHANGE HISTORY:
+  
+    see corresponding header file
+  
+===============================================================================
+*/
+
+#include "laswritepoint.hpp"
 
 #include "arithmeticencoder.hpp"
-#ifdef LASZIP_HAVE_RANGECODER
+#ifdef LASZIP_HAVE_RANGECODER
 #include "rangeencoder.hpp"
-#endif
+#endif
 #include "laswriteitemraw.hpp"
 #include "laswriteitemcompressed_v1.hpp"
 
@@ -81,11 +81,11 @@
   case LASzip::POINT_BY_POINT_RAW:
     enc = 0;
     break;
-#ifdef LASZIP_HAVE_RANGECODER
+#ifdef LASZIP_HAVE_RANGECODER
   case LASzip::POINT_BY_POINT_RANGE:
     enc = new RangeEncoder();
     break;
-#endif
+#endif
   case LASzip::POINT_BY_POINT_ARITHMETIC:
     enc = new ArithmeticEncoder();
     break;
@@ -222,7 +222,7 @@
   }
   return TRUE;
 }
-
+
 BOOL LASwritePoint::done()
 {
   if (enc)
@@ -232,16 +232,17 @@
   return TRUE;
 }
 
-LASwritePoint::~LASwritePoint()
+LASwritePoint::~LASwritePoint()
 {
   U32 i;
 
   if (writers_raw)
-  {
+  {
     for (i = 0; i < num_writers; i++)
     {
       delete writers_raw[i];
     }
+    delete[] writers_raw;
   }
   if (writers_compressed)
   {
@@ -249,9 +250,10 @@
     {
       delete writers_compressed[i];
     }
+    delete[] writers_compressed;
   }
   if (enc)
   {
     delete enc;
   }
-}
+}
diff -r cd0c52aa33c2 -r d464a9150b13 tools/laszippertest.cpp
--- a/tools/laszippertest.cpp	Wed Jan 12 13:28:11 2011 -0800
+++ b/tools/laszippertest.cpp	Wed Jan 12 13:55:19 2011 -0800
@@ -142,7 +142,10 @@
 
   LASzipper* laszipper1 = new LASzipper(); // without compression
   LASzipper* laszipper2 = new LASzipper(); // with arithmetic compression
-  LASzipper* laszipper3 = new LASzipper(); // with range compression
+  LASzipper* laszipper3 = NULL;
+#ifdef LASZIP_HAVE_RANGECODER
+  laszipper3 = new LASzipper(); // with range compression
+#endif
 
   if (use_iostream)
   {
@@ -174,6 +177,7 @@
       return 0;
     }
 
+#ifdef LASZIP_HAVE_RANGECODER
 #ifdef LZ_WIN32_VC6 
     ofb3.open("test3.lax", ios::out);
     ofb3.setmode(filebuf::binary);
@@ -187,6 +191,9 @@
       fprintf(stderr, "ERROR: could not open laszipper3\n");
       return 0;
     }
+#else
+    fprintf(stderr, "(skipping range coder test)\n");
+#endif
   }
   else
   {
@@ -204,12 +211,16 @@
       return 0;
     }
 
+#ifdef LASZIP_HAVE_RANGECODER
     ofile3 = fopen("test3.lax", "wb");
     if (laszipper3->open(ofile3, num_items, items, LASzip::POINT_BY_POINT_RANGE) != 0)
     {
       fprintf(stderr, "ERROR: could not open laszipper3\n");
       return 0;
     }
+#else
+    fprintf(stderr, "(skipping range coder test)\n");
+#endif
   }
 
   // write / compress num_points with "random" data
@@ -244,6 +255,7 @@
   end_time = taketime();
   fprintf(stderr, "laszipper2 wrote %d bytes in %g seconds\n", num_bytes, end_time-start_time);
 
+#ifdef LASZIP_HAVE_RANGECODER
   start_time = taketime();
   c = 0;
   for (i = 0; i < num_points; i++)
@@ -258,11 +270,11 @@
   num_bytes = laszipper3->close();
   end_time = taketime();
   fprintf(stderr, "laszipper3 wrote %d bytes in %g seconds\n", num_bytes, end_time-start_time);
+#endif
 
   delete laszipper1;
   delete laszipper2;
   delete laszipper3;
-
   if (use_iostream)
   {
     delete ostream1;
@@ -276,14 +288,20 @@
   }
   else
   {
-    fclose(ofile1);
-    fclose(ofile2);
-    fclose(ofile3);
+    if (ofile1)
+        fclose(ofile1);
+    if (ofile2)
+        fclose(ofile2);


More information about the Liblas-commits mailing list