summaryrefslogtreecommitdiff
path: root/src/qcam/viewfinder.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-23 02:34:36 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-24 10:34:08 +0200
commit5816c0c38e2a7dce1bcbf88f9fdcc330358eea8d (patch)
treeadde4d8b21ea218f3d7e6500e8a9dc1fe6376600 /src/qcam/viewfinder.h
parentac828f937e5426d48f996a29e70ff1a6ab5c85e6 (diff)
qcam: viewfinder: Avoid memory copy when conversion isn't needed
If the frame buffer format is identical to the display format, the viewfinder still invokes the converter to perform what is essentially a slow memcpy(). Make it possible to skip that operation by creating a QImage referencing the buffer memory instead. A reference to the frame buffer is kept internally, and released when the next buffer is queued, pushing the current one out. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/qcam/viewfinder.h')
-rw-r--r--src/qcam/viewfinder.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h
index 54c0fa9d..4d0622a8 100644
--- a/src/qcam/viewfinder.h
+++ b/src/qcam/viewfinder.h
@@ -36,6 +36,7 @@ public:
int setFormat(const libcamera::PixelFormat &format, const QSize &size);
void render(libcamera::FrameBuffer *buffer, MappedBuffer *map);
+ void stop();
QImage getCurrentImage();
@@ -52,6 +53,7 @@ private:
libcamera::PixelFormat format_;
QSize size_;
+ libcamera::FrameBuffer *buffer_;
QImage image_;
QMutex mutex_; /* Prevent concurrent access to image_ */
};