Skip to content

Commit

Permalink
Debugging parsing. Smaller fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianFeldmann committed Feb 22, 2024
1 parent 98c8e78 commit f3588e4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
15 changes: 8 additions & 7 deletions YUViewLib/src/parser/HEVC/Extensions/vps_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,17 @@ void vps_extension::parse(SubByteReaderLogging &reader,
for (unsigned i = 1; i <= this->MaxLayersMinus1; i++)
{
if (this->vps_nuh_layer_id_present_flag)
this->layer_id_in_nuh.push_back(reader.readBits(formatArray("layer_id_in_nuh", i), 6));
this->layer_id_in_nuh[i] = reader.readBits(formatArray("layer_id_in_nuh", i), 6);
else
this->layer_id_in_nuh.push_back(i);
this->layer_id_in_nuh[i] = i;
this->LayerIdxInVps[this->layer_id_in_nuh[i]] = i;

if (!this->splitting_flag)
{
this->dimension_id.push_back({});
for (unsigned j = 0; j < NumScalabilityTypes; j++)
{
const auto nrBits = this->dimension_id_len_minus1[j] + 1;
this->dimension_id[i].push_back(reader.readBits(formatArray("dimension_id", i, j), nrBits));
const auto nrBits = this->dimension_id_len_minus1[j] + 1;
this->dimension_id[i][j] = reader.readBits(formatArray("dimension_id", i, j), nrBits);
}
}
}
Expand All @@ -110,6 +109,7 @@ void vps_extension::parse(SubByteReaderLogging &reader,
if (this->NumIndependentLayers > 1)
this->num_add_layer_sets = reader.readUEV("num_add_layer_sets");

this->NumLayersInIdList[0] = 1;
for (unsigned i = 0; i < this->num_add_layer_sets; i++)
{
for (unsigned j = 1; j < this->NumIndependentLayers; j++)
Expand Down Expand Up @@ -177,9 +177,10 @@ void vps_extension::parse(SubByteReaderLogging &reader,
this->OutputLayerFlag[i][j] = this->output_layer_flag[i][j];
}
}
else
else if ((this->defaultOutputLayerIdc == 0 || this->defaultOutputLayerIdc == 1) &&
i <= vps_num_layer_sets_minus1)
{
for (unsigned j = 0; j < NumLayersInIdList[OlsIdxToLsIdx[i]] - 1; j++)
for (int j = 0; j <= int(NumLayersInIdList[OlsIdxToLsIdx[i]]) - 1; j++)
{
const auto layerIdAList = this->LayerSetLayerIdList[this->OlsIdxToLsIdx[i]];
const auto nuhLayerIdA = std::max_element(layerIdAList.begin(), layerIdAList.end());
Expand Down
4 changes: 2 additions & 2 deletions YUViewLib/src/parser/HEVC/Extensions/vps_extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ class vps_extension
vector<bool> scalability_mask_flag{};
vector<unsigned> dimension_id_len_minus1{};
bool vps_nuh_layer_id_present_flag{};
vector<unsigned> layer_id_in_nuh{};
umap_1d<unsigned> layer_id_in_nuh{};
umap_1d<unsigned> LayerIdxInVps{};
vector2d<unsigned> dimension_id{};
umap_2d<unsigned> dimension_id{};
unsigned view_id_len{};
vector<unsigned> view_id_val{};

Expand Down
12 changes: 6 additions & 6 deletions YUViewLib/src/parser/HEVC/Extensions/vps_vui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void vps_vui::parse(SubByteReaderLogging & reader,
const vector<unsigned> & MaxSubLayersInLayerSetMinus1,
const unsigned MaxLayersMinus1,
const umap_1d<unsigned> &NumDirectRefLayers,
const vector<unsigned> & layer_id_in_nuh,
const umap_1d<unsigned> &layer_id_in_nuh,
const umap_1d<unsigned> &LayerIdxInVps,
const umap_2d<unsigned> &IdDirectRefLayer,
const unsigned vps_num_hrd_parameters,
Expand Down Expand Up @@ -119,9 +119,9 @@ void vps_vui::parse(SubByteReaderLogging & reader,
this->loop_filter_not_across_tiles_flag[i] = reader.readFlag("tiles_in_use_flag");
}
for (unsigned i = vps_base_layer_internal_flag ? 1 : 2; i <= MaxLayersMinus1; i++)
for (unsigned j = 0; j < NumDirectRefLayers.at(layer_id_in_nuh[i]); j++)
for (unsigned j = 0; j < NumDirectRefLayers.at(layer_id_in_nuh.at(i)); j++)
{
const auto layerIdx = LayerIdxInVps.at(IdDirectRefLayer.at(layer_id_in_nuh[i]).at(j));
const auto layerIdx = LayerIdxInVps.at(IdDirectRefLayer.at(layer_id_in_nuh.at(i)).at(j));
if (tiles_in_use_flag[i] && tiles_in_use_flag[layerIdx])
this->tile_boundaries_aligned_flag[i][j] =
reader.readFlag(formatArray("tile_boundaries_aligned_flag", i, j));
Expand All @@ -139,9 +139,9 @@ void vps_vui::parse(SubByteReaderLogging & reader,
if (this->ilp_restricted_ref_layers_flag)
{
for (unsigned i = 1; i <= MaxLayersMinus1; i++)
for (unsigned j = 0; j < NumDirectRefLayers.at(layer_id_in_nuh[i]); j++)
for (unsigned j = 0; j < NumDirectRefLayers.at(layer_id_in_nuh.at(i)); j++)
{
if (vps_base_layer_internal_flag || IdDirectRefLayer.at(layer_id_in_nuh[i]).at(j) > 0)
if (vps_base_layer_internal_flag || IdDirectRefLayer.at(layer_id_in_nuh.at(i)).at(j) > 0)
{
this->min_spatial_segment_offset_plus1[i][j] =
reader.readUEV(formatArray("min_spatial_segment_offset_plus1", i, j));
Expand All @@ -167,7 +167,7 @@ void vps_vui::parse(SubByteReaderLogging & reader,
MaxSubLayersInLayerSetMinus1);

for (unsigned i = 1; i <= MaxLayersMinus1; i++)
if (NumDirectRefLayers.at(layer_id_in_nuh[i]) == 0)
if (NumDirectRefLayers.at(layer_id_in_nuh.at(i)) == 0)
this->base_layer_parameter_set_compatibility_flag[i] =
reader.readFlag(formatArray("base_layer_parameter_set_compatibility_flag", i));
}
Expand Down
2 changes: 1 addition & 1 deletion YUViewLib/src/parser/HEVC/Extensions/vps_vui.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class vps_vui
const vector<unsigned> & MaxSubLayersInLayerSetMinus1,
const unsigned MaxLayersMinus1,
const umap_1d<unsigned> & NumDirectRefLayers,
const vector<unsigned> & layer_id_in_nuh,
const umap_1d<unsigned> & layer_id_in_nuh,
const umap_1d<unsigned> & LayerIdxInVps,
const umap_2d<unsigned> & IdDirectRefLayer,
const unsigned vps_num_hrd_parameters,
Expand Down

0 comments on commit f3588e4

Please sign in to comment.