From patchwork Thu Oct 15 19:43:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ray Strode X-Patchwork-Id: 28461 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 67173C3307 for ; Thu, 15 Oct 2026 19:49:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 311BE68E23; Thu, 15 Oct 2026 21:49:45 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rQjYI3jw"; dkim-atps=neutral Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0047068E06 for ; Thu, 15 Oct 2026 21:43:46 +0200 (CEST) Received: by mail-qv1-xf36.google.com with SMTP id 6a1803df08f44-91986c5cb75so20978426d6.0 for ; Thu, 15 Oct 2026 12:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1792093426; x=1792698226; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=yg4spNdLNqywki9dO1doK0W9jsu4cEUCxK/glUUsyB0=; b=rQjYI3jwuKdT3HAl8Ih2ML9WaYfs4VALKGjk5J/TJ7PklL7mcnbN7D31dOrByDNqol itqGZkkRjuJHa1UpMRd8DAFzat2D4gz7SjuLnWuzt4EDE4zqbbo2O7ip5ef24P/oY+xH +4NfWTS7T1mtg/51hXq90ltTN7DPIb8HUYPM9WbsBAmGp4iKkAZLC9c3+dbwwh2SQC1r 2T0gdUZUEZTu4xNJGS7EJcj4giDHJ0HgYCPnAO2e7j8joeJWGqduHLmV6WUrY3PPd36v D5/oFEJ15lm9p4mWbHlrdrQ7bSlR5xEeltmCeQiKkkt/oZJOpI+6UsLA/l19GSL8IF5+ 4Fng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792093426; x=1792698226; h=content-transfer-encoding:mime-version: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=yg4spNdLNqywki9dO1doK0W9jsu4cEUCxK/glUUsyB0=; b=eQA2kabKrTbUh3Dlo9nbcvTNUJcaypw9bISqtlwna7fl0IRqr9EMU3EW+2zKr92No+ 6npJRi2xA5XHGadxHfQmOsOXeJtL9qB57BWMO/OwR6KFTbP6oprNP0AnRIn9ZCEQTFih Z7+gJwelTOAyzb5yeUC79dWWkEK1o2SrpE8tk2cWJEegPASDY9T5bNSLUEnjHBAp+tf0 4lh0O+dzBNvFr81pf5c//UkpUDaH2f/fqrBRpoGccwh/AmCKbQaTiZC21PKx7U+8XXyD ptXtFWGu6Xejiork0MjSaTWfk0ZY4t8qNLkEmpyWjouifd8Pn6nR4AppDMzCAEn11gcR 20AA== X-Gm-Message-State: AFq9FYJv9Vwl5aFr2HBBEh2PCdY/tegWwAh1ASFCYGJW/jwEPasfWkOF 9oYba/kBfxsZeWJJlQDdvMp0Mis+41yewXSW4BybF/1P8ieCdrrEuIdKVBHvChwQYPg= X-Gm-Gg: AYBFou1rfry2DKSznZShXdrd4qcJEFuSAtY8vCS0oSWXIrgyaPv440IJMp7leUqRXSY YwphkFUJ3FjNIQKGKMKsz2HbE9ENRUx5tnl0TCYRDapO6C1Isj/sr5wzaFbGQ+DlOG51LwiZc3J c880RP5e0TUOorjYy+T//osy9WVD39DBqHW0G4M3LFTsoQL7OcL5FoC2KdQIzQjn65c4ZUWniFL f1wcPbYsMJppfHQFqH/NmY8R38cqSfkmUmEF/rdDO7IJCosD3qhlObcqVPrgYbtrErX3hYyz2Lw 4mrrOpZp4cZiZ8GH33nVGcdJbpYyTUzSyn9usJoatGTYFT2kOt+9u62MTM+W0Ux676fLcLZb+dp 37xUuKJSNVOfUJc6cpyPXDzWusvlkvA5opGOBUQEebCgxcK2MwQvLH4SF/qFFavpxNXippTJewT LmQOK3WxEJKSc+X4tafzYMvI4sqSzSvnP8hg/lAeTglZg0TjLDdLKdpx7dAFF2WHOWOjyNAlKNk As1iTwrESOSuCOb6UUr1sXKUY5xA2QwXYF+ X-Received: by 2002:a05:620a:4456:b0:93b:be6d:4f3e with SMTP id af79cd13be357-93ebd1b7386mr3331708185a.25.1792093425770; Thu, 15 Oct 2026 12:43:45 -0700 (PDT) Received: from localhost ([144.121.52.163]) by smtp.gmail.com with ESMTPSA id af79cd13be357-93f1a18176esm15370385a.20.2026.10.15.12.43.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 12:43:45 -0700 (PDT) From: Ray Strode To: libcamera-devel@lists.libcamera.org Subject: [PATCH 0/4] software-isp: Align GPU cropping and statistics Date: Thu, 15 Oct 2026 15:43:31 -0400 Message-ID: <20261015194335.287960-1-halfline@gmail.com> X-Mailer: git-send-email 2.56.0 MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 15 Oct 2026 21:49:41 +0200 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 add a test that compares rendered output against a centered crop of the native image. Patches 3 and 4 align statistics with the visible sensor region and add checks for the expected sample count, symmetry, and pixel inclusion and exclusion at crop boundaries. The tests cover 8-bit and packed RAW10 input with two Bayer patterns. Thanks, Ray Ray Strode (4): software-isp: Center the GPU image crop tests: Validate rendered GPU crop across output sizes software-isp: Meter the visible sensor crop tests: Validate visible GPU statistics across output sizes src/libcamera/software_isp/debayer_egl.cpp | 37 ++-- src/libcamera/software_isp/debayer_egl.h | 1 - test/meson.build | 19 +- test/software-isp-gpu-crop.cpp | 203 +++++++++++++++++++++ test/software-isp-gpu-stats.cpp | 188 +++++++++++++++++++ 5 files changed, 433 insertions(+), 15 deletions(-) create mode 100644 test/software-isp-gpu-crop.cpp create mode 100644 test/software-isp-gpu-stats.cpp