#pragma once #include #include #include #include #include #include namespace rk3588 { enum class PixelFormat { NV12, YUV420, RGB, BGR, 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{}; // Optional owner to keep underlying buffer alive (e.g., shared_ptr> or MPP buffer). std::shared_ptr data_owner; std::shared_ptr det; std::shared_ptr user_meta; }; } // namespace rk3588