From patchwork Fri Mar 31 08:19:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Semkowicz X-Patchwork-Id: 18508 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 ABF5BC329C for ; Fri, 31 Mar 2023 08:19:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 010A662756; Fri, 31 Mar 2023 10:19:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1680250793; bh=qu3WqscAGEA8x3Eue5ZsJHxdhKOiF3mX4z9hhAtIJcE=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=23qrss6IB7pPEmwcBKdyb1ISYHKPZAqjAIIe3pDo52R5Ejf41UbABjLGbIdxCpbfq f9FFJ60W+wrHul2mw/RNS7i36IPgE31JDhjoDZOuoH815upvW273HB4+voowHf3Kf7 tWgeaIDgLzFuwMSszzrWKUJ1lvZcdeLQhPzU8ObTFUcIHUEm0YPnQH80+dU7J9+LvE 6lRAXcJPVIOHLcdcjce30okOBgKAsBOsGvJDidZf1W5TQKczQzWOpdQwNFJa9jQagT VAV6YvwMxHJQHf9b8ufeDyJFTZbb/RiWu79W1Jbp+Tm/pmmniRDFTMhJ72HqHa8sLg 5rwiFZTvy94zg== Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 043CE61ECB for ; Fri, 31 Mar 2023 10:19:48 +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="2NR3qQyq"; dkim-atps=neutral Received: by mail-lf1-x12f.google.com with SMTP id g19so14771055lfr.9 for ; Fri, 31 Mar 2023 01:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thaumatec-com.20210112.gappssmtp.com; s=20210112; t=1680250787; x=1682842787; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=5gQdqnNIe5J7HwQ8RinSnUJvXkshjJSln7wU6DfWjWc=; b=2NR3qQyqYdOsKx6lkKsDlRBAMatAE89BvZ4I1OMuTsFePJ5xo0GQj31ftizzUgSHzJ fIrl+zIt5PZktOW2HU305jMyVvFrQC9Cgqvl4eLbYGtzMRgY4iQu6p7XYApJpyU7riBT j97JnUBghroYr/eKMnpXGISR6R421DWd89gI5yy+7tnsm1t5oc0Lt4e1HmK311iKz+NE VRp3k9kHuJyA/szPRuwUJaDJ3WjoRA9XX56x8hUuzuxok7ZQ7YGlGyIzlIJb9eZnaTRe dY4zaLacoEf/DtATz9/BwTg38oO2kMKeGKxCsipnSP/mpsCImEngRkOEqh4zxFD49+9x 8c9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680250787; x=1682842787; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5gQdqnNIe5J7HwQ8RinSnUJvXkshjJSln7wU6DfWjWc=; b=uZhzFnCTPtk7OCbQVRnYgz0P7LSuU2iVTOa6SB+D7H7hs+eIczWC7t8snH0KlfaThk H7Fdeex7zi8sbtIwRWpO5b5EZOilkPbR/aWyyAYpzyUdCnBOV9zKKiLQtnmRhQ5qN05m IWELCQkdatcrrcHL3vVdiPz94D2IfyM5KX5o0nm6rLJFT/WU5q0CHj11SMkSDqNbNCmg khH6rrY8/RtdM6MEFogKaTYp7lOuh2d269jWReAmapAlOe2w4t7b3LhBy3dEzNwR63RF zilwmZgZIlym71Vbfj+ItX+PPmmU4MPK7uppLeFn2VOT5b65swN95uBuAUKi96vqCJ9z bEbg== X-Gm-Message-State: AAQBX9eCpGouV0dzvdkfUeUt1xh+yvzW9BBb5ySKYUOjWq7Fllg1GzPB 6DyGi5bDiy4uu5Cf1jidv3r7u/qqqto7cJ58zGJCxA== X-Google-Smtp-Source: AKy350ZJz8fBye4B/CAMiwoRTKhXgvjGLYL1skoSxUuFWs8mcBbTPvH5pwuSi/Hr5hcZ8QfCQtv2nA== X-Received: by 2002:a05:6512:6f:b0:4dd:9f4d:7459 with SMTP id i15-20020a056512006f00b004dd9f4d7459mr8167061lfo.67.1680250787108; Fri, 31 Mar 2023 01:19:47 -0700 (PDT) Received: from localhost.localdomain ([91.90.166.178]) by smtp.gmail.com with ESMTPSA id t1-20020ac24c01000000b004e84a8c3d86sm281459lfq.42.2023.03.31.01.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 01:19:46 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 31 Mar 2023 10:19:20 +0200 Message-Id: <20230331081930.19289-1-dse@thaumatec.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 00/10] 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" This is the updated version of the common contrast based Auto Focus algorithm implementation and it's usage for RkISP1 AF implementation. Main changes in v6: - Pass lens controls to IPA in init() instead of configure() - Make IPASessionConfiguration::lens optional and set the values only if lens was detected - Add AF controls in IPARkISP1::updateControls() only if lens was detected - Replace __FUNCTION__ with inline text - Change if..else to switch() in requested places - Remove final specifiers from AfHillClimbing functions - Rename AfHillClimbing::setFramesToSkip() to skipFrames() Best regards Daniel Semkowicz Daniel Semkowicz (10): rkisp1: Add camera lens to PH and expose it to the IPA ipa: rkisp1: Add lens limits to the session config ipa: Add base class defining AF algorithm interface ipa: Add common contrast based AF implementation ipa: af_hill_climbing: Add "Windows" metering mode ipa: rkisp1: Add AF algorithm based on AfHillClimbing ipa: rkisp1: af: Add "Windows" Metering mode ipa: rkisp1: Add AF controls to the RkISP1 IPA rkisp1: Control camera lens position from IPA ipa: rkisp1: Add OV5675 tuning file include/libcamera/ipa/rkisp1.mojom | 4 +- src/ipa/libipa/algorithms/af.cpp | 159 +++++++ src/ipa/libipa/algorithms/af.h | 46 ++ .../libipa/algorithms/af_hill_climbing.cpp | 424 ++++++++++++++++++ src/ipa/libipa/algorithms/af_hill_climbing.h | 101 +++++ src/ipa/libipa/algorithms/meson.build | 11 + src/ipa/libipa/meson.build | 6 + src/ipa/rkisp1/algorithms/af.cpp | 183 ++++++++ src/ipa/rkisp1/algorithms/af.h | 54 +++ src/ipa/rkisp1/algorithms/meson.build | 1 + src/ipa/rkisp1/data/meson.build | 1 + src/ipa/rkisp1/data/ov5675.yaml | 18 + src/ipa/rkisp1/ipa_context.cpp | 30 ++ src/ipa/rkisp1/ipa_context.h | 14 + src/ipa/rkisp1/rkisp1.cpp | 58 +++ src/libcamera/pipeline/rkisp1/rkisp1.cpp | 22 +- 16 files changed, 1130 insertions(+), 2 deletions(-) create mode 100644 src/ipa/libipa/algorithms/af.cpp create mode 100644 src/ipa/libipa/algorithms/af.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