Skip to content

Commit

Permalink
More work on the extensions. Almost done.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianFeldmann committed Feb 22, 2024
1 parent 0bad52e commit 298ed36
Show file tree
Hide file tree
Showing 10 changed files with 1,002 additions and 9 deletions.
79 changes: 79 additions & 0 deletions YUViewLib/src/parser/HEVC/Extensions/dpb_size.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* This file is part of YUView - The YUV player with advanced analytics toolset
* <https://github.com/IENT/YUView>
* Copyright (C) 2015 Institut f�r Nachrichtentechnik, RWTH Aachen University, GERMANY
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations including
* the two.
*
* You must obey the GNU General Public License in all respects for all
* of the code used other than OpenSSL. If you modify file(s) with this
* exception, you may extend this exception to your version of the
* file(s), but you are not obligated to do so. If you do not wish to do
* so, delete this exception statement from your version. If you delete
* this exception statement from all source files in the program, then
* also delete it here.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http:https://www.gnu.org/licenses/>.
*/

#include "dpb_size.h"

#include <parser/common/Functions.h>

namespace parser::hevc
{

using namespace reader;

void dpb_size::parse(SubByteReaderLogging & reader,
const unsigned NumOutputLayerSets,
const umap_1d<unsigned> &OlsIdxToLsIdx,
const vector<unsigned> & MaxSubLayersInLayerSetMinus1,
const umap_1d<unsigned> &NumLayersInIdList,
const umap_2d<bool> NecessaryLayerFlag,
const bool vps_base_layer_internal_flag,
const umap_2d<unsigned> &LayerSetLayerIdList)
{
SubByteReaderLoggingSubLevel subLevel(reader, "dpb_size()");

for (unsigned i = 1; i < NumOutputLayerSets; i++)
{
const auto currLsIdx = OlsIdxToLsIdx.at(i);
this->sub_layer_flag_info_present_flag.push_back(
reader.readFlag(formatArray("sub_layer_flag_info_present_flag", i)));
for (unsigned j = 0; j <= MaxSubLayersInLayerSetMinus1.at(currLsIdx); j++)
{
if (j > 0 && this->sub_layer_flag_info_present_flag[i])
this->sub_layer_dpb_info_present_flag[i][j] =
reader.readFlag(formatArray("sub_layer_dpb_info_present_flag", i, j));
if (this->sub_layer_dpb_info_present_flag[i][j])
{
for (unsigned k = 0; k < NumLayersInIdList.at(currLsIdx); k++)
if (NecessaryLayerFlag.at(i).at(k) &&
(vps_base_layer_internal_flag || (LayerSetLayerIdList.at(currLsIdx).at(k) != 0)))
this->max_vps_dec_pic_buffering_minus1[i][k][j] =
reader.readUEV(formatArray("max_vps_dec_pic_buffering_minus1", i, k, j));
this->max_vps_num_reorder_pics[i][j] =
reader.readUEV(formatArray("max_vps_num_reorder_pics", i, j));
this->max_vps_latency_increase_plus1[i][j] =
reader.readUEV(formatArray("max_vps_latency_increase_plus1", i, j));
}
}
}
}

} // namespace parser::hevc
62 changes: 62 additions & 0 deletions YUViewLib/src/parser/HEVC/Extensions/dpb_size.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/* This file is part of YUView - The YUV player with advanced analytics toolset
* <https://github.com/IENT/YUView>
* Copyright (C) 2015 Institut f�r Nachrichtentechnik, RWTH Aachen University, GERMANY
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations including
* the two.
*
* You must obey the GNU General Public License in all respects for all
* of the code used other than OpenSSL. If you modify file(s) with this
* exception, you may extend this exception to your version of the
* file(s), but you are not obligated to do so. If you do not wish to do
* so, delete this exception statement from your version. If you delete
* this exception statement from all source files in the program, then
* also delete it here.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http:https://www.gnu.org/licenses/>.
*/

#pragma once

#include "parser/common/SubByteReaderLogging.h"

namespace parser::hevc
{

// F.7.3.2.1.3 DPB size syntax
class dpb_size
{
public:
dpb_size() {}

void parse(reader::SubByteReaderLogging &reader,
const unsigned NumOutputLayerSets,
const umap_1d<unsigned> & OlsIdxToLsIdx,
const vector<unsigned> & MaxSubLayersInLayerSetMinus1,
const umap_1d<unsigned> & NumLayersInIdList,
const umap_2d<bool> NecessaryLayerFlag,
const bool vps_base_layer_internal_flag,
const umap_2d<unsigned> & LayerSetLayerIdList);

vector<bool> sub_layer_flag_info_present_flag;
umap_2d<bool> sub_layer_dpb_info_present_flag;
umap_3d<unsigned> max_vps_dec_pic_buffering_minus1;
umap_2d<unsigned> max_vps_num_reorder_pics;
umap_2d<unsigned> max_vps_latency_increase_plus1;
};

} // namespace parser::hevc
66 changes: 66 additions & 0 deletions YUViewLib/src/parser/HEVC/Extensions/rep_format.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/* This file is part of YUView - The YUV player with advanced analytics toolset
* <https://github.com/IENT/YUView>
* Copyright (C) 2015 Institut f�r Nachrichtentechnik, RWTH Aachen University, GERMANY
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations including
* the two.
*
* You must obey the GNU General Public License in all respects for all
* of the code used other than OpenSSL. If you modify file(s) with this
* exception, you may extend this exception to your version of the
* file(s), but you are not obligated to do so. If you do not wish to do
* so, delete this exception statement from your version. If you delete
* this exception statement from all source files in the program, then
* also delete it here.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http:https://www.gnu.org/licenses/>.
*/

#include "rep_format.h"

namespace parser::hevc
{

using namespace reader;

void rep_format::parse(SubByteReaderLogging &reader)
{
SubByteReaderLoggingSubLevel subLevel(reader, "rep_format()");

this->pic_width_vps_in_luma_samples = reader.readBits("pic_width_vps_in_luma_samples", 16);
this->pic_height_vps_in_luma_samples = reader.readBits("pic_height_vps_in_luma_samples", 16);
this->chroma_and_bit_depth_vps_present_flag =
reader.readFlag("chroma_and_bit_depth_vps_present_flag");
if (this->chroma_and_bit_depth_vps_present_flag)
{
chroma_format_vps_idc = reader.readBits("chroma_format_vps_idc", 2);
if (this->chroma_format_vps_idc == 3)
this->separate_colour_plane_vps_flag = reader.readFlag("separate_colour_plane_vps_flag");
this->bit_depth_vps_luma_minus8 = reader.readBits("bit_depth_vps_luma_minus8", 2);
this->bit_depth_vps_chroma_minus8 = reader.readBits("bit_depth_vps_chroma_minus8", 2);
}
this->conformance_window_vps_flag = reader.readFlag("conformance_window_vps_flag");
if (this->conformance_window_vps_flag)
{
conf_win_vps_left_offset = reader.readUEV("conf_win_vps_left_offset");
conf_win_vps_right_offset = reader.readUEV("conf_win_vps_right_offset");
conf_win_vps_top_offset = reader.readUEV("conf_win_vps_top_offset");
conf_win_vps_bottom_offset = reader.readUEV("conf_win_vps_bottom_offset");
}
}

} // namespace parser::hevc
62 changes: 62 additions & 0 deletions YUViewLib/src/parser/HEVC/Extensions/rep_format.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/* This file is part of YUView - The YUV player with advanced analytics toolset
* <https://github.com/IENT/YUView>
* Copyright (C) 2015 Institut f�r Nachrichtentechnik, RWTH Aachen University, GERMANY
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations including
* the two.
*
* You must obey the GNU General Public License in all respects for all
* of the code used other than OpenSSL. If you modify file(s) with this
* exception, you may extend this exception to your version of the
* file(s), but you are not obligated to do so. If you do not wish to do
* so, delete this exception statement from your version. If you delete
* this exception statement from all source files in the program, then
* also delete it here.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http:https://www.gnu.org/licenses/>.
*/

#pragma once

#include "parser/common/SubByteReaderLogging.h"

namespace parser::hevc
{

// F.7.3.2.1.2 Representation format syntax
class rep_format
{
public:
rep_format() {}

void parse(reader::SubByteReaderLogging &reader);

unsigned pic_width_vps_in_luma_samples{};
unsigned pic_height_vps_in_luma_samples{};
bool chroma_and_bit_depth_vps_present_flag{};
unsigned chroma_format_vps_idc{};
bool separate_colour_plane_vps_flag{};
unsigned bit_depth_vps_luma_minus8{};
unsigned bit_depth_vps_chroma_minus8{};
bool conformance_window_vps_flag{};
unsigned conf_win_vps_left_offset{};
unsigned conf_win_vps_right_offset{};
unsigned conf_win_vps_top_offset{};
unsigned conf_win_vps_bottom_offset{};
};

} // namespace parser::hevc
Loading

0 comments on commit 298ed36

Please sign in to comment.