From patchwork Tue Aug 4 21:47:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 9204 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 0A783BD87B for ; Tue, 4 Aug 2020 21:47:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C650C60555; Tue, 4 Aug 2020 23:47:25 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tONj3B8j"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CC1E760597 for ; Tue, 4 Aug 2020 23:47:20 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5BFA6D84; Tue, 4 Aug 2020 23:47:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1596577640; bh=HSQtq0YpaIaTxOy0WeHU1lEPHqEBZox3cu1j1CXOoiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tONj3B8j5QOTWrW2NHghgRPiqvQTxo5an89oiROA3u2uOU0SWoI8zcIdVZ65zEN2z pHL45dOyykEG59SH5ZvAkStpwlVVluhSeZY2S6ud2sxq+tf56Q6gb0QCzzPkqkD/fc vb7ovepj/ausU5pKF3UIJzAtlUxOC4ZXxU9RSMi0= From: Kieran Bingham To: libcamera devel Date: Tue, 4 Aug 2020 22:47:09 +0100 Message-Id: <20200804214711.177645-12-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200804214711.177645-1-kieran.bingham@ideasonboard.com> References: <20200804214711.177645-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 11/13] android: camera_device: Generate ResultMetadata earlier X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Generate the ResultMetadata before performing JPEG compression so that JPEG specific metadata can be added to the metadata when it has been processed. Reviewed-by: Jacopo Mondi Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/android/camera_device.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 4178db952846..c529246e115c 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1198,6 +1198,8 @@ void CameraDevice::requestComplete(Request *request) const std::map &buffers = request->buffers(); camera3_buffer_status status = CAMERA3_BUFFER_STATUS_OK; std::unique_ptr resultMetadata; + Camera3RequestDescriptor *descriptor = + reinterpret_cast(request->cookie()); if (request->status() != Request::RequestComplete) { LOG(HAL, Error) << "Request not successfully completed: " @@ -1205,9 +1207,17 @@ void CameraDevice::requestComplete(Request *request) status = CAMERA3_BUFFER_STATUS_ERROR; } + /* + * \todo The timestamp used for the metadata is currently always taken + * from the first buffer (which may be the first stream) in the Request. + * It might be appropriate to return a 'correct' (as determined by + * pipeline handlers) timestamp in the Request itself. + */ + FrameBuffer *buffer = buffers.begin()->second; + resultMetadata = getResultMetadata(descriptor->frameNumber, + buffer->metadata().timestamp); + /* Prepare to call back the Android camera stack. */ - Camera3RequestDescriptor *descriptor = - reinterpret_cast(request->cookie()); camera3_capture_result_t captureResult = {}; captureResult.frame_number = descriptor->frameNumber; @@ -1220,21 +1230,12 @@ void CameraDevice::requestComplete(Request *request) captureResult.output_buffers = const_cast(descriptor->buffers); - /* - * \todo The timestamp used for the metadata is currently always taken - * from the first buffer (which may be the first stream) in the Request. - * It might be appropriate to return a 'correct' (as determined by - * pipeline handlers) timestamp in the Request itself. - */ - FrameBuffer *buffer = buffers.begin()->second; if (status == CAMERA3_BUFFER_STATUS_OK) { notifyShutter(descriptor->frameNumber, buffer->metadata().timestamp); captureResult.partial_result = 1; - resultMetadata = getResultMetadata(descriptor->frameNumber, - buffer->metadata().timestamp); captureResult.result = resultMetadata->get(); }