{"id":12443,"url":"https://patchwork.libcamera.org/api/1.1/patches/12443/?format=json","web_url":"https://patchwork.libcamera.org/patch/12443/","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":"<20210527084540.9983-2-david.plowman@raspberrypi.com>","date":"2021-05-27T08:45:39","name":"[libcamera-devel,1/2] ipa: raspberrypi: Add sensitivity field to camera mode","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"80e3bff1bc698db3ff674675e21c9d35844b1606","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/12443/mbox/","series":[{"id":2083,"url":"https://patchwork.libcamera.org/api/1.1/series/2083/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2083","date":"2021-05-27T08:45:38","name":"Raspberrypi: support per-mode camera sensitivities","version":1,"mbox":"https://patchwork.libcamera.org/series/2083/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12443/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12443/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 7B660BDB80\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 27 May 2021 08:45:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1045168924;\n\tThu, 27 May 2021 10:45:50 +0200 (CEST)","from mail-wr1-x434.google.com (mail-wr1-x434.google.com\n\t[IPv6:2a00:1450:4864:20::434])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E34F068920\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 May 2021 10:45:46 +0200 (CEST)","by mail-wr1-x434.google.com with SMTP id x7so3825434wrt.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 May 2021 01:45:46 -0700 (PDT)","from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tq11sm2325553wrx.80.2021.05.27.01.45.46\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 27 May 2021 01:45:46 -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=\"MKTnTcuE\"; 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=V5Re0dpffDCKWoUA3ShNyWGXAsBd9y/diewHASCjpvA=;\n\tb=MKTnTcuE4epic7dPtnFTMjIzR6K4hI74Ayvrl+8FrRW7Kgkm1xlh5vR3Qdi9k2dOTG\n\trD9/DyhwKhGM6EYXxeBwcejLtT0jiiwXXiruHKsrkeJAzeTkcAdPqfKhE+FlMfd/IoPV\n\tbkHp15fgeqp0v7z9tnHgl6Cs6Rd73xY3YQpUYu+lRWhBNIGsXoftH4lvz1EUz7pBPcfI\n\tOBt32r+7iQC51dBFQzZah6+qVhYWW0nXMRyROCm6uGerWAIr2rkq76pyjoWL6odVk/zv\n\tiKHQWN9znW/hWjaKXo2wqsLQ4M4Qu6R8y5lELex2oXyv0DhxnHXk/TH3mmtCkHdC5NXM\n\tnAwg==","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=V5Re0dpffDCKWoUA3ShNyWGXAsBd9y/diewHASCjpvA=;\n\tb=eZ86DgfguOu32RbXFqvVH9zID2HKBGigDmlx6TKMjhvtUQ+fnSyQZ7qRTeoNQSC0Vu\n\tSnXDQNfYQVAkhaJNE9B89DeNeZuP2j3N3r8FhnUD3z6EbtiS9p6+wzVGmlMGJsHSnMU2\n\tMXDtDVegShDhiOblQShE+YP4zoi9M5juK8+/ZChYrQiuILxQkAjSLoGHsdsronaG/EGM\n\tfcD0CyKCWLbcSEyiyCmSoQ7BBPf/qgYJQo/1UM2vBbzS1w5c6hXnBLfqKp7qDn9l26r6\n\t6RF6MgaZ6N8vzCBazUK7HXaxvtQI+ItBnmvgZJkXEez4oim0P0yOCZYDbk/aH18Rc/eP\n\tpWKg==","X-Gm-Message-State":"AOAM531q/0iXSpUVPhLoSg/Oj7pejbNy3tE5TQgdWyNhhKAxWwCsm8Ok\n\tX2QjspD9mvIq3h0Tzlc7/iTkzPO4/7A3Ug==","X-Google-Smtp-Source":"ABdhPJylCcXoiW50lB7a/jt5gDQg2RKUFzj5KisbT2eJeuE9ii6Qt5Oi5GseXozLGbeFuULtJHH9Vg==","X-Received":"by 2002:adf:e291:: with SMTP id\n\tv17mr2137648wri.149.1622105146393; \n\tThu, 27 May 2021 01:45:46 -0700 (PDT)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 27 May 2021 09:45:39 +0100","Message-Id":"<20210527084540.9983-2-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20210527084540.9983-1-david.plowman@raspberrypi.com>","References":"<20210527084540.9983-1-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 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":"Initialise it to the usual value of 1, until such time as we have a\nmechanism that allows us to discover the correct value.\n\nThe CamHelper class also gets a method to return this sensitivity\nvalue. This method is virtual so that it can be overridden for\nspecific sensors. Once the correct value is obtainable elsewhere, this\ncan be removed.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/cam_helper.cpp           |  5 +++++\n src/ipa/raspberrypi/cam_helper.hpp           |  3 +++\n src/ipa/raspberrypi/controller/camera_mode.h |  2 ++\n src/ipa/raspberrypi/raspberrypi.cpp          | 12 ++++++++++++\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..71ea21ff 100644\n--- a/src/ipa/raspberrypi/cam_helper.cpp\n+++ b/src/ipa/raspberrypi/cam_helper.cpp\n@@ -128,6 +128,11 @@ bool CamHelper::SensorEmbeddedDataPresent() const\n \treturn false;\n }\n \n+double CamHelper::Sensitivity() const\n+{\n+\treturn mode_.sensitivity;\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..14c4714c 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 the current 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 Sensitivity() 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 e5bb8159..da42d279 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 * For now, initialise the mode sensitivity to the usual value of 1.\n+\t * \\todo Obtain the correct sensitivity number automatically.\n+\t */\n+\tmode_.sensitivity = 1.0;\n }\n \n int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,\n@@ -379,6 +385,12 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,\n \t/* Pass the camera mode to the CamHelper to setup algorithms. */\n \thelper_->SetCameraMode(mode_);\n \n+\t/*\n+\t * For now, the CamHelper knows the sensitivity correctly.\n+\t * \\todo This can be removed once the sensitivity is initialised properly.\n+\t */\n+\tmode_.sensitivity = helper_->Sensitivity();\n+\n \tif (firstStart_) {\n \t\t/* Supply initial values for frame durations. */\n \t\tapplyFrameDurations(defaultMinFrameDuration, defaultMaxFrameDuration);\n","prefixes":["libcamera-devel","1/2"]}