更新include/frame/frame.h

This commit is contained in:
sladro 2025-12-09 14:32:15 +08:00
parent 6c4db875ac
commit 1fbe51642b

View File

@ -1,6 +1,11 @@
#pragma once
#include <array>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
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<Detection> 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<FramePlane, 3> planes{};
std::shared_ptr<DetectionResult> det;
std::shared_ptr<void> user_meta;
};
} // namespace rk3588