Patch Detail
Show a patch.
GET /api/1.1/patches/23613/?format=api
{ "id": 23613, "url": "https://patchwork.libcamera.org/api/1.1/patches/23613/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23613/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20250620124452.557855-6-naush@raspberrypi.com>", "date": "2025-06-20T12:42:26", "name": "[v1,5/8] ipa: rpi: controller: AutoFocus tweak earlyTerminationByPhase()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "407f3eed1deec6f7a1679b3ca5549170dd217df2", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23613/mbox/", "series": [ { "id": 5235, "url": "https://patchwork.libcamera.org/api/1.1/series/5235/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5235", "date": "2025-06-20T12:42:21", "name": "Raspberry Pi: AF improvements", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5235/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23613/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23613/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 30CBCBDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 20 Jun 2025 12:45:15 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 378E268DF5;\n\tFri, 20 Jun 2025 14:45:10 +0200 (CEST)", "from mail-wr1-x430.google.com (mail-wr1-x430.google.com\n\t[IPv6:2a00:1450:4864:20::430])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DD1D468DC6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Jun 2025 14:45:00 +0200 (CEST)", "by mail-wr1-x430.google.com with SMTP id\n\tffacd0b85a97d-3a4e57d018cso300746f8f.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Jun 2025 05:45:00 -0700 (PDT)", "from NAUSH-P-DELL.pitowers.org ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-45361461375sm41561525e9.14.2025.06.20.05.44.59\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 20 Jun 2025 05:44:59 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"HPdXYfRo\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1750423500; x=1751028300;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=24KjDT2YWBwBNbd3x7CDgdf7GATAgEkVdmI8IyKPmTk=;\n\tb=HPdXYfRo2ks970/Fft3QaFiIH73SI5e46U2u6ZTWGQ4d+O5APdXdSpTNDVYtLiP2sK\n\tXiMbyxEHxEGn0EWb4ntC48Rm7nnMoys0mfog1RMSIEygaYKOWCNJqXlIYBcQMjzCq50p\n\tFj8blBwpI0uGMIH6aYAOKOoMFMKEmcC0uoygYJBePrBaCrobmXy27MqB0F2nFhnqagEn\n\tjccWoQoqyQWUpf2rY2uycuGZxGt+SWAEKT8BZ5zKy+fRY4NEuAcpAIhMqwVBFAynknmY\n\tEn0ARGU6w18WD2s7k+YwKHFkOBXhAJ9kwxVJbTxGWrHGDwbap9Xw8LprYt7ALqpbxGLb\n\tDgEg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1750423500; x=1751028300;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=24KjDT2YWBwBNbd3x7CDgdf7GATAgEkVdmI8IyKPmTk=;\n\tb=uk81i1IjqmJuAQm/lsitdWNZdiOoiYqAVvnvaO3xsBwMB4uQznV0nQg5zOUfwvtHdk\n\tiMMtYdJSx5ESHoNcjkcsnzSxujzGQ+LXy5uTOaZy+NGozvKrA+y5UsYexCHSjwyPeNoC\n\tQjiyZ2K3QzbfWmbmx5iUFd00O7CSznF9tbNBbjKRFipJoDR0atMP1xdCKm9M5mXipLmo\n\t1Mi3H7LvgY7cRVC6px65NoLDxgZrMmH86Q23BpjiTa8fLpSnBLhEtvrL1Dr5KbTQHpSH\n\tZXdiJ4AM2yxUftwX1fR52g6QWcvB2S+lubxZ3TGGvLapVnmrZVRD4Jt3JZJZHND3aUlX\n\tvE7A==", "X-Gm-Message-State": "AOJu0YzPSGv9SOuPlwoWuufKWqXsvqtRluM+unNV/l/iWHwMT48IZOnb\n\tu89gLANeFbnouLuzKNIc/u2SBvsDRvBT9LSHmRJsSnvLKUs23UxVRuvk7hV4eJO49XafcHi2FFT\n\tegDYi", "X-Gm-Gg": "ASbGncuymL5oLAxDzZHRZP+UMp7jIrA61egGp+8EcJVBxFL8mdYXGXU1XQ11dFBSwdp\n\tYJGa9ZXPLYM9sLd4qS6nx/bhcjCKDvWi1o4xFshdJIIDwSuCkTo0ONYjux6AHKyF1ZXGOeTaOln\n\twOpogYY1k/x4weKiZlq/6n5+cbj7SbnMgXG9/pYRF9W8q7XF0CNurmtpoDI4fmkFcTElsHwxjDd\n\tB7sBMRXP7NhHyBWjJzEGfSNngDCU3TqOSJuVCaJuy9Syp5ZmMCuJnS4dQEyVM0Qk5HvlphzxDXd\n\tMW3MjMIEqErv2GUajRF1j1rTUbWhecm7TBPVSQP/23AA4mVyB94zSE6qdmVieM8F7dkGpeQL1s6\n\tfSt8+Qw==", "X-Google-Smtp-Source": "AGHT+IHBgECgTN4VV0Cclz5AavamnOvPTx3PmVkiyqVoabLjkewYkt8veSsk0wosL4yQYHTE5lZfVQ==", "X-Received": "by 2002:a05:6000:2211:b0:3a5:7875:576 with SMTP id\n\tffacd0b85a97d-3a6d12d737bmr901101f8f.1.1750423500172; \n\tFri, 20 Jun 2025 05:45:00 -0700 (PDT)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>,\n\tNaushir Patuck <naush@raspberrypi.com>", "Subject": "[PATCH v1 5/8] ipa: rpi: controller: AutoFocus tweak\n\tearlyTerminationByPhase()", "Date": "Fri, 20 Jun 2025 13:42:26 +0100", "Message-ID": "<20250620124452.557855-6-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20250620124452.557855-1-naush@raspberrypi.com>", "References": "<20250620124452.557855-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>\n\nIncrease threshold for ETBP, from \"confEpsilon\" to \"confThresh\".\nCorrect sign test to take account of pdafGain sign (typically -ve).\nReduce allowed extrapolation range, but relax the check in the\ncase of Continuous AF, when we go back into the PDAF closed loop.\n\nSigned-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/rpi/controller/rpi/af.cpp | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)", "diff": "diff --git a/src/ipa/rpi/controller/rpi/af.cpp b/src/ipa/rpi/controller/rpi/af.cpp\nindex 3b2d6167df61..ecc0fc4175a7 100644\n--- a/src/ipa/rpi/controller/rpi/af.cpp\n+++ b/src/ipa/rpi/controller/rpi/af.cpp\n@@ -411,7 +411,7 @@ void Af::doPDAF(double phase, double conf)\n bool Af::earlyTerminationByPhase(double phase)\n {\n \tif (scanData_.size() > 0 &&\n-\t scanData_[scanData_.size() - 1].conf >= cfg_.confEpsilon) {\n+\t scanData_[scanData_.size() - 1].conf >= cfg_.confThresh) {\n \t\tdouble oldFocus = scanData_[scanData_.size() - 1].focus;\n \t\tdouble oldPhase = scanData_[scanData_.size() - 1].phase;\n \n@@ -420,11 +420,12 @@ bool Af::earlyTerminationByPhase(double phase)\n \t\t * Interpolate/extrapolate the lens position for zero phase.\n \t\t * Check that the extrapolation is well-conditioned.\n \t\t */\n-\t\tif ((ftarget_ - oldFocus) * (phase - oldPhase) > 0.0) {\n+\t\tif ((ftarget_ - oldFocus) * (phase - oldPhase) * cfg_.speeds[speed_].pdafGain < 0.0) {\n \t\t\tdouble param = phase / (phase - oldPhase);\n-\t\t\tif (-3.0 <= param && param <= 3.5) {\n-\t\t\t\tftarget_ += param * (oldFocus - ftarget_);\n+\t\t\tif ((-2.5 <= param || mode_ == AfModeContinuous) && param <= 3.0) {\n \t\t\t\tLOG(RPiAf, Debug) << \"ETBP: param=\" << param;\n+\t\t\t\tparam = std::max(param, -2.5);\n+\t\t\t\tftarget_ += param * (oldFocus - ftarget_);\n \t\t\t\treturn true;\n \t\t\t}\n \t\t}\n@@ -562,7 +563,7 @@ void Af::doAF(double contrast, double phase, double conf)\n \t\t\telse\n \t\t\t\tscanState_ = ScanState::Idle;\n \t\t\tscanData_.clear();\n-\t\t} else if (conf >= cfg_.confEpsilon && earlyTerminationByPhase(phase)) {\n+\t\t} else if (conf >= cfg_.confThresh && earlyTerminationByPhase(phase)) {\n \t\t\tscanState_ = ScanState::Settle;\n \t\t\tstepCount_ = (mode_ == AfModeContinuous) ? 0\n \t\t\t\t\t\t\t\t : cfg_.speeds[speed_].stepFrames;\n", "prefixes": [ "v1", "5/8" ] }