Commit 6b18730b authored by Noritaka Iguchi's avatar Noritaka Iguchi Committed by David Flynn
Browse files

attr/m49626: add region-wise quantization support for LoD coding

A per-slice region may be defined with a qp offset.  Points within
the region have an offset applied to the per-level QP.
parent 1654a45d
...@@ -189,7 +189,7 @@ AttributeDecoder::decode( ...@@ -189,7 +189,7 @@ AttributeDecoder::decode(
int abhSize; int abhSize;
AttributeBrickHeader abh = parseAbh(attr_aps, payload, &abhSize); AttributeBrickHeader abh = parseAbh(attr_aps, payload, &abhSize);
std::vector<Quantizers> quantLayers = deriveQuantizerLayers(attr_aps, abh); QpSet qpSet = deriveQpSet(attr_aps, abh);
PCCResidualsDecoder decoder; PCCResidualsDecoder decoder;
decoder.start(sps, payload.data() + abhSize, payload.size() - abhSize); decoder.start(sps, payload.data() + abhSize, payload.size() - abhSize);
...@@ -197,34 +197,32 @@ AttributeDecoder::decode( ...@@ -197,34 +197,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( decodeReflectancesRaht(attr_desc, attr_aps, qpSet, decoder, pointCloud);
attr_desc, attr_aps, quantLayers, decoder, pointCloud);
break; break;
case AttributeEncoding::kPredictingTransform: case AttributeEncoding::kPredictingTransform:
decodeReflectancesPred( decodeReflectancesPred(attr_desc, attr_aps, qpSet, decoder, pointCloud);
attr_desc, attr_aps, quantLayers, decoder, pointCloud);
break; break;
case AttributeEncoding::kLiftingTransform: case AttributeEncoding::kLiftingTransform:
decodeReflectancesLift( decodeReflectancesLift(
attr_desc, attr_aps, quantLayers, geom_num_points, minGeomNodeSizeLog2, attr_desc, attr_aps, qpSet, geom_num_points, minGeomNodeSizeLog2,
decoder, pointCloud); 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, quantLayers, decoder, pointCloud); decodeColorsRaht(attr_desc, attr_aps, qpSet, decoder, pointCloud);
break; break;
case AttributeEncoding::kPredictingTransform: case AttributeEncoding::kPredictingTransform:
decodeColorsPred(attr_desc, attr_aps, quantLayers, decoder, pointCloud); decodeColorsPred(attr_desc, attr_aps, qpSet, decoder, pointCloud);
break; break;
case AttributeEncoding::kLiftingTransform: case AttributeEncoding::kLiftingTransform:
decodeColorsLift( decodeColorsLift(
attr_desc, attr_aps, quantLayers, geom_num_points, minGeomNodeSizeLog2, attr_desc, attr_aps, qpSet, geom_num_points, minGeomNodeSizeLog2,
decoder, pointCloud); decoder, pointCloud);
break; break;
} }
...@@ -277,7 +275,7 @@ void ...@@ -277,7 +275,7 @@ void
AttributeDecoder::decodeReflectancesPred( AttributeDecoder::decodeReflectancesPred(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud) PCCPointSet3& pointCloud)
{ {
...@@ -295,14 +293,14 @@ AttributeDecoder::decodeReflectancesPred( ...@@ -295,14 +293,14 @@ AttributeDecoder::decodeReflectancesPred(
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) { if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1); quantLayer = std::min(int(qpSet.layers.size()) - 1, quantLayer + 1);
} }
auto& quant = quantLayers[quantLayer]; const uint32_t pointIndex = indexesLOD[predictorIndex];
auto quant = qpSet.quantizers(pointCloud[pointIndex], 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];
attr_t& reflectance = pointCloud.getReflectance(pointIndex); attr_t& reflectance = pointCloud.getReflectance(pointIndex);
uint32_t attValue0 = 0; uint32_t attValue0 = 0;
if (zero_cnt > 0) { if (zero_cnt > 0) {
...@@ -365,7 +363,7 @@ void ...@@ -365,7 +363,7 @@ void
AttributeDecoder::decodeColorsPred( AttributeDecoder::decodeColorsPred(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud) PCCPointSet3& pointCloud)
{ {
...@@ -387,9 +385,10 @@ AttributeDecoder::decodeColorsPred( ...@@ -387,9 +385,10 @@ AttributeDecoder::decodeColorsPred(
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) { if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1); quantLayer = std::min(int(qpSet.layers.size()) - 1, quantLayer + 1);
} }
auto& quant = quantLayers[quantLayer]; const uint32_t pointIndex = indexesLOD[predictorIndex];
auto quant = qpSet.quantizers(pointCloud[pointIndex], quantLayer);
auto& predictor = predictors[predictorIndex]; auto& predictor = predictors[predictorIndex];
computeColorPredictionWeights( computeColorPredictionWeights(
...@@ -401,7 +400,6 @@ AttributeDecoder::decodeColorsPred( ...@@ -401,7 +400,6 @@ AttributeDecoder::decodeColorsPred(
decoder.decode(values); decoder.decode(values);
zero_cnt = decoder.decodeZeroCnt(pointCount); zero_cnt = decoder.decodeZeroCnt(pointCount);
} }
const uint32_t pointIndex = indexesLOD[predictorIndex];
Vec3<attr_t>& color = pointCloud.getColor(pointIndex); Vec3<attr_t>& color = pointCloud.getColor(pointIndex);
const Vec3<attr_t> predictedColor = const Vec3<attr_t> predictedColor =
predictor.predictColor(pointCloud, indexesLOD); predictor.predictColor(pointCloud, indexesLOD);
...@@ -426,7 +424,7 @@ void ...@@ -426,7 +424,7 @@ void
AttributeDecoder::decodeReflectancesRaht( AttributeDecoder::decodeReflectancesRaht(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud) PCCPointSet3& pointCloud)
{ {
...@@ -460,7 +458,7 @@ AttributeDecoder::decodeReflectancesRaht( ...@@ -460,7 +458,7 @@ AttributeDecoder::decodeReflectancesRaht(
} }
int* attributes = new int[attribCount * voxelCount]; int* attributes = new int[attribCount * voxelCount];
auto quantLayers = qpSet.quantizerLayers();
regionAdaptiveHierarchicalInverseTransform( regionAdaptiveHierarchicalInverseTransform(
aps.raht_prediction_enabled_flag, quantLayers, mortonCode, attributes, aps.raht_prediction_enabled_flag, quantLayers, mortonCode, attributes,
attribCount, voxelCount, coefficients); attribCount, voxelCount, coefficients);
...@@ -486,7 +484,7 @@ void ...@@ -486,7 +484,7 @@ void
AttributeDecoder::decodeColorsRaht( AttributeDecoder::decodeColorsRaht(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud) PCCPointSet3& pointCloud)
{ {
...@@ -524,7 +522,7 @@ AttributeDecoder::decodeColorsRaht( ...@@ -524,7 +522,7 @@ AttributeDecoder::decodeColorsRaht(
} }
int* attributes = new int[attribCount * voxelCount]; int* attributes = new int[attribCount * voxelCount];
auto quantLayers = qpSet.quantizerLayers();
regionAdaptiveHierarchicalInverseTransform( regionAdaptiveHierarchicalInverseTransform(
aps.raht_prediction_enabled_flag, quantLayers, mortonCode, attributes, aps.raht_prediction_enabled_flag, quantLayers, mortonCode, attributes,
attribCount, voxelCount, coefficients); attribCount, voxelCount, coefficients);
...@@ -556,7 +554,7 @@ void ...@@ -556,7 +554,7 @@ void
AttributeDecoder::decodeColorsLift( AttributeDecoder::decodeColorsLift(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
int geom_num_points, int geom_num_points,
int minGeomNodeSizeLog2, int minGeomNodeSizeLog2,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
...@@ -603,9 +601,10 @@ AttributeDecoder::decodeColorsLift( ...@@ -603,9 +601,10 @@ AttributeDecoder::decodeColorsLift(
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) { if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1); quantLayer = std::min(int(qpSet.layers.size()) - 1, quantLayer + 1);
} }
auto& quant = quantLayers[quantLayer]; const uint32_t pointIndex = indexesLOD[predictorIndex];
auto quant = qpSet.quantizers(pointCloud[pointIndex], quantLayer);
uint32_t values[3]; uint32_t values[3];
if (zero_cnt > 0) { if (zero_cnt > 0) {
...@@ -658,7 +657,7 @@ void ...@@ -658,7 +657,7 @@ void
AttributeDecoder::decodeReflectancesLift( AttributeDecoder::decodeReflectancesLift(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
int geom_num_points, int geom_num_points,
int minGeomNodeSizeLog2, int minGeomNodeSizeLog2,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
...@@ -705,9 +704,10 @@ AttributeDecoder::decodeReflectancesLift( ...@@ -705,9 +704,10 @@ AttributeDecoder::decodeReflectancesLift(
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) { if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1); quantLayer = std::min(int(qpSet.layers.size()) - 1, quantLayer + 1);
} }
auto& quant = quantLayers[quantLayer]; const uint32_t pointIndex = indexesLOD[predictorIndex];
auto quant = qpSet.quantizers(pointCloud[pointIndex], quantLayer);
int64_t detail = 0; int64_t detail = 0;
if (zero_cnt > 0) { if (zero_cnt > 0) {
......
...@@ -67,7 +67,7 @@ protected: ...@@ -67,7 +67,7 @@ protected:
void decodeReflectancesLift( void decodeReflectancesLift(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
int geom_num_points, int geom_num_points,
int minGeomNodeSizeLog2, int minGeomNodeSizeLog2,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
...@@ -76,7 +76,7 @@ protected: ...@@ -76,7 +76,7 @@ protected:
void decodeColorsLift( void decodeColorsLift(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
int geom_num_points, int geom_num_points,
int minGeomNodeSizeLog2, int minGeomNodeSizeLog2,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
...@@ -85,28 +85,28 @@ protected: ...@@ -85,28 +85,28 @@ protected:
void decodeReflectancesPred( void decodeReflectancesPred(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
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 std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
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 std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
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 std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
PCCResidualsDecoder& decoder, PCCResidualsDecoder& decoder,
PCCPointSet3& pointCloud); PCCPointSet3& pointCloud);
......
...@@ -337,7 +337,7 @@ AttributeEncoder::encode( ...@@ -337,7 +337,7 @@ AttributeEncoder::encode(
PCCPointSet3& pointCloud, PCCPointSet3& pointCloud,
PayloadBuffer* payload) PayloadBuffer* payload)
{ {
std::vector<Quantizers> quantLayers = deriveQuantizerLayers(attr_aps, abh); QpSet qpSet = deriveQpSet(attr_aps, abh);
PCCResidualsEncoder encoder; PCCResidualsEncoder encoder;
encoder.start(sps, int(pointCloud.getPointCount())); encoder.start(sps, int(pointCloud.getPointCount()));
...@@ -346,30 +346,29 @@ AttributeEncoder::encode( ...@@ -346,30 +346,29 @@ AttributeEncoder::encode(
switch (attr_aps.attr_encoding) { switch (attr_aps.attr_encoding) {
case AttributeEncoding::kRAHTransform: case AttributeEncoding::kRAHTransform:
encodeReflectancesTransformRaht( encodeReflectancesTransformRaht(
desc, attr_aps, quantLayers, pointCloud, encoder); desc, attr_aps, qpSet, pointCloud, encoder);
break; break;
case AttributeEncoding::kPredictingTransform: case AttributeEncoding::kPredictingTransform:
encodeReflectancesPred(desc, attr_aps, quantLayers, pointCloud, encoder); encodeReflectancesPred(desc, attr_aps, qpSet, pointCloud, encoder);
break; break;
case AttributeEncoding::kLiftingTransform: case AttributeEncoding::kLiftingTransform:
encodeReflectancesLift(desc, attr_aps, quantLayers, pointCloud, encoder); encodeReflectancesLift(desc, attr_aps, qpSet, 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( encodeColorsTransformRaht(desc, attr_aps, qpSet, pointCloud, encoder);
desc, attr_aps, quantLayers, pointCloud, encoder);
break; break;
case AttributeEncoding::kPredictingTransform: case AttributeEncoding::kPredictingTransform:
encodeColorsPred(desc, attr_aps, quantLayers, pointCloud, encoder); encodeColorsPred(desc, attr_aps, qpSet, pointCloud, encoder);
break; break;
case AttributeEncoding::kLiftingTransform: case AttributeEncoding::kLiftingTransform:
encodeColorsLift(desc, attr_aps, quantLayers, pointCloud, encoder); encodeColorsLift(desc, attr_aps, qpSet, pointCloud, encoder);
break; break;
} }
} else { } else {
...@@ -472,7 +471,7 @@ void ...@@ -472,7 +471,7 @@ void
AttributeEncoder::encodeReflectancesPred( AttributeEncoder::encodeReflectancesPred(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
PCCPointSet3& pointCloud, PCCPointSet3& pointCloud,
PCCResidualsEncoder& encoder) PCCResidualsEncoder& encoder)
{ {
...@@ -496,16 +495,16 @@ AttributeEncoder::encodeReflectancesPred( ...@@ -496,16 +495,16 @@ AttributeEncoder::encodeReflectancesPred(
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) { if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1); quantLayer = std::min(int(qpSet.layers.size()) - 1, quantLayer + 1);
} }
auto& quant = quantLayers[quantLayer]; const uint32_t pointIndex = indexesLOD[predictorIndex];
auto quant = qpSet.quantizers(pointCloud[pointIndex], 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]);
const uint32_t pointIndex = indexesLOD[predictorIndex];
const uint64_t reflectance = pointCloud.getReflectance(pointIndex); const uint64_t reflectance = pointCloud.getReflectance(pointIndex);
const attr_t predictedReflectance = const attr_t predictedReflectance =
predictor.predictReflectance(pointCloud, indexesLOD); predictor.predictReflectance(pointCloud, indexesLOD);
...@@ -658,7 +657,7 @@ void ...@@ -658,7 +657,7 @@ void
AttributeEncoder::encodeColorsPred( AttributeEncoder::encodeColorsPred(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
PCCPointSet3& pointCloud, PCCPointSet3& pointCloud,
PCCResidualsEncoder& encoder) PCCResidualsEncoder& encoder)
{ {
...@@ -682,20 +681,19 @@ AttributeEncoder::encodeColorsPred( ...@@ -682,20 +681,19 @@ AttributeEncoder::encodeColorsPred(
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
residual[i].resize(pointCount); residual[i].resize(pointCount);
} }
int quantLayer = 0; int quantLayer = 0;
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) { if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1); quantLayer = std::min(int(qpSet.layers.size()) - 1, quantLayer + 1);
} }
auto& quant = quantLayers[quantLayer]; const auto pointIndex = indexesLOD[predictorIndex];
auto quant = qpSet.quantizers(pointCloud[pointIndex], 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);
const auto pointIndex = indexesLOD[predictorIndex];
const Vec3<attr_t> color = pointCloud.getColor(pointIndex); const Vec3<attr_t> color = pointCloud.getColor(pointIndex);
const Vec3<attr_t> predictedColor = const Vec3<attr_t> predictedColor =
predictor.predictColor(pointCloud, indexesLOD); predictor.predictColor(pointCloud, indexesLOD);
...@@ -770,7 +768,7 @@ void ...@@ -770,7 +768,7 @@ void
AttributeEncoder::encodeReflectancesTransformRaht( AttributeEncoder::encodeReflectancesTransformRaht(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
PCCPointSet3& pointCloud, PCCPointSet3& pointCloud,
PCCResidualsEncoder& encoder) PCCResidualsEncoder& encoder)
{ {
...@@ -795,6 +793,7 @@ AttributeEncoder::encodeReflectancesTransformRaht( ...@@ -795,6 +793,7 @@ AttributeEncoder::encodeReflectancesTransformRaht(
attributes[attribCount * n] = reflectance; attributes[attribCount * n] = reflectance;
} }
auto quantLayers = qpSet.quantizerLayers();
// Transform. // Transform.
regionAdaptiveHierarchicalTransform( regionAdaptiveHierarchicalTransform(
aps.raht_prediction_enabled_flag, quantLayers, mortonCode, attributes, aps.raht_prediction_enabled_flag, quantLayers, mortonCode, attributes,
...@@ -838,7 +837,7 @@ void ...@@ -838,7 +837,7 @@ void
AttributeEncoder::encodeColorsTransformRaht( AttributeEncoder::encodeColorsTransformRaht(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
PCCPointSet3& pointCloud, PCCPointSet3& pointCloud,
PCCResidualsEncoder& encoder) PCCResidualsEncoder& encoder)
{ {
...@@ -865,6 +864,7 @@ AttributeEncoder::encodeColorsTransformRaht( ...@@ -865,6 +864,7 @@ AttributeEncoder::encodeColorsTransformRaht(
attributes[attribCount * n + 2] = color[2]; attributes[attribCount * n + 2] = color[2];
} }
auto quantLayers = qpSet.quantizerLayers();
// Transform. // Transform.
regionAdaptiveHierarchicalTransform( regionAdaptiveHierarchicalTransform(
aps.raht_prediction_enabled_flag, quantLayers, mortonCode, attributes, aps.raht_prediction_enabled_flag, quantLayers, mortonCode, attributes,
...@@ -915,7 +915,7 @@ void ...@@ -915,7 +915,7 @@ void
AttributeEncoder::encodeColorsLift( AttributeEncoder::encodeColorsLift(
const AttributeDescription& desc, const AttributeDescription& desc,
const AttributeParameterSet& aps, const AttributeParameterSet& aps,
const std::vector<Quantizers>& quantLayers, const QpSet& qpSet,
PCCPointSet3& pointCloud, PCCPointSet3& pointCloud,
PCCResidualsEncoder& encoder) PCCResidualsEncoder& encoder)
{ {
...@@ -963,9 +963,10 @@ AttributeEncoder::encodeColorsLift( ...@@ -963,9 +963,10 @@ AttributeEncoder::encodeColorsLift(
for (size_t predictorIndex = 0; predictorIndex < pointCount; for (size_t predictorIndex = 0; predictorIndex < pointCount;
++predictorIndex) { ++predictorIndex) {
if (predictorIndex == numberOfPointsPerLOD[quantLayer]) { if (predictorIndex == numberOfPointsPerLOD[quantLayer]) {
quantLayer = std::min(int(quantLayers.size()) - 1, quantLayer + 1); quantLayer = std::min(int(qpSet.layers.size()) - 1, quantLayer + 1);
} }
auto& quant = quantLayers[quantLayer]; const auto pointIndex = indexesLOD[predictorIndex];
auto quant = qpSet.quantizers(pointCloud[pointIndex], quantLayer);
const int64_t quantWeight = weights[predictorIndex]; const int64_t quantWeight = weights[predictorIndex];
auto& color = colors[predictorIndex]; auto& color = colors[predictorIndex];
...@@ -1023,7 +1024,7 @@ void ...@@ -1023,7 +1024,7 @@ void
AttributeEncoder::encodeReflectancesLift( AttributeEncoder::encodeReflectancesLift(
const AttributeDescription& desc, const AttributeDescription& desc,