From patchwork Thu Nov 20 23:19:58 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: 25102 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 DF375C3330 for ; Thu, 20 Nov 2025 23:20:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 45030609D8; Fri, 21 Nov 2025 00:20:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="syCuUDHo"; dkim-atps=neutral Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C0C0A609D8 for ; Fri, 21 Nov 2025 00:20:27 +0100 (CET) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-42b31c610fcso1224813f8f.0 for ; Thu, 20 Nov 2025 15:20:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680827; x=1764285627; 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=/gSAihp723eT5WD8BN6u+nuIIn+QakUM8//jMcFRlD0=; b=syCuUDHoUyRmlZRKJDEngETFTMP3bfJJ+dt5mAHwZxOh1rj7hK0jUwKk34LBRSsiDD ALy5DybXgJKSQX+AfeCsACd+pj1wM486+ddYJMKjBe0JaeiCZUT0nJ819ALV3Aw5nZru MgL9awmFChIo8UprgozLkwvUmwHTco1ihMRW21ZRKN9z1QaoatHALbKOuUnAFu+RSyMp FbNzKpDN1eg72A2B9roUl29BP3t9TZeoVOcETFGl857ICnnNfMTj9e5OqqcfjCARBYnk 8b3gLYwavlxYTuRLXUjhIW8APMS0Dderv/uWPWs5OV5EZbnDaLPq5hXIQJKgqu8B3+QH uQcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680827; x=1764285627; 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=/gSAihp723eT5WD8BN6u+nuIIn+QakUM8//jMcFRlD0=; b=r/KL/A0c8Tz71VlD4WmStUNaWC16c365tWx3eVgftS+8UCvucv33NeKfWRGY+FUZR5 WuTiczMM1UzANxRTpr3J1/TIBtw4gGvT92vM4Pt38BvqomdgLybsbWYYbxw2Wzlmclgp +jyyx6lzKOeix445O8I2+DwmpTn9cxR05iE4ODE8PcZpUd/Z6hz71iWdSnhzK2h01FUQ xleCLNMtPxHzvu/gm+8a4lkp0pCrJfsjt2WK0tOcu2pmD4GYjsejHovqoP66ewNzQZ8I ne7/Gm9TrTwN7Ke3xDgoKGdgRtf46RCd3qlYEbh0bTGFXPwH1dmzQWw1jd2Na09nsSVD 8LAQ== X-Gm-Message-State: AOJu0YxV6fr/2V6V49xLi7sjdFRt7apDrPwcEMsrwBz+s+AEA5xoyGcd 9kJwkdL60p81gxiRXhq/B/VbYVdFm+AGZz8Eo6e9Emimwo3uOfjHhFC3O6I/qpvKvGmhwb+XuGQ ja+GFYI8= X-Gm-Gg: ASbGncss1lwNxDiRa0S9axyOTa3VEOS74oY+kkLAjzbpoB+rPD6xdkWzb667MiLmfDZ gsjDVlCknbYdhcOee3bqtokBN1KDOtwCUv9dHNTJLztiL46McLOjXQ0gN6qk15PTVpDwkjgi/UY IqcCCdoOpRlCM1CnB+SXmJkupi5Fud+r4ebtBGAzx98oOK0BhaP1g0c8uPAoPMoFnU1CECOlpxq FTeVoW6T8X2V0h3pQGWZWCFR142J6jAcdKuNHgas3UrCPBLgbEutdwa4Rsmis351Nv+MhtNBMdm EJ/E0btMgAmskM7bqBlmwEu26VCHYjCe2X3rr+/0GkKw/nFUg+KqiWWdUu1lqzOZfGxtsiPm2Kq qrNc0fgMihGtu99NsoR/3tCDDzURykAtJzmSBpSKbYuNwsQuJ6Wnsq6gokXU6HVaSBhMsOXlqfM SQHvf3jU66nJrfVcY61jrQMd/p9BXlXmJMSQbSUVHEtA0fQK5hCsBNyLfzklq3Uh6lh/o= X-Google-Smtp-Source: AGHT+IH3ZVeF7T5NRTnMLJwulVifL2sOXyzdRYtZy99dxuzrTX/N1t4C9m0GNOntLJrMijUHxnFX/Q== X-Received: by 2002:a05:6000:4026:b0:42b:3220:941e with SMTP id ffacd0b85a97d-42cc1cbce4bmr80745f8f.19.1763680827061; Thu, 20 Nov 2025 15:20:27 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:26 -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 01/22] libcamera: shaders: Move GL shader programs to src/libcamera/assets/shader Date: Thu, 20 Nov 2025 23:19:58 +0000 Message-ID: <20251120232019.3590-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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/assets/shader 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 --- .../libcamera/internal/shaders}/RGB.frag | 0 .../internal/shaders}/YUV_2_planes.frag | 0 .../internal/shaders}/YUV_3_planes.frag | 0 .../internal/shaders}/YUV_packed.frag | 0 .../internal/shaders}/bayer_1x_packed.frag | 0 .../libcamera/internal/shaders}/bayer_8.frag | 0 .../libcamera/internal/shaders}/bayer_8.vert | 0 .../libcamera/internal/shaders}/identity.vert | 0 src/apps/qcam/assets/shader/shaders.qrc | 16 ++--- src/apps/qcam/meson.build | 3 + src/apps/qcam/viewfinder_gl.cpp | 70 +++++++++---------- 11 files changed, 46 insertions(+), 43 deletions(-) rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/RGB.frag (100%) rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/YUV_2_planes.frag (100%) rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/YUV_3_planes.frag (100%) rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/YUV_packed.frag (100%) rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/bayer_1x_packed.frag (100%) rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/bayer_8.frag (100%) rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/bayer_8.vert (100%) rename {src/apps/qcam/assets/shader => include/libcamera/internal/shaders}/identity.vert (100%) diff --git a/src/apps/qcam/assets/shader/RGB.frag b/include/libcamera/internal/shaders/RGB.frag similarity index 100% rename from src/apps/qcam/assets/shader/RGB.frag rename to include/libcamera/internal/shaders/RGB.frag diff --git a/src/apps/qcam/assets/shader/YUV_2_planes.frag b/include/libcamera/internal/shaders/YUV_2_planes.frag similarity index 100% rename from src/apps/qcam/assets/shader/YUV_2_planes.frag rename to include/libcamera/internal/shaders/YUV_2_planes.frag diff --git a/src/apps/qcam/assets/shader/YUV_3_planes.frag b/include/libcamera/internal/shaders/YUV_3_planes.frag similarity index 100% rename from src/apps/qcam/assets/shader/YUV_3_planes.frag rename to include/libcamera/internal/shaders/YUV_3_planes.frag diff --git a/src/apps/qcam/assets/shader/YUV_packed.frag b/include/libcamera/internal/shaders/YUV_packed.frag similarity index 100% rename from src/apps/qcam/assets/shader/YUV_packed.frag rename to include/libcamera/internal/shaders/YUV_packed.frag diff --git a/src/apps/qcam/assets/shader/bayer_1x_packed.frag b/include/libcamera/internal/shaders/bayer_1x_packed.frag similarity index 100% rename from src/apps/qcam/assets/shader/bayer_1x_packed.frag rename to include/libcamera/internal/shaders/bayer_1x_packed.frag diff --git a/src/apps/qcam/assets/shader/bayer_8.frag b/include/libcamera/internal/shaders/bayer_8.frag similarity index 100% rename from src/apps/qcam/assets/shader/bayer_8.frag rename to include/libcamera/internal/shaders/bayer_8.frag diff --git a/src/apps/qcam/assets/shader/bayer_8.vert b/include/libcamera/internal/shaders/bayer_8.vert similarity index 100% rename from src/apps/qcam/assets/shader/bayer_8.vert rename to include/libcamera/internal/shaders/bayer_8.vert diff --git a/src/apps/qcam/assets/shader/identity.vert b/include/libcamera/internal/shaders/identity.vert similarity index 100% rename from src/apps/qcam/assets/shader/identity.vert rename to include/libcamera/internal/shaders/identity.vert diff --git a/src/apps/qcam/assets/shader/shaders.qrc b/src/apps/qcam/assets/shader/shaders.qrc index 96c709f92..04f9d7061 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 + ../../../../../include/libcamera/internal/shaders/RGB.frag + ../../../../../include/libcamera/internal/shaders/YUV_2_planes.frag + ../../../../../include/libcamera/internal/shaders/YUV_3_planes.frag + ../../../../../include/libcamera/internal/shaders/YUV_packed.frag + ../../../../../include/libcamera/internal/shaders/bayer_1x_packed.frag + ../../../../../include/libcamera/internal/shaders/bayer_8.frag + ../../../../../include/libcamera/internal/shaders/bayer_8.vert + ../../../../../include/libcamera/internal/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..70f600650 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_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/shaders/YUV_2_planes.frag"; break; case libcamera::formats::YUV420: horzSubSample_ = 2; vertSubSample_ = 2; - fragmentShaderFile_ = ":YUV_3_planes.frag"; + fragmentShaderFile_ = ":include/libcamera/internal/shaders/YUV_3_planes.frag"; break; case libcamera::formats::YVU420: horzSubSample_ = 2; vertSubSample_ = 2; - fragmentShaderFile_ = ":YUV_3_planes.frag"; + fragmentShaderFile_ = ":include/libcamera/internal/shaders/YUV_3_planes.frag"; break; case libcamera::formats::UYVY: fragmentShaderDefines_.append("#define YUV_PATTERN_UYVY"); - fragmentShaderFile_ = ":YUV_packed.frag"; + fragmentShaderFile_ = ":include/libcamera/internal/shaders/YUV_packed.frag"; break; case libcamera::formats::VYUY: fragmentShaderDefines_.append("#define YUV_PATTERN_VYUY"); - fragmentShaderFile_ = ":YUV_packed.frag"; + fragmentShaderFile_ = ":include/libcamera/internal/shaders/YUV_packed.frag"; break; case libcamera::formats::YUYV: fragmentShaderDefines_.append("#define YUV_PATTERN_YUYV"); - fragmentShaderFile_ = ":YUV_packed.frag"; + fragmentShaderFile_ = ":include/libcamera/internal/shaders/YUV_packed.frag"; break; case libcamera::formats::YVYU: fragmentShaderDefines_.append("#define YUV_PATTERN_YVYU"); - fragmentShaderFile_ = ":YUV_packed.frag"; + fragmentShaderFile_ = ":include/libcamera/internal/shaders/YUV_packed.frag"; break; case libcamera::formats::ABGR8888: fragmentShaderDefines_.append("#define RGB_PATTERN rgb"); - fragmentShaderFile_ = ":RGB.frag"; + fragmentShaderFile_ = ":include/libcamera/internal/shaders/RGB.frag"; break; case libcamera::formats::ARGB8888: fragmentShaderDefines_.append("#define RGB_PATTERN bgr"); - fragmentShaderFile_ = ":RGB.frag"; + fragmentShaderFile_ = ":include/libcamera/internal/shaders/RGB.frag"; break; case libcamera::formats::BGRA8888: fragmentShaderDefines_.append("#define RGB_PATTERN gba"); - fragmentShaderFile_ = ":RGB.frag"; + fragmentShaderFile_ = ":include/libcamera/internal/shaders/RGB.frag"; break; case libcamera::formats::RGBA8888: fragmentShaderDefines_.append("#define RGB_PATTERN abg"); - fragmentShaderFile_ = ":RGB.frag"; + fragmentShaderFile_ = ":include/libcamera/internal/shaders/RGB.frag"; break; case libcamera::formats::BGR888: fragmentShaderDefines_.append("#define RGB_PATTERN rgb"); - fragmentShaderFile_ = ":RGB.frag"; + fragmentShaderFile_ = ":include/libcamera/internal/shaders/RGB.frag"; break; case libcamera::formats::RGB888: fragmentShaderDefines_.append("#define RGB_PATTERN bgr"); - fragmentShaderFile_ = ":RGB.frag"; + fragmentShaderFile_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/shaders/bayer_8.vert"; + fragmentShaderFile_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/shaders/bayer_8.vert"; + fragmentShaderFile_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/shaders/bayer_8.vert"; + fragmentShaderFile_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/shaders/bayer_8.vert"; + fragmentShaderFile_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/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_ = ":include/libcamera/internal/shaders/bayer_1x_packed.frag"; textureMinMagFilters_ = GL_NEAREST; break; default: From patchwork Thu Nov 20 23:19:59 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: 25103 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 9748EC3330 for ; Thu, 20 Nov 2025 23:20:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4117C60AA0; Fri, 21 Nov 2025 00:20:33 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="GzEj5XeX"; dkim-atps=neutral Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6224B609D8 for ; Fri, 21 Nov 2025 00:20:29 +0100 (CET) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-42b32a3e78bso1197199f8f.0 for ; Thu, 20 Nov 2025 15:20:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680829; x=1764285629; 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=9Tia+XY9MrQ6HrF0RJpqLjs2LQN6nlxpbG5nPfwV5EE=; b=GzEj5XeX5PXmpIPWZXo1OV4H/ev6RtEggqFvxYfJ4k9lpcJL/60s3tNaVgEVjyWYCj yKeIXxzZ9AlM7A7eykBDixEL2AwcSuQ8qadtha2BQ9xyoFtQC5A3O8Aq9586ZkI/dOeE twt8LfO2l+olCJhISRExRjalqbG75HNSJLYyNca3CeQCMp03S/6w4YUb59s4AAy7PkV0 fn7DV/xsfDOg8LJQrbdgNPFgApg+hjKK33HWJyXTDSA5S2Gh8/KAXOrX3QuavgAGm1HZ vWIollwXWCe+F1LarUJPafWLDz0BAVkbx8nxL2x+yIps6Kj+k/JsvbMveY02zkUvxNQO RloQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680829; x=1764285629; 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=9Tia+XY9MrQ6HrF0RJpqLjs2LQN6nlxpbG5nPfwV5EE=; b=tg9xSUSuQcClvl4b5qDduhQgfdxNEJ4nI1BQWxLCT8NWyQ+yJVEcvdX/+FJql/8mM1 uTM1cZHO2FpojE89WgO2/P9Vjqvmt6/QOi8FEqIdUU+LNls+gBxAcCu2ESenv/wAXzb+ k+cWbP3ZrMCSG6lySWD6uCYw8bnOC0lOYg8LlP5VAuzpa8moeo8VMddI68/Tx+hJHIhj 6zfIOvMviVTgAA4uxvtLRRDnUfdLoeq3cI3ij2FEuWiCPrPdN0c1q8Edti2DslM3cO2W duzuX+JAhrMuDcyWCnaM+zQRlfxT4uwH7z7jpYBXKFcT+CUjhVGSqiiqMZqFbJEYsxDN azjw== X-Gm-Message-State: AOJu0Ywzcg6EjZChp39h1Zr1QhSgXtUEQ/dkb2d9Gr6xP16X2rWI5H0N sI2DOM6CYMefOTd4HfvsSfjvjXZ8aB29jTpE4QHv/8r561+dahFTPAmIlMu/jd6v0fz7vf0bmBR vkTE1CWI= X-Gm-Gg: ASbGncsths5qtyCqwAqDMsx6afuRDK7oBozrGY+aeKcVVc9DKXr6uDrN8JnyjnTdBRm 777PrOETlxmocmnDR7LsGB9AsbRv1xPY2i0oMfPC7M9VWs3y2atip8WoqTP6F1+Q1CL/LMjm/2b n1A7sv3OrLa/Dy0YtOgS+KGWS19Mzalf8kMHhwa96V98En4hy3it7J9Nhi7Kmbq5dURWDKPZIZK dkgs0+H1C65nHE86sTRdqqNR/8wHedlsVKpIgpYuHJ8QioS+wRLgUA5P6HuUCjp00QtOkCrfH5h osnb578dH71YkvU9sCMYqriqkj28gi6nO/UffbxuvPBmvKu2fXLxTOJgbN6aao+7yoayKMtjYlJ iBh7Ok8JKCmxd4g3yfLHvsiqTDvjBHJODB8tb+WXFB4Egu1gy/cH4ono0VKakOkq7T0cV1HvGXF p5/kTsvtZlUK/0y4DuYA3UEYRzqkctAFIAi6shBB/5Hde7ZquZuYZG+Nl+4LbCLP1k3ow= X-Google-Smtp-Source: AGHT+IEYNYL/5VAIuFh6pckUzAy7H9Z8ahhpX0FRnzspqeRKkwXp/Gslg8UjicPM+9hU9XgXYsS7AQ== X-Received: by 2002:a5d:64e6:0:b0:429:bac1:c7f5 with SMTP id ffacd0b85a97d-42cc1d19907mr73114f8f.44.1763680828720; Thu, 20 Nov 2025 15:20:28 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:28 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham Subject: [PATCH 02/22] utils: gen-shader-headers: Add a utility to generate headers from shaders Date: Thu, 20 Nov 2025 23:19:59 +0000 Message-ID: <20251120232019.3590-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 | 38 ++++++++++++++++++++++++++++++++ utils/gen-shader-headers.sh | 44 +++++++++++++++++++++++++++++++++++++ 2 files changed, 82 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..6668e648f --- /dev/null +++ b/utils/gen-shader-header.py @@ -0,0 +1,38 @@ +#!/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 into a C +# header. +# +import sys + +try: + with open(sys.argv[2]) as file: + data = file.read() + data_len = len(data) + + name = sys.argv[1].replace(".", "_") + name_len = name + "_len" + + j = 0 + print("unsigned char", name, "[] = {") + for ch in data: + print(f"0x{ord(ch):02x}, ", end="") + j = j + 1 + if j == 16: + print() + j = 0 + 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..ca4f19f07 --- /dev/null +++ b/utils/gen-shader-headers.sh @@ -0,0 +1,44 @@ +#!/bin/sh +set -x + +if [ $# -lt 4 ]; then + echo "Invalid arg count must be >= 5" + exit 1 +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! */ +/* + * Copyright (C) 2025, Linaro Ltd. + * + */ + +#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 + echo "file is $file" + name=$(basename "$build_dir/$file" | tr '.' '_') + 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 Thu Nov 20 23:20:00 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: 25104 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 05A94C3330 for ; Thu, 20 Nov 2025 23:20:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A4F6560A80; Fri, 21 Nov 2025 00:20:34 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="UcLbrEsq"; dkim-atps=neutral Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0791660AA0 for ; Fri, 21 Nov 2025 00:20:31 +0100 (CET) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-42b3b29153fso855282f8f.3 for ; Thu, 20 Nov 2025 15:20:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680830; x=1764285630; 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=AZjvy8VuhuGnPkiKZz0H2mspahrpuWL7zN2wdWyCmEw=; b=UcLbrEsqcTitFxSsVi/k/PyWh00i7oHYkbEyf1McAqh6zAnfFyuvHWkIi1goJhWuSZ 1hHeiYVvgcB9SbLzEBiveoWNoWt9YaDrSct3dr3saAYacFUrS/FUkUTxdzhsmGkbjsuB 8sg01M5ur9SfCAcNMsZ2QjPl+V7dheu4aVoWTqGzPLM36RrUkgHdVjeRUsZAb10byEGq V03A68nZfq+Jl6Yj7VcOZc2FLWFnALiDW9iAi1lgRxWUNF7BNKp76ewCEedY+ovkTCTR we0ZiFTLFXGBU3Hg5ZKltE3wrsIy6uWUC2VwbXwJb/3wBR8AOgLe4wcyMMMS0zNFHa1j 84GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680830; x=1764285630; 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=AZjvy8VuhuGnPkiKZz0H2mspahrpuWL7zN2wdWyCmEw=; b=X7Gf5d7h1zdaKYl0WoEzx3BE6+lI5MTI4u1btGggwQyW7b/notyHYYto8deIbjC4Ph Tz42fYmuRkrtETQqz3cvk9qIspcGGyi71mPWjFamrL4M9JTsq76lMpjlE/VdC3fiXIjU 24BUofKIYfKjcWoXo8gu+B+52XLvZhRZE8Dx+F5m4ibYzlmvm0lPnfjfzPkJ3aMEBd9x TaydDJ9CZyVg5MMqDnp1HWXNV/8OHRNfamG64iEzvczGsitQas5EPuTLLeqG5IRoruLm 3zlMX3/VQnsl/vJeR4Py9FTFlVqsdh7PNMgyCcuhfQYpYo1pLeYABR/IfTZJe+80VhUp VgqA== X-Gm-Message-State: AOJu0YzoYXizqWHdD2bLeDESrNei2WFBEwJzHx8Af670z58yVj7KI09B jHdOHChYqX33Lk7M6oRiqVUoa3qoNzC/gbI8GQ9eK6SexkrOX/dLpq8wEZpcWMuPlCNdsZ7A0LY SONXW+9c= X-Gm-Gg: ASbGncvpLSzqFCnaIVrP6tH5401N2sr6ntPfTxmvTIH8N3stlStz06n9tYsv6WKPXLO fTckOAsWITWrDk5RvWCVIl4IYFfSIjFksEgeHL3Pzu+l+OFaj5wFIVvLtX3nTEw5vcoAIozPrKN Z83d1L6zM75317aaUUDgCjy0ekr0Bpib5du8oakHg9uejS4EgkiV4SJASdoJ/cm27sRbhe2IBa9 kYuymZwCZZh4bOH9WfyKaE4QkK8Ln5BaFCP9bSSBklqIdkFO84i8hQbOMTqjW+81yLycdydP2Iq 5GCRmexmvgt/yjOjZEySmH0dr9aYOvVCQx2Tlo7kE+CJpyOrbPrOEKFj2i0lKqW1f2LYJWxnLEn p+lG6i4VDTFaMu3VZ3vIq03rvnE5VK3qZfIQ8pu0DHVIN2G7SUAlKkh2TJE/oVYzNvCz9z6DuNJ SPDcfJR/j8t/eZ+TQM3eDllwYZ8C7yR0Ur0vcUaA+Ay4rpvcGjNbQVZS+2BQ0mxdl3w6Q= X-Google-Smtp-Source: AGHT+IFVaEdm+Z3bckYYenVRySGR41Y1lfOhCRDnHUpUwFFAdrlQuwIf2oP9IwyEUQyR5bDpUdLQfQ== X-Received: by 2002:a05:6000:601:b0:429:ca7f:8d5a with SMTP id ffacd0b85a97d-42cc1d2e2e3mr58464f8f.37.1763680830298; Thu, 20 Nov 2025 15:20:30 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:29 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham Subject: [PATCH 03/22] meson: Automatically generate glsl_shaders.h from specified shader programs Date: Thu, 20 Nov 2025 23:20:00 +0000 Message-ID: <20251120232019.3590-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 --- include/libcamera/internal/meson.build | 10 ++++++++++ include/libcamera/internal/shaders/meson.build | 10 ++++++++++ utils/meson.build | 2 ++ 3 files changed, 22 insertions(+) create mode 100644 include/libcamera/internal/shaders/meson.build diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index 45c299f6a..ecb7c9fa8 100644 --- a/include/libcamera/internal/meson.build +++ b/include/libcamera/internal/meson.build @@ -1,6 +1,7 @@ # SPDX-License-Identifier: CC0-1.0 subdir('tracepoints') +subdir('shaders') libcamera_internal_headers = files([ 'bayer_format.h', @@ -59,5 +60,14 @@ tracepoints_h = custom_target( libcamera_internal_headers += tracepoints_h +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 + subdir('converter') subdir('software_isp') diff --git a/include/libcamera/internal/shaders/meson.build b/include/libcamera/internal/shaders/meson.build new file mode 100644 index 000000000..386b342d0 --- /dev/null +++ b/include/libcamera/internal/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 Thu Nov 20 23:20:01 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: 25105 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 9A3DEC3330 for ; Thu, 20 Nov 2025 23:20:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5641860AA8; Fri, 21 Nov 2025 00:20:37 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="tkgnjAi4"; dkim-atps=neutral Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 22D75609DE for ; Fri, 21 Nov 2025 00:20:33 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4777771ed1aso9717455e9.2 for ; Thu, 20 Nov 2025 15:20:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680832; x=1764285632; 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=BYLFp48Jtlh28DV0l7WkmFCL3lrDfDHVbIKL8htzT4E=; b=tkgnjAi4zUlOH16meHfDpcEW40BiEU08q5jzilgdKC3Os/QPtuxXWXQoFC0e3hnC76 pkVAFXA1wlTHgsQBwPYBXSY79bMhYM6wMuRxOiWKb+vavo4l4Px94ZUSmL+zfBFWdEal PZ20/D2D38zx3EnYJl2izGwCxUKVIZMNYD0wxGuZFDVdMRtF+yt5R/ST3WkcoJ141Bp9 1yThP5S9o7jHbt4Aa0peO8h0r9bF+IiAb048QeSh/Tzb+KzPinVr7Kqlp8ww8NcjgzOs /Ku98lLmFaxc8q4xA0+87+wPaKQGs6zFwOaK6VNbo/m61YRsC5TcUz5kKBJaT1yKkm6l 5qqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680832; x=1764285632; 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=BYLFp48Jtlh28DV0l7WkmFCL3lrDfDHVbIKL8htzT4E=; b=LMDuS43ILxWsl5q4SapVWe9Eov1UZ1yfQXxTgB9PoqGkETYBtnEh6HMA1EokpZd2Eo e/pex7TFY6Lj7RZxA97Nsd81v3mtJTbCEJFz2cyvcA4+fopMIJdQJqihh57B5qoOwpXh PhsvXnh54h07ysWSw41AQMP64no1HTrPiURJwZfMrQJRjZxvtwzRsMKcDMQQoVm5Km2p 75tJPtRf3FOUa++IK9h+oHQy7AVjDgbss2rJG9SCkDx4yLNKxM72EEYrwLDO2If+4E0X UUqbRXfSR0pf+o+QNirCk7jUPCzyQT5Q9Qd5K8I8DMX4o/dD4LYzWV4P9GMYxhCEOeid ES8g== X-Gm-Message-State: AOJu0YyGcG4fYcqB52fZl2aQc63oNUZr+N/mqdKhXSgOS6SqigNXQoGC Rq4q5k1mDPjkeU2UmavZK1FLnSzMvcHlxrQg+RL4MRIy0tUB3RsA8sxGswzrMDQMw03VannUxGC 8mWEm0OA= X-Gm-Gg: ASbGncuInIp26Gud8kewwIzBnC8MORxXKrwbX+SdpW6+FVIPmBvQnh/0c4m7D7GTWLZ xKHecHNsFePqf05lzNC4VB0DyaOFrbBCWwL+QEIOIlMPnLsKRCa28USVFrfWBdZlz9+RNreFR1a D7xwZq+8/JSco3KL3N4OcQVfQ47PgJpFPogUdpREUZTnNb8bL1FCyfRvlanYteR65UVlibz3uJN InK26Eqqch0CTX7DSKj/hHYp1fbda/Pl4LrpNAQ8WeWrpPhfT44q22rUlQLm6fB8VVEMQPEp2D5 8QvY4uQJ9aLuifY2BFHaAX9Z+iSDn26E+Vb6nO3DpeOIT1PPg3SNocBnBVv0jqG31W2PDVEntO1 84Yl55ePQzIPZwLw1QtneJ+HNbqqSvy9GUI/NJU1AtnN8PAPMeYlpfW75zbEZ02DNyDBIKEzDus auL47tm3rJ79R5ZRtzGEzhWMxn7aZn73qRqUc6+noE4QcexlY5/k2I6qaBk3rZ4EtbuAI= X-Google-Smtp-Source: AGHT+IE+lwAwIbMQwP55EOpjso52jOpajRLW1RSPF0IcBjKNSlkcFeIWNlgmHLqKEdTYBbrUrpshtg== X-Received: by 2002:a05:600c:45cf:b0:477:8ba7:fe0a with SMTP id 5b1f17b1804b1-477c01c001bmr3631235e9.24.1763680832446; Thu, 20 Nov 2025 15:20:32 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:31 -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 04/22] libcamera: swstats_cpu: Update statsProcessFn() / processLine0() documentation Date: Thu, 20 Nov 2025 23:20:01 +0000 Message-ID: <20251120232019.3590-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 Thu Nov 20 23:20:02 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: 25106 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 67C3BC3333 for ; Thu, 20 Nov 2025 23:20:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 25A1860A8B; Fri, 21 Nov 2025 00:20:38 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="eKZ8K4Am"; 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 D360F60A9D for ; Fri, 21 Nov 2025 00:20:34 +0100 (CET) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-47796a837c7so9424105e9.0 for ; Thu, 20 Nov 2025 15:20:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680834; x=1764285634; 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=J/rNUy6IT8Dq/gobx75Pygy+h2VMr98GtCcoWBBrzZU=; b=eKZ8K4AmDARdsmThf3v+ls8mG9gipqwucPUHy8L71i6g2Fh2u0yXeyy9PH7Eua0nYC kKesU8ysWGQyfljuuKSQs7NnMVzopOolgKErZn9Mg5gnxjZbEDC/GFJi6Q8cfgT5P6hf sNya3+g37TCwj5VPbRE1O65INEm0ahtBRH+L1d9dPJYiJOsuONZ+UiBaHfxvcPiPIWhG TVA/bdcg8OXfnvmnkvTaVhdEirFVBavFoBKxhgUM14FxPXaNycr3oVgWdlXOXU20oKUx 6bbKa4EJAPO1NV2/DTbaGxpUJXpn6gt7qMdmcbwS+ZgBF0KquBnmoqGFXXDKMN/iItKH V8mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680834; x=1764285634; 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=J/rNUy6IT8Dq/gobx75Pygy+h2VMr98GtCcoWBBrzZU=; b=WaheV8vULEnJD23XVYs8LExpn4UO5c7fNPV4jzDCJiQvHQ3Sr5m40ksFlSjsLLWwQR juidQMBsgy7g2VrI8zcK933AKmIJnYXsLC5kQ576wPNgbqKpl4eY+Atv8mUmrR5GOA/z xJ+ykBJ1gchDeJXD6IuJz5/wC3N7L6BQcL/Iu82EZ7Ad610lgC+5WavaDuVbkAXqRS1G xBrEFkc67Ih81NI+ZYL+gBjXnUjgps9kCYHsoZ/tcLnRrmpugO1vLHJUrerwWOyihPbp kFsM6QZcrqAW7Hj3oH9yNQixZmkGjKLNExmTvyw+vUhP4NLILnfQsudAkFDhisTHNKRj HjVw== X-Gm-Message-State: AOJu0YzDQofNXswdWQsMS4ljiPFh39X9pQQ8gYwjsnsjn7LjMl9b6roL ree3oduZnrly3dP+ThGIHJgzx+OC2WyEIuUkHnKeDDUCEt41JHwoy978rANfUMtyY5nGYxIH+ru Ew65kpXc= X-Gm-Gg: ASbGnctJvyrgRFFchKqOusf2Zxn605zzbB+47BKZDC+XEKPWKdNhKMEbQwZPjFXs77y I2jGUUUEM2e+XfIfOIJ++0kRs71acAwSAwIHjLcQhNkcR9xP5Qru9+4AJi6fY+TVU0Hd+buiQlL 6Goy+nN05q/Hisr9D8mgNFwk+exj6pJ3ahiknDGEvkrB9ztiTyQaX4ip2lywA+ZF7JQXT1dzHKo 9ZNaNr+hAqTsRc5q552PR3kWKOkClipJI3TKHXxG6EOYz/kEkE8Pp/HshlTCYbRGFHMTyydYs1M 8ujycRhRChwjsJP+FQ9hzql2nseZSCpeHRvHjp1bwt9NRAbbOnhgFAien+X+T1VjtvUw48n4JIj QMDO73AW7wh/ScQEbDS+LQ0qtOVFC8q8KVTqvRlMxAcVGpF6i+aCc97rfXaHsV4rs6piGk7p/oZ CN1tJV5qsMQqlD9IpqWK4xMKwzpK4EaDVi7BiE+s5a1875c9dATIG3cG1XfrzCkZyZfik= X-Google-Smtp-Source: AGHT+IExo/lZJ5aSQVeh+ZgmyPHPlqN12DlPdCnFcian4cxW11tHaGwpKCj9UEis+wbsjhh7O5Q6Lg== X-Received: by 2002:a05:600c:310d:b0:477:9fcf:3ff9 with SMTP id 5b1f17b1804b1-477c01c359fmr2941445e9.27.1763680834133; Thu, 20 Nov 2025 15:20:34 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:33 -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 05/22] libcamera: swstats_cpu: Drop patternSize_ documentation Date: Thu, 20 Nov 2025 23:20:02 +0000 Message-ID: <20251120232019.3590-6-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 Thu Nov 20 23:20:03 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: 25107 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 69734C3330 for ; Thu, 20 Nov 2025 23:20:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BC67D60AA4; Fri, 21 Nov 2025 00:20:38 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="DDzeo4/p"; dkim-atps=neutral Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9674D609D8 for ; Fri, 21 Nov 2025 00:20:36 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-477aa218f20so9419365e9.0 for ; Thu, 20 Nov 2025 15:20:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680836; x=1764285636; 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=POEtUhiKDMucv1U75gLO1B2WYaDcFKD6qvD9bzHNOGM=; b=DDzeo4/pOIXugP/GUf6LjT/arPQrELZRExaaudwmk7kjtpfeiMWP37NPrupABF1OGo 7EVCOludgWMr9Yiy3XUr7pRnDbVVT/ujMJBYYPCBdZxqdVS847+EKL6PGF6XVvmqmQcV Wx7bm8TWq753/YR5wHjEy+xlPbqMMx7iYOI4l9WRYi/7L/MwGPW49z4UooOgAButkcoD 1QsFs2u1jzHghcZ36qfHQtRAc+WN/cJUQAGsewyT25bN8DL8F5alc5iQXHy8PG3pgQcl NobFb/S1HAn6WpzgK6M80HioUq7nnTHHV6FyaTh7BqzuhjjTE5oNLLEj0n30xG/8Zxok l3iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680836; x=1764285636; 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=POEtUhiKDMucv1U75gLO1B2WYaDcFKD6qvD9bzHNOGM=; b=uCqpKArMsVKd0fYIKkow0+LYTWHDbucVETCuanPmiaEDC0pF9FQWOg4UM+nydV4OsL L1piHea+Xe4mQA3TvmpzLRi1qNDydeael7NjJ7g18mDjln1x5xbS+AEoKWDmbRbMx0GS KmsGiwsdYIPZZXKRqsW+zYn/0M4MfiQV/5myB+ww/dI7Z6SQUC7Jn4vGsFTqdUUK8W/Y 7DejSMFbkqBCQ6paF7X3FCYtkFdQrdBokllOoWyCnwH3h2jShDOFlD/qAhRXDgSb/z3q 6xkRLC/qvYLOlAaSbhZTPs0SisFWjXzafEN9sgLJ15zrLOI2MGLrBlv9hCwueiYjGbUF VIXQ== X-Gm-Message-State: AOJu0YyUFvGawEb/04SjzvK6NB+OkAq7PF8OJVpQ3pbCMa8HFdIGxkZm adhhSEeJlIOazntLgTOSkdcOtY7AI0upikZkcEmdAeJNqXR6ApFzYi2llAujXOczquT/apC2kaH ZgCMiEdY= X-Gm-Gg: ASbGncshuqg2L+paaBcrzucnFaP9sB/PzfV/i6DHt0UjwlX3laJ68RkXHmUmmVhKxIA CaVzEStspXZHtZacFCAQqprGVqmkD0yLwYfwruHgGWHcKdSxp5xdiMg8hTM1ATP10PggppCBQZo /5PNXlv5rd9zGxPzWcn7FA4XLF6dJGouVKmz7a11A+RtNPAMf5xrpMyIKltabBrgwllm6zs/yP+ axevR+IoVDq9kaRxFtHqS9vwfs6HDV/4vP63P2vcMlO2QZEp4F12litqfwwQ2SDIu8oeG3JRs0A 2Zbkj+WqHR2qBlKsa0jzvPwR9xZNqdnZILntkPLMBfoQbuzNwmM1NN8FeT7ZYmdR7O7brNV2PaF 7iHxeKZ7K4Rklg09tVgvL9aj9L+n46BabTh9xuum635auyhtQj6jp6juWjPtpcixL2/Rlr2CaFS ZElaIyqbFIWDyZE3dw7gXyXcz3TrRfzsscDqUAjM1LwJo57+WyiwzhZAd9IbWJsngsERAh8ZIHv lOzHw== X-Google-Smtp-Source: AGHT+IF9rK9Byr0DBWUsbMfjJ0TN4UbGYQ42EIEyBy+IRGRCGPE+LYpACAugeoUtGY0M5tHfuljXPw== X-Received: by 2002:a05:600c:4e87:b0:46d:a04:50c6 with SMTP id 5b1f17b1804b1-477c01ebc76mr3109625e9.30.1763680835918; Thu, 20 Nov 2025 15:20:35 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:35 -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 06/22] libcamera: swstats_cpu: Move header to libcamera/internal/software_isp Date: Thu, 20 Nov 2025 23:20:03 +0000 Message-ID: <20251120232019.3590-7-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 Thu Nov 20 23:20:04 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: 25108 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 24221C3330 for ; Thu, 20 Nov 2025 23:20:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CC04960AB0; Fri, 21 Nov 2025 00:20:40 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="NBFfqUa/"; dkim-atps=neutral Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1EFC560A8A for ; Fri, 21 Nov 2025 00:20:38 +0100 (CET) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-477632b0621so9995585e9.2 for ; Thu, 20 Nov 2025 15:20:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680837; x=1764285637; 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=ghAief1BczG8dBZtklHiLxUtm0S3sgE9QT1CVt2nttY=; b=NBFfqUa/hkNakrcxFrUcTTukOVT7ErW/HG6/Q2wusKRAJhf2T68b1L3X00m31hsILa /R2+vHY1Ap1lwLu+hhe8+E5zm2wLK4ZcCEixwbAvipX9J+473ZTvbxQP/qfEERi6mwZu Ackq2aJPwNOI7ZG6iAehAmYBpruwFdldyr9ABHWaaV/CU9z1EWV7/4iOUsdlTPSWKdbm e58HDQeDYLaPItVfQ+HlzbOcKh5pXbe/AIjzD3g+Tnz9Kbay3PJDwMVuYIK+lRJ51518 6NbaUTKayJqFeWmdvpBN0rnZ0IGzwlibu5gLbu0ZhGBMCwWQj+Km/P4d3WrIqRlMsjH7 9evQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680837; x=1764285637; 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=ghAief1BczG8dBZtklHiLxUtm0S3sgE9QT1CVt2nttY=; b=CvEVnWJux2OTUCR8KMvgsOaLwAfnl9CZEHx42PHy9F4Curh1LyALdv/WPibTx+awbE Z7vjJ3SErRDE3t3SH84EgEMGUArSfBS2Ewtnx3ALu8aJXOMgoOhby4Fo2/1FlcjB/WH9 A8IUUxj2cfg6TukQ+oPSs4TLxeFPXhFmQ+f1n0p25AyPTKLYCt6okfFTBTk6cFKqNQGn DKP50HX9D+SxrfUjRCcdGQ9elbR1LhLV+Es79aru9L9GxQdmhgfzpmXeEHnFvoW1qOiY NJQSX6G2CS1uc0jsNp8r2gQpOQgLRUsKSrmr3tRkPpvf7ofRTiOMmbLWF4G+unx90fFj Ak5w== X-Gm-Message-State: AOJu0Yw5y5fmXWjoP0ivJVzOJQ4fKfyNRQjbx/Uce5HgWJLaHI5qK1mn fti5YUpo02YooaLfD+IPlQ0jgncbhTkHCCYB7qFsh7YfOslU5FHZIbYKsWSLx8IUz+BUCk6zQS+ xMps+mOQ= X-Gm-Gg: ASbGncs/9+0oj/38jGNibUP9A1maaarWlC027CqCAAcCX/U9nsKK5s0DrEoTnUxNICp 0a68xQrUbKILuPx/oMuUudYLQIsSGjvQ4Inmoa/KTj+4mCnjWxITo6u5hX9wnkq6DIVC41lWvEV 3j7dvXxWocJGBkQH/L3476gLAz5mLUwkUckAbjpDopFLYADUfF0F4y1et72GQMW/QEFzhTGJk4l 5ebGwIL07GTZoD5eOSByfb9IFradHFmMlTXmqtQO5tizjdmVcKOaZH1kYQk8foCv22TD9Cs3BgZ /OcWK4Mhk1xvNh4z2vckBYoCUZOYJWSo79Mmynkglxz7c8PKH6azoYvM2rM5mML3DbVGSTWxU0w DxC/8BEdlrE6UrOd+FJqcV0dK1b4HwPGl8uTCyYAJku3MFWid3Ojd2prz0FgwQ/Gyk3bhYrllSD z+LUveHJdEL0C2X4XCvjdMgXCUUOUszjCVXbPyvmF/qd+fBXqwS1fYBo7HKgmi2qW/p2w= X-Google-Smtp-Source: AGHT+IEi63MqipVcjTBhKxKTUJrxDud+upCl2qZtVYkaKvHcmXdRDZhrCsljFLXPub4QwFNlhDOdUg== X-Received: by 2002:a05:600c:a07:b0:477:a219:cdb7 with SMTP id 5b1f17b1804b1-477c10523aamr1053605e9.0.1763680837367; Thu, 20 Nov 2025 15:20:37 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:36 -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 07/22] libcamera: software_isp: Move benchmark code to its own class Date: Thu, 20 Nov 2025 23:20:04 +0000 Message-ID: <20251120232019.3590-8-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 Thu Nov 20 23:20:05 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: 25109 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 36E85C3330 for ; Thu, 20 Nov 2025 23:20:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C120B60A80; Fri, 21 Nov 2025 00:20:41 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="J2zaqsXK"; dkim-atps=neutral Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A92DA60A80 for ; Fri, 21 Nov 2025 00:20:39 +0100 (CET) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-47790b080e4so7868475e9.3 for ; Thu, 20 Nov 2025 15:20:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680839; x=1764285639; 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=yrAaF8kfmIMdOuL0ewQtH4n9iA/J3ddd4eeCQCFdbAQ=; b=J2zaqsXKdYfb4qR5zRPZx9zUi3QgHE7nYaPzk8avgI+obGylmPvslxCEg1gicJIB9s zOFuMqbi6pG3qJJmRnaC9dujeK4dBwrA71XxBalcnUisIVyQY1j85qYHyZYLCtIKv1LZ 6BIShXxOFJBtQhilw5NPDP7kFKwdtZm/TS+Y55J/6+7ZJVFW/aFwtD82ajc7JtIJXRgp jAS7RutHSa0nv3uJNTR3TS/j3CD+b1IhdZh4WfrBliJgHmJ19vwFMuYbWj58ZrWvLyqj J1PljdaZWRytJd2wP2TWnPeLszhj8kCBeSUDKy9U8paiGRUs1An7vfo+jDiEmgKENX1I gkvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680839; x=1764285639; 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=yrAaF8kfmIMdOuL0ewQtH4n9iA/J3ddd4eeCQCFdbAQ=; b=vi9lkEGNPyPUc9Q5gxdSf2WqCTOR0P152Zzn8thvNcWdXUY9SNS5u49rnORn7xSrJ7 B1X0/ZYjiC/430EqZH2llKOB1m5t3JXioOstKocbnCxfywvN/ZT1A6pChYqNUHIRIDk5 2FOb3MV25JuhPxbNlz8sY9wj3RjROJOcSPWLqvfzJqbVdp1nE1HeNdnRHdXmiQMnDlLI IGA4mDSnIrDd+S6DkeakDqtaIblVP2B9tid6KybwP8/sSK6OdmegC4VbEe2Y8Kl7ERuO v06oJiSXZ7nNvKRG4669FF8aTqpmI73f7ObwRS/FE0eFgKP6WZ6heV+lDQXt8ZDsfipS TlzQ== X-Gm-Message-State: AOJu0Ywk3566R2CKwBRUX/R8Gvso16HYIm/lfVabqvaiaU6rCOl0O+lK FRMIyvC1llguz4BUaDhNWWPNNkpIRGrDU3zevMK+L2Lb7pqN+3+kN5JNLFtnFkxDLHd25V/ICWd VpoP/61Y= X-Gm-Gg: ASbGncssvz/g6RmNFwOcbx3cgr6ENYrpm1xGKGC3BU6N4lj6K0Xo2qlRh1juclirtGU +ravdMLrvXSp/fdr1zNLVk0ZMynopggGtntvCvsyr9q4EfYvyng9Gs+IWHObDYs7s8HJWYnMb5i l4u2GjQ+tJkkHmhieDzRJnNGbat3AiZ8tH3G2TAuKb2X/MlrUgkmUCH1aykaXT+lC1gPr+oBcVj rs+kKXVMuifJi+kzJkECDcnobjQhqbf0XlHdim1Inu9g6QhG3nSxTSV28oF1kZ5Zyzo8T5mSISy F49wyS+ymem2fuu6bCZgFuMlOcQLvPy2mzHDtkCzA0H7WgOdssz76xe4ZNf7dBDT23dJre3ZkqG +IcAAQEWI0z8Mic56lLiRmZrtaETpYg/vw/SLvuyCCZ9N2KH8Vt6X95yZwBeoT7QPA684gHblaG Y5xWQFN02cgRwwtUZl1iObH92wbblk5l8W6IbqlrjkNhp4PiTPmoG4TM/k4e9DKb9IgeY= X-Google-Smtp-Source: AGHT+IGgZPdT5NZicNYjfh8wf1cTv/cHhtJi3V01I6n5XNRPO7z9oA9MFXsK8cnXMGEp2jgP3xFT+A== X-Received: by 2002:a05:600c:19d4:b0:477:63b5:6f3a with SMTP id 5b1f17b1804b1-477c112635amr345725e9.27.1763680838921; Thu, 20 Nov 2025 15:20:38 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:38 -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 08/22] libcamera: swstats_cpu: Add processFrame() method Date: Thu, 20 Nov 2025 23:20:05 +0000 Message-ID: <20251120232019.3590-9-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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] 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 | 64 ++++++++++++++++++- 3 files changed, 79 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..f5906197b 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,50 @@ 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) +{ + 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 Thu Nov 20 23:20:06 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: 25110 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 BE658C3330 for ; Thu, 20 Nov 2025 23:20:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 84B6360AA4; Fri, 21 Nov 2025 00:20:44 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="KbhNMKhe"; 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 C8D4960A8A for ; Fri, 21 Nov 2025 00:20:41 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4779aa4f928so13841125e9.1 for ; Thu, 20 Nov 2025 15:20:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680841; x=1764285641; 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=zVktTW+jzDGHUXwiqWUbvZQ5i5MyV+LhWJh64BRRBbI=; b=KbhNMKheKWOS8YNlA3ie0gGEE5a+GY6EaU8q0i0Osj+T7vgkgyHN9+biOaIkB7XV8h BzAbqBeIy0RWxoHDlvYXzqUgrMo6J00A7Bi3XSdDJLp9MGnMLgXVcluinwdJDOT52liL mjQ7cD8P3113TWqjdjgObRcFmHX4/3RcSroLGwn/bxbz/UBRuMmGJQPgzMUKM+H7nbXQ W6VwJetPm2WKW55l0QDRpaREIm5By3pZgDWdg1Sq2aVpTg571dCKECLsj+fflCBseR3Y oXxUlu/sVW3WLHYXld58HFybFoAJ8gkeyp4ZXJ181MxAwPcaQ7Rbeu3hFM3tkPwbYTeI 9/Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680841; x=1764285641; 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=zVktTW+jzDGHUXwiqWUbvZQ5i5MyV+LhWJh64BRRBbI=; b=Mx0a3CsbCQhx0QjdaNnY7FD9SnApEbwOwBf9sX1qeK6Pr9wKJn2lrM/qOCXqwDXpUv ZdAGgMkdBMEygqIg2liHRrPidnysCZ48Y/2ljGjeDRBkKBNGjCVBgHKnGgu8Q7ySUiGU V+e5tVR1kUq5gWcjkdUr6R3kJIID5f6kRomYEYQD/w5SK/pGSJhEEAVso7LyOzeBGDew Qr4yUiXgfnhJ4HIwfc9r/ixefITGWW6oqDC/5eGOAzoQoLc3HCpZz3b1CVXlPnsBpRlc 9KUk9nPrG717Az2U71XX751qn66vHo5lNRfnSnFJHVlf8eMttpEO4C45b/TA1wBBOi0d ZOSQ== X-Gm-Message-State: AOJu0YwXjppbbSAgjvNgkK02Qk2xoQGQCJlDQKBGyk8aTw/HKead23Io inwjUD8e5qrtBWKKE/ByJ7+7VA30Ejgj0UFkdWue1KR9X0EDj7pkEuuPbrV8vTVGQT78YxJpICF U2RGziuE= X-Gm-Gg: ASbGnct2cQuU/gfy50RyE1c7zKTpAF8YFsS2wHsQDuA57lq71H1+EPhsHepe97jsZnH In6XEG8Y51UJQKbZNOyG3L5oPyvqjS0zSBMlJThOzQwiaCDv0zwvoizCOlIH1CkHkbb+RiWJOFm iAH1mZsY3WonDqSlXbHD+uHd+0NB0+xl0vxbpvdcJN2jOJFi9T2GH0btdhhtkt8cTkMCca7qX3h d0T8cK7UGRxhanfFeynYMTD0H+mY9xZ8ijfMtKGWhWCDXupd8yEv6cRSPmqsG25/znqIcz33Aah VRkK5u3LDNcY9X8mZfMeunqV1kZekqtH+y375gGo9amMRDmEv/RnOv7vIRqu1eWn8Dzv3v3+3Vm zkvnVAJuWFdLAa5Vvstd/cRC+tTn7uxSJGPAYpoe8oThU28TcMIy2i5D/XHLhuUNIwl8u9D1P7y rvOdmSPnBwE5G7zPG6C1FLdzGXEDFsre3JfyiHEbV6t+ORqjzIvITwBOOGcISSBYCTnNg= X-Google-Smtp-Source: AGHT+IHDoTRBAw7aA/ZWbvn7gmFKfGi8Gm18/KuuM3RcDheV12Og51BP3pcBnN+V8+QJ3Woe4aROeA== X-Received: by 2002:a05:600c:470d:b0:475:dd7f:f6cd with SMTP id 5b1f17b1804b1-477c01f751cmr3262485e9.35.1763680840954; Thu, 20 Nov 2025 15:20:40 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:39 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Kieran Bingham Subject: [PATCH 09/22] libcamera: software_isp: Move useful items from DebayerCpu to Debayer base class Date: Thu, 20 Nov 2025 23:20:06 +0000 Message-ID: <20251120232019.3590-10-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 | 6 +++ src/libcamera/software_isp/debayer.h | 63 +++++++++++++++++++++- src/libcamera/software_isp/debayer_cpu.cpp | 2 +- src/libcamera/software_isp/debayer_cpu.h | 41 +------------- 4 files changed, 70 insertions(+), 42 deletions(-) diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index e9e18c488..e9130df1e 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 diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index ba033d440..578535b20 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,10 +49,67 @@ public: virtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0; + /** + * \brief Get the file descriptor for the statistics + * + * \return the file descriptor pointing to the statistics + */ + virtual const SharedFD &getStatsFD() = 0; + + /** + * \brief Get the output frame size + * + * \return The output frame size + */ + unsigned int frameSize() { return outputConfig_.frameSize; } + Signal inputBufferReady; Signal outputBufferReady; + /** + * struct DebayerInputConfig + * + * Structure to describe the incoming Bayer parameters. + */ + struct DebayerInputConfig { + Size patternSize; /**< patternSize size of the Bayer pattern in pixels */ + unsigned int bpp; /**< bpp Memory used per pixel, not precision */ + unsigned int stride; /**< stride Line stride in bytes */ + std::vector outputFormats; /**< outputFormats List of supported output pixel formats */ + }; + + /** + * struct DebayerOutputConfig + * + * Structure to describe the output pattern requested to the Debayer logic. + */ + struct DebayerOutputConfig { + unsigned int bpp; /**< bpp Memory used per pixel, not precision */ + unsigned int stride; /**< stride Line stride in bytes */ + unsigned int frameSize; /**< framesize Total frame size in bytes */ + }; + + DebayerInputConfig inputConfig_; /**< inputConfig_ debayer input config params */ + DebayerOutputConfig outputConfig_; /**< outputConfig_ debayer output config data */ + DebayerParams::LookupTable red_; /**< red_ DebayerParams red_ lookup table */ + DebayerParams::LookupTable green_; /**< green_ DebayerParams green_ lookup table */ + DebayerParams::LookupTable blue_; /**< blue_ DebayerParams blue_ lookup table */ + DebayerParams::CcmLookupTable redCcm_; /**< redCcm_ Red Colour Correction matrix lookup table */ + DebayerParams::CcmLookupTable greenCcm_; /**< greenCcm_ Green Colour Correction matrix lookup table */ + DebayerParams::CcmLookupTable blueCcm_; /**< blueCcm_ Blue Colour Correction matrix lookup table */ + DebayerParams::LookupTable gammaLut_; /**< gammaLut_ Gamma Lut lookup table */ + bool swapRedBlueGains_; /**< swapRedBlueGains_ bool to indicate swapping of red/blue gains */ + Benchmark bench_; /**< bench_ an instance of the Benchmark class */ + private: + /** + * \fn patternSize(PixelFormat inputFormat) + * \var DebayerInputConfig::patternSize + * \brief Size of the Bayer pattern in pixels + * + * The width and height of the Bayer color filter array pattern. For standard + * Bayer formats (BGGR, GRBG, GBRG, RGGB) this is typically 2x2 pixels. + */ 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 Thu Nov 20 23:20:07 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: 25111 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 675A5C3333 for ; Thu, 20 Nov 2025 23:20:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1268460AB2; Fri, 21 Nov 2025 00:20:45 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="rxwqmCzz"; 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 4A6AE60A8A for ; Fri, 21 Nov 2025 00:20:43 +0100 (CET) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-47798ded6fcso8877155e9.1 for ; Thu, 20 Nov 2025 15:20:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680842; x=1764285642; 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=6taQd3w4X1L7oCzH3j3Wpop7VYRFzi9h4x9pwFGHnV8=; b=rxwqmCzztppcewPysY5p7W1ZLgV5HlEVbO0tq+WzYzk8uOTVQouNpaWe5ro8X5rxPc YuW9SMQUbwC0jYPk8mvJ7KYmi91x3JaC+uKcu4q2MXcVUn2iCBfJcrCRjg4TYnrRD/a6 MH/A0a6/TQN7quQj280iArXejn20UM41+ILjVgOgJ+o9QpWCzC2q3Y8ClicqgFDMvR++ sp2FT92SxggokygjksV88rnKZ4vmVM1mdub5gFr7kmgWf9MM2MDRR6xo0MP8MKjFWhm5 FdeLxA7cOx1MwWZ+CJ6+O3QwSmGJFlm4ffQInQgT/0Bwb62o0jtpUHgiQkP0BU3FD9X0 s5bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680842; x=1764285642; 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=6taQd3w4X1L7oCzH3j3Wpop7VYRFzi9h4x9pwFGHnV8=; b=taEzp2YkJ3tEvAZHwzR1HcsMfRXHx9jFsKGfVx7rUSPQsq7cPILNAmpsSlpyEOZFaO uEaiutk3o2GZuFlJ4xe/C/PANL+fu8KOBF5NKstEC6vjBF7ZyCeMvCUa09pEQGi1raOB /F8Yulem0CaxrtDD6p27TqHk+/tt3/TJ2GXYfNvIs/ZzBwx74XfaqXlEPVnW7HK5qVq0 bvaDCaeN/NJGbIKKDSygc+OYe+2LflwnPYmQIzOIc9oQLBLFa/O1637lOrOAQsBSKWnm jUm0XLcReQ4B6p8038D6l0vHANqotpsATEZKZEHDx0FeAMXlu2Ydwxzq3Pa7s2jDgZK4 6Ntw== X-Gm-Message-State: AOJu0YyEc5rvnBs4wMvv6EQtftnSUO6JD/NgIu+8OSMs8FAvkyi0LTa+ vF4PVamm/QCXr75/CNW+GONaqoGhqBHqikBLsGWnenNSHBFhUNsgOTUgtKjAAkrI0sFGqXy2+/Q w+WfxHJM= X-Gm-Gg: ASbGncsg42fld5zKRIX3dp4L3W8VSRHC1z7bJNKTdRB/BAtjiN7RQ8LO9hRNayuhYwd SLpcIPM6c2VotZrUJTjKhC36Vh3rf+dDHmJq9GXLPBsgkuU10NlK9HVMRAHotwfpiedehD7hAYY 74QDxt4jfO/oyb8AuILK9WypgoubUPS5crbRWn6o+nDeNXXUcC28NMcMRgBr/qIIBNKKMAer9nW XQawelLcTxdAyGmN14YEoKlqSjN9BlSYrBdH+DEXvK0sFo4nDwXaKfDy3MY5Np/pbFeBDW26mWa 309zHQttpTuGtD7f2YSg7JiFENkW+wVwxki4Wzvd5bAwC8/nZa3qFuuN8wZHXjD+NFSEOQmJ4p7 c2fB2DWdJ0zVspMeTsfDZIpA1PD+LZN+PVIVgzKcFpN+EvmhR/NNmRf8nbOPc45A9Mpgf/0Gumy qCPrgyVuEc4vK7clihraotCLOFk7EhqIbAloG/L3iiBTYQThcR/uXktu5oj9LmRUpTFhU= X-Google-Smtp-Source: AGHT+IGPVfSINfNlHRtOdH9zwOfPn0hHHkM5fDAP7QiF9spkFXScVpbOrajmrhoafPWNJd4UspJyyA== X-Received: by 2002:a05:600c:5249:b0:477:5897:a0c4 with SMTP id 5b1f17b1804b1-477c10c858bmr541755e9.4.1763680842624; Thu, 20 Nov 2025 15:20:42 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:41 -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 10/22] libcamera: software_isp: Move Bayer params init from DebayerCpu to Debayer Date: Thu, 20 Nov 2025 23:20:07 +0000 Message-ID: <20251120232019.3590-11-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 e9130df1e..f267f8c7f 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 578535b20..dc0b8e67b 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 Thu Nov 20 23:20:08 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: 25112 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 6586CC3330 for ; Thu, 20 Nov 2025 23:20:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2088760AB7; Fri, 21 Nov 2025 00:20:47 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="PAq9+Fbz"; dkim-atps=neutral Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B117C60AAF for ; Fri, 21 Nov 2025 00:20:44 +0100 (CET) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-47775fb6cb4so10206175e9.0 for ; Thu, 20 Nov 2025 15:20:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680844; x=1764285644; 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=5RzA2VjoFGo8Y8DWFS3Wdghq/DKfdgt6/HWUREdw1BA=; b=PAq9+FbznkwBtxqT6zgW7MfP3ETuPiDICa+Q08weWmHmZ7eHZMfmStT3CvGc2iivSY HbdUNsxkWrGsy2C21u3kaiLyEc9rZBW4Z/M/g5U7X3Pwf8BYnPrWt1Z5pw9WWkMt4LNi 4JmyHJFKItRWsrGcsURHXwzaDnIJKoJH131wLJETyKSO9Dsu4fVrg/5FQ1eOxoUkzW++ Pas5ZeTTcZrDDiN7XzzRmyuKa8NY8S/yvy8jyuKqWNH2ZVAbwrjAXuhcdXKX8EDWaMbd GDf1FYJVwd3ZSam7SnE3VLfX5go+zZgo69UzxVo5O2NqlF1up10Nt7y5yrWEp7wP6svu qm/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680844; x=1764285644; 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=5RzA2VjoFGo8Y8DWFS3Wdghq/DKfdgt6/HWUREdw1BA=; b=S8xphJhDfz+HcolQJU4GOJcF4EWStdUhKMQG+z58ym5HHNGznMuMLnTAWi4rlSe08s 3YN/RWXcFgDzn7hjdE6jzZ47aFm8jQBVheKW0GmLX96h1EhYX7vJVJ/+p7cWI7Jm9eMY uTBFc8tYaisP8a3XTHov1t93SkQkLwIechnxMXW+BXDPXbnDdBKeESUn9dmrS/Rha4GC 72Zz1IFQbMLNySKhrZDd8JA4vszYJn+4WkoWEPpB548UEcmCNqy2bzcPJwOUhXTmMHXM t+7ID26OIqF6AuDoOPs5HvY01/jN2iZqJrvkhz7zmH/FQOjgDbJDdIay9PtM5lfGpauH RDlA== X-Gm-Message-State: AOJu0YxgaU4IcAWht00jeq63Hd+TZVgKoszUVkJbDgvP2WLujqwif6vm HRITWTNlnrIHGlT1vECztcsDylDTD7I/W9tjEozYHNsgK9oRRWQcvdgQo6FiX0pdSr3oOxgOQ2c C9YIQvTM= X-Gm-Gg: ASbGncvSjYLnHRVxr3gHXVrO+CrUysQksR2SImL5myAKZHSd7TRDo1FQRJrooyCCxgn YGTAslDiVmmoYYSKiXqgQQKd7P+Es3GSSY22lZl8Tt5QF4I/nSM/oEMAtIvmb31nQf4XJLfnf3Z rnpdW967B/bOBB5uG3sfQA7EPwHfNNspKbZisafdKfxk5nXA0WyrL8EAxiGGl96S1ESAfNtQeda 6iDCCSUUlxaMP1q8BUEutATrRsyQDlkszYSTL8vgimYDTiDs4dFXDlmxViV2ma/+O14VPcIsncd XMd03Ig8z7s9tXoJeiRTOswcDSYtD1+4nrxJ/OEV40uBdJV7//rK5RNj+tOqAbDvxWe2rJ9RTAW SUrkho/ZIbdGCZSZIWnsTYLU2MixSThrFqlaexSDVBr/bDPs7ac7P7Trh+giLA/D10DIzZPYLDL a7zIr0L7/hGJ3oo4V1wsF+0uh+u7cUhmWPkS4JLt7fBVKAjO/OZqCYI+OJ7gT7xlum+xW2pZTeY oprXQ== X-Google-Smtp-Source: AGHT+IFMg5r4Pc8TsMtLy0Nh+xdmQpXAKwKToCC037X7lghQqKfnXz79BXw+8Gnpd0RI2oXihcqj2A== X-Received: by 2002:a05:600c:198e:b0:46e:33b2:c8da with SMTP id 5b1f17b1804b1-477c1133927mr330985e9.32.1763680844054; Thu, 20 Nov 2025 15:20:44 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:43 -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 11/22] libcamera: software_isp: Move param select code to Debayer base class Date: Thu, 20 Nov 2025 23:20:08 +0000 Message-ID: <20251120232019.3590-12-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 f267f8c7f..af40f5107 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -193,4 +193,32 @@ Debayer::~Debayer() * \brief Signals when the output buffer is ready */ +/** + * \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 dc0b8e67b..0b5e11abd 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -111,6 +111,9 @@ private: * Bayer formats (BGGR, GRBG, GBRG, RGGB) this is typically 2x2 pixels. */ 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 Thu Nov 20 23:20:09 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: 25113 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 F13F5C3330 for ; Thu, 20 Nov 2025 23:20:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A410860ABB; Fri, 21 Nov 2025 00:20:48 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="TxplIrwn"; dkim-atps=neutral Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7290060AA8 for ; Fri, 21 Nov 2025 00:20:46 +0100 (CET) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-42b3108f41fso884878f8f.3 for ; Thu, 20 Nov 2025 15:20:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680846; x=1764285646; 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=3KNxt7sun2ScTJ5zZqBzup1sCzFwl/1rNCfJO4h1TH8=; b=TxplIrwn/TiFgIlvgapq6Kk17FhjHHSmrbdLfm5SRsfvMdz/TLJENh1V3RoE0/RGvn MXhWsfO72ZH91tIrVoNo0HlWELFeFCioln/b9FIljXbYWzK41bf6X26XW4DJkXENoElJ JpAZwsDUIzNNS74kDVlHgzrYtqCvetDJitAi8M1OJU/vdT/UI9ncafexIQC4xsOnepUn oJSOR8BZOdtE3nylotYh/cW+Fex9/PxZwdLa4Yg8RO0yXM+jV/qz0s0oPP1iMXwUU9VP QJt+oIp5Dp93mR8H01AEf2Sg3XkdIV99PRrm6ytmvvS0qzFGRHCB2EBsbFcW1+Fzal/c fCOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680846; x=1764285646; 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=3KNxt7sun2ScTJ5zZqBzup1sCzFwl/1rNCfJO4h1TH8=; b=NnzcfTjb1b2nGf15miEeulkAkFaxXEjo0+oolDZMepiN9k9uE4wVzlfbbwmbSqEQtc yDVstdvkErYWdqDY3zmOAmHVsgVmkwBGxvfnnWYdH1SVmsFtxrQMgsrV9jRySA6ifLGt 8M+MyCgN5B4RkLuezqhLW7P4/52uCSXRiZve2OoSeq29XbmmX5lPXQoZ41C93DL6fN8C M4WB8+UBEC+RChoZ8SkTbONBdadbF4CnJYlDQKvBYWVq8FywkfZ9xaFbj9ulIv/KoNQt pJxrBuxH9Bj2dDM8tJ77EjGjwx+tltPzfomNBPyjFaLONu3pC8Az2bHWZsqjEVYnkP+g 9jjQ== X-Gm-Message-State: AOJu0Yzp6T/CUR658bOkU1LJAG/733z4EehyAHWC3cJ5JRN5dw8TaaQb tDE2GsopgbCi/FWxFIU0OGY/S2FVuiEygEK1poWCSBG9ylNpLRh0odivmdHBAXy0k01DHSvmWEk Wx9lskEg= X-Gm-Gg: ASbGnctMjtImxO8mVK06MtMnKVByZ3INleQRdhFhtX+hC7QBh6z5KUEMW/OO17gcU/p 5b3z7GnwVGRClvSYlzfXMDnPPhC5uOm2UoSGOuaINGAPeiPayNlwVhfvq+q8G/1cxCUuaiO3nri 9d36f8wi+R1tyDHaoV8G/DJTyljkNFI33aEdatblWo1yZr4AskaaRV3VwMADrzZfl6crhYg/fSj b9Pne4W/JJ4DqUy3NKyChQPQPbMdlBgbeh/dDRCZW1KzXrM/0WUuQ6azQVrTSO2zYd0Ujs5lHyQ WseYQFQ1yx1IlUe2iUgF6rlGUGWVpE77MPQd5tp6CTcbNWXt/u5peRpG/EOfRcqXDuOttI6cvkU nUMyIsyJjJwSVxym9CdXapYBYayKCWv86qTUfCkZsISvOSv/pIGNKbvP/9wf3FO0UkjhzGCiydt oBixg7kXOyuLrG8snBotAIFc+2roS2ra2dd3Epe4fYQGVlL9e44hjOV8Skg6J8GDzmHeuvDvyX7 4iUDw== X-Google-Smtp-Source: AGHT+IEMYk/DzaHQP8V2b5WyW49AXlrJ9oDC2fIKgWUv7cN9ImUR+AqG/usqkp8FulD3KCFTzsPLSw== X-Received: by 2002:a05:6000:2281:b0:42b:2e1c:6341 with SMTP id ffacd0b85a97d-42cc1abe28bmr86173f8f.9.1763680845742; Thu, 20 Nov 2025 15:20:45 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:45 -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 12/22] libcamera: software_isp: Move DMA Sync code to Debayer base class Date: Thu, 20 Nov 2025 23:20:09 +0000 Message-ID: <20251120232019.3590-13-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 af40f5107..795c68af7 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -221,4 +221,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 0b5e11abd..334211215 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" @@ -114,6 +115,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 Thu Nov 20 23:20:10 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: 25114 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 99FEEC3330 for ; Thu, 20 Nov 2025 23:20:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 51DF460ABD; Fri, 21 Nov 2025 00:20:50 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="J+Yxa4+g"; dkim-atps=neutral Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1D03460A80 for ; Fri, 21 Nov 2025 00:20:48 +0100 (CET) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-477632d9326so9117605e9.1 for ; Thu, 20 Nov 2025 15:20:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680847; x=1764285647; 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=fuB5nZvmUnr2qr/n7eHSpAHaAkGWzDTTnkqO1/Mr7cs=; b=J+Yxa4+g/P0sE9xYQdFtY7TwVc8EFImoR1V/PMP3DupeleV0Ugutz6BKSlbwFVAewV ZF9b97UGWYsKYCrkihlvWFI0gdI1fV3CuKeHTVasg+dFnAooBgWIgzShS9b9Adw7ZsNL LppA+38wufzKt9jRkewIM/S79t+ENFP6JHASqNTrLq5NyKSlBnSrU1fFgEPoINNmI3uL 1NsItLn+pwVQhoTwY0d0TAkDIKUCHZ9SSCty5ZrpCowX9L7jzSktEgUyJUin/HjQ4emS 9nUgHtCxadUoC06Cz2a76s6OsQuOi/LdacDF4GeENHVq5P7vWmMpJLN3VLXLBXUzbesM JR8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680847; x=1764285647; 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=fuB5nZvmUnr2qr/n7eHSpAHaAkGWzDTTnkqO1/Mr7cs=; b=CRKyQWS9sIZaLuCWq10hxofbpsL2scIllPY7sMTcsOatXwSdOQbT21hyTvS4QxmfQd nTenqR7RY9MxdtjZZQDtWMQrphKHK6cIYGsOpDcx6UHjy5YoU0HEnFsvwmb/VnGlreGi wIXytWs9SLFg/xb07Lx2xsCBoUBOCb9IGHdpMPAYbXCAU9jZAfRuepTH3znXWUQU7InP EG7eXOhT3J/l8tMkUsUWj4vEFl6M7vtFCajXtYTo6BAWrHkY+gDiJMRhX8ESroJDZJFz fbY2BHHHmGcPRmbRUVcou46FMVlNV9jUh3IstbpuUFaPx+5RgD7v1TH0m0dFFVHcbje1 pzVQ== X-Gm-Message-State: AOJu0YyzvwBpWVpPKuQI6X82FWlKdbZidA2FKVGRyPHtX3u7srR9DyVg hCFX5Hj9XPVlR6zDlUDWr2XwQRP4L9+9JC7DJBECXtc8PopBGy+hsRQrgIeWG+jBsUpDKD2b8yK T93wNc5s= X-Gm-Gg: ASbGncvSWmEUALS2Vuq9th/Xg1jd4Jctz3aVEyCnXLM4Y1dt7U9069uPp09mIyzDYit MI82PxMetLBSlSeBNDVdLZSRyuWoE7fBw3gzu6Y9fmPm2ahqLH//Vi0EA/5mwmXDfXIAUoAVbTd MMNUIUdtKu9SLostghLOg7/fiholzBzQtqYhjdoapKc9D9DwCZz/VV8fISkGX+yi7uAG6GYtNYX 4dz/8MGOsLf83DO61yl4MGn4A3niA5Gu9g29dLfp5gbI0RUyiUp+HFLYtdgiQs08msa9tHcDqQr s4KhkIna6XBbhriMoYw05EX2sOuTcqvQVnQIiiXiDFa4JJPiy0MO6IdxDdWSAlxAqTOJoSkttzt NywMbkT8azkw3sPZt9Qd/LlBXL8rL3Qi4FeUzdtPFX16U+T0bW8uYzYT71BsTasr0szYLmGfApx JxtYUZjp1Ovxi813vVcq1jCHwnfYEpt/ATkJLn9ksFSvMM8f2zHzgLCAC4NAzm3vhh9W8YAb2Sk iPtyA== X-Google-Smtp-Source: AGHT+IEhYt6l8Tv6P+rAi+PuUj4PoDBlOvFNfnReXaRXKr9d4cV7VsQVbWOWrIK5BppbaZfw1ON6ZQ== X-Received: by 2002:a05:600c:4506:b0:477:7bca:8b2b with SMTP id 5b1f17b1804b1-477c0190e57mr3754645e9.15.1763680847459; Thu, 20 Nov 2025 15:20:47 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:46 -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 13/22] libcamera: software_isp: Make output DMA sync contingent Date: Thu, 20 Nov 2025 23:20:10 +0000 Message-ID: <20251120232019.3590-14-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 795c68af7..8a53437e9 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -230,8 +230,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 Thu Nov 20 23:20:11 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: 25115 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 51F77C3333 for ; Thu, 20 Nov 2025 23:20:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F23B960AB3; Fri, 21 Nov 2025 00:20:50 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="AZLIAG+4"; dkim-atps=neutral Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 37DCE60AAF for ; Fri, 21 Nov 2025 00:20:49 +0100 (CET) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-47796a837c7so9424795e9.0 for ; Thu, 20 Nov 2025 15:20:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680848; x=1764285648; 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=P/vViwioaRQnkwkLzBBnhXzc9u7iK4MAB2njnFCGogQ=; b=AZLIAG+4PyTCzxwOVwgdjIfa9Dla0qseG1ea4nzxs80GNZq15XyngGdl2N8+BsRK42 MXyDfCCpJMwyLPYYx6xr0boQrmV1jlelJrF2yUwgMdt0LD0FxGbrxUgvqtsstHnFQ/Cc 4FH0xygU+CRvvylm2vJ5B93MMKnO7sn0mjMmc7jx4N/dYOlFAyfMLmZST+jPWBhjvvHU AVtUKpVaDIfBXlLbMAxC2ouDIrltzBrEo1uMj2ByaeSGL5p1CFezU6ixapMNR6pJ5buz b88nFsP4JZQvLQDHiAUKb7DifYSARdMYbf4u9WwrCNmWhf6bKmuG3olDa5yvDn3zdndN DXkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680848; x=1764285648; 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=P/vViwioaRQnkwkLzBBnhXzc9u7iK4MAB2njnFCGogQ=; b=rH0sg21qHy4s396jPfhAL2qY+kmCzWL1/mya4IT2PuUff07DuA0swBaDWq+tACNT9G 4E5C96QyUsZWRvWNjbW93wSQbtuSFer+19IiXONUXHGx/koNfaachVU/iuHoAZrqkT2X n1Od61lSeDdeLdPANLweR+gM1wNK3U6YlIZZuaEEw5nerIrQH4dLOqm9JEodcn/7pozE sU6c7ovA1YWC2kR9VF1ENgyopGWKrMo+nNYVQHiLSAPIK4c6Q0Tsu6XY9OufeT5vvppQ dD0aR2ZUcMrh5Qoi65lvlS1XuFE7YhGwZUH8dSuMhRzMfoxlz/SR8U9MZZGl+70EE8Kb lisA== X-Gm-Message-State: AOJu0YxZTtTA7WPUCMthaYA86KER4Whfh4WOMSzB/fF5mEkzdi/Tj0mL Tk/VE9iSmK5tqucOOyVhWZYSetG5bMko2U1cTnDhDSrhfUXLv7Eju1NDA2TM/oPUHWQIFx2lT6D aWAPss+A= X-Gm-Gg: ASbGncukbDqAWDBG05ruXT+oGGLbRaT3tdzCFFk5j9WH4M2KrOGcvwu+U4tzmR6lhhb +ZvfxvcCZCdgECFZ3HFf8RyThedbaYO64ZHymeSFSZtiOvDv7csy2O46tMygYFsU6DBBVpzSLxc oJQl39T0kJnFbsLaXS+eDCScjOxwqAek21BDnuPQrtgSM03sVVojaiRHq0/KJOskpTylz5q38g2 TGP82/X49PJdPV0K3QnAQ7/z5vYDqPDHbWBIIJRFeqxpFkDECmEiFB0+y5M9hei7HNYVXqUudIW rn19hzxuHNbx990Txvs4h0HlA7B6QgmuPDhCGGywlxsnedUh0KIXWSWaYYfQ9j+HwOoeuVdXIS8 6vFadhx/C8eQmHB+faVymRQkTpojIdFX+DsfuVC4grLx8PZTyE3I34+sA7DjG0T5+FD280nR+zr bPSlVM6sKxOwC9JnYJl8oyoo2SQ5wP3CvlYQuSQoUBiDylTEtAQ6v5yfMG3CBfxPjofZE= X-Google-Smtp-Source: AGHT+IG/UQAVf29+IYijztD5D0i+UYGbaaJ9llpkWn1cv9fnT+huQY3NzXdRXGRBvutSr6hfehWW0A== X-Received: by 2002:a05:600c:468c:b0:477:79f8:daa8 with SMTP id 5b1f17b1804b1-477c01b219amr3584435e9.17.1763680848531; Thu, 20 Nov 2025 15:20:48 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:47 -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 14/22] libcamera: software_isp: Move isStandardBayerOrder to base class Date: Thu, 20 Nov 2025 23:20:11 +0000 Message-ID: <20251120232019.3590-15-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 8a53437e9..441e49522 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -236,4 +236,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 334211215..26787a985 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" @@ -116,6 +117,7 @@ private: protected: void setParams(DebayerParams ¶ms); void dmaSyncBegin(std::vector &dmaSyncers, FrameBuffer *input, FrameBuffer *output); + 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 Thu Nov 20 23:20:12 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: 25116 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 D5EDAC3330 for ; Thu, 20 Nov 2025 23:20:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9691160AB3; Fri, 21 Nov 2025 00:20:53 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="WnU+HEeh"; 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 D4CA260AAF for ; Fri, 21 Nov 2025 00:20:50 +0100 (CET) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-429c7869704so1230305f8f.2 for ; Thu, 20 Nov 2025 15:20:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680850; x=1764285650; 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=0FUA8kH36pvKSfSDc4qeO8M3Vhl+74knCB5rIoM7BX0=; b=WnU+HEehTy4PQIMU+0tZUKnsJfnW3VGNyOwIwRdYBCrAyGdg5Mb9Vc3SsJoOrEtsmF 3lwS58R8I3RCWNuN5secw5hhzi2tT4mnlB7bzHsg1k/aMWBNNrqZsoKEqhpee3JGTPR2 /Cpfo7wyxO9OlM8wsE7wybWXb9+2frqQ/LqO/oNjW3gh0ouxuij3Zs/BHWJHkRO3V+Ul 5+YE4qmu4QMF+nbe74unUwxg0QJ0v8KlsZXTXPiE2b7oTZ/0Npdh4GCWUNgapOO1LX9p XMs2OfFCsksNXsALE8MPe3nVPZGQc8sxq5V3wwMTlxLlqpWA3OiaYtzQdJlj8Z+kWHYG o/cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680850; x=1764285650; 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=0FUA8kH36pvKSfSDc4qeO8M3Vhl+74knCB5rIoM7BX0=; b=RNnN5oJicqS/2bVUEWjQTfyb5dQihS91VjHnBZyLcY4vFcAD1TqiIsohidTouSazMA ZXAnJI3i1S9iHv66Mwfz3o2mKdhXHDWC2WPZ2nFnfjtOe0/AaIymSLESRZ7NNgWuDcEg G0Mtz4QS6xx4BBoZK1HymZCLQHVuFB+08szN3Ga1oqrKLKEPkPbhZK552zaLVOXsJFe2 3HzRfcXAlJOekPI8icuk0DWzO9OZeAbkd+K5qmjoQDeiXhT6VBTUv7xk1p0ETKS7Zqsq 0sAZsPbxDmx/lTnQ0liuvKh8kaylqCLdH58rOd14EELj1RgyMzSLP2DvKKqpRx4d5SFz Y1Dg== X-Gm-Message-State: AOJu0YyfluCd74iyvixhjM5S2vW0xMsiCaVVu2lLhxnYCFrYOn1ommWr 2XVOY8eRwZg0l3aJR6InvV4KQr8+K+eqWqh1YRyJlcm0T61Mb1S4ykz5r2z7uOT/K6tWxzNy4H5 KXsBWSU0= X-Gm-Gg: ASbGncsUaHJn/nJmlf0uojp4afbywbUynJvidz30hoAknnZVDxR0qcuq5LAkCjwhqDi SMm/XSkkz6LUy/6dh1ArtA5aPYPjlbbKR9O2t3aZYhhsNfb0gQRlSy5HiaLPSPgmyJixGPRCFpM afdOGKD6gXYnsNVHXKZ2+O64xJBXDEwg4Hl9O93rnEnOGe7D6XDKArkmML8lcYLz6DN4ELWwRUY oHEsIDyp86o5n2yXT7nmFh0I6Y3uNdR1RmmM5Ezn1SV5IaNSB3h+08LS8yo6ZVuifmq6WtPilL+ wtO79/kWxE7qbXerb9XutqQD5LXhLr5HvvxQCr+BRGqdAe0L7sHib8ovSvUflVr01OJNYkkemjh ccMQ3RhYK3Y9WXeRMQN+/4X6xa6udIvweT/svwMSYYdY7KkvUsIkx2nDnBWo2Z7Gz4Pv61BTtWy wqHvJjIOEo7iokX2joJ0EMHyn9W12ktZJh8r/adn2mPNzgxQNtJXQlyM882Bn9BthY6SE= X-Google-Smtp-Source: AGHT+IGwpZ/PVbs9VQq8dpseNsXDlDCkylAjbElujHuno/VPeyiRieeQbvg5MZPlXZafwU/3nXpQgw== X-Received: by 2002:a05:6000:2585:b0:42b:4247:b07e with SMTP id ffacd0b85a97d-42cc1cf46b8mr85562f8f.25.1763680850126; Thu, 20 Nov 2025 15:20:50 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:49 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Robert Mader Subject: [PATCH 15/22] libcamera: software_isp: Start the ISP thread in configure Date: Thu, 20 Nov 2025 23:20:12 +0000 Message-ID: <20251120232019.3590-16-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 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 Thu Nov 20 23:20:13 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: 25117 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 A75B5C3330 for ; Thu, 20 Nov 2025 23:20:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5EEEF60B0B; Fri, 21 Nov 2025 00:20:55 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="All0US39"; 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 9F2AF60AAF for ; Fri, 21 Nov 2025 00:20:52 +0100 (CET) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-47774d3536dso11138655e9.0 for ; Thu, 20 Nov 2025 15:20:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680852; x=1764285652; 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=KaV04Bxgis4mNG/lyi1+ASdW7XQgEYuf59tHgnfd3u4=; b=All0US39BUpkpZs6opGdVRIsxLi0vSw6oSewAkfCtUXONY/y1pWZcCltRayZSUoF1f aE7O9XQclAboAd+EKDOqWEoTBBSNwebQOmZIwAaOy+MJObViG30dZUMPXRGqzv3tASYF y6JXoWoQVSFG1mNO08b4XjrQEKvCQSIcHqnZjY4letnTTSFM2bjVyY7tCSdvbqq/JJ0X jt/H/qtJtXk2p6gCkbqwmncltCGff+zv66APUq06Dt7sEL7Ci/busaZJ9w8R4J1Rmtn5 pbG/6jWGtbre05t8VqYs2jm1kZSix/0iUhF0MModHeCE7k5w1QlBhnDEoCP8SONcQr7v Yz2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680852; x=1764285652; 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=KaV04Bxgis4mNG/lyi1+ASdW7XQgEYuf59tHgnfd3u4=; b=WN2saLwOkzCxv4quJhYwC4oJUg5Eo0SVOWQNKHbUOcoW1WQnelHoaqadMtccleTFm/ jAj5KtBttSn44wPCTNINJlFN82eDNic2yyxkCzoRnaEl6ySPIP52JElzVjAXDDtXmYLN Txnxd7wOtvqHQ66ukD3/zZ1pbLvIRe8a7bFmH+3In4nP929Zr0du7KCj8JhaYTVREOFL g9nyFhGYpM2dWJjh0c+qqIJWKIkZypucYOdf3kh4Kw9o8H0AiLoALu6gaLU6H5FQt77y ELv4wG6hlSxyAQub9oAdsUm2HP7q8di3YXm7aHuDWtm2FfT0gK1V+pf66eODEXkzyZqh JM/Q== X-Gm-Message-State: AOJu0YxcbVcGXe8iqHOVU8pQvRJui0h5XxEC1MIPXcDyfz9ZSvMelwzw VeT/zuHmoYJHH83F22vUJt37V+rPbgU9ogrXljPtV8kxC7qKch/luGZIWXMAUK1RcCF5zLFoLyU lctzyidw= X-Gm-Gg: ASbGncsw8mjtSws3TRH9W6waSefDWHEsX2Ar31WbJdnikflw/vd08sRuslzf9oWO9N8 CqSOB1BFdZtC9WECPSQkX+gJXEEOFjlKoZwRZFIxb2KdzoxU1U+bZh/zIwNz6CTzyLitGS1ssiJ t70J7XcDRLjGFc7250aunPxAWVqjYGPwdhq39EBYi7M2wqv3WofTHiFEmC2uIi0dnMx0XnyppU6 3FGBmHFViqQBjzxUM3/6eZ9HkG29qi8fAaM5doyH0Jh1hWC+IR4aPKUNZFJwNlNGB97/D31bYHR C6Q+MO1BRJDI8pgBoKwqrO+J7zN25zxZj/SGWYprA6rC4GR+qKCgraMBDpsEtGtuWO5mY9qfYpe L8YCmmpwWRUuoFbmsN7B8jGiKG4fAcGIujDzFIu9FVL4n2vNnHA2qXsAirGucCoYCcxDhQxJ4ED W7fkID4ARFU/ZtfrlxGGTsrKFdYXXHVQJPNH7PioIW1A16cCLLW9M0oqmww3p+486vET4= X-Google-Smtp-Source: AGHT+IHhGmh/RDHP45IYLyYaVUdsVYtEgSZ/RPgEH+7rVDtYp+oOSej4EvudkQel7oELsNrNykR7Og== X-Received: by 2002:a05:600c:4685:b0:475:ddad:c3a9 with SMTP id 5b1f17b1804b1-477c052f04bmr2490385e9.13.1763680851947; Thu, 20 Nov 2025 15:20:51 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:51 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue Subject: [PATCH 16/22] libcamera: software_isp: Move configure to worker thread Date: Thu, 20 Nov 2025 23:20:13 +0000 Message-ID: <20251120232019.3590-17-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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. Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/software_isp.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index afa4eb7a8..4c232339b 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(&Debayer::configure, + ConnectionTypeBlocking, inputCfg, + outputCfgs, ccmEnabled_); + if (ret) { + ispWorkerThread_.exit(); + ispWorkerThread_.wait(); + } + + return ret; } /** @@ -391,7 +399,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 Thu Nov 20 23:20:14 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: 25118 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 7B052C3330 for ; Thu, 20 Nov 2025 23:20:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2BFDF60B13; Fri, 21 Nov 2025 00:20:58 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="F+x8xakm"; dkim-atps=neutral Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 43C0960AAF for ; Fri, 21 Nov 2025 00:20:54 +0100 (CET) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4779cb0a33fso13968775e9.0 for ; Thu, 20 Nov 2025 15:20:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680853; x=1764285653; 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=ZFi6TZY5hIuZxehPR0Y+ao56s/Ou2XRORvnhhULoNLs=; b=F+x8xakmCqjGlPJTxxdBg7WUUCJ+f5I8LFMCVkb2DIlXkzUlRznMp6nAlqi9c6f3tl T54PBnPDKyTFaN1mm+Y0/JD8gUuLekqWIGhb8CC6KLh1Dhptsz3noDtBjqJBweZix2FR mBBKlFLsoYA3AW2iaFs34AP6CVYq6ACxtaqVHbHGj/Vw/tu89RiFKqjUkwFEQ+vHYNJB w+aj+u9mZSd24t3dlT127cuNsaNySehxTiCKJ0fRyv6Pb6WjRy7/rCgF2dPUNl9j36Sc was2RrEb/9nOsws76VnAIadpyk1rMqSsIwmDbCObgtVJEBC5xB3+EUY12kHyNI9Z9bej 9E/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680853; x=1764285653; 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=ZFi6TZY5hIuZxehPR0Y+ao56s/Ou2XRORvnhhULoNLs=; b=dxhXo5yCgWyjgla6WetduoWhHyT9VV+xwdh7zKWFP4tGUMZZzL9776nYpi71TRbZ/u ikCiRAW2znBfG4lG7SuMEjmZCzf9jfmY1QJGR1yhFdc37KLrIrln1oKqi50Ry7fduFXU JK7U75gzm3i81XYQqG8bpqHvEtip63+aZWC3wU5ocZaU/FOiSgV9Q1mi+PBhMD/cTd64 CvBSe8GS6nhMBIun/GgeIgRoCtnU4xEzTXQB8QtgcuWGtqwzsZYSaz3/XCLhp5OdaRRy xd8Su0RuLBwOF5cfG4BdwasmVXCzOlMAG9oVsmTPFZCGKYXigrtWb6mD0ksNUKv6ix2F JlMA== X-Gm-Message-State: AOJu0YydrzbjLo1oB83QsjXU8YG651BE/Hq8oVsZ5gHnTLHFGYSLLzpY MQZI3PaqYH1XJuw08hy0tqvdXgtuAfGCEZ75FkavZfuOaYHTohsE+bXYVVpxGtD0c6QpG8pl2H8 VybWxrCU= X-Gm-Gg: ASbGncsQVIrfoVactc9e2qh8FF4XNRe4SHnI4H+5N8RcT67skHneHogIj9V4phq40A+ vRGTD8v/68NF4N1mayRjpdm5fEeNGeM9pu3ODMXjf2MJ2U9HNe6yt2oXLpchpVh6fMKFEX14LxE 17UQC7ZKi2l6c4avShnJ7OgUJ8HhidOTSsrhNy7zYz730v1KCGHQMJrIJkQssYDnWIDtTeFK8E9 fvUJwboX5Z3CgTdxrrRTfXki2XoF65kUpNW/UKpPh75HEMGZkRTMKFJFb5jE23vbaHeIR4dbp8s K+oPeKWfyMnBN0lTaJxLNyxY1qFFBtAs23medwVi+AF7alkcdoDZlwIxVlTbrhOwZFg8gTx3Eq3 rbn/RaGPXlSqR6NZv+L/s1F2BwPGKhT5s+8KComcSpxRBTXu06uKGfRcXYua3aV94huOYqurn7M P8rTle7yywF0qg5Gu+TKCX1xPJfLbb97M5WcE8jap1bBFspL6SJCrC4P/U74GuNnOagdY= X-Google-Smtp-Source: AGHT+IGFb7DLIoDhZHFAfcSTdib+RQ5z24ZKzLuiQvu0+Xzp+2i1fqIGmH8edG1Q+ToQiYlYvzkZfA== X-Received: by 2002:a05:600c:474b:b0:46e:35a0:3587 with SMTP id 5b1f17b1804b1-477c01ee377mr2676675e9.27.1763680853616; Thu, 20 Nov 2025 15:20:53 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:52 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Milan Zamazal Subject: [PATCH 17/22] libcamera: software_isp: debayer: Introduce a stop() callback to the debayer object Date: Thu, 20 Nov 2025 23:20:14 +0000 Message-ID: <20251120232019.3590-18-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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] Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/debayer.h | 1 + src/libcamera/software_isp/debayer_cpu.cpp | 10 ++++++++++ src/libcamera/software_isp/debayer_cpu.h | 1 + src/libcamera/software_isp/software_isp.cpp | 3 +++ 4 files changed, 15 insertions(+) diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index 26787a985..530564c02 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() = 0; virtual SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) = 0; diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 00738c56b..28fb8ca50 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -788,6 +788,16 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output inputBufferReady.emit(input); } +/** + * \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. + */ +void DebayerCpu::stop() {} + SizeRange DebayerCpu::sizes(PixelFormat inputFormat, const Size &inputSize) { Size patternSize = this->patternSize(inputFormat); diff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h index ecc4f9dd0..2d385cf01 100644 --- a/src/libcamera/software_isp/debayer_cpu.h +++ b/src/libcamera/software_isp/debayer_cpu.h @@ -38,6 +38,7 @@ public: std::tuple strideAndFrameSize(const PixelFormat &outputFormat, const Size &size); void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params); + void stop(); SizeRange sizes(PixelFormat inputFormat, const Size &inputSize); const SharedFD &getStatsFD() { return stats_->getStatsFD(); } diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index 4c232339b..aa4a40cb6 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -367,6 +367,9 @@ int SoftwareIsp::start() */ void SoftwareIsp::stop() { + debayer_->invokeMethod(&Debayer::stop, + ConnectionTypeBlocking); + ispWorkerThread_.exit(); ispWorkerThread_.wait(); ispWorkerThread_.removeMessages(debayer_.get()); From patchwork Thu Nov 20 23:20:15 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: 25119 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 847D3C3333 for ; Thu, 20 Nov 2025 23:20:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2F09760B0B; Fri, 21 Nov 2025 00:20:59 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="PKH0rS+W"; dkim-atps=neutral Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BA04A60B13 for ; Fri, 21 Nov 2025 00:20:55 +0100 (CET) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4779ce2a624so12854365e9.2 for ; Thu, 20 Nov 2025 15:20:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680855; x=1764285655; 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=iRXr4nHEuISqL9vL3N0Wmx/RaPbrgqdaQeOrOOYFO6Q=; b=PKH0rS+WZQJ51Rj/+YvS8fYAgI6zf1q5x5P89nBU8TA+WluBt5ca4q0nKxxIHvrJdr rh4HtPJTUvrXIkQD5V9eol5rn590r+XDiQX6osMQg70t5Z76E+DTLJNckThB4cZ+VqCy R7IodOv3j6lkOF2DTH8SSJoiEzpJQg32LU333qtYMu3Wq4c2c+M0lQNS4FT3VIPsQGN6 2GD01KTSyBBmWlwWCg11zZgb1MYRTVYeMEBvngCsNxNBB+SqqutmPZE3kuC005iERyjL 28ay1I2xGEVivaYVJwYE1QR+d8PvS+/l1bx1qkmmgJIUZw5Brb4cPaRpYRmlPDskNoJi KfjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680855; x=1764285655; 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=iRXr4nHEuISqL9vL3N0Wmx/RaPbrgqdaQeOrOOYFO6Q=; b=cis0ZtaCnMap3pF0PNWfZHO9v+mUL2U598MZPhTr9Wrym3iwt6MYFT3wVmadSLTw1z O2G2eYQZVoVZ1qDgt/2gab8sg97Jt4Atn/tHM92zP+Awde80RRnlzgRLtCS1k3ru5Yxd HWnuP1V13dwKI09EWxYL+4+zHCaYjHietNaK8j779JeAzK1rvbNlSOpekHgfZhohB455 sTUL1NZkPiPpcmgdfm4Rzw+ZNvfqWQXL5oDf91c+g/vDVRATO1SGG/YW7XEL1XVhyc3R ZqNg8ELR5pbC5KVOzzyImLMcns9wD97StBFsf6dKeyGljs/uhTjYHJnKssI9f1Ma3B7o C4rQ== X-Gm-Message-State: AOJu0Yy2/zAZRhdQyYXo0vV2Cnyr+mm8W7kqcuHi3tgdAJevI1+qM7sh aTxcOvPued6KcEqR9oX2ZHx0zkwtq/4GHhDm1lsWk9xu/YrugekJ7UxrN0/tXWI8wpJAHzfhj+v dW7TYgOA= X-Gm-Gg: ASbGnctb5qFprsdtcKiZGJiUNFsFRDSGWa/QSwOjQErHkAIcMJhvhHrYrOEG9I0a9dd t1kXnKfU1U57JNTsgs2iwIJbA+RmNdmodqYrxbrDfT08ejBC/Lu6YvjuHPtNopSUOocgVU6iOD8 +iEys7rDAltJt0ZNMt+Og5GvEc+W2ObWSmCaZ/Vu99P9kHRRn1pmS23dTWhvgLypA6pBuAW11sK zPiPRcytDGWyefmf4wEtLhXY382kQcO98PigcjlbeAQUB+FytPPe28UjLbDptLznwfKrUPVJTSa tpBoZmxzEvuUsLQL+RW/D0kitssodJA//tjZDg4DCKvWTVzIKNaG+X0HYaXaHyZ8mge3U+ghusC eS90hLqeyp9g6hV/z9+8KiclYciVGx3mTR/GSmzkoDKgsXQky0s5+eNodb3dN66EiSlOXWAEUPl jmHQeod8twoZkLULFO1uRms6pgGJHTYPl8iIaIkkOZqRx13vNVuflhgpQ+G6WV0IhX85Y= X-Google-Smtp-Source: AGHT+IHhklXk6D5nLHBLCQmioEbPa4TMCTWtzaG+2olfg5zKrdi5b5iY4sEckx47N/qo7bHjAXWAgQ== X-Received: by 2002:a05:600c:314d:b0:477:7975:30ea with SMTP id 5b1f17b1804b1-477c01f2cc7mr2888755e9.29.1763680855065; Thu, 20 Nov 2025 15:20:55 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:54 -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 18/22] libcamera: software_isp: debayer: Make the debayer_ object of type class Debayer not DebayerCpu Date: Thu, 20 Nov 2025 23:20:15 +0000 Message-ID: <20251120232019.3590-19-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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 ++--- 1 file changed, 2 insertions(+), 3 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_; From patchwork Thu Nov 20 23:20:16 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: 25120 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 3852CC3330 for ; Thu, 20 Nov 2025 23:21:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CBB5260B31; Fri, 21 Nov 2025 00:21:00 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="qQ1zSuHQ"; dkim-atps=neutral Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6D72E60B2F for ; Fri, 21 Nov 2025 00:20:58 +0100 (CET) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-42b3377aaf2so813959f8f.2 for ; Thu, 20 Nov 2025 15:20:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680858; x=1764285658; 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=Q72Mq/ODDFKHXLOJoLvTa+pTSd+VTsB7EmzhQuxUCGI=; b=qQ1zSuHQrdFwWiS4CywnBK52zeO6BX/dPRtJIexmg8uqx0gz1pmp5q9au3I3XkFg1H Nq1HffEXUT3pKZPP3HzDEhovJQTCdOfLCyXkSovyFl3Os4PJwMllj70P6qExbdN9Dyqw Z8IGihmo7hTCLqFYwJHk8Cjk6qvYezTyg6Kj/KiH/FfToTyMG1zod/+Hb1EaN5qfqH5l a+f8yM7eBxSVjst+ntgRRwVjA8iegF5G1McHMhOHVxnHuRMQYms5gRX75eYof3hE1TlE ejmBQb+mBcn+KWbqalLIyUIGX9D+Iff42coTdO1Npu/Ql/xlyotIM6vp1Hggkd59na6T GVNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680858; x=1764285658; 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=Q72Mq/ODDFKHXLOJoLvTa+pTSd+VTsB7EmzhQuxUCGI=; b=nUVo4YpW7eyQoTOtaoeXEG9xWnG6p4gaDx+tR57UM6oodrBFEQpusekjHU39SVYMJx e7K0C07Ri/UrgibW0cuKKIxug0mhjL5+iQYxFrburA1jJ99wl1okIxruHCL7bgpvXvCe c9D6UJfvlzzff5oyTLsm29rbwTNI8BinUUbN01VJn6R7VIoIJ0u0vDxtL7IqV9kba+5i aYQtXq/oHa6MfHYbGRSPzn5OfwfhIYZOjwYNY6VTugrM73JOEdZrD8Ek69xS5oqj1O8S bRB2vNgVX1LaoLClViiSvJkCqCAoDuiPltia2QWQDdAtwRboEYPqth0KTL/6ZYFQ0Pof RNhw== X-Gm-Message-State: AOJu0Yz7t1IPSs7HzROi3luC/TmI6wQaHLG/M88xU1XsaIRGDObUy6dQ Iff+QQx+mX0SRpaDPM8jOMSmN9L2+Az91W4cfzKv55RZzQ25jcTGQ9UCbymVRA9gofV+kohPiaM dCadGx7k= X-Gm-Gg: ASbGnctPBcMMwaSHPuhRfOqIU280n2Ww0r+n8K6hnpllg38E29LCXV7Gs/2E8zaLRKB PzIO9eG5cgWAlTZaNGmfHUqkq/39lN4Byeteuza4DmW3WSb4D/MkHbqaZ1DeY4f/xQ6szAQSWt9 v1HH/JjDEP6PHH2pMBN4s2/H119P/bdh5rxBcWvJcX3RPdt7UUoQrVHruUjBetz20SmNG8SVt0P 4QZ57Fpn3xw2RUBfGHI2Hkbmy6acrUMwVBYLCojcGrtaqaccFFH16c4ok71nSbtWMMnCUsn8OWi rcjZS/ztgJ20SPi9RhawzKWlvKozHZ2rsgaOF0/Uqje8hMeEssAgbeMBJAQbNt3yBFwn9DS1ZGL H6mWH0NGB3BtoZ7jBM0CJ7o1xC2CJwq/f5FxJh/nF8mv8lYHRTMZkOJlzzP/zDvNP3FgKsfAwi0 Z6G88T8gUY7cVBZkGV5X/wmPvhk6/40QTb5IQG8mSqTeQGrVf4iVAUpAENd18aX7EHzzSyi5bBJ 4pQrw== X-Google-Smtp-Source: AGHT+IGr6em+UcoEmUHGX2PSVgy1Y/ZKLLYBm2RhcDpWvuQ2pmaipdpJAQncAy3M78cHMcjgcA2ypw== X-Received: by 2002:a05:6000:401e:b0:427:690:1d84 with SMTP id ffacd0b85a97d-42cc1d0ce5bmr76942f8f.32.1763680857721; Thu, 20 Nov 2025 15:20:57 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:56 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue Subject: [PATCH 19/22] libcamera: software_isp: lut: Make CCM available in debayer params Date: Thu, 20 Nov 2025 23:20:16 +0000 Message-ID: <20251120232019.3590-20-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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. Signed-off-by: Bryan O'Donoghue --- include/libcamera/internal/software_isp/debayer_params.h | 7 +++++++ src/ipa/simple/algorithms/lut.cpp | 1 + 2 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 217cd5d92..019df2048 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 CCM values as calcualted by the IPA + */ + Matrix ccm; /**< Per frame colour correction matrix for GPUISP */ }; } /* 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]); From patchwork Thu Nov 20 23:20:17 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: 25121 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 5168AC3333 for ; Thu, 20 Nov 2025 23:21:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D677660B0B; Fri, 21 Nov 2025 00:21:02 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Nl5FFTXf"; 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 D568A60AB7 for ; Fri, 21 Nov 2025 00:20:59 +0100 (CET) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-42b39d51dcfso899127f8f.2 for ; Thu, 20 Nov 2025 15:20:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680859; x=1764285659; 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=AuPxMEyMZ3Lo0mpOyPYWzB7IFgSovDMxMLPQ36HxQoY=; b=Nl5FFTXf7eJRMLSbvu/Re6ZWqTZIi+0H8gUrQWLsSM+MERiD7uqyK9I2QUsvDRBK63 ISWIGX0fNGBAl4OB5rxAXej08qEHMIiLVhQ2JmkpW9Hs7T0yYbQ9B8iEeOKGlnQG4sMW wrJoqtYxAKETgFpqo5PONo/N3SISMpsnhdHQvnRggR8SdYqF/AeGLwoh4bTbAT1w8U7B UeAQ1eMVe+Ml5Wbg6JDKtfRKB0DB8ieIKE83RPeXjS4M8ijH+vy0tBNX1WbUQhcf4a8v Ch894fEfTNMdCKXl64zHKsv53vudHUWdDf0IRnoLQttRSWcSMCpsDMu5bb8siJsMJIjq voAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680859; x=1764285659; 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=AuPxMEyMZ3Lo0mpOyPYWzB7IFgSovDMxMLPQ36HxQoY=; b=OtS7BD1712YQ06RNzA74olpvMvB0d3++r4n2GKQK58wwX2VAXdsYOrIHUh0bD+aZwh 1qSdB3dn3wqODZ5RxpMw5kZjsVT1Zf7+hRt2EAvRyCtz+oz4if6cYRKZxyZD0rWVplN6 qTJUHgKbPIA9tx16Gv9cyu8YEIUSlBJW0ZW4ayzZixPQHM2y8epCyrrUolxGcjuGG/bY vWIJEqfD4GwAf3HF3wq6xY015oWJGR8UcymIntvq9gge0WpoiCU3E2nnoNkNTY1457Fs x+cLboWg2lB4e6nGXjM9i7Bzx5Gos+hkfEKwaR3XFs+P3xNPD7xtwVcHwI/3emraZugY HCFA== X-Gm-Message-State: AOJu0YwL0L14RflJl/IMKDgw98YTpfen8beSWo/Kdz4QNkTOD8MrAqjM VGCPCijnZncw5wSDm2mL4WjEmfr7w0B68j/qUEwjOlXpNTGe/l8kYxU2IWMBy+t78KPkZWX5PAR N+rZXFWs= X-Gm-Gg: ASbGncs6v03BkX98pG/AciAI9DwDuwuOdiaU6ixkuuSIuS3QHkf9P5sn7z/CKYY5iDd 8ypO4EdkHXmJWBlcRNjLpdYoNr7R5eAW3B0zrwu989fHzcPODHYOZROX8wLr6W+hKnMUMxBoUXp N2RmcztnSgl6TRqvl1vkTnCG5cMK5YAlrVRycMyS6LwuS8bg5ajnejLgcA1gF0Td2VI1/YOcvXK tn2IT5uadBNYiWuBsHCFb2Jkt7HAQmSHylB4ybRutWh5TRMWx2RGLziUTgEFSx3mgg6Ljz40UHp E9ipcbOZuGANQYcI11o/AswGTQWasntbwGqUJuIpa6KuL/35OJ6W/E77KdvfwyHz6ZKdINJWlrx c8/K9cKSizAVze72dRbY1my/lNw43yDIrJNgjfsqA5y+/RE9YNAQSUygD1KchE/99/Cvh7GAeY/ /fHE+klsqr0B0FYjPu7wM8gvcAxAqaFmVAOLvK1oiUY3U1FlgCD3LuJlj4U9Fr/dfNip0= X-Google-Smtp-Source: AGHT+IFnBxKeAlU6ux+zAn6PseytuJPsUk+xgN+ktDesNDgIOAavH07+EjvPjs9lf+6AiVHhkJgliQ== X-Received: by 2002:a05:6000:2f85:b0:3fb:aca3:d5d9 with SMTP id ffacd0b85a97d-42cc1abdce5mr93767f8f.1.1763680859136; Thu, 20 Nov 2025 15:20:59 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:58 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue Subject: [PATCH 20/22] libcamera: software_isp: blacklevel: Make black level available in debayer params Date: Thu, 20 Nov 2025 23:20:17 +0000 Message-ID: <20251120232019.3590-21-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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. Signed-off-by: Bryan O'Donoghue --- .../internal/software_isp/debayer_params.h | 6 ++++++ src/ipa/simple/algorithms/blc.cpp | 13 +++++++++++++ src/ipa/simple/algorithms/blc.h | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h index 019df2048..1a319833c 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,11 @@ struct DebayerParams { * Per frame CCM values as calcualted by the IPA */ Matrix ccm; /**< Per frame colour correction matrix for GPUISP */ + + /* + * Per frame blacklevel gains calculated by the IPA + */ + RGB blackLevel; /**< Blacklevel gains for GPUISP */ }; } /* namespace libcamera */ diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp index 370385afc..4569ded48 100644 --- a/src/ipa/simple/algorithms/blc.cpp +++ b/src/ipa/simple/algorithms/blc.cpp @@ -47,6 +47,19 @@ int BlackLevel::configure(IPAContext &context, return 0; } +void BlackLevel::prepare(IPAContext &context, + [[maybe_unused]] const uint32_t frame, + [[maybe_unused]] IPAFrameContext &frameContext, + DebayerParams *params) +{ + const std::array blackLevel { context.activeState.blc.level / 255.0f, + context.activeState.blc.level / 255.0f, + context.activeState.blc.level / 255.0f }; + + /* Latch the blacklevel gain so GPUISP can apply. */ + params->blackLevel = RGB(blackLevel); +} + 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, From patchwork Thu Nov 20 23:20:18 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: 25122 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 58F28C3330 for ; Thu, 20 Nov 2025 23:21:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1663E60ABB; Fri, 21 Nov 2025 00:21:06 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="jrO4mKcL"; 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 9348F60ABD for ; Fri, 21 Nov 2025 00:21:01 +0100 (CET) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-47774d3536dso11139105e9.0 for ; Thu, 20 Nov 2025 15:21:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680861; x=1764285661; 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=DnTn9MIz19IX9mj9lajM91BQDHALRtnXvR7P8cLPuio=; b=jrO4mKcLQFwyr8TTZTt/m1zoHG4oPOC/xfAS+O9IicGbngTcWzOe4XiPBvdoxvnC1n kdKS8Yt3Ji4iKslJ6vNH906rwqzhKmiRuGADnH9Z9BxzEi4E4PNHZVKa6yPezeHpijLG MJPALcVdEWp3W51Jesr8VtuzrQw7z5ar5vKdwDIfkDjOk/CD446KKzLenAzBKDwgUzbP mTycJfewVriYRrLNSsjsqPH25qufK5EDpYCDWtwMwpoTQeqG1JI8QG8OBEzqf//t6xc3 sTsKSrRB8NPF15jnNsvu+Hrd9qSUKx4OG1SFdJOYFpsK3qs0smy1RqSWDo3hSJdp9Baa alSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680861; x=1764285661; 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=DnTn9MIz19IX9mj9lajM91BQDHALRtnXvR7P8cLPuio=; b=JGiWlJ4r8pzpBO7kCBhE5qY0nJ2Rb8AeGPK6mf+QWSjCGUViLDpmEIXtQ92ek92kRH POT4DJj0C+lC39CYGW1HbE5en3FXJz6LV775sIXoVddTSiRuuBEPe/OzkfY3BBtcMfDh 4StpivcM0Fhy7+CBmBZxwPXI7jZh9thqqJrWbknsr5cEwMqQJDMmUlGddtAySO8tUD3x 6oZLpK4nD1DpR5FmiqIcIiVDRKr0dt3LS6emzhXxWpsQPCLDtcXkX9ANZrq1f56X/tqW CIrIWsESxtwmZJpDym2sTp/cgn+qdC30Hbi/yTBz1xQk1Upw4NUj0087rQO3E0niWVxq ZASA== X-Gm-Message-State: AOJu0YzBUuGZArb9KX2wvSupfqsCOtUOW1kacbLnFBxEBOMWITHRdKSr iEuofZyxRb1LnxeXAu/QGDgJi6Tw5oTWYjlbVy/OT9+MJjD7LwM1PtYmTis0HCllJ6IbksE52C0 0LIA3AUs= X-Gm-Gg: ASbGncvpXUgD1uCI1GZZyYuozyAsBr/0gZ8CyVI8P5GOqp3TxDnTIsDqHnBjZEg0/Y5 kyx/AOpgCfjJ5kLFsWPOmQpNQ6sLbch4dxqj7cd//4whZM2sQPX7KlsYUzUECkGMB4uisQj9eB1 gsNEY9ix6PVg/xtLkKWprq/f4I3PV1w2pBdoc242H+zQgJ1bpXbS5rR2ljQ9e+XnsaWjFSmEIKO aji3Pc0DP/EYZzhD7IS9I6HHHIjvxujra2mnuuHH+WWVqcU2MQ9Ptw/VwD5zBDf3/LtI3QGQUuY W/Yt1ElLuxYjtJ/3lSoLgvXc1d3rG5/zB5uuNiaV/WHJG34ibeidOBJjcOmmqNzspDK2vmnUFtZ MOnKItprDkc8FMG18jA3CeeW7J4fECTFEwYV3veKfBJ7/101eEp9aOd+QOuPpzHGf0xveb0Fy+D zFmrvB3sB/MejjafRBRMcA7aSeZxLCUa4SAZkXOsEhRAH145SrAT3NnW8StLTB1o2ecyW8bPn4G LnNAA== X-Google-Smtp-Source: AGHT+IE54obcrC+Moe3y9r3lQaz+IxsTfaJoGEJ6kIA5RVi9TZvnrvDGzc6cfT8X6onDUlk2lHcBHw== X-Received: by 2002:a05:600c:4685:b0:475:ddad:c3a9 with SMTP id 5b1f17b1804b1-477c052f04bmr2491925e9.13.1763680860764; Thu, 20 Nov 2025 15:21:00 -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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:20:59 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue Subject: [PATCH 21/22] libcamera: software_isp: lut: Make gamma from lut.cpp available in debayer params Date: Thu, 20 Nov 2025 23:20:18 +0000 Message-ID: <20251120232019.3590-22-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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. Signed-off-by: Bryan O'Donoghue --- include/libcamera/internal/software_isp/debayer_params.h | 5 +++++ src/ipa/simple/algorithms/lut.cpp | 2 ++ 2 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 1a319833c..5f340a7a6 100644 --- a/include/libcamera/internal/software_isp/debayer_params.h +++ b/include/libcamera/internal/software_isp/debayer_params.h @@ -62,6 +62,11 @@ struct DebayerParams { * Per frame blacklevel gains calculated by the IPA */ RGB blackLevel; /**< Blacklevel gains for GPUISP */ + + /* + * Gamma value as provided by the IPA + */ + float gamma; /**< Gamma for GPUISP */ }; } /* 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, From patchwork Thu Nov 20 23:20:19 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: 25123 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 F2A44C3330 for ; Thu, 20 Nov 2025 23:21:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BC60D60B31; Fri, 21 Nov 2025 00:21:07 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="qwGZ7Jn7"; 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 0134B60B13 for ; Fri, 21 Nov 2025 00:21:03 +0100 (CET) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-477563e28a3so10095885e9.1 for ; Thu, 20 Nov 2025 15:21:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763680862; x=1764285662; 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=TU2m7Tc7hCiC/4jWw549iHAkv5vmQq6nhrkowOLldmk=; b=qwGZ7Jn7gIJF45OLXfrYdSTG8WKOOSSw+yu7trzM0vSqb/In5YA9lTFi4SSMWlwCF+ dJAHUfmPsBqjiJio/MPKtqRY4/pQPCkb22qrPlXiOPytO9y0VjLA+NuepV7CCb8qWKCr Ls0wWmFubjm5EE9zRFI1JBln9aN5J9BOZ9UBdlyAxu2Dhe74hpMcG0vPehC+atTZJJho dmnuZuZrNBqIPtDULfNKR20Vy2vsM2COX3M6KsRqgzxZlhNG7Pudud6UT6u8+XHyhtsf 98ftp7wYmhCKhSBEsFTMv9yI5W987qqO5RwyAZ60pM1RRM3eUwj/uweG5FfpTWDd8By6 wK5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763680862; x=1764285662; 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=TU2m7Tc7hCiC/4jWw549iHAkv5vmQq6nhrkowOLldmk=; b=VziHK7YJ5+ze9npDQgXvGmmEjb0/TBMWrxywtfi3GS16qk35Bju7Nr1H750vLwu3JQ QKJBrer3TG8Gl0afs1L6xJAwkMlTcdVawxSTULMtarwAx6U5ewQGn3F6T5LTrfRI4T3d +bEj1aUOgfHnAd50E3LJ57Iq4AUAfFJG1OZLYqQS0VuJWrsfGwrJm2/KIp6Ges2DZwt3 iY6Mp+yTwG4TJ2AsYzxaD0ffUm7pJm66II4gACVFQu1f2cHlDEd5ZJRZtJ/MmltQFBe/ S43qI1GPf/tDxJcS/dmx0JxA6nT3OlEEoWmKtIDm77Bsa6N6iPfF40L/Nm/zvqxdrZkr LPbQ== X-Gm-Message-State: AOJu0YyVitqjUBHbulh3+8lNlrUh1Icij7RUWeCwB3pFBKigfrfnA/Ko TRhGXPeRL8QebHljUX5/3+z+URdQupN13g4uNSXTcRnE9QyRB8W0KwFwJLTiDXuhebphGJFL+mt uMbhD8sc= X-Gm-Gg: ASbGncvHxpEeXZpwNut4vgc8v4DNwEib0s+b0kAlemrEyeZW4sL1BJFztnf/ReZaF2+ 8Sh76DVZzJAZomcFiv14FAY3vABMf/jovRcEBjrjBnO4GOtOcTtVXFCL4SBfPBkxfaGBV2Xt7OI Co/AWJReDvNzRN4hmZjd9WqSxyNJ1p7Ny470Hr9VEbWOVAKlzaH5Fbtu17gbuwmELNhgbiQyoTH mF2UdLQeStBAMpXRiOr7YG9w5fCmd1CI6uE+DMhmvJ1Kyl3XnBDlQtVGrsxh82HL04HNe0XPDCP +Zbyc00PUIAtwYpRJXbzuAFTHt2xXPdTY9lHu9UUJ+OJF9TMYkiExf6ZYexS9t3anTnCUNg+ifO xT+23+hHw+re+fc2wCAvNtPEQnkFs6uoNjs5TkAmCPQ6JgkJgeG7Uegu4iCq5oo8DYgTv/9IZy9 4KPkUiZPNghO0gjmhjhwx+J0RiE/xa4mPkIeMWtbAhBEBdHpx0xrSPbwP3M2VzyVOUtfo= X-Google-Smtp-Source: AGHT+IH+4cu6UR+CsG+yjPIJ7okFAybKgwGMDXKtndRYmn5h0go48t5/WGBIEGAwR3iY5TkzLszGmQ== X-Received: by 2002:a05:600c:3ba7:b0:46e:59bd:f7e2 with SMTP id 5b1f17b1804b1-477c05139c2mr2473585e9.11.1763680862337; Thu, 20 Nov 2025 15:21: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 5b1f17b1804b1-477bf3af0ecsm11618415e9.9.2025.11.20.15.21.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 15:21:01 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue Subject: [PATCH 22/22] libcamera: software_isp: lut: Make contrast available in debayer params Date: Thu, 20 Nov 2025 23:20:19 +0000 Message-ID: <20251120232019.3590-23-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120232019.3590-1-bryan.odonoghue@linaro.org> References: <20251120232019.3590-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. Signed-off-by: Bryan O'Donoghue --- include/libcamera/internal/software_isp/debayer_params.h | 5 +++++ src/ipa/simple/algorithms/lut.cpp | 1 + 2 files changed, 6 insertions(+) diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h index 5f340a7a6..2bfa71529 100644 --- a/include/libcamera/internal/software_isp/debayer_params.h +++ b/include/libcamera/internal/software_isp/debayer_params.h @@ -67,6 +67,11 @@ struct DebayerParams { * Gamma value as provided by the IPA */ float gamma; /**< Gamma for GPUISP */ + + /* + * Contrast + */ + float contrast; /**< Contrast value for GPUISP */ }; } /* 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,