From 1fbe51642bce656c95a9a564c95a1f46ac4e8829 Mon Sep 17 00:00:00 2001 From: sladro Date: Tue, 9 Dec 2025 14:32:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0include/frame/frame.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/frame/frame.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/include/frame/frame.h b/include/frame/frame.h index ba9e0be..32db93d 100644 --- a/include/frame/frame.h +++ b/include/frame/frame.h @@ -1,6 +1,11 @@ #pragma once +#include +#include #include +#include +#include +#include namespace rk3588 { @@ -12,16 +17,53 @@ enum class PixelFormat { UNKNOWN }; +struct Rect { + float x = 0.0f; + float y = 0.0f; + float w = 0.0f; + float h = 0.0f; +}; + +struct Detection { + int cls_id = -1; + float score = 0.0f; + Rect bbox{}; + int track_id = -1; +}; + +struct DetectionResult { + std::vector items; + int img_w = 0; + int img_h = 0; + std::string model_name; +}; + +struct FramePlane { + uint8_t* data = nullptr; + int stride = 0; // bytes per row + int size = 0; // valid bytes in this plane + int offset = 0; // offset from base data pointer +}; + struct Frame { int width = 0; int height = 0; PixelFormat format = PixelFormat::UNKNOWN; + // Fallback stride for single-plane formats; prefer per-plane stride. int stride = 0; int dma_fd = -1; uint64_t pts = 0; uint64_t frame_id = 0; + + uint8_t* data = nullptr; // base pointer if mapped to CPU + size_t data_size = 0; // total mapped buffer size + int plane_count = 0; + std::array planes{}; + + std::shared_ptr det; + std::shared_ptr user_meta; }; } // namespace rk3588