{"id":12490,"url":"https://patchwork.libcamera.org/api/patches/12490/?format=json","web_url":"https://patchwork.libcamera.org/patch/12490/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20210602152122.14836-2-david.plowman@raspberrypi.com>","date":"2021-06-02T15:21:21","name":"[libcamera-devel,v2,1/2] ipa: raspberrypi: Add sensitivity field to camera mode","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"abfd7c18061c9dad05a64ac3e608ba8308ee456b","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12490/mbox/","series":[{"id":2102,"url":"https://patchwork.libcamera.org/api/series/2102/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2102","date":"2021-06-02T15:21:20","name":"Raspberrypi: support per-mode camera sensitivities","version":2,"mbox":"https://patchwork.libcamera.org/series/2102/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12490/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12490/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 E6C09C3208\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Jun 2021 15:21:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7812B68923;\n\tWed,  2 Jun 2021 17:21:28 +0200 (CEST)","from mail-wm1-x330.google.com (mail-wm1-x330.google.com\n\t[IPv6:2a00:1450:4864:20::330])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2C256602A4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Jun 2021 17:21:27 +0200 (CEST)","by mail-wm1-x330.google.com with SMTP id\n\tb145-20020a1c80970000b029019c8c824054so4006766wmd.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 02 Jun 2021 08:21:27 -0700 (PDT)","from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id p1sm57044wmc.11.2021.06.02.08.21.26\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 02 Jun 2021 08:21:26 -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=\"aJHTdCGn\"; 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=VcVXDLtZMS/ZdvZzR6ROcLDdyirQXTZQvOsQmAI0Pzk=;\n\tb=aJHTdCGnQB9kpd2TAJvuC8Iq2SoQCs9dOHR+4t6IQA9PpRLl6hnTfLkINvfkSLNB3j\n\tAB6JPVjBMhIjAeUCijGLnDVcuB3A57yZ6ZonBlGkL4a4WW8jmZ98/SoalR9yOUBKNi2o\n\tBhBj3nTRW7zKMxdlDYdErr0YfJU7IG6Y+Bsj3XOW2ikKKXkBUiLEpRBMuOloIDmNQNrH\n\txflWx9sjGMKNU8bVLC6GNFwc9s0BmT1GhE4Hgcf4K0HnStBetxLd7vWpF9gzLU6/XneT\n\tWnvJ0IKQGI28IEg+pAlJ4VGl19zvQfCxwktYTuZkgmXTtqn2yXVV8QtfNCSTrZ4ofeaO\n\t6UTw==","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=VcVXDLtZMS/ZdvZzR6ROcLDdyirQXTZQvOsQmAI0Pzk=;\n\tb=DNAoYSzesWzHrtQVoxYHcc7bFIWCrJ/JRUhdSRAnm1VFbkY74/H7zi7UJQ+v/hJBhO\n\tGsH/eKxBJzVQN+rBSDQLMYjEnk2CFAxFq0OG/m4dvxV6bvyTef5b3ASSNLB/BhgG7B9s\n\tWcUQdMx7y87aBjK6hBMUwg5CHXo52lVVXDqSsMra74Tqlfdb/ZHTMnY1pLDW8rHssCeq\n\t+6IOd6ZhUCorBv3EM1JFo13XsrTZ/eMMN+JP6YEgAVobhI6AAbNmdoSQH/ar1Anh8VG6\n\tDU9ik3YE7JTPCdsQbk1slXOIOB05X7x9Fade4bnq7NC0eHyToKRtDzX+vh01rhZJ9bsf\n\tfxfQ==","X-Gm-Message-State":"AOAM532o/jSoZwDkeaRseFR3aj0pUqBXAtC7SIRea1rqUsMw62zCbLI/\n\tL/ApbWScsrsly5G+0uz99dQQn/vWgfjA+UWJ","X-Google-Smtp-Source":"ABdhPJyZlFUuijQtWPWWxs6sxbxBi3IfaVwAJjXlAtJB7YUwSJc1bRzlrTZY/zF94HCO7KYnyK0GZA==","X-Received":"by 2002:a1c:9804:: with SMTP id a4mr32486779wme.34.1622647286440;\n\tWed, 02 Jun 2021 08:21:26 -0700 (PDT)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  2 Jun 2021 16:21:21 +0100","Message-Id":"<20210602152122.14836-2-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20210602152122.14836-1-david.plowman@raspberrypi.com>","References":"<20210602152122.14836-1-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 1/2] ipa: raspberrypi: Add sensitivity\n\tfield to camera mode","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":"We use the CamHelper class to initialise it to the usual value of 1.\n\nThe CamHelper's GetModeSensitivity method can be redefined to\nimplement a different behaviour for sensors that require it.\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           |  3 +++\n src/ipa/raspberrypi/controller/camera_mode.h |  2 ++\n src/ipa/raspberrypi/raspberrypi.cpp          |  6 ++++++\n 4 files changed, 22 insertions(+)","diff":"diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp\nindex 09917f3c..c1dd0daa 100644\n--- a/src/ipa/raspberrypi/cam_helper.cpp\n+++ b/src/ipa/raspberrypi/cam_helper.cpp\n@@ -128,6 +128,17 @@ bool CamHelper::SensorEmbeddedDataPresent() const\n \treturn false;\n }\n \n+double CamHelper::GetModeSensitivity([[maybe_unused]] const CameraMode &mode) const\n+{\n+\t/*\n+\t * Most sensors have the same sensitivity in every mode, but this\n+\t * method can be overridden for those that do not. Note that it is\n+\t * called before mode_ is set, so it must return the sensitivity\n+\t * of the mode that is passed in.\n+\t */\n+\treturn 1.0;\n+}\n+\n unsigned int CamHelper::HideFramesStartup() const\n {\n \t/*\ndiff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp\nindex a52f3f0b..bc034877 100644\n--- a/src/ipa/raspberrypi/cam_helper.hpp\n+++ b/src/ipa/raspberrypi/cam_helper.hpp\n@@ -39,6 +39,8 @@ namespace RPiController {\n //\n // A method to query if the sensor outputs embedded data that can be parsed.\n //\n+// A method to return the sensitivity of a given camera mode.\n+//\n // A parser to parse the embedded data buffers provided by some sensors (for\n // example, the imx219 does; the ov5647 doesn't). This allows us to know for\n // sure the exposure and gain of the frame we're looking at. CamHelper\n@@ -81,6 +83,7 @@ public:\n \tvirtual void GetDelays(int &exposure_delay, int &gain_delay,\n \t\t\t       int &vblank_delay) const;\n \tvirtual bool SensorEmbeddedDataPresent() const;\n+\tvirtual double GetModeSensitivity(const CameraMode &mode) const;\n \tvirtual unsigned int HideFramesStartup() const;\n \tvirtual unsigned int HideFramesModeSwitch() const;\n \tvirtual unsigned int MistrustFramesStartup() const;\ndiff --git a/src/ipa/raspberrypi/controller/camera_mode.h b/src/ipa/raspberrypi/controller/camera_mode.h\nindex 256438c9..326f4f20 100644\n--- a/src/ipa/raspberrypi/controller/camera_mode.h\n+++ b/src/ipa/raspberrypi/controller/camera_mode.h\n@@ -39,6 +39,8 @@ struct CameraMode {\n \tlibcamera::Transform transform;\n \t// minimum and maximum fame lengths in units of lines\n \tuint32_t min_frame_length, max_frame_length;\n+\t// sensitivity of this mode\n+\tdouble sensitivity;\n };\n \n #ifdef __cplusplus\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 0c4752ec..3da7e232 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -321,6 +321,12 @@ void IPARPi::setMode(const IPACameraSensorInfo &sensorInfo)\n \t */\n \tmode_.min_frame_length = sensorInfo.minFrameLength;\n \tmode_.max_frame_length = sensorInfo.maxFrameLength;\n+\n+\t/*\n+\t * Some sensors may have different sensitivities in different modes;\n+\t * the CamHelper will know the correct value.\n+\t */\n+\tmode_.sensitivity = helper_->GetModeSensitivity(mode_);\n }\n \n int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,\n","prefixes":["libcamera-devel","v2","1/2"]}