From 5816c0c38e2a7dce1bcbf88f9fdcc330358eea8d Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 23 Mar 2020 02:34:36 +0200 Subject: 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 Reviewed-by: Kieran Bingham --- src/qcam/main_window.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qcam/main_window.cpp') diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index e872bdd7..b13660bc 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -416,6 +416,8 @@ void MainWindow::stopCapture() if (!isCapturing_) return; + viewfinder_->stop(); + int ret = camera_->stop(); if (ret) qInfo() << "Failed to stop capture"; -- cgit v1.2.1