Commit cacab992 authored by David Flynn's avatar David Flynn
Browse files

cli: add option to use binary format for ply output files

Reading and writing binary ply files is significantly faster than going
via formatted I/O.  This commit adds the --outputBinaryPly=1|0 option
to select writing either binary or ascii ply files.
parent e1a44408
......@@ -49,6 +49,9 @@ struct Parameters {
// command line parsing should adjust dist2 values according to PQS
bool positionQuantizationScaleAdjustsDist2;
// output mode for ply writing (binary or ascii)
bool outputBinaryPly;
std::string uncompressedDataPath;
std::string compressedStreamPath;
std::string reconstructedDataPath;
......@@ -244,6 +247,10 @@ ParseParameters(int argc, char* argv[], Parameters& params)
params.preInvScalePath, {},
"Pre inverse scaled pointcloud file path (decoder only)")
("outputBinaryPly",
params.outputBinaryPly, false,
"Output ply files using binary (or otherwise ascii) format")
// general
// todo(df): this should be per-attribute
("colorTransform",
......@@ -621,7 +628,8 @@ Compress(Parameters& params, Stopwatch& clock)
}
}
reconPointCloud->write(params.reconstructedDataPath, true);
reconPointCloud->write(
params.reconstructedDataPath, !params.outputBinaryPly);
}
return 0;
......@@ -665,14 +673,15 @@ Decompress(Parameters& params, Stopwatch& clock)
// Dump the decoded colour using the pre inverse scaled geometry
if (!params.preInvScalePath.empty()) {
pointCloud.write(params.preInvScalePath);
pointCloud.write(params.preInvScalePath, !params.outputBinaryPly);
}
decoder.inverseQuantization(pointCloud);
clock.stop();
if (!pointCloud.write(params.reconstructedDataPath, true)) {
if (!pointCloud.write(
params.reconstructedDataPath, !params.outputBinaryPly)) {
cout << "Error: can't open output file!" << endl;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment