[{"id":31799,"web_url":"https://patchwork.libcamera.org/comment/31799/","msgid":"<172926394386.532453.2335561912738833362@ping.linuxembedded.co.uk>","date":"2024-10-18T15:05:43","subject":"Re: [PATCH v2 1/4] ipa: rkisp1: algorithms: agc: Check for correct\n\tstats type","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2024-10-18 15:58:35)\n> Sometimes the ISP produces statistics only with a subset of statistic\n> types being valid. It doesn't happen normally, but was observed in the\n> wild. Check for the RKISP1_CIF_ISP_STAT_AUTOEXP bit to prevent using\n> invalid or outdated data. As it doesn't happen regularly add an error\n> message to get notified when it happens.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> \n> ---\n> Changes in v2:\n> - Added error message\n> - Made condition more readable\n> - Collected tags\n> ---\n>  src/ipa/rkisp1/algorithms/agc.cpp | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> index 17d074d9c03e..f03136836fd7 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> @@ -398,8 +398,9 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n>                   IPAFrameContext &frameContext, const rkisp1_stat_buffer *stats,\n>                   ControlList &metadata)\n>  {\n> -       if (!stats) {\n> +       if (!stats || !(stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP)) {\n>                 fillMetadata(context, frameContext, metadata);\n> +               LOG(RkISP1Agc, Error) << \"AUTOEXP data is missing in statistics\";\n\nWon't this now report an error for every frame on Raw streams?\n\n>                 return;\n>         }\n>  \n> @@ -412,7 +413,6 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n>          */\n>  \n>         const rkisp1_cif_isp_stat *params = &stats->params;\n> -       ASSERT(stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP);\n>  \n>         /* The lower 4 bits are fractional and meant to be discarded. */\n>         Histogram hist({ params->hist.hist_bins, context.hw->numHistogramBins },\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 63AB7C32FE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Oct 2024 15:05:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5DB8165380;\n\tFri, 18 Oct 2024 17:05:49 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 52624633C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Oct 2024 17:05:47 +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 39D625A5;\n\tFri, 18 Oct 2024 17:04:03 +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=\"Gsiu+Tl3\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729263843;\n\tbh=RvTbg2W5pVblhbr0JNkZSwXJyARiyjcfBBgd2QSGrr8=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=Gsiu+Tl3zEOwd3NOBVA85sRtRR1TMrflbiVsV7r2vbJNu2fkAeByZmxdO/I4VVhdm\n\tfbIDMg+4hfXTwm5l+8eIa6EVgFZi7eqhGVG6w7R1IeFiSJesUaXMTCXTIyU7mHx8u+\n\tDFUW+xfANrbEgBoVgvSVbGugeSUEzT5OH9BUDIUE=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20241018145856.914816-2-stefan.klug@ideasonboard.com>","References":"<20241018145856.914816-1-stefan.klug@ideasonboard.com>\n\t<20241018145856.914816-2-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v2 1/4] ipa: rkisp1: algorithms: agc: Check for correct\n\tstats type","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 18 Oct 2024 16:05:43 +0100","Message-ID":"<172926394386.532453.2335561912738833362@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>"}},{"id":31801,"web_url":"https://patchwork.libcamera.org/comment/31801/","msgid":"<64d3oe6263pyxw2xuz2r6vn257hxfx65uuyhei2qafin4weh6f@hi3rl5nr2q7t>","date":"2024-10-18T15:26:41","subject":"Re: [PATCH v2 1/4] ipa: rkisp1: algorithms: agc: Check for correct\n\tstats type","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"On Fri, Oct 18, 2024 at 04:05:43PM +0100, Kieran Bingham wrote:\n> Quoting Stefan Klug (2024-10-18 15:58:35)\n> > Sometimes the ISP produces statistics only with a subset of statistic\n> > types being valid. It doesn't happen normally, but was observed in the\n> > wild. Check for the RKISP1_CIF_ISP_STAT_AUTOEXP bit to prevent using\n> > invalid or outdated data. As it doesn't happen regularly add an error\n> > message to get notified when it happens.\n> > \n> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> > \n> > ---\n> > Changes in v2:\n> > - Added error message\n> > - Made condition more readable\n> > - Collected tags\n> > ---\n> >  src/ipa/rkisp1/algorithms/agc.cpp | 4 ++--\n> >  1 file changed, 2 insertions(+), 2 deletions(-)\n> > \n> > diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> > index 17d074d9c03e..f03136836fd7 100644\n> > --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> > +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> > @@ -398,8 +398,9 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n> >                   IPAFrameContext &frameContext, const rkisp1_stat_buffer *stats,\n> >                   ControlList &metadata)\n> >  {\n> > -       if (!stats) {\n> > +       if (!stats || !(stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP)) {\n> >                 fillMetadata(context, frameContext, metadata);\n> > +               LOG(RkISP1Agc, Error) << \"AUTOEXP data is missing in statistics\";\n> \n> Won't this now report an error for every frame on Raw streams?\n\nOuch. v3 is on it's way.\n\n> \n> >                 return;\n> >         }\n> >  \n> > @@ -412,7 +413,6 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n> >          */\n> >  \n> >         const rkisp1_cif_isp_stat *params = &stats->params;\n> > -       ASSERT(stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP);\n> >  \n> >         /* The lower 4 bits are fractional and meant to be discarded. */\n> >         Histogram hist({ params->hist.hist_bins, context.hw->numHistogramBins },\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 5170BC32AF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Oct 2024 15:26:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E7C4E6538B;\n\tFri, 18 Oct 2024 17:26:46 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2E945633C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Oct 2024 17:26:45 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:77a0:ddb9:22bf:b8d9])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 12F7B21C;\n\tFri, 18 Oct 2024 17:25:01 +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=\"eFyJfSSS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729265101;\n\tbh=DMbzXYim5lWxiTSWHpeixztc7fTJXxe800qC7AF7Yv8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=eFyJfSSSH6IvUOr994teBH4LINAZS1s7RO+r1qfjMdxg5ENJlelBf+pFQVU7V1iuL\n\tJ86s3FRw7+QHmStxK61U94MruQgLE8ka504bCaAnCc6nExZjfSi3rfSfwBNeFnFWEV\n\t8mDygox2j+tRDOfBkgoAfVYpU8C32wPqwGeB9rVA=","Date":"Fri, 18 Oct 2024 17:26:41 +0200","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, \n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","Subject":"Re: [PATCH v2 1/4] ipa: rkisp1: algorithms: agc: Check for correct\n\tstats type","Message-ID":"<64d3oe6263pyxw2xuz2r6vn257hxfx65uuyhei2qafin4weh6f@hi3rl5nr2q7t>","References":"<20241018145856.914816-1-stefan.klug@ideasonboard.com>\n\t<20241018145856.914816-2-stefan.klug@ideasonboard.com>\n\t<172926394386.532453.2335561912738833362@ping.linuxembedded.co.uk>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<172926394386.532453.2335561912738833362@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>"}}]