Commit 11ffe4b1 authored by David Flynn's avatar David Flynn
Browse files

trisoup: make tmc1 invocation report errors early

If there is an issue running one of the tmc1 blocks, terminate
the encoding immediately and report the error.
parent 12cb66f2
......@@ -247,7 +247,10 @@ class PCCTMC3Decoder3 {
// Decompress geometry with TMC1.
std::string cmd;
cmd = "7z e -aoa -bso0 -ooutbin outbin/outbin_0000.bin";
system(cmd.c_str());
if (int err = system(cmd.c_str())) {
std::cerr << "Failed (" << err << ") to run :" << cmd << '\n';
return -1;
}
cmd =
"TMC1_geometryDecode"
......@@ -256,7 +259,10 @@ class PCCTMC3Decoder3 {
" -depth " + std::to_string(triSoup.depth) +
" -level " + std::to_string(triSoup.level) +
" -format binary_little_endian";
system(cmd.c_str());
if (int err = system(cmd.c_str())) {
std::cerr << "Failed (" << err << ") to run :" << cmd << '\n';
return -1;
}
cmd =
"TMC1_voxelize"
......@@ -264,11 +270,17 @@ class PCCTMC3Decoder3 {
" -outvox quantizedPointCloudDecoded.ply"
" -depth " + std::to_string(triSoup.depth) +
" -format binary_little_endian";
system(cmd.c_str());
if (int err = system(cmd.c_str())) {
std::cerr << "Failed (" << err << ") to run :" << cmd << '\n';
return -1;
}
bool hasColors = pointCloud.hasColors();
bool hasReflectances = pointCloud.hasReflectances();
pointCloud.read("quantizedPointCloudDecoded.ply");
if (!pointCloud.read("quantizedPointCloudDecoded.ply")) {
std::cerr << "Failed to read quantizedPointCloudDecoded.ply\n";
return -1;
}
pointCloud.addRemoveAttributes(hasColors, hasReflectances);
return 0;
}
......
......@@ -158,7 +158,10 @@ class PCCTMC3Encoder3 {
}
if (params.geometryCodec == GeometryCodecType::kTriSoup) {
// todo(?): this ought to be replaced with quantization(...)
inputPointCloud.write("verticesInWorldCoords.ply", true);
if (!inputPointCloud.write("verticesInWorldCoords.ply", true)) {
std::cerr << "Failed to write verticesInWorldCoords.ply\n";
return -1;
}
std::string cmd =
"TMC1_coordinateTransform"
" -inworld verticesInWorldCoords.ply"
......@@ -166,7 +169,10 @@ class PCCTMC3Encoder3 {
" -depth " + std::to_string(params.triSoup.depth) +
" -scale " + std::to_string(params.triSoup.intToOrigScale) +
" -format binary_little_endian";
system(cmd.c_str());
if (int err = system(cmd.c_str())) {
std::cerr << "Failed (" << err << ") to run :" << cmd << '\n';
return -1;
}
}
// geometry encoding
......@@ -690,7 +696,10 @@ class PCCTMC3Encoder3 {
" -depth " + std::to_string(params.triSoup.depth) +
" -level " + std::to_string(params.triSoup.level) +
" -format binary_little_endian";
system(cmd.c_str());
if (int err = system(cmd.c_str())) {
std::cerr << "Failed (" << err << ") to run :" << cmd << '\n';
return -1;
}
// todo(?): port interpolator
cmd =
......@@ -699,10 +708,16 @@ class PCCTMC3Encoder3 {
" -outvox voxelizedVertices.ply"
" -depth " + std::to_string(params.triSoup.depth) +
" -format binary_little_endian";
system(cmd.c_str());
if (int err = system(cmd.c_str())) {
std::cerr << "Failed (" << err << ") to run :" << cmd << '\n';
return -1;
}
// Read in quantizedPointCloud file.
pointCloud.read("voxelizedVertices.ply");
if (!pointCloud.read("voxelizedVertices.ply")) {
std::cerr << "Failed to open voxelizedVertices.ply\n";
return -1;
}
pointCloud.addRemoveAttributes(hasColor, hasReflectance);
// encapsulate the TMC1 "bitstream"
......
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