Commit 4586396e authored by David Flynn's avatar David Flynn
Browse files

hls/m47398: add common signalling of geom_box_log2_scale to gps

When the same geom_box_log2_scale is used for all slices, it is not
necessary to store them in slice headers.  This commit permits
signalling of the common value in the GPS.
parent a7db40cc
......@@ -193,6 +193,8 @@ PCCTMC3Encoder3::fixupParameterSets(EncoderParams* params)
// the encoder writes out the slice origin in the GBH
// NB: this may be disabled during encoding
params->gps.geom_box_present_flag = true;
params->gps.geom_box_log2_scale_present_flag = true;
params->gps.gps_geom_box_log2_scale = 0;
// fixup attribute parameters
for (auto it : params->attributeIdxMap) {
......
......@@ -169,6 +169,13 @@ struct GeometryParameterSet {
// geom_box_origin_xyz.
int geom_box_present_flag;
// Indicates the presence of gps_geom_box_log2_scale and
// geom_box_log2_scale.
bool geom_box_log2_scale_present_flag;
// Default scaling factor for per-slice geometry box origin
int gps_geom_box_log2_scale;
// Controls the ability to represent multiple points (with associated
// attributes) at the same spatial position.
bool geom_unique_points_flag;
......@@ -221,6 +228,15 @@ struct GeometryBrickHeader {
// todo(df): minus1?
int geom_max_node_size_log2;
int geom_num_points;
int geomBoxLog2Scale(const GeometryParameterSet& gps) const
{
if (!gps.geom_box_present_flag)
return 0;
if (!gps.geom_box_log2_scale_present_flag)
return gps.gps_geom_box_log2_scale;
return geom_box_log2_scale;
}
};
//============================================================================
......
......@@ -190,6 +190,11 @@ write(const GeometryParameterSet& gps)
bs.writeUe(gps.gps_geom_parameter_set_id);
bs.writeUe(gps.gps_seq_parameter_set_id);
bs.write(gps.geom_box_present_flag);
if (gps.geom_box_present_flag) {
bs.write(gps.geom_box_log2_scale_present_flag);
if (!gps.geom_box_log2_scale_present_flag)
bs.writeUe(gps.gps_geom_box_log2_scale);
}
bs.write(gps.geom_unique_points_flag);
bs.write(gps.neighbour_context_restriction_flag);
bs.write(gps.inferred_direct_coding_mode_enabled_flag);
......@@ -219,6 +224,11 @@ parseGps(const PayloadBuffer& buf)
bs.readUe(&gps.gps_geom_parameter_set_id);
bs.readUe(&gps.gps_seq_parameter_set_id);
bs.read(&gps.geom_box_present_flag);
if (gps.geom_box_present_flag) {
bs.read(&gps.geom_box_log2_scale_present_flag);
if (!gps.geom_box_log2_scale_present_flag)
bs.readUe(&gps.gps_geom_box_log2_scale);
}
bs.read(&gps.geom_unique_points_flag);
bs.read(&gps.neighbour_context_restriction_flag);
bs.read(&gps.inferred_direct_coding_mode_enabled_flag);
......@@ -358,10 +368,12 @@ write(
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;
int geom_box_origin_y = gbh.geomBoxOrigin.y() >> gbh.geom_box_log2_scale;
int geom_box_origin_z = gbh.geomBoxOrigin.z() >> gbh.geom_box_log2_scale;
int geomBoxLog2Scale = gbh.geomBoxLog2Scale(gps);
int geom_box_origin_x = gbh.geomBoxOrigin.x() >> geomBoxLog2Scale;
int geom_box_origin_y = gbh.geomBoxOrigin.y() >> geomBoxLog2Scale;
int geom_box_origin_z = gbh.geomBoxOrigin.z() >> geomBoxLog2Scale;
if (gps.geom_box_log2_scale_present_flag)
bs.writeUe(gbh.geom_box_log2_scale);
bs.writeUe(geom_box_origin_x);
bs.writeUe(geom_box_origin_y);
......@@ -388,6 +400,7 @@ parseGbh(
bs.readUe(&gbh.geom_slice_id);
if (gps.geom_box_present_flag) {
if (gps.geom_box_log2_scale_present_flag)
bs.readUe(&gbh.geom_box_log2_scale);
int geom_box_origin_x;
......@@ -396,9 +409,10 @@ parseGbh(
bs.readUe(&geom_box_origin_x);
bs.readUe(&geom_box_origin_y);
bs.readUe(&geom_box_origin_z);
gbh.geomBoxOrigin.x() = geom_box_origin_x << gbh.geom_box_log2_scale;
gbh.geomBoxOrigin.y() = geom_box_origin_y << gbh.geom_box_log2_scale;
gbh.geomBoxOrigin.z() = geom_box_origin_z << gbh.geom_box_log2_scale;
int geomBoxLog2Scale = gbh.geomBoxLog2Scale(gps);
gbh.geomBoxOrigin.x() = geom_box_origin_x << geomBoxLog2Scale;
gbh.geomBoxOrigin.y() = geom_box_origin_y << geomBoxLog2Scale;
gbh.geomBoxOrigin.z() = geom_box_origin_z << geomBoxLog2Scale;
}
bs.readUe(&gbh.geom_max_node_size_log2);
......
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