Show a patch.

GET /api/1.1/patches/18395/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 18395,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/18395/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18395/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20230314144834.85193-6-dse@thaumatec.com>",
    "date": "2023-03-14T14:48:29",
    "name": "[libcamera-devel,v4,05/10] ipa: af_hill_climbing: Add \"Windows\" metering mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "a5effc75bb89eccd8fc19736fe71754fb855ab18",
    "submitter": {
        "id": 126,
        "url": "https://patchwork.libcamera.org/api/1.1/people/126/?format=api",
        "name": "Daniel Semkowicz",
        "email": "dse@thaumatec.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18395/mbox/",
    "series": [
        {
            "id": 3805,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3805/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3805",
            "date": "2023-03-14T14:48:24",
            "name": "ipa: rkisp1: Add autofocus algorithm",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/3805/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18395/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18395/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 99468C3263\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Mar 2023 14:50:02 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1FF1D62722;\n\tTue, 14 Mar 2023 15:50:02 +0100 (CET)",
            "from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com\n\t[IPv6:2a00:1450:4864:20::22c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E1A016270F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Mar 2023 15:49:53 +0100 (CET)",
            "by mail-lj1-x22c.google.com with SMTP id b10so16321036ljr.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Mar 2023 07:49:53 -0700 (PDT)",
            "from localhost.localdomain ([91.90.166.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tq25-20020a2eb4b9000000b00295a35f30e1sm470961ljm.115.2023.03.14.07.49.53\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 14 Mar 2023 07:49:53 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1678805402;\n\tbh=A2RCsHkfkpU7qUA8+y5Em7gqpmln87ljqcVoTTsnXK4=;\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:Cc:\n\tFrom;\n\tb=pDK/9K+q45pwhcmEO+tbxV+WDKklIcAAZ+2/RREc7bXgEzcZxLy8iyyJvEZ5wApiy\n\tn1ZXsQ+KJhkLunJaXWS8qz7gO3SLNJ8MyxJyMX/BNlBRxPjKl/qzq9jBrnIA9D5ZkB\n\tpuME/t2xans3/CgVW/1ANGPrUy3F2erxOTFk2nluEhB0e5Kr47coFURyPQGPHdUo16\n\tuirWbQZq8Nh8+E92LvMda6pMSHGiqxsr/mTi5NY7szTEKKNSeZqGniw7lfTaxC08Cd\n\t4+xG/ctz3g9YLWIPvE+Pr+OatB+MsBJ8dfLwHtmVYGICZhZ+wqWdifW4SwBT33A8z3\n\t64ffePNl41A8g==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112; t=1678805393;\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=I8Rq7qVe+BzRDOtVw2SyeCLk2jE0HIkmVbPuakObb0Q=;\n\tb=12ILASIj3zvIXYDJD0gdFF96NL3qNW+NNFVV+pt4Eaf8+xEmVxgcAbZzis056E6G1I\n\t/y75Ewi2WJpJneA/K25vj2dU5WLtggo2OHGYTckv3FXt33S8nVT+9mdT8d3qHQiCtk1R\n\tJ1uqZpoBNHeszegSzf5YTOF+2tDB74K4zQse6SZB1TCxqiTVGtfEGP6bmiV/KuvcBoLa\n\tQi6veLtju3Mcs4uIJ1Zer49TpniPCNhnnFEBH9MOL9B3s7qnwW/Ses3O0BgLe2xP0AIS\n\tEB3YrqP64WMpNpgLsYCt7tedmOf303pqmxe4nq5/mY/VAe11lrlFJ8LIRa0f95OIZd/Y\n\t5kXw=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=thaumatec-com.20210112.gappssmtp.com\n\theader.i=@thaumatec-com.20210112.gappssmtp.com header.b=\"12ILASIj\"; \n\tdkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1678805393;\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=I8Rq7qVe+BzRDOtVw2SyeCLk2jE0HIkmVbPuakObb0Q=;\n\tb=tgyCGFUOhuWBjcvpbAKPWX2+FEmEgaKtEXkr0dYbp54wwyxLA8DS881mJUwR/Dg2tH\n\tNpBhbyq5vx7hxgyJPViBx2oFkCdT+z37OuSnLkriiZ4Yz9TOIaBisORg7LT/5/fkTcAU\n\tjexu4LcV3kE3OZlWv8C0IzAZ0ALaBJPTlPB+jM7VTVGENIDD5jz7D+2RGy6RZOtZMTlA\n\tuHor2dLnd4ife6HLB23nJJ5+u6XttnE0PG3COi59t6Bf3rauw/6TQy2ik/MTNilzlpe8\n\t5/Se5g+lcJqVlC9USUhCKTl9XvLkr685hFpv+xy4EdIl4iJ46uZfx/D18OY9djC6621I\n\tyWKQ==",
        "X-Gm-Message-State": "AO0yUKUOz30Xpt4hkpQpStZ/F0xEVogKWx1tn1olrGIoeqNtm+fl0bun\n\tE6v96GX2XW4Kqn7NDK54lrFaOjHL9HUEfGvZm74=",
        "X-Google-Smtp-Source": "AK7set+IuIfHpGhEAIaioBmEl5beCamarzFE5RiwE8MbVrafJUbK2Q2S7lOEh6BpniIzOQwMAt8x4Q==",
        "X-Received": "by 2002:a2e:b8cb:0:b0:298:592e:113a with SMTP id\n\ts11-20020a2eb8cb000000b00298592e113amr12004257ljp.6.1678805393573; \n\tTue, 14 Mar 2023 07:49:53 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 14 Mar 2023 15:48:29 +0100",
        "Message-Id": "<20230314144834.85193-6-dse@thaumatec.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20230314144834.85193-1-dse@thaumatec.com>",
        "References": "<20230314144834.85193-1-dse@thaumatec.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 05/10] ipa: af_hill_climbing: Add\n\t\"Windows\" metering mode",
        "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": "Daniel Semkowicz via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Daniel Semkowicz <dse@thaumatec.com>",
        "Cc": "jacopo.mondi@ideasonboard.com",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Add support for setting user defined auto focus window in the\nAfHillClimbing. This enables usage of AfMetering and AfWindows controls.\nEach time, there is a need for changing the window configuration in the\nISP, the signal is emitted. Platform layer that wants to use\nthe \"Windows\" metering mode, needs to connect to this signal\nand configure the ISP on each emission.\n\nCurrently only one window is supported.\n\nSigned-off-by: Daniel Semkowicz <dse@thaumatec.com>\n---\n .../libipa/algorithms/af_hill_climbing.cpp    | 52 +++++++++++++++++--\n src/ipa/libipa/algorithms/af_hill_climbing.h  | 12 ++++-\n 2 files changed, 58 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/src/ipa/libipa/algorithms/af_hill_climbing.cpp b/src/ipa/libipa/algorithms/af_hill_climbing.cpp\nindex 2b99afef..3421f240 100644\n--- a/src/ipa/libipa/algorithms/af_hill_climbing.cpp\n+++ b/src/ipa/libipa/algorithms/af_hill_climbing.cpp\n@@ -83,15 +83,28 @@ int AfHillClimbing::init(const YamlObject &tuningData)\n  * \\brief Configure the AfHillClimbing with sensor and lens information\n  * \\param[in] minFocusPosition Minimum position supported by camera lens\n  * \\param[in] maxFocusPosition Maximum position supported by camera lens\n+ * \\param[in] outputSize Camera sensor output size\n  *\n  * This method should be called in the libcamera::ipa::Algorithm::configure()\n  * method of the platform layer.\n  */\n void AfHillClimbing::configure(int32_t minFocusPosition,\n-\t\t\t       int32_t maxFocusPosition)\n+\t\t\t       int32_t maxFocusPosition,\n+\t\t\t       const Size &outputSize)\n {\n \tminLensPosition_ = minFocusPosition;\n \tmaxLensPosition_ = maxFocusPosition;\n+\n+\t/*\n+\t * Default AF window of 3/4 size of the camera sensor output,\n+\t * placed at the center\n+\t */\n+\tdefaultWindow_ = Rectangle(outputSize.width / 8,\n+\t\t\t\t   outputSize.height / 8,\n+\t\t\t\t   3 * outputSize.width / 4,\n+\t\t\t\t   3 * outputSize.height / 4);\n+\n+\twindowUpdateRequested.emit(defaultWindow_);\n }\n \n /**\n@@ -165,6 +178,14 @@ void AfHillClimbing::setFramesToSkip(uint32_t n)\n \t\tframesToSkip_ = n;\n }\n \n+/**\n+ * \\var AfHillClimbing::windowUpdateRequested\n+ * \\brief Signal emitted when change in AF window was requested\n+ *\n+ * Platform layer supporting AF windows should connect to this signal\n+ * and configure the ISP with new window on each emition.\n+ */\n+\n void AfHillClimbing::setMode(controls::AfModeEnum mode)\n {\n \tif (mode == mode_)\n@@ -190,14 +211,35 @@ void AfHillClimbing::setSpeed([[maybe_unused]] controls::AfSpeedEnum speed)\n \tLOG(Af, Error) << __FUNCTION__ << \" not implemented!\";\n }\n \n-void AfHillClimbing::setMeteringMode([[maybe_unused]] controls::AfMeteringEnum metering)\n+void AfHillClimbing::setMeteringMode(controls::AfMeteringEnum metering)\n {\n-\tLOG(Af, Error) << __FUNCTION__ << \" not implemented!\";\n+\tif (metering == meteringMode_)\n+\t\treturn;\n+\n+\tif (metering == controls::AfMeteringWindows) {\n+\t\twindowUpdateRequested.emit(userWindow_);\n+\t} else {\n+\t\twindowUpdateRequested.emit(defaultWindow_);\n+\t}\n+\n+\tmeteringMode_ = metering;\n }\n \n-void AfHillClimbing::setWindows([[maybe_unused]] Span<const Rectangle> windows)\n+void AfHillClimbing::setWindows(Span<const Rectangle> windows)\n {\n-\tLOG(Af, Error) << __FUNCTION__ << \" not implemented!\";\n+\tif (windows.size() != 1) {\n+\t\tLOG(Af, Error) << \"Only one AF window is supported\";\n+\t\treturn;\n+\t}\n+\n+\t/* \\todo Check if window size is valid for ISP */\n+\n+\tLOG(Af, Debug) << \"setWindows: \" << windows[0];\n+\n+\tuserWindow_ = windows[0];\n+\n+\tif (meteringMode_ == controls::AfMeteringWindows)\n+\t\twindowUpdateRequested.emit(userWindow_);\n }\n \n void AfHillClimbing::setTrigger(controls::AfTriggerEnum trigger)\ndiff --git a/src/ipa/libipa/algorithms/af_hill_climbing.h b/src/ipa/libipa/algorithms/af_hill_climbing.h\nindex b361e5a1..4f507010 100644\n--- a/src/ipa/libipa/algorithms/af_hill_climbing.h\n+++ b/src/ipa/libipa/algorithms/af_hill_climbing.h\n@@ -10,6 +10,7 @@\n #pragma once\n \n #include <libcamera/base/log.h>\n+#include <libcamera/base/signal.h>\n \n #include \"af.h\"\n \n@@ -25,13 +26,16 @@ class AfHillClimbing : public Af\n {\n public:\n \tint init(const YamlObject &tuningData);\n-\tvoid configure(int32_t minFocusPosition, int32_t maxFocusPosition);\n+\tvoid configure(int32_t minFocusPosition, int32_t maxFocusPosition,\n+\t\t       const Size &outputSize);\n \tint32_t process(double currentContrast);\n \tvoid setFramesToSkip(uint32_t n);\n \n \tcontrols::AfStateEnum state() final { return state_; }\n \tcontrols::AfPauseStateEnum pauseState() final { return pauseState_; }\n \n+\tSignal<const Rectangle &> windowUpdateRequested;\n+\n private:\n \tvoid setMode(controls::AfModeEnum mode) final;\n \tvoid setRange(controls::AfRangeEnum range) final;\n@@ -54,6 +58,7 @@ private:\n \tcontrols::AfModeEnum mode_ = controls::AfModeManual;\n \tcontrols::AfStateEnum state_ = controls::AfStateIdle;\n \tcontrols::AfPauseStateEnum pauseState_ = controls::AfPauseStateRunning;\n+\tcontrols::AfMeteringEnum meteringMode_ = controls::AfMeteringAuto;\n \n \t/* VCM step configuration. It is the current setting of the VCM step. */\n \tint32_t lensPosition_ = 0;\n@@ -87,6 +92,11 @@ private:\n \n \t/* Max ratio of variance change, 0.0 < maxChange_ < 1.0 */\n \tdouble maxChange_;\n+\n+\t/* Default AF window */\n+\tRectangle defaultWindow_;\n+\t/* AF window set by user using AF_WINDOWS control */\n+\tRectangle userWindow_;\n };\n \n } /* namespace ipa::common::algorithms */\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "05/10"
    ]
}