From patchwork Mon Feb 16 19:02:02 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 26165 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 24671C0DA4 for ; Mon, 16 Feb 2026 19:02:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D47CB62212; Mon, 16 Feb 2026 20:02:15 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.b="MmENt5Ft"; dkim=pass (2048-bit key; unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="bQrk8eSH"; dkim-atps=neutral Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 63CFC62201 for ; Mon, 16 Feb 2026 20:02:12 +0100 (CET) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61GH4XCA1545248 for ; Mon, 16 Feb 2026 19:02:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=UlDgFMps2ge rX/b1RmWRBztHRaK0o9MdqNKO/MQzYBY=; b=MmENt5FtKEzPhihm3/Z7nhmgxQL 8kqq+8/vDu3Wk8yEGW7eX07nIAgIrqHoCkr6wF2LM4qyUl3u5uuVGLLNSdb1uYSM 6pGvS3h5zrlU/tpKy5dsLcdH/XcEgUke8ex2qJ2hDs4RCwZJ0gh0nsrK+xAAnJut ghffuw6FGzM6wWi9ma6r4vYZLvfxxOhDlOx2kpyO1CDSSANrqxYKstPtFLnlz9p5 iBhxxwEcWC92s7w/pD33cCgsmvx8gSA0tvrBBMDoCsApG5G41bWe4CiBbvV5Kmng EE61bGxOgCsOM0aRQ7p7iSCxCQYxHPiBusS7viepzwEc9WsmxmOtzqk6dTg== Received: from mail-vk1-f199.google.com (mail-vk1-f199.google.com [209.85.221.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cc7ajr8nt-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 16 Feb 2026 19:02:10 +0000 (GMT) Received: by mail-vk1-f199.google.com with SMTP id 71dfb90a1353d-567503c3dbdso5295664e0c.2 for ; Mon, 16 Feb 2026 11:02:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771268529; x=1771873329; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UlDgFMps2gerX/b1RmWRBztHRaK0o9MdqNKO/MQzYBY=; b=bQrk8eSH0JFa0TTGbdKE0KDISiiqCRNxqoxNbz0wKgxvvzrGuthJ74VRtoa/jGjCYx xbAQIysD8Y+ydsR6BDFrTF4KCZ+c6UZODSfF/r6mZEoFqkRKTkcvEVZgh6Hh6abWAFAd decMIqi8AQDFYcP3a4xhnWjtNwxVrJZp1pa/oul1JIax+Q67G6PgPcHBR3FAeMRclGOT aeOeN79mcCEmCs/Bnf5/rVLLyoEs2eDEjAd6S4g5cM2CUA+tdnYv8HrDyaxx6gkrPHlG EpztY/KKc/NhHEzTLr85PtCqa8g1x3Se28wr85o1zzSloLe5WYO0TOZNl+d85fk+ul8p FURw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771268529; x=1771873329; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UlDgFMps2gerX/b1RmWRBztHRaK0o9MdqNKO/MQzYBY=; b=J48zI2tMRjsKH6L4Tuk+AkY2sNhRL9OvJTXgP4ELiTHHbCAUzkX5Lidur6iDOaD1yS vUYw0hKraLoEd6xmXxozsuMcWGFDkQC6qoe3cIlplsINnKJjjMEoZ0UvDS1WUXkeQdCY aS6rE1Juhxy7D0HiOxqA5uzPzpvmvwuSOFRFYX7wKdIBrJ8wwTaiA1NorsLwDmej4dKR v1FEAYuuSMq3kdJlcQ2lXXVYRjRhBV2/lT/ZNweoOXR0ot8IeVb+pMkAOEIrASRBZK6k ONIvM06i3Kv0bO6sjPGyVJLoAieGvmf57I/hwn9Xprl9ZWWSV4BRtYD9IBQ0cPSt6mjx ZhqA== X-Gm-Message-State: AOJu0YxgGY5g+IH1ljweYSzJM0pePmlt7LKqorFg5PW2hPlrZNcwvN5K g8z/pXjV9USGokgF+HawWE6WqOH7bCkZCOH+YkSOus4P8qaOaKqrL/ODCbL15bqiswavUloY7h1 9o1M/61vyXTDG7mUISKejHAU1XkNF72csBtc9+v+BAMF5KOt0FzQGY+yAUsjcF3his48VavH2az Q5z/5C5Chb X-Gm-Gg: AZuq6aIMA4Oy791r+IrWJHQH2KIa9vYBSlZeP629VfI8sG8GSnG0BbqkoPKSqopbctR VnylWhdv+y9RsOOEWVHgV+ZTC6XPYW6J87kokb76RyuXaO69RGIpMq2GG/T7T7maeoKmJcM2M/g QQYkzJgBvhFGtTjO8nkpIUiktEPiJAB8hDbA+SzgC93XZnzQu7tskt9wcm9FRFRSfc1ppSP5/bB 2uyeajAnXP1XDnY3jr3JS5iec0o8kr36Vk/n01fgK+7jGiTaLPSZIkg5H9x+f8Wf+JzcvmLCnGH od99fZhPptwQWwbwxHuS9ppAgxCwlaVEWizQTZIYZ2oiiOi4mPJgqs7zGYgkOIHQelWtuZnh6c3 gGOAgRzbWGAgOLTT03fLDAZpxtYp+4e5oeyxQXMvm4902ivjlfpl1BkuASHxoiRNmBVegkl6bPm og932i/ymPKg4Gji0kW3WEGdk5FnGMRgLQy507 X-Received: by 2002:a05:6122:8284:b0:55f:c318:1afa with SMTP id 71dfb90a1353d-56889b68e4fmr2774292e0c.6.1771268529138; Mon, 16 Feb 2026 11:02:09 -0800 (PST) X-Received: by 2002:a05:6122:8284:b0:55f:c318:1afa with SMTP id 71dfb90a1353d-56889b68e4fmr2774248e0c.6.1771268528624; Mon, 16 Feb 2026 11:02:08 -0800 (PST) Received: from shalem (2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:5bfa:a036:83f0:f9ec]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8fc735e587sm276698966b.2.2026.02.16.11.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Feb 2026 11:02:08 -0800 (PST) From: Hans de Goede To: libcamera-devel@lists.libcamera.org, Milan Zamazal Cc: Hans de Goede Subject: [PATCH 3/5] software_isp: debayer_cpu: Group innerloop variables together Date: Mon, 16 Feb 2026 20:02:02 +0100 Message-ID: <20260216190204.106922-4-johannes.goede@oss.qualcomm.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260216190204.106922-1-johannes.goede@oss.qualcomm.com> References: <20260216190204.106922-1-johannes.goede@oss.qualcomm.com> MIME-Version: 1.0 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjE2MDE2MyBTYWx0ZWRfX8C6/Lmys7wL0 Vu5LM/v1x79o5EwKXm2A+LqLS8772oWv39j0Db9BdF5W3vRhw8Uj8ANSXhQ5jGQjrgpnhJxBLdy CFeN/QOjrH+QI+4CSbhCpMeB93mOC3J9jPMRpZL4xDfO2XbtY1sOhE/UsQawCjPE3VlEpOZXueA YrTrhiq7O18e5vFKeTuIbvLzxG7BEuVaf/xU3aM5IaT5C+idH5s8WuLrf/nWjpkTNNAf3EYBvGa GGwio2XsYGtkPo8ov/C1lR1PYxKXiykLLBGupgc+eFGKP33lPDkiM4TAtewBncCoRDwAJdHUbdt XgNR30Gm9lcmssfGKru73MF04pCAlh828Gn0yi3c0LOQtFy8x334o73Pf4rtjBLJcSZ9BMYKzII 1ZUulAd0nBrtQpuB/Y2ahZ0NXoIMR//lrO4rJbUlZq6rWOzErppqVJq+pCsB1BHt1IJWT3Vng6D lO7MyvIl4THlF9AnFTw== X-Proofpoint-ORIG-GUID: wmZiOMpz7I56ixSz9mrl8Msn3w_uIIaf X-Authority-Analysis: v=2.4 cv=BryQAIX5 c=1 sm=1 tr=0 ts=699369b2 cx=c_pps a=+D9SDfe9YZWTjADjLiQY5g==:117 a=xqWC_Br6kY4A:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=EUspDBNiAAAA:8 a=8m3Se83TVroFe3lHWL4A:9 a=vmgOmaN-Xu0dpDh8OwbV:22 X-Proofpoint-GUID: wmZiOMpz7I56ixSz9mrl8Msn3w_uIIaf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293, Aquarius:18.0.1121, Hydra:6.1.51, FMLib:17.12.100.49 definitions=2026-02-16_06,2026-02-16_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 clxscore=1015 adultscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602160163 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" Group variables used every pixel together, followed by variables used every lines and then lastly variables only used every frame. The idea here is to have all the data used every pixel fit in as few cachelines as possible. Benchmarking does not show any differerence before after, possibly because most of the per pixel lookup tables where already grouped together. Despite that this still seems like a good idea. Signed-off-by: Hans de Goede --- src/libcamera/software_isp/debayer_cpu.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h index 800b018c..a54418dc 100644 --- a/src/libcamera/software_isp/debayer_cpu.h +++ b/src/libcamera/software_isp/debayer_cpu.h @@ -135,6 +135,7 @@ private: }; using LookupTable = std::array; using CcmLookupTable = std::array; + /* Variables used every pixel */ LookupTable red_; LookupTable green_; LookupTable blue_; @@ -143,24 +144,26 @@ private: CcmLookupTable blueCcm_; std::array gammaTable_; LookupTable gammaLut_; - bool ccmEnabled_; - DebayerParams params_; - SwIspStats statsBuffer_; + Rectangle window_; + /* Variables used every line */ + SwIspStats statsBuffer_; debayerFn debayer0_; debayerFn debayer1_; debayerFn debayer2_; debayerFn debayer3_; - Rectangle window_; std::unique_ptr stats_; unsigned int lineBufferLength_; unsigned int lineBufferPadding_; unsigned int xShift_; /* Offset of 0/1 applied to window_.x */ bool enableInputMemcpy_; - static constexpr unsigned int kMaxThreads = 4; struct DebayerCpuThreadData threadData_[kMaxThreads]; + + /* variables used every frame */ unsigned int threadCount_; + bool ccmEnabled_; + DebayerParams params_; }; } /* namespace libcamera */