Skip to content

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++

hdr: publish the live curve coverage into the player snapshot

georgeg911bfe3eca3b247
diff --git a/include/veyra/engine/EngineController.h b/include/veyra/engine/EngineController.h
index 4336785f..3bee6978 100644
--- a/include/veyra/engine/EngineController.h
+++ b/include/veyra/engine/EngineController.h
@@ -89,6 +89,18 @@ struct PlayerSnapshot {
// ratio (0 = use coded size). Known at open time, before the first frame.
uint32_t sourceWidth=0,sourceHeight=0;
bool sourceHdr=false;
+ // The source's own HDR numbers, straight from the container. They survive the
+ // hardware-decode path, where there is no CPU luma to measure a histogram from.
+ unsigned sourceMasteringPeakNits=0;
+ unsigned sourceMaxCllNits=0;
+ unsigned sourceMaxFallNits=0;
+ // Custom: the live coverage the presenter measured with its 64x36 probe (see
+ // HdrOutputTuning.h). Percentages of the last probed frame; invalid until the
+ // first probe completes, so the panel can say "not measured" instead of 0%.
+ bool hdrCoverageValid=false;
+ double hdrAboveCeilingPercent=0.0;
+ double hdrInRollOffPercent=0.0;
+ double hdrInLiftPercent=0.0;
double sourceDisplayAspect=0.0;
int sourceRotationDegrees=0;
// Poster frame for the minimal-mode bar, as a small RGBA8 image. Empty when
diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.h
index d7acc739..ff135fcd 100644
--- a/include/veyra/ui/QmlPlayerBridge.h
+++ b/include/veyra/ui/QmlPlayerBridge.h
@@ -320,6 +320,34 @@ class QmlPlayerBridge : public QObject {
Q_PROPERTY(int hdrDisplayPeakNits READ hdrDisplayPeakNits WRITE setHdrDisplayPeakNits NOTIFY settingsChanged)
// What the system reports about the display, for the peak field's reset button.
Q_PROPERTY(QVariantMap hdrDisplayInfo READ hdrDisplayInfo NOTIFY snapshotChanged)
+ // Custom: the source's own HDR numbers (container metadata), the one-click
+ // recommendation derived from them, and the warning that compares the film's
+ // peak with what the curve will actually cap.
+ Q_PROPERTY(QVariantMap hdrSourceInfo READ hdrSourceInfo NOTIFY snapshotChanged)
+ Q_PROPERTY(QVariantMap hdrRecommendation READ hdrRecommendation NOTIFY snapshotChanged)
+ // Custom: whether the running source is SDR. Used only to word the recommendation
+ // row (an SDR source has no HDR metadata, so "no metadata" would be misleading).
+ Q_PROPERTY(bool sourceIsSdr READ sourceIsSdr NOTIFY snapshotChanged)
+ Q_PROPERTY(QVariantMap hdrPeakWarning READ hdrPeakWarning NOTIFY snapshotChanged)
+ // Custom: one remembered curve per display device, so moving the window to the
+ // projector or the TV applies the settings tuned on that device.
+ Q_PROPERTY(int hdrDisplayProfileCount READ hdrDisplayProfileCount NOTIFY preferencesChanged)
+ // Custom: which preset system the panel shows. "legacy" is the original seven
+ // presets, "axes" is content x environment. A UI choice kept in preferences:
+ // both modes write the very same curve, so the saved session is unaffected.
+ Q_PROPERTY(QString hdrPresetMode READ hdrPresetMode WRITE setHdrPresetMode NOTIFY preferencesChanged)
+ Q_PROPERTY(QVariantMap hdrAxes READ hdrAxes NOTIFY preferencesChanged)
+ Q_PROPERTY(QVariantMap hdrAxesMatch READ hdrAxesMatch NOTIFY settingsChanged)
+ Q_PROPERTY(QVariantMap hdrDials READ hdrDials NOTIFY settingsChanged)
+ // Custom: the curve sampled by the same function the shader runs, for the panel
+ // graph (see hdrCurveLuminance).
+ Q_PROPERTY(QVariantMap hdrCurveGraph READ hdrCurveGraph NOTIFY settingsChanged)
+ // Custom: the live coverage measured by the presenter's probe (see the panel's
+ // live meter). Invalid until a probe has completed.
+ Q_PROPERTY(QVariantMap hdrCurveCoverage READ hdrCurveCoverage NOTIFY snapshotChanged)
+ Q_PROPERTY(bool hdrTitleMemory READ hdrTitleMemory WRITE setHdrTitleMemory NOTIFY preferencesChanged)
+ Q_PROPERTY(bool hdrAutoRecommend READ hdrAutoRecommend WRITE setHdrAutoRecommend NOTIFY preferencesChanged)
+ Q_PROPERTY(int hdrTitleCount READ hdrTitleCount NOTIFY preferencesChanged)
Q_PROPERTY(int nrStyle READ nrStyle WRITE setNrStyle NOTIFY settingsChanged)
Q_PROPERTY(double nrIntensity READ nrIntensity WRITE setNrIntensity NOTIFY settingsChanged)
Q_PROPERTY(double nrTone READ nrTone WRITE setNrTone NOTIFY settingsChanged)
@@ -856,12 +884,46 @@ public:
bool commitHdrTuning(engine::EnhancementSettings settings);
QString hdrTuningPreset() const;
Q_INVOKABLE bool applyHdrTuningPreset(const QString& id);
+ // Custom: apply the recommendation above in one click.
+ Q_INVOKABLE bool applyRecommendedHdrTuning();
+ // Custom: forget every remembered display profile (the current device is kept
+ // and re-learned from the settings in use).
+ Q_INVOKABLE void forgetHdrDisplayProfiles();
+ Q_INVOKABLE bool applyHdrAxesPreset(const QString& content, const QString& environment);
+ Q_INVOKABLE bool setHdrDial(const QString& key, int level);
+ Q_INVOKABLE void forgetHdrTitles();
// The strength dial and the display peak (stored next to the baseline).
int hdrCurveStrength() const;
void setHdrCurveStrength(int percent);
int hdrDisplayPeakNits() const;
void setHdrDisplayPeakNits(int nits);
QVariantMap hdrDisplayInfo() const;
+ // Custom: see the hdrSourceInfo/hdrRecommendation/hdrPeakWarning properties.
+ QVariantMap hdrSourceInfo() const;
+ QVariantMap hdrRecommendation() const;
+ bool sourceIsSdr() const;
+ unsigned effectiveHdrDisplayPeakNits() const;
+ QVariantMap hdrPeakWarning() const;
+ int hdrDisplayProfileCount() const;
+ QString hdrPresetMode() const;
+ void setHdrPresetMode(const QString& mode);
+ QVariantMap hdrAxes() const;
+ QVariantMap hdrAxesMatch() const;
+ QVariantMap hdrDials() const;
+ QVariantMap hdrCurveGraph() const;
+ QVariantMap hdrCurveCoverage() const;
+ bool hdrTitleMemory() const;
+ void setHdrTitleMemory(bool on);
+ bool hdrAutoRecommend() const;
+ void setHdrAutoRecommend(bool on);
+ int hdrTitleCount() const;
+ void syncHdrTitleProfile();
+ bool loadHdrTitleProfile(const QString& title);
+ bool storeHdrTitleProfile(const QString& title);
+ bool loadHdrProfile(const QString& id);
+ bool storeHdrProfile(const QString& id);
+ QString hdrDisplayProfileId() const;
+ void syncHdrDisplayProfile();
QVariantMap videoHdrParams() const;
Q_INVOKABLE bool setVideoHdrParameter(const QString& key, double value);
int nrStyle() const;
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index 384bf680..c3d3b6fe 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -686,7 +686,13 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
return active;
};
pipeline::EnhanceGraphDesc gd;gd.sourceWidth=width;gd.sourceHeight=height;gd.hdrInput=!isImage&&activeSource->info().color.isHdrPath();
- {std::lock_guard lock(mutex_);snapshot_.sourceHdr=gd.hdrInput;}
+ {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));
+ std::lock_guard lock(mutex_);snapshot_.sourceHdr=gd.hdrInput;
+ snapshot_.sourceMasteringPeakNits=sourceMastering;snapshot_.sourceMaxCllNits=sourceCll;
+ snapshot_.sourceMaxFallNits=sourceFall;}
gd.highQualityPresentation=isRemote&&activeSource->info().color.reconstructChroma;
gd.rgbInput=isImage||isScreen||(isCapture&&activeSource->info().color.pixelFormat==pipeline::SourcePixelFormat::Bgra8);
auto ingressBitDepth=[](pipeline::SourcePixelFormat format){return format==pipeline::SourcePixelFormat::P010||format==pipeline::SourcePixelFormat::V210||format==pipeline::SourcePixelFormat::Rgb10xLE?10u:format==pipeline::SourcePixelFormat::P016?16u:8u;};
@@ -1851,10 +1857,14 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
width=uint32_t(frame->width);height=uint32_t(frame->height);
describeStages(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));
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);
- std::lock_guard lock(mutex_);snapshot_.sourceWidth=width;snapshot_.sourceHeight=height;snapshot_.sourceHdr=gd.hdrInput;snapshot_.sourceDisplayAspect=activeSource->info().displayAspect;
+ std::lock_guard lock(mutex_);snapshot_.sourceWidth=width;snapshot_.sourceHeight=height;snapshot_.sourceHdr=gd.hdrInput;snapshot_.sourceMasteringPeakNits=resizeMastering;snapshot_.sourceMaxCllNits=resizeCll;snapshot_.sourceMaxFallNits=resizeFall;snapshot_.sourceDisplayAspect=activeSource->info().displayAspect;
}
if(!presenter.prepareGraphChange()){status(L"输入尺寸切换呈现排空失败",true);break;}
graph->shutdown();recentGraphCache.evict("source-resize");
@@ -2483,6 +2493,15 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
presenter.reflexFrame(watch->reflexFrame);
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());