{"id":21651,"url":"https://patchwork.libcamera.org/api/patches/21651/?format=json","web_url":"https://patchwork.libcamera.org/patch/21651/","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":"<20241017124613.3853273-2-mike.rudenko@gmail.com>","date":"2024-10-17T12:46:11","name":"[1/3] ipa: rkisp1: agc: Use better default value for analogue gain","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"54fe9351be8a75c8baa211b049ba5d605f1684a7","submitter":{"id":146,"url":"https://patchwork.libcamera.org/api/people/146/?format=json","name":"Mikhail Rudenko","email":"mike.rudenko@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21651/mbox/","series":[{"id":4710,"url":"https://patchwork.libcamera.org/api/series/4710/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4710","date":"2024-10-17T12:46:10","name":"Reduce rkisp1 flicker on first start","version":1,"mbox":"https://patchwork.libcamera.org/series/4710/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21651/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21651/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 CB0EFC32FC\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Oct 2024 12:46:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DC85265387;\n\tThu, 17 Oct 2024 14:46:25 +0200 (CEST)","from mail-lj1-x235.google.com (mail-lj1-x235.google.com\n\t[IPv6:2a00:1450:4864:20::235])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B867A6353B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Oct 2024 14:46:22 +0200 (CEST)","by mail-lj1-x235.google.com with SMTP id\n\t38308e7fff4ca-2fb4fa17044so10188681fa.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Oct 2024 05:46:22 -0700 (PDT)","from localhost ([83.149.246.185]) by smtp.gmail.com with ESMTPSA id\n\t38308e7fff4ca-2fb5d0fb634sm7374221fa.11.2024.10.17.05.46.19\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 17 Oct 2024 05:46:20 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"PLtcRFdd\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20230601; t=1729169181; x=1729773981;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=gf//YmGItTJZqmMJGI0RLt5WZowlPXW4ukhDfXgr89M=;\n\tb=PLtcRFddVXzhQMbFRuOKLwt0OGFcJB9ZMMGP6pBncvVqGyKlXpBdgBuZ39vbnVzA7Z\n\tK16QQeT+Y4k+SrI3C7S6zhfnXdsyg2M5r8X8BjEYw+tpF67dGQaDJsEwALxcqZB7ZDFP\n\toM7Df0mj4ysa8I6u4o+26oQSYawFgh1YQyXlaz5Oq3EwjCjg+osTLGe/j5S33nMIz/pQ\n\tdpQC1eQMQvw1v7exRAEIHPH+bAxMm28/AFmz7ISoEc9PDVw0Rha5jw2Ncyxs0m26wuwg\n\tI4hXr2rbQZvK8y00CyC8gf+NJRqnDQjx4c4mTf24b4p43AzHM8isCkfNodAyujrTRhJb\n\tsQGA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1729169181; x=1729773981;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=gf//YmGItTJZqmMJGI0RLt5WZowlPXW4ukhDfXgr89M=;\n\tb=HXjTnTWI8x2dovHLwKJ7nxJvr/PtpzM9dwi8mkLZcRLfkv5dmhnrPU4sL4MwKLd26z\n\tXm2VNY017Q1iCS7pmST7sEVv/7ew1X0lGoqdGMgCsk2c4XvkFetw2UOS6NvgcT7c6ouq\n\tFsGfwcKRtpkAdIKFDmFUIZNlM47m/aB3XCbig8PbS/7qflBVWAt1qzIzkSEvOQaPIEmw\n\tHiPoTvlzrWPvhyNWGrZl2SnqWHA+Vm7n08NZaRgoFS81tLC7osJPFRvj5SNObGNPnQdE\n\t8WPnguZy8pUQYH8Wsz+l+/o3xSncUYTxAY9NRkvvbbuuGJh3jGvXxJBKj9whcUlztum0\n\t9ATw==","X-Gm-Message-State":"AOJu0YyZOJhRWdSFxNb6RS1f97kkg4vgG9UB2sk9ow8QeCgHWnW0z19Q\n\tbjFklOHHKR/H3Dg2FDki7t8XS84qhGMDdzJUjV2kY/8aKJ4CNQdDA8mxJQ==","X-Google-Smtp-Source":"AGHT+IEOGj9OnSDq497BhqP4ufqC7mYZI70EH7SkQvVrdOsxkqjHbYpAyGpPjCqM6yrFAaO9J16ShA==","X-Received":"by 2002:a2e:bea7:0:b0:2fb:5ebe:ed40 with SMTP id\n\t38308e7fff4ca-2fb5ebef039mr57788551fa.15.1729169181057; \n\tThu, 17 Oct 2024 05:46:21 -0700 (PDT)","From":"Mikhail Rudenko <mike.rudenko@gmail.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Mikhail Rudenko <mike.rudenko@gmail.com>","Subject":"[PATCH 1/3] ipa: rkisp1: agc: Use better default value for analogue\n\tgain","Date":"Thu, 17 Oct 2024 15:46:11 +0300","Message-ID":"<20241017124613.3853273-2-mike.rudenko@gmail.com>","X-Mailer":"git-send-email 2.46.0","In-Reply-To":"<20241017124613.3853273-1-mike.rudenko@gmail.com>","References":"<20241017124613.3853273-1-mike.rudenko@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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":"At present, analogue gain in IPA context is initialized to the minimum\nsensor gain in configure(). Many sensors report minimum analogue gain\nof 0, which is by no means a sane default. Use a reasonable default of\n1.0 instead. Also move the default exposure to a named constant.\n\nSigned-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>\n---\n src/ipa/rkisp1/algorithms/agc.cpp | 8 ++++++--\n 1 file changed, 6 insertions(+), 2 deletions(-)","diff":"diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex 17d074d9..339cddef 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -30,9 +30,13 @@\n namespace libcamera {\n \n using namespace std::literals::chrono_literals;\n+using utils::Duration;\n \n namespace ipa::rkisp1::algorithms {\n \n+constexpr double defaultAnalogueGain = 1.0;\n+constexpr Duration defaultExposureTime = 10.0ms;\n+\n /**\n  * \\class Agc\n  * \\brief A mean-based auto-exposure algorithm\n@@ -164,9 +168,9 @@ int Agc::init(IPAContext &context, const YamlObject &tuningData)\n int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n {\n \t/* Configure the default exposure and gain. */\n-\tcontext.activeState.agc.automatic.gain = context.configuration.sensor.minAnalogueGain;\n+\tcontext.activeState.agc.automatic.gain = defaultAnalogueGain;\n \tcontext.activeState.agc.automatic.exposure =\n-\t\t10ms / context.configuration.sensor.lineDuration;\n+\t\tdefaultExposureTime / context.configuration.sensor.lineDuration;\n \tcontext.activeState.agc.manual.gain = context.activeState.agc.automatic.gain;\n \tcontext.activeState.agc.manual.exposure = context.activeState.agc.automatic.exposure;\n \tcontext.activeState.agc.autoEnabled = !context.configuration.raw;\n","prefixes":["1/3"]}