From patchwork Mon Sep 25 10:27:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 19086 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 4C58AC326B for ; Mon, 25 Sep 2023 10:27:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A106F62931; Mon, 25 Sep 2023 12:27:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1695637639; bh=qhVbYuFtENNVTCz1CYfx88/Y+v8sEtLJVBwETMYBueQ=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=nX33JuBbflcvZL7YrC7g8HgbgWK21J3lL8OM48FWmAxAa/Qmznn8NAQwpDso42UCK 1JZ1v5pM2dBvtC/AuDuOFPyxWtBP7nRqP5E6qVSrF++id2ij7I3Q86tmwJLFP4MYi4 SIOWChgTRtvmxO4M8TGp1Ny/bhamv4r7SBsttEAuj99JuGcmO2m/dXJXIniiyhqtqH W2Rjf0NvujAZKJ0y6RVZCtcggC4GkESOqgKbmMYQV1cN7wt6hWD1oiS56O6NcZhboH ZmiMpkk/IIwUWOHfUty+Mz0AXouJe7tGZuSbET8nk9ZWzUYGJbZ7mGY15TwQIONfDG OhVxhpNoiY0Ng== Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E60A3628FA for ; Mon, 25 Sep 2023 12:27:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="gTHIG+9d"; dkim-atps=neutral Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4053db20d03so47559665e9.2 for ; Mon, 25 Sep 2023 03:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1695637637; x=1696242437; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fdssBw/9AWXE07eotNGp9RB1NjIg/NYZ5aW71fQezuA=; b=gTHIG+9d3xjwiql8lR0ZJ9xvNgnO/ZWX8zWmRh64K/44gykWDBU3GEiOmdzTx/tzOJ JFG84TVo1b5fhQ74Pl1kWOQYQjwhM8DXfVE2KqejcSJJ/EkyIrGf8H9RtFYcvsTiCbRb a8zQX+3VpYA19zwb8QFuqfGNvniLG4o0mCLqe4q1PeNsPhuHWk2/BUGij6B2WLh7/ufu 3+8cZl6Itn9zOPfDec3CiMbwyxHKqZrFB2d/OeSqLKfUeyJJS3LZU8XvzGzg/ps0DqN0 YkS0L7zg9DmHzw+Qp9iulE1ykPjQhPwZKOG8PEdimDz+63Z0C1zN5OHUowdUmgrf9q5q q2DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695637637; x=1696242437; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fdssBw/9AWXE07eotNGp9RB1NjIg/NYZ5aW71fQezuA=; b=A9KK2Nur9cvmWB4P/TVKbUEK8jsBLVxChmSj4dGxx2XY31p+6sQUxqZ560J3gGIaVP D5wIjKYK8zluEwz0jQ4+9EIogDKrCFPdVM7uBFs0v+2EJYfQOeMTblzTNZ5Dnxx6nQFG bn3Nqns8plseEAA4Twe6O9kNKYbxiriU0PDScKa9JVA6Ut4XZBkUfIX534skrCqO9Jpd o9hHFW0i3M1xWQHuTkZ2GZ2qR8g6QvGfFWn1kkgWSnB4V9SKqoSPKabwz4OzX4glFOM2 mry6XLlIog2khI908gMmQz05GvTUbuzjeX/O/sS4tetOmezPps1czADstZLlYhOkerRJ AnTQ== X-Gm-Message-State: AOJu0Yz69s81E+eu/gBDJwY3j9UgSMP4cRe0+Av76TanktgLVUmOeyVs TsjrwiyxJWzl6MRxH3hqh31KBYxFtkH/TnFzjeW4sQ== X-Google-Smtp-Source: AGHT+IH+Da5CKXu+xoQBF2MMRP0YlxrMUVvW/CWwgPi02NZ+uZBSVlTYeUvxzzB7KculGsYpyVQcOg== X-Received: by 2002:a05:600c:b49:b0:405:1ba2:4fd1 with SMTP id k9-20020a05600c0b4900b004051ba24fd1mr5821352wmr.24.1695637637156; Mon, 25 Sep 2023 03:27:17 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id p19-20020a05600c1d9300b0040531f5c51asm11974634wms.5.2023.09.25.03.27.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 03:27:16 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 25 Sep 2023 11:27:14 +0100 Message-Id: <20230925102714.31780-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] ipa: rpi: Fix frame count logic when running algorithms X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The frame counter test to determine if we run the IPA algorithms has a logic bug where it treats dropFrameCount_ and mistrustCount_ as frame numbers, not counts of frames (which it is). The implication is that startup convergence and initial settings take one extra frame to apply. Fix this. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Tested-by: David Plowman Reviewed-by: Kieran Bingham --- src/ipa/rpi/common/ipa_base.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index f7e7ad5ee499..5d8344e3e7e3 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -409,7 +409,7 @@ void IpaBase::prepareIsp(const PrepareParams ¶ms) /* Allow a 10% margin on the comparison below. */ Duration delta = (frameTimestamp - lastRunTimestamp_) * 1.0ns; - if (lastRunTimestamp_ && frameCount_ > dropFrameCount_ && + if (lastRunTimestamp_ && frameCount_ >= dropFrameCount_ && delta < controllerMinFrameDuration * 0.9) { /* * Ensure we merge the previous frame's metadata with the current @@ -451,7 +451,7 @@ void IpaBase::processStats(const ProcessParams ¶ms) { unsigned int ipaContext = params.ipaContext % rpiMetadata_.size(); - if (processPending_ && frameCount_ > mistrustCount_) { + if (processPending_ && frameCount_ >= mistrustCount_) { RPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext]; auto it = buffers_.find(params.buffers.stats);