From patchwork Thu Jun 30 14:35:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Semkowicz X-Patchwork-Id: 16483 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 49A43BE173 for ; Thu, 30 Jun 2022 14:35:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F3D1B65633; Thu, 30 Jun 2022 16:35:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656599755; bh=6vuxPUsFppSJnT7Dl58T841m9nlsFUiJheooK2pk4Jo=; 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=WCk6GGjBRb9A5e2J1m5PP6WnfmJZBolYvwJLVBkIcB4MJ+B2CXDiotcCpttVyrgwG NSdHa7Oybu+dgfQR2y2CT6ZiJ/p9YkaKbUzrnM6U3jow8FsMQgLAA/gQQlHoYRNdLV 7yrqfwYwWhj8squzk5FLgkMeQAmix+bl5V5GoJwqNl6yUMckwV6liYHUZrxEpOM8Z8 0YxE7d6Yye41nOB+Yepew2DaMenUd5Ts+ub3gSVeLsyXZfO3Ix2VROEGMDfhfSbQ0V b11YJGxpmbOtDJ4OaQfy3+pqImsRzZAWeQGMx6uip0GoNJMY0KiRh2QUCa71cEFSxy UBSXJdgSxSehA== Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EC16565633 for ; Thu, 30 Jun 2022 16:35:51 +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="xTVj8s70"; dkim-atps=neutral Received: by mail-wr1-x42f.google.com with SMTP id v14so27588240wra.5 for ; Thu, 30 Jun 2022 07:35:51 -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=s9hXRdoqeXHWPH716obtEfzwRxtV5yA4ljxL4a2zDs0=; b=xTVj8s70Sc8u4qsU0D5et4tq5eCLPNLFEx+M+k9lasnM3G11vCTeWPK4XXlBqtxBLC aN8O//fN8CXmgyRbe9QoOpKiwPNxDvnnTan/fBG/h1uSJdc52YwVnrp7ycfeFZkplf8S pycX7OVEKcBuM5fzT4UMsSnYvDoXbGU1W/p8Ns74PGCoOkDcHPq6K1tBVtYbJi1RNjIH ZPEBbzOEnTZbmH19g/mxdKqghZBk0L2hozFz90LpuQNUkyM/wtbbgl71zbBMnG1TnR3D 5Dp3OZzoEvdXeD6I33egiy+Sj7AJfT46uscOB3r23Jf0+bt4fvyYxgWeM0Yg1Vn7X/AK MDXA== 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=s9hXRdoqeXHWPH716obtEfzwRxtV5yA4ljxL4a2zDs0=; b=F4b6MKZTQ96XMvD0y5qqoSrB6kjEICCFgTVA+c+8iFw8xWo4U/AgvA9z46LWdnmRCj +bM19eXd83T11DRdOT+OchXD9iNRUl1x1N6KX8EuNcSycsVVxC2WsDBlC2JtHFUPhWVJ NFsHd3os/RWBvvAE3Akm2ekBwW3B7kEK/yc/AfCxCvoDaELcBjreM6vRXzO8Q9/OVMTo BA1OMDZDXuMas2Ys1B2Me+yhk27Lxpep0ujsAKN7o1L1epJ6U2gSsbEVPTQI/3rSfADn JWDeqs0UpF/gDbyetsxQMVi/nwZZkV06hpSM3kR64QKlTtDkuPrSyO0DFyYV46zrG4U6 Lltg== X-Gm-Message-State: AJIora/6hlHFpQ3N/F+W42eRx6LDD1HHyrbBuLfGd34AabCzKaXHrWcN Q/AFlxOG6+0Zfo2r3fQlb6lmw2LWNb+OgQ== X-Google-Smtp-Source: AGRyM1tZIkgZYXu3aDCo43nuaE7SfxWcl+f/yPE+i95qaCKlTXokDkEpdGb4KsGV8kTQvMotbXEUKA== X-Received: by 2002:adf:f34c:0:b0:21b:9938:b7d0 with SMTP id e12-20020adff34c000000b0021b9938b7d0mr8636965wrp.215.1656599751654; Thu, 30 Jun 2022 07:35:51 -0700 (PDT) Received: from localhost.localdomain (ip092042140082.rev.nessus.at. [92.42.140.82]) by smtp.gmail.com with ESMTPSA id r5-20020a05600c320500b0039db500714fsm6405945wmp.6.2022.06.30.07.35.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 07:35:50 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 30 Jun 2022 16:35:36 +0200 Message-Id: <20220630143543.39599-2-dse@thaumatec.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220630143543.39599-1-dse@thaumatec.com> References: <20220630143543.39599-1-dse@thaumatec.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/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_algorithm.cpp | 77 ++++++++++++++++++++++ src/ipa/libipa/algorithms/af_algorithm.h | 39 +++++++++++ src/ipa/libipa/algorithms/meson.build | 9 +++ src/ipa/libipa/meson.build | 6 ++ 4 files changed, 131 insertions(+) create mode 100644 src/ipa/libipa/algorithms/af_algorithm.cpp create mode 100644 src/ipa/libipa/algorithms/af_algorithm.h create mode 100644 src/ipa/libipa/algorithms/meson.build diff --git a/src/ipa/libipa/algorithms/af_algorithm.cpp b/src/ipa/libipa/algorithms/af_algorithm.cpp new file mode 100644 index 00000000..1c4d981a --- /dev/null +++ b/src/ipa/libipa/algorithms/af_algorithm.cpp @@ -0,0 +1,77 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) 2022, Theobroma Systems + * + * af_algorithm.cpp - autofocus algorithm interface + */ + +#include "af_algorithm.h" + +/** + * \file af_algorithm.h + * \brief AF algorithm common interface + */ + +namespace libcamera::ipa::common::algorithms { + +/** + * \class AfAlgorithm + * \brief Common interface for auto-focus algorithms + * \tparam Module The IPA module type for this class of algorithms + * + * The AfAlgorithm class defines a standard interface for IPA auto focus + * algorithms. + */ + +/** + * \fn AfAlgorithm::setMode() + * \brief Set auto focus mode + * \param[in] mode AF mode + */ + +/** + * \fn AfAlgorithm::setRange() + * \brief set the range of focus distances that is scanned + * \param[in] range AF range + */ + +/** + * \fn AfAlgorithm::setSpeed() + * \brief Set how fast algorithm should move the lens + * \param[in] speed Lens move speed + */ + +/** + * \fn AfAlgorithm::setMetering() + * \brief Set AF metering mode + * \param[in] metering AF metering mode + */ + +/** + * \fn AfAlgorithm::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 AfAlgorithm::setTrigger() + * \brief Starts or cancels the autofocus scan + * \param[in] trigger Trigger mode + */ + +/** + * \fn AfAlgorithm::setPause() + * \brief Pause the autofocus while in AfModeContinuous mode. + * \param[in] pause Pause mode + */ + +/** + * \fn AfAlgorithm::setLensPosition() + * \brief Set the lens position while in AfModeManual + * \param[in] lensPosition Lens position + */ + +} /* namespace libcamera::ipa::common::algorithms */ diff --git a/src/ipa/libipa/algorithms/af_algorithm.h b/src/ipa/libipa/algorithms/af_algorithm.h new file mode 100644 index 00000000..89db591b --- /dev/null +++ b/src/ipa/libipa/algorithms/af_algorithm.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) 2022, Theobroma Systems + * + * af_algorithm.h - autofocus algorithm interface + */ +#pragma once + +#include + +#include "../algorithm.h" + +namespace libcamera::ipa::common::algorithms { + +template +class AfAlgorithm : public Algorithm +{ +public: + AfAlgorithm() = default; + virtual ~AfAlgorithm() {} + + virtual void setMode(controls::AfModeEnum mode) = 0; + + virtual void setRange(controls::AfRangeEnum range) = 0; + + virtual void setSpeed(controls::AfSpeedEnum speed) = 0; + + virtual void setMetering(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; +}; + +} /* 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..ab8da13a --- /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_algorithm.h', +]) + +common_ipa_algorithms_sources = files([ + 'af_algorithm.cpp', +]) diff --git a/src/ipa/libipa/meson.build b/src/ipa/libipa/meson.build index fb894bc6..1fc3fd56 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', @@ -7,6 +9,8 @@ libipa_headers = files([ 'module.h', ]) +libipa_headers += common_ipa_algorithms_headers + libipa_sources = files([ 'algorithm.cpp', 'camera_sensor_helper.cpp', @@ -14,6 +18,8 @@ libipa_sources = files([ 'module.cpp', ]) +libipa_sources += common_ipa_algorithms_sources + libipa_includes = include_directories('..') libipa = static_library('ipa', [libipa_sources, libipa_headers],