Problem
`VideoReader::read()` calls `.clone()` on every frame:
```cpp
frame = cv::Mat(height_, width_, CV_8UC3, frameBGR_->data[0], frameBGR_->linesize[0]).clone();
```
The clone is necessary for correctness (the underlying `frameBGR_` buffer is reused on the next `read()`), but it doubles memory bandwidth for every frame.
For real-time processing of 4K video, this can be a significant bottleneck.
Suggested approach
Offer a zero-copy path where the user gets a `cv::Mat` that wraps the internal buffer directly. The contract would be that the reference is only valid until the next `read()` call. For example:
```cpp
bool read(cv::Mat& frame); // existing (cloned, always safe)
bool readRef(cv::Mat& frame); // zero-copy, invalidated by next read
```
Priority
Low — performance optimization.
Problem
`VideoReader::read()` calls `.clone()` on every frame:
```cpp
frame = cv::Mat(height_, width_, CV_8UC3, frameBGR_->data[0], frameBGR_->linesize[0]).clone();
```
The clone is necessary for correctness (the underlying `frameBGR_` buffer is reused on the next `read()`), but it doubles memory bandwidth for every frame.
For real-time processing of 4K video, this can be a significant bottleneck.
Suggested approach
Offer a zero-copy path where the user gets a `cv::Mat` that wraps the internal buffer directly. The contract would be that the reference is only valid until the next `read()` call. For example:
```cpp
bool read(cv::Mat& frame); // existing (cloned, always safe)
bool readRef(cv::Mat& frame); // zero-copy, invalidated by next read
```
Priority
Low — performance optimization.