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

Preserve capture RGB chroma and opaque source pixels

Veyra Goal Agentd731ccf60cdf
diff --git a/docs/REVIEW_CAPTURE_RGB_2026-09-08.md b/docs/REVIEW_CAPTURE_RGB_2026-09-08.md
new file mode 100644
index 00000000..66b3ea2f
--- /dev/null
+++ b/docs/REVIEW_CAPTURE_RGB_2026-09-08.md
@@ -0,0 +1,7 @@
+# Cycle62 independent review — 2026-09-08
+
+review_capture_rgb, new-context read-only: scoped PASS, no introduced P0/P1/P2. Tracked fingerprint unchanged: 897bd69d35f1f94f7b08b59e2deb78c7e262f996.
+
+Independent preflight71/71; phase7 75/75, logs/delivery/afe022a9598943edb924ab1e745dbe6f/result.json, 41.407 seconds. App SHA256410EE473BDBCD8948D24589D8047F4A54FA6C30BA4E243F2B946D44EAF03B06A. Image tests logs/optimization-goal-20260908/image-9ac2822f03904d8c845683766a639ac1/,11.487 seconds with275 second watchdog: actual Feature18 Create0x1, non-null,SEH0; BGR0 alpha0 alternating redblue NR-off exact maxError8=0; NR-on4 Evaluates,2 NVOF,cut1. NR-on does not calculate pixel error: its logged0 is not a quality assertion. Independent quality1080 NR60,NVOF59,GBV errors0,normalPathReadbackCount0,failures0.
+
+BGR0 opacity and channel order, shared linear graph, scene/cadence/reset and no normal readback reviewed. Physical capture/driver/audio/latency and actual cadence unexecuted; synthetic fixture does not enable SR/FG. Q4–Q7 and full Goal remain open. Export integrity implementation unchanged. Reviewer ran current binaries, did not independently rebuild.
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index efef3457..0ef4d114 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1134,3 +1134,13 @@ Q3 color: shared ColorMetadata resolver combines declared AVFrame fields with so
Commands: scripts/build.ps1 -Root . -Preset x64-release exit0 (build-color-capture.log); veyra_live_timing_tests.exe14 PASS (duration-unit.log); run-image-tests.ps1 (275s bound) and explicit25s-bounded PreviewGeometry/app tests. Latest phase7 via scripts/loop-gate.ps1 -Gate phase7 exit0; logs/delivery/f3fbdc84e9c54e718e03a94066df28bc/result.json41.453s appCDD4A16CC66A462A907EFA9EB82C10D22AA58A7B057BAEFDFAF4FB0EC055DC4F. Earlier duration gate e2fee...41.489s was previous app9A5C... . Latest small metadata-format changes covered by gate; GPU color goldens precede those small changes and await independent rerun. No new export integrity checks, publish, runtime change or shutdown. Independent review pending; Q4–Q7 open.
Independent scoped review PASS: docs/REVIEW_COLOR_TIMING_2026-09-08.md; actual GPU tests and phase7 rerun. Q3 direct RGB capture and Q4-Q7 remain.
+
+## Cycle62 — direct RGB capture (review pending)
+- CaptureCardSource now labels DirectShow RGB32 as BGR0 (unused alpha); EngineController selects direct RGB for capture. EnhanceGraph accepts BGR0/RGB0 with opaque alpha and preserves alpha only for RGBA/BGRA. Removes an application RGB→NV12 conversion, not upstream device compression.
+- Shared 64×36 scene/cadence analysis serves CPU YUV and live RGB. Static images remain single frame. No normal pixel readback added.
+- Build: scripts/build.ps1 -Root project -Preset x64-release, build-capture-rgb2.log exit0. Initial image test 1df8045c failed because fixture omitted enableNvofStandalone; production sets it. Fixed fixture to match product, no production bypass.
+- GPU image test image-1660346e66504f8bac949030915d7398 exit0, 11.706s (275s watchdog): alternating red/blue BGR0 alpha0 exact maxError8=0, opaque output, one detected cut; NR-on4 actual Evaluates and2 NVOF executes. Prior images/colors/tiles remain passed. This is synthetic source, not physical capture validation.
+- powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/loop-gate.ps1 -Gate phase7: 75 checks PASS, logs/delivery/8211c4bf969647d099f62cd3cd11d96a/result.json. App SHA256 410EE473BDBCD8948D24589D8047F4A54FA6C30BA4E243F2B946D44EAF03B06A.
+- Q4–Q7 and natural image tile quality remain; full Phase7/Goal stays in_progress. Existing export integrity unchanged.
+
+Cycle62 independent PASS: docs/REVIEW_CAPTURE_RGB_2026-09-08.md. phase7 afe022a9 41.407s, image9ac2822f11.487s. NR-on fixture error0 is unmeasured, not a pixel quality assertion. Next Q4: official DLSS guide31March2026 PDF pages20/35/37 verifies linear input IsHDR and exposure contract; local SR evaluate/isBypass still width-only (Create checks both), fix and GPU-test next.
diff --git a/loop/EVIDENCE.md b/loop/EVIDENCE.md
index 8aa9d009..2f03ff5f 100644
--- a/loop/EVIDENCE.md
+++ b/loop/EVIDENCE.md
@@ -460,3 +460,7 @@ Q3 color: shared ColorMetadata resolver combines declared AVFrame fields with so
Commands: scripts/build.ps1 -Root . -Preset x64-release exit0 (build-color-capture.log); veyra_live_timing_tests.exe14 PASS (duration-unit.log); run-image-tests.ps1 (275s bound) and explicit25s-bounded PreviewGeometry/app tests. Latest phase7 via scripts/loop-gate.ps1 -Gate phase7 exit0; logs/delivery/f3fbdc84e9c54e718e03a94066df28bc/result.json41.453s appCDD4A16CC66A462A907EFA9EB82C10D22AA58A7B057BAEFDFAF4FB0EC055DC4F. Earlier duration gate e2fee...41.489s was previous app9A5C... . Latest small metadata-format changes covered by gate; GPU color goldens precede those small changes and await independent rerun. No new export integrity checks, publish, runtime change or shutdown. Independent review pending; Q4–Q7 open.
Cycles56-61 independent review_color_timing PASS: docs/REVIEW_COLOR_TIMING_2026-09-08.md. Full Goal still open.
+
+Cycle62 RGB capture: image-1660346e66504f8bac949030915d7398 11.706s PASS, exact saturated color / opaque BGR0, cut1 NR4 NVOF2. phase7 8211c4bf969647d099f62cd3cd11d96a PASS; app410EE473... Review pending; real capture unexecuted.
+
+Cycle62 independent scoped PASS: docs/REVIEW_CAPTURE_RGB_2026-09-08.md; full Goal not approved.
diff --git a/loop/JOURNAL.md b/loop/JOURNAL.md
index 27b137af..59ece2a0 100644
--- a/loop/JOURNAL.md
+++ b/loop/JOURNAL.md
@@ -1434,3 +1434,9 @@ Q3 color: shared ColorMetadata resolver combines declared AVFrame fields with so
Commands: scripts/build.ps1 -Root . -Preset x64-release exit0 (build-color-capture.log); veyra_live_timing_tests.exe14 PASS (duration-unit.log); run-image-tests.ps1 (275s bound) and explicit25s-bounded PreviewGeometry/app tests. Latest phase7 via scripts/loop-gate.ps1 -Gate phase7 exit0; logs/delivery/f3fbdc84e9c54e718e03a94066df28bc/result.json41.453s appCDD4A16CC66A462A907EFA9EB82C10D22AA58A7B057BAEFDFAF4FB0EC055DC4F. Earlier duration gate e2fee...41.489s was previous app9A5C... . Latest small metadata-format changes covered by gate; GPU color goldens precede those small changes and await independent rerun. No new export integrity checks, publish, runtime change or shutdown. Independent review pending; Q4–Q7 open.
Cycles56-61 review finished: scoped PASS, no project writes by reviewer; checkpoint before next atomic RGB capture change.
+
+Cycle62 before edit: bypass capture RGB32 -> NV12 conversion; use BGR0 opaque pixels, share CPU luma scene/cadence analysis with YUV path, verify GPU RGB goldens. Keep real capture acceptance pending.
+
+Cycle62 after edit: build/GPU image/phase7 passed. First fixture failure was missing standalone motion flag; production already set it. Freeze checkout for independent readonly reviewer.
+
+Cycle62 reviewer PASS, freeze lifted. Checkpoint; next atomic Q4 SR linear-input flags/exposure and extent bypass with actual GPU outputs.
diff --git a/loop/STATE.json b/loop/STATE.json
index 4e9cb0c5..a6604044 100644
--- a/loop/STATE.json
+++ b/loop/STATE.json
@@ -76,19 +76,19 @@
}
],
"cycle": {
- "completed": 61,
+ "completed": 62,
"maximum": 120,
"sameFailureAttempts": 0,
"maximumSameFailureAttempts": 3,
"noProgressCycles": 0,
"maximumNoProgressCycles": 5
},
- "currentTask": "Cycles56-61 independently reviewed PASS; proceed to direct RGB capture",
+ "currentTask": "Cycle62 direct RGB capture independently reviewed PASS",
"lastGate": {
"name": "phase7",
"status": "passed",
"exitCode": 0,
- "evidence": "logs/delivery/f3fbdc84e9c54e718e03a94066df28bc/result.json41.453s appCDD4A16..."
+ "evidence": "logs/delivery/8211c4bf969647d099f62cd3cd11d96a/result.json app410EE473..."
},
"lastFailureFingerprint": "",
"failureLedger": [
@@ -107,8 +107,8 @@
"Current USB2 1080p50 physical throughput passed; user perceived latency/audio/actual FG display cadence still need confirmation.",
"Public proprietary runtime distribution rights unresolved; local delivery only."
],
- "nextAction": "Implement and verify direct RGB capture with opaque BGR0 and shared scene/cadence analysis; then Q4-Q7.",
- "updatedAt": "2026-09-08T09:32:12.0342288Z",
+ "nextAction": "Q4: set official linear SR input flags/exposure, fix width-only evaluate/isBypass, verify actual GPU color and extent outputs; then Q5-Q7",
+ "updatedAt": "2026-09-08T09:45:28.2172149Z",
"deliveryPlan": "docs/ACTIVE_DELIVERY_PLAN.md",
"captureAcceptance": "throughput_short_test_passed_user_latency_audio_pending",
"testInvocationLimitSeconds": 300,
@@ -123,7 +123,8 @@
"Cycle55 saved failure/retry recovered: save-recovery-15610...; image988453...6.515s includes multi-band PNG/JPEG; phase7 04815...41.246s",
"docs/REVIEW_IMAGES_PREVIEW_2026-09-08.md: independent scoped PASS; final phase7 3e2dd555...41.144s; save retry and image matrix independently verified",
"Cycles56-61:2Dtile,actualGPUpreview,rootqueuehover,odd/tallH264,14 timing checks,4 GPU color goldens; review pending",
- "docs/REVIEW_COLOR_TIMING_2026-09-08.md: scoped independent PASS; phase7 31051b6d 41.143s, image GPU matrix and timing14 passed"
+ "docs/REVIEW_COLOR_TIMING_2026-09-08.md: scoped independent PASS; phase7 31051b6d 41.143s, image GPU matrix and timing14 passed",
+ "docs/REVIEW_CAPTURE_RGB_2026-09-08.md: independent phase7afe022a9 41.407s and image9ac2822f11.487s PASS; synthetic RGB only"
],
"reviewBaseCommit": "6f0ebaa687e3966d989bf138c86b6882380f20fb",
"localDelivery": "capture_fix_candidate_needs_review",
@@ -262,7 +263,7 @@
"productModified": true,
"consecutiveBlockedGoalTurns": 0,
"previousGoalTurnClassification": "progress: checkpoint3b2806b reviewed image/preview and save recovery",
- "currentGoalTurnClassification": "progress: input/preview evidence, actual odd/tall video, capture duration and shared color correction",
+ "currentGoalTurnClassification": "progress: color/timing checkpoint0dee6c1 and reviewed direct RGB capture",
"controlSynchronizationAuthorization": "2026-09-08 user: 确认,给你全部权限; applies to previously proposed exact two-hash synchronization"
}
}
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index beb36170..dc68687b 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -91,7 +91,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options){
width=activeSource->info().width;height=activeSource->info().height;duration=activeSource->info().duration.toDouble();
}
if(!pipeline::Extent{width,height}.valid()){status(L"图像尺寸超出单张GPU纹理能力,需要分块处理",true);break;}
- pipeline::EnhanceGraphDesc gd;gd.sourceWidth=width;gd.sourceHeight=height;gd.rgbInput=isImage;gd.stillImage=isImage;
+ pipeline::EnhanceGraphDesc gd;gd.sourceWidth=width;gd.sourceHeight=height;gd.rgbInput=isImage||isCapture;gd.stillImage=isImage;
const auto resolution=pipeline::ResolutionPlan::make({width,height},options.sr,options.realtime?pipeline::NrSizePolicy::Realtime:pipeline::NrSizePolicy::Native,isImage,1);
gd.workWidth=resolution.base.width;gd.workHeight=resolution.base.height;gd.nrWidth=resolution.nr.width;gd.nrHeight=resolution.nr.height;
gd.enableSr=resolution.srApplied;gd.enableNr=options.nr;gd.enableFg=options.fg;gd.fgMultiplier=options.fgMultiplier;gd.enableNvofStandalone=options.nr;
diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cpp
index 9706e203..d9ffc697 100644
--- a/src/pipeline/EnhanceGraph.cpp
+++ b/src/pipeline/EnhanceGraph.cpp
@@ -654,15 +654,42 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
if (list == nullptr) { veyra::log::error("graph", "ring acquire"); return false; }
gpuTimer_.frame({epoch_,desc_.settingsRevision,realFrameIndex_+1},context_.fence());gpuTimer_.mark(list,GpuStage::Color);
+ // Both CPU source layouts feed the same bounded scene/cadence history.
+ auto analyzeLuma = [&](std::vector<uint8_t> sample) {
+ std::vector<double> hist(256,0);double sad=0;
+ for(auto v:sample)hist[v]+=1.0/sample.size();
+ if(previousLuma_.size()==sample.size())for(size_t i=0;i<sample.size();++i)sad+=std::abs(int(sample[i])-int(previousLuma_[i]))/(255.0*sample.size());
+ cadence_.observe(ptsMs,sad,previousLuma_.size()==sample.size());
+ out.measuredContentRate=cadence_.confirmedRate(desc_.contentRate);
+ if(cadence_.conflicts(desc_.contentRate)&&realFrameIndex_%60==0)veyra::log::warn("cadence","requested content-rate identification conflicts with observed motion; preserving source timestamps");
+ out.contentDuplicate=desc_.contentRate!=engine::ContentRate::Transport&&previousLuma_.size()==sample.size()&&sad<0.0001;
+ const auto analysis=scene_.analyze(realFrameIndex_,hist,sad,static_cast<uint64_t>(std::max(0.0,ptsMs)*1000));
+ if(analysis.isSceneCut||analysis.isCadenceBreak){reset=true;prevValid_=false;if(analysis.isSceneCut)++metrics_.sceneCutCount;}
+ previousLuma_=std::move(sample);
+ };
+
if(desc_.rgbInput){
- if(frame->format!=AV_PIX_FMT_RGBA&&frame->format!=AV_PIX_FMT_BGRA){
- veyra::log::error("graph","direct RGB input contract requires RGBA/BGRA frame");return false;
+ if(frame->format!=AV_PIX_FMT_RGBA&&frame->format!=AV_PIX_FMT_BGRA&&frame->format!=AV_PIX_FMT_RGB0&&frame->format!=AV_PIX_FMT_BGR0){
+ veyra::log::error("graph","direct RGB input contract requires packed RGBA/BGRA/RGB0/BGR0 frame");return false;
}
if(frame->width!=int(srcW_)||frame->height!=int(srcH_))return false;
for(uint32_t y=0;y<srcH_;++y){
auto* dst=mappedRgb_[parity]+y*rgbPitch_;const auto* src=frame->data[0]+ptrdiff_t(y)*frame->linesize[0];
if(frame->format==AV_PIX_FMT_RGBA)std::memcpy(dst,src,size_t(srcW_)*4);
- else for(uint32_t x=0;x<srcW_;++x){dst[x*4]=src[x*4+2];dst[x*4+1]=src[x*4+1];dst[x*4+2]=src[x*4];dst[x*4+3]=src[x*4+3];}
+ else for(uint32_t x=0;x<srcW_;++x){
+ const bool bgr=frame->format==AV_PIX_FMT_BGRA||frame->format==AV_PIX_FMT_BGR0;
+ dst[x*4]=src[x*4+(bgr?2:0)];dst[x*4+1]=src[x*4+1];dst[x*4+2]=src[x*4+(bgr?0:2)];
+ dst[x*4+3]=(frame->format==AV_PIX_FMT_BGRA)?src[x*4+3]:255;
+ }
+ }
+ if(!desc_.stillImage){
+ std::vector<uint8_t> sample;sample.reserve(64*36);
+ const bool bgr=frame->format==AV_PIX_FMT_BGRA||frame->format==AV_PIX_FMT_BGR0;
+ for(unsigned y=0;y<36;++y)for(unsigned x=0;x<64;++x){
+ const auto* p=frame->data[0]+ptrdiff_t(y*srcH_/36)*frame->linesize[0]+(x*srcW_/64)*4;
+ sample.push_back(uint8_t((54*unsigned(p[bgr?2:0])+183*unsigned(p[1])+19*unsigned(p[bgr?0:2])+128)>>8));
+ }
+ analyzeLuma(std::move(sample));
}
tracker_.transition(list,rgbTex_.Get(),D3D12_RESOURCE_STATE_COPY_DEST);
D3D12_TEXTURE_COPY_LOCATION dst{},src{};dst.pResource=rgbTex_.Get();dst.Type=D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
@@ -744,16 +771,9 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
uint8_t* planes[2] = { directUpload?mappedLuma_[parity]:nv12Buf_.data(), directUpload?mappedChroma_[parity]:nv12Buf_.data() + lumaSize_ };
const int strides[2] = { static_cast<int>(lumaPitch_), static_cast<int>(chromaPitch_) };
sws_scale(nv12Ctx_, frame->data, frame->linesize, 0, frame->height, planes, strides);
- std::vector<uint8_t> sample;sample.reserve(64*36);std::vector<double> hist(256,0);double sad=0;
- for(unsigned y=0;y<36;++y)for(unsigned x=0;x<64;++x){const uint8_t v=directUpload?frame->data[0][ptrdiff_t(y*srcH_/36)*frame->linesize[0]+x*srcW_/64]:planes[0][size_t(y*srcH_/36)*lumaPitch_+x*srcW_/64];hist[v]+=1.0/(64*36);sample.push_back(v);}
- if(previousLuma_.size()==sample.size())for(size_t i=0;i<sample.size();++i)sad+=std::abs(int(sample[i])-int(previousLuma_[i]))/(255.0*sample.size());
- cadence_.observe(ptsMs,sad,previousLuma_.size()==sample.size());
- out.measuredContentRate=cadence_.confirmedRate(desc_.contentRate);
- if(cadence_.conflicts(desc_.contentRate)&&realFrameIndex_%60==0)veyra::log::warn("cadence","requested content-rate identification conflicts with observed motion; preserving source timestamps");
- out.contentDuplicate=desc_.contentRate!=engine::ContentRate::Transport&&previousLuma_.size()==sample.size()&&sad<0.0001;
- const auto analysis=scene_.analyze(realFrameIndex_,hist,sad,static_cast<uint64_t>(std::max(0.0,ptsMs)*1000));
- if(analysis.isSceneCut||analysis.isCadenceBreak){reset=true;prevValid_=false;if(analysis.isSceneCut)++metrics_.sceneCutCount;}
- previousLuma_=std::move(sample);
+ std::vector<uint8_t> sample;sample.reserve(64*36);
+ for(unsigned y=0;y<36;++y)for(unsigned x=0;x<64;++x){const uint8_t v=directUpload?frame->data[0][ptrdiff_t(y*srcH_/36)*frame->linesize[0]+x*srcW_/64]:planes[0][size_t(y*srcH_/36)*lumaPitch_+x*srcW_/64];sample.push_back(v);}
+ analyzeLuma(std::move(sample));
if(!directUpload){for (uint32_t y = 0; y < srcH_; ++y)
std::memcpy(mappedLuma_[parity] + y * lumaPitch_, planes[0] + y * lumaPitch_, srcW_);
for (uint32_t y = 0; y < (srcH_+1) / 2; ++y)
diff --git a/src/source/CaptureCardSource.cpp b/src/source/CaptureCardSource.cpp
index b4563b9b..813e4b21 100644
--- a/src/source/CaptureCardSource.cpp
+++ b/src/source/CaptureCardSource.cpp
@@ -101,7 +101,7 @@ bool CaptureCardSource::configure(const SourceOpenDesc& desc){close();p_->lastAu
if(FAILED(p.graph.As(&p.control))||FAILED(p.graph.As(&p.events))||FAILED(p.grab->SetBufferSamples(FALSE))||FAILED(p.grab->SetCallback(&p,0)))return false;
for(auto** f:{&p.frame,&p.pendingFrame}){
*f=av_frame_alloc();if(!*f)return false;
- (*f)->format=AV_PIX_FMT_BGRA;(*f)->width=p.info.width;(*f)->height=p.info.height;(*f)->color_range=AVCOL_RANGE_JPEG;
+ (*f)->format=AV_PIX_FMT_BGR0;(*f)->width=p.info.width;(*f)->height=p.info.height;(*f)->color_range=AVCOL_RANGE_JPEG;
if(av_frame_get_buffer(*f,32)<0)return false;
}
p.info.color=pipeline::resolveFrameColor(*p.frame);p.configured=true;
diff --git a/tests/integration/ImageDimensionTests.cpp b/tests/integration/ImageDimensionTests.cpp
index 680fcebc..46dd676b 100644
--- a/tests/integration/ImageDimensionTests.cpp
+++ b/tests/integration/ImageDimensionTests.cpp
@@ -101,6 +101,30 @@ bool colorFallback(){
ok=test(128,128,128,AVCOL_TRC_UNSPECIFIED,142,142,142)&&test(128,128,128,AVCOL_TRC_IEC61966_2_1,130,130,130)&&test(128,128,128,AVCOL_TRC_LINEAR,189,189,189)&&test(81,90,240,AVCOL_TRC_UNSPECIFIED,255,0,0);
ring.drainQueue();graph.shutdown();av_frame_free(&f);ring.shutdown();ctx.shutdown();return ok;
}
+bool captureRgb(bool nr){
+ gfx::D3D12DeviceContext ctx;gfx::CommandSlotRing ring;Status st;gfx::DeviceContextDesc device;
+ if(!ctx.initialize(device,st)||!ring.initialize(ctx.device(),ctx.directQueue(),ctx.fence(),ctx.fenceEvent(),4,st))return false;
+ pipeline::EnhanceGraph graph(ctx,ring);pipeline::EnhanceGraphDesc gd;
+ gd.sourceWidth=gd.sourceHeight=gd.workWidth=gd.workHeight=256;gd.rgbInput=true;gd.enableNr=nr;gd.enableNvofStandalone=nr;gd.enableFg=false;gd.noFeatures=!nr;
+ gd.runtimeAbsPath=(std::filesystem::path(VEYRA_PROJECT_ROOT)/"runtime_local/nvidia").wstring();
+ if(!graph.initialize(gd)||!graph.createViews())return false;
+ AVFrame* f=av_frame_alloc();f->format=AV_PIX_FMT_BGR0;f->width=f->height=256;
+ if(av_frame_get_buffer(f,32)<0){av_frame_free(&f);return false;}
+ bool ok=true;int maxError=0;
+ for(unsigned frame=0;frame<4&&ok;++frame){
+ for(unsigned y=0;y<256;++y)for(unsigned x=0;x<256;++x){auto* p=f->data[0]+size_t(y)*f->linesize[0]+x*4;
+ // Adjacent saturated red/blue proves that no 4:2:0 averaging occurs.
+ p[0]=frame<2?(x%2?255:0):255;p[1]=frame<2?0:255;p[2]=frame<2?(x%2?0:255):255;p[3]=0;}
+ pipeline::EnhanceGraph::FrameOutputs out;sink::RgbaImage result;
+ ok=graph.process(f,frame*33.333333,frame==0,out,frame+1)&&sink::readRgba8(ctx,ring,graph.videoFrameResource(out.videoSlot),result);
+ if(ok&&!nr)for(unsigned y=0;y<256;++y)for(unsigned x=0;x<256;++x){auto* expected=f->data[0]+size_t(y)*f->linesize[0]+x*4;auto* actual=result.pixels.data()+(size_t(y)*256+x)*4;
+ for(unsigned c=0;c<3;++c)maxError=std::max(maxError,std::abs(int(actual[c])-int(expected[2-c])));ok=ok&&actual[3]==255;}
+ out={};
+ }
+ const auto m=graph.metrics();ok=ok&&maxError<=1&&m.sceneCutCount==1&&(!nr||(m.nrEvaluateCount==4&&m.nvofExecuteCount>=2));
+ std::cout<<"CAPTURE_RGB nr="<<nr<<" maxError8="<<maxError<<" cuts="<<m.sceneCutCount<<" nrEvaluations="<<m.nrEvaluateCount<<" nvof="<<m.nvofExecuteCount<<" pass="<<ok<<std::endl;
+ ring.drainQueue();graph.shutdown();av_frame_free(&f);ring.shutdown();ctx.shutdown();return ok;
+}
int wmain(int argc,wchar_t** argv){
if(argc!=2)return 2;CoInitializeEx(nullptr,COINIT_MULTITHREADED);std::filesystem::path directory(argv[1]);std::filesystem::create_directories(directory);
bool ok=true;for(auto e:{pipeline::Extent{1,1},{257,513},{97,9001},{4097,257},{257,4097}}){if(!run(e.width,e.height,false,directory)){ok=false;break;}}
@@ -113,5 +137,6 @@ int wmain(int argc,wchar_t** argv){
if(ok)ok=tiled(2561,2561,true,directory);
if(ok)ok=codecBands(directory);
if(ok)ok=colorFallback();
+ if(ok)ok=captureRgb(false)&&captureRgb(true);
CoUninitialize();return ok?0:1;
}