From patchwork Thu Jun 11 19:15:13 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Mader X-Patchwork-Id: 26873 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 1EAE0C324C for ; Thu, 11 Jun 2026 19:15:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 369A7623B4; Thu, 11 Jun 2026 21:15:42 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=robert.mader@collabora.com header.b="G9RTB2OG"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5C41460579 for ; Thu, 11 Jun 2026 21:15:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; t=1781205336; cv=none; d=zohomail.com; s=zohoarc; b=Ji52kz5+O62B6b5CP3YN31z9rk7R1eFUMgjxkpTjACDPyuHLq0tk45icgfwFNU3KL3cjTqKW54rG1w26WR7ZvX64xkkqS/Tor17/uarmY/xdU0TkTOttAqxtQzdmg3kreVL5VrjVIBIjrSh65PkAGHRD/wEasR7DvfDm86eMV2o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781205336; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=pMNVXepSsf9c3pTFTp6Bg/XurYu0/kUHLofjiB/xGFs=; b=YJZ9ggfKdQ4nYOrTHxP0gaStjaPXDxu8egjH6bulI2hXjZrjIJcZiXqY9Wof1Bb1WevUV0UtlpIn43b3S+yuEZ/r5PrzTu1Q8YNThzvmRdT31gs4oh+q5WRkOli3vV1Jpy0hh4/PF6bfy7OrvT1ecuU3jVRGBDVYlOpHYVRljjo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=robert.mader@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1781205336; s=zohomail; d=collabora.com; i=robert.mader@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=pMNVXepSsf9c3pTFTp6Bg/XurYu0/kUHLofjiB/xGFs=; b=G9RTB2OG8RZsSIEz2xWSCi/1NXZDsQYG6b8oK483Ic7gQ3Peszja2YDVWtmM/Lh2 U5fUeepGrjDfFrKoX15+ci7TLkq9HSfBRFhFZtLBQBgT80JcyD01EhPZQbicmVTllA+ DlPzHTBKbsQzuvcnyAQrAXn4WeJc77/G968p2nk4= Received: by mx.zohomail.com with SMTPS id 17812053336141022.322603986421; Thu, 11 Jun 2026 12:15:33 -0700 (PDT) From: Robert Mader To: libcamera-devel@lists.libcamera.org Cc: Robert Mader Subject: [PATCH v1] software_isp: debayer_egl: Consider border for scaling Date: Thu, 11 Jun 2026 21:15:13 +0200 Message-ID: <20260611191513.595489-1-robert.mader@collabora.com> X-Mailer: git-send-email 2.54.0 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" The debayer algorithm produces a sligtly smaller output resolution compared to the input one, using a border at the edges depending on the pattern. This wasn't considered when scaling to the final output buffer size, resulting in garbage pixels at the right - or in case or 90 degree rotated sensors - the bottom of the image. Use the correct algorithm output size instead - the maximum output buffer size. Fixes: f520b29fe (libcamera: software_isp: debayer_egl: Add an eGL Debayer class) Signed-off-by: Robert Mader --- src/libcamera/software_isp/debayer_egl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index 8e52b45ae..f857e0271 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -404,8 +404,9 @@ void DebayerEGL::setShaderVariableValues(const DebayerParams ¶ms) * Scale input to output size, keeping the aspect ratio and preferring * cropping over black bars. */ - GLfloat scale = std::max((GLfloat)window_.width / width_, - (GLfloat)window_.height / height_); + Size maxInputSize = sizes(inputPixelFormat_, {width_, height_}).max; + GLfloat scale = std::max((GLfloat)window_.width / maxInputSize.width, + (GLfloat)window_.height / maxInputSize.height); GLfloat trans = -(1.0f - scale); GLfloat projMatrix[] = { scale, 0, 0, 0,