From patchwork Thu Jan 19 08:41:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Semkowicz X-Patchwork-Id: 18142 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 E0EB8C3240 for ; Thu, 19 Jan 2023 08:42:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 89974625F5; Thu, 19 Jan 2023 09:42:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674117733; bh=y3vF8V8I3AUjjNn+AFv2YT48BWnRplFjpI7zOyj/uWw=; 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=VlcMB4RW5/lTxsHyKtIsV28EwkUuAuilwVR/iKPX9iTNrMiVhjLGeenWay5Hf3R71 WF6VccxNEmbJyhS6rha+Qc4Q3f9ll3a76DQeTvV1PGxEmSBYCsL7Rf7r1NDPWV8Ogr CJPoN7S9pCz02lD8dZZzuvWSlxTYDgQvipfFrp0h+C/GR61v5px8h95xe1MB2lvCcD 31X8KQKTcE9JQqVQkUKRvMNlGrWEE5nOWbxCPwZHomBPZu/hmH04mjZN4+ks5R8l6f 5e/46p0/OiFYJ21CHJ5g8J75tTOOWoN0zJ9fjwiSyUYiXBM3nCUYesFd3EibQTgLAL hxSSlulLstpLA== Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3FF70625D8 for ; Thu, 19 Jan 2023 09:42:10 +0100 (CET) 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="BltcjWGN"; dkim-atps=neutral Received: by mail-wm1-x335.google.com with SMTP id m15so900450wms.4 for ; Thu, 19 Jan 2023 00:42:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thaumatec-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Xm49jR5et7fNPrzF0NIG3A+f0aOzkc1oiwUtbL9VUBg=; b=BltcjWGNEKiKttvTJwsFXyVAh7Kt2ucu4MFXdB4+BGD1RYw9gZRrCXYsjx0ld0Dl5K j1TlKVMBfjOxI/LhR/1ickVLvTAGIo2jUXddVchHVfWveYOV3r5T4SOd9CluM2n+lfub Zt2v2gzhZZTMyMxxnzmnUfAK+QAyGuQ7i28u0aqEZJMqJO5crPBRQ9CJxDk38VLO91NX pFwUk5Va/amfs1kh4yK2mbWeSZikyLgJRupgFUqwJ1h1XlU0R85oyE9ZxgLX0DAVHxYF 7HxhRW2OrsL80H9xBjl21riwg/oAdFgEOVccFibGDdTnfvQ0Cn3EhGZ/Kxf9LLae6vSt bBFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xm49jR5et7fNPrzF0NIG3A+f0aOzkc1oiwUtbL9VUBg=; b=tjb8SOJb49ew1kOSXV3OtDw0roQwtgFbSvE/T2NnebDiQrla1YmKKf1Nf43Xcj3yBY ydXr0AB0A98ax+uP1Rpkiee3MZKNjN+jnbfTBCVmh6aEfB9XhUhJkGaBFuXKJJkt5gzj NV1EtZjaoBIhscz6vg2CWvn6ltclc7uT61sDxy+9I2E90yPX/GoiQhXhMqLUY+rBgo2b 8nIyXV0sl1fg5PsOsxB85iu+1EQifwMqTsQwPF1sjJniMGUbltp7V+f1wvAcKdf624vB vv4ZalYMhx4AruVyWNGAeAPw0monN7oIAdmdiFvOm61KSeNPcssFQTO1mCQSpFIVHZl3 WasQ== X-Gm-Message-State: AFqh2krnxpmmrirTVnazFitTuC0vbj9q9fSK+HvgGaXq9173lAYWi2G5 ZH8+B9lDaUBKG5IE0SY98Xiy7oXyNcAUVUSxXoE= X-Google-Smtp-Source: AMrXdXujQzmcyAN+bIbLFMQ5hZEi0yJVcCYPC7THWY4HWEMMCMZQKwuSzG6D2QqZnIp7Sq1zzcKocg== X-Received: by 2002:a05:600c:1c2a:b0:3cf:d0b1:8aa1 with SMTP id j42-20020a05600c1c2a00b003cfd0b18aa1mr9371352wms.0.1674117729729; Thu, 19 Jan 2023 00:42:09 -0800 (PST) Received: from localhost.localdomain (ip092042140082.rev.nessus.at. [92.42.140.82]) by smtp.gmail.com with ESMTPSA id j10-20020a05600c074a00b003db0ee277b2sm3935754wmn.5.2023.01.19.00.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 00:42:09 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Thu, 19 Jan 2023 09:41:07 +0100 Message-Id: <20230119084112.20564-4-dse@thaumatec.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119084112.20564-1-dse@thaumatec.com> References: <20230119084112.20564-1-dse@thaumatec.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/8] ipa: Add base class defining AF algorithm interface 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" Define common interface with basic functions that should be supported by Auto Focus algorithms. Signed-off-by: Daniel Semkowicz --- src/ipa/libipa/algorithms/af_interface.cpp | 92 ++++++++++++++++++++++ src/ipa/libipa/algorithms/af_interface.h | 41 ++++++++++ src/ipa/libipa/algorithms/meson.build | 9 +++ src/ipa/libipa/meson.build | 6 ++ 4 files changed, 148 insertions(+) create mode 100644 src/ipa/libipa/algorithms/af_interface.cpp create mode 100644 src/ipa/libipa/algorithms/af_interface.h create mode 100644 src/ipa/libipa/algorithms/meson.build diff --git a/src/ipa/libipa/algorithms/af_interface.cpp b/src/ipa/libipa/algorithms/af_interface.cpp new file mode 100644 index 00000000..af341d13 --- /dev/null +++ b/src/ipa/libipa/algorithms/af_interface.cpp @@ -0,0 +1,92 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2022, Theobroma Systems + * + * af_interface.cpp - Autofocus control algorithm interface + */ + +#include "af_interface.h" + +/** + * \file af_interface.h + * \brief AF algorithm common interface + */ + +namespace libcamera::ipa::common::algorithms { + +/** + * \class AfInterface + * \brief Common interface for auto-focus algorithms + * \tparam Module The IPA module type for this class of algorithms + * + * The AfInterface class defines a standard interface for IPA auto focus + * algorithms. + */ + +/** + * \fn AfInterface::setMode() + * \brief Set auto focus mode + * \param[in] mode AF mode + */ + +/** + * \fn AfInterface::setRange() + * \brief set the range of focus distances that is scanned + * \param[in] range AF range + */ + +/** + * \fn AfInterface::setSpeed() + * \brief Set how fast algorithm should move the lens + * \param[in] speed Lens move speed + */ + +/** + * \fn AfInterface::setMeteringMode() + * \brief Set AF metering mode + * \param[in] metering AF metering mode + */ + +/** + * \fn AfInterface::setWindows() + * \brief Set AF windows + * \param[in] windows AF windows + * + * Sets the focus windows used by the AF algorithm when AfMetering is set + * to AfMeteringWindows. + */ + +/** + * \fn AfInterface::setTrigger() + * \brief Starts or cancels the autofocus scan + * \param[in] trigger Trigger mode + */ + +/** + * \fn AfInterface::setPause() + * \brief Pause the autofocus while in AfModeContinuous mode. + * \param[in] pause Pause mode + */ + +/** + * \fn AfInterface::setLensPosition() + * \brief Set the lens position while in AfModeManual + * \param[in] lensPosition Lens position + */ + +/** + * \fn AfInterface::getState() + * \brief Get the current state of the AF algorithm + * \return AF state + */ + +/** + * \fn AfInterface::getPauseState() + * \brief Get the current pause state of the AF algorithm. + * \return AF pause state + * + * Only applicable in continuous (AfModeContinuous) mode. In other modes, + * AfPauseStateRunning is always returned. + */ + +} /* namespace libcamera::ipa::common::algorithms */ diff --git a/src/ipa/libipa/algorithms/af_interface.h b/src/ipa/libipa/algorithms/af_interface.h new file mode 100644 index 00000000..b6b7bea6 --- /dev/null +++ b/src/ipa/libipa/algorithms/af_interface.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2022, Theobroma Systems + * + * af_interface.h - Autofocus control algorithm interface + */ +#pragma once + +#include + +namespace libcamera::ipa::common::algorithms { + +class AfInterface +{ +public: + AfInterface() = default; + + virtual ~AfInterface() {} + + virtual void setMode(controls::AfModeEnum mode) = 0; + + virtual void setRange(controls::AfRangeEnum range) = 0; + + virtual void setSpeed(controls::AfSpeedEnum speed) = 0; + + virtual void setMeteringMode(controls::AfMeteringEnum metering) = 0; + + virtual void setWindows(Span windows) = 0; + + virtual void setTrigger(controls::AfTriggerEnum trigger) = 0; + + virtual void setPause(controls::AfPauseEnum pause) = 0; + + virtual void setLensPosition(float lensPosition) = 0; + + virtual controls::AfStateEnum getState() = 0; + + virtual controls::AfPauseStateEnum getPauseState() = 0; +}; + +} /* namespace libcamera::ipa::common::algorithms */ diff --git a/src/ipa/libipa/algorithms/meson.build b/src/ipa/libipa/algorithms/meson.build new file mode 100644 index 00000000..0a1f18fa --- /dev/null +++ b/src/ipa/libipa/algorithms/meson.build @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: CC0-1.0 + +common_ipa_algorithms_headers = files([ + 'af_interface.h', +]) + +common_ipa_algorithms_sources = files([ + 'af_interface.cpp', +]) diff --git a/src/ipa/libipa/meson.build b/src/ipa/libipa/meson.build index 016b8e0e..0cfc551a 100644 --- a/src/ipa/libipa/meson.build +++ b/src/ipa/libipa/meson.build @@ -1,5 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 +subdir('algorithms') + libipa_headers = files([ 'algorithm.h', 'camera_sensor_helper.h', @@ -8,6 +10,8 @@ libipa_headers = files([ 'module.h', ]) +libipa_headers += common_ipa_algorithms_headers + libipa_sources = files([ 'algorithm.cpp', 'camera_sensor_helper.cpp', @@ -16,6 +20,8 @@ libipa_sources = files([ 'module.cpp', ]) +libipa_sources += common_ipa_algorithms_sources + libipa_includes = include_directories('..') libipa = static_library('ipa', [libipa_sources, libipa_headers],