Commit 17e89a3f authored by David Flynn's avatar David Flynn
Browse files

m43662/geometry: replace neighb=0 with sibling neighbour constraint

In the contextualisation of occupancy coding using neighbour patterns,
this commit replaces the case when neighbour contextualisation is
disabled with a constraint that restricts neighbour contextualisation
only examine the direct siblings of a node.

The restriction ensures that at most three neighbours may be present
for a node.

The configuration option "neighbourContextualisation=1" is replaced with
"neighbourContextRestriction=0".
parent 7d62e7ca
......@@ -262,9 +262,12 @@ PCCBuildPredictors(
//---------------------------------------------------------------------------
// Update the neighbour pattern flags for a node and the 'left' neighbour on
// each axis. This update should be applied to each newly inserted node.
//
// @param siblingRestriction limits neighbours to direct siblings of child
inline void
updateGeometryNeighState(
bool siblingRestriction,
const ringbuf<PCCOctree3Node>::iterator& bufEnd,
int64_t numNodesNextLvl,
int childSizeLog2,
......@@ -273,7 +276,10 @@ updateGeometryNeighState(
uint8_t neighPattern,
uint8_t parantOccupancy)
{
uint64_t midx = child.mortonIdx = mortonAddr(child.pos, childSizeLog2);
uint64_t midx;
if (!siblingRestriction) {
midx = child.mortonIdx = mortonAddr(child.pos, childSizeLog2);
}
static const struct {
int childIdxBitPos;
......@@ -304,6 +310,10 @@ updateGeometryNeighState(
continue;
}
if (siblingRestriction)
continue;
uint64_t midx = child.mortonIdx = mortonAddr(child.pos, childSizeLog2);
// calculate the morton address of the 'left' neighbour,
// the delta is then used as the starting position for a search
int64_t mortonIdxNeigh =
......
......@@ -183,7 +183,7 @@ private:
geometryPointsAreUnique = bool(u8value);
PCCReadFromBuffer<uint8_t>(bitstream.buffer, u8value, bitstream.size);
neighbourContextsEnabled = bool(u8value);
neighbourContextRestriction = bool(u8value);
PCCReadFromBuffer<uint8_t>(bitstream.buffer, u8value, bitstream.size);
inferredDirectCodingModeEnabled = bool(u8value);
......@@ -478,18 +478,12 @@ private:
// decode node occupancy bits
//
uint32_t decodeGeometryOccupancy(
bool neighbourContextsEnabled,
o3dgc::Arithmetic_Codec* arithmeticDecoder,
o3dgc::Adaptive_Bit_Model& ctxSingleChild,
o3dgc::Static_Bit_Model& ctxEquiProb,
CtxModelOctreeOccupancy& ctxOccupancy,
const PCCOctree3Node& node0)
{
if (!neighbourContextsEnabled) {
assert(0); // todo(df): fixme -- we need an old context for this.
//return arithmeticDecoder->decode(ctxOccupancy[0]);
}
// neighbouring configuration with reduction from 64 to 10
int neighPattern = node0.neighPattern;
int neighPattern10 = kNeighPattern64to10[neighPattern];
......@@ -632,8 +626,8 @@ private:
// decode occupancy pattern
uint8_t occupancy = decodeGeometryOccupancy(
neighbourContextsEnabled, &arithmeticDecoder, ctxSingleChild,
ctxEquiProb, ctxOccupancy, node0);
&arithmeticDecoder, ctxSingleChild, ctxEquiProb, ctxOccupancy, node0);
assert(occupancy > 0);
// population count of occupancy for IDCM
......@@ -704,11 +698,10 @@ private:
}
numNodesNextLvl++;
if (neighbourContextsEnabled) {
updateGeometryNeighState(
fifo.end(), numNodesNextLvl, childSizeLog2, child, i,
node0.neighPattern, occupancy);
}
updateGeometryNeighState(
neighbourContextRestriction, fifo.end(), numNodesNextLvl,
childSizeLog2, child, i, node0.neighPattern, occupancy);
}
}
......@@ -750,7 +743,7 @@ private:
// Controls the use of neighbour based contextualisation of octree
// occupancy during geometry coding.
bool neighbourContextsEnabled;
bool neighbourContextRestriction;
// Controls the use of early termination of the geometry tree
// by directly coding the position of isolated points.
......
......@@ -63,13 +63,15 @@ struct PCCTMC3Encoder3Parameters {
bool mergeDuplicatedPoints;
// Controls the use of neighbour based contextualisation of octree
// occupancy during geometry coding.
bool neighbourContextsEnabled;
// occupancy during geometry coding. When true, only neighbours that
// are direct siblings are available.
bool neighbourContextRestriction;
// Controls the use of early termination of the geometry tree
// by directly coding the position of isolated points.
bool inferredDirectCodingModeEnabled;
bool skipNeighborSearch;
struct TriSoup {
// depth of voxels (reconstructed points) in trisoup geometry
int depth;
......@@ -465,7 +467,6 @@ private:
// decode node occupancy bits
//
void encodeGeometryOccupancy(
bool neighbourContextsEnabled,
o3dgc::Arithmetic_Codec* arithmeticEncoder,
o3dgc::Adaptive_Bit_Model& ctxSingleChild,
o3dgc::Static_Bit_Model& ctxEquiProb,
......@@ -473,12 +474,6 @@ private:
const PCCOctree3Node& node0,
int occupancy)
{
if (!neighbourContextsEnabled) {
assert(0); // todo(df): fixme -- old contexts needed
// arithmeticEncoder->encode(occupancy, ctxOccupancy[0]);
return;
}
// code occupancy using the neighbour configuration context
// with reduction from 64 states to 10.
int neighPattern = node0.neighPattern;
......@@ -649,8 +644,8 @@ private:
// encode child occupancy map
assert(occupancy > 0);
encodeGeometryOccupancy(
params.neighbourContextsEnabled, &arithmeticEncoder, ctxSingleChild,
ctxEquiProb, ctxOccupancy, node0, occupancy);
&arithmeticEncoder, ctxSingleChild, ctxEquiProb, ctxOccupancy, node0,
occupancy);
// when nodeSizeLog2 == 1, children are indivisible (ie leaf nodes)
// and are immediately coded. No further splitting occurs.
......@@ -727,11 +722,10 @@ private:
}
numNodesNextLvl++;
if (params.neighbourContextsEnabled) {
updateGeometryNeighState(
fifo.end(), numNodesNextLvl, childSizeLog2, child, i,
node0.neighPattern, occupancy);
}
updateGeometryNeighState(
params.neighbourContextRestriction, fifo.end(), numNodesNextLvl,
childSizeLog2, child, i, node0.neighPattern, occupancy);
}
}
......@@ -782,7 +776,7 @@ private:
uint8_t(params.mergeDuplicatedPoints), bitstream.buffer, bitstream.size);
PCCWriteToBuffer<uint8_t>(
uint8_t(params.neighbourContextsEnabled), bitstream.buffer,
uint8_t(params.neighbourContextRestriction), bitstream.buffer,
bitstream.size);
PCCWriteToBuffer<uint8_t>(
......
......@@ -244,9 +244,9 @@ ParseParameters(int argc, char* argv[], Parameters& params)
" 1: octree (TMC3)\n"
" 2: trisoup (TMC1)")
("neighbourContextualisation",
params.encodeParameters.neighbourContextsEnabled, true,
"Contextualise geometry octree occupancy based on neighbour patterns")
("neighbourContextRestriction",
params.encodeParameters.neighbourContextRestriction, false,
"Limit geometry octree occupancy contextualisation to sibling nodes")
("inferredDirectCodingMode",
params.encodeParameters.inferredDirectCodingModeEnabled, true,
......
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