[{"id":11681,"web_url":"https://patchwork.libcamera.org/comment/11681/","msgid":"<20200728235606.GB151012@oden.dyn.berto.se>","date":"2020-07-28T23:56:06","subject":"Re: [libcamera-devel] [PATCH 2/5] android: camera_device: Construct\n\tmanual request template","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2020-07-25 18:42:40 +0200, Jacopo Mondi wrote:\n> Construct the template for the MANUAL capture intent.\n> \n> The constructed control pack is quite similar to the one used for\n> preview, with the exception that the 3A functionalities are disabled.\n> \n> This fixes the CTS 9.0.r12 test:\n> android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceManualTemplate\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/android/camera_device.cpp | 91 ++++++++++++++++++++++++++++++++++-\n>  src/android/camera_device.h   |  1 +\n>  2 files changed, 91 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index fa4570fabdd7..de18d1dbe299 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -917,6 +917,90 @@ CameraMetadata *CameraDevice::requestTemplatePreview()\n>  \treturn requestTemplate;\n>  }\n>  \n> +CameraMetadata *CameraDevice::requestTemplateManual()\n> +{\n> +\t/*\n> +\t * \\todo Keep this in sync with the actual number of entries.\n> +\t * Currently: 20 entries, 35 bytes\n> +\t */\n\nI think this is starting to become a pain point for us and we need to \nmake this automatic somehow. It does not have to be done as part of this \nseries and I think Kieran is already working on it so for this patch,\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> +\tCameraMetadata *requestTemplate = new CameraMetadata(20, 35);\n> +\tif (!requestTemplate->isValid()) {\n> +\t\tdelete requestTemplate;\n> +\t\treturn nullptr;\n> +\t}\n> +\n> +\tuint8_t aeMode = ANDROID_CONTROL_AE_MODE_OFF;\n> +\trequestTemplate->addEntry(ANDROID_CONTROL_AE_MODE,\n> +\t\t\t\t  &aeMode, 1);\n> +\n> +\tint32_t aeExposureCompensation = 0;\n> +\trequestTemplate->addEntry(ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION,\n> +\t\t\t\t  &aeExposureCompensation, 1);\n> +\n> +\tuint8_t aePrecaptureTrigger = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE;\n> +\trequestTemplate->addEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER,\n> +\t\t\t\t  &aePrecaptureTrigger, 1);\n> +\n> +\tuint8_t aeLock = ANDROID_CONTROL_AE_LOCK_OFF;\n> +\trequestTemplate->addEntry(ANDROID_CONTROL_AE_LOCK,\n> +\t\t\t\t  &aeLock, 1);\n> +\n> +\tstd::vector<int32_t> aeFpsTarget = {\n> +\t\t15, 30,\n> +\t};\n> +\trequestTemplate->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE,\n> +\t\t\t\t  aeFpsTarget.data(),\n> +\t\t\t\t  aeFpsTarget.size());\n> +\n> +\tuint8_t aeAntibandingMode = ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO;\n> +\trequestTemplate->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE,\n> +\t\t\t\t  &aeAntibandingMode, 1);\n> +\n> +\tuint8_t afTrigger = ANDROID_CONTROL_AF_TRIGGER_IDLE;\n> +\trequestTemplate->addEntry(ANDROID_CONTROL_AF_TRIGGER,\n> +\t\t\t\t  &afTrigger, 1);\n> +\n> +\tuint8_t awbMode = ANDROID_CONTROL_AWB_MODE_OFF;\n> +\trequestTemplate->addEntry(ANDROID_CONTROL_AWB_MODE,\n> +\t\t\t\t  &awbMode, 1);\n> +\n> +\tuint8_t awbLock = ANDROID_CONTROL_AWB_LOCK_OFF;\n> +\trequestTemplate->addEntry(ANDROID_CONTROL_AWB_LOCK,\n> +\t\t\t\t  &awbLock, 1);\n> +\n> +\tuint8_t flashMode = ANDROID_FLASH_MODE_OFF;\n> +\trequestTemplate->addEntry(ANDROID_FLASH_MODE,\n> +\t\t\t\t  &flashMode, 1);\n> +\n> +\tuint8_t faceDetectMode = ANDROID_STATISTICS_FACE_DETECT_MODE_OFF;\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> +\trequestTemplate->addEntry(ANDROID_NOISE_REDUCTION_MODE,\n> +\t\t\t\t  &noiseReduction, 1);\n> +\n> +\tuint8_t aberrationMode = ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF;\n> +\trequestTemplate->addEntry(ANDROID_COLOR_CORRECTION_ABERRATION_MODE,\n> +\t\t\t\t  &aberrationMode, 1);\n> +\n> +\tuint8_t controlMode = ANDROID_CONTROL_MODE_OFF;\n> +\trequestTemplate->addEntry(ANDROID_CONTROL_MODE, &controlMode, 1);\n> +\n> +\tfloat lensAperture = 2.53 / 100;\n> +\trequestTemplate->addEntry(ANDROID_LENS_APERTURE, &lensAperture, 1);\n> +\n> +\tuint8_t opticalStabilization = ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF;\n> +\trequestTemplate->addEntry(ANDROID_LENS_OPTICAL_STABILIZATION_MODE,\n> +\t\t\t\t  &opticalStabilization, 1);\n> +\n> +\tuint8_t captureIntent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW;\n> +\trequestTemplate->addEntry(ANDROID_CONTROL_CAPTURE_INTENT,\n> +\t\t\t\t  &captureIntent, 1);\n> +\n> +\treturn requestTemplate;\n> +}\n> +\n>  /*\n>   * Produce a metadata pack to be used as template for a capture request.\n>   */\n> @@ -931,21 +1015,27 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n>  \tuint8_t captureIntent;\n>  \tswitch (type) {\n>  \tcase CAMERA3_TEMPLATE_PREVIEW:\n> +\t\trequestTemplate = requestTemplatePreview();\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW;\n>  \t\tbreak;\n>  \tcase CAMERA3_TEMPLATE_STILL_CAPTURE:\n> +\t\trequestTemplate = requestTemplatePreview();\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE;\n>  \t\tbreak;\n>  \tcase CAMERA3_TEMPLATE_VIDEO_RECORD:\n> +\t\trequestTemplate = requestTemplatePreview();\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD;\n>  \t\tbreak;\n>  \tcase CAMERA3_TEMPLATE_VIDEO_SNAPSHOT:\n> +\t\trequestTemplate = requestTemplatePreview();\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT;\n>  \t\tbreak;\n>  \tcase CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG:\n> +\t\trequestTemplate = requestTemplatePreview();\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG;\n>  \t\tbreak;\n>  \tcase CAMERA3_TEMPLATE_MANUAL:\n> +\t\trequestTemplate = requestTemplateManual();\n>  \t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_MANUAL;\n>  \t\tbreak;\n>  \tdefault:\n> @@ -953,7 +1043,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 5a52ad8f741c..db7b3c558993 100644\n> --- a/src/android/camera_device.h\n> +++ b/src/android/camera_device.h\n> @@ -84,6 +84,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 *requestTemplateManual();\n>  \tlibcamera::PixelFormat toPixelFormat(int format);\n>  \tstd::unique_ptr<CameraMetadata> getResultMetadata(int frame_number,\n>  \t\t\t\t\t\t\t  int64_t timestamp);\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 96F3ABD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Jul 2020 23:56:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 16B3C613C6;\n\tWed, 29 Jul 2020 01:56:10 +0200 (CEST)","from mail-lj1-x231.google.com (mail-lj1-x231.google.com\n\t[IPv6:2a00:1450:4864:20::231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1FDCE60535\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Jul 2020 01:56:08 +0200 (CEST)","by mail-lj1-x231.google.com with SMTP id f5so23071969ljj.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Jul 2020 16:56:08 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id v16sm47326ljd.1.2020.07.28.16.56.06\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 28 Jul 2020 16:56:06 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"Xp6lTxBc\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=Bd8aptjcPnICw9fG+iITx3jdFTUxtE17re0R9iJY9nU=;\n\tb=Xp6lTxBcdjnryeQpJB1ljg+0LVsu7D4Yc9Rc9XkNZECTQcyFywLWFPjkGIOv+BBJbC\n\tgQUAQQQD6P+QhhKR1BZEq2y1Wi6H2bgogQQr+QtZT3QoNctVGtBSEx5UxiJG728gGBiU\n\tAa00Ab0XCuYLvlZx9l0294j/ytdMgPZVNSudEKaNfANH39uqTGUIddY3Mrw8U8CpztFF\n\twjizOr5EOpwWKqq0qarX6Dx4UDtgqEQSwvWmx6ba+crDJWPVEvbaWA847EtIeHUUFs+n\n\trnGNv0FLlvwo99guh5L64TLVkNi1LywgFQ+FD6NRB+7gwqOJhJSmscpL9lyqLlpHsevk\n\tH79w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=Bd8aptjcPnICw9fG+iITx3jdFTUxtE17re0R9iJY9nU=;\n\tb=j10zIK87XjPi/VqvCeILBqN9Ocees5Ppvw3nfe9yIMEujnUKQ8ONex8xs0eCs+quJs\n\tK8aUdx2UOj0yDTyhDAie4r5U/0wzbzwqxjlfDHnv+pu/la5K8RBn9wWybtw5epgSfflm\n\tWMQ0eOosMaF4tI+gs/hv+YwrAamvp4Fq+DMwUEzIbx4vdC077SX/AloM7/2XI3MPlxUr\n\t9ZNuIbUc+4sypWMoFaQhLDy/51K+syvFmDH9iYvnVJgL+wuPj4OpWXifmvkVLWAhQ+2+\n\thN31uWkGYvwNxaNBCssC00xIqTVdy3iTOahEmIr2wnsrr6mRVYUXuG4LZDbwCZZusqIz\n\tvLkQ==","X-Gm-Message-State":"AOAM530HMpGfk6W1gVhKV6/UnxAOlc/frAaNPoZ3vsUx2YmkTs4Q+8Ki\n\tywkhd7nHZEym6MqtpBwgKKXZDg==","X-Google-Smtp-Source":"ABdhPJz/gk/kvk/MFc7x2FePNoW1aA4XEkqJgQs0MsXHe4+qlNNIPoVMx1puaLy5UwtTddRGJ9kt2w==","X-Received":"by 2002:a2e:9c95:: with SMTP id\n\tx21mr13528067lji.234.1595980567314; \n\tTue, 28 Jul 2020 16:56:07 -0700 (PDT)","Date":"Wed, 29 Jul 2020 01:56:06 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200728235606.GB151012@oden.dyn.berto.se>","References":"<20200725164243.168297-1-jacopo@jmondi.org>\n\t<20200725164243.168297-3-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200725164243.168297-3-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 2/5] android: camera_device: Construct\n\tmanual request template","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=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]