From patchwork Fri Jun 20 12:42:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 23608 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 8405EBDE6B for ; Fri, 20 Jun 2025 12:45:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5319168DE2; Fri, 20 Jun 2025 14:44:59 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="fWKesL70"; dkim-atps=neutral Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 201BE61535 for ; Fri, 20 Jun 2025 14:44:58 +0200 (CEST) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3a577ab8c34so275214f8f.3 for ; Fri, 20 Jun 2025 05:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1750423497; x=1751028297; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zGAcD6vT+M6/L1iTEcnvkQnL4E6uY7FMIpgwC3sh99I=; b=fWKesL70uG4UE47YT/TJ1nz9VAT93a5Kyw927dU7R9GxULW49oKPSZr7zqaZsNRQBb D6qOL1xnJl/R6nZALdk/VGEceOuU1CHdO7wGwbZEkSuGNAun3O+8r3ek4qah32triwTW VtTQeF+6Bci2Y5FoDWFTN4ybcrJMyE9UnTwhgg/YSjK5yFVru1wr18T5dDjBx3nUSg4E UpJGKyweDBoV342SJwtHOc5iUS8HaA/feRhboU7Y+4vTs++/LhU0XdjqaEulAuRMWDnb V/OqLxUFAYD1t1ZM8GXb8chIWiYaIh5pMwqxQrsiGuVToLmh8wCJ9iU20sQzNSpCKVx9 H9TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750423497; x=1751028297; 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=zGAcD6vT+M6/L1iTEcnvkQnL4E6uY7FMIpgwC3sh99I=; b=n1L9GE4IPvE1Ha3OHns2k+AO9Pe8USjrO4DoggvW8oANQ4wvqmDOreSd9o0ZoRKjor xOuTr9+UXKiub+MoRubpres3YmViEz2iWurbClP/S5bvnWywn6uEhvjOYow1b1mmZr+A i2LtNsCnFAxKFlMiQ2TAhtQxOdY+Q3f2tkGdAP32W36IiUJMnpYYYtVoWwHKmSVwoYH/ iHq5hDKs/4Yfk/RLJupuH7qbi4Q8yfJcP/o+o8H1HtX6VyjnYqahcdbnRNnhKpqTc+br hmbNXfDO9rmvPLrVRix41zI8UaovM/9U0r3BgTPmPLwj62ohjzLy837l0Gh5wLdZvsMc ub+Q== X-Gm-Message-State: AOJu0YzRPDA+PH7ujUHNZth6+ka8LU7Wx6ihdnurGi7bbxH9auxqboRJ WeBKKkv9tq0s/c1859P8DY9Je+Rm/pXnx3syJo7X8CW+KawmTztfiU6aJPJUqvRTbDNMBCd9Z2T CoKK8 X-Gm-Gg: ASbGncviGF2U4oqra27s9/BVLlBrBGqEGyetXQVWs9lPgvpK4vZQUNyc6gGbWhEE1B6 l6Vdv1WwStPdN9yi8vlr7tAqEYnBrmFsdGpEOasq50uzNB10XGd8fU8nuGAuN4WkzE/e0S1VI6U uUgqWsV4uRidgBm7IlOhcLFvVWD3hbO0g2R94bQyAYnAfXSlfFN0JwfJAvm+NQheP7iH/BY7uXN tIGDtI8fJHMOiLE71GFvNEfkw+IHeCdPWTJcroCtifZ/APmNiKwHYi3cAdnA7pnpvPgy+w/LjDk UIAO+3qbisx2oebS5i1o0cOdoWPrDWEQWARlMagZQ06IHfRDkMu8gdmmRIPAE8e5sQ4NjdBv7Mn QtfkPJQ== X-Google-Smtp-Source: AGHT+IGDjk3Ly0I1epHoGwS4yOAkrTKjyt3FA2YZrh9829CN+b8xUyrpTdyZcVOVqFK1tbY5zytz+A== X-Received: by 2002:a05:6000:2010:b0:3a4:dd00:9ac3 with SMTP id ffacd0b85a97d-3a6d12e428amr799673f8f.12.1750423497246; Fri, 20 Jun 2025 05:44:57 -0700 (PDT) Received: from NAUSH-P-DELL.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45361461375sm41561525e9.14.2025.06.20.05.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jun 2025 05:44:56 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck Subject: [PATCH v1 0/8] Raspberry Pi: AF improvements Date: Fri, 20 Jun 2025 13:42:21 +0100 Message-ID: <20250620124452.557855-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi, (submitting on behalf of Nick) The following patch series improves our AF algorithm in a number of ways: 1. Treat low-confidence PDAF values more linearly, which may improve reliability and reduce wobble a little. 2. Check for IR lighting and suppress PDAF when it's detected (only when a new flag is set in the tuning file). 3. Allow CDAF-based scan to be re-triggered multiple times in Continuous AF mode (when there's no PDAF). 4. Allow subsequent scans to start from the current lens position, rather than always from 0 (infinity). 5. Skip the "fine" search altogether (when the tuning file has "step_fine": 0). 6. Read the default lens position from the tuning file, rather than hard-coding it to 1.0 in source code as now. 7. Not send the default position to the lens driver, when it would be immediately overridden by a user-specified manual setting. Thanks, Naush Nick Hollinghurst (8): ipa: rpi: Defer initialising AF LensPosition ControlInfo and value ipa: rpi: controller: Improve findPeak() function in AF algorithm ipa: rpi: controller: AutoFocus weighting tweak ipa: rpi: controller: Autofocus CAF/PDAF stability tweak ipa: rpi: controller: AutoFocus tweak earlyTerminationByPhase() ipa: rpi: controller: Autofocus to use AWB statistics; re-trigger ipa: rpi: controller: AutoFocus bidirectional scanning ipa: rpi: Update IMX708 camera tuning files for AutoFocus changes src/ipa/rpi/common/ipa_base.cpp | 53 ++-- src/ipa/rpi/controller/af_algorithm.h | 8 +- src/ipa/rpi/controller/rpi/af.cpp | 305 +++++++++++++++----- src/ipa/rpi/controller/rpi/af.h | 52 +++- src/ipa/rpi/pisp/data/imx708.json | 23 +- src/ipa/rpi/pisp/data/imx708_noir.json | 23 +- src/ipa/rpi/pisp/data/imx708_wide.json | 19 +- src/ipa/rpi/pisp/data/imx708_wide_noir.json | 19 +- src/ipa/rpi/vc4/data/imx708.json | 23 +- src/ipa/rpi/vc4/data/imx708_noir.json | 23 +- src/ipa/rpi/vc4/data/imx708_wide.json | 19 +- src/ipa/rpi/vc4/data/imx708_wide_noir.json | 19 +- 12 files changed, 442 insertions(+), 144 deletions(-)