Skip to content

Commit

Permalink
Add parsing of SPS extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianFeldmann committed Feb 20, 2024
1 parent 0b5796a commit 178c408
Show file tree
Hide file tree
Showing 10 changed files with 542 additions and 9 deletions.
78 changes: 78 additions & 0 deletions YUViewLib/src/parser/HEVC/Extensions/sps_3d_extension.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/* 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://www.gnu.org/licenses/>.
*/

#include "sps_3d_extension.h"

#include <parser/common/Functions.h>

namespace parser::hevc
{

using namespace reader;

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

for (int d = 0; d <= 1; d++)
{
this->iv_di_mc_enabled_flag[d] = reader.readFlag(formatArray("iv_di_mc_enabled_flag", d));
this->iv_mv_scal_enabled_flag[d] = reader.readFlag(formatArray("iv_mv_scal_enabled_flag", d));
if (d == 0)
{
this->log2_ivmc_sub_pb_size_minus3[d] =
reader.readUEV(formatArray("log2_ivmc_sub_pb_size_minus3", d));
this->iv_res_pred_enabled_flag[d] =
reader.readFlag(formatArray("iv_res_pred_enabled_flag", d));
this->depth_ref_enabled_flag[d] = reader.readFlag(formatArray("depth_ref_enabled_flag", d));
this->vsp_mc_enabled_flag[d] = reader.readFlag(formatArray("vsp_mc_enabled_flag", d));
this->dbbp_enabled_flag[d] = reader.readFlag(formatArray("dbbp_enabled_flag", d));
}
else
{
this->tex_mc_enabled_flag[d] = reader.readFlag(formatArray("tex_mc_enabled_flag", d));
this->log2_texmc_sub_pb_size_minus3[d] =
reader.readUEV(formatArray("log2_texmc_sub_pb_size_minus3", d));
this->intra_contour_enabled_flag[d] =
reader.readFlag(formatArray("intra_contour_enabled_flag", d));
this->intra_dc_only_wedge_enabled_flag[d] =
reader.readFlag(formatArray("intra_dc_only_wedge_enabled_flag", d));
this->cqt_cu_part_pred_enabled_flag[d] =
reader.readFlag(formatArray("cqt_cu_part_pred_enabled_flag", d));
this->inter_dc_only_enabled_flag[d] =
reader.readFlag(formatArray("inter_dc_only_enabled_flag", d));
this->skip_intra_enabled_flag[d] = reader.readFlag(formatArray("skip_intra_enabled_flag", d));
}
}
}

} // namespace parser::hevc
65 changes: 65 additions & 0 deletions YUViewLib/src/parser/HEVC/Extensions/sps_3d_extension.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/* 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://www.gnu.org/licenses/>.
*/

#pragma once

#include "parser/common/SubByteReaderLogging.h"

namespace parser::hevc
{

// I.7.3.2.2.5 Sequence parameter set 3D extension syntax
class sps_3d_extension
{
public:
sps_3d_extension() {}

void parse(reader::SubByteReaderLogging &reader);

bool iv_di_mc_enabled_flag[2]{};
bool iv_mv_scal_enabled_flag[2]{};
unsigned log2_ivmc_sub_pb_size_minus3[2]{};
bool iv_res_pred_enabled_flag[2]{};
bool depth_ref_enabled_flag[2]{};
bool vsp_mc_enabled_flag[2]{};
bool dbbp_enabled_flag[2]{};

bool tex_mc_enabled_flag[2]{};
unsigned log2_texmc_sub_pb_size_minus3[2]{};
bool intra_contour_enabled_flag[2]{};
bool intra_dc_only_wedge_enabled_flag[2]{};
bool cqt_cu_part_pred_enabled_flag[2]{};
bool inter_dc_only_enabled_flag[2]{};
bool skip_intra_enabled_flag[2]{};
};

} // namespace parser::hevc
47 changes: 47 additions & 0 deletions YUViewLib/src/parser/HEVC/Extensions/sps_multilayer_extension.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* 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://www.gnu.org/licenses/>.
*/

#include "sps_multilayer_extension.h"

namespace parser::hevc
{

using namespace reader;

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

this->inter_view_mv_vert_constraint_flag = reader.readFlag("inter_view_mv_vert_constraint_flag");
}

} // namespace parser::hevc
51 changes: 51 additions & 0 deletions YUViewLib/src/parser/HEVC/Extensions/sps_multilayer_extension.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* 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://www.gnu.org/licenses/>.
*/

#pragma once

#include "parser/common/SubByteReaderLogging.h"

namespace parser::hevc
{

// F.7.3.2.2.4 Sequence parameter set multilayer extension syntax
class sps_multilayer_extension
{
public:
sps_multilayer_extension() {}

void parse(reader::SubByteReaderLogging &reader);

bool inter_view_mv_vert_constraint_flag{};
};

} // namespace parser::hevc
60 changes: 60 additions & 0 deletions YUViewLib/src/parser/HEVC/Extensions/sps_range_extension.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/* 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://www.gnu.org/licenses/>.
*/

#include "sps_range_extension.h"

namespace parser::hevc
{

using namespace reader;

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

this->transform_skip_rotation_enabled_flag =
reader.readFlag("transform_skip_rotation_enabled_flag");
this->transform_skip_context_enabled_flag =
reader.readFlag("transform_skip_context_enabled_flag");
this->implicit_rdpcm_enabled_flag = reader.readFlag("implicit_rdpcm_enabled_flag");
this->explicit_rdpcm_enabled_flag = reader.readFlag("explicit_rdpcm_enabled_flag");
this->extended_precision_processing_flag = reader.readFlag("extended_precision_processing_flag");
this->intra_smoothing_disabled_flag = reader.readFlag("intra_smoothing_disabled_flag");
this->high_precision_offsets_enabled_flag =
reader.readFlag("high_precision_offsets_enabled_flag");
this->persistent_rice_adaptation_enabled_flag =
reader.readFlag("persistent_rice_adaptation_enabled_flag");
this->cabac_bypass_alignment_enabled_flag =
reader.readFlag("cabac_bypass_alignment_enabled_flag");
}

} // namespace parser::hevc
59 changes: 59 additions & 0 deletions YUViewLib/src/parser/HEVC/Extensions/sps_range_extension.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* 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://www.gnu.org/licenses/>.
*/

#pragma once

#include "parser/common/SubByteReaderLogging.h"

namespace parser::hevc
{

// 7.3.2.2.2 Sequence parameter set range extension syntax
class sps_range_extension
{
public:
sps_range_extension() {}

void parse(reader::SubByteReaderLogging &reader);

bool transform_skip_rotation_enabled_flag{};
bool transform_skip_context_enabled_flag{};
bool implicit_rdpcm_enabled_flag{};
bool explicit_rdpcm_enabled_flag{};
bool extended_precision_processing_flag{};
bool intra_smoothing_disabled_flag{};
bool high_precision_offsets_enabled_flag{};
bool persistent_rice_adaptation_enabled_flag{};
bool cabac_bypass_alignment_enabled_flag{};
};

} // namespace parser::hevc
Loading

0 comments on commit 178c408

Please sign in to comment.