Patch Detail
Show a patch.
GET /api/1.1/patches/21344/?format=api
{ "id": 21344, "url": "https://patchwork.libcamera.org/api/1.1/patches/21344/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21344/", "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": "<20240924110353.2025397-3-chenghaoyang@google.com>", "date": "2024-09-24T11:02:45", "name": "[v7,2/3] libcamera: Add face detection controls", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "8abaa6d1a5a3774b73ccb14c05e6cbe180b2333a", "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/21344/mbox/", "series": [ { "id": 4618, "url": "https://patchwork.libcamera.org/api/1.1/series/4618/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4618", "date": "2024-09-24T11:02:43", "name": "Add Face Detection Controls", "version": 7, "mbox": "https://patchwork.libcamera.org/series/4618/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21344/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21344/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 D025EC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 24 Sep 2024 11:04:09 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 68BB663510;\n\tTue, 24 Sep 2024 13:04:09 +0200 (CEST)", "from mail-pg1-x530.google.com (mail-pg1-x530.google.com\n\t[IPv6:2607:f8b0:4864:20::530])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B1B146350B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Sep 2024 13:04:03 +0200 (CEST)", "by mail-pg1-x530.google.com with SMTP id\n\t41be03b00d2f7-7e6b738acd5so280989a12.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Sep 2024 04:04:03 -0700 (PDT)", "from chenghaoyang-low.c.googlers.com.com\n\t(208.158.221.35.bc.googleusercontent.com. [35.221.158.208])\n\tby smtp.gmail.com with ESMTPSA id\n\td2e1a72fcca58-71afc9833c3sm993326b3a.182.2024.09.24.04.04.00\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 24 Sep 2024 04:04:01 -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=\"F7J2m8eL\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1727175842; x=1727780642;\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=nD1aTGFoZhor1a0602dxtuqbeRDiOtQLq2EYFIgL/IE=;\n\tb=F7J2m8eLCTBdWzZ43yMy3urRtz4MYQ47Nz/DYznWLjyTh2Ds3DTCydaiXBiAb8fwj9\n\ttyb+0VRloAPddmxo16RyPCMhbTa9AX0RdE0xT56zPYG9Grq7dCIpCksmLE+gYoo2w6Ht\n\t5kLv/v0obggtfNuHFOatKSRYuuXT4wUm8hBtw=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1727175842; x=1727780642;\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=nD1aTGFoZhor1a0602dxtuqbeRDiOtQLq2EYFIgL/IE=;\n\tb=TCL/q4aAZtpesat6GjcfBCzFGOPUbN94CJoN6s486mM0EOCev5vFcPh7ZWU47P16Ob\n\tHa8hIeePcqmE0PvhJkxuHYWHK2kRJlUqmSWJUINj/7pbJfGELc4q73WkaixErswKaffj\n\tmdx6ISMOuXN9kqqMtqgj7r0UqXPytJFGCDXitnwfeRy51y9jyWvxXuFiguQqnsXTCYai\n\tawl0fuiZXVajno9fAnHLC8aFnxfua2VKppKNxrdyz6dBuZwnsVeJz6ZBAMrGwsVDy/m4\n\tk0L26TRKD1rOIeJaG/KVwESpoh+teo5vbEeFQFMpwW0ep/qgo8bfVHBvE5kzhZzg/W1k\n\tmOiw==", "X-Gm-Message-State": "AOJu0YwIafGsx/2JFKCFp+ZdlEmaayb/I6zXGbQmrbvhk6pj4SsmnwWC\n\t6/gDHa/2jC4SsQlUhq8hnl3hMurWlTtRXpwwRr7To5lYJ9ltJdZ9lMNEoMzjAEdMaVyScq2mwb4\n\t=", "X-Google-Smtp-Source": "AGHT+IGzvYP/LLry8S2fgbwzQ4FQ/tzj8rWvO5lQeLg/d5ilMhUDHOWDSARKHCGXrio72lSAVzks1Q==", "X-Received": "by 2002:a05:6a20:e605:b0:1d1:13de:68c6 with SMTP id\n\tadf61e73a8af0-1d30ca220ddmr18164417637.29.1727175841658; \n\tTue, 24 Sep 2024 04:04:01 -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 v7 2/3] libcamera: Add face detection controls", "Date": "Tue, 24 Sep 2024 11:02:45 +0000", "Message-ID": "<20240924110353.2025397-3-chenghaoyang@google.com>", "X-Mailer": "git-send-email 2.46.0.792.g87dc391469-goog", "In-Reply-To": "<20240924110353.2025397-1-chenghaoyang@google.com>", "References": "<20240924110353.2025397-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 include/libcamera/meson.build | 3 +-\n src/libcamera/control_ids_android.yaml | 98 ++++++++++++++++++++++++++\n src/libcamera/control_ranges.yaml | 4 +-\n src/libcamera/controls.cpp | 6 ++\n 5 files changed, 115 insertions(+), 2 deletions(-)\n create mode 100644 src/libcamera/control_ids_android.yaml", "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/include/libcamera/meson.build b/include/libcamera/meson.build\nindex a969a95d..4fff14d2 100644\n--- a/include/libcamera/meson.build\n+++ b/include/libcamera/meson.build\n@@ -34,6 +34,7 @@ libcamera_headers_install_dir = get_option('includedir') / libcamera_include_dir\n \n controls_map = {\n 'controls': {\n+ 'android': 'control_ids_android.yaml',\n 'draft': 'control_ids_draft.yaml',\n 'core': 'control_ids_core.yaml',\n 'rpi/vc4': 'control_ids_rpi.yaml',\n@@ -55,7 +56,7 @@ foreach mode, entry : controls_map\n files_list = []\n input_files = []\n foreach vendor, header : entry\n- if vendor != 'core' and vendor != 'draft'\n+ if vendor != 'core' and vendor != 'draft' and vendor != 'android'\n if vendor not in pipelines\n continue\n endif\ndiff --git a/src/libcamera/control_ids_android.yaml b/src/libcamera/control_ids_android.yaml\nnew file mode 100644\nindex 00000000..8b0d624f\n--- /dev/null\n+++ b/src/libcamera/control_ids_android.yaml\n@@ -0,0 +1,98 @@\n+# SPDX-License-Identifier: LGPL-2.1-or-later\n+#\n+# Copyright (C) 2024, Google Inc.\n+#\n+%YAML 1.1\n+---\n+# Unless otherwise stated, all controls are bi-directional, i.e. they can be\n+# set through Request::controls() and returned out through Request::metadata().\n+vendor: android\n+controls:\n+ - FaceDetectMode:\n+ type: uint8_t\n+ description: |\n+ Reporting mode of face detection.\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 reported in\n+ FaceDetectFaceRectangles.\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 reported in\n+ FaceDetectFaceRectangles.\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 reported in\n+ FaceDetectFaceRectangles.\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 reported in\n+ FaceDetectFaceRectangles.\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/control_ranges.yaml b/src/libcamera/control_ranges.yaml\nindex d42447d0..9d406f10 100644\n--- a/src/libcamera/control_ranges.yaml\n+++ b/src/libcamera/control_ranges.yaml\n@@ -13,6 +13,8 @@ ranges:\n draft: 10000\n # Raspberry Pi vendor controls\n rpi: 20000\n- # Next range starts at 30000\n+ # Android metadata related controls\n+ android: 30000\n+ # Next range starts at 40000\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": [ "v7", "2/3" ] }