Commit 08880f88 authored by David Flynn's avatar David Flynn
Browse files

hls: refactor LoD presence test into aps.lodParametersPresent()

Rather than testing for the attribute encoding in various places in
order to determine the use of LoDs, use the derivation
lodParametersPresent instead.
parent 7cce3e15
......@@ -209,13 +209,8 @@ AttributeDecoder::decode(
decoder.start(sps, payload.data() + abhSize, payload.size() - abhSize);
// generate LoDs if necessary
switch (attr_aps.attr_encoding) {
case AttributeEncoding::kLiftingTransform:
case AttributeEncoding::kPredictingTransform:
if (_lods.empty())
_lods.generate(attr_aps, minGeomNodeSizeLog2, pointCloud);
default: break;
}
if (attr_aps.lodParametersPresent() && _lods.empty())
_lods.generate(attr_aps, minGeomNodeSizeLog2, pointCloud);
if (attr_desc.attr_num_dimensions == 1) {
switch (attr_aps.attr_encoding) {
......
......@@ -357,13 +357,8 @@ AttributeEncoder::encode(
encoder.start(sps, int(pointCloud.getPointCount()));
// generate LoDs if necessary
switch (attr_aps.attr_encoding) {
case AttributeEncoding::kLiftingTransform:
case AttributeEncoding::kPredictingTransform:
if (_lods.empty())
if (attr_aps.lodParametersPresent() && _lods.empty())
_lods.generate(attr_aps, 0, pointCloud);
default: break;
}
if (desc.attr_num_dimensions == 1) {
switch (attr_aps.attr_encoding) {
......
......@@ -839,12 +839,8 @@ ParseParameters(int argc, char* argv[], Parameters& params)
if (attr_sps.cicp_matrix_coefficients_idx == ColourMatrix::kYCgCo)
attr_sps.attr_bitdepth_secondary++;
bool isLifting =
attr_aps.attr_encoding == AttributeEncoding::kPredictingTransform
|| attr_aps.attr_encoding == AttributeEncoding::kLiftingTransform;
// derive the dist2 values based on an initial value
if (isLifting) {
if (attr_aps.lodParametersPresent()) {
if (attr_aps.dist2.size() > attr_aps.num_detail_levels) {
attr_aps.dist2.resize(attr_aps.num_detail_levels);
} else if (
......@@ -917,17 +913,13 @@ ParseParameters(int argc, char* argv[], Parameters& params)
}
}
bool isLifting =
attr_aps.attr_encoding == AttributeEncoding::kPredictingTransform
|| attr_aps.attr_encoding == AttributeEncoding::kLiftingTransform;
if (attr_sps.attr_bitdepth > 16)
err.error() << it.first << ".bitdepth must be less than 17\n";
if (attr_sps.attr_bitdepth_secondary > 16)
err.error() << it.first << ".bitdepth_secondary must be less than 17\n";
if (isLifting) {
if (attr_aps.lodParametersPresent()) {
int lod = attr_aps.num_detail_levels;
if (lod > 255 || lod < 0) {
err.error() << it.first
......
......@@ -349,6 +349,11 @@ struct AttributeParameterSet {
int aps_seq_parameter_set_id;
AttributeEncoding attr_encoding;
bool lodParametersPresent() const {
return attr_encoding == AttributeEncoding::kLiftingTransform
|| attr_encoding == AttributeEncoding::kPredictingTransform;
}
//--- lifting/predicting transform parameters
bool lod_decimation_enabled_flag;
......
......@@ -317,9 +317,7 @@ write(const AttributeParameterSet& aps)
bs.writeSe(aps.aps_chroma_qp_offset);
bs.write(aps.aps_slice_qp_deltas_present_flag);
bool isLifting = aps.attr_encoding == AttributeEncoding::kLiftingTransform
|| aps.attr_encoding == AttributeEncoding::kPredictingTransform;
if (isLifting) {
if (aps.lodParametersPresent()) {
bs.writeUe(aps.num_pred_nearest_neighbours);
bs.writeUe(aps.search_range);
bs.writeUe(aps.num_detail_levels);
......@@ -376,9 +374,7 @@ parseAps(const PayloadBuffer& buf)
bs.readSe(&aps.aps_chroma_qp_offset);
bs.read(&aps.aps_slice_qp_deltas_present_flag);
bool isLifting = aps.attr_encoding == AttributeEncoding::kLiftingTransform
|| aps.attr_encoding == AttributeEncoding::kPredictingTransform;
if (isLifting) {
if (aps.lodParametersPresent()) {
bs.readUe(&aps.num_pred_nearest_neighbours);
bs.readUe(&aps.search_range);
bs.readUe(&aps.num_detail_levels);
......
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