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 { ...@@ -247,7 +247,10 @@ class PCCTMC3Decoder3 {
// Decompress geometry with TMC1. // Decompress geometry with TMC1.
std::string cmd; std::string cmd;
cmd = "7z e -aoa -bso0 -ooutbin outbin/outbin_0000.bin"; 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 = cmd =
"TMC1_geometryDecode" "TMC1_geometryDecode"
...@@ -256,7 +259,10 @@ class PCCTMC3Decoder3 { ...@@ -256,7 +259,10 @@ class PCCTMC3Decoder3 {
" -depth " + std::to_string(triSoup.depth) + " -depth " + std::to_string(triSoup.depth) +
" -level " + std::to_string(triSoup.level) + " -level " + std::to_string(triSoup.level) +
" -format binary_little_endian"; " -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 = cmd =
"TMC1_voxelize" "TMC1_voxelize"
...@@ -264,11 +270,17 @@ class PCCTMC3Decoder3 { ...@@ -264,11 +270,17 @@ class PCCTMC3Decoder3 {
" -outvox quantizedPointCloudDecoded.ply" " -outvox quantizedPointCloudDecoded.ply"
" -depth " + std::to_string(triSoup.depth) + " -depth " + std::to_string(triSoup.depth) +
" -format binary_little_endian"; " -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 hasColors = pointCloud.hasColors();
bool hasReflectances = pointCloud.hasReflectances(); 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); pointCloud.addRemoveAttributes(hasColors, hasReflectances);
return 0; return 0;
} }
......
...@@ -158,7 +158,10 @@ class PCCTMC3Encoder3 { ...@@ -158,7 +158,10 @@ class PCCTMC3Encoder3 {
} }
if (params.geometryCodec == GeometryCodecType::kTriSoup) { if (params.geometryCodec == GeometryCodecType::kTriSoup) {
// todo(?): this ought to be replaced with quantization(...) // 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 = std::string cmd =
"TMC1_coordinateTransform" "TMC1_coordinateTransform"
" -inworld verticesInWorldCoords.ply" " -inworld verticesInWorldCoords.ply"
...@@ -166,7 +169,10 @@ class PCCTMC3Encoder3 { ...@@ -166,7 +169,10 @@ class PCCTMC3Encoder3 {
" -depth " + std::to_string(params.triSoup.depth) + " -depth " + std::to_string(params.triSoup.depth) +
" -scale " + std::to_string(params.triSoup.intToOrigScale) + " -scale " + std::to_string(params.triSoup.intToOrigScale) +
" -format binary_little_endian"; " -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 // geometry encoding
...@@ -690,7 +696,10 @@ class PCCTMC3Encoder3 { ...@@ -690,7 +696,10 @@ class PCCTMC3Encoder3 {
" -depth " + std::to_string(params.triSoup.depth) + " -depth " + std::to_string(params.triSoup.depth) +
" -level " + std::to_string(params.triSoup.level) + " -level " + std::to_string(params.triSoup.level) +
" -format binary_little_endian"; " -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 // todo(?): port interpolator
cmd = cmd =
...@@ -699,10 +708,16 @@ class PCCTMC3Encoder3 { ...@@ -699,10 +708,16 @@ class PCCTMC3Encoder3 {
" -outvox voxelizedVertices.ply" " -outvox voxelizedVertices.ply"
" -depth " + std::to_string(params.triSoup.depth) + " -depth " + std::to_string(params.triSoup.depth) +
" -format binary_little_endian"; " -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. // 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); pointCloud.addRemoveAttributes(hasColor, hasReflectance);
// encapsulate the TMC1 "bitstream" // 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