Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parsing of three_dimensional_reference_displays_info #568

Merged
merged 8 commits into from
Mar 20, 2024
22 changes: 11 additions & 11 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
INSTALL_LIBS: qt6-base-dev
QMAKE_COMMAND: qmake6
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Install Linux packages
run: |
Expand All @@ -40,7 +40,7 @@ jobs:
include:
- os: macos-12
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Install packages
run: |
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
ARTIFACT_NAME: YUView-Mac12-Monterey.zip
CPU_COUNT_COMMAND: sysctl -n hw.logicalcpu
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Install Qt base
run: |
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
cp YUView.AppImage $GITHUB_WORKSPACE/artifacts/
if: matrix.os == 'ubuntu-20.04'
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{matrix.ARTIFACT_NAME}}
path: artifacts
Expand All @@ -155,7 +155,7 @@ jobs:
ARTIFACT_NAME: YUView-Win2019-noautoupdate.zip
QT_FILE: qtBase_6.5.2_win2019.zip
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- run: git fetch --prune --unshallow
- name: Install Qt base
Expand Down Expand Up @@ -219,20 +219,20 @@ jobs:
run: |
cd ${{ github.workspace }}/deployment/wix
cp 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\v142\MergeModules\Microsoft_VC142_CRT_x64.msm' .
& "C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe" dir ../../deploy -gg -dr APPLICATIONFOLDER -srd -sreg -cg YUViewComponents -out harvestedDirectory.wxs
& "C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe" -dConfiguration=Release -dOutDir=bin/Release/ '-dTargetExt=.msi' '-dTargetFileName=YUViewSetup.msi' -dTargetName=YUViewSetup -out obj/Release/ -arch x64 -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUIExtension.dll" YUView.wxs
& "C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe" -dConfiguration=Release -dOutDir=bin/Release/ '-dTargetExt=.msi' '-dTargetFileName=YUViewSetup.msi' -dTargetName=YUViewSetup -out obj/Release/ -arch x64 harvestedDirectory.wxs
& "C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe" -b ../../deploy -out bin/Release/YUViewSetup.msi -pdbout bin/Release/YUViewSetup.wixpdb -cultures:null -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUIExtension.dll" -contentsfile obj/Release/YUViewSetup.wixproj.BindContentsFileListnull.txt -outputsfile obj/Release/YUViewSetup.wixproj.BindOutputsFileListnull.txt -builtoutputsfile obj/Release/YUViewSetup.wixproj.BindBuiltOutputsFileListnull.txt obj/Release/YUView.wixobj obj/Release/harvestedDirectory.wixobj
& "C:\Program Files (x86)\WiX Toolset v3.14\bin\heat.exe" dir ../../deploy -gg -dr APPLICATIONFOLDER -srd -sreg -cg YUViewComponents -out harvestedDirectory.wxs
& "C:\Program Files (x86)\WiX Toolset v3.14\bin\candle.exe" -dConfiguration=Release -dOutDir=bin/Release/ '-dTargetExt=.msi' '-dTargetFileName=YUViewSetup.msi' -dTargetName=YUViewSetup -out obj/Release/ -arch x64 -ext "C:\Program Files (x86)\WiX Toolset v3.14\bin\WixUIExtension.dll" YUView.wxs
& "C:\Program Files (x86)\WiX Toolset v3.14\bin\candle.exe" -dConfiguration=Release -dOutDir=bin/Release/ '-dTargetExt=.msi' '-dTargetFileName=YUViewSetup.msi' -dTargetName=YUViewSetup -out obj/Release/ -arch x64 harvestedDirectory.wxs
& "C:\Program Files (x86)\WiX Toolset v3.14\bin\light.exe" -b ../../deploy -out bin/Release/YUViewSetup.msi -pdbout bin/Release/YUViewSetup.wixpdb -cultures:null -ext "C:\Program Files (x86)\WiX Toolset v3.14\bin\WixUIExtension.dll" -contentsfile obj/Release/YUViewSetup.wixproj.BindContentsFileListnull.txt -outputsfile obj/Release/YUViewSetup.wixproj.BindOutputsFileListnull.txt -builtoutputsfile obj/Release/YUViewSetup.wixproj.BindBuiltOutputsFileListnull.txt obj/Release/YUView.wixobj obj/Release/harvestedDirectory.wixobj
cd ${{ github.workspace }}
cp deployment/wix/bin/Release/YUViewSetup.msi ./
if: matrix.auto_update == true
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{matrix.ARTIFACT_NAME}}
path: artifacts
- name: Upload Windows installer Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: YUViewSetup.msi
path: ./YUViewSetup.msi
Expand Down
5 changes: 4 additions & 1 deletion YUViewLib/src/parser/HEVC/SEI/sei_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
#include "content_light_level_info.h"
#include "mastering_display_colour_volume.h"
#include "parser/common/SubByteReaderLoggingOptions.h"
#include <parser/common/Functions.h>
#include "pic_timing.h"
#include "three_dimensional_reference_displays_info.h"
#include "user_data_unregistered.h"
#include <parser/common/Functions.h>

namespace parser::hevc
{
Expand Down Expand Up @@ -234,6 +235,8 @@ sei_message::parsePayloadData(bool reparse,
this->payload = std::make_shared<content_light_level_info>();
else if (this->payloadType == 147)
this->payload = std::make_shared<alternative_transfer_characteristics>();
else if (this->payloadType == 176)
this->payload = std::make_shared<three_dimensional_reference_displays_info>();
else
this->payload = std::make_shared<unknown_sei>();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/* 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 "three_dimensional_reference_displays_info.h"

#include <parser/common/Functions.h>

namespace parser::hevc
{

using namespace reader;

SEIParsingResult three_dimensional_reference_displays_info::parse(
reader::SubByteReaderLogging &reader,
bool reparse,
VPSMap &vpsMap,
SPSMap &spsMap,
std::shared_ptr<seq_parameter_set_rbsp> associatedSPS)
{
(void)reparse;
(void)vpsMap;
(void)spsMap;
(void)associatedSPS;

SubByteReaderLoggingSubLevel subLevel(reader, "three_dimensional_reference_displays_info");

this->prec_ref_display_width = reader.readUEV("prec_ref_display_width");
this->ref_viewing_distance_flag = reader.readFlag("ref_viewing_distance_flag");
if (this->ref_viewing_distance_flag)
this->prec_ref_viewing_dist = reader.readUEV("prec_ref_viewing_dist");
this->num_ref_displays_minus1 = reader.readUEV("num_ref_displays_minus1");
for (unsigned i = 0; i <= num_ref_displays_minus1; ++i)
{
this->left_view_id.push_back(reader.readUEV(formatArray("left_view_id", i)));
this->right_view_id.push_back(reader.readUEV(formatArray("right_view_id", i)));
this->exponent_ref_display_width.push_back(
reader.readBits(formatArray("exponent_ref_display_width", i), 6));

const auto refDispWidthBits =
this->exponent_ref_display_width.at(i) == 0
? std::max(uint64_t(0), this->prec_ref_display_width - 30)
: std::max(uint64_t(0),
this->exponent_ref_display_width.at(i) + this->prec_ref_display_width - 31);
this->mantissa_ref_display_width.push_back(
reader.readBits(formatArray("mantissa_ref_display_width", i), refDispWidthBits));

if (this->ref_viewing_distance_flag)
{
this->exponent_ref_viewing_distance.push_back(
reader.readBits(formatArray("exponent_ref_viewing_distance", i), 6));

const auto refViewDistBits = exponent_ref_viewing_distance.at(i) == 0
? std::max(uint64_t(0), this->prec_ref_viewing_dist - 30)
: std::max(uint64_t(0),
this->exponent_ref_viewing_distance.at(i) +
this->prec_ref_viewing_dist - 31);
this->mantissa_ref_viewing_distance.push_back(
reader.readBits(formatArray("mantissa_ref_viewing_distance", i), refViewDistBits));
}
this->additional_shift_present_flag.push_back(
reader.readFlag(formatArray("additional_shift_present_flag", i)));
if (this->additional_shift_present_flag.at(i))
this->num_sample_shift_plus512[i] =
reader.readBits(formatArray("num_sample_shift_plus512", i), 10);
}

this->three_dimensional_reference_displays_extension_flag =
reader.readFlag("three_dimensional_reference_displays_extension_flag");

return SEIParsingResult::OK;
}

} // namespace parser::hevc
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* 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"
#include "sei_message.h"

namespace parser::hevc
{

class three_dimensional_reference_displays_info : public sei_payload
{
public:
three_dimensional_reference_displays_info() = default;

SEIParsingResult parse(reader::SubByteReaderLogging & reader,
bool reparse,
VPSMap & vpsMap,
SPSMap & spsMap,
std::shared_ptr<seq_parameter_set_rbsp> associatedSPS) override;

uint64_t prec_ref_display_width{};
bool ref_viewing_distance_flag{};
uint64_t prec_ref_viewing_dist{};
uint64_t num_ref_displays_minus1{};

vector<uint64_t> left_view_id;
vector<uint64_t> right_view_id;
vector<uint64_t> exponent_ref_display_width;
vector<uint64_t> mantissa_ref_display_width;
vector<uint64_t> exponent_ref_viewing_distance;
vector<uint64_t> mantissa_ref_viewing_distance;
vector<bool> additional_shift_present_flag;
umap_1d<uint64_t> num_sample_shift_plus512;

bool three_dimensional_reference_displays_extension_flag{};
};

} // namespace parser::hevc