[{"id":31803,"web_url":"https://patchwork.libcamera.org/comment/31803/","msgid":"<20241018155035.GA611@pendragon.ideasonboard.com>","date":"2024-10-18T15:50:35","subject":"Re: [PATCH v3 1/4] ipa: rkisp1: algorithms: agc: Check for correct\n\tstats type","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Fri, Oct 18, 2024 at 05:30:57PM +0200, Stefan Klug wrote:\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 v3:\n> - Split check for stats and type, to silence messages in raw mode\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 | 6 +++++-\n>  1 file changed, 5 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> index 17d074d9c03e..281c404902a0 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> @@ -402,6 +402,11 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n>  \t\tfillMetadata(context, frameContext, metadata);\n>  \t\treturn;\n>  \t}\n> +\t\n> +\tif (!(stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP)) {\n> +\t\tLOG(RkISP1Agc, Error) << \"AUTOEXP data is missing in statistics\";\n\nNo need to call fillMetadata() here ?\n\n> +\t\treturn;\n> +\t}\n>  \n>  \t/*\n>  \t * \\todo Verify that the exposure and gain applied by the sensor for\n> @@ -412,7 +417,6 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n>  \t */\n>  \n>  \tconst rkisp1_cif_isp_stat *params = &stats->params;\n> -\tASSERT(stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP);\n>  \n>  \t/* The lower 4 bits are fractional and meant to be discarded. */\n>  \tHistogram hist({ params->hist.hist_bins, context.hw->numHistogramBins },","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 B3B4BC32AF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Oct 2024 15:50:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A216A6538A;\n\tFri, 18 Oct 2024 17:50:41 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 916EE633C6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Oct 2024 17:50:40 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7703B21C;\n\tFri, 18 Oct 2024 17:48:56 +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=\"BLTl4SkD\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729266536;\n\tbh=YmnbT0n0RgTJrs6j55UK/L9RFJTVl6+EUOvHcHDr0pI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=BLTl4SkDqi64OhU4rk5IBu4G65EVUJ5iR8mFYnQZ8u8M4DJMPUDs/Jhawptla9qIH\n\tgjkxa6PSL7TP6znMChCxV64NxtrUyeW0Mvk2Qus1DmCD8+sGY9lG3moLkyd9C5pdSj\n\t0N5vlzhCnIqBCjTQuz4ft/uXGclIkQoiReB1VaPs=","Date":"Fri, 18 Oct 2024 18:50:35 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","Subject":"Re: [PATCH v3 1/4] ipa: rkisp1: algorithms: agc: Check for correct\n\tstats type","Message-ID":"<20241018155035.GA611@pendragon.ideasonboard.com>","References":"<20241018153116.925892-1-stefan.klug@ideasonboard.com>\n\t<20241018153116.925892-2-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241018153116.925892-2-stefan.klug@ideasonboard.com>","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>"}}]