[{"id":13893,"web_url":"https://patchwork.libcamera.org/comment/13893/","msgid":"<CAEmqJPop9eg9rPDAH9JNJUEe1HrZL4E50eGafQ0jjmfCdeqfOw@mail.gmail.com>","date":"2020-11-26T09:26:22","subject":"Re: [libcamera-devel] [PATCH 1/3] src: ipa: raspberrypi: Avoid AGC\n\tfiltering when both gain and shutter specified","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 your patch.\n\nOn Wed, 25 Nov 2020 at 11:36, David Plowman <david.plowman@raspberrypi.com>\nwrote:\n\n> When both gain and shutter have been directly specified, do not filter\n> slowly towards those target values, but adopt them immediately. This\n> should match user expectations better.\n>\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n>\n\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n\n\n> ---\n>  src/ipa/raspberrypi/controller/rpi/agc.cpp | 7 ++++++-\n>  1 file changed, 6 insertions(+), 1 deletion(-)\n>\n> diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> index 4c56bdc9..30a1c1c1 100644\n> --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> @@ -588,7 +588,12 @@ bool Agc::applyDigitalGain(double gain, double\n> target_Y)\n>\n>  void Agc::filterExposure(bool desaturate)\n>  {\n> -       double speed = frame_count_ <= config_.startup_frames ? 1.0 :\n> config_.speed;\n> +       double speed = config_.speed;\n> +       // AGC adapts instantly if both shutter and gain are directly\n> specified\n> +       // or we're in the startup phase.\n> +       if ((status_.fixed_shutter && status_.fixed_analogue_gain) ||\n> +           frame_count_ <= config_.startup_frames)\n> +               speed = 1.0;\n>         if (filtered_.total_exposure == 0.0) {\n>                 filtered_.total_exposure = target_.total_exposure;\n>                 filtered_.total_exposure_no_dg =\n> target_.total_exposure_no_dg;\n> --\n> 2.20.1\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel\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 8E9A1BE176\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Nov 2020 09:26:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5DB9063441;\n\tThu, 26 Nov 2020 10:26:40 +0100 (CET)","from mail-lf1-x141.google.com (mail-lf1-x141.google.com\n\t[IPv6:2a00:1450:4864:20::141])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D94F60331\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Nov 2020 10:26:39 +0100 (CET)","by mail-lf1-x141.google.com with SMTP id d20so1490792lfe.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Nov 2020 01:26:39 -0800 (PST)"],"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=\"Myr1kyY8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=0tiMd5qh+zg4K2MjwJ+PQCXL6kzr/Uc6VOgZMdAjPDo=;\n\tb=Myr1kyY8WuC9sNqZl5KwuWpNa7SlY2eY2h6RwqnnZEKyjPf2SbvRDwig64UfR+h9oK\n\tlvh7tFWacUt8otvc705gb8ESx/dkJGYT70MbzN6c/ifvPalAxwCvYhiTYJuIWvo3CqIJ\n\thylTIgO5Za5JCaGhbu7zIq4GstVHDzl0uyHMXdp92oM3FOSXTw+Zoief821x6D95lELA\n\tmQSbDzrQJQEPl8qTI/QxLYYcMHrR74WAIxS7dmMih75fgPcgYGqHokUolKFy38JYuOxY\n\tTqpZcE2QzIfJGV2dAv7vjFCyKC1QVZ9wfno2BM3x6L37GD7vrwzPY/sAN3LP3aEW7DmI\n\tBKSQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=0tiMd5qh+zg4K2MjwJ+PQCXL6kzr/Uc6VOgZMdAjPDo=;\n\tb=lh8epFiM6I14FEh6N9UyH13vly5WVNPhzdeEVUg0eIU6O7/VvZlZ9WThEw7I/28GIV\n\tu30QC8s2AM7wVr01T6ugWTD37Y+z9mO7UFoN0vu3IfPRhunhAsvUijybsp1WLkB7zH8m\n\tz13l7ydHsD5ThtQ17x4v1uNoMku7mRuCz7exojCdaAqBhPOEp+6Znn7JyAJkj/YQxUGW\n\trycPoewolwzHpP2a4/HYdsDREkbPrOGdPPuBMCElGi7B2jk2kaYc+UBJa4D7qEAVAKwZ\n\tDSw8ZUzOkPuXi69r2OfIyCgeIfh6ZCWtwhy7BAaaB7yQ1ypp/gPT7JRzJmNMfOivUgge\n\tAchg==","X-Gm-Message-State":"AOAM533QRPCQvFqyu4+Gm5ouxp2qz/75Y5DBo0x0nx+U+hozV7hShmQY\n\tTeozmHZnpTXByDShmhGSLviekWmprsLzaOWNDiHfp0HdzL4=","X-Google-Smtp-Source":"ABdhPJwbltRcMHFW0Y2I2/lPWhLIlQkgQOIEe5cQ92/c82vMoVA+oFRT0xyjHqDSZhUhljM+3pTFv3ySbgxotCreGN4=","X-Received":"by 2002:a19:418d:: with SMTP id\n\to135mr1006799lfa.329.1606382798847; \n\tThu, 26 Nov 2020 01:26:38 -0800 (PST)","MIME-Version":"1.0","References":"<20201125113640.20246-1-david.plowman@raspberrypi.com>\n\t<20201125113640.20246-2-david.plowman@raspberrypi.com>","In-Reply-To":"<20201125113640.20246-2-david.plowman@raspberrypi.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Thu, 26 Nov 2020 09:26:22 +0000","Message-ID":"<CAEmqJPop9eg9rPDAH9JNJUEe1HrZL4E50eGafQ0jjmfCdeqfOw@mail.gmail.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 1/3] src: ipa: raspberrypi: Avoid AGC\n\tfiltering when both gain and shutter specified","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Content-Type":"multipart/mixed;\n\tboundary=\"===============8790507230575512426==\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":13900,"web_url":"https://patchwork.libcamera.org/comment/13900/","msgid":"<20201126100027.GB3905@pendragon.ideasonboard.com>","date":"2020-11-26T10:00:27","subject":"Re: [libcamera-devel] [PATCH 1/3] src: ipa: raspberrypi: Avoid AGC\n\tfiltering when both gain and shutter specified","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi David,\n\nThank you for the patch.\n\nOn Wed, Nov 25, 2020 at 11:36:38AM +0000, David Plowman wrote:\n> When both gain and shutter have been directly specified, do not filter\n> slowly towards those target values, but adopt them immediately. This\n> should match user expectations better.\n> \n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/ipa/raspberrypi/controller/rpi/agc.cpp | 7 ++++++-\n>  1 file changed, 6 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> index 4c56bdc9..30a1c1c1 100644\n> --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> @@ -588,7 +588,12 @@ bool Agc::applyDigitalGain(double gain, double target_Y)\n>  \n>  void Agc::filterExposure(bool desaturate)\n>  {\n> -\tdouble speed = frame_count_ <= config_.startup_frames ? 1.0 : config_.speed;\n> +\tdouble speed = config_.speed;\n> +\t// AGC adapts instantly if both shutter and gain are directly specified\n> +\t// or we're in the startup phase.\n> +\tif ((status_.fixed_shutter && status_.fixed_analogue_gain) ||\n> +\t    frame_count_ <= config_.startup_frames)\n> +\t\tspeed = 1.0;\n>  \tif (filtered_.total_exposure == 0.0) {\n>  \t\tfiltered_.total_exposure = target_.total_exposure;\n>  \t\tfiltered_.total_exposure_no_dg = target_.total_exposure_no_dg;","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 934E0BE08A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Nov 2020 10:00:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E6AC063447;\n\tThu, 26 Nov 2020 11:00:37 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 065616343E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Nov 2020 11:00:35 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8C17DA1B;\n\tThu, 26 Nov 2020 11:00:35 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"X2qA+7I6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1606384835;\n\tbh=d8xXB12g99S+6FYGE+714WihW8H/4bJTv4PLWOp0oZM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=X2qA+7I67PG8zhNCZy+ynn9VrziFCPvniQ7u5OhrXyHSIrpZ7NIKDOXQyemc8ZPB1\n\tgRJHEjwL733pIxivtrrRO3M4GwPtv4Ol1zUsooVpeTJ0WE1YBWVf2CGY1233cFLs/a\n\tBBWgDzm35pZ4IjFbKndXBUgFpEERE2Eilj58rWhk=","Date":"Thu, 26 Nov 2020 12:00:27 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Message-ID":"<20201126100027.GB3905@pendragon.ideasonboard.com>","References":"<20201125113640.20246-1-david.plowman@raspberrypi.com>\n\t<20201125113640.20246-2-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201125113640.20246-2-david.plowman@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 1/3] src: ipa: raspberrypi: Avoid AGC\n\tfiltering when both gain and shutter specified","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]