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++
Initialize hardware filter sources with their frame context and add playback regression
Veyra Goal Agent3c3793241e5a
diff --git a/src/media/FFmpegDeinterlacer.cpp b/src/media/FFmpegDeinterlacer.cppindex 15222504..584e72bb 100644--- a/src/media/FFmpegDeinterlacer.cpp+++ b/src/media/FFmpegDeinterlacer.cpp@@ -28,6 +28,7 @@ struct FilterApi {#define FILTER_API(name) decltype(&::name) name=nullptrFILTER_API(avfilter_graph_alloc);FILTER_API(avfilter_graph_free);FILTER_API(avfilter_get_by_name);FILTER_API(avfilter_graph_create_filter);+ FILTER_API(avfilter_graph_alloc_filter);FILTER_API(avfilter_init_str);FILTER_API(avfilter_link);FILTER_API(avfilter_graph_config);FILTER_API(av_buffersrc_add_frame_flags);FILTER_API(av_buffersink_get_frame);FILTER_API(av_buffersink_get_time_base);FILTER_API(av_buffersrc_parameters_alloc);@@ -43,6 +44,7 @@ struct FilterApi {#define FILTER_API(name) name=reinterpret_cast<decltype(name)>(GetProcAddress(module,#name));if(!name)returnFILTER_API(avfilter_graph_alloc);FILTER_API(avfilter_graph_free);FILTER_API(avfilter_get_by_name);FILTER_API(avfilter_graph_create_filter);+ FILTER_API(avfilter_graph_alloc_filter);FILTER_API(avfilter_init_str);FILTER_API(avfilter_link);FILTER_API(avfilter_graph_config);FILTER_API(av_buffersrc_add_frame_flags);FILTER_API(av_buffersink_get_frame);FILTER_API(av_buffersink_get_time_base);FILTER_API(av_buffersrc_parameters_alloc);@@ -115,18 +117,20 @@ bool FFmpegDeinterlacer::open(const AVFrame* frame,const HardwareSurfaceView* sui.graph=a.avfilter_graph_alloc();if(!i.graph){av_frame_free(&input);return false;}const auto sar=input->sample_aspect_ratio.num>0&&input->sample_aspect_ratio.den>0?input->sample_aspect_ratio:AVRational{1,1};- const auto args=std::format("video_size={}x{}:pix_fmt={}:time_base={}/{}:pixel_aspect={}/{}:frame_rate={}/{}",- input->width,input->height,input->format,num,den,sar.num,sar.den,std::max(1,fpsNum),std::max(1,fpsDen));- int result=a.avfilter_graph_create_filter(&i.source,a.avfilter_get_by_name("buffer"),"in",args.c_str(),nullptr,i.graph);+ i.source=a.avfilter_graph_alloc_filter(i.graph,a.avfilter_get_by_name("buffer"),"in");+ int result=i.source?0:AVERROR(ENOMEM);if(result>=0){auto* parameters=a.av_buffersrc_parameters_alloc();if(!parameters)result=AVERROR(ENOMEM);else{+ parameters->format=input->format;parameters->width=input->width;parameters->height=input->height;+ parameters->time_base={num,den};parameters->sample_aspect_ratio=sar;parameters->frame_rate={std::max(1,fpsNum),std::max(1,fpsDen)};if(input->hw_frames_ctx)parameters->hw_frames_ctx=av_buffer_ref(input->hw_frames_ctx);parameters->color_space=input->colorspace;parameters->color_range=input->color_range;result=a.av_buffersrc_parameters_set(i.source,parameters);av_buffer_unref(¶meters->hw_frames_ctx);av_free(parameters);}}+ if(result>=0)result=a.avfilter_init_str(i.source,nullptr);const bool hardware=input->format==AV_PIX_FMT_D3D12;const char* name=hardware?"deinterlace_d3d12":"bwdif";const char* options=hardware?"method=default:mode=field:deint=interlaced":"mode=send_field:parity=auto:deint=interlaced";diff --git a/tests/integration/NetworkInterlaceTests.cpp b/tests/integration/NetworkInterlaceTests.cppindex 02eb9c7e..fa24a753 100644--- a/tests/integration/NetworkInterlaceTests.cpp+++ b/tests/integration/NetworkInterlaceTests.cpp@@ -1,6 +1,7 @@#include "veyra/source/MediaFileSource.h"#include "veyra/gfx/D3D12DeviceContext.h"#include "veyra/Log.h"+#include "veyra/engine/EngineController.h"#include <chrono>#include <thread>#include <filesystem>@@ -11,8 +12,36 @@ extern "C" {#include <libavutil/hwcontext.h>}using namespace veyra;+int enginePlayback(const wchar_t* path,const wchar_t* directory,const wchar_t* effects){+ CoInitializeEx(nullptr,COINIT_MULTITHREADED);+ const std::filesystem::path out=directory;std::filesystem::create_directories(out);+ Logger::instance().openFile((out/L"player.log").wstring());Logger::instance().setConsoleEnabled(false);+ HWND window=CreateWindowExW(0,L"STATIC",L"Network and deinterlace playback regression",WS_POPUP,0,0,960,540,nullptr,nullptr,GetModuleHandleW(nullptr),nullptr);+ if(!window)return 2;ShowWindow(window,SW_SHOWNOACTIVATE);+ engine::EngineController player;player.setVolume(0,true);+ engine::PlayerOptions options;options.nr=std::wstring_view(effects)==L"nr-xess";options.fg=options.nr;options.fgMultiplier=2;+ options.settings.nrRuntime=engine::NrRuntime::NvidiaOriginal;options.settings.nrPolicy=pipeline::NrSizePolicy::P1080;+ options.settings.frameGenerationBackend=engine::FrameGenerationBackend::Xess;+ player.open(window,path,options);+ auto deadline=std::chrono::steady_clock::now()+std::chrono::seconds(35);+ uint64_t frames=0,generated=0;bool audio=false,failed=false,nr=false,fg=false,playing=false;+ while(std::chrono::steady_clock::now()<deadline){+ MSG msg;while(PeekMessageW(&msg,nullptr,0,0,PM_REMOVE)){TranslateMessage(&msg);DispatchMessageW(&msg);}+ const auto s=player.snapshot();failed|=s.failed;audio|=s.audioAvailable;nr|=s.nrActive;fg|=s.fgActive;+ frames=std::max(frames,s.metrics.flow.counters.realPresented);generated=std::max(generated,s.metrics.flow.counters.generatedPresented);+ playing|=s.transport==engine::TransportState::Playing;+ if(failed||s.transport==engine::TransportState::Ended||frames>=100)break;+ std::this_thread::sleep_for(std::chrono::milliseconds(5));+ }+ const auto stopAt=std::chrono::steady_clock::now();player.stop();+ const auto stopMs=std::chrono::duration<double,std::milli>(std::chrono::steady_clock::now()-stopAt).count();+ DestroyWindow(window);+ std::cout<<"ENGINE frames="<<frames<<" generated="<<generated<<" audio="<<audio<<" nr="<<nr<<" fg="<<fg<<" failed="<<failed<<" playing="<<playing<<" stopMs="<<stopMs<<std::endl;+ return !failed&&playing&&frames>10&&stopMs<2500&&(!options.nr||(nr&&fg&&generated>0))?0:1;+}int wmain(int argc,wchar_t** argv){if(argc<3)return 2;+ if(std::wstring_view(argv[2])==L"engine")return argc>=4?enginePlayback(argv[1],argv[3],argc>=5?argv[4]:L"off"):2;std::atomic<bool> cancel=false;source::SourceOpenDesc desc;desc.path=argv[1];desc.cancelled=&cancel;if(std::wstring_view(argv[2])==L"cancel"){