From patchwork Tue Dec 2 13:31:32 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: 25287 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 A9C87C3260 for ; Tue, 2 Dec 2025 13:32:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 41FAC60C8D; Tue, 2 Dec 2025 14:32:04 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="PY2mAs/n"; dkim-atps=neutral Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7169D6096B for ; Tue, 2 Dec 2025 14:32:02 +0100 (CET) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4775e891b5eso23189365e9.2 for ; Tue, 02 Dec 2025 05:32:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682322; x=1765287122; 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=fAgiKIq2Mba5SDA4R9r4zYA4hXxSb4cFgrJ1EB93fGY=; b=PY2mAs/nEk/7nsZJmlWbVDORkYpT7vi/sdoQLpVRqyQUOSOe/ZkJ5kU4CT0feaCgv8 7IeZhEJYNAAhQATF0ztqkEk3MQT8lwFsRt/S03sYBl/zba4cmwPrq7IFSTZy3MfaxDx8 hoPr9gv6FI1sBo42IgCrnVY0G9L7Wn1AFmZuX/LkSXxw38qQ7M9+MWwKL8imZRjUnBbb E4FJNVHzrHHIBwb1DuAQSfnp9i3H34QZAZJ0PS1QXwGmev1csMp66vcjw7YSsAluXbrA Sxqc7cgGXLB5EH7lffRU/GkaHlzoB2kNHSddsUIoT9XTkdVEdUHA35pgzaOOXJfgxfw1 hAnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682322; x=1765287122; 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=fAgiKIq2Mba5SDA4R9r4zYA4hXxSb4cFgrJ1EB93fGY=; b=YjtTf5sBK4nJEmVQwguh5NtDacvapSwLDqR8d7DRFsBUGT4jcXukgHfvDQ93o0AwP4 HAhDC7qToZDcMHBJyPsdcxAlMziSMUqdVnSukQEfyh7dTSYZO3ZRba7pieSo5OzxB17E rtITG/j+M96BFNS1f0YAcSoVVYj4VJf54ZaF3mcgat1QA4MnkP2uma5BmpFgu2DhSMKh +LejCxpDXjbOD1zwWLkRj6fWCog5lZ4S+3EgYPuQMHj1CPakT4qjWUqOTXZq/Lh2dqp6 6p4FtQzYY7Iu5GXHkfFWR7QEN/J4yLiiPEkX6Fu649OH6cb7nU+61xY7q/KedzvhUEhB YRqw== X-Gm-Message-State: AOJu0YyeKy4vYovtBb4/QeiiKbx5JSxl1/7NDlVt1SYYSaEYQB2Tpyd0 Jtb7HlzaSfJcNuW8wduhy2sBsySyf7tMp8rYUXKieGrow8Pd1WC+7BKpgg9mNnqcV3rkzQhNscK tugqC X-Gm-Gg: ASbGnctgbKpgOUMGX59bO+9bnIG0skSz5ORgutdDjehf/+pYOpfgY+BWcSrDnbSpWGZ CaMegzdmDQMKHW34KTV6D/b7VY1n5q3vhX98nEnp8YTde0I5m7P4KiIJRf7Vf1bT6XXgPANdf2o JXMFI7ZoVW+F3WA6OgZDgKXSY6za8JWfzX77BzGKznrgNX4lx3EA7dr0w3QuJS2cK8sA3rnMHhI F7kU/WqXQBnr8DQMV1TvATzSBdaGeIzyKlHIRAZyjcLAO8ATEGGW0gMV96ova0Hc4QIeSWoYcK9 gGuhrEIBqXKvY1ELZBr+JmN01tMbo1c21VbxHglBd8Wv1PjYKdorgw6Jsrg65xqGHQkDDiQeQJm jStSBCW+Yr8dPHSxi4/u8JniveNIndOc/IZESaOO9S0K576+GB6Dr4SNeK9kf8M5BPXShPC2Wu0 T816LjK7dcHHEpzc3bIGlhnesLTZIM+rzE+/Ys5HLDaNSbAPL79NZ85cHBjTxORnRJqQo= X-Google-Smtp-Source: AGHT+IGrUsSjXrL2LHhOCuLaGAU4qX6qGSnPEZ4Ok8hrK5aWFwO3d+Dee+mfrjafGnRxq2o/Ja3H+w== X-Received: by 2002:a05:600c:1c88:b0:477:9cdb:e337 with SMTP id 5b1f17b1804b1-477c0165badmr491654545e9.7.1764682321693; Tue, 02 Dec 2025 05:32:01 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:01 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham , Milan Zamazal Subject: [PATCH v3 01/22] libcamera: shaders: Move GL shader programs to src/libcamera/assets/shader Date: Tue, 2 Dec 2025 13:31:32 +0000 Message-ID: <20251202133157.661407-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" Moving the vertex and fragment shaders to src/libcamera/shaders to allow for reuse of these inside of the SoftISP. A comment has been added to src/apps/qcom/meson.build to force a rebuild. Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal Signed-off-by: Bryan O'Donoghue --- src/apps/qcam/assets/shader/shaders.qrc | 16 ++--- src/apps/qcam/meson.build | 3 + src/apps/qcam/viewfinder_gl.cpp | 70 +++++++++---------- .../shader => libcamera/shaders}/RGB.frag | 0 .../shaders}/YUV_2_planes.frag | 0 .../shaders}/YUV_3_planes.frag | 0 .../shaders}/YUV_packed.frag | 0 .../shaders}/bayer_1x_packed.frag | 0 .../shader => libcamera/shaders}/bayer_8.frag | 0 .../shader => libcamera/shaders}/bayer_8.vert | 0 .../shaders}/identity.vert | 0 11 files changed, 46 insertions(+), 43 deletions(-) rename src/{apps/qcam/assets/shader => libcamera/shaders}/RGB.frag (100%) rename src/{apps/qcam/assets/shader => libcamera/shaders}/YUV_2_planes.frag (100%) rename src/{apps/qcam/assets/shader => libcamera/shaders}/YUV_3_planes.frag (100%) rename src/{apps/qcam/assets/shader => libcamera/shaders}/YUV_packed.frag (100%) rename src/{apps/qcam/assets/shader => libcamera/shaders}/bayer_1x_packed.frag (100%) rename src/{apps/qcam/assets/shader => libcamera/shaders}/bayer_8.frag (100%) rename src/{apps/qcam/assets/shader => libcamera/shaders}/bayer_8.vert (100%) rename src/{apps/qcam/assets/shader => libcamera/shaders}/identity.vert (100%) diff --git a/src/apps/qcam/assets/shader/shaders.qrc b/src/apps/qcam/assets/shader/shaders.qrc index 96c709f92..7369cdbe8 100644 --- a/src/apps/qcam/assets/shader/shaders.qrc +++ b/src/apps/qcam/assets/shader/shaders.qrc @@ -1,13 +1,13 @@ - RGB.frag - YUV_2_planes.frag - YUV_3_planes.frag - YUV_packed.frag - bayer_1x_packed.frag - bayer_8.frag - bayer_8.vert - identity.vert + ../../../../../src/libcamera/shaders/RGB.frag + ../../../../../src/libcamera/shaders/YUV_2_planes.frag + ../../../../../src/libcamera/shaders/YUV_3_planes.frag + ../../../../../src/libcamera/shaders/YUV_packed.frag + ../../../../../src/libcamera/shaders/bayer_1x_packed.frag + ../../../../../src/libcamera/shaders/bayer_8.frag + ../../../../../src/libcamera/shaders/bayer_8.vert + ../../../../../src/libcamera/shaders/identity.vert diff --git a/src/apps/qcam/meson.build b/src/apps/qcam/meson.build index 9ca047b0f..33600095f 100644 --- a/src/apps/qcam/meson.build +++ b/src/apps/qcam/meson.build @@ -64,3 +64,6 @@ qcam = executable('qcam', qcam_sources, resources, qt6_dep, ], cpp_args : qt6_cpp_args) + +# Note: qt6.preprocess does not automatically rebuild when the +# qcam_resources dependency chain is updated. diff --git a/src/apps/qcam/viewfinder_gl.cpp b/src/apps/qcam/viewfinder_gl.cpp index f31956ff0..1554c94d5 100644 --- a/src/apps/qcam/viewfinder_gl.cpp +++ b/src/apps/qcam/viewfinder_gl.cpp @@ -141,7 +141,7 @@ bool ViewFinderGL::selectFormat(const libcamera::PixelFormat &format) textureMinMagFilters_ = GL_LINEAR; /* Use identity.vert as the default vertex shader. */ - vertexShaderFile_ = ":identity.vert"; + vertexShaderFile_ = ":src/libcamera/shaders/identity.vert"; fragmentShaderDefines_.clear(); @@ -150,170 +150,170 @@ bool ViewFinderGL::selectFormat(const libcamera::PixelFormat &format) horzSubSample_ = 2; vertSubSample_ = 2; fragmentShaderDefines_.append("#define YUV_PATTERN_UV"); - fragmentShaderFile_ = ":YUV_2_planes.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/YUV_2_planes.frag"; break; case libcamera::formats::NV21: horzSubSample_ = 2; vertSubSample_ = 2; fragmentShaderDefines_.append("#define YUV_PATTERN_VU"); - fragmentShaderFile_ = ":YUV_2_planes.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/YUV_2_planes.frag"; break; case libcamera::formats::NV16: horzSubSample_ = 2; vertSubSample_ = 1; fragmentShaderDefines_.append("#define YUV_PATTERN_UV"); - fragmentShaderFile_ = ":YUV_2_planes.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/YUV_2_planes.frag"; break; case libcamera::formats::NV61: horzSubSample_ = 2; vertSubSample_ = 1; fragmentShaderDefines_.append("#define YUV_PATTERN_VU"); - fragmentShaderFile_ = ":YUV_2_planes.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/YUV_2_planes.frag"; break; case libcamera::formats::NV24: horzSubSample_ = 1; vertSubSample_ = 1; fragmentShaderDefines_.append("#define YUV_PATTERN_UV"); - fragmentShaderFile_ = ":YUV_2_planes.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/YUV_2_planes.frag"; break; case libcamera::formats::NV42: horzSubSample_ = 1; vertSubSample_ = 1; fragmentShaderDefines_.append("#define YUV_PATTERN_VU"); - fragmentShaderFile_ = ":YUV_2_planes.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/YUV_2_planes.frag"; break; case libcamera::formats::YUV420: horzSubSample_ = 2; vertSubSample_ = 2; - fragmentShaderFile_ = ":YUV_3_planes.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/YUV_3_planes.frag"; break; case libcamera::formats::YVU420: horzSubSample_ = 2; vertSubSample_ = 2; - fragmentShaderFile_ = ":YUV_3_planes.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/YUV_3_planes.frag"; break; case libcamera::formats::UYVY: fragmentShaderDefines_.append("#define YUV_PATTERN_UYVY"); - fragmentShaderFile_ = ":YUV_packed.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/YUV_packed.frag"; break; case libcamera::formats::VYUY: fragmentShaderDefines_.append("#define YUV_PATTERN_VYUY"); - fragmentShaderFile_ = ":YUV_packed.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/YUV_packed.frag"; break; case libcamera::formats::YUYV: fragmentShaderDefines_.append("#define YUV_PATTERN_YUYV"); - fragmentShaderFile_ = ":YUV_packed.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/YUV_packed.frag"; break; case libcamera::formats::YVYU: fragmentShaderDefines_.append("#define YUV_PATTERN_YVYU"); - fragmentShaderFile_ = ":YUV_packed.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/YUV_packed.frag"; break; case libcamera::formats::ABGR8888: fragmentShaderDefines_.append("#define RGB_PATTERN rgb"); - fragmentShaderFile_ = ":RGB.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/RGB.frag"; break; case libcamera::formats::ARGB8888: fragmentShaderDefines_.append("#define RGB_PATTERN bgr"); - fragmentShaderFile_ = ":RGB.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/RGB.frag"; break; case libcamera::formats::BGRA8888: fragmentShaderDefines_.append("#define RGB_PATTERN gba"); - fragmentShaderFile_ = ":RGB.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/RGB.frag"; break; case libcamera::formats::RGBA8888: fragmentShaderDefines_.append("#define RGB_PATTERN abg"); - fragmentShaderFile_ = ":RGB.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/RGB.frag"; break; case libcamera::formats::BGR888: fragmentShaderDefines_.append("#define RGB_PATTERN rgb"); - fragmentShaderFile_ = ":RGB.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/RGB.frag"; break; case libcamera::formats::RGB888: fragmentShaderDefines_.append("#define RGB_PATTERN bgr"); - fragmentShaderFile_ = ":RGB.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/RGB.frag"; break; case libcamera::formats::SBGGR8: firstRed_.setX(1.0); firstRed_.setY(1.0); - vertexShaderFile_ = ":bayer_8.vert"; - fragmentShaderFile_ = ":bayer_8.frag"; + vertexShaderFile_ = ":src/libcamera/shaders/bayer_8.vert"; + fragmentShaderFile_ = ":src/libcamera/shaders/bayer_8.frag"; textureMinMagFilters_ = GL_NEAREST; break; case libcamera::formats::SGBRG8: firstRed_.setX(0.0); firstRed_.setY(1.0); - vertexShaderFile_ = ":bayer_8.vert"; - fragmentShaderFile_ = ":bayer_8.frag"; + vertexShaderFile_ = ":src/libcamera/shaders/bayer_8.vert"; + fragmentShaderFile_ = ":src/libcamera/shaders/bayer_8.frag"; textureMinMagFilters_ = GL_NEAREST; break; case libcamera::formats::SGRBG8: firstRed_.setX(1.0); firstRed_.setY(0.0); - vertexShaderFile_ = ":bayer_8.vert"; - fragmentShaderFile_ = ":bayer_8.frag"; + vertexShaderFile_ = ":src/libcamera/shaders/bayer_8.vert"; + fragmentShaderFile_ = ":src/libcamera/shaders/bayer_8.frag"; textureMinMagFilters_ = GL_NEAREST; break; case libcamera::formats::SRGGB8: firstRed_.setX(0.0); firstRed_.setY(0.0); - vertexShaderFile_ = ":bayer_8.vert"; - fragmentShaderFile_ = ":bayer_8.frag"; + vertexShaderFile_ = ":src/libcamera/shaders/bayer_8.vert"; + fragmentShaderFile_ = ":src/libcamera/shaders/bayer_8.frag"; textureMinMagFilters_ = GL_NEAREST; break; case libcamera::formats::SBGGR10_CSI2P: firstRed_.setX(1.0); firstRed_.setY(1.0); fragmentShaderDefines_.append("#define RAW10P"); - fragmentShaderFile_ = ":bayer_1x_packed.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/bayer_1x_packed.frag"; textureMinMagFilters_ = GL_NEAREST; break; case libcamera::formats::SGBRG10_CSI2P: firstRed_.setX(0.0); firstRed_.setY(1.0); fragmentShaderDefines_.append("#define RAW10P"); - fragmentShaderFile_ = ":bayer_1x_packed.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/bayer_1x_packed.frag"; textureMinMagFilters_ = GL_NEAREST; break; case libcamera::formats::SGRBG10_CSI2P: firstRed_.setX(1.0); firstRed_.setY(0.0); fragmentShaderDefines_.append("#define RAW10P"); - fragmentShaderFile_ = ":bayer_1x_packed.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/bayer_1x_packed.frag"; textureMinMagFilters_ = GL_NEAREST; break; case libcamera::formats::SRGGB10_CSI2P: firstRed_.setX(0.0); firstRed_.setY(0.0); fragmentShaderDefines_.append("#define RAW10P"); - fragmentShaderFile_ = ":bayer_1x_packed.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/bayer_1x_packed.frag"; textureMinMagFilters_ = GL_NEAREST; break; case libcamera::formats::SBGGR12_CSI2P: firstRed_.setX(1.0); firstRed_.setY(1.0); fragmentShaderDefines_.append("#define RAW12P"); - fragmentShaderFile_ = ":bayer_1x_packed.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/bayer_1x_packed.frag"; textureMinMagFilters_ = GL_NEAREST; break; case libcamera::formats::SGBRG12_CSI2P: firstRed_.setX(0.0); firstRed_.setY(1.0); fragmentShaderDefines_.append("#define RAW12P"); - fragmentShaderFile_ = ":bayer_1x_packed.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/bayer_1x_packed.frag"; textureMinMagFilters_ = GL_NEAREST; break; case libcamera::formats::SGRBG12_CSI2P: firstRed_.setX(1.0); firstRed_.setY(0.0); fragmentShaderDefines_.append("#define RAW12P"); - fragmentShaderFile_ = ":bayer_1x_packed.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/bayer_1x_packed.frag"; textureMinMagFilters_ = GL_NEAREST; break; case libcamera::formats::SRGGB12_CSI2P: firstRed_.setX(0.0); firstRed_.setY(0.0); fragmentShaderDefines_.append("#define RAW12P"); - fragmentShaderFile_ = ":bayer_1x_packed.frag"; + fragmentShaderFile_ = ":src/libcamera/shaders/bayer_1x_packed.frag"; textureMinMagFilters_ = GL_NEAREST; break; default: diff --git a/src/apps/qcam/assets/shader/RGB.frag b/src/libcamera/shaders/RGB.frag similarity index 100% rename from src/apps/qcam/assets/shader/RGB.frag rename to src/libcamera/shaders/RGB.frag diff --git a/src/apps/qcam/assets/shader/YUV_2_planes.frag b/src/libcamera/shaders/YUV_2_planes.frag similarity index 100% rename from src/apps/qcam/assets/shader/YUV_2_planes.frag rename to src/libcamera/shaders/YUV_2_planes.frag diff --git a/src/apps/qcam/assets/shader/YUV_3_planes.frag b/src/libcamera/shaders/YUV_3_planes.frag similarity index 100% rename from src/apps/qcam/assets/shader/YUV_3_planes.frag rename to src/libcamera/shaders/YUV_3_planes.frag diff --git a/src/apps/qcam/assets/shader/YUV_packed.frag b/src/libcamera/shaders/YUV_packed.frag similarity index 100% rename from src/apps/qcam/assets/shader/YUV_packed.frag rename to src/libcamera/shaders/YUV_packed.frag diff --git a/src/apps/qcam/assets/shader/bayer_1x_packed.frag b/src/libcamera/shaders/bayer_1x_packed.frag similarity index 100% rename from src/apps/qcam/assets/shader/bayer_1x_packed.frag rename to src/libcamera/shaders/bayer_1x_packed.frag diff --git a/src/apps/qcam/assets/shader/bayer_8.frag b/src/libcamera/shaders/bayer_8.frag similarity index 100% rename from src/apps/qcam/assets/shader/bayer_8.frag rename to src/libcamera/shaders/bayer_8.frag diff --git a/src/apps/qcam/assets/shader/bayer_8.vert b/src/libcamera/shaders/bayer_8.vert similarity index 100% rename from src/apps/qcam/assets/shader/bayer_8.vert rename to src/libcamera/shaders/bayer_8.vert diff --git a/src/apps/qcam/assets/shader/identity.vert b/src/libcamera/shaders/identity.vert similarity index 100% rename from src/apps/qcam/assets/shader/identity.vert rename to src/libcamera/shaders/identity.vert From patchwork Tue Dec 2 13:31:33 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: 25288 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 22C61C326B for ; Tue, 2 Dec 2025 13:32:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1EBF260C89; Tue, 2 Dec 2025 14:32:07 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="HYLEJE0j"; dkim-atps=neutral Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9CAB560C84 for ; Tue, 2 Dec 2025 14:32:03 +0100 (CET) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-42b38de7940so2702837f8f.3 for ; Tue, 02 Dec 2025 05:32:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682323; x=1765287123; 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=xiceLMWMoyliOmwPMu7d0tXHUd/qrCD+ZjX032QIGew=; b=HYLEJE0ju+LAk0Nc+eqmJcgliQ7IDazpV+td7sbTQpPoxFqDrVcw4LNRP9qarkaHzp FHUnPu9Ds5s4LoO9tXJ4nQ7jCm04B3zNAnDs/sKH582SjSiynuXxEFa3WINzHvFfCfIf 4/MkKWpi7XnpIxkyCmGu27I1odpgliKa8hCFliCtGxbaKDejfVhCk+qYZLezDCHJJZSO 7a0/FnkmgdYeMPjwXdImRSBKI8ZAyLX2Ba19xTkMIhw1Q3HvHM0zSlfPfP94MIFT+YdG V1rVMdCRem6PwB9IFbkfO5Xu4JeMPssSoZdfNkJ+XBQz/spiLd6Sp0Nfep9b8WGnJKW0 PmIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682323; x=1765287123; 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=xiceLMWMoyliOmwPMu7d0tXHUd/qrCD+ZjX032QIGew=; b=Mb/aXCFLxhJ5OjJBTfTCl+lzMYroEnWFzO59oJkkI0mM+ocfzN2GbMM+xu4uGm53R9 IUAnjdsFLGyrzQRagt/d6v0d5PRcbqDC6BHO7nvOKpdoRE/1lD7c4+Z9N6qExJY9Nn02 kigKXDVQyI0aF6+PMCJi7El/Xa/M1authkMfE9DMqlmkxG/heqgcL57MJBtWHoNZUJrQ iuStA0Jg0z8b+krwg9JzABvJ5bGUBdcsjcBwg7Fr9WOmhC6/BW2qUVTOT5aG+jmHXOgK eC6vlPKjfDhsE8TsPvVR9WqbOWOQXaVb2/dtqoWMaJUEIDwNnp4+nYJ4j8pTgRiCjuaj 3RAQ== X-Gm-Message-State: AOJu0YzBZt0I7JrvLzQZGMDbT9owcbSKGkAeCKhDzLWTpGo7vKXv3uJx cecTCKBip9e3QywEt6vOafhp3qK9ox+F6d+YI0ptkfsi9LzWmNZo86JioNesqh6UzGPaUgCxoTd ibZ2W X-Gm-Gg: ASbGnct7dTgj5xDCEg0qYyxsV9ohfazrMLx9kjnWpCHwKK4ufteg+tzyIGWnx8YXBBP sSd0kkG6BRTLnuFqrVtxjAbIr+JU9IgtSQ7fSyStcH/Qq3MgFUZw3Hfj/hbAjJsiCg6u6QDIMwh wA96X3W++IqZs/iHksrI7tBepo5BrWecXCzH1ES7YJH2NoHo3MsfMTfOAmrtq8lDcxqH4vuUkA2 rqUGD/uxb0xTaPguWo/w0nPL4mPe4mkSwpmYtDSNESKT019/010Pdr2LhH9SoB5jCRy8S/aMtpb wf8ZRDKhrZDZojIPbjmunVWPsDxVbZM0rjECqRjBwYwQrdxBvTrJGln9jxlwTOUSI60fRTZMAIo 87hZh49U/kjvPB0HwQiv1RJXWknHIV5J4jJPiRgc7h9m+nDTRG1rbOMQnfHZLErOzSrXZuRZv+w B2Aubulkrb7gCYFX5W5xAIu16k0UqLlKEAIalHsqobFJzKmykOWcVSmug6wgVrDfek6z5pKA2P2 Lt6WQ== X-Google-Smtp-Source: AGHT+IHK2o/b45kvptj+8v9oK+ESKitLmfgVY3DKqLtx0vIm+0fvXjNvmbhyq304blf9f0EnC9lz6A== X-Received: by 2002:a05:6000:186b:b0:42b:3dbe:3a53 with SMTP id ffacd0b85a97d-42cc1d0c716mr48166394f8f.40.1764682322600; Tue, 02 Dec 2025 05:32:02 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:02 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham Subject: [PATCH v3 02/22] utils: gen-shader-headers: Add a utility to generate headers from shaders Date: Tue, 2 Dec 2025 13:31:33 +0000 Message-ID: <20251202133157.661407-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" Two simple script to generate a header that contains GLSL shaders translated to C arrays. Acked-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- utils/gen-shader-header.py | 37 +++++++++++++++++++++++++ utils/gen-shader-headers.sh | 55 +++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100755 utils/gen-shader-header.py create mode 100755 utils/gen-shader-headers.sh diff --git a/utils/gen-shader-header.py b/utils/gen-shader-header.py new file mode 100755 index 000000000..745852b4c --- /dev/null +++ b/utils/gen-shader-header.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2025, Bryan O'Donoghue. +# +# Author: Bryan O'Donoghue +# +# A Python script which takes a list of shader files and converts each of them +# into a C header. +# +import sys + +try: + with open(sys.argv[2], "rb") as file: + data = file.read() + data_len = len(data) + + name = sys.argv[1].replace(".", "_") + name_len = name + "_len" + + j = 0 + print("unsigned char const", name, "[] = {") + for ch in data: + print(f"0x{ch:02x}, ", end="") + j = (j + 1) % 16 + if j == 0: + print() + if j != 0: + print() + print("};") + + print() + print(f"const unsigned int {name_len}={data_len};") + +except FileNotFoundError: + print(f"File {sys.argv[2]} not found", file=sys.stderr) +except IOError: + print(f"Unable to read {sys.argv[2]}", file=sys.stderr) diff --git a/utils/gen-shader-headers.sh b/utils/gen-shader-headers.sh new file mode 100755 index 000000000..81bf1584c --- /dev/null +++ b/utils/gen-shader-headers.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +set -e + +usage() { + echo "Usage: $0 [shader_file2 ...]" + echo + echo "Generates a C header file containing hex-encoded shader data." + echo + echo "Arguments:" + echo " src_dir Path to the base of the source directory" + echo " build_dir Directory where shader files are located and header will be written" + echo " output_header_name Name of the generated header file (relative to build_dir)" + echo " shader_file(s) One or more shader files to embed in the header" + exit 1 +} + +if [ $# -lt 4 ]; then + echo "Error: Invalid argument count." + usage +fi + +src_dir="$1"; shift +build_dir="$1"; shift +build_path=$build_dir/"$1"; shift + +cat < "$build_path" +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* This file is auto-generated, do not edit! */ + +#pragma once + +EOF + +cat <> "$build_path" +/* + * List the names of the shaders at the top of + * header for readability's sake + * +EOF + +for file in "$@"; do + name=$(basename "$build_dir/$file" | tr '.' '_') + echo "[SHADER-GEN] $name" + echo " * unsigned char $name;" >> "$build_path" +done + +echo "*/" >> "$build_path" + +echo "/* Hex encoded shader data */" >> "$build_path" +for file in "$@"; do + name=$(basename "$build_dir/$file") + "$src_dir/utils/gen-shader-header.py" "$name" "$build_dir/$file" >> "$build_path" + echo >> "$build_path" +done From patchwork Tue Dec 2 13:31:34 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: 25289 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 4EBE9BD80A for ; Tue, 2 Dec 2025 13:32:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8049F60C90; Tue, 2 Dec 2025 14:32:09 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="wuMWU6Wx"; dkim-atps=neutral Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7DBD360C7C for ; Tue, 2 Dec 2025 14:32:04 +0100 (CET) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-477619f8ae5so38509275e9.3 for ; Tue, 02 Dec 2025 05:32:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682324; x=1765287124; 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=CzxKgbIUkNM+BfaM3eBJB+kd44Z0ws3zBBlfjb3fc6Q=; b=wuMWU6WxmGfpAiOcGKdnlxkrrWyg6S9R8STOdP0674gz8amPIa1tpGNMSlJhkOXSe+ JCTeOdidPtIx/ozMDHs/1FgX7UZWp1uONnDCt/rk8ycccVBtov0sQuI1bQpRm+qAO+w2 NCZ1N3tF8m2DZmss0Np0KI43y8YTCvNgxamGiCdR6pH0ScZa5ZjCAjaSqApWaFReDuKT gHBmxS+uxPUsEMPz0DYtGFVRuC0j7aHAngaVN5xzK5Tq5XcmU79z4ET4f9517osxVlSr fyEdDb30zs0HjzmTB3FJUuFg84KKDZGnyD733j+YhYw1kwH2eCOYcnjppe0HYrKF3kLx EX9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682324; x=1765287124; 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=CzxKgbIUkNM+BfaM3eBJB+kd44Z0ws3zBBlfjb3fc6Q=; b=si41N3aXxMkhEmFHoAsKGZWcIeyUX6s+SSRzryWJmVAorArpEPj0P8EN/hgPqPJjym dRkfrGeLRnMKiEyceQ/Oo1SPsHp+VbiUE5k2dmQAEYNfh0HwPMWFXo2iM7olveeVKanB r+qqJq6pxT8BOh+/N+L9NMgohWqAyn4BMWY9akdsDw1UoWqTXObglhycILrCPbXOmP7P KzSaH/wixY0CY8201CX02WT0ykmgSRFNxVE2wb0WFvxHzfXrU1rGrhHuTfpJgwTiJvXQ HMcUXT5g0fE+Z8+W/wsPiNM0velxG0ALcF3R6TVfoBv2URaboDJ+QgjJjuTT/MPOCBsR YwaQ== X-Gm-Message-State: AOJu0YzY/mKTyGyMtBCgqFX31F9b8xXGUho7HvT7zvjC+5+4ezuBtgSy x6agOndrBNBhtN+x1HsHS3/udMKovfXpvuvKNclZqnkezGs2MMwj0zsROvR6azoAvd0YwUj05vh 0unAP X-Gm-Gg: ASbGncsa5LFYkNKUvAyU79kNT3fimHarYKoAhqLjbRM5la3RgCLVe46jjHpXOpoB62s oKJApdUBtUHTfHHNhJtqhCazKZqwO1RrZy0xnRkh9b3x72+E2FOidL/T+MI26MkdDT3ydSVjlnK alcSljjYmMF/0JUhsjXc0PWDrLx+8+GoS4XhOvWwLlQXX2wg18jhZPYI/kh7TaBZwAIFzFhinvR eDR4x5ohbKd35rEdniYy/VF4nGZnTJBsJ9qS3sH5SuZC9sZXz1vXIIRb3wfYgS+bN36rKkommze dP3glGYJrlZHs6DnJJIu7EeJtSEFzGFRDg2uQ0+8ZekIe0o1vi85VOdhxdbzTtP7LJEFwqkFWG1 NfUdK95OA+eMvyi+cTm3tpri2rdZyLPUQ0yQhwMbiqgiIA7ZRPTGAIDmdI8zG8LlQsPJNgYvVlb D7CUl3wOIfpjG2n7sc5ao2vBer7SAxqvv4B/am0wK62GobCzlAztE+4exApmCWqpiT6d4= X-Google-Smtp-Source: AGHT+IEocgbaTzgsj6kQhUGnEvNjtNF7bate3Ak9XrknE2ZaR2EgXQ5gNgecTptCFrk/paovlK1Mug== X-Received: by 2002:a05:6000:22c9:b0:42b:2eb3:c910 with SMTP id ffacd0b85a97d-42cc1cd9466mr44452320f8f.3.1764682323814; Tue, 02 Dec 2025 05:32:03 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:03 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham Subject: [PATCH v3 03/22] meson: Automatically generate glsl_shaders.h from specified shader programs Date: Tue, 2 Dec 2025 13:31:34 +0000 Message-ID: <20251202133157.661407-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" Encode the bayer shader files into a header as part of the build process. Qcam already compiles the shader files down into a QT resource file which it references internally. In order to share the debayering shader programs outside of qcam create a generic header which both qcam and libcamera can operate from. Acked-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- src/libcamera/meson.build | 11 +++++++++++ src/libcamera/shaders/meson.build | 10 ++++++++++ utils/meson.build | 2 ++ 3 files changed, 23 insertions(+) create mode 100644 src/libcamera/shaders/meson.build diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 34e20f557..90d434a5a 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -76,6 +76,7 @@ subdir('ipa') subdir('pipeline') subdir('proxy') subdir('sensor') +subdir('shaders') subdir('software_isp') libdl = dependency('dl') @@ -182,6 +183,16 @@ libcamera_deps += [ libyaml, ] +# Generate headers from shaders +libcamera_shader_headers = custom_target( + 'gen-shader-headers', + input : [shader_files], + output : 'glsl_shaders.h', + command : [gen_shader_headers, meson.project_source_root(), meson.project_build_root(), '@OUTPUT@', '@INPUT@'], +) + +libcamera_internal_headers += libcamera_shader_headers + # We add '/' to the build_rpath as a 'safe' path to act as a boolean flag. # The build_rpath is stripped at install time by meson, so we determine at # runtime if the library is running from an installed location by checking diff --git a/src/libcamera/shaders/meson.build b/src/libcamera/shaders/meson.build new file mode 100644 index 000000000..386b342d0 --- /dev/null +++ b/src/libcamera/shaders/meson.build @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: CC0-1.0 + +# List of shader files to convert to header hex +# for the purposes of inclusion in OpenGL debayering +shader_files = files([ + 'bayer_1x_packed.frag', + 'bayer_8.frag', + 'bayer_8.vert', + 'identity.vert', +]) diff --git a/utils/meson.build b/utils/meson.build index 95d657ac9..3deed8ad4 100644 --- a/utils/meson.build +++ b/utils/meson.build @@ -3,5 +3,7 @@ subdir('codegen') subdir('ipu3') +gen_shader_headers = files('gen-shader-headers.sh') + ## Module signing gen_ipa_priv_key = files('gen-ipa-priv-key.sh') From patchwork Tue Dec 2 13:31:35 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: 25290 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 18334C32AF for ; Tue, 2 Dec 2025 13:32:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A395E60C93; Tue, 2 Dec 2025 14:32:11 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ZeNuPkcJ"; dkim-atps=neutral Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 08E5660C79 for ; Tue, 2 Dec 2025 14:32:06 +0100 (CET) Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-42e2e3c0dccso1470057f8f.2 for ; Tue, 02 Dec 2025 05:32:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682325; x=1765287125; 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=e99H68rU1D/gDXlHtAR7K7/NWQaghQ9EtXGEFE+XesQ=; b=ZeNuPkcJOPHQvJDPkai/5+T4/8cIOTp0dGQE9jORe7Heon+CQE0tHDd/U/gQfSkLv8 mL/gTDypYZR+E0d3qvfxMmKnI7bFIrpi3caDEgmh6HhfE8JRxr+MbsuBmBQ6nnputuJt fexf6fjA06szAZQ1PHc8+awcI1Sfo1D2qPRf8D2YnziefdGoHWojqRnWF2SiY8oP86Gs IksZ+w2BkpA5bBVA4K5Md6WV6kH9Z9KLvrubTJsGpUOBHJv3Ldj0VLSbHixe+Lt5qund N2+EcVBbQBHrFFSgM5bY1Dr0oeeJVeZrH0JF3j0x3RwqOwuKZJmmogQC67AFRg09K6dD 9S1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682325; x=1765287125; 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=e99H68rU1D/gDXlHtAR7K7/NWQaghQ9EtXGEFE+XesQ=; b=VDEfqZX4uqtZJuIv3DaTRu9+YynE567DKVxFW9edtGEVDqXtCgTZFTGhvNVAVtasC6 KhI9RdqnsYQeqm+3nT/wiFUPAZsZui/Fo42suEnxF43InchsfxgQS2iRIJcYnZtSoZxW tCh6Xcp4ez4hKMH0Y+OSUvn/zZCNIh1jbuYnf/1EdcUyEueYqLMAPGZpDrF/OIBfUxeX WfC9Zd8LkIJMHwEXT7g+ek5HJv5AI+1bZUkzSEShoqwVEryFeoEby0pDd90BVXh4+Fxg 31p2Okvo15KHFckbs/pJ45t9BYCLmLGuW1cLOj8AdNW5YCWePH+Ox0EBx+M4hLNUf5kW jBdg== X-Gm-Message-State: AOJu0YyuJgQmOhKOOLFaa3w2y1m9QgjgCdrkt7GwlwoAc7tnEQtKf1aa chEqwNvJtC3wyri98zg8Esa+XrgChnjAafy2WagGbpiKk3FOp7N4icXgGphRCOo0bhNvpWZxM+B Xy8xU X-Gm-Gg: ASbGncvBZ0r5KwDrKA0lDkQgcapmB7OeT/PGkI539PYFFf2sn5UaxsJfwzhtZ5wFGq0 5KlRX77P5ONOTT6zgvyk1YqILTNIQQaqAzdcRTICbsfM6iZpXeaNAIMm/ihrhI4G66vUDJ8h61R JGsx96iRKYzsgZlSbBnkAaD1EbeupH/ol9+3H2KnOKy8mp7pNsmZqq9Xq1Jd/DJavdM2yNF4juV kkjqAGixILfYNVeEG85Em81sJ9eEY3PlbIo+OXbrvBRsV/PHz4pyCrZXsMmHLI3+cfON/sEnfmX o16IZ/FRBhf71ipKiu/rHdQjexKHHRtGEsPpii1PM6xFl6nk8PLuB4n2myE8qUiNZA2YRb6wzEp NRZW1hX46OYMzU6K3j7kj23SRMQ7f/kQRw8pXjeb48JfATDj2nMiqc7bcAggUPuc3A+laTF5zh2 HjI5thmeMhC4L6ipmTI63rhnKa0vi777cERGmf+vmZRBypLXoxk/KSx2EWjv1QW1Tu864= X-Google-Smtp-Source: AGHT+IGMacyA+TUDfLoWxXSigq8DGn2x9Y+viPaIkwbcH34wQTwpwwBHp2ohGoj0CJsFA8/5RWjDOQ== X-Received: by 2002:a5d:4d4f:0:b0:42e:a70e:cad4 with SMTP id ffacd0b85a97d-42ea70ecf3fmr2782040f8f.55.1764682325259; Tue, 02 Dec 2025 05:32:05 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:04 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Hans de Goede , Kieran Bingham , Milan Zamazal , Bryan O'Donoghue Subject: [PATCH v3 04/22] libcamera: swstats_cpu: Update statsProcessFn() / processLine0() documentation Date: Tue, 2 Dec 2025 13:31:35 +0000 Message-ID: <20251202133157.661407-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" From: Hans de Goede Update the documentation of the statsProcessFn() / processLine0() src[] pointer argument to take into account that swstats_cpu may also be used with planar input data or with non Bayer single plane input data. The statsProcessFn typedef is private, so no documentation is generated for it. Move the new updated src[] pointer argument documentation to processLine0() so that it gets included in the generated docs. Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal Signed-off-by: Hans de Goede Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/swstats_cpu.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/libcamera/software_isp/swstats_cpu.cpp b/src/libcamera/software_isp/swstats_cpu.cpp index 4f7bdd231..9c03338a0 100644 --- a/src/libcamera/software_isp/swstats_cpu.cpp +++ b/src/libcamera/software_isp/swstats_cpu.cpp @@ -72,6 +72,19 @@ namespace libcamera { * patternSize height == 1. * It'll process line 0 and 1 for input formats with patternSize height >= 2. * This function may only be called after a successful setWindow() call. + * + * This function takes an array of src pointers each pointing to a line in + * the source image. + * + * Bayer input data requires (patternSize_.height + 1) src pointers, with + * the middle element of the array pointing to the actual line being processed. + * Earlier element(s) will point to the previous line(s) and later element(s) + * to the next line(s). See the DebayerCpu::debayerFn documentation for details. + * + * Planar input data requires a src pointer for each plane, with src[0] pointing + * to the line in plane 0, etc. + * + * For non Bayer single plane input data only a single src pointer is required. */ /** From patchwork Tue Dec 2 13:31:36 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: 25291 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 98E41C32DE for ; Tue, 2 Dec 2025 13:32:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F186960D13; Tue, 2 Dec 2025 14:32:14 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Zkl3B7cB"; dkim-atps=neutral Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A79C60C8C for ; Tue, 2 Dec 2025 14:32:07 +0100 (CET) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-42b3c5defb2so3807288f8f.2 for ; Tue, 02 Dec 2025 05:32:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682327; x=1765287127; 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=KNhdXYMCXvgUlmVf+twHe8rkAmqCTfmIboT5GgzpZy8=; b=Zkl3B7cBVJwhIynnC0RoJTgUcovfzGNo3oaSu+eyCpVM6t1lvwn/Tr+ubu5lryAohx xZ5RKhQXo+KA7j6fPT8aa4OVOFjL3r/jvNm20lT37a4bgNNuYlwohxob3r5IPVa6U9RV LsdEYSZJ8mwwl5YlqkwZdPo7+g3qRUz5XQ88iI86c8kbap8zcf7EfWuwwjCLdygjv5FX 3EEk6mL6iVtuTZwKwknzGQDdzcU5b+CjhWLzvahcj9c6Wfag8wU65XcE8J2p2fV+tl3i SaxTsNyuXAQEiTUU7f97VT1nqDLAidp0Yywyv0N6f0EPXhG77S00vGVYM+m60m6YcMfR a9Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682327; x=1765287127; 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=KNhdXYMCXvgUlmVf+twHe8rkAmqCTfmIboT5GgzpZy8=; b=sd1RekaoiKMtNO2fZ5TqAeBGtzPgih6zqeUoLIoqyNMxiMWSnW8FRT6GONgSHpVeHp 6fIfxPw59W3EOAptRBHuk/5PgyRxJTOu1k7bAddTZNFnRXmxnEicUcNzF4fdvcreEs11 vXT9lh+wimWXsMqPOOgaE+lyB6TPV5em/graRIJGCv/xQ91jS9T2BZQD7QadRnm8VfqU HzfMRY6UAdDxzFL3aKm3LLT8EryvgWMZZshuMvo494Arf7m1Zz4xvUPcpvKQfEocjYie cGhPb2bQdoUe7MZa47CwG8C1y3jz3d95kd7S6nVPsp1RjNQSibECVPyrawM0lnQOZPDC 5+RQ== X-Gm-Message-State: AOJu0YzVcVgzWax/QeBX4amajASRtOrSnNcdhSuRNL/XBq4K1cQnk3D6 eiokuxkvx84Odr97Yje+8o3bGLfZUoOZWIk18tR7ba/znZPTlaVkEy+ylIx0MBPPzzv9oCKWHXE GIamk X-Gm-Gg: ASbGncvEzuJ3l1ZOWJZqJEpRm8ndjEG4Uhu2YSDcoqJVRSEE9oCha92HKDu8HcvmE25 rLlpULuPETsCL7YBbevaZbW7siEGcsNhktn4bVvX5V+j7BHIW/qYqdWC3ifBrUjmWNcHqOXDHeF j9d8OICcNSloXV2NdWFbHdgbJTObSuBfNTbKLGhlgbMuyRKf9GcpMipWqYbVUM9R8HuE8u/tmFU plPCqZEBSnq0QFX50fIxk4Se7Hk5i7XGS1+VTm+sqYLy96jMQ2mibLBT5uk59DF+If3hrI+Pjm0 rgcLZBVSIL6N52jl7hOhN857SZO2oosKDlC7LfSWRw+rgT+4jEMGwmKLIltEzGf1dV4Czh9bscC 83QRKkEg+FCcYxSqjarVFIyllKPs/XyjiqVQzStP6/lJpx6IJCFKq0VepXyVUhHkkQXozSDJCEe JfUQtMyzZhqmx+pvlGMFPFCPrW44oKReJpYLw9QPx/TbZEoeWd6gdpwIaZ+427u6Xhh5PBPZ27J 6KPRQ== X-Google-Smtp-Source: AGHT+IFXvtEu6zKc/G1giIZYkGrAl2i+PdofnQGuJdkiRgnxPvJledxm0ZTilJ/QrcOMspb51CGxWg== X-Received: by 2002:a05:6000:4304:b0:42b:55a1:2158 with SMTP id ffacd0b85a97d-42cc1cbd202mr45490558f8f.17.1764682326595; Tue, 02 Dec 2025 05:32:06 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:06 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Hans de Goede , Kieran Bingham , Milan Zamazal , Bryan O'Donoghue Subject: [PATCH v3 05/22] libcamera: swstats_cpu: Drop patternSize_ documentation Date: Tue, 2 Dec 2025 13:31:36 +0000 Message-ID: <20251202133157.661407-6-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" From: Hans de Goede patternSize_ is a private variable and its meaning is already documented in the patternSize() getter documentation. Move the list of valid sizes to the patternSize() getter documentation and drop the patternSize_ documentation. While at it also add 1x1 as valid size for use with future support of single plane non Bayer input data. Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal Signed-off-by: Hans de Goede Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/swstats_cpu.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/libcamera/software_isp/swstats_cpu.cpp b/src/libcamera/software_isp/swstats_cpu.cpp index 9c03338a0..1b33ffa71 100644 --- a/src/libcamera/software_isp/swstats_cpu.cpp +++ b/src/libcamera/software_isp/swstats_cpu.cpp @@ -58,6 +58,8 @@ namespace libcamera { * also indicates if processLine2() should be called or not. * This may only be called after a successful configure() call. * + * Valid sizes are: 1x1, 2x2, 4x2 or 4x4. + * * \return The pattern size */ @@ -133,13 +135,6 @@ namespace libcamera { * \brief Statistics window, set by setWindow(), used every line */ -/** - * \var Size SwStatsCpu::patternSize_ - * \brief The size of the bayer pattern - * - * Valid sizes are: 2x2, 4x2 or 4x4. - */ - /** * \var unsigned int SwStatsCpu::xShift_ * \brief The offset of x, applied to window_.x for bayer variants From patchwork Tue Dec 2 13:31:37 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: 25292 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 8DE8BC3260 for ; Tue, 2 Dec 2025 13:32:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EF3BE60C93; Tue, 2 Dec 2025 14:32:15 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="qF66u19D"; dkim-atps=neutral Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 839FF60C7E for ; Tue, 2 Dec 2025 14:32:08 +0100 (CET) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-42e2d52c24dso1414834f8f.1 for ; Tue, 02 Dec 2025 05:32:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682328; x=1765287128; 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=qhu6ljAZBcMcHeBpfyYPkJ64VVf1ScQqCoYCholms4U=; b=qF66u19DfG6asMCPOz1H7ZcVz2SJymH96CsdAHmDJ5vRf0gKm3y3NeSyQ2IXT84U36 g9kSjQeamLdYakFLJMJwL/lz+HkrS89ZtFLiRaErQocYbK96zQPlUOFf1I8mW4EHJ4mu qqFT+s0GQGCkxlWnrj+bRiHQh0Wc05Q9/zyGAaL3lSqEDbkAMPPvSsH7VWI5O2h392q/ YTJUsorFZAk8ncQit56ThBj4RH52fAf5HJxglPnx8I8JIGLCbMWiJyPOdOEFs/MDMcXN Suh0SatFSUM84NH6Ott8CAkIkx2aKm5mBkPrJBGOk+jYl8y9C65e4dnhZp/AtVe2Xh3F NcpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682328; x=1765287128; 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=qhu6ljAZBcMcHeBpfyYPkJ64VVf1ScQqCoYCholms4U=; b=hJW3rrQO+8FLU8pi21IW0IXA34DDUx3/BmUUb45kTYK+AjYwbKqSkk0ghKv2Cgj7vV aV7g/ZCVHQH0Tf/sjWwQHddqmvtDXf005ugdXU0kdu8HqKpL1itbkTlvBBDwYsN8ehGz bxJNt6hPfNmFl8SMxCouAegN4AStSBFfknxuhT6JAND6TUJO0l5Ivc8mnEKxa8nUkuvw Y3XK/9av764e+l/RNYuZq8p1R6dxLAr2TavgDfhImUkaXMI3Y11mfbhZA3fXHN+cAWQn 7MIrJaOTzZIiQqm0iruAQgVwc2BB2SU4dlTsjcPWNWh4+IamRxmni5tIZyVLPV1324rc oS3Q== X-Gm-Message-State: AOJu0YyWZxzOKDKTYVNaE8F1I6ja3mCw4v2hMKTt2fq6P/mPryae1IiB JOIIfuUBkKkr5fjWS6R9ZloDSj881pBEv5CjTbP6bl8m0MSVPWP+yQY9VxhZhz3blodZwxbf4ti a+IdR X-Gm-Gg: ASbGncul9oQQZwmqErgNVbiZ0bkuxc37344j8S/YJmBLzhbkKiGsl2/KfAgWfzFz42I 7ii0k8BAk4HuzOcaSCqqRuG59kqQT83ipIABSLVAtdVKbaLQvwTzh/YexD8S2kEBoESpn+HiZzN b5fC1FyG+JPuSzdNa/2SdsGztrtcoWPyDdABKhpE8kjzJ3AeE/fZ82wglQ7ERHpHSfkpFdAy0yA 8ZsiR/nfoREd0QK1Uq3/05WYLBaxth7hKL8lHOrwPYD7m9jlPs107wiC/20B1GodlxaWnfNWaQo YZ2syKK9boykwRmwZN9yA+ksnWO46X3AGkUHRAbRMr9aUKni8S2Kgk8kuWXypqI3Iy0edw6e6FW LjiwvigLCssw48TFb260NO0ughKsH+L2ojlp2KomMqg5YmWVmQm+ZGLBpaQT/ni1n9xQ0XDqxPB 7AKx0J8sBUbVZq/F3TuEhBxfFNe+mHmJeYEkIitBAzPCQvum+qKt7cCBxkIqFvbKFnEMw= X-Google-Smtp-Source: AGHT+IGDz3/FKtRkosBgxifPRFtXISBln8FrjXcmWZ053ZC+pNeZzRXVHTjppCJrbz5292adk5+5mg== X-Received: by 2002:a05:6000:4006:b0:42b:3131:5433 with SMTP id ffacd0b85a97d-42cc1cbcfe1mr45464419f8f.26.1764682327815; Tue, 02 Dec 2025 05:32:07 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:07 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Hans de Goede , Milan Zamazal , Kieran Bingham , Bryan O'Donoghue Subject: [PATCH v3 06/22] libcamera: swstats_cpu: Move header to libcamera/internal/software_isp Date: Tue, 2 Dec 2025 13:31:37 +0000 Message-ID: <20251202133157.661407-7-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" From: Hans de Goede Move the swstats_cpu.h file to include/libcamera/internal/software_isp/ so that it can be used outside the src/libcamera/software_isp/ directory. Reviewed-by: Milan Zamazal Reviewed-by: Kieran Bingham Signed-off-by: Hans de Goede Signed-off-by: Bryan O'Donoghue --- include/libcamera/internal/software_isp/meson.build | 1 + .../libcamera/internal}/software_isp/swstats_cpu.h | 0 src/libcamera/software_isp/debayer_cpu.h | 2 +- src/libcamera/software_isp/swstats_cpu.cpp | 2 +- 4 files changed, 3 insertions(+), 2 deletions(-) rename {src/libcamera => include/libcamera/internal}/software_isp/swstats_cpu.h (100%) diff --git a/include/libcamera/internal/software_isp/meson.build b/include/libcamera/internal/software_isp/meson.build index 508ddddca..ea3f3f1c1 100644 --- a/include/libcamera/internal/software_isp/meson.build +++ b/include/libcamera/internal/software_isp/meson.build @@ -4,4 +4,5 @@ libcamera_internal_headers += files([ 'debayer_params.h', 'software_isp.h', 'swisp_stats.h', + 'swstats_cpu.h', ]) diff --git a/src/libcamera/software_isp/swstats_cpu.h b/include/libcamera/internal/software_isp/swstats_cpu.h similarity index 100% rename from src/libcamera/software_isp/swstats_cpu.h rename to include/libcamera/internal/software_isp/swstats_cpu.h diff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h index 03e0d7843..1cd411f26 100644 --- a/src/libcamera/software_isp/debayer_cpu.h +++ b/src/libcamera/software_isp/debayer_cpu.h @@ -19,9 +19,9 @@ #include "libcamera/internal/bayer_format.h" #include "libcamera/internal/global_configuration.h" +#include "libcamera/internal/software_isp/swstats_cpu.h" #include "debayer.h" -#include "swstats_cpu.h" namespace libcamera { diff --git a/src/libcamera/software_isp/swstats_cpu.cpp b/src/libcamera/software_isp/swstats_cpu.cpp index 1b33ffa71..55e764b0a 100644 --- a/src/libcamera/software_isp/swstats_cpu.cpp +++ b/src/libcamera/software_isp/swstats_cpu.cpp @@ -9,7 +9,7 @@ * CPU based software statistics implementation */ -#include "swstats_cpu.h" +#include "libcamera/internal/software_isp/swstats_cpu.h" #include From patchwork Tue Dec 2 13:31:38 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: 25293 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 2EB11C32E0 for ; Tue, 2 Dec 2025 13:32:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8729D60C90; Tue, 2 Dec 2025 14:32:17 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="FJeuWeuq"; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6DAAD60C7C for ; Tue, 2 Dec 2025 14:32:09 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-47789cd2083so32350935e9.2 for ; Tue, 02 Dec 2025 05:32:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682329; x=1765287129; 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=yyoWJ0Rzqed6amy1jTZnt8wvjKyWv6LvwRUBP/6g4Vc=; b=FJeuWeuq2j3bdOPlrpDDkw6xxrvB6T4p2eVXrZRpIfGWsPs6eSZZE+ZxKunLHyN/CC k4om9Ikrrk8Q2ggeE+1jJMrXZljOZv2fzTd9VmbXNRsiWZ15ZsBsxeUeFfmKMmTWmiD5 demWWn8TUQzBLYq/JB4IEBMpeWXUb+d9cx+KiOR2L9sBNxVwXiD0B/sFrLkF8SMSk/PJ NwBo7eaNsmq+x5551u+unlXRPh2zFGK7dci6gAnL0SHI9XJTNJT6JjwRNrr6xOZgEPW3 VvBokXuC2gZ9ci4R9Ds75UiYabqUyoShn+G5cVUPGiQRgtrPU16MPQ2sSHR2SxzDmtU3 vFYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682329; x=1765287129; 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=yyoWJ0Rzqed6amy1jTZnt8wvjKyWv6LvwRUBP/6g4Vc=; b=O0baHnyMGPMRNxhIVSq0ds0U/IcjyL3CvGrs1K7HyvFe5G4/5puBrTsD8EAkp3ZZBT O8pB//N43ncJhy4T5eBuCkoXjp8Br1J+wHcMoj5OXO5UnIP3DDl3bK3DTKCOQ1CunRWx fjOTF86j9eZ4AUPPHQXTT03Dg4pdSin1fbJhzrkc2SZUX9byca88QbGL2oRVDWndBrhp PBju3uFapkyyPbeVDd0zEz4G14sj44rR2sS72GzXSPw4sl2QflFA43W+7hgyIYXpLKyf g/hsXova6Jo3/rYHyJ+pGxGJ5f/Sb+anJlFkPrrDO/R/IxstdUI1OY7NLJJnr8Yr1jNL pmpA== X-Gm-Message-State: AOJu0YxQ1UyVLwvLaaQVj1o+dcIQhN5gCUbwag3e3mOLOeY4uaNtoitI 4AiCKh4rWqUqLsxCQ6F35ymg8GTpkRDxpPQI853Et2m1hyJ1yQl8TuskrPZB5IrO0FaTjxrW39+ jSuoF X-Gm-Gg: ASbGncvsKDhKyCV7c3lJKZND4b8MQ2Jgh4C0e8kMUa60n+K9SUdGetGEYUHukXPJGUX 8mQDcVs3B99GE05WpXJXoIYCr8ZiBzb2WFIMQB4u7MqosWAYCfaH8Vhv2CwDhWUD7pnqbCAqIqZ XKMjwL4A9F/1CoHhRaOvJz1qcXKFSbG8U1K66kBU2wW8xY1UKkWLmLpljATKMRXtltF39VGU27T +GLY7wbsW9NvJsy5EEkt3pxB7bkYYEKxue1KE9orVog3oWtfSOdfLvLyFbrvd+G7EvqM59bki9W 0g4tSKdlhuTgHX/qqLWElBPZhKTtVj5cDphklo39Cu5M8VlUgtV+96Rq4EseAjbYK+YWq43DzJe HWyL0XW021MLtoQokRLykMYCiGLlnAev/2fbRM/ZeOi9h2LnQZGGFb0lf2UM/ZK3H7xYtfbtsKV dCKHyM/mu6H+n+O9iNmjEmCjYWzrkG/d5I7h7TQhOnmVDQSEfjWt4Yo+SVY27KgS1c0Y0= X-Google-Smtp-Source: AGHT+IExBPtsx/U3v6pqhlHcvi6DmZSguLO4+sJnjQy1uL0nUm9usxxe3wy4elIogrnyoBSby+6zkQ== X-Received: by 2002:a05:600c:4ed2:b0:477:9e10:3e63 with SMTP id 5b1f17b1804b1-477c1164cebmr397194255e9.35.1764682328667; Tue, 02 Dec 2025 05:32:08 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:08 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Hans de Goede , Kieran Bingham , Milan Zamazal , Bryan O'Donoghue Subject: [PATCH v3 07/22] libcamera: software_isp: Move benchmark code to its own class Date: Tue, 2 Dec 2025 13:31:38 +0000 Message-ID: <20251202133157.661407-8-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" From: Hans de Goede Move the code for the builtin benchmark to its own small Benchmark class. Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal Signed-off-by: Hans de Goede [bod: Fixed up some drift in this patch since initial propostion] Signed-off-by: Bryan O'Donoghue --- .../internal/software_isp/benchmark.h | 39 ++++++++ .../internal/software_isp/meson.build | 1 + src/libcamera/software_isp/benchmark.cpp | 92 +++++++++++++++++++ src/libcamera/software_isp/debayer_cpu.cpp | 45 +-------- src/libcamera/software_isp/debayer_cpu.h | 6 +- src/libcamera/software_isp/meson.build | 1 + 6 files changed, 138 insertions(+), 46 deletions(-) create mode 100644 include/libcamera/internal/software_isp/benchmark.h create mode 100644 src/libcamera/software_isp/benchmark.cpp diff --git a/include/libcamera/internal/software_isp/benchmark.h b/include/libcamera/internal/software_isp/benchmark.h new file mode 100644 index 000000000..0680d6cd9 --- /dev/null +++ b/include/libcamera/internal/software_isp/benchmark.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2024, Red Hat Inc. + * + * Authors: + * Hans de Goede + * + * Simple builtin benchmark to measure software ISP processing times + */ + +#pragma once + +#include +#include +#include +#include "libcamera/internal/global_configuration.h" + +namespace libcamera { + +class Benchmark +{ +public: + Benchmark(const GlobalConfiguration &configuration); + ~Benchmark(); + + void startFrame(void); + void finishFrame(void); + +private: + timespec frameStartTime_; + bool measure; + /* Skip 30 frames for things to stabilize then measure 30 frames */ + unsigned int encounteredFrames_ = 0; + int64_t frameProcessTime_ = 0; + unsigned int skipBeforeMeasure_ = 30; + unsigned int framesToMeasure_ = 30; +}; + +} /* namespace libcamera */ diff --git a/include/libcamera/internal/software_isp/meson.build b/include/libcamera/internal/software_isp/meson.build index ea3f3f1c1..df7c3b97d 100644 --- a/include/libcamera/internal/software_isp/meson.build +++ b/include/libcamera/internal/software_isp/meson.build @@ -1,6 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 libcamera_internal_headers += files([ + 'benchmark.h', 'debayer_params.h', 'software_isp.h', 'swisp_stats.h', diff --git a/src/libcamera/software_isp/benchmark.cpp b/src/libcamera/software_isp/benchmark.cpp new file mode 100644 index 000000000..1a00ae569 --- /dev/null +++ b/src/libcamera/software_isp/benchmark.cpp @@ -0,0 +1,92 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2024, Red Hat Inc. + * + * Authors: + * Hans de Goede + * + * Simple builtin benchmark to measure software ISP processing times + */ + +#include "libcamera/internal/software_isp/benchmark.h" + +#include + +namespace libcamera { + +LOG_DEFINE_CATEGORY(Benchmark) + +/** + * \class Benchmark + * \brief Simple builtin benchmark + * + * Simple builtin benchmark to measure software ISP processing times. + */ + +/** + * \brief Constructs a Benchmark object + */ +Benchmark::Benchmark(const GlobalConfiguration &configuration) +{ + skipBeforeMeasure_ = configuration.option( + { "software_isp", "measure", "skip" }) + .value_or(skipBeforeMeasure_); + framesToMeasure_ = configuration.option( + { "software_isp", "measure", "number" }) + .value_or(framesToMeasure_); +} + +Benchmark::~Benchmark() +{ +} + +static inline int64_t timeDiff(timespec &after, timespec &before) +{ + return (after.tv_sec - before.tv_sec) * 1000000000LL + + (int64_t)after.tv_nsec - (int64_t)before.tv_nsec; +} + +/** + * \brief Start measuring process time for a single frame + * + * Call this function before processing frame data to start measuring + * the process time for a frame. + */ +void Benchmark::startFrame(void) +{ + measure = framesToMeasure_ > 0 && + encounteredFrames_ < skipBeforeMeasure_ + framesToMeasure_ && + ++encounteredFrames_ > skipBeforeMeasure_; + + if (measure) { + frameStartTime_ = {}; + clock_gettime(CLOCK_MONOTONIC_RAW, &frameStartTime_); + } +} + +/** + * \brief Finish measuring process time for a single frame + * + * Call this function after processing frame data to finish measuring + * the process time for a frame. + * + * This function will log frame processing time information after + * Benchmark::kLastFrameToMeasure frames have been processed. + */ +void Benchmark::finishFrame(void) +{ + if (measure) { + timespec frameEndTime = {}; + clock_gettime(CLOCK_MONOTONIC_RAW, &frameEndTime); + frameProcessTime_ += timeDiff(frameEndTime, frameStartTime_); + if (encounteredFrames_ == skipBeforeMeasure_ + framesToMeasure_) { + LOG(Benchmark, Info) + << "Processed " << framesToMeasure_ + << " frames in " << frameProcessTime_ / 1000 << "us, " + << frameProcessTime_ / (1000 * framesToMeasure_) + << " us/frame"; + } + } +} + +} /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 67a303c65..b92c6a904 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -42,7 +42,7 @@ namespace libcamera { * \param[in] configuration The global configuration */ DebayerCpu::DebayerCpu(std::unique_ptr stats, const GlobalConfiguration &configuration) - : stats_(std::move(stats)) + : stats_(std::move(stats)), bench_(configuration) { /* * Reading from uncached buffers may be very slow. @@ -58,13 +58,6 @@ DebayerCpu::DebayerCpu(std::unique_ptr stats, const GlobalConfigurat enableInputMemcpy_ = configuration.option({ "software_isp", "copy_input_buffer" }).value_or(true); - skipBeforeMeasure_ = configuration.option( - { "software_isp", "measure", "skip" }) - .value_or(skipBeforeMeasure_); - framesToMeasure_ = configuration.option( - { "software_isp", "measure", "number" }) - .value_or(framesToMeasure_); - /* Initialize color lookup tables */ for (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) { red_[i] = green_[i] = blue_[i] = i; @@ -571,9 +564,6 @@ int DebayerCpu::configure(const StreamConfiguration &inputCfg, lineBuffers_[i].resize(lineBufferLength_); } - encounteredFrames_ = 0; - frameProcessTime_ = 0; - return 0; } @@ -765,27 +755,9 @@ void DebayerCpu::process4(uint32_t frame, const uint8_t *src, uint8_t *dst) } } -namespace { - -inline int64_t timeDiff(timespec &after, timespec &before) -{ - return (after.tv_sec - before.tv_sec) * 1000000000LL + - (int64_t)after.tv_nsec - (int64_t)before.tv_nsec; -} - -} /* namespace */ - void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params) { - timespec frameStartTime; - - bool measure = framesToMeasure_ > 0 && - encounteredFrames_ < skipBeforeMeasure_ + framesToMeasure_ && - ++encounteredFrames_ > skipBeforeMeasure_; - if (measure) { - frameStartTime = {}; - clock_gettime(CLOCK_MONOTONIC_RAW, &frameStartTime); - } + bench_.startFrame(); std::vector dmaSyncers; for (const FrameBuffer::Plane &plane : input->planes()) @@ -840,18 +812,7 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output dmaSyncers.clear(); /* Measure before emitting signals */ - if (measure) { - timespec frameEndTime = {}; - clock_gettime(CLOCK_MONOTONIC_RAW, &frameEndTime); - frameProcessTime_ += timeDiff(frameEndTime, frameStartTime); - if (encounteredFrames_ == skipBeforeMeasure_ + framesToMeasure_) { - LOG(Debayer, Info) - << "Processed " << framesToMeasure_ - << " frames in " << frameProcessTime_ / 1000 << "us, " - << frameProcessTime_ / (1000 * framesToMeasure_) - << " us/frame"; - } - } + bench_.finishFrame(); /* * Buffer ids are currently not used, so pass zeros as its parameter. diff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h index 1cd411f26..aff32491e 100644 --- a/src/libcamera/software_isp/debayer_cpu.h +++ b/src/libcamera/software_isp/debayer_cpu.h @@ -17,6 +17,7 @@ #include +#include "libcamera/internal/software_isp/benchmark.h" #include "libcamera/internal/bayer_format.h" #include "libcamera/internal/global_configuration.h" #include "libcamera/internal/software_isp/swstats_cpu.h" @@ -161,10 +162,7 @@ private: unsigned int xShift_; /* Offset of 0/1 applied to window_.x */ bool enableInputMemcpy_; bool swapRedBlueGains_; - unsigned int encounteredFrames_; - int64_t frameProcessTime_; - unsigned int skipBeforeMeasure_ = 30; - unsigned int framesToMeasure_ = 30; + Benchmark bench_; }; } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/meson.build b/src/libcamera/software_isp/meson.build index aac7eda7b..59fa5f02a 100644 --- a/src/libcamera/software_isp/meson.build +++ b/src/libcamera/software_isp/meson.build @@ -8,6 +8,7 @@ if not softisp_enabled endif libcamera_internal_sources += files([ + 'benchmark.cpp', 'debayer.cpp', 'debayer_cpu.cpp', 'software_isp.cpp', From patchwork Tue Dec 2 13:31:39 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: 25294 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 CB00EC32E7 for ; Tue, 2 Dec 2025 13:32:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BDA7B60D0B; Tue, 2 Dec 2025 14:32:18 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="l8fWpyQ9"; dkim-atps=neutral Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A3CA560C77 for ; Tue, 2 Dec 2025 14:32:10 +0100 (CET) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-477632b0621so34448045e9.2 for ; Tue, 02 Dec 2025 05:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682330; x=1765287130; 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=nLU/ifYTrqqo3T8wLQWtPEibbZ9LrJLctjntqk+s2D8=; b=l8fWpyQ9lncYsVuD5h9cr5GRlfXqAQ98GUzR6QOj4M9N6jZp3y+dOyXlbH96HCNNOn Ru5zXWtD1hU3WnMrCt2veFXtC5XGo7ETcPu95i9KFoaXe3mC+7n4bugylp7vD8szLmKy z0hYglJml4ZhG62m8Wyc2IA4XXKVg8xo7Rt5Kboazzp96lzZhK/IX3Pr2SrnV78tfByx vswwYhBD5dtMpyUrCSh84n9U8HoiL6MMbADGBfhzPY7WHRQ3R3IHIkGq38iV+B2i44II YJUi6empanQpJgSkOl4ph6ruBAnmllzqqgnq1Rxr7jeM2eU1tuqMMIMRidl2VN/BUrJ3 ocTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682330; x=1765287130; 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=nLU/ifYTrqqo3T8wLQWtPEibbZ9LrJLctjntqk+s2D8=; b=wBAuVnU3MDmXbKTTBgF0mUpXr3NDrVSW7XX2k+kYKYpnyQKJQTf0/jogPWmXQxWVTH 0uJPBeT/NZin8/KjbDMJBWelf5oIfZ3t1Plhl1L8gRAMvrqDNie+hi80NSCITBSnPQ4k pDHuL1R7dOAuKfRWAnN3w9JAUiyJIJ0smgmTwiyMg+KwVbObVUitV7etoenaSoAg7/zx nTBTJSJOMsyOqwKH4iIYjTPa35rIMlhryhacqaXYk0oUFmuvtIRJSaY6Y6sHgY28FMmH JwFMojAc1USPcwhm7C98sx3XN0bGPbfKfLtJcwY50EDF1Ve6rj3YA0r8ez0vikjUSKKb aLIg== X-Gm-Message-State: AOJu0Yy/u18eQNsxBUwIjgYY5DB/WQlIwGYvKSFNNCV1sfxl8uxfhjW1 72+tyFrsrsQep4Y4ulDhfea83cz3jkleawFH6lT9ML0YkLu0Cf5zNsWcdL2BtNEPiJe1gpAIrS7 gpuaR X-Gm-Gg: ASbGncu2PyQXaLEFg7zA0guhZ2ftF1tO6SbPRHSqaUbYzIk6LI7XVsJhdwMXLvhaCl8 FlJWp7ZH/IIbwhypDQ3BtJIGRJn2LOfow9awNn4sgQbkarSYj9vBdZefjag4toXbiBp4CWcrvTp 8u8c6NCTJqK2ww9y2cdGNUffujHSjDe9YWkIf4t4vWtpjwzX542wkg2Cjd69bMtcMpwY6zWwAUp iiUEXMlAqjt1jAQem/X0YbzXKD4kY9tgCIYwouZH7OXvmxL/cQANUgAgw3kauJkMmqQ4cFlgAbf 9HXG5o8GCZ9k7g9Yxx7MD/48J8YTan70QfXS1EFbsI6uMPNgD/bS4oaIOVofHUbsQK//4S4seom ds9AsVR+KQT1zsJWPL1WOJbrscvUzEw0xqXamzclyrYaqKMvDFdiXLWXdI+6Pj2GN9AlPyigV6v mpakyY+C36oU020gXCe+kIng4oiyx5Q6gIRH8H5eq31TnC/+Nq73yFsXtTP9eU0SNlhS4= X-Google-Smtp-Source: AGHT+IGtVOFMhJfXxAA99WA3G8z01dvYl4j7ZII/fEJTqmg4KUj2I0X+bL7wN9fl3fQL7qV06JQmRA== X-Received: by 2002:a05:600c:4591:b0:477:b642:9dbf with SMTP id 5b1f17b1804b1-477c1132adbmr418475055e9.32.1764682329885; Tue, 02 Dec 2025 05:32:09 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:09 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Hans de Goede , Milan Zamazal , Kieran Bingham , Bryan O'Donoghue Subject: [PATCH v3 08/22] libcamera: swstats_cpu: Add processFrame() method Date: Tue, 2 Dec 2025 13:31:39 +0000 Message-ID: <20251202133157.661407-9-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" From: Hans de Goede Add a method to the SwstatsCpu class to process a whole Framebuffer in one go, rather then line by line. This is useful for gathering stats when debayering is not necessary or is not done on the CPU. Reviewed-by: Milan Zamazal Signed-off-by: Hans de Goede [bod: various rebase splats fixed] [bod: Added constructor Doxygen header] [bod: Squashed a fix from Hans to calculate stats on every 4th frame] Reviewed-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- .../internal/software_isp/swstats_cpu.h | 15 +++- src/libcamera/software_isp/software_isp.cpp | 5 +- src/libcamera/software_isp/swstats_cpu.cpp | 69 ++++++++++++++++++- 3 files changed, 84 insertions(+), 5 deletions(-) diff --git a/include/libcamera/internal/software_isp/swstats_cpu.h b/include/libcamera/internal/software_isp/swstats_cpu.h index fae575f85..64b3e23f5 100644 --- a/include/libcamera/internal/software_isp/swstats_cpu.h +++ b/include/libcamera/internal/software_isp/swstats_cpu.h @@ -18,18 +18,23 @@ #include #include "libcamera/internal/bayer_format.h" +#include "libcamera/internal/framebuffer.h" +#include "libcamera/internal/global_configuration.h" #include "libcamera/internal/shared_mem_object.h" #include "libcamera/internal/software_isp/swisp_stats.h" +#include "benchmark.h" + namespace libcamera { class PixelFormat; +class MappedFrameBuffer; struct StreamConfiguration; class SwStatsCpu { public: - SwStatsCpu(); + SwStatsCpu(const GlobalConfiguration &configuration); ~SwStatsCpu() = default; /* @@ -50,6 +55,7 @@ public: void setWindow(const Rectangle &window); void startFrame(uint32_t frame); void finishFrame(uint32_t frame, uint32_t bufferId); + void processFrame(uint32_t frame, uint32_t bufferId, FrameBuffer *input); void processLine0(uint32_t frame, unsigned int y, const uint8_t *src[]) { @@ -79,6 +85,7 @@ public: private: using statsProcessFn = void (SwStatsCpu::*)(const uint8_t *src[]); + using processFrameFn = void (SwStatsCpu::*)(MappedFrameBuffer &in); int setupStandardBayerOrder(BayerFormat::Order order); /* Bayer 8 bpp unpacked */ @@ -91,6 +98,10 @@ private: void statsBGGR10PLine0(const uint8_t *src[]); void statsGBRG10PLine0(const uint8_t *src[]); + void processBayerFrame2(MappedFrameBuffer &in); + + processFrameFn processFrame_; + /* Variables set by configure(), used every line */ statsProcessFn stats0_; statsProcessFn stats2_; @@ -103,9 +114,11 @@ private: Size patternSize_; unsigned int xShift_; + unsigned int stride_; SharedMemObject sharedStats_; SwIspStats stats_; + Benchmark bench_; }; } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index 341c0352c..928a2520c 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -108,14 +108,15 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor, return; } - auto stats = std::make_unique(); + const GlobalConfiguration &configuration = pipe->cameraManager()->_d()->configuration(); + + auto stats = std::make_unique(configuration); if (!stats->isValid()) { LOG(SoftwareIsp, Error) << "Failed to create SwStatsCpu object"; return; } stats->statsReady.connect(this, &SoftwareIsp::statsReady); - const GlobalConfiguration &configuration = pipe->cameraManager()->_d()->configuration(); debayer_ = std::make_unique(std::move(stats), configuration); debayer_->inputBufferReady.connect(this, &SoftwareIsp::inputReady); debayer_->outputBufferReady.connect(this, &SoftwareIsp::outputReady); diff --git a/src/libcamera/software_isp/swstats_cpu.cpp b/src/libcamera/software_isp/swstats_cpu.cpp index 55e764b0a..c931edb41 100644 --- a/src/libcamera/software_isp/swstats_cpu.cpp +++ b/src/libcamera/software_isp/swstats_cpu.cpp @@ -16,6 +16,7 @@ #include #include "libcamera/internal/bayer_format.h" +#include "libcamera/internal/mapped_framebuffer.h" namespace libcamera { @@ -34,6 +35,15 @@ namespace libcamera { * instead of processing the whole frame. */ +/** + * \fn SwStatsCpu::SwStatsCpu(const GlobalConfiguration &configuration) + * \brief Construct a SwStatsCpu object + * \param[in] configuration Global configuration reference + * + * Creates a SwStatsCpu object and initialises shared memory for statistics + * exchange. + */ + /** * \fn bool SwStatsCpu::isValid() const * \brief Gets whether the statistics object is valid @@ -144,8 +154,8 @@ namespace libcamera { LOG_DEFINE_CATEGORY(SwStatsCpu) -SwStatsCpu::SwStatsCpu() - : sharedStats_("softIsp_stats") +SwStatsCpu::SwStatsCpu(const GlobalConfiguration &configuration) + : sharedStats_("softIsp_stats"), bench_(configuration) { if (!sharedStats_) LOG(SwStatsCpu, Error) @@ -386,11 +396,14 @@ int SwStatsCpu::setupStandardBayerOrder(BayerFormat::Order order) */ int SwStatsCpu::configure(const StreamConfiguration &inputCfg) { + stride_ = inputCfg.stride; + BayerFormat bayerFormat = BayerFormat::fromPixelFormat(inputCfg.pixelFormat); if (bayerFormat.packing == BayerFormat::Packing::None && setupStandardBayerOrder(bayerFormat.order) == 0) { + processFrame_ = &SwStatsCpu::processBayerFrame2; switch (bayerFormat.bitDepth) { case 8: stats0_ = &SwStatsCpu::statsBGGR8Line0; @@ -411,6 +424,7 @@ int SwStatsCpu::configure(const StreamConfiguration &inputCfg) /* Skip every 3th and 4th line, sample every other 2x2 block */ ySkipMask_ = 0x02; xShift_ = 0; + processFrame_ = &SwStatsCpu::processBayerFrame2; switch (bayerFormat.order) { case BayerFormat::BGGR: @@ -475,4 +489,55 @@ void SwStatsCpu::setWindow(const Rectangle &window) window_.height &= ~(patternSize_.height - 1); } +void SwStatsCpu::processBayerFrame2(MappedFrameBuffer &in) +{ + const uint8_t *src = in.planes()[0].data(); + const uint8_t *linePointers[3]; + + /* Adjust src for starting at window_.y */ + src += window_.y * stride_; + + for (unsigned int y = 0; y < window_.height; y += 2) { + if (y & ySkipMask_) { + src += stride_ * 2; + continue; + } + + /* linePointers[0] is not used by any stats0_ functions */ + linePointers[1] = src; + linePointers[2] = src + stride_; + (this->*stats0_)(linePointers); + src += stride_ * 2; + } +} + +/** + * \brief Calculate statistics for a frame in one go + * \param[in] frame The frame number + * \param[in] bufferId ID of the statistics buffer + * \param[in] input The frame to process + * + * This may only be called after a successful setWindow() call. + */ +void SwStatsCpu::processFrame(uint32_t frame, uint32_t bufferId, FrameBuffer *input) +{ + if (frame % kStatPerNumFrames) { + finishFrame(frame, bufferId); + return; + } + + bench_.startFrame(); + startFrame(frame); + + MappedFrameBuffer in(input, MappedFrameBuffer::MapFlag::Read); + if (!in.isValid()) { + LOG(SwStatsCpu, Error) << "mmap-ing buffer(s) failed"; + return; + } + + (this->*processFrame_)(in); + finishFrame(frame, bufferId); + bench_.finishFrame(); +} + } /* namespace libcamera */ From patchwork Tue Dec 2 13:31:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 25295 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 15530C326B for ; Tue, 2 Dec 2025 13:32:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5C97160D1C; Tue, 2 Dec 2025 14:32:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="nXhhonB6"; dkim-atps=neutral Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AF8AB60C94 for ; Tue, 2 Dec 2025 14:32:11 +0100 (CET) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-42b3c965cc4so2501994f8f.0 for ; Tue, 02 Dec 2025 05:32:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682331; x=1765287131; 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=bSAjf5SBs8VaBO7Nn9Jd3hXZnysfsjzqN9mTKzwsXCA=; b=nXhhonB6pM6A7u7esmd1m8wBkElmxYx6wGQzwHzvfh1HOj7zo1zk1B1Fso5E74icn7 oIKluyY6GZVtg569numi6GUyFgmLYuVpIiOIl+s40FUffFmrpYKWmAT4rv8rgKLr7kbH tIcdnk1UidtfJHMXRoj1AIrHuOMtUiSySV47vKTRe5YSetrRjiZr2DJTxnYeg9VhMlvQ 3lk2p/KBgjcYmSxrchqShHdXutV0mCKe7QNQJEc/600fpS+yT+XJZH+FHAT6U3M7gDBn X6+y5bXvNXjabNugOowdbAy5whn9BHJEBaLiGNjZQ3TGjjoNRdRp0pRbGh0AvPoikqGi AQcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682331; x=1765287131; 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=bSAjf5SBs8VaBO7Nn9Jd3hXZnysfsjzqN9mTKzwsXCA=; b=dE3xX7u76Y14ofpNVV8LjMK6TLtmQVD/MIcXGLQHgV4K1IKtw8B7L0K7D12Wc79QHL VDZo/ZqNmV8wc6h0/sYFp+lhk1Reb7/QRWck38S72oGRK9PW+STj8e0ZkDxyctiiBHHU ajuySJCeqNloSTAjaQylVvtJn6d/OtToUurhGaWK9GR709elCYVdUqXoLxsFgT6zjw66 pLtNavmcuW+SPPBeRq1TQvKdoMDRZssSLNzXgmNe0Eb9M5M5PkUKnP88xTCQSNRIgwSP SLg9P36nc8PguiOVQeXYzuxHxkCCQbgDBVxgLK9gGZkV2bOi9rwmFcxExhslnZjQhV3o CgeA== X-Gm-Message-State: AOJu0Yz6I7Tj00Mm/XbFT3r4Sxs8lTmDnKNbK32POPqGSUOM7yMGuavz oQ28MLG+j6cjFNt9un9+T74ANN5BslTGXiKpbU6JNZFuh5IRBZL6DIPknKh4u3+j+igF8UT1iUh X6SlC X-Gm-Gg: ASbGncv6wFUXuOkAjr8vEKr+hnA85di0nDpxV1zrv4tsMIe91Hi0rl2x98jul4eDXKt 8uHS6Dn2kxoMojh1g3aA4nKftfxUgwkxmRoesaKEtiCkhuFOU5bH3+DYiLlvmYbQvE4OcHlQmQP aBD69XRIrnoNUCWsQACVRCN7jPMxYqsKx0GJo8E1pcQuPUmLW4WOpLavXtxumOh72g+cCKvd3vA QIZd1nKcHAtlc1T62Hp/IN+bD8PR8dPDuBzVH6LTmGXBKWAaBviU+Hd1h9wRPelAognprHnUhE2 LBXISHaQTD0GfXcy6P72WURuX+Y0DWNK89lGCvF5W8j7PxHz5G7Ruqg7kFb2BoR6DQmHefalAzt 4WBBQx6zFM9LlUYFkqlFsBaVrhTnnIapmdDeiHWhD0X+e6M48jCtaSCukS0E/yhmjlS+oQNdTtr cYD9rgfwNrib9FiUTWSd/pOHbD4yRtjcAK0VxVyzl0frHn4Fy+CyGwimcXL8Yz0Al2u2Y= X-Google-Smtp-Source: AGHT+IHq6gGU+D0cDBliyvi68Z3Xr+JzlZ/V7qLgwSltxdV6c/X825IxKtaD8hPwpMIINES296sD/Q== X-Received: by 2002:a05:6000:18a3:b0:429:ccd0:d36c with SMTP id ffacd0b85a97d-42f6d5a0b81mr2996508f8f.14.1764682330902; Tue, 02 Dec 2025 05:32:10 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:10 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham Subject: [PATCH v3 09/22] libcamera: software_isp: Move useful items from DebayerCpu to Debayer base class Date: Tue, 2 Dec 2025 13:31:40 +0000 Message-ID: <20251202133157.661407-10-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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 DebayerCpu class has a number of variables, embedded structures and methods which are useful to DebayerGpu implementation. Move relevant variables and methods to base class. Since we want to call setParams() from the GPUISP and reuse the code in the existing CPUISP as a first step, we need to move all of the dependent variables in DebayerCPU to the Debayer base class including LookupTable and redCcm_. The DebayerEGL class will ultimately be able to consume both the CCM and non-CCM data. Reviewed-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/debayer.cpp | 149 +++++++++++++++++++++ src/libcamera/software_isp/debayer.h | 35 ++++- src/libcamera/software_isp/debayer_cpu.cpp | 2 +- src/libcamera/software_isp/debayer_cpu.h | 41 +----- 4 files changed, 185 insertions(+), 42 deletions(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index e9e18c488..1e3f08673 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -18,6 +18,12 @@ namespace libcamera { * \brief Struct to hold the debayer parameters. */ +/** + * \fn Debayer::Debayer(const GlobalConfiguration &configuration) + * \brief Construct a Debayer object + * \param[in] configuration Global configuration reference + */ + /** * \var DebayerParams::kRGBLookupSize * \brief Size of a color lookup table @@ -167,6 +173,24 @@ Debayer::~Debayer() */ /** + * \fn const SharedFD &Debayer::getStatsFD() + * \brief Get the file descriptor for the statistics. + * + * This file descriptor provides access to the output statistics buffer + * associated with the current debayering process. + * + * \return The file descriptor pointing to the statistics data. + */ + +/** + * \fn unsigned int Debayer::frameSize() + * \brief Get the output frame size. + * + * \return The total output frame size in bytes as configured for the + * current stream. + */ + + /** * \var Signal Debayer::inputBufferReady * \brief Signals when the input buffer is ready */ @@ -176,4 +200,129 @@ Debayer::~Debayer() * \brief Signals when the output buffer is ready */ +/** + * \struct Debayer::DebayerInputConfig + * \brief Structure describing the incoming Bayer parameters. + * + * The DebayerInputConfig structure defines the characteristics of the raw + * Bayer frame being processed, including: + * - The Bayer pattern dimensions (\ref patternSize) + * - Memory layout parameters such as stride and bytes per pixel (\ref bpp) + * - A list of supported output pixel formats. + * + * \var Debayer::DebayerInputConfig::patternSize + * Size of the Bayer pattern in pixels. For standard Bayer formats such as + * BGGR, GRBG, GBRG, and RGGB, this is typically 2×2 pixels. + * + * \var Debayer::DebayerInputConfig::bpp + * Number of bytes used per pixel in memory. This reflects storage size, + * not precision. + * + * \var Debayer::DebayerInputConfig::stride + * Line stride in bytes for the Bayer input frame. + * + * \var Debayer::DebayerInputConfig::outputFormats + * List of pixel formats supported as output for this input configuration. + */ + +/** + * \struct Debayer::DebayerOutputConfig + * \brief Structure describing the output frame configuration. + * + * Defines how the output of the debayer process is laid out in memory. + * It includes per-pixel size, stride, and total frame size. + * + * \var Debayer::DebayerOutputConfig::bpp + * Bytes used per pixel in the output format. + * + * \var Debayer::DebayerOutputConfig::stride + * Line stride in bytes for the output frame. + * + * \var Debayer::DebayerOutputConfig::frameSize + * Total frame size in bytes for the output buffer. + */ + +/** + * \var Debayer::inputConfig_ + * \brief Input configuration parameters for the current debayer operation. + * + * Holds metadata describing the incoming Bayer image layout, including + * pattern size, bytes per pixel, stride, and supported output formats. + * Populated during configuration. + */ + +/** + * \var Debayer::outputConfig_ + * \brief Output configuration data for the debayered frame. + * + * Contains bytes per pixel, stride, and total frame size for the + * output image buffer. Set during stream configuration. + */ + +/** + * \var Debayer::red_ + * \brief Lookup table for red channel gain and correction values. + * + * This table provides precomputed per-pixel or per-intensity + * correction values for the red color channel used during debayering. + */ + +/** + * \var Debayer::green_ + * \brief Lookup table for green channel gain and correction values. + * + * This table provides precomputed per-pixel or per-intensity + * correction values for the green color channel used during debayering. + */ + +/** + * \var Debayer::blue_ + * \brief Lookup table for blue channel gain and correction values. + * + * This table provides precomputed per-pixel or per-intensity + * correction values for the blue color channel used during debayering. + */ + +/** + * \var Debayer::redCcm_ + * \brief Red channel Color Correction Matrix (CCM) lookup table. + * + * Contains coefficients for green channel color correction. + */ + +/** + * \var Debayer::greenCcm_ + * \brief Green channel Color Correction Matrix (CCM) lookup table. + * + * Contains coefficients for green channel color correction. + */ + +/** + * \var Debayer::blueCcm_ + * \brief Blue channel Color Correction Matrix (CCM) lookup table. + * + * Contains coefficients for blue channel color correction. + */ + +/** + * \var Debayer::gammaLut_ + * \brief Gamma correction lookup table. + */ + +/** + * \var Debayer::swapRedBlueGains_ + * \brief Flag indicating whether red and blue channel gains should be swapped. + * + * Used when the Bayer pattern order indicates that red/blue color channels are + * reversed. + */ + +/** + * \var Debayer::bench_ + * \brief Benchmarking utility instance for performance measurements. + * + * Used internally to track timing and performance metrics during + * debayer processing. + */ + } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index ba033d440..b562985a6 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -14,11 +14,14 @@ #include #include +#include #include #include #include +#include "libcamera/internal/global_configuration.h" +#include "libcamera/internal/software_isp/benchmark.h" #include "libcamera/internal/software_isp/debayer_params.h" namespace libcamera { @@ -27,9 +30,10 @@ class FrameBuffer; LOG_DECLARE_CATEGORY(Debayer) -class Debayer +class Debayer : public Object { public: + Debayer (const GlobalConfiguration &configuration) : bench_(configuration) {}; virtual ~Debayer() = 0; virtual int configure(const StreamConfiguration &inputCfg, @@ -45,9 +49,38 @@ public: virtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0; + virtual const SharedFD &getStatsFD() = 0; + + unsigned int frameSize() { return outputConfig_.frameSize; } + Signal inputBufferReady; Signal outputBufferReady; + struct DebayerInputConfig { + Size patternSize; + unsigned int bpp; + unsigned int stride; + std::vector outputFormats; + }; + + struct DebayerOutputConfig { + unsigned int bpp; + unsigned int stride; + unsigned int frameSize; + }; + + DebayerInputConfig inputConfig_; + DebayerOutputConfig outputConfig_; + DebayerParams::LookupTable red_; + DebayerParams::LookupTable green_; + DebayerParams::LookupTable blue_; + DebayerParams::CcmLookupTable redCcm_; + DebayerParams::CcmLookupTable greenCcm_; + DebayerParams::CcmLookupTable blueCcm_; + DebayerParams::LookupTable gammaLut_; + bool swapRedBlueGains_; + Benchmark bench_; + private: virtual Size patternSize(PixelFormat inputFormat) = 0; }; diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index b92c6a904..e55599f09 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -42,7 +42,7 @@ namespace libcamera { * \param[in] configuration The global configuration */ DebayerCpu::DebayerCpu(std::unique_ptr stats, const GlobalConfiguration &configuration) - : stats_(std::move(stats)), bench_(configuration) + : Debayer(configuration), stats_(std::move(stats)) { /* * Reading from uncached buffers may be very slow. diff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h index aff32491e..ecc4f9dd0 100644 --- a/src/libcamera/software_isp/debayer_cpu.h +++ b/src/libcamera/software_isp/debayer_cpu.h @@ -17,16 +17,14 @@ #include -#include "libcamera/internal/software_isp/benchmark.h" #include "libcamera/internal/bayer_format.h" -#include "libcamera/internal/global_configuration.h" #include "libcamera/internal/software_isp/swstats_cpu.h" #include "debayer.h" namespace libcamera { -class DebayerCpu : public Debayer, public Object +class DebayerCpu : public Debayer { public: DebayerCpu(std::unique_ptr stats, const GlobalConfiguration &configuration); @@ -41,21 +39,8 @@ public: strideAndFrameSize(const PixelFormat &outputFormat, const Size &size); void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params); SizeRange sizes(PixelFormat inputFormat, const Size &inputSize); - - /** - * \brief Get the file descriptor for the statistics - * - * \return the file descriptor pointing to the statistics - */ const SharedFD &getStatsFD() { return stats_->getStatsFD(); } - /** - * \brief Get the output frame size - * - * \return The output frame size - */ - unsigned int frameSize() { return outputConfig_.frameSize; } - private: /** * \brief Called to debayer 1 line of Bayer input data to output format @@ -112,19 +97,6 @@ private: template void debayer10P_RGRG_BGR888(uint8_t *dst, const uint8_t *src[]); - struct DebayerInputConfig { - Size patternSize; - unsigned int bpp; /* Memory used per pixel, not precision */ - unsigned int stride; - std::vector outputFormats; - }; - - struct DebayerOutputConfig { - unsigned int bpp; /* Memory used per pixel, not precision */ - unsigned int stride; - unsigned int frameSize; - }; - int getInputConfig(PixelFormat inputFormat, DebayerInputConfig &config); int getOutputConfig(PixelFormat outputFormat, DebayerOutputConfig &config); int setupStandardBayerOrder(BayerFormat::Order order); @@ -140,20 +112,11 @@ private: /* Max. supported Bayer pattern height is 4, debayering this requires 5 lines */ static constexpr unsigned int kMaxLineBuffers = 5; - DebayerParams::LookupTable red_; - DebayerParams::LookupTable green_; - DebayerParams::LookupTable blue_; - DebayerParams::CcmLookupTable redCcm_; - DebayerParams::CcmLookupTable greenCcm_; - DebayerParams::CcmLookupTable blueCcm_; - DebayerParams::LookupTable gammaLut_; debayerFn debayer0_; debayerFn debayer1_; debayerFn debayer2_; debayerFn debayer3_; Rectangle window_; - DebayerInputConfig inputConfig_; - DebayerOutputConfig outputConfig_; std::unique_ptr stats_; std::vector lineBuffers_[kMaxLineBuffers]; unsigned int lineBufferLength_; @@ -161,8 +124,6 @@ private: unsigned int lineBufferIndex_; unsigned int xShift_; /* Offset of 0/1 applied to window_.x */ bool enableInputMemcpy_; - bool swapRedBlueGains_; - Benchmark bench_; }; } /* namespace libcamera */ From patchwork Tue Dec 2 13:31:41 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: 25296 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 4FE0FC32EA for ; Tue, 2 Dec 2025 13:32:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6410A60D16; Tue, 2 Dec 2025 14:32:21 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Z6dClsls"; dkim-atps=neutral Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 19B9D60C88 for ; Tue, 2 Dec 2025 14:32:13 +0100 (CET) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4779cb0a33fso57734675e9.0 for ; Tue, 02 Dec 2025 05:32:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682332; x=1765287132; 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=KQPTsn/KLpLpdnxwrT8L2zFzJbbxCaiz8WDvZQ7olVM=; b=Z6dClsls72P/CDnOVHWrmJHSWm/2rNvmZ1Ohf/2+IVeY7nMDcLi6qU0s2/liOEbukp Q2AFVSF63Ndo8G0qLsnme71cVUrzMJqziSR7FNLCrnhvomMOokLDqBQHI/vg99Ckwtzi zM94Sct6+m7QMiyWYkCs6/Qn8T5dEH5d1TiydlTjznejEqS2U5p8zQSjanbPk71L0i8/ wy82JZsk2eKyXmibiRmqZ3axxeMN8Bozg3ZZaWyWeP26Xa8WlIcR5ghmuRx6L13L3STX Ao++/N0VT1MpjuK2mTRekH05lbXorhyMZp8XQwl01bRp9VuWwwmw42BCppNkQboJTP4E Aeyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682332; x=1765287132; 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=KQPTsn/KLpLpdnxwrT8L2zFzJbbxCaiz8WDvZQ7olVM=; b=QAlNn90XYuuoDr0vl2yQ+eGmuumz99S8xWDBq0La7wSqJUY6tnAAXbJe/T635ReHIl CXZe+G7Rw7j6dDHmuRi+s3JtbQFWbqyQPDspsdZIGWYW7o3t4SUvApZ9e53UnigK2OAg OkADrzw6FhpV2PsS28wunwxsCXAjgYIECIlZRFZiQE5AWk3NwBYqjYLvUyIaI2YJQi8P 0mDWJ6Rdv0pLdb6BhPTBCSszjtm+N9tsp0yQiPLQm274oozFka0mZQ5Em5nszM+AVd+t XX9m2tmywqYNlzW9aWe7TMaqMwNCvanwhJRgN9WyE5kCeCKrMkKZuCyWKlhg3vokq97N 9Dgw== X-Gm-Message-State: AOJu0YxT7IaGWUZGIw8KGHzRohxSc5I/q0Y8xIh1b8hAlfa/UGh3AttU bAi3YQzpWu00eH2SdftQTows90OKA5sEWA4yv1POSOynQiUWRDrnLqw8wb+w2B3GCdvXoXWKrNo ga7nP X-Gm-Gg: ASbGncsE2m9i+hI7wV3SYjF5ICOMzHE6HDk852/+0UZ9FmRpTfL6lMMc4md3CydqEyX qyFyhbW7MDA4RX/FW6/UhIVEV4qka9iVEsieawv5YbCkRbbZW8FF90DFzVGZvw9v3/zNvIiwZQZ ZFK1/IkqvcSH0LdjxYMbqo6pFhzdnUBH2H8FGhUrMiylqsWYCAg4UC2VF5WqdqwBoF86bqxxInF Oqek36fcknLQp/Z740E2hKwPVr87CnhM3R44VJzZxKfZfKQINL29SYmhXSiSyaa72iS+d7DnAO0 z1h1W1Z70pL+1AlzXPRFtsAdWg3kZOr7/fgyuCVIuuDUK4ViVtEfZfjtMAeHR30+01q4IQZijOy hH3HrqbcG/h4+Mv8Nm9x2+1tK1vKn4DkAgHJHs8oeDSEjJ+HmjSbpZPpDGhu27KfE9Lc+YBMnEe MdeG3niVgAkAm66jP3Nd3KPcgoylHWm7ArvqWkkc3NPdwxsgDu5ma/H3UMgUWhHzfzpS8= X-Google-Smtp-Source: AGHT+IHboZ31W7T4jzanYYc591RzQoc78FjKsMHQrrxgjf5eAJy4cYgKcX12+cCHmliK65gF0Kz3ZA== X-Received: by 2002:a5d:5d83:0:b0:42b:3257:f175 with SMTP id ffacd0b85a97d-42cc1d0cd34mr45406119f8f.28.1764682332250; Tue, 02 Dec 2025 05:32:12 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:11 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham , Milan Zamazal Subject: [PATCH v3 10/22] libcamera: software_isp: Move Bayer params init from DebayerCpu to Debayer Date: Tue, 2 Dec 2025 13:31:41 +0000 Message-ID: <20251202133157.661407-11-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" Move the initialisation of Bayer params and CCM to a new constructor in the Debayer class. Ensure we call the base class constructor from DebayerCpu's constructor in the expected constructor order Debayer then DebayerCpu. Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/debayer.cpp | 11 +++++++++++ src/libcamera/software_isp/debayer.h | 2 +- src/libcamera/software_isp/debayer_cpu.cpp | 8 -------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 1e3f08673..8cadfaadc 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -109,6 +109,17 @@ namespace libcamera { LOG_DEFINE_CATEGORY(Debayer) +Debayer::Debayer(const GlobalConfiguration &configuration) : bench_(configuration) +{ + /* Initialize color lookup tables */ + for (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) { + red_[i] = green_[i] = blue_[i] = i; + redCcm_[i] = { static_cast(i), 0, 0 }; + greenCcm_[i] = { 0, static_cast(i), 0 }; + blueCcm_[i] = { 0, 0, static_cast(i) }; + } +} + Debayer::~Debayer() { } diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index b562985a6..f4373ddeb 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -33,7 +33,7 @@ LOG_DECLARE_CATEGORY(Debayer) class Debayer : public Object { public: - Debayer (const GlobalConfiguration &configuration) : bench_(configuration) {}; + Debayer (const GlobalConfiguration &configuration); virtual ~Debayer() = 0; virtual int configure(const StreamConfiguration &inputCfg, diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index e55599f09..8f42d706b 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -57,14 +57,6 @@ DebayerCpu::DebayerCpu(std::unique_ptr stats, const GlobalConfigurat */ enableInputMemcpy_ = configuration.option({ "software_isp", "copy_input_buffer" }).value_or(true); - - /* Initialize color lookup tables */ - for (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) { - red_[i] = green_[i] = blue_[i] = i; - redCcm_[i] = { static_cast(i), 0, 0 }; - greenCcm_[i] = { 0, static_cast(i), 0 }; - blueCcm_[i] = { 0, 0, static_cast(i) }; - } } DebayerCpu::~DebayerCpu() = default; From patchwork Tue Dec 2 13:31:42 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: 25297 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 46F76C3257 for ; Tue, 2 Dec 2025 13:32:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A86A560D0B; Tue, 2 Dec 2025 14:32:24 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="nUtHyror"; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1D2DB60C8C for ; Tue, 2 Dec 2025 14:32:14 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-477bf34f5f5so36196365e9.0 for ; Tue, 02 Dec 2025 05:32:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682333; x=1765287133; 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=eHob+j+mTcN+DmZI0Jjd1599ddaYfYHVsPKAaDomjAg=; b=nUtHyrorpmd84Q2szErt7OY320nqbZNiBtW/AZde0xsypcQqkraSt9DIlASqkbM/EE 4FqiC5gF834thZ3YzmOxshhDQTtW3v7DuVwwiyOmw/kY6u/dK6G+b7WadEdLjoDAHBjE yjqG+NyRG+BppVqFfmWrXU5Xp8pcBeH8RpEYOiFLmfGlZRKxEu8+iswoLov3+/6TIarJ xXOafuhcZ5jU+q3ol1MzhrIwEO97wIJyI4bJzWLeSmBNBiQq1ErDilX20oMhA9psNtRn KaYmMzd64C/0ytjfN7zOFGMP/RtvNDsn/P3JFTdEpb83QZpkccdHHmSlmlkBdB284sWS 2q9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682333; x=1765287133; 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=eHob+j+mTcN+DmZI0Jjd1599ddaYfYHVsPKAaDomjAg=; b=tRctv+yywdEbqohHFR+Jn2eSYZCwlLvuSqG4AQWMfSv3mJq/xet8UdO2m+iHDxMa3A 4NEv19A6wxSFLSg98sDtIV5QwCqO1Sv3Pc4KcaqNBVjrzpeCJGwvgUII/X4mKoH+7Mgh 7g8Ee25wihCq7jhOQK/nxb/lrCIBSRLl7S5Hw1MErN33AZ1fG8ksH1B3h92tz7JPkDyc qhi5fgMbrYy1f1fFpSnP4wQhP975n+tjhxaLieH8kDMpmnUEFULOIF5yIFtdzTOj5Lsb KfeCeeB4S4QzQl619w1wPg16Xkoa99yBkOxN3Pzwiw63rqukTZQQFDyfbVkLSSr0EjfQ UdAg== X-Gm-Message-State: AOJu0YwYh0toU6OKWMp9deW/Gy6tu8qeSi88O50uoOt8P9cQgxsHO7l3 WNtOAQqRoyqpDeomkv9Qax07y3zrx48faq2X5dlLBM9ZjNsRvUWbPR7NAn3/mtbZ5JyquUCDZMV v9T8l X-Gm-Gg: ASbGncsT93nSgbDtuzgnDWEln9cuKycCWe7etUt5b1Go/sUiKKtt0QWMCHQJxIJ5Xwh vpO8RZhIC9SKorHmrpFPfwd3WueEv3UnFrEyGtqeC5f/0aediCpydlCPbh42k5tmMARlbFlLIDW CRy0dhY+uLgzfaS1lW9b700Ag42jOoKUqDqhKuUnusbOcfuRQVrfmLiSFUy6XVpLZI0XrCNHizr T7q4A0C478IG1JgKMvgpVb/B4HVNQs9N1pnUlLDc8107jjC9+1hFibOPR4wsAGQl3yRz3fh1+Za D0E01zu88/+8EQyh5SvQVGZcCz5td/wRK56Qx2fuPLN145KOnldPnCSFYdyP9DP5zDmxEm3pODz BYoFr2+alt4HVHuD4KcenQLEkW61hpP8n055cK8INpqiyaQavBtpf806lFnx+K6iTuA9Rftb3ap 3PVK2lbaG0MKuegJTsE8lfzS/xhzmlUZ+U6zB2ggV+EIuaDH10baA11pLXBvWhggMcN54= X-Google-Smtp-Source: AGHT+IH45vLV5fKOXC82R9Mr/pZXwM9s5zTKvOwbbSliygXuCVFBXXrJ7ryiNLaUDevshfUuundZYA== X-Received: by 2002:a5d:5d85:0:b0:429:c851:69ab with SMTP id ffacd0b85a97d-42e0f35a730mr31038773f8f.55.1764682333407; Tue, 02 Dec 2025 05:32:13 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:13 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham , Milan Zamazal Subject: [PATCH v3 11/22] libcamera: software_isp: Move param select code to Debayer base class Date: Tue, 2 Dec 2025 13:31:42 +0000 Message-ID: <20251202133157.661407-12-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" Move the parameter selection code into the Debayer base class in-order to facilitate reuse of the lookup tables in the eGL shaders. Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/debayer.cpp | 28 ++++++++++++++++++++++ src/libcamera/software_isp/debayer.h | 3 +++ src/libcamera/software_isp/debayer_cpu.cpp | 20 +--------------- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 8cadfaadc..cea30af67 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -336,4 +336,32 @@ Debayer::~Debayer() * debayer processing. */ +/** + * \fn void Debayer::setParams(DebayerParams ¶ms) + * \brief Select the bayer params to use for the next frame debayer + * \param[in] params The parameters to be used in debayering + */ +void Debayer::setParams(DebayerParams ¶ms) +{ + green_ = params.green; + greenCcm_ = params.greenCcm; + if (swapRedBlueGains_) { + red_ = params.blue; + blue_ = params.red; + redCcm_ = params.blueCcm; + blueCcm_ = params.redCcm; + for (unsigned int i = 0; i < 256; i++) { + std::swap(redCcm_[i].r, redCcm_[i].b); + std::swap(greenCcm_[i].r, greenCcm_[i].b); + std::swap(blueCcm_[i].r, blueCcm_[i].b); + } + } else { + red_ = params.red; + blue_ = params.blue; + redCcm_ = params.redCcm; + blueCcm_ = params.blueCcm; + } + gammaLut_ = params.gammaLut; +} + } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index f4373ddeb..6903caae8 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -83,6 +83,9 @@ public: private: virtual Size patternSize(PixelFormat inputFormat) = 0; + +protected: + void setParams(DebayerParams ¶ms); }; } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 8f42d706b..6be5cdbd5 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -758,25 +758,7 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output for (const FrameBuffer::Plane &plane : output->planes()) dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write); - green_ = params.green; - greenCcm_ = params.greenCcm; - if (swapRedBlueGains_) { - red_ = params.blue; - blue_ = params.red; - redCcm_ = params.blueCcm; - blueCcm_ = params.redCcm; - for (unsigned int i = 0; i < 256; i++) { - std::swap(redCcm_[i].r, redCcm_[i].b); - std::swap(greenCcm_[i].r, greenCcm_[i].b); - std::swap(blueCcm_[i].r, blueCcm_[i].b); - } - } else { - red_ = params.red; - blue_ = params.blue; - redCcm_ = params.redCcm; - blueCcm_ = params.blueCcm; - } - gammaLut_ = params.gammaLut; + setParams(params); /* Copy metadata from the input buffer */ FrameMetadata &metadata = output->_d()->metadata(); From patchwork Tue Dec 2 13:31:43 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: 25298 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 93321BD80A for ; Tue, 2 Dec 2025 13:32:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1648B60D23; Tue, 2 Dec 2025 14:32:26 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Qg7Xczmw"; dkim-atps=neutral Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2C62460D14 for ; Tue, 2 Dec 2025 14:32:15 +0100 (CET) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-42e33956e76so1121408f8f.3 for ; Tue, 02 Dec 2025 05:32:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682334; x=1765287134; 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=Bh1xFO5NOzK/gF5i4+/9KWqgioiivN0r41v6p9dQA20=; b=Qg7XczmwuM05CSUxUqjJLsahc/dlJRRAXCsYTScOgGSZ+9LmTAHbRrDxvDvo1i7jEM 8Z+8evIfCGgy3OfqWjq4SKlzdK82BgA0zIoTD9oBa0zlpKzbzF+m1v4rpYxrLpwQlOWa +LFh2f8bi3BEr6TLKyVCbL867kCYENkWM1avRNsSWFT2CC2LmKJ113orhEkM23xtijCX rGIxr17gF2iKmfkmt97eMLC3Ksim7+bb9bpt/4UHjrIverOAVoysNjo8lxRUj6Lbmswk WrQSMK2k/l+BHUAwtQ0rYWcrpX3h9wl6afoH7/ySqq0XkaSj3K++3WlDruRAblgkas4y j6Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682334; x=1765287134; 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=Bh1xFO5NOzK/gF5i4+/9KWqgioiivN0r41v6p9dQA20=; b=O6hvwxDS+ddojk8mjj5tpX3ZpAz+5YD4HnrgnuLKNtL0EGRmQ2QVwffM3YOdIiY+7Z ZtTwYApdnBr2m90f5DpeqPca1SE5ZKh+11qbyQXoR0buLNy8zO2BRw5sQB0RCtweeoVV y6xZiwrPaDnCwkVwu/Z6I1i7kc7G7SQ093lGjlI5Z6FH42LE+zB2ZxhHuAynB4ohFUAs Swm1cC2/5qrui9Z79KwzIF3MAjmlULOvIGAfnwHIyD0kbHVzPi8CMcGkYw2QJ+XD/wnB qexrpF3LSG6nKbAzMzAt7KhbQqY0snBDJCGZInPFZZpDHheSZr+YiNtWJNLCFstJI/zT n1pQ== X-Gm-Message-State: AOJu0YyYqNw4o3kCzIEf7CLylrGrR7PqBbKa3VO3+Lch7D2nhb6E0UPd MPNe/V94r5Ha6E4R3IPitcF6bS9K56g4rpiVDcf7qq2Sasv24CCYkzz25pdrtSdsU1AZTTAIAnm qF3Nu X-Gm-Gg: ASbGncsWgJPHBORS8fQF6TRxRdhvy/o/ZcVWbkicimiwzy2YFNuL02RDVe0pDTqYeEE xV9+qfzepaUcz+WCh0Oq8ocNWlEGJAT60oQ/j7ybq26IvU0Ydf8lkoG40VKzshoKP3OkQsMsJvb mSVd4JD4JMdEpIsm6mFuysYc4EClX2wqtBRXJq+buQmzNGi3Usbrmu9igS/AGEZCSf3tHyVtjQB 6RH1HKnHJWwrEeWj48gs3+c86LS3N4vpRvchhVotGs4OPslzrvmwhA4mnVailLKECGcQuJRWRNe JVvS5Q2sIyr51u0YLX1J26zfkAgoVYw8ZaOQ9ouEPDlYg1iJmGd+XKWSskfUodlgijJnYeRWaWs riuW5AQjKxLS0qpVti+cxv5AKLjnzoq2X7JYSNB4OasN7XujltjbLNqBqjK/ul0mlEP4ELPDjBv CRWxZLYtpI5tsRz47ZWJlLZ8RJopPdPeQyvvo472TQ0jXgIev4doSK55+dTaK3bPlNgFk= X-Google-Smtp-Source: AGHT+IFelnZN6DqrBF1bCehBrJ+WoHesdp+6IiCB0RsJv2KHboHSG5Q+BLe4lMFu0KWAC/a9McDqWQ== X-Received: by 2002:a05:6000:2013:b0:3ec:de3c:c56 with SMTP id ffacd0b85a97d-42cc1acce0emr45239021f8f.16.1764682334427; Tue, 02 Dec 2025 05:32:14 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:14 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Milan Zamazal , Kieran Bingham Subject: [PATCH v3 12/22] libcamera: software_isp: Move DMA Sync code to Debayer base class Date: Tue, 2 Dec 2025 13:31:43 +0000 Message-ID: <20251202133157.661407-13-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" We can reuse the DMA Sync code in the GPUISP. Move the code we need to the base class. Reviewed-by: Milan Zamazal Reviewed-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/debayer.cpp | 13 +++++++++++++ src/libcamera/software_isp/debayer.h | 2 ++ src/libcamera/software_isp/debayer_cpu.cpp | 6 +----- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index cea30af67..544921656 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -364,4 +364,17 @@ void Debayer::setParams(DebayerParams ¶ms) gammaLut_ = params.gammaLut; } +/** + * \fn void Debayer::dmaSyncBegin(DebayerParams ¶ms) + * \brief Common CPU/GPU Dma Sync Buffer begin + */ +void Debayer::dmaSyncBegin(std::vector &dmaSyncers, FrameBuffer *input, FrameBuffer *output) +{ + for (const FrameBuffer::Plane &plane : input->planes()) + dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Read); + + for (const FrameBuffer::Plane &plane : output->planes()) + dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write); +} + } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index 6903caae8..d2893d81b 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -20,6 +20,7 @@ #include #include +#include "libcamera/internal/dma_buf_allocator.h" #include "libcamera/internal/global_configuration.h" #include "libcamera/internal/software_isp/benchmark.h" #include "libcamera/internal/software_isp/debayer_params.h" @@ -86,6 +87,7 @@ private: protected: void setParams(DebayerParams ¶ms); + void dmaSyncBegin(std::vector &dmaSyncers, FrameBuffer *input, FrameBuffer *output); }; } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 6be5cdbd5..8f1b4e53d 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -22,7 +22,6 @@ #include #include "libcamera/internal/bayer_format.h" -#include "libcamera/internal/dma_buf_allocator.h" #include "libcamera/internal/framebuffer.h" #include "libcamera/internal/global_configuration.h" #include "libcamera/internal/mapped_framebuffer.h" @@ -752,11 +751,8 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output bench_.startFrame(); std::vector dmaSyncers; - for (const FrameBuffer::Plane &plane : input->planes()) - dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Read); - for (const FrameBuffer::Plane &plane : output->planes()) - dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write); + dmaSyncBegin(dmaSyncers, input, output); setParams(params); From patchwork Tue Dec 2 13:31:44 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: 25299 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 842B7C32F0 for ; Tue, 2 Dec 2025 13:32:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9227B60D25; Tue, 2 Dec 2025 14:32:27 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="qKH7tcZT"; dkim-atps=neutral Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8BC1360D1A for ; Tue, 2 Dec 2025 14:32:16 +0100 (CET) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-42b3d7c1321so3410564f8f.3 for ; Tue, 02 Dec 2025 05:32:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682336; x=1765287136; 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=Kob/ToaFoFnln8JxOvYeUhkJB1Nasllbl3ZD4CR3Ky8=; b=qKH7tcZTwS1/E40Wq67h2fjXUvXp2FlyS75cbwwt5h99YWXNS10m7vHEvZTcLG5aNb CJBPnv8mZw261kLAu/9sFUy3iib3AQ0BatIzjkbDAVUScPsYLxBzv6goZGTqTGbo/qEv GFjkxpiCqfOZ74grbBrMJtycfGZ0E76R+wlwNRtsR/uWoVD1SyAqJ3WUvNYmwJmLXS2+ tdyoMh1qHv2cEqgnzbDX/eixsxg3O4Cecxq8wOWvKMt2A7ntwV+XqALiKB2ev0Xvi9LL WW3xFXt/A7rklLYuRpWsoSBRsagk6pwj+qe5sdcQp0N5/ZaBP05yYM4pQKa11DHhoQNe 7kFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682336; x=1765287136; 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=Kob/ToaFoFnln8JxOvYeUhkJB1Nasllbl3ZD4CR3Ky8=; b=jZWfrRj/C8KobS0XuFG1GUiZ4fKSwGQtytHt4zH2xqtcivdkLwSMWV4FOog37w5e9c Y1cmsijBDC6gqObhU20j1I3aB+Yb69Vpr+KXngo/yw0ZedzmQraqqVqroIWOZ5FsiiQY 7Pc4ClIgewHysW0VXqnBD0ICNOLXiTUhirc8uIYjTcsvejbRnwQi7KvjBvNyXsLL6JN1 SMLTapb+N0cvAzMmT8uJcbQF6Ln+OnRZ0jNmsfCUpYT5B4W61Cp6GBKlS9+Is7Ef3BJf bWjsU4N8wJv3ZKORYJ0Q6z5kaNtdKJfuMrlXWNsHwT/pcpK9BB+rgNerEwHVG9KwphLQ IgkQ== X-Gm-Message-State: AOJu0Yzl2V4jgrZ1mbIMPjRbzwgLPuHUHgrwaP4qZq3LfSZjq0amlN1V kcgbr3mjDHwmCIGZY1qHfpYCxu7rysrjiDqC42uUuQBwfTwD9hgmS/VheOxcv895ahK9m6AE12A viX4B X-Gm-Gg: ASbGncuLLhJj0zrm9QCsnFWak3f9kHNNgpakxU0mkcfaNOivHGqQed3EFY2rwfWCOWK n+d3xrWoYjov0KNAvwRSP/Zdt5Pc+0Af0ulBDmS6APppaBjPZWawZt3Ijxysuorxxf1o+szfzVI 5MEnMMRpYBJgT0JZu9Gf21QkIM5AnPm1wwQkfl3+526brlC4e1aEh2uZl2GyCCFi/oFdcImzWyp R+wJ5iB5Ze+V8HdjAt81mijByE8kl2Q5SU9cvUMsigmkxScGntECIz/dj33zXuwzxCS32vKbulb WM1I7FJZJVXLbch0YTdGNYe6xwuR74chouatSI3cbb8m6JWMa4pWdx14PxMvdX851CAQHnOJQAx qPTeSVw3GC5b/OA30CBzM4vBiF/2rJ7bZTF8VhtWEFIq1VSmUuYWidiN7nO5J1glDIRTd1aeJ1f cNojTZlxfpwXrClj+ova5XkvGwm4IqoZqc5X/UkSG9rZCbUOagtEzkkyzNn6/IhxmwRcY= X-Google-Smtp-Source: AGHT+IEHLk2xmBepjZEggwrYobPHQ0HuHjHcT+RcmpfBtnSyMJjgjg0ixmxfyMLG4dk4XHDxWSTBYA== X-Received: by 2002:a5d:588c:0:b0:427:813:6a52 with SMTP id ffacd0b85a97d-42e0f356812mr34777110f8f.41.1764682335796; Tue, 02 Dec 2025 05:32:15 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:15 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Robert Mader , Kieran Bingham , Milan Zamazal Subject: [PATCH v3 13/22] libcamera: software_isp: Make output DMA sync contingent Date: Tue, 2 Dec 2025 13:31:44 +0000 Message-ID: <20251202133157.661407-14-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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 DMA sync output buffer from the GPU need only have its cache invalidated if the CPU is going to modify the buffer. Right now this is not required for gpuisp so only act on the output buffer if it is non-null. Suggested-by: Robert Mader Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/debayer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 544921656..158128f30 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -373,8 +373,10 @@ void Debayer::dmaSyncBegin(std::vector &dmaSyncers, FrameBuffer *inpu for (const FrameBuffer::Plane &plane : input->planes()) dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Read); - for (const FrameBuffer::Plane &plane : output->planes()) - dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write); + if (output) { + for (const FrameBuffer::Plane &plane : output->planes()) + dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write); + } } } /* namespace libcamera */ From patchwork Tue Dec 2 13:31:45 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: 25300 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 53680C32F1 for ; Tue, 2 Dec 2025 13:32:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B3ECE60D26; Tue, 2 Dec 2025 14:32:28 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="uO7bcIgp"; dkim-atps=neutral Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C1EC060D13 for ; Tue, 2 Dec 2025 14:32:17 +0100 (CET) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-42e2b90ad22so1250284f8f.2 for ; Tue, 02 Dec 2025 05:32:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682337; x=1765287137; 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=PYxXfqRVTKkcbydoq54khVfP7mMuF5TcbppUiqX56+k=; b=uO7bcIgp6LhHezZ50HU7cC/WByA2ebaS/BsH3uSBcbjeGV0t+IM9S8KenyTfNj9cbK Vq0rqVKiR7D6cUhZ00PcKrlKvWHtHv0YMOXmEPMURtUtrnfjtXiR07HPEG44mo08O3kV j9cRA2Zwc6/XuH73YKBnvnCkINLPHzkKi4vuuIPFPf5N1inhl/KqwP53zAE7AUsZi3LE 4Bus27nENlkqeOhjixVE6872Ac1lc/PqvcWPPWwFk3vqLkKkqK6ZhYVfxjHWIw+FG3Cm 78t0MHjSibwTEc8PU23Dqfz+yr+FlifwBusjz3Gull/5jlP5kqWT8K1H6WrANRwWFl7y b5IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682337; x=1765287137; 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=PYxXfqRVTKkcbydoq54khVfP7mMuF5TcbppUiqX56+k=; b=jdKH19PDWRPfF/z5iy6Sj25KToioecU1g55peIRZQNSw1eaVisywIIfbhGAjyYdDzJ lohMQBZYw9vA1fK4yYBEcX0/kdgcOsGrJKkCid/sJZIee7JivXQVW6WykAdCIThmJK+n aMVlOmaEzq8E7eBe3xReR1N1Cf3aGsFfOl/mo2uRAkjBuD5pqr+HfK6R53t/0z8tRy/N gFKjdkjCgwiMNWwRlBGM33hUh/HL9bgMJthKGYBQ5QzxZtF6B1DGguyQMlsDndXCzigH qVrVM0nhobUjIidHZRmYmTRj5jrQREWwWsAepVCJUbOy3HUh2/cvY2RjPupWu6qodzhv RPHQ== X-Gm-Message-State: AOJu0YzBQ/a7scRx1g60na2xwLzkFwYcqWTlJ/RxRAgNDKRm67U3Zm4f 3o91N43UBlJSCPIdE6waB2NkgaTblgVmQZVlUTgY37UOZc61iC0kSRNMFj3myvjxIYWlupWUahd /oAtQ X-Gm-Gg: ASbGncudw0SAm7BIiUEsn1OeoShd18KejfTc/tZuX4LwOXDgt1GVusoefiezaB2WS5/ IE241MWT6VikJ+D9gwWZ8ERi4kCtbt1BV1tmSoObEH2W1Ta1hpZ8oPQ7u3EKMEnHxGcYTEc7S82 wPXQ3Sgd6Rlk+I+3Wf23baevgBl+vItIbXSEox4jCBaycMFAZHC6r8Jtcuq1X+mRF0NALeq1CPp qU+N8R6HNFXi348PGue+hpeF4D8HDymUrHL3P9uaYPdOq/7LMopwT8i6+42C3RW1nNtC+9GeUum SjmnF5hOBG7AF9DZzhLY+3bZG7mO9DcLvavmnI1lt6uvuga2XFlmqQCGtWkOE/CFHsaSh++5Krw FWTXYK1XZHPRScZQMNayXRA6DZwUVep4Y4ax5Rc/V3+L2/cgVu+dF5c70mOf1gOH30/oSgGxFHe R/ZyIR4/VaKgRJ1WIzK6yOHzuG3xPp61pv5yv0yCUqIoE4T/PMEjeBPdXmjT89y1lXtCo= X-Google-Smtp-Source: AGHT+IFd1FJe3hoF32cpqoAnMjWpyF0gAjbul2WCqwrm38qMiRA+TWs0k7e/0ZpbrY9sUhrqijelPA== X-Received: by 2002:a5d:5d12:0:b0:42b:3062:c647 with SMTP id ffacd0b85a97d-42cc1ceff02mr46248902f8f.21.1764682337038; Tue, 02 Dec 2025 05:32:17 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:16 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham , Milan Zamazal Subject: [PATCH v3 14/22] libcamera: software_isp: Move isStandardBayerOrder to base class Date: Tue, 2 Dec 2025 13:31:45 +0000 Message-ID: <20251202133157.661407-15-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" isStandardBayerOrder is useful to both CPU and GPU debayer logic and reusable as-is for both. Move to shared location in base class. Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/debayer.cpp | 10 ++++++++++ src/libcamera/software_isp/debayer.h | 2 ++ src/libcamera/software_isp/debayer_cpu.cpp | 6 ------ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 158128f30..1d135b278 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -379,4 +379,14 @@ void Debayer::dmaSyncBegin(std::vector &dmaSyncers, FrameBuffer *inpu } } +/** + * \fn void Debayer::isStandardBayerOrder(BayerFormat::Order order) + * \brief Common method to validate standard 2x2 Bayer pattern of 2 Green, 1 Blue, 1 Red pixels. + */ +bool Debayer::isStandardBayerOrder(BayerFormat::Order order) +{ + return order == BayerFormat::BGGR || order == BayerFormat::GBRG || + order == BayerFormat::GRBG || order == BayerFormat::RGGB; +} + } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index d2893d81b..ff4a92c15 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -20,6 +20,7 @@ #include #include +#include "libcamera/internal/bayer_format.h" #include "libcamera/internal/dma_buf_allocator.h" #include "libcamera/internal/global_configuration.h" #include "libcamera/internal/software_isp/benchmark.h" @@ -88,6 +89,7 @@ private: protected: void setParams(DebayerParams ¶ms); void dmaSyncBegin(std::vector &dmaSyncers, FrameBuffer *input, FrameBuffer *output); + static bool isStandardBayerOrder(BayerFormat::Order order); }; } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 8f1b4e53d..00738c56b 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -288,12 +288,6 @@ void DebayerCpu::debayer10P_RGRG_BGR888(uint8_t *dst, const uint8_t *src[]) } } -static bool isStandardBayerOrder(BayerFormat::Order order) -{ - return order == BayerFormat::BGGR || order == BayerFormat::GBRG || - order == BayerFormat::GRBG || order == BayerFormat::RGGB; -} - /* * Setup the Debayer object according to the passed in parameters. * Return 0 on success, a negative errno value on failure From patchwork Tue Dec 2 13:31:46 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: 25301 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 EFDEEC32F2 for ; Tue, 2 Dec 2025 13:32:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2511160D13; Tue, 2 Dec 2025 14:32:30 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="a0malalK"; dkim-atps=neutral Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EAD3F60D17 for ; Tue, 2 Dec 2025 14:32:18 +0100 (CET) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4779cc419b2so56870815e9.3 for ; Tue, 02 Dec 2025 05:32:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682338; x=1765287138; 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=lfymFnUumpfpGi9F2+IbOl+GrSQcUmyE43/IcLR2ZZQ=; b=a0malalK5Zn03YF/lBGb/mHhPlN3ohKxRHBhkhQJ1Q/xnCGs/YPc4tVbjwiKR/Q0qT GuFIl8qnDTz80EmMuPDXCVQhx5Sj0x9XwrjY8TGO8ydWKku5Dtl4WvNgwpVFe6pQbOCX fJycNAJ4JmcWgRBJoKoxwYX+cLGXxaiSXng40IqKsf6cCogEnH5gaOIC4ljqy7EyftZn B7tB0PkiK1zrYlgSAQ9URA7hpC2CYjwGcGCldFL7lR7/vxanHeyKLqhyxVZK+TqrX4md 4osM00lylDyNCAAAMFSZFCoUIiUl7jrj6m+TOaB+bzy2glNzq6s5RyeHMaGRyrba96Yi pFdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682338; x=1765287138; 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=lfymFnUumpfpGi9F2+IbOl+GrSQcUmyE43/IcLR2ZZQ=; b=bQ9ItdlsEJDB6wJJgLvk3SOJP3rgObKetVtk6VKFagTH8PhuRgJHY9gcL7vjAD0ugk IXHuzJ04WM+M/OaT9t3QYtDMbhn6fnhqj2BtSi7zh+JTpW7ku8Zdw7QxI6TDMwEl4E+k 1uch7ym60NgsP69ITxtJJHGERN6Gs35/jDhO/HLAcNYsFx8/183Y3JneILsRAxU7PQC9 G+7zjhdYERefJhZF6CzedcyTstDgN1oaXCDjsV54YmbzfHsqfIM91OmlqpcaF0FuW6yP iBJOxQin3kbUcfpvkorKCreFhrhk2Y//xE+uQ+v6WXBaR50eYzhctP7o8aEHzVN111sL 9ryQ== X-Gm-Message-State: AOJu0YwhyHraLgOMDws9QnTTYKHFUwrwfsX/aTPhceOYg8yul8yNw8Ga F4PmV+nqJFfIe+zXy4HLL6KriRfjhEm12087kEvc4tnHJmgzeHALgBnqSojoBI3zPB1BFHQUyV1 wL+fW X-Gm-Gg: ASbGncsc9zVp3bxF68Rnw/gkeBu0vzzg/ebtxnbE1QndsGhqPXd+vXzpD97Ov52K/6N VUIauDqufPrxQtw1igKqYP094VCQ5+1myOjJz+f1sS8ZLCO49Xq4/rAdl1/NWCP9ZcJo+s6Z0jZ gbNyV6wcL3BVXS/DotHnYJx4ph3998ciHmVsZneNa9+X0zS52LfAtd2De3AwTn5Nk8sCpZf0n7i a71xE31OVhKlm5uPPwqUMbZu54wkxs0u4++rknxpRWJBmtzYXGFue25mtaUeqrN5/7Ouf0eK5Ln 6bsVMwsk8fj1/icC7Xf6eydk0Isp3cXUP7b63bihFdGY/8HMy4KPWxeFBUVYneegc7FOXy74Nuu 9iM+AaLOXxbdOH+Q1zBe73yL08qRwv1Tvm7vn3DZj2Husm2PXgXVyfbD44EAORhCDACYVcY8roB uu//it5rfaE2breR+lgllGut5Tm2lkgvkUkyLbH1Fbl2UB85qLF9AYdnkZSOPLCz/W1eo= X-Google-Smtp-Source: AGHT+IH+u5UkfLTD9xyGDNV4Vr/D2Np+eYCZBJLLkM0HPhUDxAbZVf4EkSZbJyFJjDy1CCVKbMTbVQ== X-Received: by 2002:a05:600c:5252:b0:477:582e:7a81 with SMTP id 5b1f17b1804b1-477c110328amr424495355e9.4.1764682338008; Tue, 02 Dec 2025 05:32:18 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:17 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Robert Mader , Kieran Bingham Subject: [PATCH v3 15/22] libcamera: software_isp: Start the ISP thread in configure Date: Tue, 2 Dec 2025 13:31:46 +0000 Message-ID: <20251202133157.661407-16-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" EGL is not thread-safe and in fact associates invisible handles with the threadid of the calling context. As a result we need to make Deabyer::configure() and Debayer::process() in SoftISP execute on the same thread. When we call Debayer::configure() in the egl class this will setup and egl context for us which is associated with the calling thread context. Hence when Debayer::process(); runs it must run in the same thread as Debayer::configure() or the hidden Gegl context handles will not point to the same place. Move start thread into configure() as a first step towards this. Co-developed-by: Robert Mader Signed-off-by: Robert Mader Reviewed-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/software_isp.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index 928a2520c..afa4eb7a8 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -265,6 +265,8 @@ int SoftwareIsp::configure(const StreamConfiguration &inputCfg, if (ret < 0) return ret; + ispWorkerThread_.start(); + return debayer_->configure(inputCfg, outputCfgs, ccmEnabled_); } @@ -346,7 +348,6 @@ int SoftwareIsp::start() if (ret) return ret; - ispWorkerThread_.start(); return 0; } From patchwork Tue Dec 2 13:31:47 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: 25302 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 31FEEC32AF for ; Tue, 2 Dec 2025 13:32:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B353660D35; Tue, 2 Dec 2025 14:32:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ci2YkulB"; dkim-atps=neutral Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F1C2460D1B for ; Tue, 2 Dec 2025 14:32:19 +0100 (CET) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-42b38de7940so2703046f8f.3 for ; Tue, 02 Dec 2025 05:32:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682339; x=1765287139; 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=rr0TUjkFqW0qHaZrb+Vym+rnScQurGqndBbCE4iGO5s=; b=ci2YkulBzN9vIhIEsnv2rbML8PhYxHfhrr8pw40Bi4CuCsoWJP6qC2hj20BD4mNHL8 85RJd0yanmHcO7CCa4g+H9D42HKVHAXzE/PBnVe8UjvzRGCQo4RbDtwZhdrpIaYAcIWS 24NU9/cbjnqfPFvPUmDEI81e5AypmcYvjOBQ7BHI3baP1Q0aiJoUkZ01uiKEKLtwj7s0 cbbCknO9visVyPrGdu04zeeLRD6+GYHNfjjfvn4bajYzGeJtNaTKhcUOeljPaaY0k8kh TXFIyJHHzqIazzat7PWqG9138QRRnkh7nB5FdbmpZ386/X+NC+Txv275AN1DlxvpBem2 EfBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682339; x=1765287139; 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=rr0TUjkFqW0qHaZrb+Vym+rnScQurGqndBbCE4iGO5s=; b=dSdXOOzY+CXlLi7bJuIPUi2hhFiqDqFysc/EVdxUkMtoTLcCoMppgCTgSHrXjjTQoD QSQOJNF9Edaj87GdwXDwe8R7pReHv9B3VRFURzm3glFVXKazJiCEWpiaZNTkPBgYx+GH 1eIzkBrwHecJAEz/TufNPVUuZByaH/o6MjvzxYA1P48phRCl1qeHGLfV37PK/8uy/37M BeeOsXDDj0vr2qD/rbE7gjmWS4gC5BYQq03PIMB+Uq1J0p6zouFHjPHtW46FwVhIL8T0 zvb7lZOiUEM5ourpvXZ/h9RIPhU4P/IQunoGYVGidNl7FduHwu7BTLcSfl9FqMVhH1Mx 1zeQ== X-Gm-Message-State: AOJu0YzCOIkBAoOKA/gr2aUeOaf9OTNeR1xHJfUJ/YbInlbmZ+pQ5ocf FU63eHJrEaLmxstziTXxUG4MYC+jAYAE3A0FL2c5K532cio+JmQV3Bj4kc6gFXNmjifbT7v8GLN ta2GT X-Gm-Gg: ASbGncuFZLlXzDC52NnvKs0ofEYcv9jsHdL/SAqNdWhmwukSBlhc4bC0Bo8qAVuj5eI 1b4sUBFqSiSJFAHl6ULiabTAjDrmX2mIYZJZ+hLwcoxglxnGk3BZDgwxmeJOeNca9M1S/odCTT0 E3ssIpmPzMSEDd1emQC8i+RHZ63JVN0hXQ7KKNHJxTyzk4cu6PmjqsRZ2/x6gNllj35ruWRVZY3 dCt/9mC3PmasJjgVEoWAZG4OEGdDpNeULz6IHJU4OxzZ3dOhtlr3AvEtRhliGExAnWrDcHYMDDZ HeHzY0kCaCgH1qA3yCi6jp+tzhxEzagHgRK+WiD3jhsJ6oqNQt94N2dYJ6v2Pp8K0Akd7S1Tr7k IGWONpDU8ExxeH9k+xBoK3XCMHGqgOXn7t6M/dLR/iD6GOCbA6NtCaUVam+o86txZrB2uKCD+5L YMVzELixQUtvf76K0+CcH+wuW17fQ0K7Q8sOgwREDoMbex476DrfLnqmoAKOaDHTAlDT8= X-Google-Smtp-Source: AGHT+IEYbJZrVRrMPzmzqBr8eBobKC4vHTuyzddDvZ5zar5ctZQ/3QxY/Q69aAXZxJYNf2DXotoo/Q== X-Received: by 2002:a05:6000:4028:b0:429:bc93:9d8a with SMTP id ffacd0b85a97d-42cc1cf3c21mr44488030f8f.37.1764682339176; Tue, 02 Dec 2025 05:32:19 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:18 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham Subject: [PATCH v3 16/22] libcamera: software_isp: Move configure to worker thread Date: Tue, 2 Dec 2025 13:31:47 +0000 Message-ID: <20251202133157.661407-17-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" EGL requires both configure() and process() to operate on the same thread. As preparation for that, move current CPU configure into the WorkerThread with a ConnectionTypeBlocking invocation of &DebayerCpu::configure. Reviewed-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/software_isp.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index afa4eb7a8..4f6792122 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -267,7 +267,15 @@ int SoftwareIsp::configure(const StreamConfiguration &inputCfg, ispWorkerThread_.start(); - return debayer_->configure(inputCfg, outputCfgs, ccmEnabled_); + ret = debayer_->invokeMethod(&DebayerCpu::configure, + ConnectionTypeBlocking, inputCfg, + outputCfgs, ccmEnabled_); + if (ret) { + ispWorkerThread_.exit(); + ispWorkerThread_.wait(); + } + + return ret; } /** From patchwork Tue Dec 2 13:31:48 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: 25303 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 9756CC32F3 for ; Tue, 2 Dec 2025 13:32:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 152F760D1F; Tue, 2 Dec 2025 14:32:33 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gBKbwXrs"; dkim-atps=neutral Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 67E3360D1F for ; Tue, 2 Dec 2025 14:32:21 +0100 (CET) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-42b3c5defb2so3807469f8f.2 for ; Tue, 02 Dec 2025 05:32:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682341; x=1765287141; 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=Tg/LFmOYwGkiUiyeOgsMC6wUGyRuydBpKVxRE0sdxus=; b=gBKbwXrsD8IQb/0mgoFC8m0tdIhPUM/0Iwy4K0UYsMf8L+gf64zwksIocgy2ibyDVe 9gRuWjBsfXb9ubolbTxfX+KYWOhmh+J8usFfbKN+ZkEmLnEdBly2TtQDfPybPpsZl4Qg p5Mr3PQtjfU8NGEZoNYICB+AZbe+itmlvsf+5IGBZd3JlfsRNjLgDE9ytEJMlDwdPE3V elnZmcwoFdhR+LWLdk6Yl7HprJ4yunnr86HVYESnx+TZDv9y+QD/N79GIWuU8WZwgNI4 TA20mhKINWW40PeoURP5NO6+TFi/z4GgEI/YfDaYx/Wk7doVX+vUSXPCvmvP0r59fgzV Q6vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682341; x=1765287141; 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=Tg/LFmOYwGkiUiyeOgsMC6wUGyRuydBpKVxRE0sdxus=; b=h+RgsCMpy32gUP3w5opy9LB1FAAZo4iMF6/yqVzJENlleyBKZt4SxPSa9OZgoAuTxp AjSQeD53Lui4Fjiociod1oVJh1dXEnAP6mhlQ8nzDWSS9Nz+pGno36JdMGGWk/GwrQcb q2hkCC//epWB1WFC95xxkY2b/rMlKsHq4ODGybRtYFR0uwLUFvr+B4noLLB4xF0EBwUw rgX/qhwCj/nlnN2IGjCuIHSTIfnBKR2suhkZtBh8jZ1DbxIsNwzco5qoJdfTdsssAY0T vjWozc4J2zT0tyYBPfFKYPFf0AX8zkdLTr6cusIDLm2dVxJgZ0UoXP6IY+k2c360JKxR qjsg== X-Gm-Message-State: AOJu0Ywxj6/KFC3f73C+uTGqLHJQcBenKLdiw2UsQiCW0/qRvofAc1a4 LvFvOtSWCvo6dtrRpDBV2Q2XtDDK1ouXbN/9wa8fQmWTYZrusOXOGkMVN506eRt4ChyONXVlFG6 w6Da3 X-Gm-Gg: ASbGncuVXOuHvLbVOQI9CAEX3KXB0o6hByOgWAJPymFZpLMNFDhSh3TEUulDffsEc0j 6WeGInBD1YUroW8sK0r8jN524XSHgpyAFFOE0T8ExJ0B502sLmEhg0oNOp4jqtuD7U2u9euTyjW ARxvW5GiLwap+SgDHoSFeN15CUnXHSOrQ11cqqHk0+f+t9nmhmzTbntJO3cAf0dHAigDoLoaRFC z2ktTRJTMGcah/Iez08v19i2PSqUlmHpNmGJaP5uk/9IWxwwdjWyZG+Be713tH3yHq1SqvmGb9n QPWmmnuQiV6y+i+MGhNcTFLMNMQAkU0Y4YX2DIzZNg90bhSgw0PCbJtPoL+hnVyKwZ79QfxKGhk VjLVPLyn4DT+L6S3dJSt3CbPBlL+mjKsxeQ5q77t76WI+MGUcm3U6KemWz6jhxzKyuTpFp8zJAA t1CTkS4clxD2A2LxBh/ol/YWmMWZ/g1cGJLtFTD+tkrgGyltLnbtmyQzReHeFPJBxexR7wOSD2U qgdbQ== X-Google-Smtp-Source: AGHT+IEqPPe24H6F2MIPekC3VJHco0AMtEVv7uhuBtKIb8y4S4Eqm0Mkr3gYeX9DIP4TmfN3Sf/MEA== X-Received: by 2002:a05:6000:4022:b0:42b:3746:3b85 with SMTP id ffacd0b85a97d-42cc1d198c0mr42444785f8f.45.1764682340571; Tue, 02 Dec 2025 05:32:20 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:20 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Milan Zamazal , Kieran Bingham Subject: [PATCH v3 17/22] libcamera: software_isp: debayer: Introduce a stop() callback to the debayer object Date: Tue, 2 Dec 2025 13:31:48 +0000 Message-ID: <20251202133157.661407-18-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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 eGL class wants to be able to teardown its sync_ data member properly but, doing so in the destructor means we can't make the eGL context current and thus can't tear down the sync primitive properly. Introduce a stop() method to the debayer class which triggers from the softisp's stop method, allowing a controlled and appropriate tear-down of debayer-egl and egl class related data well before the destructors get invoked. Reviewed-by: Milan Zamazal [bod: Made method blocking not queued per Robert's bugfixes] Reviewed-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/debayer.cpp | 9 +++++++++ src/libcamera/software_isp/debayer.h | 1 + src/libcamera/software_isp/software_isp.cpp | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 1d135b278..dae1f12d9 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -336,6 +336,15 @@ Debayer::~Debayer() * debayer processing. */ +/** + * \fn void Debayer::stop() + * \brief Stop the debayering process and perform cleanup + * + * In the DebayerCPU case this is an empty stub function but + * for the GPU case this does something useful. The stub here is to + * ensure the right version of the virtual gets called. + */ + /** * \fn void Debayer::setParams(DebayerParams ¶ms) * \brief Select the bayer params to use for the next frame debayer diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index ff4a92c15..30bad9651 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -48,6 +48,7 @@ public: strideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0; virtual void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params) = 0; + virtual void stop() { } virtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0; diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index 4f6792122..c0ff91cc4 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -367,9 +367,11 @@ int SoftwareIsp::start() */ void SoftwareIsp::stop() { + debayer_->invokeMethod(&DebayerCpu::stop, + ConnectionTypeBlocking); + ispWorkerThread_.exit(); ispWorkerThread_.wait(); - ispWorkerThread_.removeMessages(debayer_.get()); Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this); From patchwork Tue Dec 2 13:31: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: 25304 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 C0717C32F4 for ; Tue, 2 Dec 2025 13:32:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2BC7160E27; Tue, 2 Dec 2025 14:32:35 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Tt4s7D+8"; dkim-atps=neutral Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6FEE660D1D for ; Tue, 2 Dec 2025 14:32:22 +0100 (CET) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-477563e28a3so36799615e9.1 for ; Tue, 02 Dec 2025 05:32:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682342; x=1765287142; 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=XKx6dnLcAAKiMuvnL7lnAZrPjjjZBylNVwjMOuMrIMM=; b=Tt4s7D+8Qf5arUKGbRXDdFioKIn77Tv5NwP8EIdjPP17Oy3aOy7N/eNzZA5FTsCM7r KP9AKx//9zGOQr04ocVihTvG0z5UthiHdT8PC8+DUNanjmloxwCDIP3S0ky1UiBdfjh1 jheOOb3oj4b7MG7UUFaZwKsuVKEN6NjW3m4FcCvluIWMdfqWBCuus17kVuuQmJp9H3Kq Mb+pO6HVk0A03FVIGXBrJNVrapgi+DKlgQLPW6J3D2bzakNRG/z2tNkt3ovNWGGJ3nGK 0IYeKcjGXUHUUF9hxW7PIVVd+cuSl81IdvAdwJUx6YKILQAo+DEwmHFuaYI45PBidh5d pjgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682342; x=1765287142; 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=XKx6dnLcAAKiMuvnL7lnAZrPjjjZBylNVwjMOuMrIMM=; b=grlO43Kw94NlUoFVP4kbzi6agl6rVKfkbzksqnLA/xllN1x3NEgyl5qRnibf9Q6eip uD9ULUCMW2aPti5bEAimKqYdpKtJz02gkqqbluglDqapgohgxMKU3LDcHqHOj/0IJAEy nkBK14q3QEpYWzz6dPd2XKJ3nH1A9epS7pFwamfq9e/T1uUowLM9RdEBFRrAWuR9OoVG Dml05k90+6b6gCDa6X0CJkNLmy/1Ee2NA/MmQ4UntbnoYLpWpo60jj2Bj1UQmScoXoSN vKdGupsQNuy4yx9RRe7nYmI3u/gx74nSvc01ecTgbU819pRVkET6o+2Rnnp+7FhnI8wE Albw== X-Gm-Message-State: AOJu0Yw6Diro/A3xbVQsPmfpFmh6RuxSL0g0AC7zJtL/G8WfoHfpWiHg Y+9NeofHkUVbBnRFyOrMCtiEiC9nMbdgXt7+/bzi3RXqJz+KwogsZRFEQAKij7/NCDQuVz7H1/x CL6kr X-Gm-Gg: ASbGncujlABJ2BCMLyF+MIeYnXeV8ADQfE6Tb/HuyOsBKtmRtvjoDZgmMM6pN/DrclA yShgu/UJ6ktREWx3AW/2t+oa+U2SyF25rBVlNmIJR5y5dhM+3URU9dh2D7BTMwKF9OHUQBEZpYb DrxGLgyBb1mK5GF42UkgznJ78AE62cwhLJPjyvZbi1XUPpSmBf8YqasU2hRW3BHOveDZY0DNY0W npW90WH/xJO2O0ksdvx9Vf8KCvezQAMDifnkQXB2y9cOQYrecFVnifOyRQWckCvof3tDES8724J QFrV2U0LwJQtIruiUDFY0YWyIBINlXeekuJJNAP6D9ZW8k07EFC3IHEGf7hp3GkjbCHXP2uciig F641YrbcTlQN5FoG/nSR91PHjkcVPOMCbuxBe/0/esAyD0t/hG47BJAlj3rjRpGT8YsA8oAPpJt TGlzA2xXHE5RtiyMmbN8GU5AupfV+LDnZOKTRkdySuuTXNZkNyeu1u41KyRxU/OYo3aA8= X-Google-Smtp-Source: AGHT+IHD67lytfHakPZ/BKvvXyCtSJbqrYmOdB+xxY+nOlJmNtRyrWvNWY9OMFe6PcNDhFnb1xgnZg== X-Received: by 2002:a05:600c:314f:b0:477:a1bb:c58e with SMTP id 5b1f17b1804b1-47926f93e8bmr26236355e9.7.1764682341737; Tue, 02 Dec 2025 05:32:21 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:21 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham , Milan Zamazal Subject: [PATCH v3 18/22] libcamera: software_isp: debayer: Make the debayer_ object of type class Debayer not DebayerCpu Date: Tue, 2 Dec 2025 13:31:49 +0000 Message-ID: <20251202133157.661407-19-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" Make the type of object Debayer not DebayerCpu thus allowing us to assign the object to either DebayerCpu or DebayerEGL. Reviewed-by: Kieran Bingham Reviewed-by: Milan Zamazal Signed-off-by: Bryan O'Donoghue --- include/libcamera/internal/software_isp/software_isp.h | 5 ++--- src/libcamera/software_isp/software_isp.cpp | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h index 786246592..ad89c9b3c 100644 --- a/include/libcamera/internal/software_isp/software_isp.h +++ b/include/libcamera/internal/software_isp/software_isp.h @@ -37,7 +37,7 @@ namespace libcamera { -class DebayerCpu; +class Debayer; class FrameBuffer; class PixelFormat; class Stream; @@ -94,8 +94,7 @@ private: void statsReady(uint32_t frame, uint32_t bufferId); void inputReady(FrameBuffer *input); void outputReady(FrameBuffer *output); - - std::unique_ptr debayer_; + std::unique_ptr debayer_; Thread ispWorkerThread_; SharedMemObject sharedParams_; DebayerParams debayerParams_; diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index c0ff91cc4..638d9a6e6 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -267,7 +267,7 @@ int SoftwareIsp::configure(const StreamConfiguration &inputCfg, ispWorkerThread_.start(); - ret = debayer_->invokeMethod(&DebayerCpu::configure, + ret = debayer_->invokeMethod(&Debayer::configure, ConnectionTypeBlocking, inputCfg, outputCfgs, ccmEnabled_); if (ret) { @@ -367,7 +367,7 @@ int SoftwareIsp::start() */ void SoftwareIsp::stop() { - debayer_->invokeMethod(&DebayerCpu::stop, + debayer_->invokeMethod(&Debayer::stop, ConnectionTypeBlocking); ispWorkerThread_.exit(); @@ -401,7 +401,7 @@ void SoftwareIsp::stop() void SoftwareIsp::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output) { ipa_->computeParams(frame); - debayer_->invokeMethod(&DebayerCpu::process, + debayer_->invokeMethod(&Debayer::process, ConnectionTypeQueued, frame, input, output, debayerParams_); } From patchwork Tue Dec 2 13:31:50 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: 25305 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 E4318C32F6 for ; Tue, 2 Dec 2025 13:32:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2D6E860D2E; Tue, 2 Dec 2025 14:32:36 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="SVTXga2A"; dkim-atps=neutral Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5F94C60C8C for ; Tue, 2 Dec 2025 14:32:23 +0100 (CET) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4779adb38d3so40879445e9.2 for ; Tue, 02 Dec 2025 05:32:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682343; x=1765287143; 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=gUmuV/z7G3dP1f3bLqB1UdRo5tMX4cRhpEPrzATFtaw=; b=SVTXga2AA4MzR1tVEDcKkia2d/XLqZ0BjCKycyf0JaYa+HMvvKi3wIW/46YbVtUL2U EZvU3tfCUf7Cf6y9HvjqN0m6wLJNr3SC6IwcDI+AhPbEQDdp7s1AI3wVNuFIZvUOK1Ny ddUxSArMq4tIsRSb+6RNO0NR3tPicv/hIFMfljUFBpw8Etst+EE0VBDTDU/+/ArowdnK JyUeoh8dGcOiSWoYEJ3ZWqg5CsEM7vzlBCAyDFK+Rbf873/v+NG5tP3cN8Fhl8ObxA5c ORtgd6MFT1SX1ueRZhenj9ghobhggpySmsvymvNBEuu0EoP5iH9u7kMSEhgWGnSc+r3Z wSWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682343; x=1765287143; 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=gUmuV/z7G3dP1f3bLqB1UdRo5tMX4cRhpEPrzATFtaw=; b=hYY6sb/93GoqqZALNUEee2/I9kaj1clUZxwZyhx4KzbNImD/vPC/Y/xb1F+QxHK8Z8 D7dU/A4IezmhbH9X5BKjy2UCABdS1xS02Os2Ibk+IZKZO4iqse3LDz99+3Jrle2HpQ6J mGqApOYe62Fv+0GKKUZ+qCRfMhCrR+XXmKFaWslaKPn/HNiXEoWr6pWiLp5ehb2QXz1a /CGBqDjhwTHIaXqqNllf7Sz0MOn3R3PwrCrB14cbyF4h8hPPyuJUru6Rpp8QsQfSqtoG pvVnwbiVmx8LCAU9IspisOwITgRlpg5hP5HHgUvEAGZhBPTzxYSe9mIJEYtyyWauIywg hZDA== X-Gm-Message-State: AOJu0Yx9C7M+yo2e3jtHKh78KGJO6uSGip6PzUlRHEOLcSbTVMiajnz3 Q115a7/qJ3UA2PojZgBRPgz4iFdqPZpFvLQGK8Gi2SYPgZCuAJDdK4DLUVOmQb+Od6ECtbYbjXB P0Yoe X-Gm-Gg: ASbGncspYXmK1a/JWoWrHY2AG71zcoiXUUz+OyPuTnS8vEVXkvXeAY7FyTjCwGpBmoJ lTrFDzYiENBlBh1RqljWNVOH0UNLxn8LTAseNoblTQFydFYOleV6wYCqMP8m8In5kDWdw4xNG3s 0hqyaz1VnqtRaaKZLWqY10Jn9QS5LEtbg8WsL8e6kA9OIqM53lEji51PK/gcTxj8S/Gr0tpd52z MQYNvpQGl9cVl6jhYhorNnBvZaZPVH+Zntk7l0KPaXD3UgIqvPo8yBRe7ihpCrvJHExUtWt/PQ7 WEh+1y1u/ChjEyN1VY9dvfPMSvt3dK18zlILdBbp9tDK9DMUlIKiabxq5zlxwWJI9jhDGFOs7Bx lfh8kjyvjwq615tVHMWJr4GnkOp3WgPivuwjqXChAOdXNsi50rl0TN3nIo8wctXbtGOX01A0m6H vFRwYNcxzEZKx1aQAjkh+jEc9cLcteSaRl7AEVFw5kIT/xvLOFINZmt4QpYYxWfanXcZzU9LfcM jPqCQ== X-Google-Smtp-Source: AGHT+IHb7tLrpITkVqdYAQ7qoPKz9D2P6xJ9vZlNWYU6UOiV853XtpDbSbAvNA6vOaZj/D5/SbGUdQ== X-Received: by 2002:adf:b30a:0:b0:42b:3592:1b92 with SMTP id ffacd0b85a97d-42e0f34fdd3mr24491080f8f.47.1764682342564; Tue, 02 Dec 2025 05:32:22 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:22 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham Subject: [PATCH v3 19/22] libcamera: software_isp: lut: Make CCM available in debayer params Date: Tue, 2 Dec 2025 13:31:50 +0000 Message-ID: <20251202133157.661407-20-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" Provide the CCM calculated in LUT to the debayer params structure for consumption in the debayer shaders. Reviewed-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- include/libcamera/internal/software_isp/debayer_params.h | 7 +++++++ src/ipa/simple/algorithms/lut.cpp | 1 + src/libcamera/software_isp/debayer.cpp | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h index 217cd5d92..4b203e211 100644 --- a/include/libcamera/internal/software_isp/debayer_params.h +++ b/include/libcamera/internal/software_isp/debayer_params.h @@ -13,6 +13,8 @@ #include #include +#include "libcamera/internal/matrix.h" + namespace libcamera { struct DebayerParams { @@ -49,6 +51,11 @@ struct DebayerParams { CcmLookupTable greenCcm; CcmLookupTable blueCcm; LookupTable gammaLut; + + /* + * Per frame corrections as calculated by the IPA + */ + Matrix ccm; }; } /* namespace libcamera */ diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp index d4a79e101..49482d711 100644 --- a/src/ipa/simple/algorithms/lut.cpp +++ b/src/ipa/simple/algorithms/lut.cpp @@ -133,6 +133,7 @@ void Lut::prepare(IPAContext &context, auto &red = params->redCcm; auto &green = params->greenCcm; auto &blue = params->blueCcm; + params->ccm = ccm; for (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) { red[i].r = ccmValue(i, ccm[0][0]); red[i].g = ccmValue(i, ccm[1][0]); diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index dae1f12d9..f5c94bb8c 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -100,6 +100,11 @@ namespace libcamera { * \brief Gamma lookup table used with color correction matrix */ +/** + * \var DebayerParams::ccm + * \brief Per frame colour correction matrix for GPUISP + */ + /** * \class Debayer * \brief Base debayering class From patchwork Tue Dec 2 13:31:51 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: 25306 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 73EE4C32F7 for ; Tue, 2 Dec 2025 13:32:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 98FA060E3E; Tue, 2 Dec 2025 14:32:37 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="TVEJ45ra"; dkim-atps=neutral Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 76EC660D22 for ; Tue, 2 Dec 2025 14:32:24 +0100 (CET) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-42b3d7c1321so3410674f8f.3 for ; Tue, 02 Dec 2025 05:32:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682344; x=1765287144; 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=ewF9yilxYVso5/glkSdYCFXFzXShUNQhWJKvnROK5TY=; b=TVEJ45ra5GcQoswdzOpnG3mjcDH5U1TaYa0E4pUj2WWKRGNK6GCXi32G707e3R5UJ9 /R5KPO4cj28ShEx/8ypwWfYIjvkbDt11wUFMimiKAypJOQ36UNzULNwLLXZ+ijf9y21Z qsEyUjy5XQbu2tlbrI/BbxEr/QLwoWYGVlNGeLf7PXgpd+bf+x6WxnCUCTfemwRB5Dl6 2ssgei+UuWPJseIM9NnNuEVT1giNoGodvAhoyDONLlqbEUEznzh2H6nWcpJPGPgB69mY D7iKtBXIecEWCK2wU6S+6IVy1NGU+s4P3u00OzXdnGzGd/NrQobjKPqDwyNceeqygsbl PQaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682344; x=1765287144; 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=ewF9yilxYVso5/glkSdYCFXFzXShUNQhWJKvnROK5TY=; b=FEdjdr6NPGgMo6G7w2BYKbB80uqjmeus6IKmoxQwhJXQNMwDpJG9zk2yjgfq193dQL iiOeBg9mzqXcEABMiW3h0WagJNn6uVOaopYgBhHLtN3cBXhLCVRE4U+uX5wQAmT6cLim AFFjwVThhGO8OIkT/z6ioW8Vq/uDdvco2fvXQRvQI7Fvrjj4cEfjIxbWb3d+Iqc8abqI 1eairkppS/R8xkCB7A9sI6YHFsV/ukJZJHGpyodtzAGeIK/tVNHnDB0woPGayZAWM+ZN 3J3WdxlTniIWDcWS0JLupNAqJ1GjZ60AsWFljjXFHyDjUs/PBcmIJsIeKEMU3c3nKrZh eVmg== X-Gm-Message-State: AOJu0YxyfFS9ehyrFNdOg1BxkCwOi1/2FA1PhB3rHNpL9oHgye+ddBko GAvF34Qksq31w1nFy7Z0YA4aQjy8gjZgVQNn8tO6J8O5GTRzRjMjevb62/79Kxn8oBEj3wKsa32 TJI/K X-Gm-Gg: ASbGncu2P2sGb1WvKpkHWFppDwrcSk3NDN/H2kGEcTAw7h+UgAy/4Jhe+p/fB2ZEUrG Uzii4M/wM3otVEP5TI+s6S7AGRIOJzOVxnPCjFLCfwPEpkUdAmAKJa/RSY2oY5mDkyi6DMosayO tDzCaUOHn7sTSWwy7CkwWvgwqXKeUkavSNEOABABzb+USHg7bfmPysz6jpKbMkTKhbZiis3mWVC FfmSmvFRMNTt3v6iT5DBDLJIgpzncQrOsL/Mw2IWOe6y90zE6ct4tt+9oNcCacqncV1xqKT1gIE CYTYBrXZ2foE7vDnAqjYZ6KIGsn8xP+F/CQgCvwkagzVgJaMQQHarilXHFtpiFkKJgctEG7I5O/ TEcT8jyy+wgDsKvYRaxR8aYoZWt0p2lsINfer1pHoKwjvE4xxrIn/gJWBfrG8j0ZVj0FpJBAlN5 7xuaRdgZ+TuM+RM4tPPpXfvi8NVBnHKwNNE2bzR6j6PKMAYx+jpe9uSte9HaDKovWolxM= X-Google-Smtp-Source: AGHT+IHTPKdFzSXmC+mCntqgHqAK6ggD/kGdiXxAh0LVFt7QCZRBzTR+96e7Xs13jsjIeA96aNM01g== X-Received: by 2002:a5d:5f82:0:b0:42b:3220:9412 with SMTP id ffacd0b85a97d-42e0f3491e2mr33762014f8f.28.1764682343754; Tue, 02 Dec 2025 05:32:23 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:23 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham Subject: [PATCH v3 20/22] libcamera: software_isp: blacklevel: Make black level available in debayer params Date: Tue, 2 Dec 2025 13:31:51 +0000 Message-ID: <20251202133157.661407-21-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" Populate black level gain in blacklevel::prepare(). A copy is made of the gain value in the DebayerParams structure. Reviewed-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- include/libcamera/internal/software_isp/debayer_params.h | 2 ++ src/ipa/simple/algorithms/blc.cpp | 9 +++++++++ src/ipa/simple/algorithms/blc.h | 4 ++++ src/libcamera/software_isp/debayer.cpp | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h index 4b203e211..5a0d9438f 100644 --- a/include/libcamera/internal/software_isp/debayer_params.h +++ b/include/libcamera/internal/software_isp/debayer_params.h @@ -14,6 +14,7 @@ #include #include "libcamera/internal/matrix.h" +#include "libcamera/internal/vector.h" namespace libcamera { @@ -56,6 +57,7 @@ struct DebayerParams { * Per frame corrections as calculated by the IPA */ Matrix ccm; + RGB blackLevel; }; } /* namespace libcamera */ diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp index 370385afc..464e43c27 100644 --- a/src/ipa/simple/algorithms/blc.cpp +++ b/src/ipa/simple/algorithms/blc.cpp @@ -47,6 +47,15 @@ int BlackLevel::configure(IPAContext &context, return 0; } +void BlackLevel::prepare(IPAContext &context, + [[maybe_unused]] const uint32_t frame, + [[maybe_unused]] IPAFrameContext &frameContext, + DebayerParams *params) +{ + /* Latch the blacklevel gain so GPUISP can apply. */ + params->blackLevel = RGB(context.activeState.blc.level / 255.0f); +} + void BlackLevel::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, IPAFrameContext &frameContext, diff --git a/src/ipa/simple/algorithms/blc.h b/src/ipa/simple/algorithms/blc.h index db9e6d639..a5592d087 100644 --- a/src/ipa/simple/algorithms/blc.h +++ b/src/ipa/simple/algorithms/blc.h @@ -24,6 +24,10 @@ public: int init(IPAContext &context, const YamlObject &tuningData) override; int configure(IPAContext &context, const IPAConfigInfo &configInfo) override; + void prepare(IPAContext &context, + const uint32_t frame, + IPAFrameContext &frameContext, + DebayerParams *params) override; void process(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, const SwIspStats *stats, diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index f5c94bb8c..16bf7a218 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -105,6 +105,11 @@ namespace libcamera { * \brief Per frame colour correction matrix for GPUISP */ +/** + * \var DebayerParams::blackLevel + * \brief Blacklevel gains for the GPUISP + */ + /** * \class Debayer * \brief Base debayering class From patchwork Tue Dec 2 13:31:52 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: 25307 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 E7FB4C32DE for ; Tue, 2 Dec 2025 13:32:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7ED7460D38; Tue, 2 Dec 2025 14:32:38 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="PmhJ0PlQ"; dkim-atps=neutral Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 61AF160D2F for ; Tue, 2 Dec 2025 14:32:25 +0100 (CET) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-42e2d44c727so1351477f8f.0 for ; Tue, 02 Dec 2025 05:32:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682345; x=1765287145; 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=HoRMsGpYrPRY+icAUgHJVJD1/UYHwY8MVQgFeGlpOV4=; b=PmhJ0PlQ0bBC5qwRRNQnueqhkDbMk0Esb74TGsLlRl4hRsKHskgV87qX5KaWLxuCW1 p8UtwUPIGnV0Tb70gq0Ty7yPcleicw05K27iWUIFvo1r4QOM5SLZi3Un3ImiPgC8GGw6 kuLCNaCYoPYu/1JqUYHU8aQjqxZ2xkRLqCRLsdDKwCRdLz6bIcUmoJKobwg4vIoUcRJG LBBEY0dIYShZZfX7PtlDfKVZnD+bpQ3W275ND8Gfu3fuJNNKGAFifKG8en5HyLTIWzCm w74jUpvY30vWd6pBm9fujlZkdklSvFMSbozh2sKgvQdaXbQoMlvaeArRWy795Avn0S4T QhRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682345; x=1765287145; 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=HoRMsGpYrPRY+icAUgHJVJD1/UYHwY8MVQgFeGlpOV4=; b=mlGNuvhFJZ2YRT286ihpg0Y3/SA4X/iNgHO+oxp6fXPrPN3DkX8PjNJ+OmoLoUYpNL 5vAoGQSte/XKkMmrzBqnd149gnwrhzwNigoOPgy/o+3ipZWDC3nrylgH8gUYqw5SGl8j LY65SYqgbdswgcoAR2rnp4fIzrS6Nx54kaKTa6JvYBv9FxW1YfKMhdfGhg8/PP/5QfJP d2viYPskFOiYWmQnpHnNIZTVIhaNl6x9YskYceNhql5Tnay/1qyUrXwHs3987G54OtTT r1qTBpxJH6zIqUN8ybAQQHogEWW0p7W7RXTTXLCAPotNy4hTo0i7QaMJ1oVbTPoaJA/c z+IA== X-Gm-Message-State: AOJu0Yxt82MbTZT8pgR/Upx7VP8NAPWHCMf8onpnH6zD2nyrdQOI5ThM 2/pzbHT08YHFGURkhVDY4UReycsJnFaP+RA+Q1hh9r2V3VGeWeQYBbyVDKbKv+dIigYPDSleqic nBvln X-Gm-Gg: ASbGncssO0DXqf8pJyxlixZdbcGvzsaIsqUZu+Xe6QLFvB34WqJK9ZT3/xcQY7h7xo/ XFVhVrBh+XAVm+qSKWqCwocwszMmdMw6nWj8D8JCBPAtIPMPXfJ9cDLSpf9O4gZW9MBYbLmnb26 E9bcLV7k6fLeUjI9o5UZJNpv1EQHZGaGKLN5a8y3NIE5y8A8SPtaGw6Rf3BMJt8mKNn9mSkwx9A vtSBdml/fUuhzF33E3bYxtxYJ+2Di3hs/WQqj8OMcpdh7BmM8SsPsGRK9oaOFRhr00iEwCWjrbj r8JANsQvrlnoEzyE7yqHavze0DE+8ggoQrdoj6NAINQwpcDDzf0Ue6/bk1bIzXNdj2/7mkucdAB mKO081KSsuxlGxWvS0HagbXeUINpe8QMXERS0O6hJZrFyps55Rs5o3nHQHVcLnAtmgDNYSRib2z Qfy8lvEtRrGEOR1H0oKuU85O1U6j+oicegmDx94Fn1XGlb6VpAtGdbXmmqkZ1Oq2A2H7A= X-Google-Smtp-Source: AGHT+IFtMjFGiNlPil8Yuq/yFjoaejOkbWhCH5ynd0ZXcP+6ALGDnkVGJ0AC8iVv0jB3Y4j00+SD8A== X-Received: by 2002:a5d:5d10:0:b0:42b:496e:517c with SMTP id ffacd0b85a97d-42cc1ac9146mr44289434f8f.13.1764682344687; Tue, 02 Dec 2025 05:32:24 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:24 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Milan Zamazal , Kieran Bingham Subject: [PATCH v3 21/22] libcamera: software_isp: lut: Make gamma from lut.cpp available in debayer params Date: Tue, 2 Dec 2025 13:31:52 +0000 Message-ID: <20251202133157.661407-22-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" Provide the gamma used in IPA to Bayer parameters. We will pass Gamma into the shader via a uniform and can then tweak that value from outside at will. Reviewed-by: Milan Zamazal Reviewed-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- include/libcamera/internal/software_isp/debayer_params.h | 1 + src/ipa/simple/algorithms/lut.cpp | 2 ++ src/libcamera/software_isp/debayer.cpp | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h index 5a0d9438f..d5dad1a98 100644 --- a/include/libcamera/internal/software_isp/debayer_params.h +++ b/include/libcamera/internal/software_isp/debayer_params.h @@ -58,6 +58,7 @@ struct DebayerParams { */ Matrix ccm; RGB blackLevel; + float gamma; }; } /* namespace libcamera */ diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp index 49482d711..ea5a86b20 100644 --- a/src/ipa/simple/algorithms/lut.cpp +++ b/src/ipa/simple/algorithms/lut.cpp @@ -147,6 +147,8 @@ void Lut::prepare(IPAContext &context, params->gammaLut[i] = gammaTable[i / div]; } } + + params->gamma = context.configuration.gamma; } void Lut::process([[maybe_unused]] IPAContext &context, diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 16bf7a218..7e8d81c09 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -110,6 +110,11 @@ namespace libcamera { * \brief Blacklevel gains for the GPUISP */ +/** + * \var DebayerParams::gamma + * \brief Gamma value for the GPUISP + */ + /** * \class Debayer * \brief Base debayering class From patchwork Tue Dec 2 13:31:53 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: 25308 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 13743C32F8 for ; Tue, 2 Dec 2025 13:32:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9975160D39; Tue, 2 Dec 2025 14:32:39 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OJGikJs3"; dkim-atps=neutral Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8505E60D16 for ; Tue, 2 Dec 2025 14:32:26 +0100 (CET) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-42e2e5da5fcso1769808f8f.0 for ; Tue, 02 Dec 2025 05:32:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682346; x=1765287146; 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=DqgHxVMLlIhOh7RzizVaQec40pqf/UIahAJyMSasrCI=; b=OJGikJs3NoAK/89kG74fD+fqQaxQgzUK1z0cus5biG7f9HvK/qpi1a08049oPzvV57 iofWlzXnjE23/ZNvybT9y0UEjCcsPGSX9frGjc3w4Upex5Q0ClHtXjzdkXaW/ZM2v5YJ MGPCwxyHOeky+z7+lWV4pUuLjcIFeBTtbadjI+p24cQ7aGm9v84BeadJkTzYzQ8SpzxG 423Hajmc1lqWXHmE4+nZYLyVZv/cpq57/tyfv4iIWdYINYxhTmh0BqVxAn+rajb35t7W nnAhPzv1s52lxXSUBc1OTyiCmMDOhiR/5Gk9GsBIwhwtsZGwMMbxZcaVmasxbUpYjW07 mNtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682346; x=1765287146; 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=DqgHxVMLlIhOh7RzizVaQec40pqf/UIahAJyMSasrCI=; b=uSkSrI4aQ5FxWaavsLWkTtwsv2UEDT0Hop170l+3EX4oo6Zyu+qBzTBRGns5w5b6WF obL31Qck4TknGmmIQwI5d063G0WLSkin0NAIQvBWCetivgAC/v1XcXKuyOyrmKxVd7wT dooCUQyGXIVbFSGSQfRCnDeYdZM47CY4l7RI1yWSn9TgoT/RKMsTzGv7AeCeaMOoUqKV o6AKRDrnBSdjHA57lWXDIFGsF3jhP1vRAaBAGqhQsh72ZvGSo3CgDu3zQ+dOxG1qYoYj qx2UrxeyVdWHYboqEcCBIR/S0+RSa/IGAt23ghbuT84JA7xP9WY45S3K4Cfavjc/ovAk 65dQ== X-Gm-Message-State: AOJu0YwBw+4iM8vd9hTUHRsU8/FdT1SdzgsADLrj17vockzg1RHU5NOt AjxKfTFZbM93qQ/wkiQWmowBWytltSQC4KxRrevC5AY6IslkdZPd5xDc4ZhjXB7ZgNi3ULr+tzq wF8bK X-Gm-Gg: ASbGncs9m3mn4MpqOwE+HKxrsT2gCg/qP5D4AWK8R2YDtEqdJzo+DZaLondbmJQIJ+n BwqhzzyXw5mg1saWWdpBfuVp0rytESKc1TRgErgRmxNeGD1B95DCccFOFpPcDcKLBFeoKnSJQC4 Ln0D0TawUTBsysvNUS+dGeOnKI/k3w/ZGf+enwDoLJFoSL299CUO/WnIzbAeuExjowf+fnk3Hdo TXVYaaw9Q4oz2vkkS4O3UW9Uac7JUHh9NsYcn1MeQmgWMWOpEzZEnF5DtLkJavcGb6QLrD2eHZh ZK30zTnLE1rn6zv5lCXhDz5Y1nhfnCyMXrdTMIMcspjnM7UvBeBkciBqwDY4/Yrom4a0RCp1pIs Tz/MgShWVGvC8t0/na0sXRzM32im7ahFRGYgNthFsv03tAojR3lK/tHkCS/Qsmi2V6TLhy/kwDB cZe61tEI0X/UY6Ht8K6l/YZ2dLto0p/zOQHnYUmSggTjfUGDZRLfsFRKV4sfLAVuixPGk= X-Google-Smtp-Source: AGHT+IFoulvQ3V34aUHRmh4I93l3uV3LSA4Kn0rjfu31G4n4zsesyV4EW+OP7/p6yciL7Js3k7sX1A== X-Received: by 2002:a5d:4251:0:b0:42c:b8fd:21b3 with SMTP id ffacd0b85a97d-42e0f362440mr23905039f8f.57.1764682345706; Tue, 02 Dec 2025 05:32:25 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:25 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Milan Zamazal , Kieran Bingham Subject: [PATCH v3 22/22] libcamera: software_isp: lut: Make contrast available in debayer params Date: Tue, 2 Dec 2025 13:31:53 +0000 Message-ID: <20251202133157.661407-23-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-1-bryan.odonoghue@linaro.org> 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" Provide the contrast used in IPA to Bayer parameters. Similar to the calculated Gamma value we will pass this value into the debayer fragment shader for further consumption. Reviewed-by: Milan Zamazal Reviewed-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- include/libcamera/internal/software_isp/debayer_params.h | 1 + src/ipa/simple/algorithms/lut.cpp | 1 + src/libcamera/software_isp/debayer.cpp | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h index d5dad1a98..8033f7d5b 100644 --- a/include/libcamera/internal/software_isp/debayer_params.h +++ b/include/libcamera/internal/software_isp/debayer_params.h @@ -59,6 +59,7 @@ struct DebayerParams { Matrix ccm; RGB blackLevel; float gamma; + float contrast; }; } /* namespace libcamera */ diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp index ea5a86b20..9aaab54f1 100644 --- a/src/ipa/simple/algorithms/lut.cpp +++ b/src/ipa/simple/algorithms/lut.cpp @@ -149,6 +149,7 @@ void Lut::prepare(IPAContext &context, } params->gamma = context.configuration.gamma; + params->contrast = context.activeState.gamma.contrast; } void Lut::process([[maybe_unused]] IPAContext &context, diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 7e8d81c09..e01358720 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -115,6 +115,11 @@ namespace libcamera { * \brief Gamma value for the GPUISP */ +/** + * \var DebayerParams::contrast + * \brief Contrast value for GPUISP + */ + /** * \class Debayer * \brief Base debayering class