[Liblas-commits] laszip: new interface for chunking

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Apr 25 19:14:58 EDT 2011


details:   http://hg.liblas.orglaszip/rev/22d7c227b155
changeset: 211:22d7c227b155
user:      isenburg
date:      Mon Apr 25 16:16:45 2011 -0700
description:
new interface for chunking

diffstat:

 include/laszip/lasunzipper.hpp |  13 ++++--
 include/laszip/laszip.hpp      |  72 +++++++++++++++++++++--------------------
 2 files changed, 45 insertions(+), 40 deletions(-)

diffs (153 lines):

diff -r 36aebde5b17f -r 22d7c227b155 include/laszip/lasunzipper.hpp
--- a/include/laszip/lasunzipper.hpp	Thu Apr 07 03:58:40 2011 -0700
+++ b/include/laszip/lasunzipper.hpp	Mon Apr 25 16:16:45 2011 -0700
@@ -24,13 +24,14 @@
   
   CHANGE HISTORY:
   
+    23 April 2011 -- changed interface for easier future compressor support
     10 January 2011 -- licensing change for LGPL release and liblas integration
     12 December 2010 -- created from LASwriter/LASreader after Howard got pushy (-;
   
 ===============================================================================
 */
-#ifndef LAS_UNZIPPER_H
-#define LAS_UNZIPPER_H
+#ifndef LAS_UNZIPPER_HPP
+#define LAS_UNZIPPER_HPP
 
 #include <stdio.h>
 
@@ -50,8 +51,10 @@
 class LASZIP_DLL LASunzipper
 {
 public:
-  unsigned int open(FILE* file, unsigned int num_items, const LASitem items[], LASzip::Algorithm algorithm);
-  unsigned int open(istream& stream, unsigned int num_items, const LASitem items[], LASzip::Algorithm algorithm);
+  unsigned int setup(const LASzip* laszip);
+  unsigned int open(FILE* file);
+  unsigned int open(istream& stream);
+  bool seek(const unsigned int position);
   bool read(unsigned char * const * point);
   unsigned int close();
 
@@ -59,7 +62,7 @@
   ~LASunzipper();
 
 private:
-  int count;
+  unsigned int count;
   ByteStreamIn* stream;
   LASreadPoint* reader;
 };
diff -r 36aebde5b17f -r 22d7c227b155 include/laszip/laszip.hpp
--- a/include/laszip/laszip.hpp	Thu Apr 07 03:58:40 2011 -0700
+++ b/include/laszip/laszip.hpp	Mon Apr 25 16:16:45 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
@@ -28,11 +28,11 @@
     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
@@ -45,6 +45,17 @@
 #define LASZIP_VERSION_MINOR    2
 #define LASZIP_VERSION_REVISION 0
 
+#define LASZIP_COMPRESSOR_NONE              0
+#define LASZIP_COMPRESSOR_POINTWISE         1
+#define LASZIP_COMPRESSOR_POINTWISE_CHUNKED 2
+
+#define LASZIP_COMPRESSOR_DEFAULT LASZIP_COMPRESSOR_POINTWISE
+#define LASZIP_COMPRESSOR_CHUNKED LASZIP_COMPRESSOR_POINTWISE_CHUNKED
+
+#define LASZIP_CODER_ARITHMETIC             0
+
+#define LASZIP_CHUNK_SIZE_DEFAULT 50000
+
 #include "laszipexport.hpp"
 
 class LASZIP_DLL LASitem
@@ -72,37 +83,28 @@
 {
 public:
 
-  enum Algorithm
-  {
-    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
-  };
-
   LASzip();
   ~LASzip();
 
-  Algorithm algorithm;
+  bool setup(const unsigned int num_items, const LASitem* items, const unsigned short compressor=LASZIP_COMPRESSOR_DEFAULT);
+  void set_chunk_size(const unsigned int chunk_size);
+  void request_version(const unsigned int requested_version);
+
+  // to be stored in LASzip VLR
+  unsigned short compressor;
+  unsigned short coder;
   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  ...               */ 
+  unsigned int chunk_size; 
   SIGNED_INT64 num_points;  /* not mandatory ... -1 if unknown */
   SIGNED_INT64 num_bytes;   /* not mandatory ... -1 if unknown */
   LASitem* items;
+
+  // not to be stored
+  unsigned short requested_version;
 };
 
-/*
-struct LASchunk
-{
-  unsigned int count;
-  unsigned int bytes;
-}; 
-*/
-
-#endif
+#endif


More information about the Liblas-commits mailing list