Show a patch.

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

{
    "id": 18157,
    "url": "https://patchwork.libcamera.org/api/patches/18157/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18157/",
    "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": "<20230119104544.9456-11-naush@raspberrypi.com>",
    "date": "2023-01-19T10:45:40",
    "name": "[libcamera-devel,v1,10/14] ipa: raspberrypi: Handle autofocus algorithm results",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "4a28f73fc23e73251d9e29bc5b6aa85a945744be",
    "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/18157/mbox/",
    "series": [
        {
            "id": 3715,
            "url": "https://patchwork.libcamera.org/api/series/3715/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3715",
            "date": "2023-01-19T10:45:30",
            "name": "Raspberry Pi: Camera Module 3 support",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3715/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18157/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18157/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 828A6C3297\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 19 Jan 2023 10:46:06 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1FEC16260A;\n\tThu, 19 Jan 2023 11:46:06 +0100 (CET)",
            "from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DCAE261EFC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Jan 2023 11:45:59 +0100 (CET)",
            "by mail-wm1-x32e.google.com with SMTP id m15so1149941wms.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Jan 2023 02:45:59 -0800 (PST)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tbe12-20020a05600c1e8c00b003db06224953sm5332029wmb.41.2023.01.19.02.45.58\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 19 Jan 2023 02:45:58 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1674125166;\n\tbh=hOUZPXIlhEQqFR0RsMcg2Z/jh8tJtOT052B+m706PIo=;\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=Anhrv8RgSuDh0Yi69aHfVUwHYpJ64DocAf6FyYtrnx03/855C5tqukJQhjcqoeHPj\n\tuClNM7cq2Oo/rVVSEFAcgZaXDOq5q8VTxtEcMWtZBqGzARR+VRIxnG1YeEggl13Dn1\n\tTHbwT51p1qd84yA7MBdEemvbgpMtUmpdSKXK9griYwXxup9Wdp1c+kc4+/cGO0nDps\n\tBtBgiHOFR7w5womKayicziIEqKX+nRV6cjI4pakAdDo5J1Omi3kDjEC/LWaRz0srea\n\trzEBA/x79ZT+53jd3hqD2anceyVRnoNyDqMB7/kREQE8QQx8//znSkE6CNmB6EKAnG\n\tqx/P/zmrx7Z4A==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\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=daQ5WIrNK17AMNTB2uJujU/y+E4tht6Eh2qZ398InRs=;\n\tb=PVoU519iVZfUgbPhfFPg/GgjI7M74yM3uwhCzg/Y7arPh1JVlXU8V2NZjRxA4kmUKM\n\t7GXAbBgrjpz0/2S/s1BUz8r65tIlxSy4tyKcQfxZIY36KuhWK854ooLfhFZAMNcTMyPx\n\tWul9T1rg1tzA5xe6+44Mr8onzK/TBqFY6A1h15mEvPobaj4T3mmgHt1AhXAnv0T1Z3RE\n\tzYI8aufYISBC670emaWmGguPE4h/J2mOcf3MZ/16xg9Rms6tLdr1xQhU23ak/23/kk2g\n\tmyYY2ApCLMURkt7Ps8FI4eDjpIo4tfExfuPVdxDT9u5j4/zvM7Yv00k7gnj+Po7N2YSG\n\tb4jQ=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"PVoU519i\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\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=daQ5WIrNK17AMNTB2uJujU/y+E4tht6Eh2qZ398InRs=;\n\tb=SEn5ILcwXpZOJ4Klsx/W9kUSwuAmEtLTY+fQjpmtU5UmqjcTriNiV4YSoi7CS5E/hP\n\tJx2tZsREVOhaWK3cKOyrUYp72KK0qzSF44Z4yTBEb2Ivh3JBB6iiMwOqq4c8EFuFO0f7\n\tIWXIQxeJPX26HBuiRf7mxAL6949ebjM7Irxrj4KedujhcNBNUnNLyjAxNY/6Wk5oVPgn\n\tuYLvpPoIODwFIfxRHPrNDETT+LY2Ke25ci8lviMDkyUdAQyzM5v9BQOpm8KPeqE8OAzl\n\tA2IVz35Ta4/Mf29P2obmBWq0QagK6T6g7TbB637G/ZYOH1vmDICBV3dpk6JGsycGX6/d\n\tumcQ==",
        "X-Gm-Message-State": "AFqh2kqiETvQYWSYCfyicnYfRc98ToMHn2UpoUjrFyzZFH/77GW/tdZ6\n\tmt/xejae8IUUg4RI5zbc1r8PbKpNNcxS6F7mNLo=",
        "X-Google-Smtp-Source": "AMrXdXvdv6yAespsxgkMihXttyWTfmOghiWkIcIPsZi8jLa0SDJu8X/dfRrENAoNmyr6UpaeIxcIGA==",
        "X-Received": "by 2002:a05:600c:5028:b0:3db:1dea:75c9 with SMTP id\n\tn40-20020a05600c502800b003db1dea75c9mr2033501wmr.28.1674125159098; \n\tThu, 19 Jan 2023 02:45:59 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 19 Jan 2023 10:45:40 +0000",
        "Message-Id": "<20230119104544.9456-11-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230119104544.9456-1-naush@raspberrypi.com>",
        "References": "<20230119104544.9456-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 10/14] ipa: raspberrypi: Handle\n\tautofocus algorithm results",
        "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>",
        "Cc": "Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>\n\nHandle the results returned from the autofocus algorithm by updating lens\nactuator position to the desired value. Update the Request metadata with the\nalgorithm status to provide back to the application.\n\nSigned-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/raspberrypi.cpp | 48 +++++++++++++++++++++++++++++\n 1 file changed, 48 insertions(+)",
    "diff": "diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 0eb55ed605b6..fbace14b1afe 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -32,6 +32,7 @@\n #include \"libcamera/internal/mapped_framebuffer.h\"\n \n #include \"af_algorithm.h\"\n+#include \"af_status.h\"\n #include \"agc_algorithm.h\"\n #include \"agc_status.h\"\n #include \"alsc_status.h\"\n@@ -164,6 +165,7 @@ private:\n \tvoid applySharpen(const struct SharpenStatus *sharpenStatus, ControlList &ctrls);\n \tvoid applyDPC(const struct DpcStatus *dpcStatus, ControlList &ctrls);\n \tvoid applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls);\n+\tvoid applyAF(const struct AfStatus *afStatus, ControlList &lensCtrls);\n \tvoid resampleTable(uint16_t dest[], double const src[12][16], int destW, int destH);\n \n \tstd::map<unsigned int, MappedFrameBuffer> buffers_;\n@@ -629,6 +631,36 @@ void IPARPi::reportMetadata(unsigned int ipaContext)\n \t\t\tm[i] = ccmStatus->matrix[i];\n \t\tlibcameraMetadata_.set(controls::ColourCorrectionMatrix, m);\n \t}\n+\n+\tconst AfStatus *afStatus = rpiMetadata.getLocked<AfStatus>(\"af.status\");\n+\tif (afStatus) {\n+\t\tint32_t s, p;\n+\t\tswitch (afStatus->state) {\n+\t\tcase AfState::Scanning:\n+\t\t\ts = controls::AfStateScanning;\n+\t\t\tbreak;\n+\t\tcase AfState::Focused:\n+\t\t\ts = controls::AfStateFocused;\n+\t\t\tbreak;\n+\t\tcase AfState::Failed:\n+\t\t\ts = controls::AfStateFailed;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\ts = controls::AfStateIdle;\n+\t\t}\n+\t\tswitch (afStatus->pauseState) {\n+\t\tcase AfPauseState::Pausing:\n+\t\t\tp = controls::AfPauseStatePausing;\n+\t\t\tbreak;\n+\t\tcase AfPauseState::Paused:\n+\t\t\tp = controls::AfPauseStatePaused;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tp = controls::AfPauseStateRunning;\n+\t\t}\n+\t\tlibcameraMetadata_.set(controls::AfState, s);\n+\t\tlibcameraMetadata_.set(controls::AfPauseState, p);\n+\t}\n }\n \n bool IPARPi::validateSensorControls()\n@@ -1294,6 +1326,14 @@ void IPARPi::prepareISP(const ISPConfig &data)\n \tif (dpcStatus)\n \t\tapplyDPC(dpcStatus, ctrls);\n \n+\tconst AfStatus *afStatus = rpiMetadata.getLocked<AfStatus>(\"af.status\");\n+\tif (afStatus) {\n+\t\tControlList lensctrls(lensCtrls_);\n+\t\tapplyAF(afStatus, lensctrls);\n+\t\tif (!lensctrls.empty())\n+\t\t\tsetLensControls.emit(lensctrls);\n+\t}\n+\n \tif (!ctrls.empty())\n \t\tsetIspControls.emit(ctrls);\n }\n@@ -1619,6 +1659,14 @@ void IPARPi::applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls)\n \tctrls.set(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING, c);\n }\n \n+void IPARPi::applyAF(const struct AfStatus *afStatus, ControlList &lensCtrls)\n+{\n+\tif (afStatus->lensSetting) {\n+\t\tControlValue v(afStatus->lensSetting.value());\n+\t\tlensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, v);\n+\t}\n+}\n+\n /*\n  * Resamples a 16x12 table with central sampling to destW x destH with corner\n  * sampling.\n",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "10/14"
    ]
}