[{"id":11858,"web_url":"https://patchwork.libcamera.org/comment/11858/","msgid":"<20200805005053.GY6075@pendragon.ideasonboard.com>","date":"2020-08-05T00:50:53","subject":"Re: [libcamera-devel] [PATCH v3 11/13] android: camera_device:\n\tGenerate ResultMetadata earlier","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the patch.\n\nOn Tue, Aug 04, 2020 at 10:47:09PM +0100, Kieran Bingham wrote:\n> Generate the ResultMetadata before performing JPEG compression so that\n> JPEG specific metadata can be added to the metadata when it has been\n> processed.\n> \n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/android/camera_device.cpp | 23 ++++++++++++-----------\n>  1 file changed, 12 insertions(+), 11 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 4178db952846..c529246e115c 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -1198,6 +1198,8 @@ void CameraDevice::requestComplete(Request *request)\n>  \tconst std::map<Stream *, FrameBuffer *> &buffers = request->buffers();\n>  \tcamera3_buffer_status status = CAMERA3_BUFFER_STATUS_OK;\n>  \tstd::unique_ptr<CameraMetadata> resultMetadata;\n> +\tCamera3RequestDescriptor *descriptor =\n> +\t\treinterpret_cast<Camera3RequestDescriptor *>(request->cookie());\n>  \n>  \tif (request->status() != Request::RequestComplete) {\n>  \t\tLOG(HAL, Error) << \"Request not successfully completed: \"\n> @@ -1205,9 +1207,17 @@ void CameraDevice::requestComplete(Request *request)\n>  \t\tstatus = CAMERA3_BUFFER_STATUS_ERROR;\n>  \t}\n>  \n> +\t/*\n> +\t * \\todo The timestamp used for the metadata is currently always taken\n> +\t * from the first buffer (which may be the first stream) in the Request.\n> +\t * It might be appropriate to return a 'correct' (as determined by\n> +\t * pipeline handlers) timestamp in the Request itself.\n> +\t */\n> +\tFrameBuffer *buffer = buffers.begin()->second;\n> +\tresultMetadata = getResultMetadata(descriptor->frameNumber,\n> +\t\t\t\t\t   buffer->metadata().timestamp);\n> +\n>  \t/* Prepare to call back the Android camera stack. */\n> -\tCamera3RequestDescriptor *descriptor =\n> -\t\treinterpret_cast<Camera3RequestDescriptor *>(request->cookie());\n>  \n>  \tcamera3_capture_result_t captureResult = {};\n>  \tcaptureResult.frame_number = descriptor->frameNumber;\n> @@ -1220,21 +1230,12 @@ void CameraDevice::requestComplete(Request *request)\n>  \tcaptureResult.output_buffers =\n>  \t\tconst_cast<const camera3_stream_buffer_t *>(descriptor->buffers);\n>  \n> -\t/*\n> -\t * \\todo The timestamp used for the metadata is currently always taken\n> -\t * from the first buffer (which may be the first stream) in the Request.\n> -\t * It might be appropriate to return a 'correct' (as determined by\n> -\t * pipeline handlers) timestamp in the Request itself.\n> -\t */\n> -\tFrameBuffer *buffer = buffers.begin()->second;\n>  \n>  \tif (status == CAMERA3_BUFFER_STATUS_OK) {\n>  \t\tnotifyShutter(descriptor->frameNumber,\n>  \t\t\t      buffer->metadata().timestamp);\n>  \n>  \t\tcaptureResult.partial_result = 1;\n> -\t\tresultMetadata = getResultMetadata(descriptor->frameNumber,\n> -\t\t\t\t\t\t   buffer->metadata().timestamp);\n>  \t\tcaptureResult.result = resultMetadata->get();\n>  \t}\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 2DC49BD87A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Aug 2020 00:51:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A9FD160547;\n\tWed,  5 Aug 2020 02:51:15 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3D78660536\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Aug 2020 02:51:09 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A9E1B27B;\n\tWed,  5 Aug 2020 02:51:06 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"QTcg90HJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1596588667;\n\tbh=KNwEe5jzKpPCrHr1JtJFa1hNnNKKvUEJxvbgI/hNY8Q=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=QTcg90HJK5oTrKyJ8GqqHmVRGj/meOmIxjZnbe2O402GsULGuc+XE782dsTy2VQ1G\n\tcPyG/z55JKf6im3Z5jjX7TNW20P8rcr1dlt1gYXYl1hrNK800W3WqfTwhZHVSiZg58\n\tnhP0ar6dNbGYpZCjv3FBzj3vL1FYIgiqYOk9PDho=","Date":"Wed, 5 Aug 2020 03:50:53 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20200805005053.GY6075@pendragon.ideasonboard.com>","References":"<20200804214711.177645-1-kieran.bingham@ideasonboard.com>\n\t<20200804214711.177645-12-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200804214711.177645-12-kieran.bingham@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 11/13] android: camera_device:\n\tGenerate ResultMetadata earlier","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]