From patchwork Tue Mar 22 02:41:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15493 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 786E4C0F1B for ; Tue, 22 Mar 2022 02:42:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 22665604D4; Tue, 22 Mar 2022 03:42:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1647916937; bh=h4BHMgiI5B28amHJMMXvmLOVOH702jWuC8HBaN6O15k=; 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=EFHPxrA9BNtk4zsdi2TcDgFq49qlWsty6aLOKoJtlKln3CopXFgqrfvDOpS5ZiKog G5uH3/4t1MXf8eiYvG56DpJCFHwziKXUwCaZvnwBvft781aHBpQJWTuV5w6PPnTtHu 08m1dofy3V8aSgayO9xn1Zyn6uCYZtRkGehgctLX8qLTTP15T1tiFmcjMJEn4ONUmp cqZ3eZ2TEquBgZxjnfmE3cC2rNpgQDY/mBAErneVOHyTBIYQvthM+7AGswCe2bvSRG pPx7h3r3hmOsq1w0gHw9aedQmxExQKmtlAucMWsa6mJpojrIs4TFk3bwvAfmPt666g BVzesuRBCrZ2Q== Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 44FE5604C7 for ; Tue, 22 Mar 2022 03:42:15 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="G9QdJ84K"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647916934; 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=qcb+NA1kw5u7J4J9utP+Unh3CF4y0UiuQDQMbDT1H4s=; b=G9QdJ84Kwhrv9b1dbDIPYoAGdUWfLQR1YbsZobo6q0uyQqVVplXMODJSb4ldXLbR9io2wK 6FAJdJgvIbiRT+7Clofb7pqLqSuoP7pHmRZMSE2LsLjI0FFJoseKs2QGeKq995rRZ+GwuS SfrXTiL5NYWZEQCxH/D/5EUWC0w6Nt0= 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-453-Pppxhb0tP-u67_TGKvh1hw-1; Mon, 21 Mar 2022 22:42:13 -0400 X-MC-Unique: Pppxhb0tP-u67_TGKvh1hw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED57A1011597 for ; Tue, 22 Mar 2022 02:42:12 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D052C26E9D; Tue, 22 Mar 2022 02:42:10 +0000 (UTC) To: libcamera devel Date: Tue, 22 Mar 2022 10:41:52 +0800 Message-Id: <20220322024155.6528-2-hpa@redhat.com> In-Reply-To: <20220322024155.6528-1-hpa@redhat.com> References: <20220322024155.6528-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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 1/4] ipa: ipu3: af: Introduce AWB and AE lock when AF scanning 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" The floating AWB and AE results significantly impact the AF performance since the focus value is determined by the image contrast. This lock is used to suspend the AWB and AE during AF scanning. Signed-off-by: Kate Hsuan --- src/ipa/ipu3/algorithms/af.cpp | 3 +++ src/ipa/ipu3/ipa_context.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp index 0170a372..40a8ddae 100644 --- a/src/ipa/ipu3/algorithms/af.cpp +++ b/src/ipa/ipu3/algorithms/af.cpp @@ -170,6 +170,9 @@ int Af::configure(IPAContext &context, const IPAConfigInfo &configInfo) grid.block_height_log2 = kAfMinGridBlockHeight; grid.height_per_slice = kAfDefaultHeightPerSlice; + /* Initial AE and AWB lock */ + context.configuration.af.requireAeAwbLock = false; + /* x_start and y start are default to BDS center */ grid.x_start = (configInfo.bdsOutputSize.width / 2) - (((grid.width << grid.block_width_log2) / 2)); diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h index 6b7a512e..8cc64c3e 100644 --- a/src/ipa/ipu3/ipa_context.h +++ b/src/ipa/ipu3/ipa_context.h @@ -27,6 +27,7 @@ struct IPASessionConfiguration { struct { ipu3_uapi_grid_config afGrid; + bool requireAeAwbLock; } af; struct { From patchwork Tue Mar 22 02:41:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15494 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 CE036C0F1B for ; Tue, 22 Mar 2022 02:42:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8114C610F8; Tue, 22 Mar 2022 03:42:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1647916941; bh=w/RQQQtXugf0ImdDioPF1chGj4quoqJ6Gi/7su00MYM=; 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=YnYSsa6B99QIkZlrtss4NQ2nasXAFWOnYB8qvzWHSPydkU/hcginFfAX8sqe4lC2e cPOMLxHsGstZGSVdLvrK5XPpX4R/HIoAp7bUuLOgOafBfNWYvV42LEk3PvyO5S0C9j qNUsdfKNHjM37ihwrvBieoiqUwr/y7Ylua/taCnrkRzG3N/8oNUIwGujQ/OrrPmKzN te3cqXGEu5SdvtRkbUrZqIH9ueHmPoYVGWQXQh0e/9v9DluC+WS4X0fkjAsV5SqDNP NZc1Z+hkE66KP+5l4ZCibS7/At3U4qr8JV+QZhJf5M5AcPUeuHfCc914YMwuAkWxT6 rtT5wvwZg9nfA== Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A717C604C7 for ; Tue, 22 Mar 2022 03:42:19 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="EeLcpo8j"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647916938; 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=QKG2HlLdbZT0ezlM0rN7QsRgKzX8kVv8TvQjHxCwuz8=; b=EeLcpo8jd8HIqB+zLZippCdvTqtqJ6oNVuZ66+qmUGdYATW3QychppORJ4V4Wtawrwdfre wdyrvaw12NlZ1AzoOQQacaeKdhyzsmgyF3uArAf3w5PlhEQNcwdE7FI+GK6r4NcLynEbhj n7cBRRabbX5Cv73b/HDdoKQUXOY3g2Q= 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-77-Qe0R7LiWNLiXgdLWm54x_g-1; Mon, 21 Mar 2022 22:42:17 -0400 X-MC-Unique: Qe0R7LiWNLiXgdLWm54x_g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 28262811E76 for ; Tue, 22 Mar 2022 02:42:17 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 329ADC23DC8; Tue, 22 Mar 2022 02:42:14 +0000 (UTC) To: libcamera devel Date: Tue, 22 Mar 2022 10:41:53 +0800 Message-Id: <20220322024155.6528-3-hpa@redhat.com> In-Reply-To: <20220322024155.6528-1-hpa@redhat.com> References: <20220322024155.6528-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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 2/4] ipa: ipu3: af: AE and AWE lock request flow when performing AF 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" When AF start to work, it requests to lock the AE and AWB to stabilize the estimated variance of the AF scene. After the algorithm determinesthe lens position, the lock will be released immediately. Signed-off-by: Kate Hsuan --- src/ipa/ipu3/algorithms/af.cpp | 22 ++++++++++++++++++++++ src/ipa/ipu3/algorithms/af.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp index 40a8ddae..7b9cfd05 100644 --- a/src/ipa/ipu3/algorithms/af.cpp +++ b/src/ipa/ipu3/algorithms/af.cpp @@ -197,6 +197,26 @@ int Af::configure(IPAContext &context, const IPAConfigInfo &configInfo) return 0; } +/** + * \brief Lock AE and AWB + * \param[in] context The shared IPA context + */ +void Af::afLockAeAwb(IPAContext &context) +{ + if (!context.frameContext.af.stable && ignoreCounter_ == 0) + context.configuration.af.requireAeAwbLock = true; +} + +/** + * \brief Unlock AE and AWB + * \param[in] context The shared IPA context + */ +void Af::afUnlockAeAwb(IPAContext &context) +{ + if (context.frameContext.af.stable) + context.configuration.af.requireAeAwbLock = false; +} + /** * \brief AF coarse scan * @@ -451,8 +471,10 @@ void Af::process(IPAContext &context, const ipu3_uapi_stats_3a *stats) currentVariance_ = afEstimateVariance(y_item, afRawBufferLen, true); if (!context.frameContext.af.stable) { + afLockAeAwb(context); afCoarseScan(context); afFineScan(context); + afUnlockAeAwb(context); } else { if (afIsOutOfFocus(context)) afReset(context); diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h index 13c7e0e8..c03a163f 100644 --- a/src/ipa/ipu3/algorithms/af.h +++ b/src/ipa/ipu3/algorithms/af.h @@ -55,6 +55,8 @@ private: double afEstimateVariance(y_table_item_t *y_item, uint32_t len, bool isY1); bool afIsOutOfFocus(IPAContext context); + void afLockAeAwb(IPAContext &context); + void afUnlockAeAwb(IPAContext &context); /* VCM step configuration. It is the current setting of the VCM step. */ uint32_t focus_; From patchwork Tue Mar 22 02:41:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15495 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 D4F0EC0F1B for ; Tue, 22 Mar 2022 02:42:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8AF4E61FBD; Tue, 22 Mar 2022 03:42:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1647916944; bh=AyorgNFcvMPZMiAqo+E01o0z4Y9E8VtL9fb1qPyhsHc=; 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=ufPcLhqysId0R1Cs1xtOclWoTEs0h3h2dQcDPz+B5zkLUOCp2g2XqoKGt4GYNZFDO 3EP1UC437VdYxokrrybC9ex6AwSLXawIrQVlI4U/rTH4kXuMkXQnn3URNPUR1UYksS kbbRe1OfifqGGPTUH2BGnuCGDluxExSZIuvMx9pMUw6aLDt3gD3q186o3Uf5A/YvS9 ljdBZoOTIin1UczxZQpIVUsgXGMAWcZiPD3JIHGsHIKD1UIeUpm25erFbEnh07jw67 ZDvU21NopuqUWTUhAj5LbS1JU02wDntJGwgcOc10+Fd4jcFth8i1dcvE49bUu+kyo7 V4Dn8ep+ZgGtA== Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5F2F2604DB for ; Tue, 22 Mar 2022 03:42:23 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="QUQ02fHc"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647916942; 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=eqQ98mKECq3Lt3koxQsSb8ZcOY2ca4TbRpxnx4YyeSI=; b=QUQ02fHcUsUivFEb3tYmGmnAIzy5FNXBJ4ImKEjfag0Dd1rZ9Ti+v8EV7RnFO9pwnNi54f me8w5LSknIP9pUXoibtZ7XvVyAODP2qlcPbWH409EsjoovrRr/BLddD6xqYcKi+jJNzoB9 Ewo3lPLuphKf9Qmw7CoATpejFHnCjOE= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-542-Dp7vfjLZMpOxMUG8qwo3UA-1; Mon, 21 Mar 2022 22:42:21 -0400 X-MC-Unique: Dp7vfjLZMpOxMUG8qwo3UA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E630B3803908 for ; Tue, 22 Mar 2022 02:42:20 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30B82C26E9D; Tue, 22 Mar 2022 02:42:18 +0000 (UTC) To: libcamera devel Date: Tue, 22 Mar 2022 10:41:54 +0800 Message-Id: <20220322024155.6528-4-hpa@redhat.com> In-Reply-To: <20220322024155.6528-1-hpa@redhat.com> References: <20220322024155.6528-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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 3/4] ipa: ipu3: awb: AWB lock for AF scan 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" When the AF starts to perform the scan, AWB will be suspended to stabilize the AF scene variance and improve the AF performance. Signed-off-by: Kate Hsuan --- src/ipa/ipu3/algorithms/awb.cpp | 13 +++++++++++++ src/ipa/ipu3/algorithms/awb.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp index 87a6cc7a..328bd38d 100644 --- a/src/ipa/ipu3/algorithms/awb.cpp +++ b/src/ipa/ipu3/algorithms/awb.cpp @@ -384,11 +384,24 @@ void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats) } } +/** + * \brief Test the AF requested lock is exist. + */ +bool Awb::isAfRequestedLock(IPAContext context) +{ + if (context.configuration.af.requireAeAwbLock) + return true; + else + return false; +} + /** * \copydoc libcamera::ipa::Algorithm::process */ void Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats) { + if (isAfRequestedLock(context)) + return; calculateWBGains(stats); /* diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h index ab4b0a33..9673592f 100644 --- a/src/ipa/ipu3/algorithms/awb.h +++ b/src/ipa/ipu3/algorithms/awb.h @@ -72,6 +72,7 @@ private: void awbGreyWorld(); uint32_t estimateCCT(double red, double green, double blue); static constexpr uint16_t threshold(float value); + bool isAfRequestedLock(IPAContext context); std::vector zones_; Accumulator awbStats_[kAwbStatsSizeX * kAwbStatsSizeY]; From patchwork Tue Mar 22 02:41:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15496 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 666B0C0F1B for ; Tue, 22 Mar 2022 02:42:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 14E84604D4; Tue, 22 Mar 2022 03:42:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1647916949; bh=AKwXqEAqL5AIaqoYdO07ZPKDFy9dBeD9BuCB7UzkghY=; 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=yu/UkJumFmQdopedHZJoeVmZ5S72I94SDLrQ+FmNvG/fk05xWdu2cmErRHRIYNlnJ s1xopHQd3JlTFhNLrlToNu+Hg+oYy0OiIFbbdpbZ2X4rINXfTN/R4VNL1eq+VezgcZ fthHqKahNJvtzfV55YSZzEHE0SgtoNM/I3sXmJmjqDgbSJUTJMxv9xO+rappqDhJUT on7Z8lALdk1ae6wUZrkK7gCobzgyRfL79T2rqVA8dG9iSBVHonvaO1grronfzQ2S7p elMAu23nQC/4nBl6CDFCEoTyL8uyG0E1FAQ9Byy0C7ySQy1Ooh7yma90RzlGOpCn+f 0WzyzCaQpo+wg== Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3B8BE604C7 for ; Tue, 22 Mar 2022 03:42:27 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="EZvUDEJ7"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647916946; 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=uHTuIVd9uI1qjYZ8rDDAXJfmO4GBGoSuLckQojWTq48=; b=EZvUDEJ73M17cT1pWdEd6IXlNynSGYtNbAr+alkH0LVKuFVYDdwH84WbtEdFKYA9qXvjUg 74bwd0qmDNgiVYRZpgYlM0tXeNpw2f8pnmXTkDiG20xGvXp8Hb302XM9cXeEUxhX8sZE1+ zyMbJWHypYhrDGWOfmNH9Aomq6TPIEQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-127-cyZcmdKFM2Gmu6mBSs5Hxg-1; Mon, 21 Mar 2022 22:42:25 -0400 X-MC-Unique: cyZcmdKFM2Gmu6mBSs5Hxg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E7D033C153A2 for ; Tue, 22 Mar 2022 02:42:24 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45CC7C26EA4; Tue, 22 Mar 2022 02:42:22 +0000 (UTC) To: libcamera devel Date: Tue, 22 Mar 2022 10:41:55 +0800 Message-Id: <20220322024155.6528-5-hpa@redhat.com> In-Reply-To: <20220322024155.6528-1-hpa@redhat.com> References: <20220322024155.6528-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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 4/4] ipa: ipu3: agc: AE lock for AF scanning 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" When the AF starts to perform the scan, AWB will be suspended to maintain the AF scene variance and improve the AF performance. Any changes in the exposure value will lead to an incorrect focus value during scanning. Signed-off-by: Kate Hsuan --- src/ipa/ipu3/algorithms/agc.cpp | 14 ++++++++++++++ src/ipa/ipu3/algorithms/agc.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp index 7d4b3503..2f28747a 100644 --- a/src/ipa/ipu3/algorithms/agc.cpp +++ b/src/ipa/ipu3/algorithms/agc.cpp @@ -314,6 +314,17 @@ double Agc::estimateLuminance(IPAFrameContext &frameContext, return ySum / (grid.height * grid.width) / 255; } +/** + * \brief Test the AF requested lock is exist. + */ +bool Agc::isAfRequestedLock(IPAContext context) +{ + if (context.configuration.af.requireAeAwbLock) + return true; + else + return false; +} + /** * \brief Process IPU3 statistics, and run AGC operations * \param[in] context The shared IPA context @@ -343,6 +354,9 @@ void Agc::process(IPAContext &context, const ipu3_uapi_stats_3a *stats) double yGain = 1.0; double yTarget = kRelativeLuminanceTarget; + if (isAfRequestedLock(context)) + return; + for (unsigned int i = 0; i < 8; i++) { double yValue = estimateLuminance(context.frameContext, context.configuration.grid.bdsGrid, diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h index ad705605..e00b28e5 100644 --- a/src/ipa/ipu3/algorithms/agc.h +++ b/src/ipa/ipu3/algorithms/agc.h @@ -40,6 +40,7 @@ private: const ipu3_uapi_grid_config &grid, const ipu3_uapi_stats_3a *stats, double gain); + bool isAfRequestedLock(IPAContext context); uint64_t frameCount_;