[Liblas-commits] laszip: adding arithmetic coder to the main branch

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Jan 19 00:05:55 EST 2010


changeset d0eb808ce138 in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=d0eb808ce138
summary: adding arithmetic coder to the main branch

diffstat:

 include/Makefile.am                           |  15 ++++-
 include/lasdefinitions.h                      |  62 +++------------------
 include/laspointreader.h                      |  18 ------
 include/laspointreader0compressed.h           |  32 ++--------
 include/laspointreader0compressedarithmetic.h |  69 ++++++++++++++++++++++++
 include/laspointreader0raw.h                  |  18 ------
 include/laspointreader1compressed.h           |  34 ++---------
 include/laspointreader1compressedarithmetic.h |  74 +++++++++++++++++++++++++
 include/laspointreader1raw.h                  |  18 ------
 include/laspointreader2compressed.h           |  38 +++---------
 include/laspointreader2compressedarithmetic.h |  72 +++++++++++++++++++++++++
 include/laspointreader2raw.h                  |  18 ------
 include/laspointreader3compressed.h           |  40 +++----------
 include/laspointreader3compressedarithmetic.h |  77 +++++++++++++++++++++++++++
 include/laspointreader3raw.h                  |  18 ------
 include/laspointwriter.h                      |  18 ------
 include/laspointwriter0compressed.h           |  32 ++--------
 include/laspointwriter0compressedarithmetic.h |  69 ++++++++++++++++++++++++
 include/laspointwriter0raw.h                  |  18 ------
 include/laspointwriter1compressed.h           |  34 ++---------
 include/laspointwriter1compressedarithmetic.h |  74 +++++++++++++++++++++++++
 include/laspointwriter1raw.h                  |  18 ------
 include/laspointwriter2compressed.h           |  38 +++---------
 include/laspointwriter2compressedarithmetic.h |  72 +++++++++++++++++++++++++
 include/laspointwriter2raw.h                  |  18 ------
 include/laspointwriter3compressed.h           |  40 +++----------
 include/laspointwriter3compressedarithmetic.h |  77 +++++++++++++++++++++++++++
 include/laspointwriter3raw.h                  |  18 ------
 include/lasreader.h                           |  18 ------
 include/laswriter.h                           |  18 ------
 30 files changed, 679 insertions(+), 486 deletions(-)

diffs (truncated from 1532 to 300 lines):

diff -r cfed1d96c9b2 -r d0eb808ce138 include/Makefile.am
--- a/include/Makefile.am	Mon Jan 18 23:56:45 2010 -0500
+++ b/include/Makefile.am	Tue Jan 19 00:05:41 2010 -0500
@@ -2,17 +2,30 @@
 
 laszip_HEADERS =		lasdefinitions.h \
 						laspointreader.h \
+						laspointwriter.h \
 						laspointreader0compressed.h \
 						laspointreader1compressed.h \
 						laspointreader2compressed.h \
+						laspointreader3compressed.h \
 						laspointwriter0compressed.h \
 						laspointwriter1compressed.h \
 						laspointwriter2compressed.h \
+						laspointwriter3compressed.h \
+						laspointreader0compressedarithmetic.h \
+						laspointreader1compressedarithmetic.h \
+						laspointreader2compressedarithmetic.h \
+						laspointreader3compressedarithmetic.h \
+						laspointwriter0compressedarithmetic.h \
+						laspointwriter1compressedarithmetic.h \
+						laspointwriter2compressedarithmetic.h \
+						laspointwriter3compressedarithmetic.h \
 						laspointreader0raw.h \
 						laspointreader1raw.h \
 						laspointreader2raw.h \
+						laspointreader3raw.h \
 						laspointwriter0raw.h \
 						laspointwriter1raw.h \
 						laspointwriter2raw.h \
+						laspointwriter3raw.h \
 						lasreader.h \
-						laswriter.h 
\ No newline at end of file
+						laswriter.h 
diff -r cfed1d96c9b2 -r d0eb808ce138 include/lasdefinitions.h
--- a/include/lasdefinitions.h	Mon Jan 18 23:56:45 2010 -0500
+++ b/include/lasdefinitions.h	Tue Jan 19 00:05:41 2010 -0500
@@ -1,21 +1,3 @@
-/******************************************************************************
- *
- * Project:  laszip - http://liblas.org -
- * Purpose:
- * Author:   Martin Isenburg
- *           isenburg at cs.unc.edu
- *
- ******************************************************************************
- * Copyright (c) 2009, Martin Isenburg
- *
- * This is free software; you can redistribute and/or modify it under
- * the terms of the GNU Lesser General Licence as published
- * by the Free Software Foundation.
- *
- * See the COPYING file for more information.
- *
- ****************************************************************************/
-
 /*
 ===============================================================================
 
@@ -44,6 +26,7 @@
   
   CHANGE HISTORY:
   
+    17 January 2010 -- added arithmetic coder  
     7 September 2008 -- updated to support LAS format 1.2 
     11 June 2007 -- number of return / scan direction bitfield order was wrong
     18 February 2007 -- created after repairing 2 vacuum cleaners in the garden
@@ -53,6 +36,14 @@
 #ifndef LAS_DEFINITIONS_H
 #define LAS_DEFINITIONS_H
 
+#define ENABLE_LAS_COMPRESSION
+//#undef ENABLE_LAS_COMPRESSION
+
+#ifdef ENABLE_LAS_COMPRESSION
+#define LAS_COMPRESSION_RANGE 1
+#define LAS_COMPRESSION_ARITHMETIC 2
+#endif // ENABLE_LAS_COMPRESSION
+
 class LASpoint
 {
 public:
@@ -246,39 +237,4 @@
   };
 };
 
-static const char * LASpointClassification [] = {
-  "Created, never classified",
-  "Unclassified",
-  "Ground",
-  "Low Vegetation",
-  "Medium Vegetation",
-  "High Vegetation",
-  "Building",
-  "Low Point (noise)",
-  "Model Key-point (mass point)",
-  "Water",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Overlap Points",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition",
-  "Reserved for ASPRS Definition"
-};
-
 #endif
diff -r cfed1d96c9b2 -r d0eb808ce138 include/laspointreader.h
--- a/include/laspointreader.h	Mon Jan 18 23:56:45 2010 -0500
+++ b/include/laspointreader.h	Tue Jan 19 00:05:41 2010 -0500
@@ -1,21 +1,3 @@
-/******************************************************************************
- *
- * Project:  laszip - http://liblas.org -
- * Purpose:
- * Author:   Martin Isenburg
- *           isenburg at cs.unc.edu
- *
- ******************************************************************************
- * Copyright (c) 2009, Martin Isenburg
- *
- * This is free software; you can redistribute and/or modify it under
- * the terms of the GNU Lesser General Licence as published
- * by the Free Software Foundation.
- *
- * See the COPYING file for more information.
- *
- ****************************************************************************/
-
 /*
 ===============================================================================
 
diff -r cfed1d96c9b2 -r d0eb808ce138 include/laspointreader0compressed.h
--- a/include/laspointreader0compressed.h	Mon Jan 18 23:56:45 2010 -0500
+++ b/include/laspointreader0compressed.h	Tue Jan 19 00:05:41 2010 -0500
@@ -1,21 +1,3 @@
-/******************************************************************************
- *
- * Project:  laszip - http://liblas.org -
- * Purpose:
- * Author:   Martin Isenburg
- *           isenburg at cs.unc.edu
- *
- ******************************************************************************
- * Copyright (c) 2009, Martin Isenburg
- *
- * This is free software; you can redistribute and/or modify it under
- * the terms of the GNU Lesser General Licence as published
- * by the Free Software Foundation.
- *
- * See the COPYING file for more information.
- *
- ****************************************************************************/
-
 /*
 ===============================================================================
 
@@ -51,7 +33,7 @@
 
 #include "rangemodel.h"
 #include "rangedecoder.h"
-#include "integercompressor_context.h"
+#include "rangeintegercompressor.h"
 
 #include <stdio.h>
 
@@ -71,16 +53,16 @@
   int last_incr[2];
   void init_decoder();
   RangeDecoder* rd;
-  IntegerCompressorContext* ic_dx;
-  IntegerCompressorContext* ic_dy;
-  IntegerCompressorContext* ic_z;
+  RangeIntegerCompressor* ic_dx;
+  RangeIntegerCompressor* ic_dy;
+  RangeIntegerCompressor* ic_z;
   RangeModel* rm_changed_values;
-  IntegerCompressorContext* ic_intensity;
+  RangeIntegerCompressor* ic_intensity;
   RangeModel* rm_bit_byte;
   RangeModel* rm_classification;
-  IntegerCompressorContext* ic_scan_angle_rank;
+  RangeIntegerCompressor* ic_scan_angle_rank;
   RangeModel* rm_user_data;
-  IntegerCompressorContext* ic_point_source_ID;
+  RangeIntegerCompressor* ic_point_source_ID;
 };
 
 #endif
diff -r cfed1d96c9b2 -r d0eb808ce138 include/laspointreader0compressedarithmetic.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/laspointreader0compressedarithmetic.h	Tue Jan 19 00:05:41 2010 -0500
@@ -0,0 +1,69 @@
+/*
+===============================================================================
+
+  FILE:  laspointreader0compressedarithmetic.h
+  
+  CONTENTS:
+  
+    Reads a point of type 0 (without gps_time) from our compressed LAS format 1.1
+
+  PROGRAMMERS:
+  
+    martin isenburg at cs.unc.edu
+  
+  COPYRIGHT:
+  
+    copyright (C) 2007  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:
+  
+    31 October 2009 -- updated to use the new Arithmetic Coder 
+    7 September 2008 -- updated to support LAS format 1.2 
+    22 February 2007 -- created 45 minutes before henna's 32nd birthday
+  
+===============================================================================
+*/
+#ifndef LAS_POINT_READER_0COMPRESSED_ARITHMETIC_H
+#define LAS_POINT_READER_0COMPRESSED_ARITHMETIC_H
+
+#include "laspointreader.h"
+
+#include "arithmeticmodel.h"
+#include "arithmeticdecoder.h"
+#include "arithmeticintegercompressor.h"
+
+#include <stdio.h>
+
+class LASpointReader0compressedArithmetic : public LASpointReader
+{
+public:
+  bool read_point(LASpoint* point, double* gps_time = 0, unsigned short* rgb = 0);
+  LASpointReader0compressedArithmetic(FILE* file);
+  ~LASpointReader0compressedArithmetic();
+
+private:
+  FILE* file;
+  LASpoint last_point;
+  int last_dir;
+  int last_x_diff[2][3];
+  int last_y_diff[2][3];
+  int last_incr[2];
+  void init_decoder();
+  ArithmeticDecoder* dec;
+  ArithmeticIntegerCompressor* ic_dx;
+  ArithmeticIntegerCompressor* ic_dy;
+  ArithmeticIntegerCompressor* ic_z;
+  ArithmeticModel* m_changed_values;
+  ArithmeticIntegerCompressor* ic_intensity;
+  ArithmeticModel* m_bit_byte;
+  ArithmeticModel* m_classification;
+  ArithmeticIntegerCompressor* ic_scan_angle_rank;
+  ArithmeticModel* m_user_data;
+  ArithmeticIntegerCompressor* ic_point_source_ID;
+};
+
+#endif
diff -r cfed1d96c9b2 -r d0eb808ce138 include/laspointreader0raw.h
--- a/include/laspointreader0raw.h	Mon Jan 18 23:56:45 2010 -0500
+++ b/include/laspointreader0raw.h	Tue Jan 19 00:05:41 2010 -0500
@@ -1,21 +1,3 @@
-/******************************************************************************
- *
- * Project:  laszip - http://liblas.org -
- * Purpose:
- * Author:   Martin Isenburg
- *           isenburg at cs.unc.edu
- *
- ******************************************************************************
- * Copyright (c) 2009, Martin Isenburg
- *
- * This is free software; you can redistribute and/or modify it under
- * the terms of the GNU Lesser General Licence as published
- * by the Free Software Foundation.
- *
- * See the COPYING file for more information.
- *
- ****************************************************************************/


More information about the Liblas-commits mailing list