Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.
C++
Reuse the existing snapshot publication for HDR statistics
Veyra Goal Agentf6362910f604
diff --git a/include/veyra/engine/HdrOutputTuning.h b/include/veyra/engine/HdrOutputTuning.hindex 0e0bdff7..b1b004c7 100644--- a/include/veyra/engine/HdrOutputTuning.h+++ b/include/veyra/engine/HdrOutputTuning.h@@ -596,6 +596,9 @@ inline double pqCodeToNits(double normalized) {}// Optional per-frame metadata is sticky within one source epoch only. The// presenter owns this state; reopening it or switching sources must clear it.+inline unsigned hdrMetadataNits(float value){+ return std::isfinite(value)&&value>0?unsigned(std::lround(std::clamp(value,1.0f,10000.0f))):0u;+}struct HdrSourceMetadata {uint64_t epoch=0;bool hasEpoch=false;diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex 8e9faaff..27aea5d5 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -687,9 +687,9 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s};pipeline::EnhanceGraphDesc gd;gd.sourceWidth=width;gd.sourceHeight=height;gd.hdrInput=!isImage&&activeSource->info().color.isHdrPath();{const auto& sourceColor=activeSource->info().color;- const unsigned sourceMastering=unsigned(std::max(0.0f,sourceColor.hdrMasteringPeakNits));- const unsigned sourceCll=unsigned(std::max(0.0f,sourceColor.hdrMaxCllNits));- const unsigned sourceFall=unsigned(std::max(0.0f,sourceColor.hdrMaxFallNits));+ const unsigned sourceMastering=hdrMetadataNits(sourceColor.hdrMasteringPeakNits);+ const unsigned sourceCll=hdrMetadataNits(sourceColor.hdrMaxCllNits);+ const unsigned sourceFall=hdrMetadataNits(sourceColor.hdrMaxFallNits);std::lock_guard lock(mutex_);snapshot_.sourceHdr=gd.hdrInput;snapshot_.sourceMasteringPeakNits=sourceMastering;snapshot_.sourceMaxCllNits=sourceCll;snapshot_.sourceMaxFallNits=sourceFall;}@@ -1858,9 +1858,9 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sdescribeStages(stageRequest(options),options.snapshot(),gd);gd.hdrInput=!isImage&&activeSource->info().color.isHdrPath();gd.hdrOutput=options.settings.useHdrPreview(gd.hdrInput,displayHdrActive());const auto resizeSourceColor=activeSource->info().color;- const unsigned resizeMastering=unsigned(std::max(0.0f,resizeSourceColor.hdrMasteringPeakNits));- const unsigned resizeCll=unsigned(std::max(0.0f,resizeSourceColor.hdrMaxCllNits));- const unsigned resizeFall=unsigned(std::max(0.0f,resizeSourceColor.hdrMaxFallNits));+ const unsigned resizeMastering=hdrMetadataNits(resizeSourceColor.hdrMasteringPeakNits);+ const unsigned resizeCll=hdrMetadataNits(resizeSourceColor.hdrMaxCllNits);+ const unsigned resizeFall=hdrMetadataNits(resizeSourceColor.hdrMaxFallNits);if(nativeCapture){captureGraphColor=activeSource->info().color;gd.rgbInput=captureGraphColor.pixelFormat==pipeline::SourcePixelFormat::Bgra8;gd.yuy2Input=false;gd.packedInput=pipeline::packedInputCode(captureGraphColor.pixelFormat);gd.captureBitDepth=ingressBitDepth(captureGraphColor.pixelFormat);@@ -2494,15 +2494,6 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,spresenter.observeHdrCoverage(hdrCoverageObserved_.load());if(!presenter.present(ctx,ring,*graph,item.lease->slot,generated,item.lease->referencesValid,comparisonMode_,comparisonBase_,comparisonSplit_,item.identity,previewView(),item.pts100ns))return {State::Failed};const auto presentEndHost=host100ns();- // Custom: publish the live curve coverage the presenter just collected.- // Only a completed probe updates it, so the panel never shows a stale reading.- {- std::lock_guard lock(mutex_);- snapshot_.hdrCoverageValid=presenter.liveCurveCoverage().valid;- snapshot_.hdrAboveCeilingPercent=presenter.liveCurveCoverage().aboveCeilingPercent();- snapshot_.hdrInRollOffPercent=presenter.liveCurveCoverage().inRollOffPercent();- snapshot_.hdrInLiftPercent=presenter.liveCurveCoverage().inLiftPercent();- }const double returnDeviation=deviationValid?nowMs()-itemPtsMs:0;item.lease->consumerFence=presenter.consumerFenceValue(ring.lastSignaledValue());const bool didPresent=presenter.submittedCount()>before;s.blit=presenter.blitTiming(ctx.fence());const auto elapsed=elapsedMs(begin);s.presentMs+=elapsed;flow->cpu(diagnostics::CpuStage::Present,elapsed,host100ns());@@ -2704,6 +2695,13 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,ssnapshot_.previewSkipped=measured.flow.counters.previewSkippedBeforeGraph;snapshot_.fgBudgetLimited=measured.flow.lastFgRejected100ns>0&&host100ns()-measured.flow.lastFgRejected100ns<10000000;snapshot_.xessGenerationSuppressed=graph->xessEnabled()&&presenter.xessGenerationSuppressed();+ // Reuse the existing snapshot lock, rather than locking once+ // more for every generated Present.+ const auto& coverage=presenter.liveCurveCoverage();+ snapshot_.hdrCoverageValid=coverage.valid;+ snapshot_.hdrAboveCeilingPercent=coverage.aboveCeilingPercent();+ snapshot_.hdrInRollOffPercent=coverage.inRollOffPercent();+ snapshot_.hdrInLiftPercent=coverage.inLiftPercent();snapshot_.displayVrr=gfx::vrrLevel(presenter.displayVrr());snapshot_.presentationVrrSync=presenter.vrrSync();snapshot_.nrActive=graph->nrEnabled()&&graphStats.nrEvaluateCount>0;snapshot_.nrAutoActive=graph->autoNrPoolReady();diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex 75c4a80d..8e72ad4c 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -4821,7 +4821,7 @@ QVariantMap QmlPlayerBridge::hdrCurveCoverage() const {{"lift",snap.hdrInLiftPercent}};}-void QmlPlayerBridge::observeHdrCoverage(bool on){impl_->hdrCoverageObserved=on;impl_->engine.observeHdrCoverage(on);}+void QmlPlayerBridge::observeHdrCoverage(bool on){if(impl_->hdrCoverageObserved==on)return;impl_->hdrCoverageObserved=on;impl_->engine.observeHdrCoverage(on);emit snapshotChanged();}QVariantMap QmlPlayerBridge::hdrCurveGraph() const {auto base=settings().hdrCurve;if(!base.displayPeakNits)base.displayPeakNits=effectiveHdrDisplayPeakNits();engine::HdrCurveSettings c;engine::HdrMetadataSettings metadata;diff --git a/tests/unit/HdrOutputTuningTests.cpp b/tests/unit/HdrOutputTuningTests.cppindex 84a3806e..8a3d4332 100644--- a/tests/unit/HdrOutputTuningTests.cpp+++ b/tests/unit/HdrOutputTuningTests.cpp@@ -371,6 +371,8 @@ int main() {const auto disabled=hdrCurveCoverage(frame,7,HdrCurveSettings{});check(!disabled.valid&&disabled.samples==0&&disabled.aboveCeilingPercent()==0.0,"coverage: a disabled curve reports nothing instead of zeroes that look real");+ check(hdrMetadataNits(INFINITY)==0&&hdrMetadataNits(NAN)==0&&hdrMetadataNits(-1)==0&&hdrMetadataNits(10001)==10000,+ "source metadata: non-finite values are absent and finite values bounded");const auto empty=hdrCurveCoverage(nullptr,0,curve);check(!empty.valid,"coverage: no samples means no reading");// 20 nit sits inside the 35-nit lift range; 50 would not.