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_;