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