[{"id":31129,"web_url":"https://patchwork.libcamera.org/comment/31129/","msgid":"<CAEmqJPo_m9X9bE2dEUa7-qvrmJv=ykcoWXZWMrU=0B0+-5XAjg@mail.gmail.com>","date":"2024-09-09T13:40:10","subject":"Re: [PATCH] ipa: rpi: agc: Ignore stable region when exposure/gain\n\tset manually","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi David,\n\nThank you for this fix.\n\n\nOn Mon, 9 Sept 2024 at 14:22, David Plowman\n<david.plowman@raspberrypi.com> wrote:\n>\n> When a user is taking control of exposure and gain, setting them\n> manually, we set the AGC \"stable region\" to zero. This means that any\n> user changes, however small, will be applied, and they won't be\n> regarded as \"too small to bother with\".\n>\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n\n> ---\n>  src/ipa/rpi/controller/rpi/agc_channel.cpp | 7 +++++--\n>  1 file changed, 5 insertions(+), 2 deletions(-)\n>\n> diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp\n> index cf2565a8..c9df9b5b 100644\n> --- a/src/ipa/rpi/controller/rpi/agc_channel.cpp\n> +++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp\n> @@ -883,11 +883,14 @@ void AgcChannel::filterExposure()\n>\n>         /*\n>          * AGC adapts instantly if both shutter and gain are directly specified\n> -        * or we're in the startup phase.\n> +        * or we're in the startup phase. Also disable the stable region, because we want\n> +        * to reflect any user exposure/gain updates, however small.\n>          */\n>         if ((status_.fixedShutter && status_.fixedAnalogueGain) ||\n> -           frameCount_ <= config_.startupFrames)\n> +           frameCount_ <= config_.startupFrames) {\n>                 speed = 1.0;\n> +               stableRegion = 0.0;\n> +       }\n>         if (!filtered_.totalExposure) {\n>                 filtered_.totalExposure = target_.totalExposure;\n>         } else if (filtered_.totalExposure * (1.0 - stableRegion) < target_.totalExposure &&\n> --\n> 2.34.1\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 63E33BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  9 Sep 2024 13:40:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 31949634F7;\n\tMon,  9 Sep 2024 15:40:47 +0200 (CEST)","from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com\n\t[IPv6:2607:f8b0:4864:20::112a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 88013634EB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Sep 2024 15:40:45 +0200 (CEST)","by mail-yw1-x112a.google.com with SMTP id\n\t00721157ae682-6d40538b6daso4539757b3.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 09 Sep 2024 06:40:45 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"oqpfuACT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1725889244; x=1726494044;\n\tdarn=lists.libcamera.org; \n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=npbrbNWNS8YBXC5MGoLb9Pl2uVI7+u3o29dpsUg3T4I=;\n\tb=oqpfuACTUPT2LDAmquNli0fISC0ZASjSazjBngXNG2+40quyl2dz7tTGy5E60n2NVU\n\tfqpyanEYRBKX0/uZhiycqnRW9Hky1pkwZTVflRK2mtJ8m4kYhOJpabFl/P0S/q06qxvg\n\tGdU1M1qmjjJfGyjb8AauQCVRAWcpRhYgJWb7T0dctpQPObJE09jWC+D7Lxqzh9Po1QAS\n\tp0SgpbCmlLUJSvnr9YNTAC6EuhjlAeLnke3oVVjdg6KwfTkOQOYHM1AVh0IOVizOd7Ca\n\tePPQJXcAmy4SccroO6LU+py38o/B05h2cJwEuDmmwjB3N51Cifl2dW5N5jOQ8J0U3VyV\n\t0xUA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1725889244; x=1726494044;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=npbrbNWNS8YBXC5MGoLb9Pl2uVI7+u3o29dpsUg3T4I=;\n\tb=CUbGbH7VeMMlbAlhMThsrFD8xRaqbk0uzRTBUfw6N148Z6L3mnPRY72uxjNTMCLb3N\n\t0ewUhzU+ZWfu/ZMOhPGbqafy7QrdGteCEJIaIa5eZZlJ8/qmTqDBQbhMVrlduMb64JnT\n\tp4Rdv6zKIP0XPF/4gLcg0QCrtuoE8zl8IgFgKWheGGzgfP6IbRNffKwinSR8v+KxepsE\n\tbba5xbzqPCtTROb5l7I52HpmHRYiajrSHxPBp90MmhSwHceS29JJH6sm/35qfBSrQw8c\n\t/umODVT2CgLScY2IWwW4e+zyUc7Js+Kw9tnnwmy+CFr0bBTe1TjblldcM9AK42u0Aw8q\n\tawnQ==","X-Gm-Message-State":"AOJu0Yx9WzSstgYIVK0bR3LhbivAEsjWAv/yLuJl/qo61p2tihhSmfjk\n\tQE9wz/9rGPI2jMg/mwjjVwq2ZCbsllbqvukZSBw/0OVdSoTJ6QdBBfAS35n7kZZephDiGj0Udfv\n\tp6z1GXc4JYvq0eb/7OyrUHRDJeXJNtOrR/x0myg==","X-Google-Smtp-Source":"AGHT+IHRmBPiEFxAKGWFQM/UQyL8X9mSob8Injm+1Y6RCCwZn2pAsg0yGpFI8D3PLMk8uiRbdN3nFcmxKNWMsLOHgEA=","X-Received":"by 2002:a05:690c:386:b0:6d3:c7d:5eaa with SMTP id\n\t00721157ae682-6db45289316mr60169487b3.8.1725889244164;\n\tMon, 09 Sep 2024 06:40:44 -0700 (PDT)","MIME-Version":"1.0","References":"<20240909132204.14147-1-david.plowman@raspberrypi.com>","In-Reply-To":"<20240909132204.14147-1-david.plowman@raspberrypi.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Mon, 9 Sep 2024 14:40:10 +0100","Message-ID":"<CAEmqJPo_m9X9bE2dEUa7-qvrmJv=ykcoWXZWMrU=0B0+-5XAjg@mail.gmail.com>","Subject":"Re: [PATCH] ipa: rpi: agc: Ignore stable region when exposure/gain\n\tset manually","To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"UTF-8\"","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":31130,"web_url":"https://patchwork.libcamera.org/comment/31130/","msgid":"<172588969229.2319503.15742593397334557480@ping.linuxembedded.co.uk>","date":"2024-09-09T13:48:12","subject":"Re: [PATCH] ipa: rpi: agc: Ignore stable region when exposure/gain\n\tset manually","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting David Plowman (2024-09-09 14:22:04)\n> When a user is taking control of exposure and gain, setting them\n> manually, we set the AGC \"stable region\" to zero. This means that any\n> user changes, however small, will be applied, and they won't be\n> regarded as \"too small to bother with\".\n> \n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n\nThis sounds/looks sane to me, and this is the only function that\nstableRegion is used from the config file.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/ipa/rpi/controller/rpi/agc_channel.cpp | 7 +++++--\n>  1 file changed, 5 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp\n> index cf2565a8..c9df9b5b 100644\n> --- a/src/ipa/rpi/controller/rpi/agc_channel.cpp\n> +++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp\n> @@ -883,11 +883,14 @@ void AgcChannel::filterExposure()\n>  \n>         /*\n>          * AGC adapts instantly if both shutter and gain are directly specified\n> -        * or we're in the startup phase.\n> +        * or we're in the startup phase. Also disable the stable region, because we want\n> +        * to reflect any user exposure/gain updates, however small.\n>          */\n>         if ((status_.fixedShutter && status_.fixedAnalogueGain) ||\n> -           frameCount_ <= config_.startupFrames)\n> +           frameCount_ <= config_.startupFrames) {\n>                 speed = 1.0;\n> +               stableRegion = 0.0;\n> +       }\n>         if (!filtered_.totalExposure) {\n>                 filtered_.totalExposure = target_.totalExposure;\n>         } else if (filtered_.totalExposure * (1.0 - stableRegion) < target_.totalExposure &&\n> -- \n> 2.34.1\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 C6140C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  9 Sep 2024 13:48:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ACB98634F8;\n\tMon,  9 Sep 2024 15:48:15 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AB8D0634EE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Sep 2024 15:48:14 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5D4443DA;\n\tMon,  9 Sep 2024 15:46:58 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"m9zlcHE3\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1725889618;\n\tbh=3osuIpKB1s6Gb/qCetn3cfTl5vEb6LEIULS4oX1NUzU=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=m9zlcHE3zgm8f/35MIgvxX86Q1u3R4Qw/mx3XxLUQcEh/b01NvAncGF1vPtAJ3TJ/\n\t40yItied692dcAxW890l3Fm8cg8qSKztvGUpCNlu0dY7fR5tBWZe0d8fFdAHbZ7AVC\n\teLWN83KbPHbj3XAgZYFdEEHTQv3b4pjQSuDQjj28=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20240909132204.14147-1-david.plowman@raspberrypi.com>","References":"<20240909132204.14147-1-david.plowman@raspberrypi.com>","Subject":"Re: [PATCH] ipa: rpi: agc: Ignore stable region when exposure/gain\n\tset manually","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"David Plowman <david.plowman@raspberrypi.com>","To":"David Plowman <david.plowman@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 09 Sep 2024 14:48:12 +0100","Message-ID":"<172588969229.2319503.15742593397334557480@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>"}}]