From patchwork Fri May 6 05:18:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15805 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 95C6EC3256 for ; Fri, 6 May 2022 05:19:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E551565650; Fri, 6 May 2022 07:19:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1651814366; bh=ZGem10q5WiPOC/d2uCOAfYfrTHlzxaLoBKgTMKV7uL0=; 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=GEJnfKaIo1kCG6T3JyzNjV3nZfID2izfk9ciYshWI3l4ALZnEfIccm23bwJp9Ohic 4J/sZW49VfftCjL/dHpf1X8ZxAi4XCzIcA5RtxF+wLGVu0gWLjq7AOAxnXxHfnFgUL mKyn0n3aKYcbW0gbooQakPKPQLVHepV3OLFqbgJIeZ2SUzllhrp6tF7+32BNhgCv+j xhRcmkqCS8PHOmWi8lb7Jf8M6GvCYNr3CRptCUb7WZpd/tSojAN1oVln9eHaVl6z3J 6RMuk/uEk+tymtC/q7RKJCw3FxyKGOzM3ChIOS8zIGhgPojDLbJaiq9ygaTY8o+Ov3 VQgBUSKv0ZufQ== Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [170.10.133.74]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 829A865649 for ; Fri, 6 May 2022 07:19:24 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="DHPWrOAK"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651814363; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cQ9ZrM0EBcsJIxhSzclD3wJkVaHwjYhhItKbzmRLEzo=; b=DHPWrOAKCqNe8riYrpxptNzOhJjj6IAPP/g+0arV1/AN92NApQSAf9cpttjH6KNfKIZ6jS FMRHgNAOc8Sk/7SfB5epU3F2JN8q+tl0oidjpPGu41JCaRH/CMy971YZ1wZpGetxfXoi8j +o+bWHSm57/cNcsXDurWChAwGjcYLjw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-394-1tJWtS3lOHK6ZPPmyIZnfQ-1; Fri, 06 May 2022 01:19:22 -0400 X-MC-Unique: 1tJWtS3lOHK6ZPPmyIZnfQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5D11F8001EA; Fri, 6 May 2022 05:19:22 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.192.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD8402166B1A; Fri, 6 May 2022 05:19:19 +0000 (UTC) To: libcamera devel , Jean-Michel Hautbois , Hans De Goede Date: Fri, 6 May 2022 13:18:40 +0800 Message-Id: <20220506051841.70792-3-hpa@redhat.com> In-Reply-To: <20220506051841.70792-1-hpa@redhat.com> References: <20220506051841.70792-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hpa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [libcamera-devel] [PATCH v2 2/3] ipa: ipu3: af: Trigger AF after AGC is stable 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: Kate Hsuan via libcamera-devel From: Kate Hsuan Reply-To: Kate Hsuan Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" AGC stable status is used to determine that AF is triggered or paused. If AGC is ready, AF can start to evaluate the lens position. Signed-off-by: Kate Hsuan --- src/ipa/ipu3/algorithms/af.cpp | 12 ++++++++++++ src/ipa/ipu3/algorithms/af.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp index f700b01f..8cabd064 100644 --- a/src/ipa/ipu3/algorithms/af.cpp +++ b/src/ipa/ipu3/algorithms/af.cpp @@ -403,6 +403,16 @@ bool Af::afIsOutOfFocus(IPAContext context) return false; } +void Af::pause(IPAContext &context) +{ + context.frameContext.af.focus = focus_; +} + +bool Af::isAgcStable(IPAContext context) +{ + return context.frameContext.agc.stable; +} + /** * \brief Determine the max contrast image and lens position. * \param[in] context The IPA context. @@ -421,6 +431,8 @@ bool Af::afIsOutOfFocus(IPAContext context) */ void Af::process(IPAContext &context, const ipu3_uapi_stats_3a *stats) { + if (!isAgcStable(context)) + pause(context); /* Evaluate the AF buffer length */ uint32_t afRawBufferLen = context.configuration.af.afGrid.width * context.configuration.af.afGrid.height; diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h index b85cf941..c1c9d39e 100644 --- a/src/ipa/ipu3/algorithms/af.h +++ b/src/ipa/ipu3/algorithms/af.h @@ -44,6 +44,8 @@ private: double afEstimateVariance(Span y_items, bool isY1); bool afIsOutOfFocus(IPAContext context); + bool isAgcStable(IPAContext context); + void pause(IPAContext &context); /* VCM step configuration. It is the current setting of the VCM step. */ uint32_t focus_;