Commit 38a92199 authored by David Flynn's avatar David Flynn
Browse files

geom: fix encoder geometry scaling

This commit fixes an error in the geometry scaling, resulting in
an incorrect reconstructed point (used for attribute coding) when
qP > 10, and node-based quantisation is used.
parent 7030e44b
......@@ -896,12 +896,13 @@ Vec3<int32_t>
invQuantPosition(int qp, Vec3<uint32_t> quantMasks, const Vec3<int32_t>& pos)
{
// pos represents the position within the coded tree as follows:
// |pppppqqqqqq|00
// |pppppqqqqqq|00
// - p = unquantised bit
// - q = quantised bit
// - 0 = bits that were not coded (MSBs of q)
// The reconstruction is:
// |ppppp00qqqqqq|
// |ppppp00qqqqqq| <- just prior to scaling
// |pppppssssssss| < after scaling (s = scale(q))
QuantizerGeom quantizer(qp);
int shiftBits = (qp - 4) / 6;
......
......@@ -887,8 +887,8 @@ geometryQuantization(
int32_t quantPos = quantizer.quantize(pos & quantBitsMask);
quantPos = PCCClip(quantPos, 0, clipMax);
// NB: this representation is: |ppppppqqq|00, which is the
// same as the decoder
// NB: this representation is: |ppppppqqq00|, which, except for
// the zero padding, is the same as the decoder.
pointCloud[i][k] = (pos & ~quantBitsMask) | (quantPos << qpShift);
}
}
......@@ -907,7 +907,7 @@ geometryScale(
int quantBitsMask = (1 << quantNodeSizeLog2[k]) - 1;
for (int i = node.start; i < node.end; i++) {
int32_t pos = int32_t(pointCloud[i][k]);
int32_t quantPos = (pos >> qpShift) & quantBitsMask;
int32_t quantPos = (pos & quantBitsMask) >> qpShift;
pointCloud[i][k] = (pos & ~quantBitsMask) | quantizer.scale(quantPos);
}
}
......
Markdown is supported
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