{"id":19086,"url":"https://patchwork.libcamera.org/api/patches/19086/?format=json","web_url":"https://patchwork.libcamera.org/patch/19086/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230925102714.31780-1-naush@raspberrypi.com>","date":"2023-09-25T10:27:14","name":"[libcamera-devel] ipa: rpi: Fix frame count logic when running algorithms","commit_ref":"51533fecae8d9efb82a436eb26504cb8a8db9170","pull_url":null,"state":"accepted","archived":false,"hash":"4b31887e0e79e56ea53cb61f297ff6e144900851","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19086/mbox/","series":[{"id":4037,"url":"https://patchwork.libcamera.org/api/series/4037/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4037","date":"2023-09-25T10:27:14","name":"[libcamera-devel] ipa: rpi: Fix frame count logic when running algorithms","version":1,"mbox":"https://patchwork.libcamera.org/series/4037/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19086/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19086/checks/","tags":{},"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 4C58AC326B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 25 Sep 2023 10:27:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A106F62931;\n\tMon, 25 Sep 2023 12:27:19 +0200 (CEST)","from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com\n\t[IPv6:2a00:1450:4864:20::32a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E60A3628FA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Sep 2023 12:27:17 +0200 (CEST)","by mail-wm1-x32a.google.com with SMTP id\n\t5b1f17b1804b1-4053db20d03so47559665e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Sep 2023 03:27:17 -0700 (PDT)","from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tp19-20020a05600c1d9300b0040531f5c51asm11974634wms.5.2023.09.25.03.27.16\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 25 Sep 2023 03:27:16 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1695637639;\n\tbh=qhVbYuFtENNVTCz1CYfx88/Y+v8sEtLJVBwETMYBueQ=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=nX33JuBbflcvZL7YrC7g8HgbgWK21J3lL8OM48FWmAxAa/Qmznn8NAQwpDso42UCK\n\t1JZ1v5pM2dBvtC/AuDuOFPyxWtBP7nRqP5E6qVSrF++id2ij7I3Q86tmwJLFP4MYi4\n\tSIOWChgTRtvmxO4M8TGp1Ny/bhamv4r7SBsttEAuj99JuGcmO2m/dXJXIniiyhqtqH\n\tW2Rjf0NvujAZKJ0y6RVZCtcggC4GkESOqgKbmMYQV1cN7wt6hWD1oiS56O6NcZhboH\n\tZmiMpkk/IIwUWOHfUty+Mz0AXouJe7tGZuSbET8nk9ZWzUYGJbZ7mGY15TwQIONfDG\n\tOhVxhpNoiY0Ng==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1695637637; x=1696242437;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=fdssBw/9AWXE07eotNGp9RB1NjIg/NYZ5aW71fQezuA=;\n\tb=gTHIG+9d3xjwiql8lR0ZJ9xvNgnO/ZWX8zWmRh64K/44gykWDBU3GEiOmdzTx/tzOJ\n\tJFG84TVo1b5fhQ74Pl1kWOQYQjwhM8DXfVE2KqejcSJJ/EkyIrGf8H9RtFYcvsTiCbRb\n\ta8zQX+3VpYA19zwb8QFuqfGNvniLG4o0mCLqe4q1PeNsPhuHWk2/BUGij6B2WLh7/ufu\n\t3+8cZl6Itn9zOPfDec3CiMbwyxHKqZrFB2d/OeSqLKfUeyJJS3LZU8XvzGzg/ps0DqN0\n\tYkS0L7zg9DmHzw+Qp9iulE1ykPjQhPwZKOG8PEdimDz+63Z0C1zN5OHUowdUmgrf9q5q\n\tq2DQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"gTHIG+9d\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1695637637; x=1696242437;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=fdssBw/9AWXE07eotNGp9RB1NjIg/NYZ5aW71fQezuA=;\n\tb=A9KK2Nur9cvmWB4P/TVKbUEK8jsBLVxChmSj4dGxx2XY31p+6sQUxqZ560J3gGIaVP\n\tD5wIjKYK8zluEwz0jQ4+9EIogDKrCFPdVM7uBFs0v+2EJYfQOeMTblzTNZ5Dnxx6nQFG\n\tbn3Nqns8plseEAA4Twe6O9kNKYbxiriU0PDScKa9JVA6Ut4XZBkUfIX534skrCqO9Jpd\n\to9hHFW0i3M1xWQHuTkZ2GZ2qR8g6QvGfFWn1kkgWSnB4V9SKqoSPKabwz4OzX4glFOM2\n\tmry6XLlIog2khI908gMmQz05GvTUbuzjeX/O/sS4tetOmezPps1czADstZLlYhOkerRJ\n\tAnTQ==","X-Gm-Message-State":"AOJu0Yz69s81E+eu/gBDJwY3j9UgSMP4cRe0+Av76TanktgLVUmOeyVs\n\tTsjrwiyxJWzl6MRxH3hqh31KBYxFtkH/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\n\tk9-20020a05600c0b4900b004051ba24fd1mr5821352wmr.24.1695637637156; \n\tMon, 25 Sep 2023 03:27:17 -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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] ipa: rpi: Fix frame count logic when\n\trunning algorithms","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>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The frame counter test to determine if we run the IPA algorithms has a\nlogic bug where it treats dropFrameCount_ and mistrustCount_ as frame\nnumbers, not counts of frames (which it is). The implication is that\nstartup convergence and initial settings take one extra frame to apply.\nFix this.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/rpi/common/ipa_base.cpp | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)","diff":"diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex f7e7ad5ee499..5d8344e3e7e3 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -409,7 +409,7 @@ void IpaBase::prepareIsp(const PrepareParams &params)\n \n \t/* Allow a 10% margin on the comparison below. */\n \tDuration delta = (frameTimestamp - lastRunTimestamp_) * 1.0ns;\n-\tif (lastRunTimestamp_ && frameCount_ > dropFrameCount_ &&\n+\tif (lastRunTimestamp_ && frameCount_ >= dropFrameCount_ &&\n \t    delta < controllerMinFrameDuration * 0.9) {\n \t\t/*\n \t\t * Ensure we merge the previous frame's metadata with the current\n@@ -451,7 +451,7 @@ void IpaBase::processStats(const ProcessParams &params)\n {\n \tunsigned int ipaContext = params.ipaContext % rpiMetadata_.size();\n \n-\tif (processPending_ && frameCount_ > mistrustCount_) {\n+\tif (processPending_ && frameCount_ >= mistrustCount_) {\n \t\tRPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext];\n \n \t\tauto it = buffers_.find(params.buffers.stats);\n","prefixes":["libcamera-devel"]}