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

Require and audit optional deinterlace deployment and preserve network clocks

Veyra Goal Agenta0e564dc2b3c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 89ef4354..efc5e490 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,6 +44,7 @@ if(NOT VEYRA_NVOF_SDK_ROOT)
endif()
set(VEYRA_RUNTIME_ROOT "" CACHE PATH "Local NVIDIA runtime root")
set(VEYRA_FFMPEG_ROOT "" CACHE PATH "vcpkg-installed x64-windows root with FFmpeg (player deps)")
+option(VEYRA_ENABLE_DEINTERLACE "Enable optional LGPL FFmpeg deinterlacing module" ON)
set(VEYRA_CLIP_TOOLS_ROOT "" CACHE PATH "vcpkg-installed x64-windows root with openh264-enabled FFmpeg (clip tooling only)")
option(VEYRA_ENABLE_EXPERIMENTAL_DLSSNR
@@ -506,6 +507,12 @@ if(VEYRA_FFMPEG_ROOT AND EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavformat/avform
# d3d11: the HEVC hardware path decodes on a private D3D11VA device and shares
# the surfaces with the D3D12 graph as NT handles.
target_link_libraries(veyra_media PUBLIC veyra_base veyra_gfx d3d11)
+ if(VEYRA_ENABLE_DEINTERLACE)
+ if(NOT EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavfilter/avfilter.h")
+ message(FATAL_ERROR "Deinterlacing requires the filter prefix; run scripts/ffmpeg/build-deinterlace-module.py and set VEYRA_FFMPEG_ROOT to its prefix (or explicitly disable VEYRA_ENABLE_DEINTERLACE).")
+ endif()
+ target_compile_definitions(veyra_media PRIVATE VEYRA_ENABLE_DEINTERLACE=1)
+ endif()
target_include_directories(veyra_media PUBLIC ${FFMPEG_INCLUDE_DIRS})
target_link_directories(veyra_media PUBLIC ${FFMPEG_LIBRARY_DIRS})
target_link_libraries(veyra_media PUBLIC ${FFMPEG_LIBRARIES})
diff --git a/scripts/acceptance/test-2.0.8-build.py b/scripts/acceptance/test-2.0.8-build.py
index 1e1c54ad..7567ad4c 100644
--- a/scripts/acceptance/test-2.0.8-build.py
+++ b/scripts/acceptance/test-2.0.8-build.py
@@ -24,7 +24,7 @@ for k in ('PROTOC','PKG_CONFIG_EXECUTABLE','SDL3_DIR','LibDataChannel_DIR','Opus
options[k]=re.search(r'^'+k+r':[^=]+=(.*)$',text,re.M).group(1)
options.update(VEYRA_DECKLINK_SDK_DIR=str(BASE/'deps/decklink-sdk-obs31-20261009'),
VEYRA_AMD_NR_TEST_GRAPH_SOURCE=str(ROOT/'src/pipeline/EnhanceGraph.cpp'),
- VEYRA_FFMPEG_ROOT=str(BASE/'deps/ffmpeg-subtitle-formats-20261009/installed'),
+ VEYRA_FFMPEG_ROOT=str(BASE/'deps/ffmpeg-filter-issues41-45-20261016'),
VEYRA_DISPLAY_VERSION=LABEL,Python3_EXECUTABLE=os.sys.executable)
assert all(options['VEYRA_ENABLE_'+f]=='ON' for f in ('REMOTEPLAY','MOONLIGHT','XBOX'))
env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_','QSG_','QML_'))}
diff --git a/scripts/acceptance/test-2.0.8-package.py b/scripts/acceptance/test-2.0.8-package.py
index cfde65ad..3d40d1b8 100644
--- a/scripts/acceptance/test-2.0.8-package.py
+++ b/scripts/acceptance/test-2.0.8-package.py
@@ -20,7 +20,7 @@ assert args.cold_run is None or re.fullmatch(r'[a-z0-9][a-z0-9-]{0,63}',args.col
ROOT=Path(__file__).resolve().parents[2];B=Path('E:/项目/Veyra');TASK=args.task;LABEL=args.label
VALIDATION=args.validation_record
BUILD=B/'build'/TASK;OUT=B/'test-packages'/TASK;REPORT=B/'reports'/TASK
-FF=B/'deps/ffmpeg-subtitle-formats-20261009/installed'
+FF=B/'deps/ffmpeg-filter-issues41-45-20261016'
FFSOURCE=B/'test-packages/subtitle-formats-20261009/FFmpeg-9.0.1-slices256-dav1d-zlib-source.zip'
FFSHA='49db22049f072bd5448faa664aa736074dccfe6e72b4a933f673d8ae954b0bb6'
DEPSOURCE=B/'releases/release-2.0.6-20261007/Veyra-2.0.6-dependency-source.zip'
@@ -116,6 +116,9 @@ def refresh(flavor):
ff=pkg.audit_ffmpeg(FF)
for r in ff['files']:atomic(FF/'bin'/r['name'],app/r['name'])
atomic(FF/'share/ffmpeg/veyra-local-build.json',app/'licenses/FFMPEG-VEYRA-BUILD.json')
+ assert 'filterModule' in ff,'Deinterlacing module required for this candidate'
+ for src,dst in [('veyra-filter-build.json','FFMPEG-DEINTERLACE-BUILD.json'),('filter-COPYING.LGPLv2.1','FFMPEG-DEINTERLACE-LICENSE.txt'),('filter-LICENSE.md','FFMPEG-DEINTERLACE-NOTICE.md')]:
+ atomic(FF/'share/ffmpeg'/src,app/'licenses'/dst)
for src,dst in [('copyright','ZLIB-COPYRIGHT.txt'),('vcpkg.spdx.json','ZLIB-SPDX.json')]:atomic(FF/'share/zlib'/src,app/'licenses'/dst)
runtime=json.loads((DONORS[flavor]/'release-runtime-manifest.json').read_text('utf8'));runtime.update(package='2.0.8',candidate=LABEL,localOnly=True)
if flavor=='NVIDIA':
@@ -152,6 +155,7 @@ def manifest(flavor,source=False):
knownIssues=['AMD/Intel enhancement, GC550 and Blackmagic field validation require affected hardware','Douyin live companion compatibility not reproduced locally (not installed); process-name simulation only; field confirmation needed','VFG synthetic async validation failed 22 checks once, then 2425 checks passed in an isolated rerun; cause unresolved; see validation record'],
correspondingSource=dict(application='../'+SOURCE.name,applicationSha256=sha(SOURCE) if source else None,
dependencies='../'+DEPSOURCE.name,dependencySha256=DEPSHA,ffmpeg='../'+FFSOURCE.name,ffmpegSha256=FFSHA,
+ deinterlaceModule=pkg.audit_ffmpeg(FF)['filterModule']['correspondingSource'],
instructions='docs/BUILD_2.0.8_TEST.md',displayVersionOverride='-DVEYRA_DISPLAY_VERSION='+LABEL),files=payload(app))
document(app/'package-manifest.json',data);return data
def stage():
@@ -178,7 +182,8 @@ def source_archive():
return dict(path=str(SOURCE),sha256=sha(SOURCE),files=len(records),excludedTrackedCache=skipped)
def seal():
source=source_archive();rows=[]
- for p,h in [(FFSOURCE,FFSHA),(DEPSOURCE,DEPSHA)]:
+ module=pkg.audit_ffmpeg(FF)['filterModule']['correspondingSource']
+ for p,h in [(FFSOURCE,FFSHA),(DEPSOURCE,DEPSHA),(Path(module['archive']),module['sha256'])]:
assert sha(p)==h
with zipfile.ZipFile(p) as z:assert z.testzip() is None
linked=OUT/p.name
diff --git a/scripts/ffmpeg/build-deinterlace-module.py b/scripts/ffmpeg/build-deinterlace-module.py
index ebbc0e57..76323d8f 100644
--- a/scripts/ffmpeg/build-deinterlace-module.py
+++ b/scripts/ffmpeg/build-deinterlace-module.py
@@ -2,8 +2,10 @@ from pathlib import Path
import hashlib,json,os,subprocess,time,urllib.request,zipfile
import argparse
-parser=argparse.ArgumentParser();parser.add_argument('--task',default='issues41-45-20261016');args=parser.parse_args()
+parser=argparse.ArgumentParser();parser.add_argument('--task',default='issues41-45-20261016');parser.add_argument('--compile-only',action='store_true');args=parser.parse_args()
base=Path('E:/项目/Veyra');task=args.task
+import re
+assert re.fullmatch(r'[a-z0-9][a-z0-9.-]{0,79}',task)
root=Path(__file__).resolve().parents[2]
work=base/'build'/task/'ffmpeg-filter';logs=base/'logs'/task/'ffmpeg-filter'
tmp=base/'tmp'/task/'filter-build';prefix=base/'deps'/('ffmpeg-filter-'+task)
@@ -37,7 +39,7 @@ configuration=configure_source.read_text(encoding='utf8')
# This host has the Chinese-only MSVC banner. Detection must not require
# 'Microsoft' at column 0; retain the actual compiler, flags and ABI.
configuration=configuration.replace('grep -q ^Microsoft','grep -q Microsoft').replace('grep ^Microsoft','grep Microsoft')
-configure_source.write_text(configuration,encoding='utf8')
+if configuration!=configure_source.read_text(encoding='utf8'):configure_source.write_text(configuration,encoding='utf8')
env={key:value for key,value in os.environ.items() if not key.upper().startswith(('VEYRA_','QT_','QML_','QSG_'))}
env.update(TEMP=str(tmp),TMP=str(tmp),VSLANG='1033',PYTHONDONTWRITEBYTECODE='1')
setup=subprocess.run(['cmd.exe','/u','/d','/c',r'call C:\PROGRA~2\MICROS~3\2022\BUILDT~1\VC\Auxiliary\Build\vcvars64.bat >nul && set'],env=env,stdout=subprocess.PIPE,stderr=subprocess.DEVNULL,check=True)
@@ -60,6 +62,7 @@ flags=['--toolchain=msvc','--arch=x86_64','--target-os=win32','--disable-doc','-
'--ar='+str(msys/'usr/share/automake-1.18/ar-lib')+' lib.exe','--ranlib=:',
'--extra-cflags=-MD','--extra-cxxflags=-MD','--prefix='+str(prefix)]
commands=[('configure',[str(bash),'./configure',*flags]),('compile',[str(make),'-j8','libavfilter/avfilter-12.dll'])]
+if args.compile_only:commands=commands[1:]
start=time.monotonic()
for name,command in commands:
if (logs/(name+'.log')).exists():
@@ -97,4 +100,25 @@ receipt=dict(passed=True,tag='n9.0.1',commit=obj['sha'],archive=str(archive),arc
seconds=time.monotonic()-start,license='LGPL-2.1-or-later')
(logs/'receipt.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=2),encoding='utf8')
assert receipt['existingRuntimeFilesPreserved']
+# Preserve complete upstream source plus the actual local patch/build recipe.
+archive_out=base/'archives'/task/'FFmpeg-9.0.1-deinterlace-module-source.zip'
+archive_out.parent.mkdir(parents=True,exist_ok=True)
+with zipfile.ZipFile(archive) as upstream,zipfile.ZipFile(archive_out,'w',zipfile.ZIP_DEFLATED,6) as result:
+ for entry in upstream.infolist():
+ if entry.is_dir():continue
+ rel=Path(*Path(entry.filename).parts[1:])
+ content=(src/rel).read_bytes() if rel.as_posix() in ('configure','libavfilter/vf_deinterlace_d3d12.c') else upstream.read(entry)
+ result.writestr(entry.filename,content)
+ result.writestr('veyra-build/build-deinterlace-module.py',Path(__file__).read_bytes())
+ result.writestr('veyra-build/deinterlace-d3d12-async.patch',patch.read_bytes())
+ result.writestr('veyra-build/configuration.json',json.dumps(dict(upstreamCommit=obj['sha'],configuration=flags,receipt=receipt),ensure_ascii=False,indent=2))
+with zipfile.ZipFile(archive_out) as result:assert result.testzip() is None
+share=prefix/'share/ffmpeg';share.mkdir(parents=True,exist_ok=True)
+for name in ('COPYING.LGPLv2.1','LICENSE.md'):shutil.copy2(src/name,share/('filter-'+name))
+metadata=dict(schema=1,sourceTag='n9.0.1',sourceCommit=obj['sha'],license='LGPL-2.1-or-later',configuration=flags,
+ patchSha256=sha(patch),correspondingSource=dict(archive=str(archive_out),sha256=sha(archive_out)),
+ files=[dict(name='avfilter-12.dll',sha256=sha(dll),bytes=dll.stat().st_size)],existingRuntimeFilesPreserved=True)
+(share/'veyra-filter-build.json').write_text(json.dumps(metadata,ensure_ascii=False,indent=2),encoding='utf8')
+receipt['filterManifest']=str(share/'veyra-filter-build.json');receipt['correspondingSource']=metadata['correspondingSource']
+(logs/'receipt.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=2),encoding='utf8')
print('PASS',json.dumps(receipt,ensure_ascii=False),flush=True)
diff --git a/scripts/package-qml-release.py b/scripts/package-qml-release.py
index 22f95a8a..40aba8c7 100644
--- a/scripts/package-qml-release.py
+++ b/scripts/package-qml-release.py
@@ -144,6 +144,19 @@ def audit_ffmpeg(prefix):
for name in ('copyright','vcpkg.spdx.json'):
if not (prefix / 'share/zlib' / name).is_file():
raise ValueError('Missing zlib license or build provenance')
+ module_manifest = prefix / 'share/ffmpeg/veyra-filter-build.json'
+ if module_manifest.is_file():
+ module = json.loads(module_manifest.read_text(encoding='utf8'))
+ if module['sourceCommit'] != 'bf1b838f2ab88b4f8fd83443325c782ea0e0f7fa' or module['patchSha256'] != digest(ROOT / 'scripts/ffmpeg/deinterlace-d3d12-async.patch'):
+ raise ValueError('Deinterlacing module provenance mismatch')
+ for record in module['files']:
+ if record['name'] != 'avfilter-12.dll' or digest(prefix / 'bin' / record['name']) != record['sha256']:
+ raise ValueError('Deinterlacing module identity mismatch')
+ build['files'].append(record)
+ source = module['correspondingSource']
+ if digest(Path(source['archive'])) != source['sha256']:
+ raise ValueError('Deinterlacing module corresponding source missing or changed')
+ build['filterModule'] = module
return build
@@ -185,6 +198,8 @@ def main():
cache = (args.build / 'CMakeCache.txt').read_text(encoding='utf8')
ffmpeg = args.ffmpeg_root or Path(re.search(r'^VEYRA_FFMPEG_ROOT:[^=]+=(.+)$', cache, re.M).group(1))
ffbuild = audit_ffmpeg(ffmpeg)
+ if re.search(r'^VEYRA_ENABLE_DEINTERLACE:BOOL=ON$', cache, re.M) and 'filterModule' not in ffbuild:
+ raise ValueError('This build enables deinterlacing but its filter module is missing from the dependency prefix')
stage = args.output / ('Veyra-' + args.label + '-win64-portable')
archive = Path(str(stage) + '.zip')
if stage.exists() or archive.exists():
@@ -231,6 +246,10 @@ def main():
if digest(source) != record['sha256'].lower():
raise ValueError('Patched FFmpeg binary mismatch: ' + record['name'])
copy(source, record['name'])
+ if 'filterModule' in ffbuild:
+ for source, target in [('veyra-filter-build.json','FFMPEG-DEINTERLACE-BUILD.json'),
+ ('filter-COPYING.LGPLv2.1','FFMPEG-DEINTERLACE-LICENSE.txt'),('filter-LICENSE.md','FFMPEG-DEINTERLACE-NOTICE.md')]:
+ copy(ffmpeg / 'share/ffmpeg' / source,'licenses/' + target)
if not (stage / 'dav1d.dll').is_file():
copy(ffmpeg / 'bin/dav1d.dll', 'dav1d.dll')
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index bd652908..f7b03013 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -532,7 +532,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
if(GetEnvironmentVariableW(L"VEYRA_TEST_COMMAND_SLOTS",testSlots,16))commandSlots=std::clamp(unsigned(_wtoi(testSlots)),6u,24u);
if(!gpu->initialize(commandSlots)){status(L"D3D12初始化失败,请查看诊断",true);break;}
auto ext=std::filesystem::path(path).extension().wstring();for(auto& c:ext)c=towlower(c);
- const bool isImage=ext==L".png"||ext==L".jpg"||ext==L".jpeg";
+ const bool isImage=!media::networkMediaInput(path)&&(ext==L".png"||ext==L".jpg"||ext==L".jpeg");
sink::RgbaImage image;
uint32_t width=0,height=0;double duration=0;
if(isImage){
diff --git a/src/media/FFmpegDeinterlacer.cpp b/src/media/FFmpegDeinterlacer.cpp
index 584e72bb..12346059 100644
--- a/src/media/FFmpegDeinterlacer.cpp
+++ b/src/media/FFmpegDeinterlacer.cpp
@@ -10,7 +10,7 @@ extern "C" {
#include <libavutil/frame.h>
#include <libavutil/error.h>
}
-#if __has_include(<libavfilter/avfilter.h>)
+#if defined(VEYRA_ENABLE_DEINTERLACE) && __has_include(<libavfilter/avfilter.h>)
#define VEYRA_HAS_AVFILTER_HEADERS 1
extern "C" {
#include <libavfilter/avfilter.h>
diff --git a/tests/integration/NetworkInterlaceTests.cpp b/tests/integration/NetworkInterlaceTests.cpp
index 2c8b432f..e9bd4749 100644
--- a/tests/integration/NetworkInterlaceTests.cpp
+++ b/tests/integration/NetworkInterlaceTests.cpp
@@ -106,14 +106,21 @@ int wmain(int argc,wchar_t** argv){
if(media::networkMediaInput(desc.path))break;
check(input.seek({0,1}),"seek after EOF resets decoder and filter");
}
- unsigned count=0,pixelSamples=0;double last=-1e30,first=-1,comb=0;bool chronological=true,progressive=true;
+ unsigned count=0,pixelSamples=0,networkClockChanges=0;double last=-1e30,first=-1,comb=0;bool chronological=true,progressive=true;
const AVFrame* decoded=nullptr;pipeline::FramePacket packet;source::SourceReadStatus result;
while((result=input.read(packet,&decoded))==source::SourceReadStatus::Frame){
check(decoded!=nullptr,"decoded field exists");if(!decoded)break;
const double seconds=packet.pts.toDouble();
if(count==0)first=seconds;
- chronological=chronological&&!packet.pts.isUnknown()&&seconds>last;
- if(count&&fps>0)check(std::abs((seconds-last)-1/fps)<0.0001,"field PTS has requested real cadence");
+ const bool clockReset=(packet.flags&uint32_t(pipeline::FrameFlagBits::Discontinuity))!=0;
+ chronological=chronological&&!packet.pts.isUnknown()&&(seconds>last||(media::networkMediaInput(desc.path)&&clockReset));
+ if(count&&fps>0){
+ const bool regular=std::abs((seconds-last)-1/fps)<0.0001;
+ // RTSP's RTP/RTCP clock may legitimately rebase once sender
+ // reports arrive. Preserve its PTS and demand reset on reversal.
+ if(media::networkMediaInput(desc.path))networkClockChanges+=!regular;
+ else check(regular,"field PTS has requested real cadence");
+ }
if(pass&&count==0)check(packet.flags&uint32_t(pipeline::FrameFlagBits::Seek),"first post-seek field carries seek reset");
last=seconds;progressive=progressive&&!(decoded->flags&AV_FRAME_FLAG_INTERLACED);
AVFrame* downloaded=nullptr;const AVFrame* pixels=decoded;
@@ -147,7 +154,7 @@ int wmain(int argc,wchar_t** argv){
check(count>0&&chronological,"PTS strictly increases across every field");
if(desc.deinterlace)check(count>0&&progressive,"interlaced fields are delivered as progressive frames");
if(fps>0)check(std::abs(input.info().averageFps-fps)<0.01,"source metadata reports actual progressive rate");
- std::cout<<"RESULT pass="<<pass<<" count="<<count<<" first="<<first<<" last="<<last<<" comb="<<(pixelSamples?comb/pixelSamples:-1)<<" pixelSamples="<<pixelSamples<<" deinterlace="<<input.info().deinterlacePath<<" hardware="<<input.info().hardwareDecodeActive<<" failures="<<failures<<std::endl;
+ std::cout<<"RESULT pass="<<pass<<" count="<<count<<" first="<<first<<" last="<<last<<" comb="<<(pixelSamples?comb/pixelSamples:-1)<<" networkClockChanges="<<networkClockChanges<<" pixelSamples="<<pixelSamples<<" deinterlace="<<input.info().deinterlacePath<<" hardware="<<input.info().hardwareDecodeActive<<" failures="<<failures<<std::endl;
if(result==source::SourceReadStatus::Error)std::wcerr<<input.errorMessage()<<std::endl;
}
input.close();