Patch Detail
Show a patch.
GET /api/patches/18683/?format=api
{ "id": 18683, "url": "https://patchwork.libcamera.org/api/patches/18683/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18683/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20230602132358.16314-3-naush@raspberrypi.com>", "date": "2023-06-02T13:23:58", "name": "[libcamera-devel,v2,2/2] ipa: rpi: Handle controls for mono variant sensors", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "cb979f9f15a8f4c32e1a16bfb3a0f089b2aeacd3", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18683/mbox/", "series": [ { "id": 3902, "url": "https://patchwork.libcamera.org/api/series/3902/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3902", "date": "2023-06-02T13:23:56", "name": "Mono sensor improvements", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3902/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18683/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18683/checks/", "tags": {}, "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 89DC9C328F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 2 Jun 2023 13:24:08 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7FBC262754;\n\tFri, 2 Jun 2023 15:24:06 +0200 (CEST)", "from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com\n\t[IPv6:2a00:1450:4864:20::42e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8532662728\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 2 Jun 2023 15:24:04 +0200 (CEST)", "by mail-wr1-x42e.google.com with SMTP id\n\tffacd0b85a97d-3078cc99232so1870182f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 02 Jun 2023 06:24:04 -0700 (PDT)", "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tv6-20020a1cf706000000b003f4ddde398csm1962863wmh.21.2023.06.02.06.24.03\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 02 Jun 2023 06:24:03 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1685712246;\n\tbh=Pqe7SWvu9jyqsq+ZGNlm5Lae9tUO6Ejdo0ToUF7E5os=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=nT/3dtvwYjfbSixH0jhRihidqE5nVnoRg+seJBA/hSx0hi+ncgg6v1tafHscLuJ3o\n\tBlT4g+M4prKzR6qgHNwC79bYRkh+bdh2n7FTTZS2g1PnsiDXc1nas9j9xZ+mu/6xjW\n\tbed2CWmhosVeaskJq0chTBZBRIw5RJ0kE6lidUyL8CJ9XTSaGoU0oA+bGPcNsp+Aox\n\t70epShlRLTFWvGu9K6L3W3aD0iOw58zJAN0pER/TDyIMlSvILtR6ZpXkp3ENMOFElI\n\tNpP5rUBQQUaTM9SSEREOytiNOgc45C8AOVvC5lIr1b6I7YDJgzyG8LPTLylpxbzgdH\n\tSawXdTxsaqMcw==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1685712244; x=1688304244;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=JNStbG5poG/ow/UtRjFvX8TiTOJwLn53gkEsaXMgr5Y=;\n\tb=TxLanRYhktnh10K3cbzvXRzezRdTLh6QJSrm2nuqL+k9AitWZ5JooLOOwHDBUi4O/0\n\tUPZtVQwMDVkYHCflUL3IcwlIGmbOTol7CBq1tnT+3hFLAChhwqljiB9nkQPo8+8LfYOF\n\tgya+BmbMuUvxs6yJ5JYTmQpMEFedYSTetWv7EQrYc1R0TYc2ne25XX52qq+UCr7vLpJk\n\tsPjc2Sl+DovfB73pPiB8qUkRvZMGCK77OJfszHl81x9UizTG8CuOyN4zuHqKHzABz7cK\n\tMop7TFbERmhGAUKD2+m5FnQXQi2c5iWz0gU7oj4d+F3Ne6rnmyFXKIGG/2Jkipo3Fv9G\n\tLVLQ==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"TxLanRYh\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1685712244; x=1688304244;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=JNStbG5poG/ow/UtRjFvX8TiTOJwLn53gkEsaXMgr5Y=;\n\tb=QOyXV+Z5GnA7OfNU2q6B4vQ2tjeLY28taGgguAAl+8X1mWvsOVDIueKs61DTTXX2x+\n\t5iFrP0DvnAJ8OMOajMv3UAT5/gbI7ZyY3EnB0KwOWnCTKntZpVcnMAvKgGWuk9/GNL5m\n\tplN2hQ6CgB2LHvCK8LOAjWHNqMxQXoM86s1/s3VkPabYv+bp1RPwH9bBHdSd+TF+mSgz\n\t90dV8XEwDp6kboktvUv/wCnBwSThPw90Z94p8caDpPlGDB7wcCGV96FdD3piqzplHZqs\n\t2knA4SdIeoQtLbjwY0UD9qAn1eRpk4lAXJtbUFLn060VFqtwuPqyDjokh5AiBXawCT/Y\n\tS9Zg==", "X-Gm-Message-State": "AC+VfDwVSs7WzQ+ctDGAYnap7kuq3htlc+adbUWPeAtIoxzWQp0/Nk41\n\t0TuwT/ckTWb2yqoYYNDm6LHFFzxLBmeKvC8bBxsMig==", "X-Google-Smtp-Source": "ACHHUZ6RA/BUR6fA7xwKCumAhID75A1hn2FOj/i/ylX4W6/oT+8OGMrkLK+nkrmsZFc9OI9TETw3aw==", "X-Received": "by 2002:adf:fa44:0:b0:306:2dd6:95d3 with SMTP id\n\ty4-20020adffa44000000b003062dd695d3mr4444097wrr.22.1685712243857; \n\tFri, 02 Jun 2023 06:24:03 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 2 Jun 2023 14:23:58 +0100", "Message-Id": "<20230602132358.16314-3-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20230602132358.16314-1-naush@raspberrypi.com>", "References": "<20230602132358.16314-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 2/2] ipa: rpi: Handle controls for mono\n\tvariant sensors", "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>", "From": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Naushir Patuck <naush@raspberrypi.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Do not advertise colour related controls (i.e. [A]WB, colour saturation)\nin the ControlInfoMap of available controls returned out to the\napplication.\n\nSilently ignore these controls in the control handler in case applications\ndon't use the advertised ControlInfoMap to validate controls.\n\nAs a drive-by, don't advertise controls::ColourCorrectionMatrix in the\nControlInfoMap as it is not handled by the IPA.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/rpi/common/ipa_base.cpp | 35 ++++++++++++++++++++++++++++-----\n src/ipa/rpi/common/ipa_base.h | 1 +\n 2 files changed, 31 insertions(+), 5 deletions(-)", "diff": "diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex db7a0eb3a1ca..813e01fa5cfd 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -12,6 +12,7 @@\n #include <libcamera/base/log.h>\n #include <libcamera/base/span.h>\n #include <libcamera/control_ids.h>\n+#include <libcamera/property_ids.h>\n \n #include \"controller/af_algorithm.h\"\n #include \"controller/af_status.h\"\n@@ -60,19 +61,22 @@ const ControlInfoMap::Map ipaControls{\n \t{ &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) },\n \t{ &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) },\n \t{ &controls::ExposureValue, ControlInfo(-8.0f, 8.0f, 0.0f) },\n-\t{ &controls::AwbEnable, ControlInfo(false, true) },\n-\t{ &controls::ColourGains, ControlInfo(0.0f, 32.0f) },\n-\t{ &controls::AwbMode, ControlInfo(controls::AwbModeValues) },\n \t{ &controls::Brightness, ControlInfo(-1.0f, 1.0f, 0.0f) },\n \t{ &controls::Contrast, ControlInfo(0.0f, 32.0f, 1.0f) },\n-\t{ &controls::Saturation, ControlInfo(0.0f, 32.0f, 1.0f) },\n \t{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },\n-\t{ &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) },\n \t{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },\n \t{ &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) },\n \t{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }\n };\n \n+/* IPA controls handled conditionally, if the sensor is not mono */\n+const ControlInfoMap::Map ipaColourControls{\n+\t{ &controls::AwbEnable, ControlInfo(false, true) },\n+\t{ &controls::AwbMode, ControlInfo(controls::AwbModeValues) },\n+\t{ &controls::ColourGains, ControlInfo(0.0f, 32.0f) },\n+\t{ &controls::Saturation, ControlInfo(0.0f, 32.0f, 1.0f) },\n+};\n+\n /* IPA controls handled conditionally, if the lens has a focus control */\n const ControlInfoMap::Map ipaAfControls{\n \t{ &controls::AfMode, ControlInfo(controls::AfModeValues) },\n@@ -220,6 +224,11 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa\n \t\tControlInfo(static_cast<int32_t>(mode_.minShutter.get<std::micro>()),\n \t\t\t static_cast<int32_t>(mode_.maxShutter.get<std::micro>()));\n \n+\t/* Declare colour processing related controls for non-mono sensors. */\n+\tmonoSensor_ = sensorInfo.cfaPattern == properties::draft::ColorFilterArrangementEnum::MONO;\n+\tif (!monoSensor_)\n+\t\tctrlMap.merge(ControlInfoMap::Map(ipaColourControls));\n+\n \t/* Declare Autofocus controls, only if we have a controllable lens */\n \tif (lensPresent_)\n \t\tctrlMap.merge(ControlInfoMap::Map(ipaAfControls));\n@@ -780,6 +789,10 @@ void IpaBase::applyControls(const ControlList &controls)\n \t\t}\n \n \t\tcase controls::AWB_ENABLE: {\n+\t\t\t/* Silently ignore this control for a mono sensor. */\n+\t\t\tif (monoSensor_)\n+\t\t\t\tbreak;\n+\n \t\t\tRPiController::AwbAlgorithm *awb = dynamic_cast<RPiController::AwbAlgorithm *>(\n \t\t\t\tcontroller_.getAlgorithm(\"awb\"));\n \t\t\tif (!awb) {\n@@ -799,6 +812,10 @@ void IpaBase::applyControls(const ControlList &controls)\n \t\t}\n \n \t\tcase controls::AWB_MODE: {\n+\t\t\t/* Silently ignore this control for a mono sensor. */\n+\t\t\tif (monoSensor_)\n+\t\t\t\tbreak;\n+\n \t\t\tRPiController::AwbAlgorithm *awb = dynamic_cast<RPiController::AwbAlgorithm *>(\n \t\t\t\tcontroller_.getAlgorithm(\"awb\"));\n \t\t\tif (!awb) {\n@@ -819,6 +836,10 @@ void IpaBase::applyControls(const ControlList &controls)\n \t\t}\n \n \t\tcase controls::COLOUR_GAINS: {\n+\t\t\t/* Silently ignore this control for a mono sensor. */\n+\t\t\tif (monoSensor_)\n+\t\t\t\tbreak;\n+\n \t\t\tauto gains = ctrl.second.get<Span<const float>>();\n \t\t\tRPiController::AwbAlgorithm *awb = dynamic_cast<RPiController::AwbAlgorithm *>(\n \t\t\t\tcontroller_.getAlgorithm(\"awb\"));\n@@ -867,6 +888,10 @@ void IpaBase::applyControls(const ControlList &controls)\n \t\t}\n \n \t\tcase controls::SATURATION: {\n+\t\t\t/* Silently ignore this control for a mono sensor. */\n+\t\t\tif (monoSensor_)\n+\t\t\t\tbreak;\n+\n \t\t\tRPiController::CcmAlgorithm *ccm = dynamic_cast<RPiController::CcmAlgorithm *>(\n \t\t\t\tcontroller_.getAlgorithm(\"ccm\"));\n \t\t\tif (!ccm) {\ndiff --git a/src/ipa/rpi/common/ipa_base.h b/src/ipa/rpi/common/ipa_base.h\nindex 6f9c46bb16b1..39d00760d012 100644\n--- a/src/ipa/rpi/common/ipa_base.h\n+++ b/src/ipa/rpi/common/ipa_base.h\n@@ -87,6 +87,7 @@ private:\n \tstd::map<unsigned int, MappedFrameBuffer> buffers_;\n \n \tbool lensPresent_;\n+\tbool monoSensor_;\n \tControlList libcameraMetadata_;\n \n \tstd::array<RPiController::Metadata, numMetadataContexts> rpiMetadata_;\n", "prefixes": [ "libcamera-devel", "v2", "2/2" ] }