From patchwork Thu Oct 15 22:36:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ray Strode X-Patchwork-Id: 28467 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 29D85C32F4 for ; Thu, 15 Oct 2026 22:36:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A646568E21; Fri, 16 Oct 2026 00:36:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="r61EE87h"; dkim-atps=neutral Received: from mail-ua1-x92d.google.com (mail-ua1-x92d.google.com [IPv6:2607:f8b0:4864:20::92d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 70E0A689BE for ; Fri, 16 Oct 2026 00:36:15 +0200 (CEST) Received: by mail-ua1-x92d.google.com with SMTP id a1e0cc1a2514c-9906a5410f5so483105241.0 for ; Thu, 15 Oct 2026 15:36:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1792103774; x=1792708574; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=JqAOteZCOCvRSCCKKg8gitOiksRWJ0T3Ysrj+GiLOjk=; b=r61EE87hLwd7B8dx68dkM98/Y8kgBjbmEUQsl6HfIW93FfKtd7tOW6hOZRhKrS4IDv TAmyc0XKL9dgfsgKR06hYxFgF+pJtbRhS5pHcc7pI3WUD2a5spkDyUE52bp8oRJd4vBv +uYT4/wBKj9h5lx2fuyOzmly/mo82DwM8+8NS0dljfHxw9B0h09Wd5d+mDdjiV36ZsVO wtXPCfjL5ofg3GBhXZHXea5/b4S4Bx5UHoIsze2uIH6o1fa7G5cD//soWbk9alprujDC ODaiBF6Q4zNk9q+YIZcsZoCYUlQGa6Gk7xWw6y/2L3nXe4uT8HjAcry47yaBSNKry+Hn sGzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792103774; x=1792708574; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=JqAOteZCOCvRSCCKKg8gitOiksRWJ0T3Ysrj+GiLOjk=; b=zh/DOq48mHIqCbQzGrh53yPLr8J0B5dwgjRwjjKRNwjhH+WHdHRAoGLszgBBdL4xGr 9rCQBXWnoDp/Vs3Tnze5tmC9zoediQjRkYe/cR0IU8TSeZ6jOeOcZQYwhk6aFI8012H2 Gfam+oaTQygCxBC5kdWm/md0yT6GDK5SBHWEzYbO5BYSzyJT2XPmZHDPYOROlnvC6HZp JoNRjBhDminnAPWOCEGeiCxf2oLH0XgbzGmJ0M9yBoqlegun6ttJBDQ8YiB7IeOU5+iS RlDBqOWgTrGG/yR+GQMGyvHxAyn/tniZEQJU2HtEL0im6hYw5mbcvxR8+Q1hAziJ0lXw O4EQ== X-Gm-Message-State: AFq9FYIKrXaRMNi929fFNCZIyrboRi5V4IeLH1OoesRywSVZRFu3kl9g 1KEtTwdKmABM9WIdFOysqXY5kmSfCgjFCkleb5rHl/ybFZv7ZxMKmSQhL6a9dSgK/nqisA== X-Gm-Gg: AYBFou1JO/dME6UwC3xFNTMHasFIOtEoSDpiIINRQiuqUJdj+lvHH4pI7BVKhTF+dKB hzJWp4rtnmlY0nIn8jLshdFwzq9cQpH1h6nW0SbExnHeRUyLTyqzkMBqw0fK6WMTvGDTKWropRb cHjp2h/8+7QrqUWotECAolvJGMcjkpAm4lG/bX4yIU6E0MyIiHW/5Y9G1hnssHjwfzbnXSuM9m/ Sz9U1o6U8HI3M4+YaJVQ+l25lYDn/+eB7RuMlMrbdVDyiHzZbJgiY7XtzJNgUP3zr/7wKsCTeOV KbaASc7HdHpNtj1FXA+CBHVWfDPbopSfcAMhB7beTAHD/h84yg7A6uiWMjrvRV0S+aYBsumvz4q jFCzioUDDOusIy3EYiLNoD8DgJAcvDvemGYeSERX6zNhMnaoPg/0ScShK47T3A8jpipTLht89H7 p1AuZJRXyNPUNyTadDBy4xtg54J6bG8hmaX/cyhYlPOde6qRMBUxmDzYs7LGs7jZTeH2h0lB/dx U+trwC5xp+8nk64hCvR2L155EZDPhY+RoB0IA0= X-Received: by 2002:a67:f34d:0:b0:7cc:ace:24ad with SMTP id ada2fe7eead31-7cc17c72bd9mr379071137.0.1792103773888; Thu, 15 Oct 2026 15:36:13 -0700 (PDT) Received: from localhost ([2601:19c:4a00:897d:3391:ed89:5571:41a8]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-7cc198794desm909192137.9.2026.10.15.15.36.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 15:36:12 -0700 (PDT) From: Ray Strode To: libcamera-devel@lists.libcamera.org Subject: [PATCH v2 0/4] software-isp: Align GPU cropping and statistics Date: Thu, 15 Oct 2026 18:36:00 -0400 Message-ID: <20261015223604.311616-1-halfline@gmail.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261015194335.287960-1-halfline@gmail.com> References: <20261015194335.287960-1-halfline@gmail.com> 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 all, This series fixes crop positioning and statistics alignment in the EGL software ISP when producing frames at different output sizes and aspect ratios. The GPU projection currently positions the cropped image off-center in the output, shifting the visible scene. CPU statistics operate on the full sensor buffer using a window derived from the output dimensions, so metering can cover a different region from the one displayed. Patches 1 and 2 center the GPU crop and test the projection by mapping expected sensor crop corners and the sensor center to output coordinates. Patches 3 and 4 align statistics with the visible sensor region and test the selected crop rectangles across output sizes and aspect ratios, including integer rounding before Bayer alignment. Changes in v2: - Replace the rendering and statistics integration tests with direct geometry unit tests, following Laurent's feedback. The tests require neither a graphics context nor sensor buffers. - Use the standard three lines of diff context. Thanks, Ray Ray Strode (4): software-isp: Center the GPU image crop tests: Validate debayer projection geometry software-isp: Meter the visible sensor crop tests: Validate the visible sensor crop .../internal/software_isp/debayer_geometry.h | 49 +++++++ .../internal/software_isp/meson.build | 1 + src/libcamera/software_isp/debayer_egl.cpp | 34 ++--- src/libcamera/software_isp/debayer_egl.h | 1 - test/debayer-geometry.cpp | 129 ++++++++++++++++++ test/meson.build | 1 + 6 files changed, 188 insertions(+), 27 deletions(-) create mode 100644 include/libcamera/internal/software_isp/debayer_geometry.h create mode 100644 test/debayer-geometry.cpp