Show a patch.

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

{
    "id": 21332,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21332/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21332/",
    "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": "<20240923093317.3500444-3-chenghaoyang@google.com>",
    "date": "2024-09-23T09:30:45",
    "name": "[v5,2/3] libcamera: Add face detection controls",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "e2d543b75b6a08a513ce6356213cd557840e03c8",
    "submitter": {
        "id": 117,
        "url": "https://patchwork.libcamera.org/api/1.1/people/117/?format=api",
        "name": "Cheng-Hao Yang",
        "email": "chenghaoyang@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21332/mbox/",
    "series": [
        {
            "id": 4614,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4614/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4614",
            "date": "2024-09-23T09:30:43",
            "name": "Add Face Detection Controls",
            "version": 5,
            "mbox": "https://patchwork.libcamera.org/series/4614/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21332/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21332/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 39018C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Sep 2024 09:33:33 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C62E863515;\n\tMon, 23 Sep 2024 11:33:32 +0200 (CEST)",
            "from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com\n\t[IPv6:2607:f8b0:4864:20::62d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 667F66350D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Sep 2024 11:33:27 +0200 (CEST)",
            "by mail-pl1-x62d.google.com with SMTP id\n\td9443c01a7336-2053f6b8201so35684135ad.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Sep 2024 02:33:27 -0700 (PDT)",
            "from chenghaoyang-low.c.googlers.com.com\n\t(0.223.81.34.bc.googleusercontent.com. [34.81.223.0])\n\tby smtp.gmail.com with ESMTPSA id\n\td9443c01a7336-207946d6673sm129864995ad.158.2024.09.23.02.33.24\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 23 Sep 2024 02:33:25 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"O+ZXrX4Q\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1727084005; x=1727688805;\n\tdarn=lists.libcamera.org; \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=t65ZdH9k3KpYKYy8IWDtxVVxE0TR5J85hSoLMh0Yk9Q=;\n\tb=O+ZXrX4Q/HdSZaIn63SopqboL3ivWLntbYuo20jKYAJElO97vl80ZbJsC1Y2hd2wu0\n\tRv69+fsst60/VjV46dOZ8FLKgMJ44cx2/2j+eZEgg3HlNAMhK1MKZ4PfLlNp1SiSf4t0\n\tyDTyWtauHBuJU1GDMGrxKUm/lZdCMwRGgwtgM=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1727084005; x=1727688805;\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=t65ZdH9k3KpYKYy8IWDtxVVxE0TR5J85hSoLMh0Yk9Q=;\n\tb=FzW7k/Ozd3aClGZ0knSWak0hhxMbx1KcXvkDwvVuNqJV8fqUgY0Gn+HoOk+ROlBJkb\n\tyyk/YaAWQV6S2qWwNF8RBj0dpVLXcpXZVOdNfsOpnpEjQB+t13PNUtGmz1uibW9NE6eU\n\tV7lruAyfvfTxyt1ELzvvDCLZDdHDe7VQ6dH7Sbie4PBHFqAZ+X7pnPPZCNQrV7hVpBip\n\tL9frKs0VQ1Hccz/4CLSZqwijgR+pYdj+oE3jN+oc5tAAL6CLgf3gQQnlDgJjah/hn8Z1\n\tHmigseNPGIwFTfTdr/MXJdte9udtU3J0NuK9AeWcvOjaUbiCytR5/9xm4AM5AwujV0wA\n\tk4Eg==",
        "X-Gm-Message-State": "AOJu0YyZmw91dOMHTeuQZWThm3+sItaEOfdDijhyQLaWadtxjxh6iV0Y\n\t1E/RVnfEijirA4qDL3i+xx2Epjagwu+NMYJ2GjSbjVuOkT3ybydVjnOj0JM1yPWKPs6gcA3V8qM\n\t=",
        "X-Google-Smtp-Source": "AGHT+IEkbLYZeRTdH+vdsWFcjTyXLMXXflVO4aZxayTiUTXAcVB2pwp1NaHcAMDzkvNzafn4AcN8yw==",
        "X-Received": "by 2002:a17:902:ebc4:b0:202:508c:b598 with SMTP id\n\td9443c01a7336-208d9874d94mr139975645ad.59.1727084005621; \n\tMon, 23 Sep 2024 02:33:25 -0700 (PDT)",
        "From": "Harvey Yang <chenghaoyang@chromium.org>",
        "X-Google-Original-From": "Harvey Yang <chenghaoyang@google.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Yudhistira Erlandinata <yerlandinata@chromium.org>,\n\tbecker hsieh <beckerh@chromium.org>,\n\tHarvey Yang <chenghaoyang@chromium.org>",
        "Subject": "[PATCH v5 2/3] libcamera: Add face detection controls",
        "Date": "Mon, 23 Sep 2024 09:30:45 +0000",
        "Message-ID": "<20240923093317.3500444-3-chenghaoyang@google.com>",
        "X-Mailer": "git-send-email 2.46.0.792.g87dc391469-goog",
        "In-Reply-To": "<20240923093317.3500444-1-chenghaoyang@google.com>",
        "References": "<20240923093317.3500444-1-chenghaoyang@google.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: Yudhistira Erlandinata <yerlandinata@chromium.org>\n\nAdd FaceDetectMode, FaceDetectFaceRectangles, FaceDetectFaceScores,\nand FaceDetectFaceLandmark. Also add ControlTypePoint for supporting\nFaceDetectFaceLandmark.\n\nSigned-off-by: Yudhistira Erlandinata <yerlandinata@chromium.org>\nCo-developed-by: becker hsieh <beckerh@chromium.org>\nCo-developed-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n include/libcamera/controls.h         |  6 ++\n src/libcamera/control_ids_draft.yaml | 85 ++++++++++++++++++++++++++++\n src/libcamera/controls.cpp           |  6 ++\n 3 files changed, 97 insertions(+)",
    "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 7c2bb287..bf1b8609 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -34,6 +34,7 @@ enum ControlType {\n \tControlTypeString,\n \tControlTypeRectangle,\n \tControlTypeSize,\n+\tControlTypePoint,\n };\n \n namespace details {\n@@ -87,6 +88,11 @@ struct control_type<Size> {\n \tstatic constexpr ControlType value = ControlTypeSize;\n };\n \n+template<>\n+struct control_type<Point> {\n+\tstatic constexpr ControlType value = ControlTypePoint;\n+};\n+\n template<typename T, std::size_t N>\n struct control_type<Span<T, N>> : public control_type<std::remove_cv_t<T>> {\n };\ndiff --git a/src/libcamera/control_ids_draft.yaml b/src/libcamera/control_ids_draft.yaml\nindex 9bef5bf1..c0cf5320 100644\n--- a/src/libcamera/control_ids_draft.yaml\n+++ b/src/libcamera/control_ids_draft.yaml\n@@ -227,4 +227,89 @@ controls:\n             value. All of the custom test patterns will be static (that is the\n             raw image must not vary from frame to frame).\n \n+  - FaceDetectMode:\n+      type: uint8_t\n+      description: |\n+        Reporting mode of face detection.\n+\n+        The number of faces in each list must be the same.\n+\n+        Currently identical to ANDROID_STATISTICS_FACE_DETECT_MODE.\n+\n+        \\sa FaceDetectFaceRectangles\n+        \\sa FaceDetectFaceScores\n+        \\sa FaceDetectFaceLandmarks\n+        \\sa FaceDetectFaceIds\n+\n+      enum:\n+        - name: FaceDetectModeOff\n+          value: 0\n+          description: |\n+            Pipeline should not report face detection result.\n+        - name: FaceDetectModeSimple\n+          value: 1\n+          description: |\n+            Pipeline should at least report FaceDetectFaceRectangles and\n+            FaceDetectFaceScores for each detected faces.\n+            FaceDetectFaceLandmarks and FaceDetectFaceIds is optional.\n+\n+        - name: FaceDetectModeFull\n+          value: 2\n+          description: |\n+            Pipeline should report all face controls, including\n+            FaceDetectFaceRectangles, FaceDetectFaceScores,\n+            FaceDetectFaceLandmarks, and FaceDeteceFaceIds.\n+\n+  - FaceDetectFaceRectangles:\n+      type: Rectangle\n+      description: |\n+        Boundary rectangles of the detected faces.\n+        The number of values should be the number of faces.\n+\n+        The FaceDetectFaceRectangles control can only be returned in metadata.\n+\n+        Currently identical to ANDROID_STATISTICS_FACE_RECTANGLES.\n+\n+      size: [n]\n+\n+  - FaceDetectFaceScores:\n+      type: uint8_t\n+      description: |\n+        Confidence score of each of the detected faces by face detector.\n+        The range of score is [0, 100].\n+        The FaceDetectFaceScores control can only be returned in metadata.\n+        The number of values should be the number of faces.\n+\n+        Currently identical to ANDROID_STATISTICS_FACE_SCORES.\n+\n+      size: [n]\n+\n+  - FaceDetectFaceLandmarks:\n+      type: Point\n+      description: |\n+        Array of human face landmark coordinates in format:\n+        [..., left_eye_i, right_eye_i, mouth_i, left_eye_i+1, ...],\n+        with i = index of face.\n+        The number of values should be 3 * the number of faces.\n+\n+        The FaceDetectFaceLandmarks control can only be returned in metadata.\n+\n+        Currently identical to ANDROID_STATISTICS_FACE_LANDMARKS.\n+\n+      size: [n]\n+\n+  - FaceDetectFaceIds:\n+      type: int32_t\n+      description: |\n+        Each detected face is given a unique ID that is valid for as long as\n+        the face is visible to the camera device. A face that leaves the field\n+        of view and later returns may be assigned a new ID.\n+        The number of values should be the number of faces.\n+\n+        The FaceDetectFaceIds control can only be returned in metadata.\n+\n+        Currently identical to ANDROID_STATISTICS_FACE_IDS.\n+\n+      size: [n]\n+\n ...\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex dba74404..c452e607 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -60,6 +60,7 @@ static constexpr size_t ControlValueSize[] = {\n \t[ControlTypeString]\t\t= sizeof(char),\n \t[ControlTypeRectangle]\t\t= sizeof(Rectangle),\n \t[ControlTypeSize]\t\t= sizeof(Size),\n+\t[ControlTypePoint]\t\t= sizeof(Point),\n };\n \n } /* namespace */\n@@ -254,6 +255,11 @@ std::string ControlValue::toString() const\n \t\t\tstr += value->toString();\n \t\t\tbreak;\n \t\t}\n+\t\tcase ControlTypePoint: {\n+\t\t\tconst Point *value = reinterpret_cast<const Point *>(data);\n+\t\t\tstr += value->toString();\n+\t\t\tbreak;\n+\t\t}\n \t\tcase ControlTypeNone:\n \t\tcase ControlTypeString:\n \t\t\tbreak;\n",
    "prefixes": [
        "v5",
        "2/3"
    ]
}