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

Revert "perf(vfg): live VFG falls back to the largest group that fits"

Veyra Goal Agent3b9da6f3be3d
diff --git a/include/veyra/engine/FgRecoveryBudget.h b/include/veyra/engine/FgRecoveryBudget.h
index 7f154796..f10a60e8 100644
--- a/include/veyra/engine/FgRecoveryBudget.h
+++ b/include/veyra/engine/FgRecoveryBudget.h
@@ -111,15 +111,6 @@ public:
const double grace=double(std::max<int64_t>(0,outputInterval))/10000;
return double(midpointDeadline-now)/10000+grace>=std::max(0.0,queued+*base+*firstFgMs-progress)+std::max(0.0,present);
}
- // Live partial group: base work plus `calls` measured interpolations must
- // reach the deadline of the group's last output, with the same 10 ms
- // presentation grace as canAdmit. Does not touch recovery state.
- bool canAdmitPartial(int64_t now,int64_t lastDeadline,double elapsed,double present,std::optional<double> perCallMs,unsigned calls)const{
- const auto base=baseCost(now);
- if(!base||!perCallMs||!std::isfinite(*perCallMs)||*perCallMs<0)return false;
- const double progress=std::clamp(elapsed,0.0,*base);
- return double(lastDeadline-now)/10000+10>=std::max(0.0,*base+*perCallMs*calls-progress)+std::max(0.0,present);
- }
bool recovering()const{return limited_&&recoveryPairs_>0;}
};
}
diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.h
index 9ccb8628..d1dcbf1a 100644
--- a/include/veyra/pipeline/EnhanceGraph.h
+++ b/include/veyra/pipeline/EnhanceGraph.h
@@ -459,14 +459,7 @@ public:
// interpolation positions). The pair keeps its true A/B PTS; only the
// number of outputs changes, and it is reported as previewFgMultiplier.
enum class FgDecision { Skip, Evaluate, Seed, Reduced };
- // reducedMultiplier sizes a Reduced group (default the 2X midpoint). VFG
- // sets its multiplier per pair, so live VFG admission may pick the largest
- // smaller group that fits; other backends always reduce to 2X.
- struct FgAdmissionResult {
- FgDecision decision;unsigned reducedMultiplier;
- FgAdmissionResult(FgDecision value=FgDecision::Skip,unsigned reduced=2):decision(value),reducedMultiplier(reduced){}
- };
- using FgAdmission=std::function<FgAdmissionResult(const FrameBatch&,bool warmingHistory)>;
+ using FgAdmission=std::function<FgDecision(const FrameBatch&,bool warmingHistory)>;
// `hardwareSurface` carries the decoded texture for paths whose surface
// does not travel inside the AVFrame (D3D11VA). It must be provided exactly
// when frame->format == AV_PIX_FMT_D3D11 and is unused otherwise.
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index 0faa2739..113a9732 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -1803,7 +1803,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
// owns generation inside its presenter and has no graph admission.
if(isCapture&&!rereadCached&&!presentSinkFrameGeneration(options.settings.frameGenerationBackend)){
const auto presentP95=livePresentGpu.p95();
- admitFg=[&,presentP95](const pipeline::FrameBatch& batch,bool warmingHistory)->pipeline::EnhanceGraph::FgAdmissionResult{
+ admitFg=[&,presentP95](const pipeline::FrameBatch& batch,bool warmingHistory){
// Physical capture and PS5 delivery clocks are not
// guaranteed to match the host clock. Anchor each new
// input pair before enhancement, so a 59.94-vs-60Hz
@@ -1817,27 +1817,8 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
const auto now=host100ns(),deadline=liveTimeline.deadline(lastGenerated);
const double elapsed=elapsedMs(processStart);
const bool admitted=fgBudget.admit(now,deadline,elapsed,presentP95,warmingHistory);
- const char* timeline=pairAnchoredLive?(isStream?"decoded-pair":"capture-pair"):"continuous";
- logAdmission(batch,now,deadline,elapsed,presentP95,admitted,warmingHistory,timeline);
- if(admitted)return pipeline::EnhanceGraph::FgDecision::Evaluate;
- // VFG sets its multiplier per pair. Instead of a whole-group
- // hole, emit the largest smaller group whose last output still
- // fits; its frames keep their true positions on the A/B
- // timeline and history is kept. Deadlines are unchanged.
- // VEYRA_TEST_VFG_NO_LIVE_REDUCED=1 disables it for A/B runs.
- static const bool liveReduced=GetEnvironmentVariableW(L"VEYRA_TEST_VFG_NO_LIVE_REDUCED",nullptr,0)==0;
- if(liveReduced&&!warmingHistory&&previewFgMultiplier>2&&options.settings.frameGenerationBackend==FrameGenerationBackend::Vfg){
- const auto perCall=frameFlow->snapshot(now).gpuTiming[size_t(diagnostics::GpuStage::Fg1)].p95;
- for(unsigned m=previewFgMultiplier-1;m>=2;--m){
- const auto last=liveTimeline.deadline(pipeline::FrameBatch::interpolate(a,batch.b100ns,m-1,m));
- if(!fgBudget.canAdmitPartial(now,last,elapsed,presentP95,perCall,m-1))continue;
- ++fgReducedPairs;
- if(now>=nextFgReducedLog){nextFgReducedLog=now+10000000;
- veyra::log::info("live-fg-admission",std::format("timeline={} revision={} source={} reduced={}X requestedMultiplier={} reducedPairs={} remainingLastMs={:.3f} perCallGpuP95Ms={:.3f} predictedFullMs={:.3f} (VFG history kept; smaller presentable group instead of whole-group hole)",timeline,batch.identity.settingsRevision,batch.identity.sourceFrameId,m,options.fgMultiplier,fgReducedPairs,double(last-now)/10000,perCall.value_or(-1),fgBudget.predicted(now,false).value_or(-1)));}
- return {pipeline::EnhanceGraph::FgDecision::Reduced,m};
- }
- }
- return pipeline::EnhanceGraph::FgDecision::Skip;
+ logAdmission(batch,now,deadline,elapsed,presentP95,admitted,warmingHistory,pairAnchoredLive?(isStream?"decoded-pair":"capture-pair"):"continuous");
+ return admitted?pipeline::EnhanceGraph::FgDecision::Evaluate:pipeline::EnhanceGraph::FgDecision::Skip;
};
}
// File playback checks both the first output and whole-group
diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cpp
index 97b2cea8..148836ef 100644
--- a/src/pipeline/EnhanceGraph.cpp
+++ b/src/pipeline/EnhanceGraph.cpp
@@ -2838,8 +2838,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
// VEYRA_TEST_VFG_SKIP_RESETS_HISTORY=1 restores the pre-2026-10-10 rule
// (a VFG pair skipped for budget resets history) for same-EXE A/B runs.
static const bool vfgSkipResetsHistory=GetEnvironmentVariableW(L"VEYRA_TEST_VFG_SKIP_RESETS_HISTORY",nullptr,0)>0;
- const auto admission=fgBackendAvailable?(admitFg?admitFg(out.batch,resetFg):FgAdmissionResult{FgDecision::Evaluate}):FgAdmissionResult{FgDecision::Skip};
- auto decision=admission.decision;
+ auto decision=fgBackendAvailable?(admitFg?admitFg(out.batch,resetFg):FgDecision::Evaluate):FgDecision::Skip;
// For VFG a budget seed is a hidden reset Run whose only purpose is to keep
// history; recording B below keeps it without any Run.
if(vfgBackend_&&decision==FgDecision::Seed&&historyValid&&!vfgSkipResetsHistory)decision=FgDecision::Skip;
@@ -2853,11 +2852,10 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
// seed path already runs a single evaluation.
const bool reduced=decision==FgDecision::Reduced&&!resetFg;
out.fgReduced=reduced;
- const unsigned reducedMultiplier=vfgBackend_&&fgMultiplier>2?std::clamp(admission.reducedMultiplier,2u,fgMultiplier-1):2u;
// A reset has no usable A/B pair. Seed one complete 2X evaluation group;
// all later subframes would repeat reset work and cannot be presented.
- const uint32_t fgCalls=resetFg?1:reduced?reducedMultiplier-1:fgMultiplier-1;
- const unsigned outputMultiplier=reduced?reducedMultiplier:fgMultiplier;
+ const uint32_t fgCalls=(resetFg||reduced)?1:fgMultiplier-1;
+ const unsigned outputMultiplier=reduced?2u:fgMultiplier;
if(runFg&&resetFg){
if(reseedRejected)out.fgSkippedBeforeEval=out.fgCandidates-fgCalls;
else out.fgSkippedForReset=out.fgCandidates-fgCalls;