[{"id":15547,"web_url":"https://patchwork.libcamera.org/comment/15547/","msgid":"<YEa7FaQabjBBNNhY@pendragon.ideasonboard.com>","date":"2021-03-09T00:02:29","subject":"Re: [libcamera-devel] [PATCH 3/3] android: camera_device: Generate\n\ttemplate for Video","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Mon, Mar 08, 2021 at 06:07:28PM +0100, Jacopo Mondi wrote:\n> The capture request template for video recording use cases requires\n> a fixed FPS range. Generate the request templates for the VIDEO_RECORD\n> and VIDEO_SNAPSHOT capture intents using the preview template and\n> updating the supported FPS range.\n> \n> This change fixes the CTS tests\n> android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceRecordingTemplate\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/android/camera_device.cpp | 39 +++++++++++++++++++++++++++++------\n>  src/android/camera_device.h   |  1 +\n>  2 files changed, 34 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 0621ec26feb8..58bebab31cb8 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -1396,11 +1396,7 @@ CameraMetadata *CameraDevice::requestTemplatePreview()\n>  \t}\n>  \n>  \t/*\n> -\t * \\todo Depending on the requested CaptureIntent, the FPS range\n> -\t * needs to be adjusted. For example, the capture template for\n> -\t * video capture intent shall report a fixed value.\n> -\t *\n> -\t * Also assume the AE_AVAILABLE_TARGET_FPS_RANGE static metadata\n> +\t * Assume the AE_AVAILABLE_TARGET_FPS_RANGE static metadata\n>  \t * has been assembled as {{min, max} {max, max}}.\n>  \t */\n>  \trequestTemplate->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE,\n> @@ -1474,6 +1470,30 @@ CameraMetadata *CameraDevice::requestTemplatePreview()\n>  \treturn requestTemplate;\n>  }\n>  \n> +CameraMetadata *CameraDevice::requestTemplateVideo()\n> +{\n> +\tCameraMetadata *previewTemplate = requestTemplatePreview();\n> +\tif (!previewTemplate)\n> +\t\treturn nullptr;\n> +\n> +\t/*\n> +\t * The video template requires a fixed FPS range. Everything else\n> +\t * stays the same as the preview template.\n> +\t */\n> +\tcamera_metadata_ro_entry_t entry;\n> +\tstaticMetadata_->getEntry(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES,\n> +\t\t\t\t  &entry);\n> +\n> +\t/*\n> +\t * Assume the AE_AVAILABLE_TARGET_FPS_RANGE static metadata\n> +\t * has been assembled as {{min, max} {max, max}}.\n> +\t */\n> +\tpreviewTemplate->updateEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE,\n> +\t\t\t\t     entry.data.i32 + 2, 2);\n> +\n> +\treturn previewTemplate;\n> +}\n> +\n>  /*\n>   * Produce a metadata pack to be used as template for a capture request.\n>   */\n> @@ -1489,14 +1509,22 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n>  \tswitch (type) {\n>  \tcase CAMERA3_TEMPLATE_PREVIEW:\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW;\n> +\t\trequestTemplate = requestTemplatePreview();\n>  \t\tbreak;\n>  \tcase CAMERA3_TEMPLATE_STILL_CAPTURE:\n> +\t\t/*\n> +\t\t * Use the preview template for still capture, they only differ\n> +\t\t * for the torch mode we currently do not support.\n> +\t\t */\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE;\n> +\t\trequestTemplate = requestTemplatePreview();\n>  \t\tbreak;\n>  \tcase CAMERA3_TEMPLATE_VIDEO_RECORD:\n> +\t\trequestTemplate = requestTemplateVideo();\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD;\n\nNit-picking, I'd swap the two lines to align with the previous two\ncases. Same for video snapshot.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \t\tbreak;\n>  \tcase CAMERA3_TEMPLATE_VIDEO_SNAPSHOT:\n> +\t\trequestTemplate = requestTemplateVideo();\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT;\n>  \t\tbreak;\n>  \t/* \\todo Implement templates generation for the remaining use cases. */\n> @@ -1507,7 +1535,6 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n>  \t\treturn nullptr;\n>  \t}\n>  \n> -\trequestTemplate = requestTemplatePreview();\n>  \tif (!requestTemplate || !requestTemplate->isValid()) {\n>  \t\tLOG(HAL, Error) << \"Failed to construct request template\";\n>  \t\tdelete requestTemplate;\n> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> index f96934dbf4e7..ebbd7b9b8ab1 100644\n> --- a/src/android/camera_device.h\n> +++ b/src/android/camera_device.h\n> @@ -101,6 +101,7 @@ private:\n>  \tvoid notifyShutter(uint32_t frameNumber, uint64_t timestamp);\n>  \tvoid notifyError(uint32_t frameNumber, camera3_stream_t *stream);\n>  \tCameraMetadata *requestTemplatePreview();\n> +\tCameraMetadata *requestTemplateVideo();\n>  \tlibcamera::PixelFormat toPixelFormat(int format) const;\n>  \tint processControls(Camera3RequestDescriptor *descriptor);\n>  \tstd::unique_ptr<CameraMetadata> getResultMetadata(","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 29E49BD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Mar 2021 00:03:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A1E946051F;\n\tTue,  9 Mar 2021 01:03:02 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 913CB602E4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Mar 2021 01:03:00 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0AAC0527;\n\tTue,  9 Mar 2021 01:02:59 +0100 (CET)"],"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=\"NsQe9bCw\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1615248180;\n\tbh=i+djyPN0a0vy1zk+OPZVku90CC5rsKItyTJfeI27mQ8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=NsQe9bCwjU/tTIvxTfmZFwhq0ZyhxngifA3s8QMbEqMUQgyfTu0rpOfuuUhVII3YP\n\tPX6QiraCvR+K24TBpj7lMD9uTWiMsvMO7oVvOVhLKAW4sQbXhrn0VaNI0oENvHB6Yw\n\t1A+31j9EOh0RR7DfsBP/FNorqozDPYzd3AlGWH+Q=","Date":"Tue, 9 Mar 2021 02:02:29 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YEa7FaQabjBBNNhY@pendragon.ideasonboard.com>","References":"<20210308170728.2212649-1-jacopo@jmondi.org>\n\t<20210308170728.2212649-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210308170728.2212649-4-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 3/3] android: camera_device: Generate\n\ttemplate for Video","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@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>"}},{"id":15555,"web_url":"https://patchwork.libcamera.org/comment/15555/","msgid":"<20210309074522.b6o4nz6exnxomluf@uno.localdomain>","date":"2021-03-09T07:45:22","subject":"Re: [libcamera-devel] [PATCH 3/3] android: camera_device: Generate\n\ttemplate for Video","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Tue, Mar 09, 2021 at 02:02:29AM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Mon, Mar 08, 2021 at 06:07:28PM +0100, Jacopo Mondi wrote:\n> > The capture request template for video recording use cases requires\n> > a fixed FPS range. Generate the request templates for the VIDEO_RECORD\n> > and VIDEO_SNAPSHOT capture intents using the preview template and\n> > updating the supported FPS range.\n> >\n> > This change fixes the CTS tests\n> > android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceRecordingTemplate\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/android/camera_device.cpp | 39 +++++++++++++++++++++++++++++------\n> >  src/android/camera_device.h   |  1 +\n> >  2 files changed, 34 insertions(+), 6 deletions(-)\n> >\n> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> > index 0621ec26feb8..58bebab31cb8 100644\n> > --- a/src/android/camera_device.cpp\n> > +++ b/src/android/camera_device.cpp\n> > @@ -1396,11 +1396,7 @@ CameraMetadata *CameraDevice::requestTemplatePreview()\n> >  \t}\n> >\n> >  \t/*\n> > -\t * \\todo Depending on the requested CaptureIntent, the FPS range\n> > -\t * needs to be adjusted. For example, the capture template for\n> > -\t * video capture intent shall report a fixed value.\n> > -\t *\n> > -\t * Also assume the AE_AVAILABLE_TARGET_FPS_RANGE static metadata\n> > +\t * Assume the AE_AVAILABLE_TARGET_FPS_RANGE static metadata\n> >  \t * has been assembled as {{min, max} {max, max}}.\n> >  \t */\n> >  \trequestTemplate->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE,\n> > @@ -1474,6 +1470,30 @@ CameraMetadata *CameraDevice::requestTemplatePreview()\n> >  \treturn requestTemplate;\n> >  }\n> >\n> > +CameraMetadata *CameraDevice::requestTemplateVideo()\n> > +{\n> > +\tCameraMetadata *previewTemplate = requestTemplatePreview();\n> > +\tif (!previewTemplate)\n> > +\t\treturn nullptr;\n> > +\n> > +\t/*\n> > +\t * The video template requires a fixed FPS range. Everything else\n> > +\t * stays the same as the preview template.\n> > +\t */\n> > +\tcamera_metadata_ro_entry_t entry;\n> > +\tstaticMetadata_->getEntry(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES,\n> > +\t\t\t\t  &entry);\n> > +\n> > +\t/*\n> > +\t * Assume the AE_AVAILABLE_TARGET_FPS_RANGE static metadata\n> > +\t * has been assembled as {{min, max} {max, max}}.\n> > +\t */\n> > +\tpreviewTemplate->updateEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE,\n> > +\t\t\t\t     entry.data.i32 + 2, 2);\n> > +\n> > +\treturn previewTemplate;\n> > +}\n> > +\n> >  /*\n> >   * Produce a metadata pack to be used as template for a capture request.\n> >   */\n> > @@ -1489,14 +1509,22 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n> >  \tswitch (type) {\n> >  \tcase CAMERA3_TEMPLATE_PREVIEW:\n> >  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW;\n> > +\t\trequestTemplate = requestTemplatePreview();\n> >  \t\tbreak;\n> >  \tcase CAMERA3_TEMPLATE_STILL_CAPTURE:\n> > +\t\t/*\n> > +\t\t * Use the preview template for still capture, they only differ\n> > +\t\t * for the torch mode we currently do not support.\n> > +\t\t */\n> >  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE;\n> > +\t\trequestTemplate = requestTemplatePreview();\n> >  \t\tbreak;\n> >  \tcase CAMERA3_TEMPLATE_VIDEO_RECORD:\n> > +\t\trequestTemplate = requestTemplateVideo();\n> >  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD;\n>\n> Nit-picking, I'd swap the two lines to align with the previous two\n> cases. Same for video snapshot.\n\nOh indeed! I'll fix this\n\nThanks\n   j\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n> >  \t\tbreak;\n> >  \tcase CAMERA3_TEMPLATE_VIDEO_SNAPSHOT:\n> > +\t\trequestTemplate = requestTemplateVideo();\n> >  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT;\n> >  \t\tbreak;\n> >  \t/* \\todo Implement templates generation for the remaining use cases. */\n> > @@ -1507,7 +1535,6 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n> >  \t\treturn nullptr;\n> >  \t}\n> >\n> > -\trequestTemplate = requestTemplatePreview();\n> >  \tif (!requestTemplate || !requestTemplate->isValid()) {\n> >  \t\tLOG(HAL, Error) << \"Failed to construct request template\";\n> >  \t\tdelete requestTemplate;\n> > diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> > index f96934dbf4e7..ebbd7b9b8ab1 100644\n> > --- a/src/android/camera_device.h\n> > +++ b/src/android/camera_device.h\n> > @@ -101,6 +101,7 @@ private:\n> >  \tvoid notifyShutter(uint32_t frameNumber, uint64_t timestamp);\n> >  \tvoid notifyError(uint32_t frameNumber, camera3_stream_t *stream);\n> >  \tCameraMetadata *requestTemplatePreview();\n> > +\tCameraMetadata *requestTemplateVideo();\n> >  \tlibcamera::PixelFormat toPixelFormat(int format) const;\n> >  \tint processControls(Camera3RequestDescriptor *descriptor);\n> >  \tstd::unique_ptr<CameraMetadata> getResultMetadata(\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 F249BBD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Mar 2021 07:44:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6BD0568A9C;\n\tTue,  9 Mar 2021 08:44:54 +0100 (CET)","from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[217.70.183.193])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9216C602E4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Mar 2021 08:44:53 +0100 (CET)","from uno.localdomain (host-79-22-58-175.retail.telecomitalia.it\n\t[79.22.58.175]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay1-d.mail.gandi.net (Postfix) with ESMTPSA id AE29F240004;\n\tTue,  9 Mar 2021 07:44:52 +0000 (UTC)"],"X-Originating-IP":"79.22.58.175","Date":"Tue, 9 Mar 2021 08:45:22 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20210309074522.b6o4nz6exnxomluf@uno.localdomain>","References":"<20210308170728.2212649-1-jacopo@jmondi.org>\n\t<20210308170728.2212649-4-jacopo@jmondi.org>\n\t<YEa7FaQabjBBNNhY@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<YEa7FaQabjBBNNhY@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] android: camera_device: Generate\n\ttemplate for Video","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@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>"}}]