[{"id":16615,"web_url":"https://patchwork.libcamera.org/comment/16615/","msgid":"<YIeX27ihZqs7GQEs@pendragon.ideasonboard.com>","date":"2021-04-27T04:49:31","subject":"Re: [libcamera-devel] [RFC PATCH v2 06/12] android: camera_device:\n\tSet templates for FULL requirements","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Thu, Apr 22, 2021 at 06:40:56PM +0900, Paul Elder wrote:\n> Add separate functions for manual template and still capture template.\n> Set all template values to match FULL requirements.\n> \n> This patch fixes the following tests:\n> - android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceCreateCaptureBuilder\n> - android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceManualTemplate\n> - android.hardware.camera2.cts.CameraDeviceTest#testCameraDevicePreviewTemplate\n> - android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceRecordingTemplate\n> - android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceStillTemplate\n> - android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceVideoSnapShotTemplate\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> \n> ---\n> All of the templates build off of the preview template, but there is one\n> tag that the preview template doesn't initialize but the manual template\n> adds, so we still have to allocate space for that one in the preview\n> template. Certainly there's a better way...\n\nAs commented in the previous patch, I think it's time to bite the bullet\nand address this. We need containers that will not require manually\ntracking the amount of data. Bonus points if we can be smart to stay\nefficient. If efficiency and correctness are too hard to achieve in one\ngo, let's start with correctness.\n\n> ---\n>  src/android/camera_device.cpp | 105 +++++++++++++++++++++++++++++++---\n>  src/android/camera_device.h   |   2 +\n>  2 files changed, 99 insertions(+), 8 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 7f0f8f1a..c9d4afc3 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -1596,8 +1596,9 @@ std::unique_ptr<CameraMetadata> CameraDevice::requestTemplatePreview()\n>  \t/*\n>  \t * \\todo Keep this in sync with the actual number of entries.\n>  \t * Currently: 20 entries, 35 bytes\n> +\t * \\todo how to split this with the functions that build off of this?\n>  \t */\n> -\tauto requestTemplate = std::make_unique<CameraMetadata>(21, 36);\n> +\tauto requestTemplate = std::make_unique<CameraMetadata>(30, 65);\n>  \tif (!requestTemplate->isValid()) {\n>  \t\treturn nullptr;\n>  \t}\n> @@ -1653,6 +1654,9 @@ std::unique_ptr<CameraMetadata> CameraDevice::requestTemplatePreview()\n>  \trequestTemplate->addEntry(ANDROID_CONTROL_AWB_LOCK,\n>  \t\t\t\t  &awbLock, 1);\n>  \n> +\tuint8_t edgeMode = ANDROID_EDGE_MODE_FAST;\n> +\trequestTemplate->addEntry(ANDROID_EDGE_MODE, &edgeMode, 1);\n> +\n>  \tuint8_t flashMode = ANDROID_FLASH_MODE_OFF;\n>  \trequestTemplate->addEntry(ANDROID_FLASH_MODE,\n>  \t\t\t\t  &flashMode, 1);\n> @@ -1661,7 +1665,8 @@ std::unique_ptr<CameraMetadata> CameraDevice::requestTemplatePreview()\n>  \trequestTemplate->addEntry(ANDROID_STATISTICS_FACE_DETECT_MODE,\n>  \t\t\t\t  &faceDetectMode, 1);\n>  \n> -\tuint8_t noiseReduction = ANDROID_NOISE_REDUCTION_MODE_OFF;\n> +\t/* \\todo FULL expects this to be FAST, not OFF*/\n> +\tuint8_t noiseReduction = ANDROID_NOISE_REDUCTION_MODE_FAST;\n>  \trequestTemplate->addEntry(ANDROID_NOISE_REDUCTION_MODE,\n>  \t\t\t\t  &noiseReduction, 1);\n>  \n> @@ -1683,6 +1688,35 @@ std::unique_ptr<CameraMetadata> CameraDevice::requestTemplatePreview()\n>  \trequestTemplate->addEntry(ANDROID_CONTROL_CAPTURE_INTENT,\n>  \t\t\t\t  &captureIntent, 1);\n>  \n> +\tint64_t exposureTime = 100000;\n> +\trequestTemplate->addEntry(ANDROID_SENSOR_EXPOSURE_TIME,\n> +\t\t\t\t  &exposureTime, 1);\n> +\n> +\tint32_t sensorSensitivity = 32;\n> +\trequestTemplate->addEntry(ANDROID_SENSOR_SENSITIVITY,\n> +\t\t\t\t  &sensorSensitivity, 1);\n> +\n> +\tbool blackLevelLock = false;\n> +\trequestTemplate->addEntry(ANDROID_BLACK_LEVEL_LOCK,\n> +\t\t\t\t  &blackLevelLock, 1);\n> +\n> +\t/* Hardcode this. We ignore it if it comes in as a request key. */\n> +\tint64_t frameDuration = 33333333;\n> +\trequestTemplate->addEntry(ANDROID_SENSOR_FRAME_DURATION,\n> +\t\t\t\t  &frameDuration, 1);\n> +\n> +\tuint8_t shadingMapMode = ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF;\n> +\trequestTemplate->addEntry(ANDROID_STATISTICS_LENS_SHADING_MAP_MODE,\n> +\t\t\t\t  &shadingMapMode, 1);\n> +\n> +\t/* \\todo handle this */\n> +\tuint8_t tonemapMode = ANDROID_TONEMAP_MODE_FAST;\n> +\trequestTemplate->addEntry(ANDROID_TONEMAP_MODE, &tonemapMode, 1);\n> +\n> +\t/* \\todo get this from request? and set it. handle map mode too */\n> +\tuint8_t shadingMode = ANDROID_SHADING_MODE_FAST;\n> +\trequestTemplate->addEntry(ANDROID_SHADING_MODE, &shadingMode, 1);\n> +\n>  \treturn requestTemplate;\n>  }\n>  \n> @@ -1700,6 +1734,9 @@ std::unique_ptr<CameraMetadata> CameraDevice::requestTemplateVideo()\n>  \tstaticMetadata_->getEntry(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES,\n>  \t\t\t\t  &entry);\n>  \n> +\tuint8_t edgeMode = ANDROID_EDGE_MODE_FAST;\n> +\tpreviewTemplate->updateEntry(ANDROID_EDGE_MODE, &edgeMode, 1);\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> @@ -1710,6 +1747,58 @@ std::unique_ptr<CameraMetadata> CameraDevice::requestTemplateVideo()\n>  \treturn previewTemplate;\n>  }\n>  \n> +std::unique_ptr<CameraMetadata> CameraDevice::requestTemplateStill()\n> +{\n> +\tstd::unique_ptr<CameraMetadata> previewTemplate = requestTemplatePreview();\n> +\tif (!previewTemplate)\n> +\t\treturn nullptr;\n> +\n> +\t/*\n> +\t * The still template with FULL requires the noise reduction mode to be\n> +\t * HIGH_QUALITY.\n> +\t */\n> +\tuint8_t noiseReduction = ANDROID_NOISE_REDUCTION_MODE_HIGH_QUALITY;\n> +\tpreviewTemplate->updateEntry(ANDROID_NOISE_REDUCTION_MODE,\n> +\t\t\t\t     &noiseReduction, 1);\n> +\n> +\tuint8_t edgeMode = ANDROID_EDGE_MODE_HIGH_QUALITY;\n> +\tpreviewTemplate->updateEntry(ANDROID_EDGE_MODE, &edgeMode, 1);\n> +\n> +\tuint8_t shadingMode = ANDROID_SHADING_MODE_HIGH_QUALITY;\n> +\tpreviewTemplate->updateEntry(ANDROID_SHADING_MODE, &shadingMode, 1);\n> +\n> +\tuint8_t tonemapMode = ANDROID_TONEMAP_MODE_HIGH_QUALITY;\n> +\tpreviewTemplate->updateEntry(ANDROID_TONEMAP_MODE, &tonemapMode, 1);\n> +\n> +\treturn previewTemplate;\n> +}\n> +\n> +std::unique_ptr<CameraMetadata> CameraDevice::requestTemplateManual()\n> +{\n> +\tstd::unique_ptr<CameraMetadata> previewTemplate = requestTemplatePreview();\n> +\tif (!previewTemplate)\n> +\t\treturn nullptr;\n> +\n> +\tuint8_t controlMode = ANDROID_CONTROL_MODE_OFF;\n> +\tpreviewTemplate->updateEntry(ANDROID_CONTROL_MODE, &controlMode, 1);\n> +\n> +\tuint8_t aeMode = ANDROID_CONTROL_AE_MODE_OFF;\n> +\tpreviewTemplate->updateEntry(ANDROID_CONTROL_AE_MODE, &aeMode, 1);\n> +\n> +\tuint8_t awbMode = ANDROID_CONTROL_AWB_MODE_OFF;\n> +\tpreviewTemplate->updateEntry(ANDROID_CONTROL_AWB_MODE, &awbMode, 1);\n> +\n> +\tuint8_t edgeMode = ANDROID_EDGE_MODE_OFF;\n> +\tpreviewTemplate->updateEntry(ANDROID_EDGE_MODE, &edgeMode, 1);\n> +\n> +\t/* \\todo get this from available filter densities */\n> +\tfloat filterDensity = 0.0f;\n> +\tpreviewTemplate->addEntry(ANDROID_LENS_FILTER_DENSITY,\n> +\t\t\t\t  &filterDensity, 1);\n> +\n> +\treturn previewTemplate;\n> +}\n> +\n>  /*\n>   * Produce a metadata pack to be used as template for a capture request.\n>   */\n> @@ -1728,12 +1817,8 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\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\trequestTemplate = requestTemplateStill();\n>  \t\tbreak;\n>  \tcase CAMERA3_TEMPLATE_VIDEO_RECORD:\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD;\n> @@ -1743,9 +1828,13 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT;\n>  \t\trequestTemplate = requestTemplateVideo();\n>  \t\tbreak;\n> +\tcase CAMERA3_TEMPLATE_MANUAL:\n> +\t\t/* required for FULL */\n> +\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_MANUAL;\n> +\t\trequestTemplate = requestTemplateManual();\n> +\t\tbreak;\n>  \t/* \\todo Implement templates generation for the remaining use cases. */\n>  \tcase CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG:\n> -\tcase CAMERA3_TEMPLATE_MANUAL:\n>  \tdefault:\n>  \t\tLOG(HAL, Error) << \"Unsupported template request type: \" << type;\n>  \t\treturn nullptr;\n> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> index 23457e47..8edbcdfd 100644\n> --- a/src/android/camera_device.h\n> +++ b/src/android/camera_device.h\n> @@ -104,6 +104,8 @@ private:\n>  \tvoid notifyError(uint32_t frameNumber, camera3_stream_t *stream);\n>  \tstd::unique_ptr<CameraMetadata> requestTemplatePreview();\n>  \tstd::unique_ptr<CameraMetadata> requestTemplateVideo();\n> +\tstd::unique_ptr<CameraMetadata> requestTemplateStill();\n> +\tstd::unique_ptr<CameraMetadata> requestTemplateManual();\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 877A0BDCC3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Apr 2021 04:49:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0184E68878;\n\tTue, 27 Apr 2021 06:49:38 +0200 (CEST)","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 04DF160512\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Apr 2021 06:49:38 +0200 (CEST)","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 6EFB7E9;\n\tTue, 27 Apr 2021 06:49:37 +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=\"kaD2skxq\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1619498977;\n\tbh=4psU+vQjXIQ9HLdNb/Jo7HWPg1ie8roqNtyZ+2Sf3ok=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=kaD2skxqRxsSTDFglXqs1nuEgWWX3h+UrVTYuArtxwMKhhQZwkIWg33iQ6lRvRCtH\n\tKzPtvKu8XtRkiNaNxGWhSdnThVXiN/a53j8KioRlE8tFqJbe2atJfboru19W00GUd9\n\tt1F4IQkubV3Pre6yYa9AA5orrrfl+6tx0uWhp2cA=","Date":"Tue, 27 Apr 2021 07:49:31 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<YIeX27ihZqs7GQEs@pendragon.ideasonboard.com>","References":"<20210422094102.371772-1-paul.elder@ideasonboard.com>\n\t<20210422094102.371772-7-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210422094102.371772-7-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH v2 06/12] android: camera_device:\n\tSet templates for FULL requirements","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":16649,"web_url":"https://patchwork.libcamera.org/comment/16649/","msgid":"<20210427090022.it7idj3gxpop6usv@uno.localdomain>","date":"2021-04-27T09:00:22","subject":"Re: [libcamera-devel] [RFC PATCH v2 06/12] android: camera_device:\n\tSet templates for FULL requirements","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Paul,\n\nOn Thu, Apr 22, 2021 at 06:40:56PM +0900, Paul Elder wrote:\n> Add separate functions for manual template and still capture template.\n> Set all template values to match FULL requirements.\n>\n> This patch fixes the following tests:\n> - android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceCreateCaptureBuilder\n> - android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceManualTemplate\n> - android.hardware.camera2.cts.CameraDeviceTest#testCameraDevicePreviewTemplate\n> - android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceRecordingTemplate\n> - android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceStillTemplate\n> - android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceVideoSnapShotTemplate\n>\n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n>\n> ---\n> All of the templates build off of the preview template, but there is one\n> tag that the preview template doesn't initialize but the manual template\n> adds, so we still have to allocate space for that one in the preview\n> template. Certainly there's a better way...\n\nThere is, certainly... At the moment the code looks like this as there\nis a single tag that deviates between the supported templates.\n\nIf the generation of templates starts deviating (and it's certainly\nexpected) I would not refrain from breaking each template apart in its\nown function. Then we can group setting the 'common' tags into a single\nfunction, but on top.\n\nI would also consider if we maybe want to breakout the template\ngeneration to its own file, camera_device.cpp is really growing too\nfast...\n\n> ---\n>  src/android/camera_device.cpp | 105 +++++++++++++++++++++++++++++++---\n>  src/android/camera_device.h   |   2 +\n>  2 files changed, 99 insertions(+), 8 deletions(-)\n>\n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 7f0f8f1a..c9d4afc3 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -1596,8 +1596,9 @@ std::unique_ptr<CameraMetadata> CameraDevice::requestTemplatePreview()\n>  \t/*\n>  \t * \\todo Keep this in sync with the actual number of entries.\n>  \t * Currently: 20 entries, 35 bytes\n> +\t * \\todo how to split this with the functions that build off of this?\n>  \t */\n> -\tauto requestTemplate = std::make_unique<CameraMetadata>(21, 36);\n> +\tauto requestTemplate = std::make_unique<CameraMetadata>(30, 65);\n>  \tif (!requestTemplate->isValid()) {\n>  \t\treturn nullptr;\n>  \t}\n> @@ -1653,6 +1654,9 @@ std::unique_ptr<CameraMetadata> CameraDevice::requestTemplatePreview()\n>  \trequestTemplate->addEntry(ANDROID_CONTROL_AWB_LOCK,\n>  \t\t\t\t  &awbLock, 1);\n>\n> +\tuint8_t edgeMode = ANDROID_EDGE_MODE_FAST;\n> +\trequestTemplate->addEntry(ANDROID_EDGE_MODE, &edgeMode, 1);\n> +\n>  \tuint8_t flashMode = ANDROID_FLASH_MODE_OFF;\n>  \trequestTemplate->addEntry(ANDROID_FLASH_MODE,\n>  \t\t\t\t  &flashMode, 1);\n> @@ -1661,7 +1665,8 @@ std::unique_ptr<CameraMetadata> CameraDevice::requestTemplatePreview()\n>  \trequestTemplate->addEntry(ANDROID_STATISTICS_FACE_DETECT_MODE,\n>  \t\t\t\t  &faceDetectMode, 1);\n>\n> -\tuint8_t noiseReduction = ANDROID_NOISE_REDUCTION_MODE_OFF;\n> +\t/* \\todo FULL expects this to be FAST, not OFF*/\n> +\tuint8_t noiseReduction = ANDROID_NOISE_REDUCTION_MODE_FAST;\n>  \trequestTemplate->addEntry(ANDROID_NOISE_REDUCTION_MODE,\n>  \t\t\t\t  &noiseReduction, 1);\n>\n> @@ -1683,6 +1688,35 @@ std::unique_ptr<CameraMetadata> CameraDevice::requestTemplatePreview()\n>  \trequestTemplate->addEntry(ANDROID_CONTROL_CAPTURE_INTENT,\n>  \t\t\t\t  &captureIntent, 1);\n>\n> +\tint64_t exposureTime = 100000;\n> +\trequestTemplate->addEntry(ANDROID_SENSOR_EXPOSURE_TIME,\n> +\t\t\t\t  &exposureTime, 1);\n\nShould this be clamped to the min/max values of\ncontrols::ExposureTime, which the HAL uses to populate\nANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE\n\n> +\n> +\tint32_t sensorSensitivity = 32;\n> +\trequestTemplate->addEntry(ANDROID_SENSOR_SENSITIVITY,\n> +\t\t\t\t  &sensorSensitivity, 1);\n> +\n> +\tbool blackLevelLock = false;\n> +\trequestTemplate->addEntry(ANDROID_BLACK_LEVEL_LOCK,\n> +\t\t\t\t  &blackLevelLock, 1);\n> +\n> +\t/* Hardcode this. We ignore it if it comes in as a request key. */\n> +\tint64_t frameDuration = 33333333;\n> +\trequestTemplate->addEntry(ANDROID_SENSOR_FRAME_DURATION,\n> +\t\t\t\t  &frameDuration, 1);\n\nShould be at least clamped to the supported FrameDurations ?\n\n> +\n> +\tuint8_t shadingMapMode = ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF;\n> +\trequestTemplate->addEntry(ANDROID_STATISTICS_LENS_SHADING_MAP_MODE,\n> +\t\t\t\t  &shadingMapMode, 1);\n> +\n> +\t/* \\todo handle this */\n> +\tuint8_t tonemapMode = ANDROID_TONEMAP_MODE_FAST;\n> +\trequestTemplate->addEntry(ANDROID_TONEMAP_MODE, &tonemapMode, 1);\n> +\n> +\t/* \\todo get this from request? and set it. handle map mode too */\n\nNot sure \"get this from request\" fits here. The templates are used by\nthe framework to construct, well, templates for the capture requests\nit will issue to the camera. So, we don't have a \"request\" here, but\nrather we can expect the forthcoming requests to have the values we\nset here.\n\n> +\tuint8_t shadingMode = ANDROID_SHADING_MODE_FAST;\n> +\trequestTemplate->addEntry(ANDROID_SHADING_MODE, &shadingMode, 1);\n> +\n>  \treturn requestTemplate;\n>  }\n>\n> @@ -1700,6 +1734,9 @@ std::unique_ptr<CameraMetadata> CameraDevice::requestTemplateVideo()\n>  \tstaticMetadata_->getEntry(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES,\n>  \t\t\t\t  &entry);\n>\n> +\tuint8_t edgeMode = ANDROID_EDGE_MODE_FAST;\n> +\tpreviewTemplate->updateEntry(ANDROID_EDGE_MODE, &edgeMode, 1);\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> @@ -1710,6 +1747,58 @@ std::unique_ptr<CameraMetadata> CameraDevice::requestTemplateVideo()\n>  \treturn previewTemplate;\n>  }\n>\n> +std::unique_ptr<CameraMetadata> CameraDevice::requestTemplateStill()\n> +{\n> +\tstd::unique_ptr<CameraMetadata> previewTemplate = requestTemplatePreview();\n> +\tif (!previewTemplate)\n> +\t\treturn nullptr;\n> +\n> +\t/*\n> +\t * The still template with FULL requires the noise reduction mode to be\n> +\t * HIGH_QUALITY.\n> +\t */\n> +\tuint8_t noiseReduction = ANDROID_NOISE_REDUCTION_MODE_HIGH_QUALITY;\n> +\tpreviewTemplate->updateEntry(ANDROID_NOISE_REDUCTION_MODE,\n> +\t\t\t\t     &noiseReduction, 1);\n> +\n> +\tuint8_t edgeMode = ANDROID_EDGE_MODE_HIGH_QUALITY;\n> +\tpreviewTemplate->updateEntry(ANDROID_EDGE_MODE, &edgeMode, 1);\n> +\n> +\tuint8_t shadingMode = ANDROID_SHADING_MODE_HIGH_QUALITY;\n> +\tpreviewTemplate->updateEntry(ANDROID_SHADING_MODE, &shadingMode, 1);\n> +\n> +\tuint8_t tonemapMode = ANDROID_TONEMAP_MODE_HIGH_QUALITY;\n> +\tpreviewTemplate->updateEntry(ANDROID_TONEMAP_MODE, &tonemapMode, 1);\n> +\n> +\treturn previewTemplate;\n> +}\n> +\n> +std::unique_ptr<CameraMetadata> CameraDevice::requestTemplateManual()\n> +{\n> +\tstd::unique_ptr<CameraMetadata> previewTemplate = requestTemplatePreview();\n> +\tif (!previewTemplate)\n> +\t\treturn nullptr;\n> +\n> +\tuint8_t controlMode = ANDROID_CONTROL_MODE_OFF;\n> +\tpreviewTemplate->updateEntry(ANDROID_CONTROL_MODE, &controlMode, 1);\n> +\n> +\tuint8_t aeMode = ANDROID_CONTROL_AE_MODE_OFF;\n> +\tpreviewTemplate->updateEntry(ANDROID_CONTROL_AE_MODE, &aeMode, 1);\n> +\n> +\tuint8_t awbMode = ANDROID_CONTROL_AWB_MODE_OFF;\n> +\tpreviewTemplate->updateEntry(ANDROID_CONTROL_AWB_MODE, &awbMode, 1);\n> +\n> +\tuint8_t edgeMode = ANDROID_EDGE_MODE_OFF;\n> +\tpreviewTemplate->updateEntry(ANDROID_EDGE_MODE, &edgeMode, 1);\n> +\n> +\t/* \\todo get this from available filter densities */\n> +\tfloat filterDensity = 0.0f;\n> +\tpreviewTemplate->addEntry(ANDROID_LENS_FILTER_DENSITY,\n> +\t\t\t\t  &filterDensity, 1);\n> +\n> +\treturn previewTemplate;\n> +}\n> +\n>  /*\n>   * Produce a metadata pack to be used as template for a capture request.\n>   */\n> @@ -1728,12 +1817,8 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\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\trequestTemplate = requestTemplateStill();\n>  \t\tbreak;\n>  \tcase CAMERA3_TEMPLATE_VIDEO_RECORD:\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD;\n> @@ -1743,9 +1828,13 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT;\n>  \t\trequestTemplate = requestTemplateVideo();\n>  \t\tbreak;\n> +\tcase CAMERA3_TEMPLATE_MANUAL:\n> +\t\t/* required for FULL */\n> +\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_MANUAL;\n> +\t\trequestTemplate = requestTemplateManual();\n> +\t\tbreak;\n>  \t/* \\todo Implement templates generation for the remaining use cases. */\n>  \tcase CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG:\n> -\tcase CAMERA3_TEMPLATE_MANUAL:\n>  \tdefault:\n>  \t\tLOG(HAL, Error) << \"Unsupported template request type: \" << type;\n>  \t\treturn nullptr;\n> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> index 23457e47..8edbcdfd 100644\n> --- a/src/android/camera_device.h\n> +++ b/src/android/camera_device.h\n> @@ -104,6 +104,8 @@ private:\n>  \tvoid notifyError(uint32_t frameNumber, camera3_stream_t *stream);\n>  \tstd::unique_ptr<CameraMetadata> requestTemplatePreview();\n>  \tstd::unique_ptr<CameraMetadata> requestTemplateVideo();\n> +\tstd::unique_ptr<CameraMetadata> requestTemplateStill();\n> +\tstd::unique_ptr<CameraMetadata> requestTemplateManual();\n>  \tlibcamera::PixelFormat toPixelFormat(int format) const;\n>  \tint processControls(Camera3RequestDescriptor *descriptor);\n>  \tstd::unique_ptr<CameraMetadata> getResultMetadata(\n> --\n> 2.27.0\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 703D9BDCC3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Apr 2021 08:59:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DEB3C688C7;\n\tTue, 27 Apr 2021 10:59:42 +0200 (CEST)","from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[217.70.183.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 804CC688B5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Apr 2021 10:59:41 +0200 (CEST)","from uno.localdomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay2-d.mail.gandi.net (Postfix) with ESMTPSA id B4CB140015;\n\tTue, 27 Apr 2021 08:59:40 +0000 (UTC)"],"X-Originating-IP":"93.61.96.190","Date":"Tue, 27 Apr 2021 11:00:22 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<20210427090022.it7idj3gxpop6usv@uno.localdomain>","References":"<20210422094102.371772-1-paul.elder@ideasonboard.com>\n\t<20210422094102.371772-7-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210422094102.371772-7-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH v2 06/12] android: camera_device:\n\tSet templates for FULL requirements","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>"}}]