Commit 8dbb5a7f authored by David Flynn's avatar David Flynn
Browse files

encoder: allow external configuration of geometry bounding box

The configuration parameters seq_bounding_box_xyz0 and
seq_bounding_box_whd allow overriding the automatic derivation of
frame (sequence) bounding box, forcing the depth of the geometry
tree.

NB: seq_bounding_box_xyz0 and seq_bounding_box_whd are specified
    using unscaled co-ordinates.

NB: this patch does not signal these parameters in the SPS.
parent 2ca8bfa8
......@@ -98,6 +98,20 @@ affected by geometry quantization. When this parameter is enabled,
allowing `dist2` to be specified as an intrinsic property of the source
sequence.
### `--seq_bounding_box_xyz0=x,y,z`
Explicitly sets the origin of the sequence-level bounding box in
unscaled integer coordinates.
NB: This option has no effect if `seq_bounding_box_whd`=0,0,0.
### `--seq_bounding_box_whd=w,h,d`
Explicitly sets the size of the sequence-level bounding box in
unscaled integer coordinates.
When $w,h,d$ not equal to 0,0,0, the sequence-level bounding box
origin is set according to `seq_bounding_box_xyz0`. Otherwise,
the sequence-level bounding box is determined by the encoder.
### `--mergeDuplicatedPoints=0|1`
Controls the ability to code duplicate points. When duplicate point
merging is enabled, bitstream syntax related to duplicate points is
......
......@@ -276,6 +276,15 @@ ParseParameters(int argc, char* argv[], Parameters& params)
(po::Section("Encoder"))
("seq_bounding_box_xyz0",
params.encoder.sps.seq_bounding_box_xyz0, {0},
"seq_bounding_box_xyz0. NB: seq_bounding_box_whd must be set for this "
"parameter to have an effect")
("seq_bounding_box_whd",
params.encoder.sps.seq_bounding_box_whd, {0},
"seq_bounding_box_whd")
("positionQuantizationScale",
params.encoder.sps.seq_source_geom_scale_factor, 1.f,
"Scale factor to be applied to point positions during quantization process")
......
......@@ -317,13 +317,28 @@ PCCTMC3Encoder3::computeMinPositions(const PCCPointSet3& inputPointCloud)
void
PCCTMC3Encoder3::quantization(const PCCPointSet3& inputPointCloud)
{
// todo(df): allow overriding of minposition from CLI
// todo(df): remove trisoup hack
minPositions = PCCVector3D{0.0};
if (_gps->trisoup_node_size_log2 == 0)
// if sps sequence width/height/depth is set, don't auto compute bbox
bool computeBBox = _sps->seq_bounding_box_whd == PCCVector3<int>{0};
if (computeBBox)
computeMinPositions(inputPointCloud);
else {
for (int k = 0; k < 3; k++)
minPositions[k] = _sps->seq_bounding_box_xyz0[k];
}
// Clamp all points to [clampBox.min, clampBox.max] after translation
// and quantisation.
PCCBox3<int32_t> clampBox{{0, 0, 0}, {INT32_MAX, INT32_MAX, INT32_MAX}};
if (!computeBBox) {
// todo(df): this is icky (not to mention rounding issues)
// NB: the sps seq_bounding_box_* uses unscaled co-ordinates => convert
// NB: minus 1 to convert to max x/y/z position
clampBox = PCCBox3<int32_t>{{0, 0, 0}, _sps->seq_bounding_box_whd};
for (int k = 0; k < 3; k++)
clampBox.max[k] =
int(ceil(clampBox.max[k] * _sps->seq_source_geom_scale_factor)) - 1;
}
if (_gps->geom_unique_points_flag) {
quantizePositionsUniq(
_sps->seq_source_geom_scale_factor, -minPositions, clampBox,
......@@ -334,6 +349,13 @@ PCCTMC3Encoder3::quantization(const PCCPointSet3& inputPointCloud)
inputPointCloud, &pointCloud);
}
if (!computeBBox) {
boundingBox.min = uint32_t(0);
for (int k = 0; k < 3; k++)
boundingBox.max[k] = clampBox.max[k];
return;
}
const size_t pointCount = pointCloud.getPointCount();
boundingBox.min = uint32_t(0);
boundingBox.max = uint32_t(0);
......
......@@ -148,8 +148,8 @@ struct SequenceParameterSet {
int level;
// todo(df): encode the following
//PCCVector3<int> seq_bounding_box_xyz0;
//PCCVector3<int> seq_bounding_box_whd;
PCCVector3<int> seq_bounding_box_xyz0;
PCCVector3<int> seq_bounding_box_whd;
//int seq_bounding_box_scale_log2;
// A value describing the scaling of the source positions prior to encoding.
......
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