Show a patch.

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

{
    "id": 4076,
    "url": "https://patchwork.libcamera.org/api/patches/4076/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4076/",
    "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": "<20200618111236.26897-2-david.plowman@raspberrypi.com>",
    "date": "2020-06-18T11:12:35",
    "name": "[libcamera-devel,v2,1/2] libcamera: raspberrypi: allow SwitchMode method to return camera settings",
    "commit_ref": "ff291b3c15ba250fb05236a774771fdf54554ff7",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "579e87e1ff0eb7563e6552c51001664351dc428e",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/4076/mbox/",
    "series": [
        {
            "id": 1014,
            "url": "https://patchwork.libcamera.org/api/series/1014/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1014",
            "date": "2020-06-18T11:12:34",
            "name": "Raspberry pi IPAs: update sensor exposure/gain when camera mode changes",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/1014/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/4076/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4076/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<david.plowman@raspberrypi.com>",
        "Received": [
            "from mail-wr1-x435.google.com (mail-wr1-x435.google.com\n\t[IPv6:2a00:1450:4864:20::435])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6C2A5603C1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2020 13:12:56 +0200 (CEST)",
            "by mail-wr1-x435.google.com with SMTP id t18so5621847wru.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2020 04:12:56 -0700 (PDT)",
            "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\te10sm3103857wrn.11.2020.06.18.04.12.53\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 18 Jun 2020 04:12:54 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"LlJiOYdC\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=5qE8hU/GIenZXSbgyE45a/3aThYh0QnODP/DovYVTmA=;\n\tb=LlJiOYdCyp74Ynjm9v4CJKPxtGK6UqLcdmb426vWzRMuD2qgntWVojPGYbyPBmf5Lf\n\tFtTOXm79QOgrzoV9R2U2TjGzgVikipyluLVzKdUPxFs6zhLZV+dMBin9t+oTebZWxyYX\n\tEkJRR5qhEQDygVh3+/CSwiOpEHPgOaZFsQ7AcU+tUw3sx3+Uc4Cz6Cs85xZtQhkwrx+C\n\tSbXG7PgTXWL8/iiNcFdEXthkxmXjq+dj/4y2IQ12ZmNxdxorYw+yiMEPLB5HVtk3wAIS\n\tZie0RnkilyP869Ax84kKc5wCCL6iuZ11N4cfiX4Pzi7kJPgTbS5T9XatyxvX6eBnVw9V\n\t4VVw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\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=5qE8hU/GIenZXSbgyE45a/3aThYh0QnODP/DovYVTmA=;\n\tb=t9LLodHznAPuibTw7OBOr6WeNVpNvgcgOR67/Mztb+mz0Twa/Olw3jOFTj0HQUrHOr\n\tlxs+sJSiVJM9oRBH3yCP0bU1YVIrcOiuCWfMtWWdt2K3+Cgu7zbIDzJvJKiYzgEURLhd\n\tAfNA1nHyoVDLPAR/Cw7RezzEZPWQN/3ngU5Oc4y9QBK2/BIDUqp2e9JA2UmS40vONMAb\n\tjd6PE5dWlfFj7cp07kqnjESWHskAl8TLi/6TVhLxt0dFSLT5XfedMvp8Gp0YjIrPd0hg\n\ty7k3hOyRazPZtBUpXVqjy3BIN9fAJuj81s0prt5qml2C7CSfMUyvLt5+oCIvoy7cbplN\n\tqvWw==",
        "X-Gm-Message-State": "AOAM533iRGZ0F/HoVfzBoFsHb8yTfSEHpNyn0vKSR5wMUkceqs0lqexS\n\tpPqRzdCvHMnAFg/gj5b3jxSVs07a2nc=",
        "X-Google-Smtp-Source": "ABdhPJwOy2+jh1Kr6r05P74tP02ns6cltgWBYT3iG1Fp2Cgg4KvhfO390b4FuId9JCbHl18rcgVHBA==",
        "X-Received": "by 2002:adf:e84e:: with SMTP id d14mr3943789wrn.31.1592478775129;\n\tThu, 18 Jun 2020 04:12:55 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 18 Jun 2020 12:12:35 +0100",
        "Message-Id": "<20200618111236.26897-2-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20200618111236.26897-1-david.plowman@raspberrypi.com>",
        "References": "<20200618111236.26897-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 1/2] libcamera: raspberrypi: allow\n\tSwitchMode method to return camera settings",
        "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>",
        "X-List-Received-Date": "Thu, 18 Jun 2020 11:12:56 -0000"
    },
    "content": "This commit adds a Metadata parameter to the SwitchMode method\nenabling it to return camera and other settings to the caller\n(usually the configure method, just after the camera mode has been\nselected).\n\nIn future this will allow the Raspberry Pi IPAs to take those settings\n(such as exposure and analogue gain) and program them directly into\nthe camera or ISP before the camera is even started.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/controller/algorithm.cpp   | 3 ++-\n src/ipa/raspberrypi/controller/algorithm.hpp   | 2 +-\n src/ipa/raspberrypi/controller/controller.cpp  | 4 ++--\n src/ipa/raspberrypi/controller/controller.hpp  | 2 +-\n src/ipa/raspberrypi/controller/rpi/alsc.cpp    | 4 +++-\n src/ipa/raspberrypi/controller/rpi/alsc.hpp    | 2 +-\n src/ipa/raspberrypi/controller/rpi/noise.cpp   | 4 +++-\n src/ipa/raspberrypi/controller/rpi/noise.hpp   | 2 +-\n src/ipa/raspberrypi/controller/rpi/sharpen.cpp | 4 +++-\n src/ipa/raspberrypi/controller/rpi/sharpen.hpp | 2 +-\n src/ipa/raspberrypi/raspberrypi.cpp            | 3 ++-\n 11 files changed, 20 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/controller/algorithm.cpp b/src/ipa/raspberrypi/controller/algorithm.cpp\nindex 9bd3df8..55cb201 100644\n--- a/src/ipa/raspberrypi/controller/algorithm.cpp\n+++ b/src/ipa/raspberrypi/controller/algorithm.cpp\n@@ -16,9 +16,10 @@ void Algorithm::Read(boost::property_tree::ptree const &params)\n \n void Algorithm::Initialise() {}\n \n-void Algorithm::SwitchMode(CameraMode const &camera_mode)\n+void Algorithm::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)\n {\n \t(void)camera_mode;\n+\t(void)metadata;\n }\n \n void Algorithm::Prepare(Metadata *image_metadata)\ndiff --git a/src/ipa/raspberrypi/controller/algorithm.hpp b/src/ipa/raspberrypi/controller/algorithm.hpp\nindex b82c184..187c50c 100644\n--- a/src/ipa/raspberrypi/controller/algorithm.hpp\n+++ b/src/ipa/raspberrypi/controller/algorithm.hpp\n@@ -37,7 +37,7 @@ public:\n \tvirtual void Resume() { paused_ = false; }\n \tvirtual void Read(boost::property_tree::ptree const &params);\n \tvirtual void Initialise();\n-\tvirtual void SwitchMode(CameraMode const &camera_mode);\n+\tvirtual void SwitchMode(CameraMode const &camera_mode, Metadata *metadata);\n \tvirtual void Prepare(Metadata *image_metadata);\n \tvirtual void Process(StatisticsPtr &stats, Metadata *image_metadata);\n \tMetadata &GetGlobalMetadata() const\ndiff --git a/src/ipa/raspberrypi/controller/controller.cpp b/src/ipa/raspberrypi/controller/controller.cpp\nindex 20dd4c7..7c4b04f 100644\n--- a/src/ipa/raspberrypi/controller/controller.cpp\n+++ b/src/ipa/raspberrypi/controller/controller.cpp\n@@ -56,11 +56,11 @@ void Controller::Initialise()\n \tRPI_LOG(\"Controller finished\");\n }\n \n-void Controller::SwitchMode(CameraMode const &camera_mode)\n+void Controller::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)\n {\n \tRPI_LOG(\"Controller starting\");\n \tfor (auto &algo : algorithms_)\n-\t\talgo->SwitchMode(camera_mode);\n+\t\talgo->SwitchMode(camera_mode, metadata);\n \tswitch_mode_called_ = true;\n \tRPI_LOG(\"Controller finished\");\n }\ndiff --git a/src/ipa/raspberrypi/controller/controller.hpp b/src/ipa/raspberrypi/controller/controller.hpp\nindex d685386..6ba9412 100644\n--- a/src/ipa/raspberrypi/controller/controller.hpp\n+++ b/src/ipa/raspberrypi/controller/controller.hpp\n@@ -39,7 +39,7 @@ public:\n \tAlgorithm *CreateAlgorithm(char const *name);\n \tvoid Read(char const *filename);\n \tvoid Initialise();\n-\tvoid SwitchMode(CameraMode const &camera_mode);\n+\tvoid SwitchMode(CameraMode const &camera_mode, Metadata *metadata);\n \tvoid Prepare(Metadata *image_metadata);\n \tvoid Process(StatisticsPtr stats, Metadata *image_metadata);\n \tMetadata &GetGlobalMetadata();\ndiff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\nindex 821a0ca..76e2f04 100644\n--- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp\n@@ -173,8 +173,10 @@ void Alsc::Initialise()\n \t\tlambda_r_[i] = lambda_b_[i] = 1.0;\n }\n \n-void Alsc::SwitchMode(CameraMode const &camera_mode)\n+void Alsc::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)\n {\n+\t(void)metadata;\n+\n \t// There's a bit of a question what we should do if the \"crop\" of the\n \t// camera mode has changed.  Any calculation currently in flight would\n \t// not be useful to the new mode, so arguably we should abort it, and\ndiff --git a/src/ipa/raspberrypi/controller/rpi/alsc.hpp b/src/ipa/raspberrypi/controller/rpi/alsc.hpp\nindex c8ed3d2..3806257 100644\n--- a/src/ipa/raspberrypi/controller/rpi/alsc.hpp\n+++ b/src/ipa/raspberrypi/controller/rpi/alsc.hpp\n@@ -50,7 +50,7 @@ public:\n \t~Alsc();\n \tchar const *Name() const override;\n \tvoid Initialise() override;\n-\tvoid SwitchMode(CameraMode const &camera_mode) override;\n+\tvoid SwitchMode(CameraMode const &camera_mode, Metadata *metadata) override;\n \tvoid Read(boost::property_tree::ptree const &params) override;\n \tvoid Prepare(Metadata *image_metadata) override;\n \tvoid Process(StatisticsPtr &stats, Metadata *image_metadata) override;\ndiff --git a/src/ipa/raspberrypi/controller/rpi/noise.cpp b/src/ipa/raspberrypi/controller/rpi/noise.cpp\nindex 2209d79..2cafde3 100644\n--- a/src/ipa/raspberrypi/controller/rpi/noise.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/noise.cpp\n@@ -27,8 +27,10 @@ char const *Noise::Name() const\n \treturn NAME;\n }\n \n-void Noise::SwitchMode(CameraMode const &camera_mode)\n+void Noise::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)\n {\n+\t(void)metadata;\n+\n \t// For example, we would expect a 2x2 binned mode to have a \"noise\n \t// factor\" of sqrt(2x2) = 2. (can't be less than one, right?)\n \tmode_factor_ = std::max(1.0, camera_mode.noise_factor);\ndiff --git a/src/ipa/raspberrypi/controller/rpi/noise.hpp b/src/ipa/raspberrypi/controller/rpi/noise.hpp\nindex 51d46a3..25bf188 100644\n--- a/src/ipa/raspberrypi/controller/rpi/noise.hpp\n+++ b/src/ipa/raspberrypi/controller/rpi/noise.hpp\n@@ -18,7 +18,7 @@ class Noise : public Algorithm\n public:\n \tNoise(Controller *controller);\n \tchar const *Name() const override;\n-\tvoid SwitchMode(CameraMode const &camera_mode) override;\n+\tvoid SwitchMode(CameraMode const &camera_mode, Metadata *metadata) override;\n \tvoid Read(boost::property_tree::ptree const &params) override;\n \tvoid Prepare(Metadata *image_metadata) override;\n \ndiff --git a/src/ipa/raspberrypi/controller/rpi/sharpen.cpp b/src/ipa/raspberrypi/controller/rpi/sharpen.cpp\nindex 1f07bb6..086952f 100644\n--- a/src/ipa/raspberrypi/controller/rpi/sharpen.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/sharpen.cpp\n@@ -26,8 +26,10 @@ char const *Sharpen::Name() const\n \treturn NAME;\n }\n \n-void Sharpen::SwitchMode(CameraMode const &camera_mode)\n+void Sharpen::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)\n {\n+\t(void)metadata;\n+\n \t// can't be less than one, right?\n \tmode_factor_ = std::max(1.0, camera_mode.noise_factor);\n }\ndiff --git a/src/ipa/raspberrypi/controller/rpi/sharpen.hpp b/src/ipa/raspberrypi/controller/rpi/sharpen.hpp\nindex 3b0d680..f871aa6 100644\n--- a/src/ipa/raspberrypi/controller/rpi/sharpen.hpp\n+++ b/src/ipa/raspberrypi/controller/rpi/sharpen.hpp\n@@ -18,7 +18,7 @@ class Sharpen : public Algorithm\n public:\n \tSharpen(Controller *controller);\n \tchar const *Name() const override;\n-\tvoid SwitchMode(CameraMode const &camera_mode) override;\n+\tvoid SwitchMode(CameraMode const &camera_mode, Metadata *metadata) override;\n \tvoid Read(boost::property_tree::ptree const &params) override;\n \tvoid Prepare(Metadata *image_metadata) override;\n \ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 9669f21..d6fd3df 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -267,7 +267,8 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \t\tqueueFrameAction.emit(0, op);\n \t}\n \n-\tcontroller_.SwitchMode(mode_);\n+\tRPi::Metadata metadata;\n+\tcontroller_.SwitchMode(mode_, &metadata);\n \n \tlastMode_ = mode_;\n }\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "1/2"
    ]
}