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

feat(source): report display aspect, rotation, duration and a poster frame

Veyra Goal Agent7e2b04d5ede1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 84f67650..7cefad6e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -752,7 +752,7 @@ if(VEYRA_FFMPEG_ROOT AND EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavformat/avform
target_link_libraries(veyra_repair_fg_tests PRIVATE veyra_pipeline veyra_sinks veyra_nvof)
# Headless quality-core runner (Playbook R3.3): the phase5 gate's quality
- add_library(veyra_engine STATIC src/engine/EngineController.cpp src/engine/EngineControllerImage.cpp src/engine/TiledImageProcessor.cpp src/engine/PresetStore.cpp src/engine/VideoPresenter.cpp src/engine/VideoExportJob.cpp src/engine/ExportJobManager.cpp src/engine/Subtitles.cpp src/engine/FgCompatibilityProbe.cpp)
+ add_library(veyra_engine STATIC src/engine/EngineController.cpp src/engine/EngineControllerImage.cpp src/engine/PosterFrame.cpp src/engine/TiledImageProcessor.cpp src/engine/PresetStore.cpp src/engine/VideoPresenter.cpp src/engine/VideoExportJob.cpp src/engine/ExportJobManager.cpp src/engine/Subtitles.cpp src/engine/FgCompatibilityProbe.cpp)
target_sources(veyra_pipeline PRIVATE src/guidance/AmdOpticalFlow.cpp
src/guidance/GpuDisOpticalFlow.cpp third_party/gpu-dis/src/gpu/native_strict_dis_provider.cpp)
target_include_directories(veyra_pipeline PRIVATE third_party/gpu-dis/src/gpu)
diff --git a/docs/UI_MIGRATION_EXECUTION_2026-09-25.md b/docs/UI_MIGRATION_EXECUTION_2026-09-25.md
index 192721a4..6d063c8d 100644
--- a/docs/UI_MIGRATION_EXECUTION_2026-09-25.md
+++ b/docs/UI_MIGRATION_EXECUTION_2026-09-25.md
@@ -16,7 +16,8 @@
| S0.2 | 构建与现有测试基线 | 完成 | `checkpoint/ui-mig-s0` | 600/600 目标构建通过;交付门槛 PASS |
| S0.3 | 抓帧哈希基线 | 完成 | `checkpoint/ui-mig-s0` | 13 种配置 × 24 帧,两次运行完全一致 |
| S0.4 | 性能 / 延迟基线 | 完成 | `checkpoint/ui-mig-s0` | 4 种播放场景 |
-| S1.1 | 合并图描述构建 | 完成 | `checkpoint/ui-mig-s1.1` | 5 处合并为 `describeStages()`;13 项哈希一致 |
+| S1.1 | 合并图描述构建 | 完成 | `checkpoint/ui-mig-s1.1` | 6 处合并为 `describeStages()`;13 项哈希一致 |
+| S1.7 | 快照补字段(宽高比 / 时长 / 封面) | 完成 | `checkpoint/ui-mig-s1.7` | 宽高比与时长实测正确;关键哈希一致 |
## 发现并修复的 bug
@@ -24,10 +25,18 @@
|---|---|---|---|
| B1 | S0.2 | `veyra_live_timing_tests` 的“输出上限仍会跳过候选帧”断言一直失败:09-22 把输出上限改到独立时间网格(`rateSubmitted`)后,测试只调用了 `submitted()`,测的是旧行为。产品逻辑正确,测试过期 | 测试补上 `rateSubmitted()` |
| B3 | S1.1 | 非 NVIDIA 显卡上,`initializePreview` 的能力归一化分支把 `enableSr` 直接写成 false,AMD FSR 超分(唯一的跨厂商超分)在预览里永远不生效,而 `disableUnsupportedNvidiaEffects` 是特意保留它的。导出路径没有这个问题 | 5 处描述合并进 `describeStages()`,两边同一套规则 |
+| B4 | S1.7 | 新建的 `PosterFrame.cpp` 直接把 FFmpeg 头文件放在 C++ 作用域里引用,`sws_*` 按 C++ 名字改编,链接必然失败(“无法解析的外部符号”)。项目里其它 FFmpeg 使用者都用 `extern "C" {}` 包住,新文件漏了 | 用 `extern "C" {}` 包住三个 FFmpeg 头;同时确认 `veyra_engine` 不需要额外链接 FFmpeg 库 |
| B2 | S0.2 | `veyra_quality_probe` 用 ANSI `argv` 转宽字符,输出目录含中文(`E:\项目`)时写图失败,交付门槛因此失败;门槛脚本原先用相对路径绕开,但源码在 C:、日志在 E: 时相对路径无法跨盘 | 探针改为从 UTF-16 命令行读参数;门槛改传绝对路径 |
## 日志
+### S1.7(2026-09-25)快照补字段
+- `SourceInfo` 新增 `displayAspect`(应用容器 SAR 与旋转后的显示宽高比)与 `rotationDegrees`;`FFmpegDemuxer` 增加 `sampleAspect()` / `rotationDegrees()`(读 `sample_aspect_ratio`、`rotate` 元数据和 `AV_PKT_DATA_DISPLAYMATRIX`,用 FFmpeg 6+ 的 `codecpar->coded_side_data` 接口)。
+- 四种源都填了这个字段:文件按 SAR+旋转计算;采集卡与屏幕捕获按格式尺寸;PS5 按请求尺寸或实际解码尺寸。原先完全没有宽高比信息,变形宽银幕片源会算错窗口大小。
+- `PlayerSnapshot` 新增 `sourceWidth/sourceHeight/sourceDisplayAspect/sourceRotationDegrees`(打开时即可用,不必等第一帧)和封面帧 `posterRgba/posterWidth/posterHeight`(新增 `src/engine/PosterFrame.cpp`,swscale 缩到最大 320×180,只在打开时算一次,失败就留空,不伪造)。
+- 抓帧探针现在同时输出源尺寸、宽高比、旋转和时长,便于以后回归。
+- 验证:1080p 测试片读出 `displayAspect=1.7778 rotation=0 duration=60.000`;13 项中的 5 项抽查哈希全部一致;完整构建通过。
+
### S1.1(2026-09-25)合并图描述构建
- 新增 `include/veyra/engine/GraphDescription.h`:`StageRequest` + `describeStages()`,把原先分散在 `EngineController.cpp`(初始打开、能力归一化、初始化失败降级、设置重建、串流尺寸切换、增强故障恢复共 6 处)和 `VideoExportJob.cpp` 的 `EnhanceGraphDesc` 填充合并成一处;尺寸策略、NR/超导顺序、厂商能力判断、参数下发全部由它决定。
- 各处的差异是历史遗留,不是有意区分:导出路径用 `Native` 尺寸、禁用 NR 先行、不走呈现端补帧,这些用 `StageRequest::exportJob` 表达;图片用 `stillImage` 表达。
diff --git a/include/veyra/engine/EngineController.h b/include/veyra/engine/EngineController.h
index b52b7abe..9a7151ad 100644
--- a/include/veyra/engine/EngineController.h
+++ b/include/veyra/engine/EngineController.h
@@ -52,6 +52,15 @@ struct PlayerSnapshot {
uint64_t seekRequested=0,seekPresented=0;double seekTarget=0;
double position=0,duration=0,fps=0,lateMs=0,lateP95Ms=0;
double nominalSourceFps=0;
+ // Source geometry for the UI: coded size and the container's display aspect
+ // ratio (0 = use coded size). Known at open time, before the first frame.
+ uint32_t sourceWidth=0,sourceHeight=0;
+ double sourceDisplayAspect=0.0;
+ int sourceRotationDegrees=0;
+ // Poster frame for the minimal-mode bar, as a small RGBA8 image. Empty when
+ // unavailable; the UI must not fabricate one.
+ std::vector<uint8_t> posterRgba;
+ uint32_t posterWidth=0,posterHeight=0;
diagnostics::FrameMetrics metrics;
std::optional<double> submissionFps;
uint32_t flowPerf=0;int contentFps=0;
diff --git a/include/veyra/engine/PosterFrame.h b/include/veyra/engine/PosterFrame.h
new file mode 100644
index 00000000..1b43c424
--- /dev/null
+++ b/include/veyra/engine/PosterFrame.h
@@ -0,0 +1,11 @@
+#pragma once
+#include <cstdint>
+#include <vector>
+struct AVFrame;
+namespace veyra::engine {
+// Small RGBA8 preview of one decoded frame for the UI (minimal-mode bar).
+// CPU-only, called once per open: never on the playback path. Returns false
+// when the frame cannot be converted; callers keep an empty poster rather
+// than fabricating one.
+bool makePosterFrame(const AVFrame* frame,uint32_t maxWidth,uint32_t maxHeight,std::vector<uint8_t>& rgba,uint32_t& width,uint32_t& height);
+}
diff --git a/include/veyra/media/FFmpegDemuxer.h b/include/veyra/media/FFmpegDemuxer.h
index 8b7de717..04c330bc 100644
--- a/include/veyra/media/FFmpegDemuxer.h
+++ b/include/veyra/media/FFmpegDemuxer.h
@@ -40,6 +40,12 @@ public:
int videoTimeBaseNum() const; // stream time_base for frame PTS conversion
int videoTimeBaseDen() const;
std::string formatName() const;
+ // Stream sample aspect ratio (numerator, denominator) as stored in the
+ // container; 0/0 = unknown. The display aspect is this ratio applied to the
+ // coded size, then swapped for 90/270 degree rotations.
+ void sampleAspect(int& num, int& den) const;
+ // Container display-matrix rotation in degrees (0/90/180/270); 0 = none.
+ int rotationDegrees() const;
// Returns false at end of file. The packet stays owned by this demuxer
// and remains valid until the next call.
diff --git a/include/veyra/source/IFrameSource.h b/include/veyra/source/IFrameSource.h
index f2cbcf20..da20e76e 100644
--- a/include/veyra/source/IFrameSource.h
+++ b/include/veyra/source/IFrameSource.h
@@ -32,6 +32,13 @@ struct SourceInfo {
pipeline::SourceKind kind = pipeline::SourceKind::Unknown;
uint32_t width = 0;
uint32_t height = 0;
+ // Display aspect ratio (width/height) after the container's sample aspect
+ // ratio and rotation are applied. 0 = unknown, use width/height. Live
+ // sources report their format's ratio; files read it from the stream.
+ double displayAspect = 0.0;
+ // Rotation from the container display matrix, in degrees (0/90/180/270).
+ // Informational: the decoder does not rotate, the UI reports it.
+ int rotationDegrees = 0;
pipeline::Rational duration;
double averageFps = 0.0; // informational only; the pipeline is PTS-driven
int nominalRateNum = 0, nominalRateDen = 0; // candidate, not proof of CFR
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index 111858c8..895b390c 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -35,6 +35,7 @@
#include "veyra/gfx/CommandSlotRing.h"
#include "veyra/RuntimePaths.h"
#include "veyra/engine/GraphDescription.h"
+#include "veyra/engine/PosterFrame.h"
#include <avrt.h>
#include <chrono>
#include <filesystem>
@@ -235,7 +236,10 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
if(av_frame_get_buffer(imageFrame,32)<0){status(L"图片资源分配失败",true);break;}
for(unsigned y=0;y<image.height;++y)memcpy(imageFrame->data[0]+size_t(y)*imageFrame->linesize[0],image.pixels.data()+size_t(y)*image.width*4,size_t(image.width)*4);
width=image.width;height=image.height;options.fg=false;
- {std::lock_guard lock(mutex_);desired_.multiplier=1;snapshot_.image=true;snapshot_.desired=desired_;}
+ {std::lock_guard lock(mutex_);desired_.multiplier=1;snapshot_.image=true;snapshot_.desired=desired_;
+ snapshot_.sourceWidth=image.width;snapshot_.sourceHeight=image.height;
+ snapshot_.sourceDisplayAspect=image.height>0?double(image.width)/image.height:0.0;
+ snapshot_.sourceRotationDegrees=0;}
}else{
source::SourceOpenDesc od;od.path=path;
// Files use the same shared D3D12 device as the graph. Capture
@@ -301,6 +305,18 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
cachedPacket=firstPacket;
}
width=activeSource->info().width;height=activeSource->info().height;duration=isCapture?0:activeSource->info().duration.toDouble();
+ {std::lock_guard lock(mutex_);
+ const auto& si=activeSource->info();
+ snapshot_.sourceWidth=si.width;snapshot_.sourceHeight=si.height;
+ snapshot_.sourceDisplayAspect=si.displayAspect;
+ snapshot_.sourceRotationDegrees=si.rotationDegrees;
+ // Poster for the minimal-mode bar. Built once, from the frame
+ // we already decoded; failure leaves it empty on purpose.
+ std::vector<uint8_t> poster;uint32_t pw=0,ph=0;
+ const AVFrame* posterSource=cachedFrame?cachedFrame:imageFrame;
+ if(posterSource&&makePosterFrame(posterSource,320,180,poster,pw,ph)){
+ snapshot_.posterRgba=std::move(poster);snapshot_.posterWidth=pw;snapshot_.posterHeight=ph;
+ }else{snapshot_.posterRgba.clear();snapshot_.posterWidth=snapshot_.posterHeight=0;}}
{std::lock_guard lock(mutex_);snapshot_.sourceNotice=activeSource->info().dolbyVision.description();}
}
if(!pipeline::Extent{width,height}.valid()){status(L"图像尺寸超出单张GPU纹理能力,需要分块处理",true);break;}
diff --git a/src/engine/PosterFrame.cpp b/src/engine/PosterFrame.cpp
new file mode 100644
index 00000000..da24b38a
--- /dev/null
+++ b/src/engine/PosterFrame.cpp
@@ -0,0 +1,39 @@
+#include "veyra/engine/PosterFrame.h"
+
+// FFmpeg headers are C: they must be included inside extern "C", otherwise the
+// linker looks for C++-mangled names and every sws_* symbol goes unresolved.
+extern "C" {
+#include <libavutil/frame.h>
+#include <libavutil/pixfmt.h>
+#include <libswscale/swscale.h>
+}
+
+#include <algorithm>
+#include <cmath>
+
+namespace veyra::engine {
+// Small RGBA8 preview of one decoded frame for the UI (minimal-mode bar).
+// Uses swscale, so every pixel format the decoder can hand us is covered.
+// Deliberately CPU-only and called once per open: it must never touch the
+// playback path or the GPU queue. Returns false when the frame cannot be
+// converted; callers keep an empty poster instead of a fake one.
+bool makePosterFrame(const AVFrame* frame, uint32_t maxWidth, uint32_t maxHeight,
+ std::vector<uint8_t>& rgba, uint32_t& width, uint32_t& height) {
+ rgba.clear(); width = 0; height = 0;
+ if (frame == nullptr || frame->width <= 0 || frame->height <= 0 || maxWidth == 0 || maxHeight == 0) return false;
+ const double scale = std::min({1.0, double(maxWidth) / frame->width, double(maxHeight) / frame->height});
+ const int outWidth = std::max(2, int(std::lround(frame->width * scale)));
+ const int outHeight = std::max(2, int(std::lround(frame->height * scale)));
+ SwsContext* sws = sws_getCachedContext(nullptr, frame->width, frame->height,
+ static_cast<AVPixelFormat>(frame->format), outWidth, outHeight, AV_PIX_FMT_RGBA, SWS_BILINEAR, nullptr, nullptr, nullptr);
+ if (sws == nullptr) return false;
+ rgba.assign(size_t(outWidth) * outHeight * 4, 0);
+ uint8_t* destination[4] = {rgba.data(), nullptr, nullptr, nullptr};
+ int stride[4] = {outWidth * 4, 0, 0, 0};
+ const int rows = sws_scale(sws, frame->data, frame->linesize, 0, frame->height, destination, stride);
+ sws_freeContext(sws);
+ if (rows != outHeight) { rgba.clear(); return false; }
+ width = uint32_t(outWidth); height = uint32_t(outHeight);
+ return true;
+}
+}
diff --git a/src/media/FFmpegDemuxer.cpp b/src/media/FFmpegDemuxer.cpp
index 05935b7e..cb5e51a7 100644
--- a/src/media/FFmpegDemuxer.cpp
+++ b/src/media/FFmpegDemuxer.cpp
@@ -5,6 +5,10 @@
extern "C" {
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
+#include <libavutil/display.h>
+#include <libavutil/dict.h>
+#include <cmath>
+#include <cstdlib>
}
#include <format>
@@ -113,6 +117,43 @@ int FFmpegDemuxer::nominalRateDen() const {
return context_ && videoStreamIndex_ >= 0 ? context_->streams[videoStreamIndex_]->r_frame_rate.den : 0;
}
+void FFmpegDemuxer::sampleAspect(int& num, int& den) const
+{
+ num = 0; den = 0;
+ if (context_ == nullptr || videoStreamIndex_ < 0) return;
+ const AVRational sar = context_->streams[videoStreamIndex_]->sample_aspect_ratio;
+ if (sar.num > 0 && sar.den > 0) { num = sar.num; den = sar.den; return; }
+ // Fall back to the codec parameters when the stream field is unset.
+ const AVRational coded = context_->streams[videoStreamIndex_]->codecpar->sample_aspect_ratio;
+ if (coded.num > 0 && coded.den > 0) { num = coded.num; den = coded.den; }
+}
+
+int FFmpegDemuxer::rotationDegrees() const
+{
+ if (context_ == nullptr || videoStreamIndex_ < 0) return 0;
+ const AVStream* stream = context_->streams[videoStreamIndex_];
+ // av_display_rotation_get reads the container's display matrix (the same
+ // metadata players use); it returns degrees counter-clockwise.
+ const AVDictionaryEntry* rotate = av_dict_get(stream->metadata, "rotate", nullptr, 0);
+ if (rotate != nullptr) {
+ const int value = std::atoi(rotate->value);
+ if (value != 0) return ((value % 360) + 360) % 360;
+ }
+ // FFmpeg 6+ exposes stream side data through the packet-side-data API.
+ const AVPacketSideData* side = stream->codecpar->coded_side_data;
+ const int sideCount = stream->codecpar->nb_coded_side_data;
+ const uint8_t* matrix = nullptr;
+ for (int i = 0; i < sideCount; ++i) {
+ if (side[i].type == AV_PKT_DATA_DISPLAYMATRIX && side[i].size >= 9 * int(sizeof(int32_t))) { matrix = side[i].data; break; }
+ }
+ if (matrix == nullptr) return 0;
+ const double degrees = av_display_rotation_get(reinterpret_cast<const int32_t*>(matrix));
+ if (!std::isfinite(degrees)) return 0;
+ int normalized = int(std::lround(-degrees)) % 360;
+ if (normalized < 0) normalized += 360;
+ return normalized;
+}
+
const AVCodecParameters* FFmpegDemuxer::videoCodecParameters() const
{
if (context_ == nullptr || videoStreamIndex_ < 0) {
diff --git a/src/source/CaptureCardSource.cpp b/src/source/CaptureCardSource.cpp
index bd51b3b5..58e78b70 100644
--- a/src/source/CaptureCardSource.cpp
+++ b/src/source/CaptureCardSource.cpp
@@ -775,7 +775,7 @@ bool CaptureCardSource::configure(const SourceOpenDesc& desc){close();error_.cle
applyCaptureColorOverride(p.layout.color,colorOverride);
log::info("capture-color",std::format("manual space={} range={} effective transfer={} matrix={} primaries={} range={} (0=auto, space 1=PQ 2=HLG 3=709, range 1=limited 2=full)",space,captureColorRange(colorOverride),int(p.layout.color.transfer),int(p.layout.color.matrix),int(p.layout.color.primaries),int(p.layout.color.range)));
}
- p.info={};p.info.kind=pipeline::SourceKind::CaptureCard;p.info.width=p.layout.width;p.info.height=p.layout.height;p.info.averageFps=p.layout.duration>0?1e7/p.layout.duration:0;p.info.duration=pipeline::Rational::unknown();p.info.color=p.layout.color;
+ p.info={};p.info.kind=pipeline::SourceKind::CaptureCard;p.info.width=p.layout.width;p.info.height=p.layout.height;p.info.displayAspect=p.layout.height>0?double(p.layout.width)/p.layout.height:0.0;p.info.averageFps=p.layout.duration>0?1e7/p.layout.duration:0;p.info.duration=pipeline::Rational::unknown();p.info.color=p.layout.color;
if(expectedFps>0){
const bool accepted=captureFrameRateMatches(expectedFps,p.layout.duration);
log::info("capture-rate",std::format("requestedFps={:.6f} connectedFps={:.6f} accepted={} softwareLimiter=0",expectedFps,p.info.averageFps,accepted));
diff --git a/src/source/MediaFileSource.cpp b/src/source/MediaFileSource.cpp
index ffcc68bb..fb0fb308 100644
--- a/src/source/MediaFileSource.cpp
+++ b/src/source/MediaFileSource.cpp
@@ -210,6 +210,21 @@ bool MediaFileSource::open(const SourceOpenDesc& desc)
info_.kind = pipeline::SourceKind::File;
info_.width = static_cast<uint32_t>(decoder_.width());
info_.height = static_cast<uint32_t>(decoder_.height());
+ // Display aspect for the window fit: coded size, the stream's sample aspect
+ // ratio (anamorphic DVD/HD content), then 90/270 rotations swap the axes.
+ // A stream without a usable ratio keeps displayAspect = 0 (caller uses the
+ // coded size), which is what every pre-existing caller already assumed.
+ {
+ int num = 0, den = 0;
+ demuxer_.sampleAspect(num, den);
+ info_.rotationDegrees = demuxer_.rotationDegrees();
+ if (num > 0 && den > 0 && info_.width > 0 && info_.height > 0) {
+ double aspect = (double(info_.width) * num) / (double(info_.height) * den);
+ if (info_.rotationDegrees == 90 || info_.rotationDegrees == 270) aspect = 1.0 / aspect;
+ if (std::isfinite(aspect) && aspect > 0.0) info_.displayAspect = aspect;
+ }
+ veyra::log::info("source-file", std::format("display aspect={:.4f} sar={}/{} rotation={}", info_.displayAspect, num, den, info_.rotationDegrees));
+ }
const int64_t durUs = demuxer_.durationUs();
if (durUs > 0) {
info_.duration = pipeline::Rational{durUs, 1000000};
diff --git a/src/source/RemotePlaySource.cpp b/src/source/RemotePlaySource.cpp
index 3ae5619c..70ef32a0 100644
--- a/src/source/RemotePlaySource.cpp
+++ b/src/source/RemotePlaySource.cpp
@@ -114,6 +114,7 @@ bool RemotePlaySource::connect(const RemotePlayConnectDesc& desc)
info_.opened = true;
info_.kind = pipeline::SourceKind::RemotePlay;
info_.width = request_.video.width;
+ info_.displayAspect = request_.video.height>0?double(request_.video.width)/request_.video.height:0.0;
info_.height = request_.video.height;
info_.averageFps = static_cast<double>(request_.video.fps);
info_.nominalRateNum = static_cast<int>(request_.video.fps);
@@ -306,6 +307,7 @@ bool RemotePlaySource::drainDecoder(std::uint64_t sourceIndex, const pipeline::F
if (info_.width != static_cast<uint32_t>(decoderFrame_->width) ||
info_.height != static_cast<uint32_t>(decoderFrame_->height)) {
info_.width = static_cast<uint32_t>(decoderFrame_->width);
+ info_.displayAspect = decoderFrame_->height>0?double(decoderFrame_->width)/decoderFrame_->height:0.0;
info_.height = static_cast<uint32_t>(decoderFrame_->height);
packet.flags |= static_cast<pipeline::FrameFlags>(pipeline::FrameFlagBits::Resize);
}
diff --git a/src/source/ScreenCaptureSource.cpp b/src/source/ScreenCaptureSource.cpp
index 83e7dc90..042fbb49 100644
--- a/src/source/ScreenCaptureSource.cpp
+++ b/src/source/ScreenCaptureSource.cpp
@@ -221,7 +221,7 @@ bool ScreenCaptureSource::open(const SourceOpenDesc& desc){
p.session=p.pool.CreateCaptureSession(p.item);p.session.IsCursorCaptureEnabled(o.cursor);p.session.StartCapture();
}
if(p.poolSize.Width<=int(o.left+o.right)||p.poolSize.Height<=int(o.top+o.bottom))throw winrt::hresult_error(E_INVALIDARG,L"裁剪范围超出画面");
- p.info.opened=true;p.info.kind=pipeline::SourceKind::ScreenCapture;p.info.width=p.poolSize.Width-o.left-o.right;p.info.height=p.poolSize.Height-o.top-o.bottom;
+ p.info.opened=true;p.info.kind=pipeline::SourceKind::ScreenCapture;p.info.width=p.poolSize.Width-o.left-o.right;p.info.height=p.poolSize.Height-o.top-o.bottom;p.info.displayAspect=(p.poolSize.Height-o.top-o.bottom)>0?double(p.poolSize.Width-o.left-o.right)/(p.poolSize.Height-o.top-o.bottom):0.0;
p.updateRate(monitor);p.info.hardwareDecodeActive=true;
p.info.videoDecodePath=o.method==ScreenCaptureMethod::Wgc?"WGC shared GPU":"DXGI duplication shared GPU";
p.info.containerName="screen";p.info.videoCodecName="GPU RGB";p.info.videoPixelFormatName=p.hdr?"scRGB FP16":"BGRA8 sRGB";p.color();
diff --git a/tools/chain_hash_probe/main.cpp b/tools/chain_hash_probe/main.cpp
index 155f7ca4..46ee4563 100644
--- a/tools/chain_hash_probe/main.cpp
+++ b/tools/chain_hash_probe/main.cpp
@@ -119,6 +119,9 @@ int main() {
od.path = widen(input);
od.preferHardwareDecode = false; // CPU decode: bit-exact input every run
if (!src.open(od)) { std::fprintf(stderr, "open failed\n"); return 1; }
+ const auto& info = src.info();
+ std::fprintf(stderr, "source %ux%u displayAspect=%.4f rotation=%d duration=%.3f\n",
+ info.width, info.height, info.displayAspect, info.rotationDegrees, info.duration.toDouble());
pipeline::EnhanceGraphDesc gd{};
if (!configure(caseName, src.info().width, src.info().height, gd)) {
@@ -151,8 +154,10 @@ int main() {
(void)ring.waitIdle();
graph.shutdown();
- std::string json = std::format("{{\"case\":\"{}\",\"frames\":{},\"work\":\"{}x{}\",\"nr\":\"{}x{}\",\"hashes\":[",
- caseName, hashes.size(), graph.workWidth(), graph.workHeight(), graph.nrWidth(), graph.nrHeight());
+ std::string json = std::format("{{\"case\":\"{}\",\"frames\":{},\"source\":\"{}x{}\",\"displayAspect\":{:.4f},\"rotation\":{},\"duration\":{:.3f},\"work\":\"{}x{}\",\"nr\":\"{}x{}\",\"hashes\":[",
+ caseName, hashes.size(), info.width, info.height, info.displayAspect,
+ info.rotationDegrees, info.duration.toDouble(),
+ graph.workWidth(), graph.workHeight(), graph.nrWidth(), graph.nrHeight());
for (size_t n = 0; n < hashes.size(); ++n) json += (n ? ",\"" : "\"") + hashes[n] + "\"";
json += "]}\n";
std::fputs(json.c_str(), stdout);