Commit 8c4727ae authored by David Flynn's avatar David Flynn
Browse files

attr: update methods that always return 0 -> void

Little is gained from the return type checks, it mostly serves to
clutter the code.
parent c3d42c2d
...@@ -123,7 +123,7 @@ void AttributeDecoder::buildPredictors(const PCCPointSet3 &pointCloud) { ...@@ -123,7 +123,7 @@ void AttributeDecoder::buildPredictors(const PCCPointSet3 &pointCloud) {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int AttributeDecoder::decodeHeader( void AttributeDecoder::decodeHeader(
const std::string &attributeName, const std::string &attributeName,
PCCBitstream &bitstream PCCBitstream &bitstream
) { ) {
...@@ -160,13 +160,11 @@ int AttributeDecoder::decodeHeader( ...@@ -160,13 +160,11 @@ int AttributeDecoder::decodeHeader(
PCCReadFromBuffer<uint8_t>(bitstream.buffer, binaryLevelThresholdRaht, bitstream.size); PCCReadFromBuffer<uint8_t>(bitstream.buffer, binaryLevelThresholdRaht, bitstream.size);
PCCReadFromBuffer<uint32_t>(bitstream.buffer, quantizationStepRaht, bitstream.size); PCCReadFromBuffer<uint32_t>(bitstream.buffer, quantizationStepRaht, bitstream.size);
} }
return 0;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int AttributeDecoder::decodeReflectances( void AttributeDecoder::decodeReflectances(
PCCBitstream &bitstream, PCCBitstream &bitstream,
PCCPointSet3 &pointCloud PCCPointSet3 &pointCloud
) { ) {
...@@ -188,12 +186,11 @@ int AttributeDecoder::decodeReflectances( ...@@ -188,12 +186,11 @@ int AttributeDecoder::decodeReflectances(
decoder.stop(); decoder.stop();
bitstream.size += compressedBitstreamSize; bitstream.size += compressedBitstreamSize;
return 0;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int AttributeDecoder::decodeColors( void AttributeDecoder::decodeColors(
PCCBitstream &bitstream, PCCBitstream &bitstream,
PCCPointSet3 &pointCloud PCCPointSet3 &pointCloud
) { ) {
...@@ -215,7 +212,6 @@ int AttributeDecoder::decodeColors( ...@@ -215,7 +212,6 @@ int AttributeDecoder::decodeColors(
decoder.stop(); decoder.stop();
bitstream.size += compressedBitstreamSize; bitstream.size += compressedBitstreamSize;
return 0;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
......
...@@ -57,18 +57,15 @@ public: ...@@ -57,18 +57,15 @@ public:
void buildPredictors( void buildPredictors(
const PCCPointSet3 &pointCloud); const PCCPointSet3 &pointCloud);
// todo(df): return value is always 0 => should be void? void decodeHeader(
int decodeHeader(
const std::string &attributeName, const std::string &attributeName,
PCCBitstream &bitstream); PCCBitstream &bitstream);
// todo(df): return value is always 0 => should be void? void decodeReflectances(
int decodeReflectances(
PCCBitstream &bitstream, PCCBitstream &bitstream,
PCCPointSet3 &pointCloud); PCCPointSet3 &pointCloud);
// todo(df): return value is always 0 => should be void? void decodeColors(
int decodeColors(
PCCBitstream &bitstream, PCCBitstream &bitstream,
PCCPointSet3 &pointCloud); PCCPointSet3 &pointCloud);
......
...@@ -131,7 +131,7 @@ void AttributeEncoder::buildPredictors( ...@@ -131,7 +131,7 @@ void AttributeEncoder::buildPredictors(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int AttributeEncoder::encodeHeader( void AttributeEncoder::encodeHeader(
const PCCAttributeEncodeParamaters &attributeParams, const PCCAttributeEncodeParamaters &attributeParams,
const std::string &attributeName, const std::string &attributeName,
PCCBitstream &bitstream PCCBitstream &bitstream
...@@ -170,13 +170,11 @@ int AttributeEncoder::encodeHeader( ...@@ -170,13 +170,11 @@ int AttributeEncoder::encodeHeader(
uint32_t(attributeParams.quantizationStepRaht), uint32_t(attributeParams.quantizationStepRaht),
bitstream.buffer, bitstream.size); bitstream.buffer, bitstream.size);
} }
return 0;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int AttributeEncoder::encodeReflectances( void AttributeEncoder::encodeReflectances(
const PCCAttributeEncodeParamaters &reflectanceParams, const PCCAttributeEncodeParamaters &reflectanceParams,
PCCPointSet3 &pointCloud, PCCPointSet3 &pointCloud,
PCCBitstream &bitstream PCCBitstream &bitstream
...@@ -200,12 +198,11 @@ int AttributeEncoder::encodeReflectances( ...@@ -200,12 +198,11 @@ int AttributeEncoder::encodeReflectances(
uint32_t compressedBitstreamSize = encoder.stop(); uint32_t compressedBitstreamSize = encoder.stop();
bitstream.size += compressedBitstreamSize; bitstream.size += compressedBitstreamSize;
PCCWriteToBuffer<uint32_t>(compressedBitstreamSize, bitstream.buffer, startSize); PCCWriteToBuffer<uint32_t>(compressedBitstreamSize, bitstream.buffer, startSize);
return 0;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int AttributeEncoder::encodeColors( void AttributeEncoder::encodeColors(
const PCCAttributeEncodeParamaters &colorParams, const PCCAttributeEncodeParamaters &colorParams,
PCCPointSet3 &pointCloud, PCCPointSet3 &pointCloud,
PCCBitstream &bitstream PCCBitstream &bitstream
...@@ -229,7 +226,6 @@ int AttributeEncoder::encodeColors( ...@@ -229,7 +226,6 @@ int AttributeEncoder::encodeColors(
uint32_t compressedBitstreamSize = encoder.stop(); uint32_t compressedBitstreamSize = encoder.stop();
bitstream.size += compressedBitstreamSize; bitstream.size += compressedBitstreamSize;
PCCWriteToBuffer<uint32_t>(compressedBitstreamSize, bitstream.buffer, startSize); PCCWriteToBuffer<uint32_t>(compressedBitstreamSize, bitstream.buffer, startSize);
return 0;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
......
...@@ -72,20 +72,17 @@ public: ...@@ -72,20 +72,17 @@ public:
const PCCAttributeEncodeParamaters &attributeParams, const PCCAttributeEncodeParamaters &attributeParams,
const PCCPointSet3 &pointCloud); const PCCPointSet3 &pointCloud);
// todo(df): return value is always 0 => should be void? void encodeHeader(
int encodeHeader(
const PCCAttributeEncodeParamaters &attributeParams, const PCCAttributeEncodeParamaters &attributeParams,
const std::string &attributeName, const std::string &attributeName,
PCCBitstream &bitstream) const; PCCBitstream &bitstream) const;
// todo(df): return value is always 0 => should be void? void encodeReflectances(
int encodeReflectances(
const PCCAttributeEncodeParamaters &reflectanceParams, const PCCAttributeEncodeParamaters &reflectanceParams,
PCCPointSet3 &pointCloud, PCCPointSet3 &pointCloud,
PCCBitstream &bitstream); PCCBitstream &bitstream);
// todo(df): return value is always 0 => should be void? void encodeColors(
int encodeColors(
const PCCAttributeEncodeParamaters &colorParams, const PCCAttributeEncodeParamaters &colorParams,
PCCPointSet3 &pointCloud, PCCPointSet3 &pointCloud,
PCCBitstream &bitstream); PCCBitstream &bitstream);
......
...@@ -99,13 +99,11 @@ class PCCTMC3Decoder3 { ...@@ -99,13 +99,11 @@ class PCCTMC3Decoder3 {
if (pointCloud.hasColors()) { if (pointCloud.hasColors()) {
uint64_t colorsSize = bitstream.size; uint64_t colorsSize = bitstream.size;
if (int ret = attrDecoder.decodeHeader("color", bitstream)) {
return ret; attrDecoder.decodeHeader("color", bitstream);
}
attrDecoder.buildPredictors(pointCloud); attrDecoder.buildPredictors(pointCloud);
if (int ret = attrDecoder.decodeColors(bitstream, pointCloud)) { attrDecoder.decodeColors(bitstream, pointCloud);
return ret;
}
colorsSize = bitstream.size - colorsSize; colorsSize = bitstream.size - colorsSize;
std::cout << "colors bitstream size " << colorsSize << " B" << std::endl; std::cout << "colors bitstream size " << colorsSize << " B" << std::endl;
std::cout << std::endl; std::cout << std::endl;
...@@ -113,13 +111,11 @@ class PCCTMC3Decoder3 { ...@@ -113,13 +111,11 @@ class PCCTMC3Decoder3 {
if (pointCloud.hasReflectances()) { if (pointCloud.hasReflectances()) {
uint64_t reflectancesSize = bitstream.size; uint64_t reflectancesSize = bitstream.size;
if (int ret = attrDecoder.decodeHeader("reflectance", bitstream)) {
return ret; attrDecoder.decodeHeader("reflectance", bitstream);
}
attrDecoder.buildPredictors(pointCloud); attrDecoder.buildPredictors(pointCloud);
if (int ret = attrDecoder.decodeReflectances(bitstream, pointCloud)) { attrDecoder.decodeReflectances(bitstream, pointCloud);
return ret;
}
reflectancesSize = bitstream.size - reflectancesSize; reflectancesSize = bitstream.size - reflectancesSize;
std::cout << "reflectances bitstream size " << reflectancesSize << " B" << std::endl; std::cout << "reflectances bitstream size " << reflectancesSize << " B" << std::endl;
} }
...@@ -141,25 +137,21 @@ class PCCTMC3Decoder3 { ...@@ -141,25 +137,21 @@ class PCCTMC3Decoder3 {
} }
uint64_t positionsSize = bitstream.size; uint64_t positionsSize = bitstream.size;
if (int ret = decodePositionsHeader(bitstream, pointCloud)) {
return ret; decodePositionsHeader(bitstream, pointCloud);
} decodePositions(bitstream, pointCloud);
if (int ret = decodePositions(bitstream, pointCloud)) {
return ret;
}
positionsSize = bitstream.size - positionsSize; positionsSize = bitstream.size - positionsSize;
std::cout << "positions bitstream size " << positionsSize << " B" << std::endl; std::cout << "positions bitstream size " << positionsSize << " B" << std::endl;
if (pointCloud.hasColors()) { if (pointCloud.hasColors()) {
AttributeDecoder attrDecoder; AttributeDecoder attrDecoder;
uint64_t colorsSize = bitstream.size; uint64_t colorsSize = bitstream.size;
if (int ret = attrDecoder.decodeHeader("color", bitstream)) {
return ret; attrDecoder.decodeHeader("color", bitstream);
}
attrDecoder.buildPredictors(pointCloud); attrDecoder.buildPredictors(pointCloud);
if (int ret = attrDecoder.decodeColors(bitstream, pointCloud)) { attrDecoder.decodeColors(bitstream, pointCloud);
return ret;
}
colorsSize = bitstream.size - colorsSize; colorsSize = bitstream.size - colorsSize;
std::cout << "colors bitstream size " << colorsSize << " B" << std::endl; std::cout << "colors bitstream size " << colorsSize << " B" << std::endl;
std::cout << std::endl; std::cout << std::endl;
...@@ -168,13 +160,11 @@ class PCCTMC3Decoder3 { ...@@ -168,13 +160,11 @@ class PCCTMC3Decoder3 {
if (pointCloud.hasReflectances()) { if (pointCloud.hasReflectances()) {
AttributeDecoder attrDecoder; AttributeDecoder attrDecoder;
uint64_t reflectancesSize = bitstream.size; uint64_t reflectancesSize = bitstream.size;
if (int ret = attrDecoder.decodeHeader("reflectance", bitstream)) {
return ret; attrDecoder.decodeHeader("reflectance", bitstream);
}
attrDecoder.buildPredictors(pointCloud); attrDecoder.buildPredictors(pointCloud);
if (int ret = attrDecoder.decodeReflectances(bitstream, pointCloud)) { attrDecoder.decodeReflectances(bitstream, pointCloud);
return ret;
}
reflectancesSize = bitstream.size - reflectancesSize; reflectancesSize = bitstream.size - reflectancesSize;
std::cout << "reflectances bitstream size " << reflectancesSize << " B" << std::endl; std::cout << "reflectances bitstream size " << reflectancesSize << " B" << std::endl;
} }
...@@ -204,10 +194,10 @@ class PCCTMC3Decoder3 { ...@@ -204,10 +194,10 @@ class PCCTMC3Decoder3 {
size_t level; size_t level;
double intToOrigScale; double intToOrigScale;
PCCPoint3D intToOrigTranslation; PCCPoint3D intToOrigTranslation;
if (int ret = decodeTrisoupHeader(bitstream, pointCloud, depth, level, intToOrigScale,
intToOrigTranslation)) { decodeTrisoupHeader(
return ret; bitstream, pointCloud,
} depth, level, intToOrigScale, intToOrigTranslation);
// Write out TMC1 geometry bitstream from the converged TMC13 bitstream. // Write out TMC1 geometry bitstream from the converged TMC13 bitstream.
uint32_t binSize = 0; uint32_t binSize = 0;
...@@ -247,13 +237,11 @@ class PCCTMC3Decoder3 { ...@@ -247,13 +237,11 @@ class PCCTMC3Decoder3 {
if (pointCloud.hasColors()) { if (pointCloud.hasColors()) {
AttributeDecoder attrDecoder; AttributeDecoder attrDecoder;
uint64_t colorsSize = bitstream.size; uint64_t colorsSize = bitstream.size;
if (int ret = attrDecoder.decodeHeader("color", bitstream)) {
return ret; attrDecoder.decodeHeader("color", bitstream);
}
attrDecoder.buildPredictors(pointCloud); attrDecoder.buildPredictors(pointCloud);
if (int ret = attrDecoder.decodeColors(bitstream, pointCloud)) { attrDecoder.decodeColors(bitstream, pointCloud);
return ret;
}
colorsSize = bitstream.size - colorsSize; colorsSize = bitstream.size - colorsSize;
std::cout << "colors bitstream size " << colorsSize << " B" << std::endl; std::cout << "colors bitstream size " << colorsSize << " B" << std::endl;
std::cout << std::endl; std::cout << std::endl;
...@@ -262,13 +250,11 @@ class PCCTMC3Decoder3 { ...@@ -262,13 +250,11 @@ class PCCTMC3Decoder3 {
if (pointCloud.hasReflectances()) { if (pointCloud.hasReflectances()) {
AttributeDecoder attrDecoder; AttributeDecoder attrDecoder;
uint64_t reflectancesSize = bitstream.size; uint64_t reflectancesSize = bitstream.size;
if (int ret = attrDecoder.decodeHeader("reflectance", bitstream)) {
return ret; attrDecoder.decodeHeader("reflectance", bitstream);
}
attrDecoder.buildPredictors(pointCloud); attrDecoder.buildPredictors(pointCloud);
if (int ret = attrDecoder.decodeReflectances(bitstream, pointCloud)) { attrDecoder.decodeReflectances(bitstream, pointCloud);
return ret;
}
reflectancesSize = bitstream.size - reflectancesSize; reflectancesSize = bitstream.size - reflectancesSize;
std::cout << "reflectances bitstream size " << reflectancesSize << " B" << std::endl; std::cout << "reflectances bitstream size " << reflectancesSize << " B" << std::endl;
} }
...@@ -283,7 +269,7 @@ class PCCTMC3Decoder3 { ...@@ -283,7 +269,7 @@ class PCCTMC3Decoder3 {
} }
private: private:
int decodePositionsHeader(PCCBitstream &bitstream, PCCPointSet3 &pointCloud) { void decodePositionsHeader(PCCBitstream &bitstream, PCCPointSet3 &pointCloud) {
uint32_t pointCount = 0; uint32_t pointCount = 0;
PCCReadFromBuffer<uint32_t>(bitstream.buffer, pointCount, bitstream.size); PCCReadFromBuffer<uint32_t>(bitstream.buffer, pointCount, bitstream.size);
uint8_t hasColors = 0; uint8_t hasColors = 0;
...@@ -324,10 +310,9 @@ class PCCTMC3Decoder3 { ...@@ -324,10 +310,9 @@ class PCCTMC3Decoder3 {
if (fabs(positionQuantizationScale) < minPositionQuantizationScale) { if (fabs(positionQuantizationScale) < minPositionQuantizationScale) {
positionQuantizationScale = 1.0; positionQuantizationScale = 1.0;
} }
return 0;
} }
int decodeTrisoupHeader(PCCBitstream &bitstream, PCCPointSet3 &pointCloud, size_t &depth, void decodeTrisoupHeader(PCCBitstream &bitstream, PCCPointSet3 &pointCloud, size_t &depth,
size_t &level, double &intToOrigScale, PCCPoint3D &intToOrigTranslation) { size_t &level, double &intToOrigScale, PCCPoint3D &intToOrigTranslation) {
uint32_t pointCount = 0; uint32_t pointCount = 0;
PCCReadFromBuffer<uint32_t>(bitstream.buffer, pointCount, bitstream.size); PCCReadFromBuffer<uint32_t>(bitstream.buffer, pointCount, bitstream.size);
...@@ -362,7 +347,6 @@ class PCCTMC3Decoder3 { ...@@ -362,7 +347,6 @@ class PCCTMC3Decoder3 {
PCCReadFromBuffer<size_t>(bitstream.buffer, level, bitstream.size); PCCReadFromBuffer<size_t>(bitstream.buffer, level, bitstream.size);
PCCReadFromBuffer<double>(bitstream.buffer, intToOrigScale, bitstream.size); PCCReadFromBuffer<double>(bitstream.buffer, intToOrigScale, bitstream.size);
PCCReadFromBuffer<PCCPoint3D>(bitstream.buffer, intToOrigTranslation, bitstream.size); PCCReadFromBuffer<PCCPoint3D>(bitstream.buffer, intToOrigTranslation, bitstream.size);
return 0;
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
...@@ -515,7 +499,7 @@ class PCCTMC3Decoder3 { ...@@ -515,7 +499,7 @@ class PCCTMC3Decoder3 {
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
int decodePositions(PCCBitstream &bitstream, PCCPointSet3 &pointCloud) { void decodePositions(PCCBitstream &bitstream, PCCPointSet3 &pointCloud) {
uint32_t compressedBitstreamSize; uint32_t compressedBitstreamSize;
PCCReadFromBuffer<uint32_t>(bitstream.buffer, compressedBitstreamSize, bitstream.size); PCCReadFromBuffer<uint32_t>(bitstream.buffer, compressedBitstreamSize, bitstream.size);
o3dgc::Arithmetic_Codec arithmeticDecoder; o3dgc::Arithmetic_Codec arithmeticDecoder;
...@@ -668,7 +652,6 @@ class PCCTMC3Decoder3 { ...@@ -668,7 +652,6 @@ class PCCTMC3Decoder3 {
arithmeticDecoder.stop_decoder(); arithmeticDecoder.stop_decoder();
bitstream.size += compressedBitstreamSize; bitstream.size += compressedBitstreamSize;
return 0;
} }
void inverseQuantization(PCCPointSet3 &pointCloud, const bool roundOutputPositions) { void inverseQuantization(PCCPointSet3 &pointCloud, const bool roundOutputPositions) {
......
...@@ -139,13 +139,11 @@ class PCCTMC3Encoder3 { ...@@ -139,13 +139,11 @@ class PCCTMC3Encoder3 {
AttributeEncoder attrEncoder; AttributeEncoder attrEncoder;
const auto &colorParams = params.attributeEncodeParameters.find("color")->second; const auto &colorParams = params.attributeEncodeParameters.find("color")->second;
uint64_t colorsSize = bitstream.size; uint64_t colorsSize = bitstream.size;
if (int ret = attrEncoder.encodeHeader(colorParams, "color", bitstream)) {
return ret; attrEncoder.encodeHeader(colorParams, "color", bitstream);
}
attrEncoder.buildPredictors(colorParams, pointCloud); attrEncoder.buildPredictors(colorParams, pointCloud);
if (int ret = attrEncoder.encodeColors(colorParams, pointCloud, bitstream)) { attrEncoder.encodeColors(colorParams, pointCloud, bitstream);
return ret;
}
colorsSize = bitstream.size - colorsSize; colorsSize = bitstream.size - colorsSize;
std::cout << "colors bitstream size " << colorsSize << " B (" std::cout << "colors bitstream size " << colorsSize << " B ("
<< (8.0 * colorsSize) / inputPointCloud.getPointCount() << " bpp)" << std::endl; << (8.0 * colorsSize) / inputPointCloud.getPointCount() << " bpp)" << std::endl;
...@@ -155,13 +153,11 @@ class PCCTMC3Encoder3 { ...@@ -155,13 +153,11 @@ class PCCTMC3Encoder3 {
AttributeEncoder attrEncoder; AttributeEncoder attrEncoder;
const auto &reflectanceParams = params.attributeEncodeParameters.find("reflectance")->second; const auto &reflectanceParams = params.attributeEncodeParameters.find("reflectance")->second;
uint64_t reflectancesSize = bitstream.size; uint64_t reflectancesSize = bitstream.size;
if (int ret = attrEncoder.encodeHeader(reflectanceParams, "reflectance", bitstream)) {
return ret; attrEncoder.encodeHeader(reflectanceParams, "reflectance", bitstream);
}
attrEncoder.buildPredictors(reflectanceParams, pointCloud); attrEncoder.buildPredictors(reflectanceParams, pointCloud);
if (int ret = attrEncoder.encodeReflectances(reflectanceParams, pointCloud, bitstream)) { attrEncoder.encodeReflectances(reflectanceParams, pointCloud, bitstream);
return ret;
}
reflectancesSize = bitstream.size - reflectancesSize; reflectancesSize = bitstream.size - reflectancesSize;
std::cout << "reflectances bitstream size " << reflectancesSize << " B (" std::cout << "reflectances bitstream size " << reflectancesSize << " B ("
<< (8.0 * reflectancesSize) / inputPointCloud.getPointCount() << " bpp)" << (8.0 * reflectancesSize) / inputPointCloud.getPointCount() << " bpp)"
...@@ -182,13 +178,11 @@ class PCCTMC3Encoder3 { ...@@ -182,13 +178,11 @@ class PCCTMC3Encoder3 {
if (int ret = quantization(inputPointCloud, params)) { if (int ret = quantization(inputPointCloud, params)) {
return ret; return ret;
} }
uint64_t positionsSize = bitstream.size; uint64_t positionsSize = bitstream.size;
if (int ret = encodePositionsHeader(params, bitstream)) { encodePositionsHeader(params, bitstream);
return ret; encodePositions(params, bitstream);
}
if (int ret = encodePositions(params, bitstream)) {
return ret;
}
positionsSize = bitstream.size - positionsSize; positionsSize = bitstream.size - positionsSize;
std::cout << "positions bitstream size " << positionsSize << " B (" std::cout << "positions bitstream size " << positionsSize << " B ("
<< (8.0 * positionsSize) / inputPointCloud.getPointCount() << " bpp)" << std::endl; << (8.0 * positionsSize) / inputPointCloud.getPointCount() << " bpp)" << std::endl;
...@@ -197,13 +191,11 @@ class PCCTMC3Encoder3 { ...@@ -197,13 +191,11 @@ class PCCTMC3Encoder3 {
AttributeEncoder attrEncoder; AttributeEncoder attrEncoder;
const auto &colorParams = params.attributeEncodeParameters.find("color")->second; const auto &colorParams = params.attributeEncodeParameters.find("color")->second;
uint64_t colorsSize = bitstream.size; uint64_t colorsSize = bitstream.size;
if (int ret = attrEncoder.encodeHeader(colorParams, "color", bitstream)) {
return ret; attrEncoder.encodeHeader(colorParams, "color", bitstream);
}
attrEncoder.buildPredictors(colorParams, pointCloud); attrEncoder.buildPredictors(colorParams, pointCloud);
if (int ret = attrEncoder.encodeColors(colorParams, pointCloud, bitstream)) { attrEncoder.encodeColors(colorParams, pointCloud, bitstream);
return ret;
}
colorsSize = bitstream.size - colorsSize; colorsSize = bitstream.size - colorsSize;
std::cout << "colors bitstream size " << colorsSize << " B (" std::cout << "colors bitstream size " << colorsSize << " B ("
<< (8.0 * colorsSize) / inputPointCloud.getPointCount() << " bpp)" << std::endl; << (8.0 * colorsSize) / inputPointCloud.getPointCount() << " bpp)" << std::endl;
...@@ -213,13 +205,11 @@ class PCCTMC3Encoder3 { ...@@ -213,13 +205,11 @@ class PCCTMC3Encoder3 {
AttributeEncoder attrEncoder; AttributeEncoder attrEncoder;
const auto &reflectanceParams = params.attributeEncodeParameters.find("reflectance")->second; const auto &reflectanceParams = params.attributeEncodeParameters.find("reflectance")->second;
uint64_t reflectancesSize = bitstream.size; uint64_t reflectancesSize = bitstream.size;
if (int ret = attrEncoder.encodeHeader(reflectanceParams, "reflectance", bitstream)) {
return ret; attrEncoder.encodeHeader(reflectanceParams, "reflectance", bitstream);
}
attrEncoder.buildPredictors(reflectanceParams, pointCloud); attrEncoder.buildPredictors(reflectanceParams, pointCloud);
if (int ret = attrEncoder.encodeReflectances(reflectanceParams, pointCloud, bitstream)) { attrEncoder.encodeReflectances(reflectanceParams, pointCloud, bitstream);
return ret;
}
reflectancesSize = bitstream.size - reflectancesSize; reflectancesSize = bitstream.size - reflectancesSize;
std::cout << "reflectances bitstream size " << reflectancesSize << " B (" std::cout << "reflectances bitstream size " << reflectancesSize << " B ("
<< (8.0 * reflectancesSize) / inputPointCloud.getPointCount() << " bpp)" << (8.0 * reflectancesSize) / inputPointCloud.getPointCount() << " bpp)"
...@@ -296,9 +286,8 @@ class PCCTMC3Encoder3 { ...@@ -296,9 +286,8 @@ class PCCTMC3Encoder3 {
// Encode positions. // Encode positions.
uint64_t positionsSize = bitstream.size; uint64_t positionsSize = bitstream.size;
if (int ret = encodeTrisoupHeader(params, bitstream)) { encodeTrisoupHeader(params, bitstream);
return ret;
}
// Read in TMC1 geometry bitstream and put it into the converged TMC13 bitstream. // Read in TMC1 geometry bitstream and put it into the converged TMC13 bitstream.
std::ifstream fin("outbin/outbin_0000.bin", std::ios::binary); std::ifstream fin("outbin/outbin_0000.bin", std::ios::binary);
if (!fin.is_open()) { if (!fin.is_open()) {
...@@ -324,13 +313,11 @@ class PCCTMC3Encoder3 { ...@@ -324,13 +313,11 @@ class PCCTMC3Encoder3 {
AttributeEncoder attrEncoder; AttributeEncoder attrEncoder;
const auto &colorParams = params.attributeEncodeParameters.find("color")->second; const auto &colorParams = params.attributeEncodeParameters.find("color")->second;
uint64_t colorsSize = bitstream.size; uint64_t colorsSize = bitstream.size;
attrEncoder.buildPredictors(colorParams, pointCloud); attrEncoder.buildPredictors(colorParams, pointCloud);
if (int ret = attrEncoder.encodeHeader(colorParams, "color", bitstream)) { attrEncoder.encodeHeader(colorParams, "color", bitstream);
return ret; attrEncoder.encodeColors(colorParams, pointCloud, bitstream);
}
if (int ret = attrEncoder.encodeColors(colorParams, pointCloud, bitstream)) {
return ret;
}
colorsSize = bitstream.size - colorsSize; colorsSize = bitstream.size - colorsSize;
std::cout << "colors bitstream size " << colorsSize << " B (" std::cout << "colors bitstream size " << colorsSize << " B ("