{"id":11872,"url":"https://patchwork.libcamera.org/api/1.1/patches/11872/?format=json","web_url":"https://patchwork.libcamera.org/patch/11872/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210408133634.16815-3-david.plowman@raspberrypi.com>","date":"2021-04-08T13:36:33","name":"[libcamera-devel,v2,2/3] ipa: raspberrypi: Add CamHelper::ColourGainCode method","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"23f93cd21bad4211d437ce69bba8ff4fcde6d046","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/1.1/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11872/mbox/","series":[{"id":1905,"url":"https://patchwork.libcamera.org/api/1.1/series/1905/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1905","date":"2021-04-08T13:36:31","name":"Raspberry Pi: handle sensors more flexibly","version":2,"mbox":"https://patchwork.libcamera.org/series/1905/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11872/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11872/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 CE266BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  8 Apr 2021 13:36:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 45673602CD;\n\tThu,  8 Apr 2021 15:36:43 +0200 (CEST)","from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 290BF602CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Apr 2021 15:36:41 +0200 (CEST)","by mail-wm1-x32c.google.com with SMTP id\n\to20-20020a05600c4fd4b0290114265518afso1249942wmq.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 08 Apr 2021 06:36:41 -0700 (PDT)","from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tz18sm13132522wmc.27.2021.04.08.06.36.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 08 Apr 2021 06:36:40 -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=\"lgXBVoby\"; 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=bPgy71T3ChQPM1WXwYAkhYqDaJuQNuEYvNRjWcTa3CM=;\n\tb=lgXBVobyQ/odebYVLuWoq+WA8050xFFeCK98SDfgxw4JMKcyxxHasz0rUdxNgy7r79\n\tYGQKJ+zuBPCHJmvEaADqPnRlLn4HLvZOIUrndsFHA/MSjJo1k4hd7fOooDDWuDkC1I3j\n\tBmsOsu4CbjDEIvDTK74qE1Hp5JalTU4IPIMy1aPFqwQZBeWtPNdsX9OwCEDZ86w5WGJh\n\tX+uk0iEpqTqtxpGiVp6MFy00myZ+t2OsOoh1hgDeAqkz+1NVkWDCaM3bHCklxc9yhDzV\n\tflLobboHXN7HdNXHoul1EzDPXZ5JGs1khyulDBZwGkKwthLHEeOwvYR/lP2q+C/KaZQF\n\tIqBw==","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=bPgy71T3ChQPM1WXwYAkhYqDaJuQNuEYvNRjWcTa3CM=;\n\tb=boS3ogx0Q4Jwxc+37ehHdFxFzP+CcCubgr9+OsB2hlEZaRNpwZ8ZXmbfZ0YtIthf6d\n\tKNSy+rWj8GqKXkf7NAgxY9plrMDtw12R5LvUQ4Amwq0a+934JqLCjbGmKte6k+74bIiu\n\tcqXWs9TRsIaqVjWAQ21GnvfVKjmkYyMEumIqK7RQKQ1rZ4vQ5MxDbdPQMY4HgAj/aex4\n\ttRjvvm8biUw9yUiYuOGCQKTtcSUyIRZtmyO93+q3S1GPvqVCbU+5NOSCxcoR7HR7vBUx\n\t+ouxD8C+sP2Mu5ET7NtO17F+LCkxmKUS+rxCZtlctohJqW+5JpiXKpBHVUSTBC5hXB58\n\tep/Q==","X-Gm-Message-State":"AOAM531JCa2TMa3Yo4JK6q7klpP0nD0WtKcQ+JbDPgmCCX6xdDjaHSZX\n\tQDtwuYyLCQUV9eiHLU6h7jwHGMaME2QLOQ==","X-Google-Smtp-Source":"ABdhPJwI4uXi5hPVz+UH1Jbubp0Haos0PY+UIk2ILnlbLcYV9Hss8qEYi7tdcvq2hXOvUccZCd090A==","X-Received":"by 2002:a7b:c1c4:: with SMTP id a4mr8397811wmj.67.1617889000615; \n\tThu, 08 Apr 2021 06:36:40 -0700 (PDT)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  8 Apr 2021 14:36:33 +0100","Message-Id":"<20210408133634.16815-3-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20210408133634.16815-1-david.plowman@raspberrypi.com>","References":"<20210408133634.16815-1-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 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>\n---\n src/ipa/raspberrypi/cam_helper.cpp | 11 +++++++++++\n src/ipa/raspberrypi/cam_helper.hpp |  4 +++-\n 2 files changed, 14 insertions(+), 1 deletion(-)","diff":"diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp\nindex 0ae0baa0..556a7c03 100644\n--- a/src/ipa/raspberrypi/cam_helper.cpp\n+++ b/src/ipa/raspberrypi/cam_helper.cpp\n@@ -57,6 +57,17 @@ 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+\tassert(0);\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","v2","2/3"]}