Show a patch.

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

{
    "id": 11928,
    "url": "https://patchwork.libcamera.org/api/patches/11928/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11928/",
    "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": "<20210414102955.9503-3-david.plowman@raspberrypi.com>",
    "date": "2021-04-14T10:29:54",
    "name": "[libcamera-devel,v3,2/3] ipa: raspberrypi: Add CamHelper::ColourGainCode method",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "766d2002aaca7046f8f2e9025136f2cae613b7c2",
    "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/11928/mbox/",
    "series": [
        {
            "id": 1927,
            "url": "https://patchwork.libcamera.org/api/series/1927/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1927",
            "date": "2021-04-14T10:29:52",
            "name": "Raspberry Pi: handle sensors more flexibly",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/1927/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11928/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11928/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 DE8BABD224\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 14 Apr 2021 10:30:04 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E366F68816;\n\tWed, 14 Apr 2021 12:30:03 +0200 (CEST)",
            "from mail-ej1-x631.google.com (mail-ej1-x631.google.com\n\t[IPv6:2a00:1450:4864:20::631])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A79036880B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 14 Apr 2021 12:30:01 +0200 (CEST)",
            "by mail-ej1-x631.google.com with SMTP id g5so23916891ejx.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 14 Apr 2021 03:30:01 -0700 (PDT)",
            "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\th8sm11369137ede.25.2021.04.14.03.30.00\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 14 Apr 2021 03:30:00 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"K6JVyybg\"; 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=tAHohxZ+A701u5gqGmIQteFz6G6UtZkAvLkzpylEG8o=;\n\tb=K6JVyybgPdflobv5FFfZsp2YZPUEiXp/km79TFaPSRLU+lHUumWgvoWgvwBevs5tcH\n\t5saqBsMg20vm1mfA9Vl+WqxOk21lFjkIPyzwf3mwjcH1oBziNeicTj+nwm++/cUm1cq7\n\toqPOQV+6ahppSAdltBI8Co9/czdnHl3am/IivjoZPsZdmf08ExjNHf61gGhkNgBW6k0c\n\tsueQ/iu58Ba0GaSImUEJPbJS+DQgBw3rBjOMM+SLZlzcr8zMwzpx6mGc69bvPRcjVA5c\n\tE7EmThC3qSTFTY/6pZDO4+/UM6oeDXy4cBr6QEgbUdviJ/We3a0EqoUOD/xzp8Hfy8Qi\n\tQ7ng==",
        "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=tAHohxZ+A701u5gqGmIQteFz6G6UtZkAvLkzpylEG8o=;\n\tb=aEICXb+9ltW+G6Q7X7Oc8KmF3vthgoGl1V3STqUAp6+foL79kl29e78P6HlURWMLPK\n\txdvpvpfOmoJeSyR2LpT+4yvqDl174yuwhm6KOUMifVqwEsIsQ88Wke2clrLdIP8/Zkjl\n\tocdklfjZ0dUqPOHAZTLpQnAWVgHJihUjqrTYw+UcbQ0L9VhkdvVFohHQOvnwYZ7MlMrF\n\tj9Fm+ttz9sHcOgN5JAaR4j3ewCk6O1JcNJQiLoMDGY3jsxAU8sL9Am1f6ShOqjdHEhgB\n\tsLIvATp/qvDIvugad2rmLnVgqGnlB3pivbY766Fm/9hv5sQCqxamK8DKH9sYT36tGQeR\n\tr19w==",
        "X-Gm-Message-State": "AOAM532LF/Vmw37bsfjRFtPcnN/NPLR9zMkIhyRjn/SqiCnBx8gOt+A5\n\tnw8JR9dUrNG1IKwNKZ9JMFGeYnz88bM7dw==",
        "X-Google-Smtp-Source": "ABdhPJwzokcVacEBNnY8/a0lQuaaL9f7W+H0JCTr6AmrDfzDDE1PCUg7CRosyQPZmKLK/Bt8eMszYw==",
        "X-Received": "by 2002:a17:907:75d9:: with SMTP id\n\tjl25mr14416589ejc.420.1618396201067; \n\tWed, 14 Apr 2021 03:30:01 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 14 Apr 2021 11:29:54 +0100",
        "Message-Id": "<20210414102955.9503-3-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20210414102955.9503-1-david.plowman@raspberrypi.com>",
        "References": "<20210414102955.9503-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v3 2/3] ipa: raspberrypi: Add\n\tCamHelper::ColourGainCode method",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Some sensors may require the V4L2_RED/BLUE_BALANCE to be set. These\nwill require a ColourGainCode method in the CamHelper, analogous to\nthe GainCode method, but which converts the red and blue gains to the\ncodes that the driver will want.\n\nMost sensors don't require these values so it's helpful to provide a\ndefault method - noting that it should then never be called.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/raspberrypi/cam_helper.cpp | 18 ++++++++++++++++++\n src/ipa/raspberrypi/cam_helper.hpp |  4 +++-\n 2 files changed, 21 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp\nindex 0ae0baa0..ad344d29 100644\n--- a/src/ipa/raspberrypi/cam_helper.cpp\n+++ b/src/ipa/raspberrypi/cam_helper.cpp\n@@ -17,6 +17,11 @@\n #include \"md_parser.hpp\"\n \n using namespace RPiController;\n+using namespace libcamera;\n+\n+namespace libcamera {\n+LOG_DECLARE_CATEGORY(IPARPI)\n+}\n \n static std::map<std::string, CamHelperCreateFunc> cam_helpers;\n \n@@ -57,6 +62,19 @@ double CamHelper::Exposure(uint32_t exposure_lines) const\n \treturn exposure_lines * mode_.line_length / 1000.0;\n }\n \n+uint32_t CamHelper::ColourGainCode([[maybe_unused]] double gain) const\n+{\n+\t/*\n+\t * This is only used when the sensor has RED/BLUE_BALANCE controls.\n+\t * Most do not, so supplying a default is helpful - though no one\n+\t * should be calling it.\n+\t */\n+\tLOG(IPARPI, Fatal)\n+\t\t<< \"Sensor is requesting RED/BLUE gains so a proper \"\n+\t\t<< \"implementation of ColourGainCode must be provided\";\n+\treturn 0;\n+}\n+\n uint32_t CamHelper::GetVBlanking(double &exposure, double minFrameDuration,\n \t\t\t\t double maxFrameDuration) const\n {\ndiff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp\nindex 4053a870..a0b6b987 100644\n--- a/src/ipa/raspberrypi/cam_helper.hpp\n+++ b/src/ipa/raspberrypi/cam_helper.hpp\n@@ -26,7 +26,8 @@ namespace RPiController {\n //\n // The ability to convert between number of lines of exposure and actual\n // exposure time, and to convert between the sensor's gain codes and actual\n-// gains.\n+// gains. Some sensors like to be told the colour (red and blue) gains, so\n+// there's a method for converting these to gain codes too.\n //\n // A method to return the number of frames of delay between updating exposure,\n // analogue gain and vblanking, and for the changes to take effect. For many\n@@ -72,6 +73,7 @@ public:\n \t\t\t\t      double maxFrameDuration) const;\n \tvirtual uint32_t GainCode(double gain) const = 0;\n \tvirtual double Gain(uint32_t gain_code) const = 0;\n+\tvirtual uint32_t ColourGainCode(double gain) const;\n \tvirtual void GetDelays(int &exposure_delay, int &gain_delay,\n \t\t\t       int &vblank_delay) const;\n \tvirtual bool SensorEmbeddedDataPresent() const;\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "2/3"
    ]
}