[Liblas-commits] laszip: mpg: the LAS_ZIP_DLL does not work with my
code. can you...
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Jan 4 18:58:09 EST 2011
details: http://hg.liblas.orglaszip/rev/a8aa0185aa63
changeset: 114:a8aa0185aa63
user: isenburg
date: Tue Jan 04 15:52:11 2011 -0800
description:
mpg: the LAS_ZIP_DLL does not work with my code. can you ifdef it?
Subject: laszip: improved endianness again, renamed compression to algorithm, improved wavepacket13 compressor
details: http://hg.liblas.orglaszip/rev/dcd14845f9ed
changeset: 115:dcd14845f9ed
user: isenburg
date: Tue Jan 04 15:57:54 2011 -0800
description:
improved endianness again, renamed compression to algorithm, improved wavepacket13 compressor
diffstat:
include/laszip/lasunzipper.hpp | 6 +-
include/laszip/laszip.hpp | 90 +++++-----
include/laszip/laszipper.hpp | 6 +-
src/bytestreamin.hpp | 18 +-
src/bytestreamin_file.hpp | 148 ++++++++++++++----
src/bytestreamin_istream.hpp | 148 ++++++++++++++----
src/bytestreamout.hpp | 18 +-
src/bytestreamout_file.hpp | 134 +++++++++++++----
src/bytestreamout_ostream.hpp | 134 +++++++++++++----
src/lasreaditemcompressed_v1.cpp | 28 +++-
src/lasreaditemcompressed_v1.hpp | 3 +-
src/lasreaditemraw.hpp | 40 ++--
src/lasreadpoint.cpp | 12 +-
src/lasreadpoint.hpp | 2 +-
src/lasunzipper.cpp | 18 +-
src/laswriteitemcompressed_v1.cpp | 39 ++++-
src/laswriteitemcompressed_v1.hpp | 3 +-
src/laswriteitemraw.hpp | 40 ++--
src/laswritepoint.cpp | 11 +-
src/laswritepoint.hpp | 2 +-
src/laszip.cpp | 292 ++++++++++++++++++-------------------
src/laszipper.cpp | 18 +-
src/rangemodel.cpp | 10 +-
23 files changed, 793 insertions(+), 427 deletions(-)
diffs (truncated from 1859 to 300 lines):
diff -r 473e998d2955 -r dcd14845f9ed include/laszip/lasunzipper.hpp
--- a/include/laszip/lasunzipper.hpp Tue Jan 04 12:02:44 2011 -0600
+++ b/include/laszip/lasunzipper.hpp Tue Jan 04 15:57:54 2011 -0800
@@ -61,11 +61,11 @@
class ByteStreamIn;
class LASreadPoint;
-class LASZIP_DLL LASunzipper
+class LASunzipper
{
public:
- unsigned int open(FILE* file, unsigned int num_items, const LASitem items[], LASzip::CompressionType compression_type);
- unsigned int open(istream& stream, unsigned int num_items, const LASitem items[], LASzip::CompressionType compression_type);
+ 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);
bool read(unsigned char * const * point);
unsigned int close();
diff -r 473e998d2955 -r dcd14845f9ed include/laszip/laszip.hpp
--- a/include/laszip/laszip.hpp Tue Jan 04 12:02:44 2011 -0600
+++ b/include/laszip/laszip.hpp Tue Jan 04 15:57:54 2011 -0800
@@ -16,36 +16,36 @@
*
****************************************************************************/
-/*
-===============================================================================
-
- 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
-
- 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:
-
+ supported entropy coding scheme
+
+ 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:
+
12 December 2010 -- refactored from lasdefinitions after movies with silke
-
-===============================================================================
-*/
-#ifndef LASZIP_H
-#define LASZIP_H
+
+===============================================================================
+*/
+#ifndef LASZIP_H
+#define LASZIP_H
#if defined(_MSC_VER) && (_MSC_VER < 1300)
#define LZ_WIN32_VC6
@@ -58,10 +58,10 @@
#define LASZIP_VERSION_MINOR 0
#define LASZIP_VERSION_REVISION 0
-#include "export.hpp"
+//#include "export.hpp"
+#define LAS_ZIP_DLL
-
-class LASZIP_DLL LASitem
+class LAS_ZIP_DLL LASitem
{
public:
enum Type { BYTE = 0, SHORT, INT, LONG, FLOAT, DOUBLE, POINT10, GPSTIME11, RGB12, WAVEPACKET13 } type;
@@ -80,23 +80,23 @@
unsigned short version;
};
-class LASZIP_DLL LASzip
+class LAS_ZIP_DLL LASzip
{
public:
- enum CompressionType
- {
- COMPRESSION_NONE = 0,
- COMPRESSION_ARITHMETIC = 1,
- COMPRESSION_RANGE = 2,
- COMPRESSION_DEFAULT = COMPRESSION_ARITHMETIC
- };
-public:
- LASzip();
- ~LASzip();
+ enum Algorithm
+ {
+ POINT_BY_POINT_RAW = 0,
+ POINT_BY_POINT_ARITHMETIC = 1,
+ POINT_BY_POINT_RANGE = 2,
+ DEFAULT_COMPRESSION = POINT_BY_POINT_ARITHMETIC,
+ DEFAULT_RAW = POINT_BY_POINT_RAW
+ };
-public:
- unsigned int compression;
+ LASzip();
+ ~LASzip();
+
+ Algorithm algorithm;
unsigned char version_major;
unsigned char version_minor;
unsigned short version_revision;
@@ -116,4 +116,4 @@
};
*/
-#endif
+#endif
diff -r 473e998d2955 -r dcd14845f9ed include/laszip/laszipper.hpp
--- a/include/laszip/laszipper.hpp Tue Jan 04 12:02:44 2011 -0600
+++ b/include/laszip/laszipper.hpp Tue Jan 04 15:57:54 2011 -0800
@@ -61,11 +61,11 @@
class ByteStreamOut;
class LASwritePoint;
-class LASZIP_DLL LASzipper
+class LASzipper
{
public:
- unsigned int open(FILE* outfile, unsigned int num_items, LASitem items[], LASzip::CompressionType compression_type);
- unsigned int open(ostream& outstream, unsigned int num_items, LASitem items[], LASzip::CompressionType compression_type);
+ unsigned int open(FILE* outfile, unsigned int num_items, LASitem items[], LASzip::Algorithm algorithm);
+ unsigned int open(ostream& outstream, unsigned int num_items, LASitem items[], LASzip::Algorithm algorithm);
bool write(const unsigned char* const * point);
unsigned int close();
diff -r 473e998d2955 -r dcd14845f9ed src/bytestreamin.hpp
--- a/src/bytestreamin.hpp Tue Jan 04 12:02:44 2011 -0600
+++ b/src/bytestreamin.hpp Tue Jan 04 15:57:54 2011 -0800
@@ -51,12 +51,18 @@
virtual unsigned int getByte() = 0;
/* read an array of bytes */
virtual bool getBytes(unsigned char* bytes, unsigned int num_bytes) = 0;
-/* read 16 bit field (for implementing endian swap) */
- virtual bool get16bits(unsigned char* bytes) = 0;
-/* read 32 bit field (for implementing endian swap) */
- virtual bool get32bits(unsigned char* bytes) = 0;
-/* read 64 bit field (for implementing endian swap) */
- virtual bool get64bits(unsigned char* bytes) = 0;
+/* read 16 bit low-endian field */
+ virtual bool get16bitsLE(unsigned char* bytes) = 0;
+/* read 32 bit low-endian field */
+ virtual bool get32bitsLE(unsigned char* bytes) = 0;
+/* read 64 bit low-endian field */
+ virtual bool get64bitsLE(unsigned char* bytes) = 0;
+/* read 16 bit big-endian field */
+ virtual bool get16bitsBE(unsigned char* bytes) = 0;
+/* read 32 bit big-endian field */
+ virtual bool get32bitsBE(unsigned char* bytes) = 0;
+/* read 64 bit big-endian field */
+ virtual bool get64bitsBE(unsigned char* bytes) = 0;
/* is the stream seekable (e.g. standard in is not) */
virtual bool isSeekable() const = 0;
/* returns how many bytes were read since last reset */
diff -r 473e998d2955 -r dcd14845f9ed src/bytestreamin_file.hpp
--- a/src/bytestreamin_file.hpp Tue Jan 04 12:02:44 2011 -0600
+++ b/src/bytestreamin_file.hpp Tue Jan 04 15:57:54 2011 -0800
@@ -56,12 +56,6 @@
unsigned int getByte();
/* read an array of bytes */
bool getBytes(unsigned char* bytes, unsigned int num_bytes);
-/* read 16 bit field (for implementing endian swap) */
- virtual bool get16bits(unsigned char* bytes);
-/* read 32 bit field (for implementing endian swap) */
- virtual bool get32bits(unsigned char* bytes);
-/* read 64 bit field (for implementing endian swap) */
- virtual bool get64bits(unsigned char* bytes);
/* is the stream seekable (e.g. standard in is not) */
bool isSeekable() const;
/* save position in the stream for (forward) seeking later */
@@ -83,16 +77,42 @@
long seek_position;
};
-class ByteStreamInFileEndianSwapped : public ByteStreamInFile
+class ByteStreamInFileLE : public ByteStreamInFile
{
public:
- ByteStreamInFileEndianSwapped(FILE* file);
-/* read 16 bit field (for implementing endian swap) */
- bool get16bits(unsigned char* bytes);
-/* read 32 bit field (for implementing endian swap) */
- bool get32bits(unsigned char* bytes);
-/* read 64 bit field (for implementing endian swap) */
- bool get64bits(unsigned char* bytes);
+ ByteStreamInFileLE(FILE* file);
+/* read 16 bit low-endian field */
+ bool get16bitsLE(unsigned char* bytes);
+/* read 32 bit low-endian field */
+ bool get32bitsLE(unsigned char* bytes);
+/* read 64 bit low-endian field */
+ bool get64bitsLE(unsigned char* bytes);
+/* read 16 bit big-endian field */
+ bool get16bitsBE(unsigned char* bytes);
+/* read 32 bit big-endian field */
+ bool get32bitsBE(unsigned char* bytes);
+/* read 64 bit big-endian field */
+ bool get64bitsBE(unsigned char* bytes);
+private:
+ unsigned char swapped[8];
+};
+
+class ByteStreamInFileBE : public ByteStreamInFile
+{
+public:
+ ByteStreamInFileBE(FILE* file);
+/* read 16 bit low-endian field */
+ bool get16bitsLE(unsigned char* bytes);
+/* read 32 bit low-endian field */
+ bool get32bitsLE(unsigned char* bytes);
+/* read 64 bit low-endian field */
+ bool get64bitsLE(unsigned char* bytes);
+/* read 16 bit big-endian field */
+ bool get16bitsBE(unsigned char* bytes);
+/* read 32 bit big-endian field */
+ bool get32bitsBE(unsigned char* bytes);
+/* read 64 bit big-endian field */
+ bool get64bitsBE(unsigned char* bytes);
private:
unsigned char swapped[8];
};
@@ -109,7 +129,7 @@
int byte = getc(file);
if (byte == EOF)
{
- //fprintf(stderr, "reading EOF\n");
+// fprintf(stderr, "reading EOF\n");
byte = 0;
}
return (unsigned int)byte;
@@ -120,21 +140,6 @@
return (fread(bytes, 1, num_bytes, file) == num_bytes);
}
-inline bool ByteStreamInFile::get16bits(unsigned char* bytes)
-{
- return getBytes(bytes, 2);
-}
-
-inline bool ByteStreamInFile::get32bits(unsigned char* bytes)
-{
- return getBytes(bytes, 4);
-}
-
-inline bool ByteStreamInFile::get64bits(unsigned char* bytes)
-{
- return getBytes(bytes, 8);
-}
-
inline bool ByteStreamInFile::isSeekable() const
{
return (file != stdin);
@@ -161,11 +166,26 @@
start = ftell(file);
}
-inline ByteStreamInFileEndianSwapped::ByteStreamInFileEndianSwapped(FILE* file) : ByteStreamInFile(file)
+inline ByteStreamInFileLE::ByteStreamInFileLE(FILE* file) : ByteStreamInFile(file)
{
}
-inline bool ByteStreamInFileEndianSwapped::get16bits(unsigned char* bytes)
+inline bool ByteStreamInFileLE::get16bitsLE(unsigned char* bytes)
+{
+ return getBytes(bytes, 2);
More information about the Liblas-commits
mailing list