Show a patch.

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

{
    "id": 16601,
    "url": "https://patchwork.libcamera.org/api/patches/16601/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16601/",
    "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": "<20220713084317.24268-4-dse@thaumatec.com>",
    "date": "2022-07-13T08:43:09",
    "name": "[libcamera-devel,v2,03/11] ipa: rkisp1: Add AF algorithm basing on common AfHillClimbing class",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d343031fedc0dd11a42b8e4001422659a19f05ac",
    "submitter": {
        "id": 126,
        "url": "https://patchwork.libcamera.org/api/people/126/?format=api",
        "name": "Daniel Semkowicz",
        "email": "dse@thaumatec.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16601/mbox/",
    "series": [
        {
            "id": 3276,
            "url": "https://patchwork.libcamera.org/api/series/3276/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3276",
            "date": "2022-07-13T08:43:06",
            "name": "ipa: rkisp1: Add autofocus algorithm",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3276/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16601/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16601/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 89F99BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Jul 2022 08:43:39 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4C0DF6331B;\n\tWed, 13 Jul 2022 10:43:39 +0200 (CEST)",
            "from mail-wr1-x433.google.com (mail-wr1-x433.google.com\n\t[IPv6:2a00:1450:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DF23063315\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Jul 2022 10:43:36 +0200 (CEST)",
            "by mail-wr1-x433.google.com with SMTP id d16so14448614wrv.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Jul 2022 01:43:36 -0700 (PDT)",
            "from localhost.localdomain (ip092042140082.rev.nessus.at.\n\t[92.42.140.82]) by smtp.gmail.com with ESMTPSA id\n\tbg32-20020a05600c3ca000b003a04d19dab3sm5667468wmb.3.2022.07.13.01.43.34\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 13 Jul 2022 01:43:36 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657701819;\n\tbh=3PwVJbBvJmfeOkck+hHDrKlm2mNGUdi/IampTEFq/pQ=;\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=0fH+pobQpcAfKxvWWjRB+vcdLd9SKoL4qiC+P4+HwQ35dYMjdSKPnjbvuDFDmJUw5\n\tvWuTKhciGvUBZinj7FEEwHsiW69GhRoHK8G86LFBbdirIEwrwZ13ughHyTi4aVXA1i\n\tXiH/3CdRyMW3AuRMXCBbmNR+PnnTFs5QgzbsxgNVqHYe5x6O5GnvwwiL9LVg5bMoQq\n\tFt+HWt5a52Za5ENXPw7THGAV7O5jcyPe5iVBlZ5vQoTPvKtIY28OT8Zuo7f+XfOd/x\n\tM0Wb68tnanCAVO8Jmxiq5wI8BeK97+j5/3SuyJ4hKif2A/byNSkLN/f9bJ1nvSesMn\n\tO1LtOUFFFzDaA==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=LNUrI0Wv0kp01lau6uWaUf3XyBtzo2JjTSprG0e5S14=;\n\tb=8EGeQgKOOOisH7P0dTOndC1qlw2bK4ghXGI+UkDzvEMC+cN4F0gxaUKEa8jxjsP9gF\n\tr5W54MuvcPKYH1DRsV1TSrh3miFtfPYyG200zJiTo6h+zM5Ff7xJOcM5bXbm9qax64v4\n\tT1JszZ4tNCe3aqvsYzlCCdOsPAF2wxna3ix4b3m9IREWliXu6YB7l7rRO33t6bIvm6WX\n\tu+wu1Z0X+bC3qv/cAkzolpHCECOyTOugqvLNN3NNR99pfZeqatKBq8CpeTVzuXWG45Ml\n\tODE2uff+sXUo7aK+9iaiaQwqlzr0Sg+vGc8/Sc+bPSkNJ6YGfhCf2rl12stIy34Vp5KN\n\tPFSw=="
        ],
        "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=\"8EGeQgKO\"; \n\tdkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=LNUrI0Wv0kp01lau6uWaUf3XyBtzo2JjTSprG0e5S14=;\n\tb=Zy6l46vWPwrc9DtoUU9Z6AaLaRa6YQEOdgQHptbNE2Yr1qOaEbLk/4exQJ0/0u1b6k\n\t/OYqlyI8/uOqWpkosshfpKafV1K14Pr9lS5VOszJz6JkBpEJD2Q77F36esnB2tvMb6hW\n\tnyHcs1aXZLz5GLpw4QuIxrsTAVM0nJPXx2n0UTNrRkhxawqZU8GjJmxKMboRaoUJ/52F\n\tD/+2cC8A/wtwO46wCuWWlMvbmQV2Iuf0BQJbSE74fKsbpQxEU2KnCeoQDwmeLFUUxdG/\n\tTL9bTUOIQv1y0JpvB2XqGdIT9AOH0wv6f3HHEN4HDDNeZle9Y/Dd+PzzOnGYUQRMX73m\n\tmCSA==",
        "X-Gm-Message-State": "AJIora8ifm4eCJffFqzkfSGyozxhYCy4pFUE4fJfKnu1cawDdnLa4TQT\n\t8Sccda7sEp/9466H9fKszJ0qPghsJHSjnA==",
        "X-Google-Smtp-Source": "AGRyM1v5FO/Brnvq/4vMKsvTqkC++lddNc8hqxqWtIaz/2nIVBbfUMt25Dggj0QbBZjMPsfsEuFWUQ==",
        "X-Received": "by 2002:a5d:530f:0:b0:21d:9669:1f44 with SMTP id\n\te15-20020a5d530f000000b0021d96691f44mr2036275wrv.644.1657701816664; \n\tWed, 13 Jul 2022 01:43:36 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 13 Jul 2022 10:43:09 +0200",
        "Message-Id": "<20220713084317.24268-4-dse@thaumatec.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220713084317.24268-1-dse@thaumatec.com>",
        "References": "<20220713084317.24268-1-dse@thaumatec.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 03/11] ipa: rkisp1: Add AF algorithm\n\tbasing on common AfHillClimbing class",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Rockchip ISP AF block allows calculation of sharpness and luminance\nin up to three user defined windows. If no windows are set, there are\nsome default settings applied for the first window and exposed through\nthe driver. For each frame, use the sharpness value calculated for this\ndefault window and feed the hill climbing algorithm with them. Then set\nthe lens position to value calculated by the algorithm.\n\nSigned-off-by: Daniel Semkowicz <dse@thaumatec.com>\n---\n src/ipa/rkisp1/algorithms/af.cpp      | 70 +++++++++++++++++++++++++++\n src/ipa/rkisp1/algorithms/af.h        | 32 ++++++++++++\n src/ipa/rkisp1/algorithms/meson.build |  1 +\n 3 files changed, 103 insertions(+)\n create mode 100644 src/ipa/rkisp1/algorithms/af.cpp\n create mode 100644 src/ipa/rkisp1/algorithms/af.h",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/af.cpp b/src/ipa/rkisp1/algorithms/af.cpp\nnew file mode 100644\nindex 00000000..6e047804\n--- /dev/null\n+++ b/src/ipa/rkisp1/algorithms/af.cpp\n@@ -0,0 +1,70 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Theobroma Systems\n+ *\n+ * af.cpp - RkISP1 AF hill climbing based control algorithm\n+ */\n+\n+#include \"af.h\"\n+\n+/**\n+ * \\file af.h\n+ */\n+\n+namespace libcamera::ipa::rkisp1::algorithms {\n+\n+/**\n+ * \\class Af\n+ * \\brief AF control algorithm\n+ */\n+\n+LOG_DEFINE_CATEGORY(RkISP1Af)\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::configure\n+ */\n+int Af::configure([[maybe_unused]] IPAContext &context,\n+\t\t  [[maybe_unused]] const IPACameraSensorInfo &configInfo)\n+{\n+\treturn 0;\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::prepare\n+ */\n+void Af::prepare([[maybe_unused]] IPAContext &context, [[maybe_unused]] rkisp1_params_cfg *params)\n+{\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::process\n+ */\n+void Af::process(IPAContext &context,\n+\t\t [[maybe_unused]] IPAFrameContext *frameCtx,\n+\t\t const rkisp1_stat_buffer *stats)\n+{\n+\tuint32_t sharpness = stats->params.af.window[0].sum;\n+\tuint32_t luminance = stats->params.af.window[0].lum;\n+\n+\tLOG(RkISP1Af, Debug) << \"lensPosition: \" << context.frameContext.af.focus\n+\t\t\t     << \", Sharpness: \" << sharpness\n+\t\t\t     << \", Luminance: \" << luminance;\n+\n+\tuint32_t lensPosition = processAutofocus(sharpness);\n+\n+\tcontext.frameContext.af.focus = lensPosition;\n+}\n+\n+void Af::setMetering([[maybe_unused]] controls::AfMeteringEnum metering)\n+{\n+\tLOG(RkISP1Af, Error) << __FUNCTION__ << \" not implemented!\";\n+}\n+\n+void Af::setWindows([[maybe_unused]] Span<const Rectangle> windows)\n+{\n+\tLOG(RkISP1Af, Error) << __FUNCTION__ << \" not implemented!\";\n+}\n+\n+REGISTER_IPA_ALGORITHM(Af, \"Af\")\n+\n+} /* namespace libcamera::ipa::rkisp1::algorithms */\ndiff --git a/src/ipa/rkisp1/algorithms/af.h b/src/ipa/rkisp1/algorithms/af.h\nnew file mode 100644\nindex 00000000..e9afbb98\n--- /dev/null\n+++ b/src/ipa/rkisp1/algorithms/af.h\n@@ -0,0 +1,32 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Theobroma Systems\n+ *\n+ * af.h - RkISP1 AF hill climbing based control algorithm\n+ */\n+\n+#pragma once\n+\n+#include <linux/rkisp1-config.h>\n+\n+#include \"libipa/algorithms/af_hill_climbing.h\"\n+#include \"module.h\"\n+\n+namespace libcamera::ipa::rkisp1::algorithms {\n+\n+class Af : public ipa::common::algorithms::AfHillClimbing<Module>\n+{\n+public:\n+\tAf() = default;\n+\t~Af() = default;\n+\n+\tint configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;\n+\tvoid prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n+\tvoid process(IPAContext &context, IPAFrameContext *frameCtx,\n+\t\t     const rkisp1_stat_buffer *stats) override;\n+\n+\tvoid setMetering(controls::AfMeteringEnum metering) override;\n+\tvoid setWindows(Span<const Rectangle> windows) override;\n+};\n+\n+} /* namespace libcamera::ipa::rkisp1::algorithms */\ndiff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build\nindex 7ec53d89..81addcc9 100644\n--- a/src/ipa/rkisp1/algorithms/meson.build\n+++ b/src/ipa/rkisp1/algorithms/meson.build\n@@ -1,6 +1,7 @@\n # SPDX-License-Identifier: CC0-1.0\n \n rkisp1_ipa_algorithms = files([\n+    'af.cpp',\n     'agc.cpp',\n     'awb.cpp',\n     'blc.cpp',\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "03/11"
    ]
}