载入中...
搜索中...
未找到
FrameCapturePreview.cpp
浏览该文件的文档.
11 return Result<T>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, std::move(message), "frame_capture"));
14 for (int shift = 24; shift >= 0; shift -= 8) out.push_back(static_cast<uint8_t>(value >> shift));
22 checksum.update(reinterpret_cast<const char*>(out.data() + start), static_cast<unsigned>(out.size() - start));
26 return std::isfinite(value) ? static_cast<uint8_t>(std::lround(std::clamp(value, 0.0, 1.0) * 255.0)) : 255;
29Result<FramePreview> frameCapturePreview(const FrameCaptureBuffer& b, const FramePreviewOptions& o) {
31 uint64_t(b.width) * b.height * framePixelBytes(b.format) != b.bytes->size() || !o.maxWidth || !o.maxHeight ||
32 o.maxWidth > 2048 || o.maxHeight > 2048 || !std::isfinite(o.rangeMin) || !std::isfinite(o.rangeMax) ||
33 o.rangeMax <= o.rangeMin || !std::isfinite(o.exposure) || std::abs(o.exposure) > 20 || o.channel < 0 ||
48 if (out.view != "linearDepth" && out.view != "scalar" && out.view != "rawChannels" && out.view != "normalWorld" &&
54 if ((out.view == "linearDepth" || (out.view == "scalar" && b.format == FramePixelFormat::Depth32Float)) &&
60 const double scale = (std::min)({1.0, double(o.maxWidth) / b.width, double(o.maxHeight) / b.height});
89 const double value = (values[static_cast<size_t>(o.channel)] - o.rangeMin) / (o.rangeMax - o.rangeMin);
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Definition ActionGuideExport.cpp:13
Result< FramePreview > frameCapturePreview(const FrameCaptureBuffer &b, const FramePreviewOptions &o)
Definition FrameCapturePreview.cpp:29
Status invalid(const char *message)
Definition OceanBindingInternal.h:21
@ InvalidArgument
constexpr size_t framePixelBytes(FramePixelFormat format)
Packed CPU bytes per pixel; pure value query, callable on any thread.
Definition FrameCapture.h:46
Result< double > frameCaptureLinearDepth(const FrameCaptureBuffer &b, uint32_t x, uint32_t y, const std::array< float, 16 > &matrix)
Reconstruct positive view depth using this snapshot's projection. @thread Any thread with CPU leases.
Definition FrameCaptureImage.cpp:58
Result< FramePixel > frameCapturePixel(const FrameCaptureBuffer &b, uint32_t x, uint32_t y)
Read CPU snapshot only; no callback, rendering, or GPU wait. @thread Any thread with a snapshot lease...
Definition FrameCaptureImage.cpp:12
@ Depth32Float
@ Rgba16Float
@ Emissive
@ Depth
@ Velocity
@ Normal
@ Final
@ Albedo
Immutable CPU attachment with producer-provided decoding metadata.
Definition FrameCapture.h:71
Explicit CPU preview transformation, separate from costly GPU capture.
Definition FrameCapturePreview.hpp:5
std::array< float, 16 > inverseProjection
Definition FrameCapturePreview.hpp:11
Encoded preview; width and height may differ from the original attachment.
Definition FrameCapturePreview.hpp:14