From patchwork Wed Jul 13 08:43:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Semkowicz X-Patchwork-Id: 16599 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 1EAACBD1F1 for ; Wed, 13 Jul 2022 08:43:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C007D63316; Wed, 13 Jul 2022 10:43:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657701814; bh=Z6UIHygHBeusnTkcZzxnyW6sRJdbI//0YB+aVUn9bIc=; 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=XzSkzyvpLBj7ojBmwo1vnRmzY+PIgOqA+PcnVyo7HYBeajv0fIg3qxb6nmtmvKW4u 4cmTW70chUiRzw1LvdV4OPRQUDa3R2/zrWgeTNGh5gmJ7ZVN13zx9On4R0n5ylDPX1 1FC1s34P0bApo1WifW08vI7KbOvQJJNQL/rmRFQ9+fOqkGv/gWNbFxTUKZ/sFHccLT yUENodR/EPlHMNpQMu014zZr0DnRa1h4ddV09dWhr2FF5FnPPU73Njl0osNCCj+psy vnu+NF4M4LOPXSVP0fIt22he+5YMJI/LEdC11oMFPfGTeVSvNfscziAndJ8y3C//Np Yodm1yr7RoJLw== Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A85E26330F for ; Wed, 13 Jul 2022 10:43:31 +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="Io0YScVo"; dkim-atps=neutral Received: by mail-wr1-x429.google.com with SMTP id r10so8317737wrv.4 for ; Wed, 13 Jul 2022 01:43:31 -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=rBAG5bRUFgIM+iLZJ9vSxX+TnEQEJKU6Yr47fYtwcvc=; b=Io0YScVotfbPuNL7+h3sy4cBhkEouAHEp6ObhC5H70jmxb48yY7baebtf6Z7srKx1A uKy3Y4OaneLBDro1gcih14FtfAcI998ogqWzp4c3sbyO/aV3EoWy+1Wtsjxhwf9ddXgC KM7ebJMoQwuYHVAIaWgmak7Vyr3PqeK/crxywFcSbhZiObIDUJ+udxLjez9loU8f/UY2 9YZN4SX4ADOud/JPesB/zNLgnIhMv962LV/Y7a8Y6qUqY7Uc7CmlbECbpsIqH9g07iTz 4XD7N2112VJS28GfgFQt9cCYpftrd0ofAJiECqrMHc8PnTU6zhXxnCJ7thY7mqxydddd aDFw== 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=rBAG5bRUFgIM+iLZJ9vSxX+TnEQEJKU6Yr47fYtwcvc=; b=Qr2hDNimUlLELg/ZHE0egYmj8PACswloIJHSXDSEUbC3KoSGNZh21LQ5MZ0jUP89N0 Eu5Fln/EpuMQh5bHnn8rnqNJ5xZkIEu97/Qb1JLHFAqu85ArLwLX1KrGaNXC/1eufas2 P6ZqKSxUx/ORrLwk226yDKsSnfW1bczm7vl7LUsid3/fHCTb5oJH2+atcl7GunnaWUsA j04Gaknvp7XbOBatyWoz4deEoYFDJjRVGVx3EwIMS//OL0DwLrNZBocpYqL9Ww48vQtZ oHJFr+yxE0+v/5cz+Gh0jTwKHiuEqJcWkMEAHnm9xefpKLmq71mQfQSNkNCWKTKbfDqc o6EQ== X-Gm-Message-State: AJIora86FYSwjEuQ1eB4gzU2U8igIDx5yo3UsDhGlitLSnNNCsTQnj1D S9gMJtCcSZg+4RqkZf0KvrDKywrOHaS9gg== X-Google-Smtp-Source: AGRyM1uZ7KAb+4IFsd1hKhYMEpE6/EWY9RwObZ/KihdSWM8XA2A/w56fHVb4OQ7CU8vjZys2LXveKw== X-Received: by 2002:adf:f9ce:0:b0:21d:68b7:e7af with SMTP id w14-20020adff9ce000000b0021d68b7e7afmr2065190wrr.236.1657701811409; Wed, 13 Jul 2022 01:43:31 -0700 (PDT) Received: from localhost.localdomain (ip092042140082.rev.nessus.at. [92.42.140.82]) by smtp.gmail.com with ESMTPSA id bg32-20020a05600c3ca000b003a04d19dab3sm5667468wmb.3.2022.07.13.01.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 01:43:30 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 13 Jul 2022 10:43:07 +0200 Message-Id: <20220713084317.24268-2-dse@thaumatec.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220713084317.24268-1-dse@thaumatec.com> References: <20220713084317.24268-1-dse@thaumatec.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 01/11] 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 | 78 ++++++++++++++++++++++ src/ipa/libipa/algorithms/af_algorithm.h | 41 ++++++++++++ src/ipa/libipa/algorithms/meson.build | 9 +++ src/ipa/libipa/meson.build | 6 ++ 4 files changed, 134 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..47e54d5a --- /dev/null +++ b/src/ipa/libipa/algorithms/af_algorithm.cpp @@ -0,0 +1,78 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) 2022, Raspberry Pi (Trading) Limited + * Copyright (C) 2022, Theobroma Systems + * + * af_algorithm.cpp - Autofocus control 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..2862042b --- /dev/null +++ b/src/ipa/libipa/algorithms/af_algorithm.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) 2022, Raspberry Pi (Trading) Limited + * Copyright (C) 2022, Theobroma Systems + * + * af_algorithm.h - Autofocus control 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],