Commit 81f2d561 authored by Noritaka Iguchi's avatar Noritaka Iguchi Committed by David Flynn
Browse files

attr/m47834: add support for per-layer luma/chroma qp offsets

This commit allow individual QP offsets to be specified for each
LoD/RAHT layer in attribute coding.
parent b6b98bf3
...@@ -181,7 +181,8 @@ AttributeDecoder::decode( ...@@ -181,7 +181,8 @@ AttributeDecoder::decode(
{ {
int abhSize; int abhSize;
AttributeBrickHeader abh = parseAbh(attr_aps, payload, &abhSize); AttributeBrickHeader abh = parseAbh(attr_aps, payload, &abhSize);
Quantizers quant = deriveQuantizers(attr_aps, abh);
std::vector<Quantizers> quantLayers = deriveQuantizerLayers(attr_aps, abh);
PCCResidualsDecoder decoder; PCCResidualsDecoder decoder;
decoder.start(payload.data() + abhSize, payload.size() - abhSize); decoder.start(payload.data() + abhSize, payload.size() - abhSize);
...@@ -189,29 +190,32 @@ AttributeDecoder::decode( ...@@ -189,29 +190,32 @@ AttributeDecoder::decode(
if (attr_desc.attr_num_dimensions == 1) { if (attr_desc.attr_num_dimensions == 1) {
switch (attr_aps.attr_encoding) { switch (attr_aps.attr_encoding) {
case AttributeEncoding::kRAHTransform: case AttributeEncoding::kRAHTransform:
decodeReflectancesRaht(attr_desc, attr_aps, quant, decoder, pointCloud); decodeReflectancesRaht(
attr_desc, attr_aps, quantLayers, decoder, pointCloud);
break; break;
case AttributeEncoding::kPredictingTransform: case AttributeEncoding::kPredictingTransform:
decodeReflectancesPred(attr_desc, attr_aps, quant, decoder, pointCloud); decodeReflectancesPred(
attr_desc, attr_aps, quantLayers, decoder, pointCloud);
break; break;
case AttributeEncoding::kLiftingTransform: case AttributeEncoding::kLiftingTransform:
decodeReflectancesLift(attr_desc, attr_aps, quant, decoder, pointCloud); decodeReflectancesLift(
attr_desc, attr_aps, quantLayers, decoder, pointCloud);
break; break;
} }
} else if (attr_desc.attr_num_dimensions == 3) { } else if (attr_desc.attr_num_dimensions == 3) {
switch (attr_aps.attr_encoding) { switch (attr_aps.attr_encoding) {
case AttributeEncoding::kRAHTransform: case AttributeEncoding::kRAHTransform:
decodeColorsRaht(attr_desc, attr_aps, quant, decoder, pointCloud); decodeColorsRaht(attr_desc, attr_aps, quantLayers, decoder, pointCloud);
break; break;
case AttributeEncoding::kPredictingTransform: case AttributeEncoding::kPredictingTransform:
decodeColorsPred(attr_desc, attr_aps, quant, decoder, pointCloud); decodeColorsPred(attr_desc, attr_aps, quantLayers, decoder, pointCloud);
break; break;
case AttributeEncoding::kLiftingTransform: case AttributeEncoding::kLiftingTransform:
decodeColorsLift(attr_desc, attr_aps, quant, decoder, pointCloud); decodeColorsLift(attr_desc, attr_aps, quantLayers, decoder, pointCloud);
break; break;
} }
} else { } else {
...@@ -263,7 +267,7 @@ void ...@@ -263,7 +267,7 @@ void
AttributeDecoder::decodeReflectancesPred( AttributeDecoder::decodeReflectancesPred(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud) PCCPointSet3& pointCloud)
{ {
...@@ -280,9 +284,15 @@ AttributeDecoder::decodeReflectancesPred( ...@@ -280,9 +284,15 @@ AttributeDecoder::decodeReflectancesPred(
const int64_t maxReflectance = (1ll << desc.attr_bitdepth) - 1; const int64_t maxReflectance = (1ll << desc.attr_bitdepth) - 1;
int zero_cnt = decoder.decodeZeroCnt(pointCount); int zero_cnt = decoder.decodeZeroCnt(pointCount);
int quantLayer = 0;
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1);
}
auto& quant = quantLayers[quantLayer];
auto& predictor = predictors[predictorIndex]; auto& predictor = predictors[predictorIndex];
computeReflectancePredictionWeights( computeReflectancePredictionWeights(
aps, pointCloud, indexesLOD, predictor, decoder); aps, pointCloud, indexesLOD, predictor, decoder);
const uint32_t pointIndex = indexesLOD[predictorIndex]; const uint32_t pointIndex = indexesLOD[predictorIndex];
...@@ -348,7 +358,7 @@ void ...@@ -348,7 +358,7 @@ void
AttributeDecoder::decodeColorsPred( AttributeDecoder::decodeColorsPred(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud) PCCPointSet3& pointCloud)
{ {
...@@ -365,9 +375,15 @@ AttributeDecoder::decodeColorsPred( ...@@ -365,9 +375,15 @@ AttributeDecoder::decodeColorsPred(
uint32_t values[3]; uint32_t values[3];
int zero_cnt = decoder.decodeZeroCnt(pointCount); int zero_cnt = decoder.decodeZeroCnt(pointCount);
int quantLayer = 0;
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1);
}
auto& quant = quantLayers[quantLayer];
auto& predictor = predictors[predictorIndex]; auto& predictor = predictors[predictorIndex];
computeColorPredictionWeights( computeColorPredictionWeights(
aps, pointCloud, indexesLOD, predictor, decoder); aps, pointCloud, indexesLOD, predictor, decoder);
if (zero_cnt > 0) { if (zero_cnt > 0) {
...@@ -405,7 +421,7 @@ void ...@@ -405,7 +421,7 @@ void
AttributeDecoder::decodeReflectancesRaht( AttributeDecoder::decodeReflectancesRaht(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud) PCCPointSet3& pointCloud)
{ {
...@@ -441,7 +457,7 @@ AttributeDecoder::decodeReflectancesRaht( ...@@ -441,7 +457,7 @@ AttributeDecoder::decodeReflectancesRaht(
int* attributes = new int[attribCount * voxelCount]; int* attributes = new int[attribCount * voxelCount];
regionAdaptiveHierarchicalInverseTransform( regionAdaptiveHierarchicalInverseTransform(
aps.raht_prediction_enabled_flag, quant, mortonCode, attributes, aps.raht_prediction_enabled_flag, quantLayers, mortonCode, attributes,
attribCount, voxelCount, coefficients); attribCount, voxelCount, coefficients);
const int64_t maxReflectance = (1 << desc.attr_bitdepth) - 1; const int64_t maxReflectance = (1 << desc.attr_bitdepth) - 1;
...@@ -465,7 +481,7 @@ void ...@@ -465,7 +481,7 @@ void
AttributeDecoder::decodeColorsRaht( AttributeDecoder::decodeColorsRaht(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud) PCCPointSet3& pointCloud)
{ {
...@@ -505,7 +521,7 @@ AttributeDecoder::decodeColorsRaht( ...@@ -505,7 +521,7 @@ AttributeDecoder::decodeColorsRaht(
int* attributes = new int[attribCount * voxelCount]; int* attributes = new int[attribCount * voxelCount];
regionAdaptiveHierarchicalInverseTransform( regionAdaptiveHierarchicalInverseTransform(
aps.raht_prediction_enabled_flag, quant, mortonCode, attributes, aps.raht_prediction_enabled_flag, quantLayers, mortonCode, attributes,
attribCount, voxelCount, coefficients); attribCount, voxelCount, coefficients);
const int clipMax = (1 << desc.attr_bitdepth) - 1; const int clipMax = (1 << desc.attr_bitdepth) - 1;
...@@ -532,7 +548,7 @@ void ...@@ -532,7 +548,7 @@ void
AttributeDecoder::decodeColorsLift( AttributeDecoder::decodeColorsLift(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud) PCCPointSet3& pointCloud)
{ {
...@@ -556,10 +572,17 @@ AttributeDecoder::decodeColorsLift( ...@@ -556,10 +572,17 @@ AttributeDecoder::decodeColorsLift(
const size_t lodCount = numberOfPointsPerLOD.size(); const size_t lodCount = numberOfPointsPerLOD.size();
std::vector<Vec3<int64_t>> colors; std::vector<Vec3<int64_t>> colors;
colors.resize(pointCount); colors.resize(pointCount);
// decompress // decompress
int zero_cnt = decoder.decodeZeroCnt(pointCount); int zero_cnt = decoder.decodeZeroCnt(pointCount);
int quantLayer = 0;
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1);
}
auto& quant = quantLayers[quantLayer];
uint32_t values[3]; uint32_t values[3];
if (zero_cnt > 0) { if (zero_cnt > 0) {
values[0] = values[1] = values[2] = 0; values[0] = values[1] = values[2] = 0;
...@@ -607,7 +630,7 @@ void ...@@ -607,7 +630,7 @@ void
AttributeDecoder::decodeReflectancesLift( AttributeDecoder::decodeReflectancesLift(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud) PCCPointSet3& pointCloud)
{ {
...@@ -635,8 +658,14 @@ AttributeDecoder::decodeReflectancesLift( ...@@ -635,8 +658,14 @@ AttributeDecoder::decodeReflectancesLift(
// decompress // decompress
int zero_cnt = decoder.decodeZeroCnt(pointCount); int zero_cnt = decoder.decodeZeroCnt(pointCount);
int quantLayer = 0;
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1);
}
auto& quant = quantLayers[quantLayer];
int64_t detail = 0; int64_t detail = 0;
if (zero_cnt > 0) { if (zero_cnt > 0) {
zero_cnt--; zero_cnt--;
......
...@@ -64,42 +64,42 @@ protected: ...@@ -64,42 +64,42 @@ protected:
void decodeReflectancesLift( void decodeReflectancesLift(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud); PCCPointSet3& pointCloud);
void decodeColorsLift( void decodeColorsLift(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud); PCCPointSet3& pointCloud);
void decodeReflectancesPred( void decodeReflectancesPred(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud); PCCPointSet3& pointCloud);
void decodeColorsPred( void decodeColorsPred(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud); PCCPointSet3& pointCloud);
void decodeReflectancesRaht( void decodeReflectancesRaht(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud); PCCPointSet3& pointCloud);
void decodeColorsRaht( void decodeColorsRaht(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud); PCCPointSet3& pointCloud);
......
...@@ -333,7 +333,7 @@ AttributeEncoder::encode( ...@@ -333,7 +333,7 @@ AttributeEncoder::encode(
PCCPointSet3& pointCloud, PCCPointSet3& pointCloud,
PayloadBuffer* payload) PayloadBuffer* payload)
{ {
Quantizers quant = deriveQuantizers(attr_aps, abh); std::vector<Quantizers> quantLayers = deriveQuantizerLayers(attr_aps, abh);
PCCResidualsEncoder encoder; PCCResidualsEncoder encoder;
encoder.start(int(pointCloud.getPointCount())); encoder.start(int(pointCloud.getPointCount()));
...@@ -342,29 +342,30 @@ AttributeEncoder::encode( ...@@ -342,29 +342,30 @@ AttributeEncoder::encode(
switch (attr_aps.attr_encoding) { switch (attr_aps.attr_encoding) {
case AttributeEncoding::kRAHTransform: case AttributeEncoding::kRAHTransform:
encodeReflectancesTransformRaht( encodeReflectancesTransformRaht(
desc, attr_aps, quant, pointCloud, encoder); desc, attr_aps, quantLayers, pointCloud, encoder);
break; break;
case AttributeEncoding::kPredictingTransform: case AttributeEncoding::kPredictingTransform:
encodeReflectancesPred(desc, attr_aps, quant, pointCloud, encoder); encodeReflectancesPred(desc, attr_aps, quantLayers, pointCloud, encoder);
break; break;
case AttributeEncoding::kLiftingTransform: case AttributeEncoding::kLiftingTransform:
encodeReflectancesLift(desc, attr_aps, quant, pointCloud, encoder); encodeReflectancesLift(desc, attr_aps, quantLayers, pointCloud, encoder);
break; break;
} }
} else if (desc.attr_num_dimensions == 3) { } else if (desc.attr_num_dimensions == 3) {
switch (attr_aps.attr_encoding) { switch (attr_aps.attr_encoding) {
case AttributeEncoding::kRAHTransform: case AttributeEncoding::kRAHTransform:
encodeColorsTransformRaht(desc, attr_aps, quant, pointCloud, encoder); encodeColorsTransformRaht(
desc, attr_aps, quantLayers, pointCloud, encoder);
break; break;
case AttributeEncoding::kPredictingTransform: case AttributeEncoding::kPredictingTransform:
encodeColorsPred(desc, attr_aps, quant, pointCloud, encoder); encodeColorsPred(desc, attr_aps, quantLayers, pointCloud, encoder);
break; break;
case AttributeEncoding::kLiftingTransform: case AttributeEncoding::kLiftingTransform:
encodeColorsLift(desc, attr_aps, quant, pointCloud, encoder); encodeColorsLift(desc, attr_aps, quantLayers, pointCloud, encoder);
break; break;
} }
} else { } else {
...@@ -467,7 +468,7 @@ void ...@@ -467,7 +468,7 @@ void
AttributeEncoder::encodeReflectancesPred( AttributeEncoder::encodeReflectancesPred(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCPointSet3& pointCloud, PCCPointSet3& pointCloud,
PCCResidualsEncoder& encoder) PCCResidualsEncoder& encoder)
{ {
...@@ -490,9 +491,15 @@ AttributeEncoder::encodeReflectancesPred( ...@@ -490,9 +491,15 @@ AttributeEncoder::encodeReflectancesPred(
std::vector<uint32_t> residual; std::vector<uint32_t> residual;
residual.resize(pointCount); residual.resize(pointCount);
int quantLayer = 0;
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1);
}
auto& quant = quantLayers[quantLayer];
auto& predictor = predictors[predictorIndex]; auto& predictor = predictors[predictorIndex];
computeReflectancePredictionWeights( computeReflectancePredictionWeights(
aps, pointCloud, indexesLOD, predictorIndex, predictor, encoder, context, aps, pointCloud, indexesLOD, predictorIndex, predictor, encoder, context,
quant[0]); quant[0]);
...@@ -651,7 +658,7 @@ void ...@@ -651,7 +658,7 @@ void
AttributeEncoder::encodeColorsPred( AttributeEncoder::encodeColorsPred(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCPointSet3& pointCloud, PCCPointSet3& pointCloud,
PCCResidualsEncoder& encoder) PCCResidualsEncoder& encoder)
{ {
...@@ -669,7 +676,6 @@ AttributeEncoder::encodeColorsPred( ...@@ -669,7 +676,6 @@ AttributeEncoder::encodeColorsPred(
const int64_t clipMax = (1ll << desc.attr_bitdepth) - 1; const int64_t clipMax = (1ll << desc.attr_bitdepth) - 1;
uint32_t values[3]; uint32_t values[3];
PCCResidualsEntropyEstimator context; PCCResidualsEntropyEstimator context;
int zero_cnt = 0; int zero_cnt = 0;
std::vector<int> zerorun; std::vector<int> zerorun;
std::vector<uint32_t> residual[3]; std::vector<uint32_t> residual[3];
...@@ -677,9 +683,15 @@ AttributeEncoder::encodeColorsPred( ...@@ -677,9 +683,15 @@ AttributeEncoder::encodeColorsPred(
residual[i].resize(pointCount); residual[i].resize(pointCount);
} }
int quantLayer = 0;
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1);
}
auto& quant = quantLayers[quantLayer];
auto& predictor = predictors[predictorIndex]; auto& predictor = predictors[predictorIndex];
computeColorPredictionWeights( computeColorPredictionWeights(
aps, pointCloud, indexesLOD, predictorIndex, predictor, encoder, context, aps, pointCloud, indexesLOD, predictorIndex, predictor, encoder, context,
quant); quant);
...@@ -757,7 +769,7 @@ void ...@@ -757,7 +769,7 @@ void
AttributeEncoder::encodeReflectancesTransformRaht( AttributeEncoder::encodeReflectancesTransformRaht(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCPointSet3& pointCloud, PCCPointSet3& pointCloud,
PCCResidualsEncoder& encoder) PCCResidualsEncoder& encoder)
{ {
...@@ -784,7 +796,7 @@ AttributeEncoder::encodeReflectancesTransformRaht( ...@@ -784,7 +796,7 @@ AttributeEncoder::encodeReflectancesTransformRaht(
// Transform. // Transform.
regionAdaptiveHierarchicalTransform( regionAdaptiveHierarchicalTransform(
aps.raht_prediction_enabled_flag, quant, mortonCode, attributes, aps.raht_prediction_enabled_flag, quantLayers, mortonCode, attributes,
attribCount, voxelCount, coefficients); attribCount, voxelCount, coefficients);
// Entropy encode. // Entropy encode.
...@@ -825,7 +837,7 @@ void ...@@ -825,7 +837,7 @@ void
AttributeEncoder::encodeColorsTransformRaht( AttributeEncoder::encodeColorsTransformRaht(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCPointSet3& pointCloud, PCCPointSet3& pointCloud,
PCCResidualsEncoder& encoder) PCCResidualsEncoder& encoder)
{ {
...@@ -854,7 +866,7 @@ AttributeEncoder::encodeColorsTransformRaht( ...@@ -854,7 +866,7 @@ AttributeEncoder::encodeColorsTransformRaht(
// Transform. // Transform.
regionAdaptiveHierarchicalTransform( regionAdaptiveHierarchicalTransform(
aps.raht_prediction_enabled_flag, quant, mortonCode, attributes, aps.raht_prediction_enabled_flag, quantLayers, mortonCode, attributes,
attribCount, voxelCount, coefficients); attribCount, voxelCount, coefficients);
// Entropy encode. // Entropy encode.
...@@ -899,7 +911,7 @@ void ...@@ -899,7 +911,7 @@ void
AttributeEncoder::encodeColorsLift( AttributeEncoder::encodeColorsLift(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCPointSet3& pointCloud, PCCPointSet3& pointCloud,
PCCResidualsEncoder& encoder) PCCResidualsEncoder& encoder)
{ {
...@@ -941,8 +953,14 @@ AttributeEncoder::encodeColorsLift( ...@@ -941,8 +953,14 @@ AttributeEncoder::encodeColorsLift(
// compress // compress
int zero_cnt = 0; int zero_cnt = 0;
int quantLayer = 0;
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1);
}
auto& quant = quantLayers[quantLayer];
const int64_t quantWeight = weights[predictorIndex]; const int64_t quantWeight = weights[predictorIndex];
auto& color = colors[predictorIndex]; auto& color = colors[predictorIndex];
const int64_t delta = quant[0].quantize(color[0] * quantWeight); const int64_t delta = quant[0].quantize(color[0] * quantWeight);
...@@ -996,7 +1014,7 @@ void ...@@ -996,7 +1014,7 @@ void
AttributeEncoder::encodeReflectancesLift( AttributeEncoder::encodeReflectancesLift(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const Quantizers& quant, const std::vector<Quantizers>& quantLayers,
PCCPointSet3& pointCloud, PCCPointSet3& pointCloud,
PCCResidualsEncoder& encoder) PCCResidualsEncoder& encoder)
{ {
...@@ -1038,8 +1056,14 @@ AttributeEncoder::encodeReflectancesLift( ...@@ -1038,8 +1056,14 @@ AttributeEncoder::encodeReflectancesLift(
// compress // compress
int zero_cnt = 0; int zero_cnt = 0;
int quantLayer = 0;
for (size_t predictorIndex = 0; predictorIndex < pointCount;