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++
4.3 KB
Raw Blame
// Ported unchanged from SilyNoMeta/DLSSG-Transfusion (MIT) tag v1.4.5.3-rtx20-30-40,
// commit b56bd2deed114507ad2c88f986d90ed50ffb4639, source/native/quality_explained_warp.h.
// Copyright (c) 2026 Michael Robles (TonyJoaca/DLSSG-Transfusion), fork by SilyNoMeta; MIT, see LICENSE.txt.
#pragma once
// Explained-warp policy: dlssg_for_sm86's tuning of the valid-warp technique
// invented by Tony Joaca for Transfusion. A candidate takes the full warp when
// the warp explains the change between the two source frames, where
// Transfusion's own policy requires the two warped candidates to agree. It is
// that project's third iteration (v0.3.5-5, its "V3"; unrelated to
// Transfusion's V4): its 310.9.1-11 V1 without the UIR rule and without the
// asymmetric copy, on the Blackwell blend layout.
// Generated by dlssg_for_sm86 tools/companion/quality_program.py
// program_v3('blackwell'); kept byte-identical to that generator. Inserted at
// the same anchor as Transfusion's policy (before the UIR flag load), alternative
// to it, never combined.
//
//   valid_i    = finite warp inside the half-texel border
//   explained  = both valid, Em + 0.08 < Es and Em < 0.15   (warp explains the change)
//   forced_i   = valid_i, NVIDIA weight c_i >= 0.20, Es > 0.25, not explained
//   explained or forced_i -> output_i = W_i (full warp); otherwise NVIDIA's blend
//
// Es / Em: RGB L1 difference of the two candidates, unwarped / warped.
#include <string_view>

namespace quality_fix
{
inline constexpr std::string_view kPolicyExplainedWarp = R"ptx(
{ // SM86_QUALITY_VALID_WARP_V3
.reg .f32 %qw_f<16>;
.reg .pred %qw_p<12>;
cvt.rn.f32.u32 %qw_f0, %r10;
div.approx.ftz.f32 %qw_f0, 0f3F000000, %qw_f0;
sub.f32 %qw_f2, 0f3F800000, %qw_f0;
cvt.rn.f32.u32 %qw_f1, %r11;
div.approx.ftz.f32 %qw_f1, 0f3F000000, %qw_f1;
sub.f32 %qw_f3, 0f3F800000, %qw_f1;
not.pred %qw_p0, %p17;
setp.ge.f32 %qw_p2, %f123, %qw_f0;
and.pred %qw_p0, %qw_p0, %qw_p2;
setp.le.f32 %qw_p2, %f123, %qw_f2;
and.pred %qw_p0, %qw_p0, %qw_p2;
setp.ge.f32 %qw_p2, %f124, %qw_f1;
and.pred %qw_p0, %qw_p0, %qw_p2;
setp.le.f32 %qw_p2, %f124, %qw_f3;
and.pred %qw_p0, %qw_p0, %qw_p2;
abs.f32 %qw_f12, %f125;
abs.f32 %qw_f13, %f126;
abs.f32 %qw_f14, %f127;
add.f32 %qw_f12, %qw_f12, %qw_f13;
add.f32 %qw_f12, %qw_f12, %qw_f14;
setp.lt.f32 %qw_p2, %qw_f12, 0f7F800000;
and.pred %qw_p0, %qw_p0, %qw_p2;
not.pred %qw_p1, %p16;
setp.ge.f32 %qw_p2, %f129, %qw_f0;
and.pred %qw_p1, %qw_p1, %qw_p2;
setp.le.f32 %qw_p2, %f129, %qw_f2;
and.pred %qw_p1, %qw_p1, %qw_p2;
setp.ge.f32 %qw_p2, %f130, %qw_f1;
and.pred %qw_p1, %qw_p1, %qw_p2;
setp.le.f32 %qw_p2, %f130, %qw_f3;
and.pred %qw_p1, %qw_p1, %qw_p2;
abs.f32 %qw_f12, %f131;
abs.f32 %qw_f13, %f132;
abs.f32 %qw_f14, %f133;
add.f32 %qw_f12, %qw_f12, %qw_f13;
add.f32 %qw_f12, %qw_f12, %qw_f14;
setp.lt.f32 %qw_p2, %qw_f12, 0f7F800000;
and.pred %qw_p1, %qw_p1, %qw_p2;
sub.f32 %qw_f12, %f115, %f119;
abs.f32 %qw_f12, %qw_f12;
sub.f32 %qw_f13, %f116, %f120;
abs.f32 %qw_f13, %qw_f13;
sub.f32 %qw_f14, %f117, %f121;
abs.f32 %qw_f14, %qw_f14;
add.f32 %qw_f4, %qw_f12, %qw_f13;
add.f32 %qw_f4, %qw_f4, %qw_f14;
sub.f32 %qw_f12, %f125, %f131;
abs.f32 %qw_f12, %qw_f12;
sub.f32 %qw_f13, %f126, %f132;
abs.f32 %qw_f13, %qw_f13;
sub.f32 %qw_f14, %f127, %f133;
abs.f32 %qw_f14, %qw_f14;
add.f32 %qw_f5, %qw_f12, %qw_f13;
add.f32 %qw_f5, %qw_f5, %qw_f14;
add.f32 %qw_f6, %qw_f5, 0f3DA3D70A;
setp.lt.f32 %qw_p3, %qw_f6, %qw_f4;
setp.lt.f32 %qw_p2, %qw_f5, 0f3E19999A;
and.pred %qw_p3, %qw_p3, %qw_p2;
and.pred %qw_p3, %qw_p3, %qw_p0;
and.pred %qw_p3, %qw_p3, %qw_p1;
setp.gt.f32 %qw_p4, %qw_f4, 0f3E800000;
not.pred %qw_p5, %qw_p3;
and.pred %qw_p8, %qw_p3, %qw_p0;
setp.ge.f32 %qw_p6, %f148, 0f3E4CCCCD;
and.pred %qw_p6, %qw_p6, %qw_p4;
and.pred %qw_p6, %qw_p6, %qw_p5;
and.pred %qw_p6, %qw_p6, %qw_p0;
@%qw_p6 mov.f32 %f39, %f125;
@%qw_p6 mov.f32 %f38, %f126;
@%qw_p6 mov.f32 %f37, %f127;
@%qw_p8 mov.f32 %f39, %f125;
@%qw_p8 mov.f32 %f38, %f126;
@%qw_p8 mov.f32 %f37, %f127;
and.pred %qw_p9, %qw_p3, %qw_p1;
setp.ge.f32 %qw_p7, %f149, 0f3E4CCCCD;
and.pred %qw_p7, %qw_p7, %qw_p4;
and.pred %qw_p7, %qw_p7, %qw_p5;
and.pred %qw_p7, %qw_p7, %qw_p1;
@%qw_p7 mov.f32 %f43, %f131;
@%qw_p7 mov.f32 %f42, %f132;
@%qw_p7 mov.f32 %f41, %f133;
@%qw_p9 mov.f32 %f43, %f131;
@%qw_p9 mov.f32 %f42, %f132;
@%qw_p9 mov.f32 %f41, %f133;
} // end SM86_QUALITY_VALID_WARP_V3
)ptx";
}