From patchwork Tue Jan 6 17:00:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 25670 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 BE700BDCC0 for ; Tue, 6 Jan 2026 17:01:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 78A9D6200F; Tue, 6 Jan 2026 18:01:27 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="nCa1AS4t"; dkim-atps=neutral Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D3FCF6201B for ; Tue, 6 Jan 2026 18:01:24 +0100 (CET) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-42fbad1fa90so973549f8f.0 for ; Tue, 06 Jan 2026 09:01:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767718884; x=1768323684; 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=slR7u71MBKDNK7zqNb3HFSBXdLunmgpP/3QgIZdLnTA=; b=nCa1AS4thZ0UpoSR8MKAg7Rt5oksluLwgdUkAGfS3tQkkoEe1H43TfwvUOVEmx4p34 CHAgjzvI5tjC09fR5qQDWSXxqydfbYZTK6xYtbzyIe/3ct68ckkrC+0V44JMn942bXD6 pkvKnixRD/T+PD6oVJaVPmu90eIRD9H5Phv5C3lfS72ZjTN+mgSpcy8wPHsJGntrcIeM CepCro+POvTvNRka5dbm297BVr7daP4cacspUs3np5o4OxiN+SxwTocNGZbo6bNtaY1X 0PQfg7vQX6RqjCaPhSagsGo8/9DgXUKRSbyYy1cgVCjDbDpK1uu0hiAybwDYb6CAksO+ tZkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767718884; x=1768323684; 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=slR7u71MBKDNK7zqNb3HFSBXdLunmgpP/3QgIZdLnTA=; b=stPGog9xOa4FcjtE32pDacD27Q9GTgWVhGMQR0ifi0hY6HfV916g3vKtViDtVyw8fP LSmSv3Ha3YriSq4MdjoCjuTZVaOoK38jrXWQZIbyGYig4EVHB0uBuVz5oBbC4RjlPqGG Lea2q4FtL2otH8JiUAR0866b19VPOhyxzr21HaL8YMnr33qSzYmrVSQMZ1JgBt0f4SNk FrgkajNAelgqMfWbf4gWdmmK/lxF1D/usMC3txl/J949EXhBZ3i4QBQUa+9yuJWDYvtv 5LfnziEctEuy0cBa4AglHfX4Yk17fN+Ls4daKktoNTzM0Ul9QEvD7vvfQ7wzR5Xh8q+E 6yDg== X-Gm-Message-State: AOJu0YxlIbxqHzx68CU0SfUNkO1VdX+rowVB4iOXahFbIAJiZ4NsKxse +1ko9Oy/QSmCXCQbt5w5XlPsNtXIts1E6ESt+t4k17QP6WkUDvn+Sip9BRY+NGU2mux0O44iOC5 Q881sOT0= X-Gm-Gg: AY/fxX4CDEdYg7OU70KKiWGUeCq2LBZkRTs0oI41yrszxq4UvDkQAiIJUll3joPzmPG /iRNgfkt5Cw1gA5f9fa57TsiGt73WrUu6vAlnuoTeKdJfhOnbqZQmXUXTtQ/AihE6irHqUlvRqM i9sY7S//ctQm7g0vJ3rJhThP1TrY69IoAk/AUhd9XWlew/vLayEvsUYKgqk6+/Bs6qUmQlMZbib MmBVYC4qXBQ4fOL4ITWwma9BoPHShTxtic2IqAAuxU9MvvS9QAVCHIz8PGL6TCGmzwtmJTcysZA YbQwZPh4AIwxeZRKYqBZ/0jU9oj4TyvXXXkluAq4WaoLrfrs7Yt7eSc+BKiJiGlELVO7/P8/iDi S9YiHN3R0b3e/Wzxae0hPmzRUqLOMi7YtWdaewf+S1h/ecx1w1yhvD6XGIGw0hXU4K1FUI9b92g TTCG9Sq1DcIwoxdLYzP5UX8fuqEkMfGQ6/r/unx8cwNbundDDhFpXewqI2pvkorfs8oiA= X-Google-Smtp-Source: AGHT+IHmA40Wzv6zC64BVsAxLRt0MQ2ZrZK74G9mazdZPcStGkWEfO1mmZ38Avn7y/Mvz1ew9VKYBg== X-Received: by 2002:a05:6000:2082:b0:431:62:d946 with SMTP id ffacd0b85a97d-432bc9d7881mr5089809f8f.23.1767718884039; Tue, 06 Jan 2026 09:01:24 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd0dadcfsm5515322f8f.3.2026.01.06.09.01.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 09:01:23 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Milan Zamazal , Hans de Goede , Bryan O'Donoghue Subject: [PATCH v11 17/24] libcamera: software_isp: GPU support for unpacked 10/12-bit formats Date: Tue, 6 Jan 2026 17:00:52 +0000 Message-ID: <20260106170059.56193-18-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260106170059.56193-1-bryan.odonoghue@linaro.org> References: <20260106170059.56193-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: Milan Zamazal The GPU processing supports 8-bit sensor formats and 10/12-bit packed formats. Support for 10/12-bit unpacked formats is missing, let's add it. 10/12-bit unpacked formats use two adjacent bytes to store the value. This means the 8-bit shaders can be used if we can modify them for additional support of 16-bit addressing. This requires the following modifications: - Using GL_RG (two bytes per pixel) instead of GL_LUMINANCE (one byte per pixel) as the texture format for the given input formats. - Setting the texture width to the number of pixels rather than the number of bytes. - Making the definition of `fetch' macro variable, according to the pixel format. - Using only `fetch' for accessing the texture. Signed-off-by: Milan Zamazal Reviewed-by: Hans de Goede Signed-off-by: Bryan O'Donoghue --- src/libcamera/shaders/bayer_unpacked.frag | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libcamera/shaders/bayer_unpacked.frag b/src/libcamera/shaders/bayer_unpacked.frag index af4a30c4b..1b85196ae 100644 --- a/src/libcamera/shaders/bayer_unpacked.frag +++ b/src/libcamera/shaders/bayer_unpacked.frag @@ -41,9 +41,17 @@ float apply_contrast(float value) void main(void) { vec3 rgb; + #if defined(RAW10P) + #define pixel(p) p.r / 4.0 + p.g * 64.0 + #define fetch(x, y) pixel(texture2D(tex_y, vec2(x, y))) + #elif defined(RAW12P) + #define pixel(p) p.r / 16.0 + p.g * 16.0 + #define fetch(x, y) pixel(texture2D(tex_y, vec2(x, y))) + #else #define fetch(x, y) texture2D(tex_y, vec2(x, y)).r + #endif - float C = texture2D(tex_y, center.xy).r; // ( 0, 0) + float C = fetch(center.x, center.y); // ( 0, 0) const vec4 kC = vec4( 4.0, 6.0, 5.0, 5.0) / 8.0; // Determine which of four types of pixels we are on.