[{"id":33687,"web_url":"https://patchwork.libcamera.org/comment/33687/","msgid":"<e60d0379-bf24-4f2c-bd04-95ad657ab168@ideasonboard.com>","date":"2025-03-24T07:39:15","subject":"Re: [PATCH 2/2] ipa: rkisp1: agc: Set measurement window to full\n\tframe","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/people/156/","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"content":"Hi Stefan\n\nOn 19/03/2025 16:01, Stefan Klug wrote:\n> With the availability of metering modes and the corresponding weights,\n> there is a flexible way of defining the area that gets taken into\n> account when AEGC is calculated. There is no need to reduce that window\n> to an arbitrary region anymore. If need arises we can make this\n> parameter user configurable or add a control for it.\n>\n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n\nMakes sense to me:\n\n\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n\n> ---\n>   src/ipa/rkisp1/algorithms/agc.cpp | 12 ++++--------\n>   1 file changed, 4 insertions(+), 8 deletions(-)\n>\n> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> index 101cad5d0893..b3ac9400b74f 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> @@ -193,14 +193,10 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n>   \tcontext.activeState.agc.minFrameDuration = std::chrono::microseconds(frameDurationLimits.min().get<int64_t>());\n>   \tcontext.activeState.agc.maxFrameDuration = std::chrono::microseconds(frameDurationLimits.max().get<int64_t>());\n>   \n> -\t/*\n> -\t * Define the measurement window for AGC as a centered rectangle\n> -\t * covering 3/4 of the image width and height.\n> -\t */\n> -\tcontext.configuration.agc.measureWindow.h_offs = configInfo.outputSize.width / 8;\n> -\tcontext.configuration.agc.measureWindow.v_offs = configInfo.outputSize.height / 8;\n> -\tcontext.configuration.agc.measureWindow.h_size = 3 * configInfo.outputSize.width / 4;\n> -\tcontext.configuration.agc.measureWindow.v_size = 3 * configInfo.outputSize.height / 4;\n> +\tcontext.configuration.agc.measureWindow.h_offs = 0;\n> +\tcontext.configuration.agc.measureWindow.v_offs = 0;\n> +\tcontext.configuration.agc.measureWindow.h_size = configInfo.outputSize.width;\n> +\tcontext.configuration.agc.measureWindow.v_size = configInfo.outputSize.height;\n>   \n>   \tsetLimits(context.configuration.sensor.minExposureTime,\n>   \t\t  context.configuration.sensor.maxExposureTime,","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 32456BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Mar 2025 07:39:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D0ADB61868;\n\tMon, 24 Mar 2025 08:39:19 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4ED7961868\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Mar 2025 08:39:18 +0100 (CET)","from [192.168.0.43]\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1E8C1455\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Mar 2025 08:37:32 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"QdQAnJtN\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1742801852;\n\tbh=Hl/Ludba2O1iLvoLYqMtvdOKf8e0v/ami5TIgRU4kq4=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=QdQAnJtNA7UrmRAbQ9BodBII1KQHmMGotmRe29AsTnHuo7LOEeFG36/JOvMhXbXou\n\tQp8FF3CDqNlxzpgWrUJ/jlaFgq1uL7gcSD2eXQ9JDqCLuxBFOf0WdmTHW5cMDuZSwq\n\tY5PtEUlqyiHiAN0gZ+QdXkCXN1C3xNtQPE7KRzWc=","Message-ID":"<e60d0379-bf24-4f2c-bd04-95ad657ab168@ideasonboard.com>","Date":"Mon, 24 Mar 2025 07:39:15 +0000","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 2/2] ipa: rkisp1: agc: Set measurement window to full\n\tframe","To":"libcamera-devel@lists.libcamera.org","References":"<20250319160146.61751-1-stefan.klug@ideasonboard.com>\n\t<20250319160146.61751-3-stefan.klug@ideasonboard.com>","Content-Language":"en-US","From":"Dan Scally <dan.scally@ideasonboard.com>","Autocrypt":"addr=dan.scally@ideasonboard.com; keydata=\n\txsFNBGLydlEBEADa5O2s0AbUguprfvXOQun/0a8y2Vk6BqkQALgeD6KnXSWwaoCULp18etYW\n\tB31bfgrdphXQ5kUQibB0ADK8DERB4wrzrUb5CMxLBFE7mQty+v5NsP0OFNK9XTaAOcmD+Ove\n\teIjYvqurAaro91jrRVrS1gBRxIFqyPgNvwwL+alMZhn3/2jU2uvBmuRrgnc/e9cHKiuT3Dtq\n\tMHGPKL2m+plk+7tjMoQFfexoQ1JKugHAjxAhJfrkXh6uS6rc01bYCyo7ybzg53m1HLFJdNGX\n\tsUKR+dQpBs3SY4s66tc1sREJqdYyTsSZf80HjIeJjU/hRunRo4NjRIJwhvnK1GyjOvvuCKVU\n\tRWpY8dNjNu5OeAfdrlvFJOxIE9M8JuYCQTMULqd1NuzbpFMjc9524U3Cngs589T7qUMPb1H1\n\tNTA81LmtJ6Y+IV5/kiTUANflpzBwhu18Ok7k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MYZl1ur2JzOC\n\tFHRpGadlNzKDE3fEdoMobxHB3Lm6FDml5GyBAA8+dQYVI0oDwJ3gpZPZ0J5Vx9RbqXe8RDuR\n\tdu90hvCJkq7/tzSQ0GeD3BwXb9/R/A4dVXhaDd91Q1qQXidI+2jwhx8iqiYxbT+DoAUkQRQy\n\txBtoCM1CxH7u45URUgD//fxYr3D4B1SlonA6vdaEdHZOGwECnDpTxecENMbz/Bx7qfrmd901\n\tD+N9SjIwrbVhhSyUXYnSUb8F+9g2RDY42Sk7GcYxIeON4VzKqWM7hpkXZ47pkK0YodO+dRKM\n\tyMcoUWrTK0Uz6UzUGKoJVbxmSW/EJLEGoI5p3NWxWtScEVv8mO49gqQdrRIOheZycDmHnItt\n\t9Qjv00uFhEwv2YfiyGk6iGF2W40s2pH2t6oeuGgmiZ7g6d0MEK8Ql/4zPItvr1c1rpwpXUC1\n\tu1kQWgtnNjFHX3KiYdqjcZeRBiry1X0zY+4Y24wUU0KsEewJwjhmCKAsju1RpdlPg2kC","In-Reply-To":"<20250319160146.61751-3-stefan.klug@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>"}},{"id":33699,"web_url":"https://patchwork.libcamera.org/comment/33699/","msgid":"<lw3ra4jzvsats4kg5wix2izcu3ncb44x2eyu2cvv67icrtapxb@eex6vuepk6o2>","date":"2025-03-25T13:57:26","subject":"Re: [PATCH 2/2] ipa: rkisp1: agc: Set measurement window to full\n\tframe","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the review. \n\nOn Tue, Mar 25, 2025 at 10:19:54AM +0000, Kieran Bingham wrote:\n> Quoting Stefan Klug (2025-03-19 16:01:37)\n> > With the availability of metering modes and the corresponding weights,\n> > there is a flexible way of defining the area that gets taken into\n> > account when AEGC is calculated. There is no need to reduce that window\n> > to an arbitrary region anymore. If need arises we can make this\n> > parameter user configurable or add a control for it.\n> > \n> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > ---\n> >  src/ipa/rkisp1/algorithms/agc.cpp | 12 ++++--------\n> >  1 file changed, 4 insertions(+), 8 deletions(-)\n> > \n> > diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> > index 101cad5d0893..b3ac9400b74f 100644\n> > --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> > +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> > @@ -193,14 +193,10 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n> >         context.activeState.agc.minFrameDuration = std::chrono::microseconds(frameDurationLimits.min().get<int64_t>());\n> >         context.activeState.agc.maxFrameDuration = std::chrono::microseconds(frameDurationLimits.max().get<int64_t>());\n> >  \n> > -       /*\n> > -        * Define the measurement window for AGC as a centered rectangle\n> > -        * covering 3/4 of the image width and height.\n> > -        */\n> \n> Do the existing weights already match this? Where are the weights\n> currently coming from for this ? Are they filled in from the tuning file\n> generator ? or is there a default somewhere?\n\nYes, the weights come from the tuning file generator. This code here\ndates back to 2022 8917c9e7ba64 (\"ipa: rkisp1: agc: Add a\nhistogram-based gain\") and I believe the intention was to add a bit of a\nspot measurement. We should have changed it when the metering modes were\nadded. You are right, the behavior of existing cameras with existing\ntuning files change a bit. So we should strive for updated tuning files\nin the near future. We could add the default metering modes to all\nexisting tuning files in a follow up patch.\n\nCheers,\nStefan\n\n> \n> > -       context.configuration.agc.measureWindow.h_offs = configInfo.outputSize.width / 8;\n> > -       context.configuration.agc.measureWindow.v_offs = configInfo.outputSize.height / 8;\n> > -       context.configuration.agc.measureWindow.h_size = 3 * configInfo.outputSize.width / 4;\n> > -       context.configuration.agc.measureWindow.v_size = 3 * configInfo.outputSize.height / 4;\n> > +       context.configuration.agc.measureWindow.h_offs = 0;\n> > +       context.configuration.agc.measureWindow.v_offs = 0;\n> > +       context.configuration.agc.measureWindow.h_size = configInfo.outputSize.width;\n> > +       context.configuration.agc.measureWindow.v_size = configInfo.outputSize.height;\n> >  \n> >         setLimits(context.configuration.sensor.minExposureTime,\n> >                   context.configuration.sensor.maxExposureTime,\n> > -- \n> > 2.43.0\n> >","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 D6B6DC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 25 Mar 2025 13:57:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1B0B568951;\n\tTue, 25 Mar 2025 14:57:31 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CAB7B600EB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 Mar 2025 14:57:28 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:c7a4:3bff:5111:79f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 75274353;\n\tTue, 25 Mar 2025 14:55:41 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"wWkpdlqb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1742910941;\n\tbh=wBGp8dcq8xLGMiaiS2zkDDtU2UG8iqT3Ekx83E49vn4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=wWkpdlqbwArt5DkNaTrAGFmDqMpnRtKmNgt+tQd9HOM8y6aGRN9cskFfU01RYyLo0\n\t5HM5RVBruIh96tlDvfp0/B/4NLVxFHnb7gCPMEI4Zk5nTcl91F+D7fHqi5oIe67X2n\n\tK6bfuqAMeN9PJ/Yl17hwyLn0hWHOoc/0vjIf2HV4=","Date":"Tue, 25 Mar 2025 14:57:26 +0100","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH 2/2] ipa: rkisp1: agc: Set measurement window to full\n\tframe","Message-ID":"<lw3ra4jzvsats4kg5wix2izcu3ncb44x2eyu2cvv67icrtapxb@eex6vuepk6o2>","References":"<20250319160146.61751-1-stefan.klug@ideasonboard.com>\n\t<20250319160146.61751-3-stefan.klug@ideasonboard.com>\n\t<174289799426.670680.4357062632787954938@ping.linuxembedded.co.uk>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<174289799426.670680.4357062632787954938@ping.linuxembedded.co.uk>","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>"}}]