{"id":18639,"url":"https://patchwork.libcamera.org/api/patches/18639/?format=json","web_url":"https://patchwork.libcamera.org/patch/18639/","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":"<20230519145109.447590-1-bbara93@gmail.com>","date":"2023-05-19T14:51:09","name":"[libcamera-devel] ipa: rkisp1: agc: drop hard-coded analogue gain range","commit_ref":"a3178dd0391f716d01fe216449e977d1e1bd5591","pull_url":null,"state":"accepted","archived":false,"hash":"36288b37587ed64eb9182578b98db9b25182d604","submitter":{"id":163,"url":"https://patchwork.libcamera.org/api/people/163/?format=json","name":"Benjamin Bara","email":"bbara93@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18639/mbox/","series":[{"id":3880,"url":"https://patchwork.libcamera.org/api/series/3880/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3880","date":"2023-05-19T14:51:09","name":"[libcamera-devel] ipa: rkisp1: agc: drop hard-coded analogue gain range","version":1,"mbox":"https://patchwork.libcamera.org/series/3880/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18639/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18639/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 4FADBC31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 19 May 2023 15:07:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9D9416285F;\n\tFri, 19 May 2023 17:07:29 +0200 (CEST)","from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com\n\t[IPv6:2a00:1450:4864:20::62f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C13DD627CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 May 2023 16:51:18 +0200 (CEST)","by mail-ej1-x62f.google.com with SMTP id\n\ta640c23a62f3a-96f50e26b8bso262596566b.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 May 2023 07:51:18 -0700 (PDT)","from PCBABN.skidata.net ([91.230.2.244])\n\tby smtp.gmail.com with ESMTPSA id\n\tbq6-20020a170906d0c600b0093313f4fc3csm2375636ejb.70.2023.05.19.07.51.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 19 May 2023 07:51:17 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1684508849;\n\tbh=yUrl/VPwhm8mmItIrau3nWey9KpTOz3LrTgkww+1gv8=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=jlure8XHX1v3i6pgSE2OlIQxNWBbjGPxta/7Nk4ICfKre9syj2N4Dg5mj0p05OB4G\n\tLHuIVqsB2sagvo7hjlxM4fzytuy9EcXpU2V6hTe7+YBUQM5gyWtn8qjF5EwNu2WWRr\n\t4865OHHq0vYwB1rBCtoMt/V8h3RykvhfRGpWRzB+sy2Yk3gGuqrrm/q8VG7fvgxvfu\n\tq3+zhfNNeBa2sMI9nZjbeX9q9Wyw2HTfLfG3QCmA6Zp+3BQoBTuvDfJArvrmg/wnvc\n\tD3RCelLyLEIIzhegIbFiv5MpSWq4sRJPz6SnDydswy5pL/O4HS/KHnzRow5vE31IR+\n\t1/pQ9ZSM+H+NQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20221208; t=1684507878; x=1687099878;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=Pky30XqpzLsH55nKa+2aLDaZYfSC41hnPZxl97IONeE=;\n\tb=HOOKRzP2WZvYDrwusjVxxL/4ROeiCyXmXK5EhrnMfEMzP6daMuIYWrC6z5YW1hNE/N\n\ta596XX36lDu3zCGeZjWXadv9zha8n1QzXGW0cQRaEuj5vco29WPbInVmbLg3B2Swqpbt\n\tuC9ljBX8U3OgU4/hoTc39iPUCj/Mx29N6M1gYabuCgaA1v/bSnMDU+BS5J5ZiVB74wPn\n\t0rWtSoqpyI2TN1GG+yDUXeW63K4ICYiqzd+UPA31fffTNDIZQ4zclzwMwO9NvcWviK1m\n\twnbiTTzZOg0FwXWJd5z8mY0wFbFmqAgOY5IpZn1xGNyfUk+z9kGSVstRm/UgHZTFS8wS\n\tKSHQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"HOOKRzP2\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1684507878; x=1687099878;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=Pky30XqpzLsH55nKa+2aLDaZYfSC41hnPZxl97IONeE=;\n\tb=NQSatcjLVduarf/ON/WA6iq/16YOKium2TTZO3R3HUcUcOWdyzaiHtyOIhdpmUyu72\n\tz59IAXJcnA8Zkg7wxbJ8lgjhk2qV49HCC93NJje7XouheQyej48E/FiIJQSFulcd+eGy\n\tL4U8mj8OsfZdSL/7X4XUbvIP4Ik0SMTFYFNznEs2q7/ivn0ZjEyUI2gduTl/OVVBPcE2\n\tfyiMmD1+VlAiTzyu6kGPnKgx0rpy0Zf2mUe5lkp3iOHPeCK1+UTOSMQsCVpKlsnTGYf5\n\tCZxavo3mrQ1hAUetF2bYBDWo7b+SQwMhojKi5lW5BALQtOyWdoDZbFcL7sC68JnQk4YY\n\tI2aQ==","X-Gm-Message-State":"AC+VfDzXJIWa7YgxPJofSICZT39pkt68oSkJgSbvSDrkf4I1niqFt5ZP\n\tWy0l7lZSNGdAbT25zJbs7L9eRdSM34U=","X-Google-Smtp-Source":"ACHHUZ7vXajW6iHMcVKdm8VB29sodiB5v+gMMQ/FB/g5VcZqASwCP0+DGg6oegxzfZdcfSqnmpulCw==","X-Received":"by 2002:a17:907:3206:b0:94e:8559:b5c5 with SMTP id\n\txg6-20020a170907320600b0094e8559b5c5mr1623585ejb.64.1684507877774; \n\tFri, 19 May 2023 07:51:17 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 19 May 2023 16:51:09 +0200","Message-Id":"<20230519145109.447590-1-bbara93@gmail.com>","X-Mailer":"git-send-email 2.34.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Mailman-Approved-At":"Fri, 19 May 2023 17:07:28 +0200","Subject":"[libcamera-devel] [PATCH] ipa: rkisp1: agc: drop hard-coded\n\tanalogue gain range","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>","From":"Benjamin Bara via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Benjamin Bara <bbara93@gmail.com>","Cc":"Benjamin Bara <benjamin.bara@skidata.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Benjamin Bara <benjamin.bara@skidata.com>\n\nAs the sensor's analogue gain range is known (read-out in\nIPARkISP1::configure()), drop the limiting hard-coded range.\nThis enables better performance in low-light conditions for sensors with\na higher gain (e.g. the imx327).\n\nSigned-off-by: Benjamin Bara <benjamin.bara@skidata.com>\n---\n src/ipa/rkisp1/algorithms/agc.cpp | 19 +++----------------\n 1 file changed, 3 insertions(+), 16 deletions(-)","diff":"diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex 22f70aba..a4e5500e 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -36,15 +36,6 @@ namespace ipa::rkisp1::algorithms {\n \n LOG_DEFINE_CATEGORY(RkISP1Agc)\n \n-/*\n- * Limits for analogue gain values\n- *\n- * \\todo Remove the hard-coded limits and let the sensor helper specify\n- * the minimum and maximum allowed gain values.\n- */\n-static constexpr double kMinAnalogueGain = 1.0;\n-static constexpr double kMaxAnalogueGain = 16.0;\n-\n /* \\todo Honour the FrameDurationLimits control instead of hardcoding a limit */\n static constexpr utils::Duration kMaxShutterSpeed = 60ms;\n \n@@ -80,9 +71,7 @@ Agc::Agc()\n int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n {\n \t/* Configure the default exposure and gain. */\n-\tcontext.activeState.agc.automatic.gain =\n-\t\tstd::max(context.configuration.sensor.minAnalogueGain,\n-\t\t\t kMinAnalogueGain);\n+\tcontext.activeState.agc.automatic.gain = context.configuration.sensor.minAnalogueGain;\n \tcontext.activeState.agc.automatic.exposure =\n \t\t10ms / context.configuration.sensor.lineDuration;\n \tcontext.activeState.agc.manual.gain = context.activeState.agc.automatic.gain;\n@@ -265,10 +254,8 @@ void Agc::computeExposure(IPAContext &context, IPAFrameContext &frameContext,\n \tutils::Duration maxShutterSpeed = std::min(configuration.sensor.maxShutterSpeed,\n \t\t\t\t\t\t   kMaxShutterSpeed);\n \n-\tdouble minAnalogueGain = std::max(configuration.sensor.minAnalogueGain,\n-\t\t\t\t\t  kMinAnalogueGain);\n-\tdouble maxAnalogueGain = std::min(configuration.sensor.maxAnalogueGain,\n-\t\t\t\t\t  kMaxAnalogueGain);\n+\tdouble minAnalogueGain = configuration.sensor.minAnalogueGain;\n+\tdouble maxAnalogueGain = configuration.sensor.maxAnalogueGain;\n \n \t/* Consider within 1% of the target as correctly exposed. */\n \tif (utils::abs_diff(evGain, 1.0) < 0.01)\n","prefixes":["libcamera-devel"]}