From patchwork Sun Aug 24 00:48:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 24219 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 BF533C332B for ; Sun, 24 Aug 2025 00:49:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 41B7269337; Sun, 24 Aug 2025 02:49:47 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="vKS0OlIO"; dkim-atps=neutral Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DCA106932C for ; Sun, 24 Aug 2025 02:49:10 +0200 (CEST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-45a1b0bde14so18322595e9.2 for ; Sat, 23 Aug 2025 17:49:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755996550; x=1756601350; darn=lists.libcamera.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2etWwA6J1SYpTDI5CoVSwI33oPVBanpyO7HgTRHCDS0=; b=vKS0OlIOp/J8EswmlDaTIH4rhprILb2HKUE6RSRZI7FH2OaFWGSiR6gGRQso2t18A5 62RAabOsdmgcQ1GEKny0obAQyFeyXcn8wbZpoxT/2VOQMCLsud+52ETefu+GHbeag/eo 8gFbHaI0RaVBmxDfLxDBRtlcyQybSeeEXs62pgY4SQB80J2xmUV38APEymES+SxdPaCy ql4l6HfDWFJ1ud0zlD4q1oks4JyzkNnM7nOsVtoZ1wlO6HHb0wPaLMlnBy6Lu8erqoZ+ vTbprfWt8r8Kdlg8vCHbI+B30nxY9f/Qf6SBW3zNd5v/wYVUxF+3xopwjfNVhquEjrjE j/ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755996550; x=1756601350; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2etWwA6J1SYpTDI5CoVSwI33oPVBanpyO7HgTRHCDS0=; b=OGDYh25fn2VWRrqcBVmdLrOBxipMU5Zoer+AyufTPqyGRiHcPrYd5vAFRVS+wV9x2I bruJMbwiWfaTNJQRXIrgMsKHHuUNmosMbZRD1+/kH1tjVYLVwpkz+PVMZEFvgVUHLt5t u0cEVGT8LdAmprGWutLBKuZt5l9PVtssp9xcX7MJDVmbnyNQf0WYKsXvao1JZP/VV86e i3dGqipwgQ+y5VPVPfxy1VwI31QchnMz4FukmRa9KD/GlwZu0R/rQOiuI+8XA92GaYXR df0dPVshcrVVjFppQ/Ob3DfkCtimp/MXn8XH8ERKfNa9Ufwv8TjKa3PBMB3hij8U3wwY HSyQ== X-Gm-Message-State: AOJu0Yx3uR5NkCvPJw0q9LWrV7Fuav5PWyaSSQr+0yLBVTrSvUUz2Cor 4YA47jTKVz73Qy7eCaOKXzy7Q6IeJFmZcuwuNi+aTwOSZxK4eqkh91ZAJXJA0da4cgQ= X-Gm-Gg: ASbGncuGtHfBHl3s/9CjqDWghzdJeE0n13GcSdYZqQ2dF5dm/GOiTd2lH1ODp2lkQ+7 P3bneDDqiWXC10ZD5bJkXRVVPomObZxXySAhs/XZnwNx81V2u3cx0INnQO1bLxqTVaGPRY5ubli 52Gt7KgJ4WMZj2/si8tlJNbRYkaku/SOsBp7TYZzrHZ3gqGqigbaYspK4jiNeIS2+lJn8bN5jrf OXseIHFdc54m0nhxj8Drk4yJh2Spafc+JvLXrc/xsdra1VzqGdti/ddItJTezQzYJMGeZX6KxK5 ZnqiJDEOJX+Xshr12wMqsA2o1A4PKMOR+j5BOwUUlZSjC8Shiu/tPgAt41u5ytZ1vj2/YgLrxH1 MuG7VoyGpqiogSx05bfTTj5Xl18tyqjeAELZLJNk+8RCZfzSx5hASZHzya1TGgKu17AUCo2oXjt sWnVfzNmpRzgK2EbfrJqheKzKRwrbB0Y8= X-Google-Smtp-Source: AGHT+IGYxZTEaWf1wZW5sT9kXdfmPIgF4YtTManMjAXTaOuv14+p6lTd9Idlb3dFaG+PUp3DdGmF4A== X-Received: by 2002:a05:600c:46cb:b0:458:bf7c:f744 with SMTP id 5b1f17b1804b1-45b517c2d5fmr54970585e9.32.1755996550418; Sat, 23 Aug 2025 17:49:10 -0700 (PDT) Received: from [192.168.0.13] (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45b4e1d530esm69347225e9.0.2025.08.23.17.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Aug 2025 17:49:10 -0700 (PDT) From: Bryan O'Donoghue Date: Sun, 24 Aug 2025 01:48:49 +0100 Subject: [PATCH v2 37/37] libcamera: software_isp: Reduce statistics image area MIME-Version: 1.0 Message-Id: <20250824-b4-v0-5-2-gpuisp-v2-a-v2-37-96f4576c814e@linaro.org> References: <20250824-b4-v0-5-2-gpuisp-v2-a-v2-0-96f4576c814e@linaro.org> In-Reply-To: <20250824-b4-v0-5-2-gpuisp-v2-a-v2-0-96f4576c814e@linaro.org> To: libcamera-devel@lists.libcamera.org Cc: Bryan O'Donoghue , Milan Zamazal , Kieran Bingham X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1809; i=bryan.odonoghue@linaro.org; h=from:subject:message-id; bh=bRnKLUJjXpxW5OOLk8SuBI4fSZ62DWkB8yvaqS8TeDk=; b=owEBbQKS/ZANAwAKASJxO7Ohjcg6AcsmYgBoqmFjiqIo2cIrllvz6JtiqpJNEwjIjEJEx39Pv rHrBe7nekiJAjMEAAEKAB0WIQTmk/sqq6Nt4Rerb7QicTuzoY3IOgUCaKphYwAKCRAicTuzoY3I OuPlD/42q5/hcPeEsjKWvhxHAiHGIpYAf80gyme+F6iN6ie5Jj2aJBUdbXNcnJDgmdWTFaUWC71 I0px3JYxyys/nclOoXNbdDhyauYSSvQx6fMveuBe0qpJTgIJM4pN022AP9lCn7j2tfvsfQVTqma 8QJTpu97yda3R1ll+rLW3BUWcqkUQA/xoOzQoOxzbDnJtNGYhPBZAstKkjSFiAowQTX+pkV82xF jomi/VtRh7+JvwZtz45rPiPFTFn2/gZO9hMJu3wek+fs2nPFJQrbuyUf8ubuENAPmwvNNcerXoz AeezR4UaPcrbVkYdS/EtVaoPQGB8JH9a8bGOfoENT5E1DSMlb9HLzQSuFrrTZYk/5wFckQ9J0UU yRW0RlRz26ZXtGI1j7Kt9+pgfucMyUb3qDMnE3vWJ1SnYJ7EhPFd9L2TfJMPybKG9nsqIp77T3L 0zpD1isFPAxdb4PTh8Nozcxi7PfpQWqi355oeAUj+VgLYTwdSOJ8JfR4lQa1vGa1ECY/UFqWaJu LqbAP21kP5Off0cWY1RUe6HRc2FhfvCY6w5gqVd9id8hgMqd93KS+BWa00Kwegn6rbmNL/VHU29 GuizFeQmkkmg/NkSMNdHojFXWeUPCG84dhMZoMKmOjUtSK+yS1Kd/trM3BWi6JaL8K4WvnNdHAl U7kcODz+fW4J6MA== X-Developer-Key: i=bryan.odonoghue@linaro.org; a=openpgp; fpr=E693FB2AABA36DE117AB6FB422713BB3A18DC83A 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" From: Milan Zamazal The statistics in software ISP is computed basically over the whole image area, although only on part of the pixels. It is not necessary to cover the whole image area, it's sufficient to compute the statistics let's say over the central area of 2/3 of the image width and height, which should be both sufficient and faster. The speedup is not that important with the CPU implementation but it may save CPU work more noticeably with GPU debayering implementation. Signed-off-by: Milan Zamazal Reviewed-by: Kieran Bingham --- src/libcamera/software_isp/debayer_cpu.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 7bd1fc39266f651845cc7a87ac991aa67c36c094..b19d89c1cae04104d6d8377555b306128e700f62 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -526,8 +526,13 @@ int DebayerCpu::configure(const StreamConfiguration &inputCfg, window_.width = outputCfg.size.width; window_.height = outputCfg.size.height; - /* Don't pass x,y since process() already adjusts src before passing it */ - stats_->setWindow(Rectangle(window_.size())); + /* + * Don't pass x,y from window_ since process() already adjusts for it. + * But crop the window to 2/3 of its width and height for speedup. + * The speedup is more important with GPU than with CPU ISP; we want the + * same implementation on both. + */ + stats_->setWindow((window_.size() * 2 / 3).centeredTo(window_.center())); /* pad with patternSize.Width on both left and right side */ lineBufferPadding_ = inputConfig_.patternSize.width * inputConfig_.bpp / 8;