Commit 0ffb70ab authored by David Flynn's avatar David Flynn
Browse files

dec: add support for DecoderParameters struct

This commit adds a DecoderParameters struct to reduce the overhead of
adding extra parameters.
parent 4e830636
......@@ -52,6 +52,10 @@
namespace pcc {
struct DecoderParameters {
bool roundOutputPositions;
};
class PCCTMC3Decoder3 {
public:
PCCTMC3Decoder3() { init(); }
......@@ -66,7 +70,11 @@ class PCCTMC3Decoder3 {
boundingBox.max = uint32_t(0);
}
int decompressWithLosslessGeometry(PCCBitstream &bitstream, PCCPointSet3 &pointCloud) {
int decompressWithLosslessGeometry(
const DecoderParameters& params,
PCCBitstream &bitstream,
PCCPointSet3 &pointCloud
) {
init();
uint32_t magicNumber = 0;
uint32_t formatVersion = 0;
......@@ -126,7 +134,12 @@ class PCCTMC3Decoder3 {
}
return 0;
}
int decompress(PCCBitstream &bitstream, PCCPointSet3 &pointCloud, const bool roundOutputPositions) {
int decompress(
const DecoderParameters& params,
PCCBitstream &bitstream,
PCCPointSet3 &pointCloud
) {
init();
uint32_t magicNumber = 0;
uint32_t formatVersion = 0;
......@@ -178,12 +191,15 @@ class PCCTMC3Decoder3 {
std::cout << "reflectances bitstream size " << reflectancesSize << " B" << std::endl;
}
inverseQuantization(pointCloud, roundOutputPositions);
inverseQuantization(pointCloud, params.roundOutputPositions);
return 0;
}
int decompressWithTrisoupGeometry(PCCBitstream &bitstream, PCCPointSet3 &pointCloud,
const bool roundOutputPositions) {
int decompressWithTrisoupGeometry(
const DecoderParameters& params,
PCCBitstream &bitstream,
PCCPointSet3 &pointCloud
) {
init();
uint32_t magicNumber = 0;
uint32_t formatVersion = 0;
......@@ -277,7 +293,7 @@ class PCCTMC3Decoder3 {
tempPointCloud.convertYUVToRGB();
tempPointCloud.write("decodedVoxelsAndDecodedColors.ply");
inverseQuantization(pointCloud, roundOutputPositions);
inverseQuantization(pointCloud, params.roundOutputPositions);
return 0;
}
......
......@@ -193,7 +193,7 @@ bool ParseParameters(int argc, char *argv[], Parameters &params) {
"Enables removal of duplicated points")
("roundOutputPositions",
params.roundOutputPositions, false,
params.decodeParameters.roundOutputPositions, false,
"todo(kmammou)")
// tools
......@@ -436,7 +436,8 @@ bool ParseParameters(int argc, char *argv[], Parameters &params) {
}
cout << endl;
} else {
cout << "\t roundOutputPositions " << params.roundOutputPositions << endl;
cout << "\t roundOutputPositions "
<< params.decodeParameters.roundOutputPositions << '\n';
}
return true;
......@@ -543,13 +544,13 @@ int Decompress(const Parameters &params, Stopwatch &clock) {
int ret;
if (params.encodeParameters.geometryCodec == GeometryCodecType::kOctree)
ret = decoder.decompress(
bitstream, pointCloud, params.roundOutputPositions);
params.decodeParameters, bitstream, pointCloud);
if (params.encodeParameters.geometryCodec == GeometryCodecType::kBypass)
ret = decoder.decompressWithLosslessGeometry(
bitstream, pointCloud);
params.decodeParameters, bitstream, pointCloud);
if (params.encodeParameters.geometryCodec == GeometryCodecType::kTriSoup)
ret = decoder.decompressWithTrisoupGeometry(
bitstream, pointCloud, params.roundOutputPositions);
params.decodeParameters, bitstream, pointCloud);
if (ret) {
cout << "Error: can't decompress point cloud!" << endl;
return -1;
......
......@@ -75,6 +75,7 @@ struct Parameters {
CodecMode mode;
bool roundOutputPositions;
pcc::PCCTMC3Encoder3Parameters encodeParameters;
pcc::DecoderParameters decodeParameters;
};
typedef pcc::chrono::Stopwatch<pcc::chrono::utime_inc_children_clock> Stopwatch;
......
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