From patchwork Wed Jul 13 08:43:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Semkowicz X-Patchwork-Id: 16608 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 5EF5FBE173 for ; Wed, 13 Jul 2022 08:43:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2C85C63313; Wed, 13 Jul 2022 10:43:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657701832; bh=m+Xj9uD9TyeuceKfbUq/i9CZdpOv8SWmTrnRRg9kaqQ=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=EOPf4IpTni0MbTve1H5U1Hv16pPLp7APovevYx5tDjmbPai4dzIPt3w35SqqZ3et/ HsaG62wzwZlronn3zb5l80KlswQhYyyJxX56jmp6tfWA9S2ZI3VcHgeqTBUG3gHl7x QWx6sKqDfYT9FyHpTMkTXU5YUWdYXKM01CEgpwhIMa0LMf7KRKutqq38jaVwUe5XEA E/3E6tmcW3pfP+hf1HNGKg3hULHlr1l7pLRlBUrpRifIB+HS/948fe+0G0uVCajaEI 5ZG/yIqw6tr4oIF9aZDl5Qy6q7LZ9egpUUyBjPd0QnhuMiWHqkAj9gURP6x9paZg8Z JS5hqZmSwBrBA== Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 035C36332B for ; Wed, 13 Jul 2022 10:43:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=thaumatec-com.20210112.gappssmtp.com header.i=@thaumatec-com.20210112.gappssmtp.com header.b="j+SzsUAc"; dkim-atps=neutral Received: by mail-wr1-x42c.google.com with SMTP id v16so14439356wrd.13 for ; Wed, 13 Jul 2022 01:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thaumatec-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TEGxL/naVQWQr6xucb2l/oPavSBpoOzBqH6+ELsxOok=; b=j+SzsUAcCBf5txDfkptZX1lcfIyqzZpFWNE8xooIov5+NSNLf/NZ1nlAPPU81ret8u wi8GLBtuNMGm3Z+zEWZ6wuTK8a0/JSktUS7eluXlH3oQqGohGJ89dBYR9GwTXV9kyNAC mxlGTpZ8pJhVndbU6EJ2tvpHZrm3xbMUHI6kjJdwrndZrEEjWDaefVOxSDBlBlGaiwso WerZdeAQErT/dy/vBRREceEybQgIBtU4b9+UZ4usue8T0glHqsQwl4tJ7SUPyaVTV7j5 aF168FNJ2fnn6QNGFbEsJYj8z1w0OrQWkLJ97aupQ2vh7KszaTrCVohOnEG46TgA2jvt P+DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TEGxL/naVQWQr6xucb2l/oPavSBpoOzBqH6+ELsxOok=; b=HBCTrxKfhYwoG/Tq30gzk/a9x+EhIpd2McHLq9I1FS0uBN07dRAI01R5SSo6iqwFrc 6GOp31XwZYXLFXfyp7WK8Kh+98X7yiAAYfk81Y6IS+hksvPCtTmohgODXtohPyhvyyeG tfZR7h83dG8xyAF8YDtZ5/I2HmrQkvgSXi8Xm0++ZCn6QuVmJXsrmL2jkiOSVRL3vPCe frRsX7O7SnUogdbN3A1nKuxkc1jR+6CHYVKT5RKF01QRwt65IrPubhAWIRwLWy3KnGKf QIGCH2KlGQZ0l+ANrMuXJwFlFcs0pAAOazHwBNeHHhnG41SYoQBn6/Frz7MYxSIuRO1q V55Q== X-Gm-Message-State: AJIora+PuAkPCfhbJ6nVJM7yYoCMBO6MDPfYQ5vz/RSqwzR0cVjDfNk/ 1kB3VAnb5F0yJ5LE5W89IAikaRDBSUiJkA== X-Google-Smtp-Source: AGRyM1sXVokCw6nXi8XnVOHXewAKHrzTW+POJsPOPis6d+pRWu2r0rHfk5wviIW084OLqjW4ih2L3w== X-Received: by 2002:a5d:4344:0:b0:21d:578a:d8b7 with SMTP id u4-20020a5d4344000000b0021d578ad8b7mr2026751wrr.108.1657701828587; Wed, 13 Jul 2022 01:43:48 -0700 (PDT) Received: from localhost.localdomain (ip092042140082.rev.nessus.at. [92.42.140.82]) by smtp.gmail.com with ESMTPSA id bg32-20020a05600c3ca000b003a04d19dab3sm5667468wmb.3.2022.07.13.01.43.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 01:43:48 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 13 Jul 2022 10:43:16 +0200 Message-Id: <20220713084317.24268-11-dse@thaumatec.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220713084317.24268-1-dse@thaumatec.com> References: <20220713084317.24268-1-dse@thaumatec.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 10/11] ipa: rkisp1: af: Skip few frames after changing lens position 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: Daniel Semkowicz via libcamera-devel From: Daniel Semkowicz Reply-To: Daniel Semkowicz Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" With 30fps stream, lens movement takes more time than one frame. Skip few frames to allow lens to stabilize before calculating next contrast value. Signed-off-by: Daniel Semkowicz --- src/ipa/rkisp1/algorithms/af.cpp | 5 ++++- src/ipa/rkisp1/algorithms/af.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ipa/rkisp1/algorithms/af.cpp b/src/ipa/rkisp1/algorithms/af.cpp index cd4f0e08..a0d914e0 100644 --- a/src/ipa/rkisp1/algorithms/af.cpp +++ b/src/ipa/rkisp1/algorithms/af.cpp @@ -86,7 +86,10 @@ void Af::process(IPAContext &context, uint32_t lensPosition = processAutofocus(sharpness); - context.frameContext.af.focus = lensPosition; + if (lensPosition != context.frameContext.af.focus) { + context.frameContext.af.focus = lensPosition; + setFramesToSkip(kFLensWaitFrames); + } } void Af::setMetering(controls::AfMeteringEnum metering) diff --git a/src/ipa/rkisp1/algorithms/af.h b/src/ipa/rkisp1/algorithms/af.h index eeb806c0..36d0c9b0 100644 --- a/src/ipa/rkisp1/algorithms/af.h +++ b/src/ipa/rkisp1/algorithms/af.h @@ -36,6 +36,8 @@ private: Rectangle defaultWindow_; Rectangle userWindow_; bool updateAfwindow_ = false; + + static constexpr uint32_t kFLensWaitFrames = 2; }; } /* namespace libcamera::ipa::rkisp1::algorithms */