Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 66 additions & 3 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,25 @@ jobs:
- name: Install Linux packages
run: |
sudo apt-get update
sudo apt-get install qt6-base-dev
# qt6-base-private-dev: QRhi / gui-private headers for HDR
sudo apt-get install -y qt6-base-dev qt6-base-private-dev libpng-dev
# qsb / shadertools package names differ by Ubuntu release:
# 22.04: qt6-shader-baker + libqt6shadertools6-dev
# 24.04+: also provides qt6-shadertools-dev
sudo apt-get install -y qt6-shader-baker || true
sudo apt-get install -y libqt6shadertools6-dev || true
sudo apt-get install -y qt6-shadertools-dev || true
echo "/usr/lib/qt6/bin" >> "$GITHUB_PATH"
echo "/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/qt6/bin" >> "$GITHUB_PATH"
if ! command -v qsb >/dev/null 2>&1 && ! command -v qsb6 >/dev/null 2>&1 && \
[ ! -x /usr/lib/qt6/bin/qsb ]; then
echo "ERROR: qsb not found after installing shadertools packages"
exit 1
fi
- name: Compile HDR shaders
run: |
chmod +x "$GITHUB_WORKSPACE/YUViewLib/resources/shaders/compile_shaders.sh"
"$GITHUB_WORKSPACE/YUViewLib/resources/shaders/compile_shaders.sh"
- name: Build
run: |
cd $GITHUB_WORKSPACE
Expand All @@ -44,7 +62,13 @@ jobs:
submodules: true
- run: git fetch --prune --unshallow
- name: Install packages
run: brew install qt
run: |
brew install qt
echo "$(brew --prefix qt)/bin" >> "$GITHUB_PATH"
- name: Compile HDR shaders
run: |
chmod +x "$GITHUB_WORKSPACE/YUViewLib/resources/shaders/compile_shaders.sh"
"$GITHUB_WORKSPACE/YUViewLib/resources/shaders/compile_shaders.sh"
- name: Build
run: |
cd $GITHUB_WORKSPACE
Expand Down Expand Up @@ -90,7 +114,29 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libgl1-mesa-dev libxkbcommon-x11-0 libpcre2-16-0 '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev libatspi2.0-dev libfuse2
sudo apt-get install -y libgl1-mesa-dev libxkbcommon-x11-0 libpcre2-16-0 '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev libatspi2.0-dev libfuse2
# qsb package names differ by Ubuntu release (see build-unix-native)
sudo apt-get install -y qt6-shader-baker || true
sudo apt-get install -y libqt6shadertools6-dev || true
sudo apt-get install -y qt6-shadertools-dev || true
echo "/usr/lib/qt6/bin" >> "$GITHUB_PATH"
echo "/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/qt6/bin" >> "$GITHUB_PATH"
if ! command -v qsb >/dev/null 2>&1 && ! command -v qsb6 >/dev/null 2>&1 && \
[ ! -x /usr/lib/qt6/bin/qsb ]; then
echo "ERROR: qsb not found after installing shadertools packages"
exit 1
fi
- name: Ensure qsb on macOS
if: runner.os == 'macOS'
run: |
if ! command -v qsb >/dev/null 2>&1; then
brew install qt
echo "$(brew --prefix qt)/bin" >> "$GITHUB_PATH"
fi
- name: Compile HDR shaders
run: |
chmod +x "$GITHUB_WORKSPACE/YUViewLib/resources/shaders/compile_shaders.sh"
"$GITHUB_WORKSPACE/YUViewLib/resources/shaders/compile_shaders.sh"
- name: Download libde265 (Linux)
if: runner.os == 'Linux'
run: curl -L https://github.com/ChristianFeldmann/libde265/releases/download/v1.1/libde265.so -o libde265-internals.so
Expand Down Expand Up @@ -180,6 +226,23 @@ jobs:
if: matrix.autoUpdate == true
run: sed -i -- "s/#define UPDATE_FEATURE_ENABLE 0/#define UPDATE_FEATURE_ENABLE 1/g" YUViewLib/src/common/Typedef.h
shell: bash
- name: Ensure qsb and compile HDR shaders
shell: pwsh
run: |
$qsb = Get-Command qsb.exe -ErrorAction SilentlyContinue
if (-not $qsb) {
Write-Host "qsb.exe not on PATH; installing Qt Shader Tools via aqtinstall"
python -m pip install --upgrade pip aqtinstall
$qtOut = Join-Path $env:RUNNER_TEMP "qt-shadertools"
# Host tool only used to bake .qsb; output is portable across Qt 6.x
aqt install-qt windows desktop 6.9.0 win64_msvc2022_64 -m qtshadertools --outputdir $qtOut
$qsbPath = Get-ChildItem -Path $qtOut -Recurse -Filter qsb.exe | Select-Object -First 1 -ExpandProperty FullName
if (-not $qsbPath) { throw "Failed to locate qsb.exe after aqtinstall" }
$env:QSB = $qsbPath
Write-Host "Using QSB=$env:QSB"
}
& "$env:GITHUB_WORKSPACE\YUViewLib\resources\shaders\compile_shaders.bat"
if ($LASTEXITCODE -ne 0) { throw "compile_shaders.bat failed with exit code $LASTEXITCODE" }
- name: Build
run: |
echo "Creating Build dir and entering it"
Expand Down
105 changes: 91 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,95 @@
Makefile
# Qt Creator user files
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.qmlproject.user
*.qmlproject.user.*
.qmake.stash
YUView.pro.user
# Exclude files that will be created by visual studio
.qmake.cache

# Visual Studio files
.vs/
*.sln
*.vcxproj
*.vcxproj.*
*.filters
*.user
*.VC.opendb
*.VC.db
*.sln
*.vcxproj*
/.vs
/build
/buildRelease
/GeneratedFiles
/x64
/deploy
/decoders
.vscode
issues

# Build directories
build/
build_*/
buildRelease/
debug/
release/
bin/
obj/
x64/
GeneratedFiles/
deploy/
decoders/

# Compiled object files
*.o
*.obj

# Compiled executable and library files
*.exe
*.dll
*.so
*.so.*
*.dylib
*.a
*.lib

# Qt generated files
moc_*.cpp
qrc_*.cpp
ui_*.h
Makefile*
*.qrc.depends

# Core dump
core

# IDE and editor files
.vscode/
.idea/
*.swp
*.swo
*~

# OS generated files
Thumbs.db
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Desktop.ini

# Temporary and log files
*.log
*.tmp
*.temp

# Issue tracking (local)
issues/

# Local development artifacts (not for upstream PR)
temp_docs/
_upstream_ref/
HDR_DEBUG_VERIFICATION.md
docs/HDR_*.md
docs/hdr_*.md
docs/Buffer_Pipeline_Investigation_Report.md
docs/PR_HDR_Debug_Plan_Verification.md

# Compiled shader binaries
# These should be generated during build, not committed
*.qsb
_diff_list.txt
_substantive_diff.txt
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "submodules/googletest"]
path = submodules/googletest
url = git@github.com:google/googletest.git
url = https://github.com/google/googletest.git
8 changes: 8 additions & 0 deletions YUViewApp/YUViewApp.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Qt module configuration with version compatibility
QT += core gui widgets opengl xml concurrent network

# openglwidgets module only exists in Qt6, not in Qt5
greaterThan(QT_MAJOR_VERSION, 5) {
QT += openglwidgets
}

TARGET = YUView
TEMPLATE = app
CONFIG += c++20
Expand Down Expand Up @@ -78,6 +84,8 @@ win32 {
RC_FILE += images/WindowsAppIcon.rc
SVNN = $$system("git describe --tags")
DEFINES += NOMINMAX
# Windows-specific libraries needed for HDR functionality
LIBS += -ldxgi -luser32 -lole32
}

LASTHASH = $$system("git rev-parse HEAD")
Expand Down
77 changes: 71 additions & 6 deletions YUViewApp/src/yuviewapp.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* This file is part of YUView - The YUV player with advanced analytics toolset
/* 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
*
Expand Down Expand Up @@ -31,22 +31,87 @@
*/

#include <QCoreApplication>
#include <QSurfaceFormat>
#include <QColorSpace>
#include <QDebug>
#include <QSettings>
#include <QMessageBox>

#include <common/Typedef.h>
#include <ui/YUViewApplication.h>


int main(int argc, char *argv[])
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); // DPI support
#endif
// ========================================
// BASIC OPENGL SETUP - MUST BE FIRST
// ========================================

// Set basic OpenGL attributes before any application creation
// Qt6 enables high-DPI scaling by default.
QCoreApplication::setAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents,false);
QCoreApplication::setAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents,false);

// ========================================
// STARTUP-BASED HDR DECISION LOGIC (PRD Requirement 5.1-5.5)
// Simplified branch structure: HDR vs SDR path determined once at startup
// ========================================

qRegisterMetaType<recacheIndicator>("recacheIndicator");

YUViewApplication app(argc, argv);
// Set application identity before using QSettings
QCoreApplication::setApplicationName("YUView");
QCoreApplication::setOrganizationName("Institut für Nachrichtentechnik, RWTH Aachen University");
QCoreApplication::setOrganizationDomain("ient.rwth-aachen.de");

// Read HDR preference from configuration (PRD Requirement 5.2)
QSettings settings;
const bool userWantsHDR = settings.value("Enable10BitDisplay", false).toBool();

bool hdrModeEnabled = false;
bool hardwareFallbackOccurred = false;
QString fallbackMessage;


// Simplified pure branch structure for HDR/SDR decision
// When userWantsHDR is true: configure 10-bit OpenGL surface format for HDR rendering
// When userWantsHDR is false: use Qt default format, rely on standard QPainter path
// This eliminates the redundant 8-bit -> 10-bit reconfiguration pattern
if (userWantsHDR) {
// HDR PATH: Configure 10-bit OpenGL surface format with Qt 6.8+ native HDR color space
// This format is required for HDR_VideoWindow to render 10-bit content correctly
QSurfaceFormat hdrFormat;
hdrFormat.setProfile(QSurfaceFormat::CoreProfile);
hdrFormat.setVersion(3, 3);
hdrFormat.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
hdrFormat.setSwapInterval(1);
// HDR RGBA16F requires 16-bit per channel for linear light rendering
hdrFormat.setRedBufferSize(16);
hdrFormat.setGreenBufferSize(16);
hdrFormat.setBlueBufferSize(16);
hdrFormat.setAlphaBufferSize(16);

// Qt 6.8+ Native HDR: Use extended sRGB linear color space for RGBA16F
// The QRhi swap chain will be configured with HDRExtendedSrgbLinear format
// which uses scRGB linear light (values > 1.0 represent HDR content)
// PQ/HLG/Linear OETF will be applied in fragment shader (homework assignment)
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
hdrFormat.setColorSpace(QColorSpace(QColorSpace::SRgbLinear));
#else
#endif

QSurfaceFormat::setDefaultFormat(hdrFormat);

hdrModeEnabled = true;
} else {
// SDR PATH: Use Qt default format, no explicit QSurfaceFormat configuration needed
// Standard QPainter rendering path handles 8-bit display automatically
hdrModeEnabled = false;
}

// Create the main YUView application with HDR decision made

YUViewApplication app(argc, argv, hdrModeEnabled, hardwareFallbackOccurred, fallbackMessage);

return app.returnCode;
}
Loading