Skip to content
Commits on Source (5)
9 November 2019 -- upped version to 3.4 revision 3 for selective decompression extra bytes fix
9 November 2019 -- fix for selective decompression of more than 16 extra bytes in new point types 6 or higher
9 November 2019 -- moved UTF8toUTF16() function from laszip.hpp to mydefs.hpp and added new mydefs.cpp
16 October 2019 -- unicode support added for Windows LASzip.dll via in new UTF8toUTF16() function
11 August 2019 -- added CMake for DLL build and minor fixes to allow 64 bit Windows compile of LASzip.dll
11 April 2019 -- increase AC_BUFFER_SIZE from 1024 to 4096 to lower chance of ultra-rare propagate_carry() overflow
10 April 2019 -- fix potential memory leaks found by Connor Manning using valgrind
31 March 2019 -- better license terms for core arithmetic coder thanks to Amir Said. upgrade to version 3.4 rev 0
......
......@@ -7,7 +7,7 @@ set(ROOT_DIR "${PROJECT_SOURCE_DIR}")
# the next line is the ONLY place in the entire laszip system where
# the version info is hard-coded
set(LASZIP_API_VERSION_STRING "3.4.1" CACHE STRING "LASzip version" FORCE)
set(LASZIP_API_VERSION_STRING "3.4.3" CACHE STRING "LASzip version" FORCE)
include (CheckIncludeFileCXX)
include(${ROOT_DIR}/cmake/common.cmake NO_POLICY_SCOPE)
......@@ -41,7 +41,7 @@ set(LASZIP_API_VERSION ${LASZIP_API_VERSION_MAJOR}.${LASZIP_API_VERSION_MINOR}.$
# libtool SO version naming
# 8.0.0 for 3.2.1
# 9.0.0 for 4.0+
set(LASZIP_SO_VERSION "8.0.4")
set(LASZIP_SO_VERSION "8.0.5")
set(LASZIP_COMPATIBILITY_VERSION 8)
check_include_file_cxx ("unordered_map" HAVE_UNORDERED_MAP)
......
laszip (3.4.1-3) UNRELEASED; urgency=medium
laszip (3.4.3-1) unstable; urgency=medium
* New upstream release.
* Update Homepage URL to use HTTPS.
* Bump Standards-Version to 4.4.1, no changes.
* Add lintian override for shared-lib-without-dependency-information.
-- Bas Couwenberg <sebastic@debian.org> Mon, 29 Jul 2019 06:56:51 +0200
-- Bas Couwenberg <sebastic@debian.org> Tue, 12 Nov 2019 05:41:08 +0100
laszip (3.4.1-2) unstable; urgency=medium
......
# symbols are problematic for C++ libraries.
no-symbols-control-file *
# API library
shared-lib-without-dependency-information *
......@@ -957,7 +957,11 @@ laszip_I32 laszip_load_dll()
}
// Load DLL file
#ifdef _WIN32
#ifdef _WIN64
laszip_HINSTANCE = LoadLibrary(TEXT("LASzip64.dll"));
#else
laszip_HINSTANCE = LoadLibrary(TEXT("LASzip.dll"));
#endif // _WIN64
#elif __APPLE__
laszip_HINSTANCE = LoadLibrary("liblaszip.dylib", RTLD_NOW);
#else
......
......@@ -41,16 +41,16 @@ master_doc = 'index'
# General information about the project.
project = u'LASzip'
copyright = u'2018, Martin Isenburg'
copyright = u'2019, Martin Isenburg'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '3.2.8'
version = '3.4.3'
# The full version, including alpha/beta/rc tags.
release = '3.2.8'
release = '3.4.3'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
......
......@@ -9,15 +9,20 @@ LASzip - a free open source product of `rapidlasso GmbH <http://rapidlasso.com/>
Source
..............................................................................
* **2019-04-12**
* **2019-11-11**
- `laszip-3.4.1.tar.gz <https://github.com/LASzip/LASzip/releases/download/3.4.1/laszip-src-3.4.1.tar.gz>`_
`(md5) <https://github.com/LASzip/LASzip/releases/download/3.4.1/laszip-src-3.4.1.tar.gz.sha256sum>`__
- `laszip-3.4.3.tar.gz <https://github.com/LASzip/LASzip/releases/download/3.4.3/laszip-src-3.4.3.tar.gz>`_
`(md5) <https://github.com/LASzip/LASzip/releases/download/3.4.3/laszip-src-3.4.3.tar.gz.sha256sum>`__
Past Release(s)
~~~~~~~~~~~~~~~~~~~~~~~~~
* **2019-04-12**
- `laszip-3.4.1.tar.gz <https://github.com/LASzip/LASzip/releases/download/3.4.1/laszip-src-3.4.1.tar.gz>`_
`(md5) <https://github.com/LASzip/LASzip/releases/download/3.4.1/laszip-src-3.4.1.tar.gz.sha256sum>`__
* **2018-12-27**
- `laszip-3.2.9.tar.gz <https://github.com/LASzip/LASzip/releases/download/3.2.9/laszip-src-3.2.9.tar.gz>`_
......
......@@ -18,7 +18,6 @@ set(LASZIP_SOURCES
lasreaditemcompressed_v3.cpp
lasreaditemcompressed_v4.cpp
lasreadpoint.cpp
#lasunzipper.cpp
laswriteitemcompressed_v1.cpp
laswriteitemcompressed_v2.cpp
laswriteitemcompressed_v3.cpp
......@@ -26,6 +25,7 @@ set(LASZIP_SOURCES
laswritepoint.cpp
laszip.cpp
laszip_dll.cpp
mydefs.cpp
)
add_definitions(-DLASZIPDLL_EXPORTS)
......
......@@ -342,7 +342,13 @@ BOOL LASindex::read(const char* file_name)
name[strlen(name)-2] = 'a';
name[strlen(name)-1] = 'x';
}
#ifdef _MSC_VER
wchar_t* utf16_name = UTF8toUTF16(name);
FILE* file = _wfopen(utf16_name, L"rb");
delete [] utf16_name;
#else
FILE* file = fopen(name, "rb");
#endif
if (file == 0)
{
free(name);
......@@ -379,7 +385,13 @@ BOOL LASindex::append(const char* file_name) const
lasreader->close();
#ifdef _MSC_VER
wchar_t* utf16_file_name = UTF8toUTF16(file_name);
FILE* file = _wfopen(utf16_file_name, L"rb");
delete [] utf16_file_name;
#else
FILE* file = fopen(file_name, "rb");
#endif
ByteStreamIn* bytestreamin = 0;
if (IS_LITTLE_ENDIAN())
bytestreamin = new ByteStreamInFileLE(file);
......@@ -443,7 +455,13 @@ BOOL LASindex::append(const char* file_name) const
fclose(file);
ByteStreamOut* bytestreamout;
#ifdef _MSC_VER
utf16_file_name = UTF8toUTF16(file_name);
file = _wfopen(utf16_file_name, L"rb+");
delete [] utf16_file_name;
#else
file = fopen(file_name, "rb+");
#endif
if (IS_LITTLE_ENDIAN())
bytestreamout = new ByteStreamOutFileLE(file);
else
......@@ -517,7 +535,13 @@ BOOL LASindex::write(const char* file_name) const
name[strlen(name)-2] = 'a';
name[strlen(name)-1] = 'x';
}
#ifdef _MSC_VER
wchar_t* utf16_name = UTF8toUTF16(name);
FILE* file = _wfopen(utf16_name, L"wb");
delete [] utf16_name;
#else
FILE* file = fopen(name, "wb");
#endif
if (file == 0)
{
fprintf(stderr,"ERROR (LASindex): cannot open '%s' for write\n", name);
......
......@@ -53,7 +53,7 @@ class LASreader;
class ByteStreamIn;
class ByteStreamOut;
class LASindex
class LASLIB_DLL LASindex
{
public:
LASindex();
......
......@@ -301,7 +301,7 @@ void LASinterval::merge_intervals(U32 maximum_intervals, const BOOL verbose)
}
map_element++;
}
fprintf(stderr,"largest interval gap increased to %u\n", diff);
if (verbose) fprintf(stderr,"largest interval gap increased to %u\n", diff);
// update totals
......
......@@ -25,6 +25,7 @@
CHANGE HISTORY:
10 May 2019 -- checking for overflows in X, Y, Z of I32 of fixed-point LAS
15 June 2018 -- fix in flag copy from legacy (0-5) to extended (6-10) type
10 March 2017 -- fix in copy_to() and copy_from() new LAS 1.4 point types
10 October 2016 -- small fixes for NIR and extended scanner channel
......@@ -560,7 +561,9 @@ public:
inline U16 get_point_source_ID() const { return point_source_ID; };
inline U8 get_deleted_flag() const { return deleted_flag; };
inline F64 get_gps_time() const { return gps_time; };
inline const U16* get_rgb() const { return rgb; };
inline const U16* get_RGB() const { return rgb; };
inline const U16* get_RGBI() const { return rgb; };
inline U16 get_RGBI(const U32 band) const { return rgb[band]; };
inline U16 get_R() const { return rgb[0]; };
inline U16 get_G() const { return rgb[1]; };
inline U16 get_B() const { return rgb[2]; };
......@@ -586,6 +589,7 @@ public:
inline void set_gps_time(const F64 gps_time) { this->gps_time = gps_time; };
inline void set_RGB(const U16* rgb) { memcpy(this->rgb, rgb, sizeof(U16) * 3); };
inline void set_RGBI(const U16* rgb) { memcpy(this->rgb, rgb, sizeof(U16) * 4); };
inline void set_RGBI(const U32 band, const U16 value) { rgb[band] = value; };
inline void set_R(const U16 R) { this->rgb[0] = R; };
inline void set_G(const U16 G) { this->rgb[1] = G; };
inline void set_B(const U16 B) { this->rgb[2] = B; };
......@@ -596,9 +600,9 @@ public:
inline F64 get_y() const { return quantizer->get_y(Y); };
inline F64 get_z() const { return quantizer->get_z(Z); };
inline void set_x(const F64 x) { this->X = quantizer->get_X(x); };
inline void set_y(const F64 y) { this->Y = quantizer->get_Y(y); };
inline void set_z(const F64 z) { this->Z = quantizer->get_Z(z); };
inline BOOL set_x(const F64 x) { I64 X = quantizer->get_X(x); this->X = (I32)(X); return I32_FITS_IN_RANGE(X); };
inline BOOL set_y(const F64 y) { I64 Y = quantizer->get_Y(y); this->Y = (I32)(Y); return I32_FITS_IN_RANGE(Y); };
inline BOOL set_z(const F64 z) { I64 Z = quantizer->get_Z(z); this->Z = (I32)(Z); return I32_FITS_IN_RANGE(Z); };
inline BOOL is_extended_point_type() const { return extended_point_type; };
......@@ -628,18 +632,23 @@ public:
coordinates[2] = get_z();
};
inline void compute_XYZ()
inline BOOL compute_XYZ()
{
set_x(coordinates[0]);
set_y(coordinates[1]);
set_z(coordinates[2]);
BOOL retX = set_x(coordinates[0]);
BOOL retY = set_y(coordinates[1]);
BOOL retZ = set_z(coordinates[2]);
return (retX && retY && retZ);
};
inline void compute_XYZ(const LASquantizer* quantizer)
inline BOOL compute_XYZ(const LASquantizer* quantizer)
{
X = quantizer->get_X(coordinates[0]);
Y = quantizer->get_Y(coordinates[1]);
Z = quantizer->get_Z(coordinates[2]);
I64 X = quantizer->get_X(coordinates[0]);
I64 Y = quantizer->get_Y(coordinates[1]);
I64 Z = quantizer->get_Z(coordinates[2]);
this->X = (I32)(X);
this->Y = (I32)(Y);
this->Z = (I32)(Z);
return (I32_FITS_IN_RANGE(X) && I32_FITS_IN_RANGE(Y) && I32_FITS_IN_RANGE(Z));
};
// generic functions for attributes in extra bytes
......
......@@ -42,7 +42,7 @@ class ByteStreamOut;
#define LAS_SPATIAL_QUAD_TREE 0
class LASquadtree
class LASLIB_DLL LASquadtree
{
public:
LASquadtree();
......
......@@ -51,9 +51,9 @@ public:
inline F64 get_y(const I32 Y) const { return y_scale_factor*Y+y_offset; };
inline F64 get_z(const I32 Z) const { return z_scale_factor*Z+z_offset; };
inline I32 get_X(const F64 x) const { if (x >= x_offset) return (I32)((x-x_offset)/x_scale_factor+0.5); else return (I32)((x-x_offset)/x_scale_factor-0.5); };
inline I32 get_Y(const F64 y) const { if (y >= y_offset) return (I32)((y-y_offset)/y_scale_factor+0.5); else return (I32)((y-y_offset)/y_scale_factor-0.5); };
inline I32 get_Z(const F64 z) const { if (z >= z_offset) return (I32)((z-z_offset)/z_scale_factor+0.5); else return (I32)((z-z_offset)/z_scale_factor-0.5); };
inline I64 get_X(const F64 x) const { if (x >= x_offset) return (I64)(((x-x_offset)/x_scale_factor)+0.5); else return (I64)(((x-x_offset)/x_scale_factor)-0.5); };
inline I64 get_Y(const F64 y) const { if (y >= y_offset) return (I64)(((y-y_offset)/y_scale_factor)+0.5); else return (I64)(((y-y_offset)/y_scale_factor)-0.5); };
inline I64 get_Z(const F64 z) const { if (z >= z_offset) return (I64)(((z-z_offset)/z_scale_factor)+0.5); else return (I64)(((z-z_offset)/z_scale_factor)-0.5); };
LASquantizer()
{
......
......@@ -2133,8 +2133,15 @@ LASreadItemCompressed_BYTE14_v3::LASreadItemCompressed_BYTE14_v3(ArithmeticDecod
changed_Bytes[i] = FALSE;
if (i > 15) // currently only the first 16 extra bytes can be selectively decompressed
{
requested_Bytes[i] = TRUE;
}
else
{
requested_Bytes[i] = (decompress_selective & (LASZIP_DECOMPRESS_SELECTIVE_BYTE0 << i) ? TRUE : FALSE);
}
}
/* init the bytes buffer to zero */
......
......@@ -2133,8 +2133,15 @@ LASreadItemCompressed_BYTE14_v4::LASreadItemCompressed_BYTE14_v4(ArithmeticDecod
changed_Bytes[i] = FALSE;
if (i > 15) // currently only the first 16 extra bytes can be selectively decompressed
{
requested_Bytes[i] = TRUE;
}
else
{
requested_Bytes[i] = (decompress_selective & (LASZIP_DECOMPRESS_SELECTIVE_BYTE0 << i) ? TRUE : FALSE);
}
}
/* init the bytes buffer to zero */
......
......@@ -545,11 +545,11 @@ BOOL LASreadPoint::check_end()
if (current_chunk < tabled_chunks)
{
I64 here = instream->tell();
if (chunk_starts[current_chunk] != here)
if (chunk_starts[current_chunk] != here) // then last chunk was corrupt
{
// create error string
if (last_error == 0) last_error = new CHAR[128];
// last chunk was corrupt
// report error
sprintf(last_error, "chunk with index %u of %u is corrupt", current_chunk, tabled_chunks);
return FALSE;
}
......@@ -603,6 +603,10 @@ BOOL LASreadPoint::read_chunk_table()
// no choice but to fail if adaptive chunking was used
if (chunk_size == U32_MAX)
{
// create error string
if (last_error == 0) last_error = new CHAR[128];
// report error
sprintf(last_error, "compressor was interrupted before writing adaptive chunk table of LAZ file");
return FALSE;
}
// otherwise we build the chunk table as we read the file
......@@ -614,6 +618,10 @@ BOOL LASreadPoint::read_chunk_table()
}
chunk_starts[0] = chunks_start;
tabled_chunks = 1;
// create warning string
if (last_warning == 0) last_warning = new CHAR[128];
// report warning
sprintf(last_warning, "compressor was interrupted before writing chunk table of LAZ file");
return TRUE;
}
......@@ -733,9 +741,33 @@ BOOL LASreadPoint::read_chunk_table()
}
// create warning string
if (last_warning == 0) last_warning = new CHAR[128];
// first seek to the end of the file
instream->seekEnd();
// get position of last byte
I64 last_position = instream->tell();
// warn if last byte position is before chunk table start position
if (last_position <= chunk_table_start_position)
{
// report warning
if (last_position == chunk_table_start_position)
{
sprintf(last_warning, "chunk table is missing. improper use of LAZ compressor?");
}
else
{
#ifdef _WIN32
sprintf(last_warning, "chunk table and %I64d bytes are missing. LAZ file truncated during copy or transfer?", chunk_table_start_position - last_position);
#else
sprintf(last_warning, "chunk table and %lld bytes are missing. LAZ file truncated during copy or transfer?", chunk_table_start_position - last_position);
#endif
}
}
else
{
// report warning
sprintf(last_warning, "corrupt chunk table");
}
}
if (!instream->seek(chunks_start))
{
return FALSE;
......
......@@ -52,9 +52,7 @@ typedef struct LASpoint14
U8 scan_direction_flag : 1;
U8 edge_of_flight_line : 1;
U8 legacy_classification : 5;
U8 legacy_synthetic_flag : 1;
U8 legacy_keypoint_flag : 1;
U8 legacy_withheld_flag : 1;
U8 legacy_flags : 3;
I8 legacy_scan_angle_rank;
U8 user_data;
U16 point_source_ID;
......@@ -206,6 +204,8 @@ LASwriteItemCompressed_POINT14_v3::~LASwriteItemCompressed_POINT14_v3()
delete outstream_point_source;
delete outstream_gps_time;
}
// fprintf(stderr, "%u %u %u %u %u %u %u %u %u\n", num_bytes_channel_returns_XY, num_bytes_Z, num_bytes_classification, num_bytes_flags, num_bytes_intensity, num_bytes_scan_angle, num_bytes_user_data, num_bytes_point_source, num_bytes_gps_time);
}
inline BOOL LASwriteItemCompressed_POINT14_v3::createAndInitModelsAndCompressors(U32 context, const U8* item)
......
......@@ -52,9 +52,7 @@ typedef struct LASpoint14
U8 scan_direction_flag : 1;
U8 edge_of_flight_line : 1;
U8 legacy_classification : 5;
U8 legacy_synthetic_flag : 1;
U8 legacy_keypoint_flag : 1;
U8 legacy_withheld_flag : 1;
U8 legacy_flags : 3;
I8 legacy_scan_angle_rank;
U8 user_data;
U16 point_source_ID;
......
......@@ -13,7 +13,7 @@
COPYRIGHT:
(c) 2007-2013, martin isenburg, rapidlasso - fast tools to catch reality
(c) 2007-2019, martin isenburg, rapidlasso - fast tools to catch reality
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
......@@ -29,7 +29,9 @@
===============================================================================
*/
#include "laszip.hpp"
#include "mydefs.hpp"
#include <assert.h>
#include <string.h>
......@@ -1001,3 +1003,4 @@ const char* LASitem::get_name() const
}
return 0;
}