Commit 70c904ff authored by David Flynn's avatar David Flynn
Browse files

hls/m43953: signal geom_slice_id / attr_geom_slice_id

 - signal geom_slice_id / attr_geom_slice_id in geometry / attribute
   header.

 - attr_geom_slice_id set to current geom_slice_id to maintain
   relationship between attribute and geometry.

 - increment geom_slice_id after each round of encoding.

 - decoder checks that the attribute payload's attr_geom_slice_id
   corresponds to the most recently decoded geometry payload.
parent 82a0c430
......@@ -87,6 +87,9 @@ public:
//==========================================================================
private:
// Current identifier of payloads with the same geometry
int _sliceId;
PCCVector3D minPositions;
// The point cloud currently being decoded
......
......@@ -98,6 +98,9 @@ private:
const SequenceParameterSet* _sps;
const GeometryParameterSet* _gps;
std::vector<const AttributeParameterSet*> _aps;
// Current identifier of payloads with the same geometry
int _sliceId;
};
//============================================================================
......
......@@ -162,6 +162,7 @@ PCCTMC3Decoder3::decodeGeometryBrick(const PayloadBuffer& buf)
int gbhSize;
GeometryBrickHeader gbh = parseGbh(*_gps, buf, &gbhSize);
_sliceId = gbh.geom_slice_id;
minPositions.x() = gbh.geomBoxOrigin.x();
minPositions.y() = gbh.geomBoxOrigin.y();
minPositions.z() = gbh.geomBoxOrigin.z();
......@@ -203,8 +204,11 @@ PCCTMC3Decoder3::decodeAttributeBrick(const PayloadBuffer& buf)
assert(_sps);
assert(_gps);
// todo(df): validate that sps activation is not changed via the APS
// verify that this corresponds to the correct geometry slice
AttributeBrickHeader abh = parseAbh(buf, nullptr);
assert(abh.attr_geom_slice_id == _sliceId);
// todo(df): validate that sps activation is not changed via the APS
const auto it_attr_aps = _apss.find(abh.attr_attr_parameter_set_id);
assert(it_attr_aps != _apss.cend());
......
......@@ -123,13 +123,15 @@ PCCTMC3Encoder3::compress(
// geometry compression consists of the following stages:
// - prefilter/quantize geometry (non-normative)
// - encode geometry
// - encode geometry (single slice, id = 0)
// - recolour
// The quantization process will determine the bounding box
quantization(inputPointCloud);
// geometry encoding
_sliceId = 0;
if (1) {
PayloadBuffer payload(PayloadType::kGeometryBrick);
......@@ -189,7 +191,7 @@ PCCTMC3Encoder3::compress(
AttributeBrickHeader abh;
abh.attr_attr_parameter_set_id = attr_aps.aps_attr_parameter_set_id;
abh.attr_sps_attr_idx = attrIdx;
abh.attr_geom_brick_id = 0;
abh.attr_geom_slice_id = _sliceId;
write(abh, &payload);
AttributeEncoder attrEncoder;
......@@ -210,6 +212,10 @@ PCCTMC3Encoder3::compress(
outputFn(payload);
}
// prevent re-use of this sliceId: the next slice (geometry + attributes)
// should be distinguishable from the current slice.
_sliceId++;
reconstructedPointCloud(reconstructedCloud);
return 0;
......@@ -232,6 +238,7 @@ PCCTMC3Encoder3::encodeGeometryBrick(PayloadBuffer* buf)
gbh.geomBoxOrigin.x() = int(minPositions.x());
gbh.geomBoxOrigin.y() = int(minPositions.y());
gbh.geomBoxOrigin.z() = int(minPositions.z());
gbh.geom_slice_id = _sliceId;
gbh.geom_box_log2_scale = 0;
gbh.geom_max_node_size_log2 = nodeSizeLog2;
gbh.geom_num_points = int(pointCloud.getPointCount());
......
......@@ -205,7 +205,7 @@ struct GeometryParameterSet {
struct GeometryBrickHeader {
int geom_geom_parameter_set_id;
int geom_brick_id; // todo(df): v2
int geom_slice_id;
// derived from geom_box_origin_{x,y,z} * (1 << geom_box_log2_scale)
PCCVector3<int> geomBoxOrigin;
......@@ -249,7 +249,7 @@ struct AttributeParameterSet {
struct AttributeBrickHeader {
int attr_sps_attr_idx;
int attr_attr_parameter_set_id;
int attr_geom_brick_id;
int attr_geom_slice_id;
};
//============================================================================
......
......@@ -343,7 +343,7 @@ write(
auto bs = makeBitWriter(std::back_inserter(*buf));
bs.writeUe(gbh.geom_geom_parameter_set_id);
//bs.writeUe(gbh.geom_brick_id);
bs.writeUe(gbh.geom_slice_id);
if (gps.geom_box_present_flag) {
int geom_box_origin_x = gbh.geomBoxOrigin.x() >> gbh.geom_box_log2_scale;
......@@ -372,7 +372,7 @@ parseGbh(
auto bs = makeBitReader(buf.begin(), buf.end());
bs.readUe(&gbh.geom_geom_parameter_set_id);
//bs.readUe(&gbh.geom_brick_id);
bs.readUe(&gbh.geom_slice_id);
if (gps.geom_box_present_flag) {
bs.readUe(&gbh.geom_box_log2_scale);
......@@ -408,7 +408,7 @@ write(const AttributeBrickHeader& abh, PayloadBuffer* buf)
bs.writeUe(abh.attr_attr_parameter_set_id);
bs.writeUe(abh.attr_sps_attr_idx);
//bs.writeUe(abh.attr_geom_brick_id);
bs.writeUe(abh.attr_geom_slice_id);
bs.byteAlign();
}
......@@ -424,7 +424,7 @@ parseAbh(const PayloadBuffer& buf, int* bytesRead)
bs.readUe(&abh.attr_attr_parameter_set_id);
bs.readUe(&abh.attr_sps_attr_idx);
//bs.readUe(&abh.attr_geom_brick_id);
bs.readUe(&abh.attr_geom_slice_id);
bs.byteAlign();
......
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