From patchwork Wed Jul 13 08:43:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Semkowicz X-Patchwork-Id: 16598 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 DD486BD1F1 for ; Wed, 13 Jul 2022 08:43:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2D88663311; Wed, 13 Jul 2022 10:43:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657701811; bh=nyeQb0OMkSRodgc4NHQVos60hQZ09QDf2G7iuPUx8JU=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=DNqt268/tTum1O/+nUKHxr7k+DSsV8jyy4ZstTztAJ4/4L6rxeHQ8tokpaLw/WFRB O0c8z1mVY9DVnD0xldnJ0qRUM0xsIDoZDPeM6g26HUv41IHhpc2gOmYa7Bqowvu+Um XqF2LfvMZdYc4/Rc/z075fHuRKgOymKvRlbSWPXzAMLKm/5Y3PoYrK//Qu36QwrFE+ aDqzLmCLe4Oe2gMUbtD3gwZLXqV1jbyl4061QeT9qQ4V7TijxOtL9ESVjB+4JcUro1 BeyRWsXsElbl5QEB48/zd8acFxASa9EVwuSfNcywIzL1mbn4V6CcbviWVy6DBoK/81 6pEIY6K/b671g== Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5325F6330A for ; Wed, 13 Jul 2022 10:43:29 +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="FvN1nzGt"; dkim-atps=neutral Received: by mail-wr1-x435.google.com with SMTP id q9so14474240wrd.8 for ; Wed, 13 Jul 2022 01:43:29 -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:mime-version :content-transfer-encoding; bh=tWSEyaVQ+EsK2TwsFuQikhUjVTFb4gsYi+ByaCnQVfU=; b=FvN1nzGt48+uL9joYzrBeFZRA069Aj4JblUExoQdbVv3LJnqDYEeubUCx3GcStFu8q qViwgJ5hOlrT7NQdhpBTrgrHCGiNkHVTCUA0OiE+k/c7X8e0h6MNDnXnl5MfA7kDZrnX zY43FUjxIqCMxuSqzGIysKWG2j0pWPN4cVEyk/aveJd8Wi9S62YEpfaZKMDBPIUQghJk PudwFbfB7sd1qRfTUV9areYF861SICYV6Lxs9FiXLPZbkMUjDFHd6Hbr3oSdjE2Vz4M9 VHdt700tx3BhYUs5idGI/8Mik/axXwRhJ2WpNA3MKZfJ1jfQxcWvW65oy1dpTW2datbH dfeQ== 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:mime-version :content-transfer-encoding; bh=tWSEyaVQ+EsK2TwsFuQikhUjVTFb4gsYi+ByaCnQVfU=; b=llLliuSQYVmdV/XfVWqN2vqsZNVAH7YUpKfDUBNTpcoHP8GJR1A2hDuFoPa0o71HmI sK62qREczY5fcFYDHf8IljDiQB/C/8hYcmbkc8lsdew/hyPlVXNPQVUMMlH3Dp3Hzi1/ YJh2+FiqVW2glJiYxN52+IOEEgtO0UUzOXMByJE/c0EgQC63cQXcpyEMedyxZwtYwQ16 WPnWJ+shq7HIsBYYZu+OgRSJ2/BXGhDu88fEZEQNHxM2l+wLRPankHxX2lvyg5melpGc 45gXWeC8dRUAIa0fI7ApryXIO8QGrkWKuhjgHiK9MzUjHOct/mTenrbtVrJ5nF97YzUi UzNQ== X-Gm-Message-State: AJIora8GvHVARJrKchuGR5adP32R87wciGQjbzVChvXvwTNwreZZzWG+ 4e836SjL7iRgkNCjt98XMsWiq/DHY1jK/Q== X-Google-Smtp-Source: AGRyM1uCSK6p06iqg7FgAFHsXjlbSKw1RoXi8YUOsCrQ0zSfVou50lLGmYaynqZ94avzjTyCJJqbQg== X-Received: by 2002:a5d:4c88:0:b0:21d:a699:d553 with SMTP id z8-20020a5d4c88000000b0021da699d553mr2086183wrs.344.1657701808960; Wed, 13 Jul 2022 01:43:28 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 01:43:28 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 13 Jul 2022 10:43:06 +0200 Message-Id: <20220713084317.24268-1-dse@thaumatec.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 00/11] ipa: rkisp1: Add autofocus algorithm 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" Hello, The following set of patches introduces an autofocus algorithm for rkisp1 platforms. As there are common parts of code in the IPU3, RPi and now they would be repeated in rkisp1, I tried to separate the main control part of the AF algorithm in the new AfHillClimbing class. These changes make use of the freshly introduced algorithm registration mechanism. As there was a missing part for the easy way to get the specific algorithm from the dynamically loaded list, I added getAlgorithm() method to the Module class that. It was implemented in the fastest way to get it working, but I think we should improve it later. Maybe it would be good to extend algorithm creation and store also the name of corresponding algorithm to allow calling it by name instead of type. Especially that algorithms are loaded from tuning file by name. I am not sure if the directory structure I have chosen for the common code is a good place, so please correct me if I should place it somewhere else. Doxygen documentation part should be, for sure, more detailed, but I firstly want to wait for your comments about the code, just in case if there were any changes to the design. These changes depend on the "libcamera: rkisp1: Add lens control" changes that are still in the review process. Link: https://patchwork.libcamera.org/project/libcamera/list/?series=3228 Changes in v2: - Skip frames in some situations to ensure correct AF calculation (Add patches: 9-11) I am waiting for your comments :) Best regards Daniel Semkowicz Daniel Semkowicz (11): ipa: Add base class defining AF algorithm interface ipa: Add class that implements base AF control algorithm ipa: rkisp1: Add AF algorithm basing on common AfHillClimbing class pipeline: rkisp1: Add basic AF controls to the supported controls list ipa: module: Add getAlgorithm() method ipa: rkisp1: Pass requests setting AF controls to the AF algorithm ipa: rkisp1: Add OV5675 tuning file ipa: rkisp1: Add "Windows" Metering mode to auto focus algorithm ipa: af_hill_climb: Skip the first frame after triggering auto focus ipa: rkisp1: af: Skip few frames after changing lens position ipa: rkisp1: af: Skip one frame after changing the AF window src/ipa/libipa/algorithms/af_algorithm.cpp | 78 +++++ src/ipa/libipa/algorithms/af_algorithm.h | 41 +++ .../libipa/algorithms/af_hill_climbing.cpp | 97 +++++++ src/ipa/libipa/algorithms/af_hill_climbing.h | 272 ++++++++++++++++++ src/ipa/libipa/algorithms/meson.build | 11 + src/ipa/libipa/meson.build | 6 + src/ipa/libipa/module.cpp | 7 + src/ipa/libipa/module.h | 17 ++ src/ipa/rkisp1/algorithms/af.cpp | 136 +++++++++ src/ipa/rkisp1/algorithms/af.h | 44 +++ src/ipa/rkisp1/algorithms/meson.build | 1 + src/ipa/rkisp1/data/meson.build | 1 + src/ipa/rkisp1/data/ov5675.yaml | 12 + src/ipa/rkisp1/rkisp1.cpp | 72 ++++- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +- 15 files changed, 801 insertions(+), 6 deletions(-) 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/af_hill_climbing.cpp create mode 100644 src/ipa/libipa/algorithms/af_hill_climbing.h create mode 100644 src/ipa/libipa/algorithms/meson.build create mode 100644 src/ipa/rkisp1/algorithms/af.cpp create mode 100644 src/ipa/rkisp1/algorithms/af.h create mode 100644 src/ipa/rkisp1/data/ov5675.yaml