|
QGroundControl
Ground Control Station for MAVLink Drones
|
Recycles CPU-backed QVideoFrame storage keyed by (size, pixelFormat) to avoid per-frame malloc churn. More...
#include <CpuVideoFramePool.h>
Classes | |
| struct | PlaneLayout |
Public Member Functions | |
| QVideoFrame | acquireFrame (const QVideoFrameFormat &format, const GstVideoInfo &info) |
Returns a pool-backed frame sized to info, or freshly allocates on a pool miss; invalid if unsupported. | |
| quint64 | hitCount () const noexcept |
| Telemetry: total acquireFrame() calls satisfied from the pool vs. fresh alloc. | |
| quint64 | missCount () const noexcept |
| void | releaseBacking (QSize size, QVideoFrameFormat::PixelFormat format, QByteArray &&backing) |
| Return a backing array to the pool; called by PooledCpuVideoBuffer's destructor only. | |
Static Public Member Functions | |
| static CpuVideoFramePool & | instance () |
| static std::unique_ptr< QAbstractVideoBuffer > | wrapZeroCopy (GstBuffer *buffer, const GstVideoInfo &info, const QVideoFrameFormat &format) |
| static PlaneLayout | computeLayout (const GstVideoInfo &info) |
Destination plane layout mirroring info (strides/offsets from the decoder). planeCount==0 means unsupported. | |
| static QVideoFrame | copyFromBuffer (GstBuffer *buffer, const GstVideoInfo &videoInfo, const QVideoFrameFormat &format) |
Copy buffer's planes into a pool-allocated QVideoFrame; invalid on stride overflow or unsupported format. | |
Recycles CPU-backed QVideoFrame storage keyed by (size, pixelFormat) to avoid per-frame malloc churn.
Definition at line 17 of file CpuVideoFramePool.h.
| QVideoFrame CpuVideoFramePool::acquireFrame | ( | const QVideoFrameFormat & | format, |
| const GstVideoInfo & | info | ||
| ) |
Returns a pool-backed frame sized to info, or freshly allocates on a pool miss; invalid if unsupported.
Definition at line 230 of file CpuVideoFramePool.cc.
References CpuVideoFramePool::PlaneLayout::byteSize, computeLayout(), and CpuVideoFramePool::PlaneLayout::planeCount.
Referenced by copyFromBuffer().
|
static |
Destination plane layout mirroring info (strides/offsets from the decoder). planeCount==0 means unsupported.
Definition at line 157 of file CpuVideoFramePool.cc.
References CpuVideoFramePool::PlaneLayout::byteSize, CpuVideoFramePool::PlaneLayout::bytesPerLine, CpuVideoFramePool::PlaneLayout::height, CpuVideoFramePool::PlaneLayout::planeCount, and CpuVideoFramePool::PlaneLayout::planeOffset.
Referenced by acquireFrame().
|
static |
Copy buffer's planes into a pool-allocated QVideoFrame; invalid on stride overflow or unsupported format.
Definition at line 260 of file CpuVideoFramePool.cc.
References acquireFrame(), and instance().
Referenced by mapSampleToFrame().
|
inlinenoexcept |
Telemetry: total acquireFrame() calls satisfied from the pool vs. fresh alloc.
Definition at line 31 of file CpuVideoFramePool.h.
|
static |
Definition at line 151 of file CpuVideoFramePool.cc.
Referenced by copyFromBuffer().
|
inlinenoexcept |
Definition at line 33 of file CpuVideoFramePool.h.
| void CpuVideoFramePool::releaseBacking | ( | QSize | size, |
| QVideoFrameFormat::PixelFormat | format, | ||
| QByteArray && | backing | ||
| ) |
Return a backing array to the pool; called by PooledCpuVideoBuffer's destructor only.
Definition at line 198 of file CpuVideoFramePool.cc.
|
static |
Zero-copy CPU frame: wraps buffer and maps its system memory through to Qt. nullptr if not CPU-mappable (caller copies instead). Pins the decoder buffer for the frame's lifetime.
Definition at line 241 of file CpuVideoFramePool.cc.
Referenced by mapSampleToFrame().