[Liblas-commits] laszip: the updated laszippertest. does not yet
test seeking.
liblas-commits at liblas.org
liblas-commits at liblas.org
Mon Apr 25 19:29:32 EDT 2011
details: http://hg.liblas.orglaszip/rev/adeb854f4738
changeset: 218:adeb854f4738
user: isenburg
date: Mon Apr 25 16:31:25 2011 -0700
description:
the updated laszippertest. does not yet test seeking.
diffstat:
tools/laszippertest.cpp | 108 +++++++++++++++++++++++++++++------------------
1 files changed, 66 insertions(+), 42 deletions(-)
diffs (147 lines):
diff -r 8b9ecc00ba69 -r adeb854f4738 tools/laszippertest.cpp
--- a/tools/laszippertest.cpp Mon Apr 25 16:28:13 2011 -0700
+++ b/tools/laszippertest.cpp Mon Apr 25 16:31:25 2011 -0700
@@ -282,50 +282,65 @@
return;
}
+//---------------------------------------------------------------------------
+
+static LASzipper* make_zipper(LASzip* laszip)
+{
+ LASzipper* zipper = new LASzipper();
+ int stat = zipper->setup(laszip);
+ if (stat != 0)
+ {
+ log("ERROR: could not make laszipper\n");
+ exit(1);
+ }
+ return zipper;
+}
+
+//---------------------------------------------------------------------------
+
+static void open_zipper(LASzipper* zipper, OStream* ost)
+{
+ int stat = 0;
+ if (ost->m_use_iostream)
+ stat = zipper->open(*ost->streamo);
+ else
+ stat = zipper->open(ost->ofile);
+ if (stat != 0)
+ {
+ log("ERROR: could not open laszipper with %s\n", ost->m_filename);
+ exit(1);
+ }
+}
//---------------------------------------------------------------------------
-static LASzipper* make_zipper(OStream* ost, PointData& data, LASzip::Algorithm alg)
+static LASunzipper* make_unzipper(LASzip* laszip)
{
- LASzipper* zipper = new LASzipper();
-
- int stat = 0;
- if (ost->m_use_iostream)
- stat = zipper->open(*ost->streamo, data.num_items, data.items, alg);
- else
- stat = zipper->open(ost->ofile, data.num_items, data.items, alg);
-
+ LASunzipper* unzipper = new LASunzipper();
+ int stat = unzipper->setup(laszip);
if (stat != 0)
{
- log("ERROR: could not open laszipper with %s\n", ost->m_filename);
+ log("ERROR: could not make lasunzipper\n");
exit(1);
}
-
- return zipper;
-}
-
-
-//---------------------------------------------------------------------------
-
-static LASunzipper* make_unzipper(IStream* ist, PointData& data, LASzip::Algorithm alg)
-{
- LASunzipper* unzipper = new LASunzipper();
-
- int stat = 0;
- if (ist->m_use_iostream)
- stat = unzipper->open(*ist->streami, data.num_items, data.items, alg);
- else
- stat = unzipper->open(ist->ifile, data.num_items, data.items, alg);
-
- if (stat != 0)
- {
- log("ERROR: could not open lasunzipper with %s\n", ist->m_filename);
- exit(1);
- }
-
return unzipper;
}
+//---------------------------------------------------------------------------
+
+static void open_unzipper(LASunzipper* unzipper, IStream* ist)
+{
+ int stat = 0;
+ if (ist->m_use_iostream)
+ stat = unzipper->open(*ist->streami);
+ else
+ stat = unzipper->open(ist->ifile);
+ if (stat != 0)
+ {
+ log("ERROR: could not open laszipper with %s\n", ist->m_filename);
+ exit(1);
+ }
+}
//---------------------------------------------------------------------------
@@ -456,16 +471,23 @@
//---------------------------------------------------------------------------
-static void run_test(const char* filename, PointData& data, LASzip::Algorithm alg)
-{
- OStream* ost = new OStream(settings->use_iostream, filename);
- LASzipper* laszipper = make_zipper(ost, data, alg);
+static void run_test(const char* filename, PointData& data, unsigned short compressor, unsigned short requested_version=0, unsigned short chunk_size=0)
+{
+ LASzip laszip;
+ laszip.setup(data.num_items, data.items, compressor);
+ if (requested_version) laszip.request_version(requested_version);
+ if (chunk_size) laszip.set_chunk_size(chunk_size);
+
+ LASzipper* laszipper = make_zipper(&laszip);
+ OStream* ost = new OStream(settings->use_iostream, filename);
+ open_zipper(laszipper, ost);
write_points(laszipper, data);
delete laszipper;
delete ost;
- IStream* ist = new IStream(settings->use_iostream, filename);
- LASunzipper* lasunzipper = make_unzipper(ist, data, alg);
+ LASunzipper* lasunzipper = make_unzipper(&laszip);
+ IStream* ist = new IStream(settings->use_iostream, filename);
+ open_unzipper(lasunzipper, ist);
read_points(lasunzipper, data);
delete lasunzipper;
delete ist;
@@ -541,9 +563,11 @@
log("Seed: %u\n", settings->seed);
}
- run_test("test1.lax", data, LASzip::POINT_BY_POINT_RAW);
- run_test("test2.lax", data, LASzip::POINT_BY_POINT_ARITHMETIC);
- run_test("test3.lax", data, LASzip::POINT_BY_POINT_ARITHMETIC_V2);
+ run_test("test1.lax", data, LASZIP_COMPRESSOR_NONE);
+ run_test("test2.lax", data, LASZIP_COMPRESSOR_DEFAULT);
+ run_test("test3.lax", data, LASZIP_COMPRESSOR_DEFAULT, 2);
+ run_test("test4.lax", data, LASZIP_COMPRESSOR_CHUNKED);
+ run_test("test5.lax", data, LASZIP_COMPRESSOR_CHUNKED, 2);
log("Finished %u runs\n\n", run);
++run;
} while (run_forever);
More information about the Liblas-commits
mailing list