From patchwork Sun Aug 2 13:59:08 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: j4niwzis X-Patchwork-Id: 27539 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 0B40AC32FE for ; Sun, 2 Aug 2026 13:59:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0DCFE67FEA; Sun, 2 Aug 2026 15:59:13 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=proton.me header.i=@proton.me header.b="VRYfHKgM"; dkim-atps=neutral Received: from mail-24425.protonmail.ch (mail-24425.protonmail.ch [109.224.244.25]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CB40C67FC1 for ; Sun, 2 Aug 2026 15:59:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1785679151; x=1785938351; bh=QgB9ZY1Lr8iZIRG2Bw98gOl3bg7XYQ/PECaKwOBmQbw=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=VRYfHKgMdlECZJtjqpXz4VYNN3LVpVI0qgYbGOMESDPD7wjcOZatM5z1MG6tNKGdT WIu1ca1OQDrRVpPNY6PqeDZkoR1SjeqHlc4s9c8fXaso0Xv33HGg8ez07Z6hiqYABx qv2UYOinP3WrGOVYYG139pac4KIpmPU5xcsp4W3cJHNqqiL4LIdVC15NeGkFDhGRWB k18ySLUlSjdD53ljOCYlw4eMkfyH6BMfV4cIhyIuq134mpWX0unpSh9+/RBwPhLxUy PIgeUc0Ht23hzIxLqJ+KDZCNcLPwUiR5Rr88tdxepluzIwRLoJN8PAQjG5ihr3rgdz tLFR9tl+YJdlA== Date: Sun, 02 Aug 2026 13:59:08 +0000 To: "libcamera-devel@lists.libcamera.org" From: j4niwzis Subject: [PATCH 1/3] libcamera: camera_sensor_properties: Add IMX582, IMX586 and OV8856 Message-ID: Feedback-ID: 156040633:user:proton X-Pm-Message-ID: 003ab1e69cfe7b533b5d57b06f0d3703482ab7a6 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" All three are on the Xiaomi Mi 9T: the IMX582 is its wide camera, the OV8856 its telephoto one, and the IMX586 is the same silicon as the IMX582 with phase detection, described by the same driver. Without an entry the unit cell falls back to one micrometre, which throws off every field of view calculation. The pitch is 0.8 um for the quad bayer 48 megapixel Sony parts and 1.12 um for the OV8856. The test pattern numbering of the Sony parts is the MIPI CCS one implemented by their register 0x0600; the OV8856 exposes the two bar patterns of its register 0x5e00, the same its sibling the OV8858 does. Signed-off-by: j4niwzis diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp --- a/src/libcamera/sensor/camera_sensor_properties.cpp +++ b/src/libcamera/sensor/camera_sensor_properties.cpp @@ -325,6 +325,38 @@ .hblankDelay = 3 }, } }, + { "imx582", { + .unitCellSize = { 800, 800 }, + .testPatternModes = { + { controls::draft::TestPatternModeOff, 0 }, + { controls::draft::TestPatternModeSolidColor, 1 }, + { controls::draft::TestPatternModeColorBars, 2 }, + { controls::draft::TestPatternModeColorBarsFadeToGray, 3 }, + { controls::draft::TestPatternModePn9, 4 }, + }, + .sensorDelays = { + .exposureDelay = 2, + .gainDelay = 2, + .vblankDelay = 3, + .hblankDelay = 3 + }, + } }, + { "imx586", { + .unitCellSize = { 800, 800 }, + .testPatternModes = { + { controls::draft::TestPatternModeOff, 0 }, + { controls::draft::TestPatternModeSolidColor, 1 }, + { controls::draft::TestPatternModeColorBars, 2 }, + { controls::draft::TestPatternModeColorBarsFadeToGray, 3 }, + { controls::draft::TestPatternModePn9, 4 }, + }, + .sensorDelays = { + .exposureDelay = 2, + .gainDelay = 2, + .vblankDelay = 3, + .hblankDelay = 3 + }, + } }, { "imx662", { .unitCellSize = { 2900, 2900 }, .testPatternModes = {}, @@ -495,6 +527,15 @@ .hblankDelay = 2 }, } }, + { "ov8856", { + .unitCellSize = { 1120, 1120 }, + .testPatternModes = { + { controls::draft::TestPatternModeOff, 0 }, + { controls::draft::TestPatternModeColorBars, 1 }, + { controls::draft::TestPatternModeColorBarsFadeToGray, 2 }, + }, + .sensorDelays = { }, + } }, { "ov8858", { .unitCellSize = { 1120, 1120 }, .testPatternModes = { From patchwork Sun Aug 2 13:59:56 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: j4niwzis X-Patchwork-Id: 27540 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 0A4E8C32FE for ; Sun, 2 Aug 2026 14:00:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AC27E67FEC; Sun, 2 Aug 2026 16:00:01 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=proton.me header.i=@proton.me header.b="farcnuEi"; dkim-atps=neutral Received: from mail-24430.protonmail.ch (mail-24430.protonmail.ch [109.224.244.30]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 61EBE67FC1 for ; Sun, 2 Aug 2026 16:00:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1785679199; x=1785938399; bh=54WPUoLBtwtAbIYD2y9tB5oTjCRVcYjHBASUBFvYNX4=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=farcnuEiHUWcEouMHwaRo7o/AiCaE1Jn/6NYBX/r86JB5lIGkYG6mXXBXuYpMgFrk B1gyYMIgElk/GdgBiHJW/Dkjp6KzrfMAOcpyIA296tK4vDaAyJl/URyeIa0NQtR83V 0JqTOjxSooMBikxMnRnQjSJWtWXSDgemT+22bSsRNz5j+11B/KGvyLAcZl/W4rQkvx ApsAIHET26WZpzW+Cm/KlS8ZZY7TKv/H4M1ePDH4wmuPkRUW1HDFqgnnqTArz1h/Af guzVt1/C9Izi/TD2uah7uaT32uECC3NMlgdELQQVx2UZBphGtQcaQ3T37vGfp0r226 Kti+ypmE/uJFA== Date: Sun, 02 Aug 2026 13:59:56 +0000 To: "libcamera-devel@lists.libcamera.org" From: j4niwzis Subject: [PATCH 2/3] ipa: libipa: Add sensor helpers for the IMX582, IMX586 and OV8856 Message-ID: Feedback-ID: 156040633:user:proton X-Pm-Message-ID: cb2b0b5d2cdbfd608d67202ee14693d140214fb9 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 Sony parts use the usual Sony analogue gain, 1024 / (1024 - code), andtheir black level is 0x40 at ten bits, which the software ISP needs in order not to subtract the wrong pedestal - without it a dim scene comes out as a uniformly black frame. The OV8856 gain is linear in 1/128 steps, as on the OV8858. Signed-off-by: j4niwzis --- -- 2.51.0 diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp --- a/src/ipa/libipa/camera_sensor_helper.cpp +++ b/src/ipa/libipa/camera_sensor_helper.cpp @@ -654,6 +654,23 @@  };  REGISTER_CAMERA_SENSOR_HELPER("imx477", CameraSensorHelperImx477) +class CameraSensorHelperImx586 : public CameraSensorHelper +{ +public: + CameraSensorHelperImx586() + { + /* From the register tables: 0x40 at 10 bits. */ + blackLevel_ = 4096; + gain_ = AnalogueGainLinear{ 0, 1024, -1, 1024 }; + } +}; +REGISTER_CAMERA_SENSOR_HELPER("imx586", CameraSensorHelperImx586) + +class CameraSensorHelperImx582 : public CameraSensorHelperImx586 +{ +}; +REGISTER_CAMERA_SENSOR_HELPER("imx582", CameraSensorHelperImx582) +  class CameraSensorHelperImx662 : public CameraSensorHelper  {  public: @@ -827,6 +844,16 @@  };  REGISTER_CAMERA_SENSOR_HELPER("ov64a40", CameraSensorHelperOv64a40) +class CameraSensorHelperOv8856 : public CameraSensorHelper +{ +public: + CameraSensorHelperOv8856() + { + gain_ = AnalogueGainLinear{ 1, 0, 0, 128 }; + } +}; +REGISTER_CAMERA_SENSOR_HELPER("ov8856", CameraSensorHelperOv8856) +  class CameraSensorHelperOv8858 : public CameraSensorHelper  {  public: From patchwork Sun Aug 2 14:01:19 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: j4niwzis X-Patchwork-Id: 27541 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 DB8C4C32FE for ; Sun, 2 Aug 2026 14:01:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8BA4A67FEC; Sun, 2 Aug 2026 16:01:27 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=proton.me header.i=@proton.me header.b="XyYyYKYw"; dkim-atps=neutral Received: from mail-106103.protonmail.ch (mail-106103.protonmail.ch [79.135.106.103]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DFC5767FC1 for ; Sun, 2 Aug 2026 16:01:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1785679285; x=1785938485; bh=QAhbjaqPVyGz0Me3eC/2wmWYDTV7EBMci1VmNR+ZOOo=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=XyYyYKYw1ZAYh7e4yybJKmDCDIkgBIa3lCbXKeRwK3k/ebx1JqnmnNp1a0tfVbFS1 U/EQKdBpiv1aItuMGfLJ2zQW+S6+JE3Xvd1D0wdiWDucWPzJS0ml5zAIgCBQrvYRA6 KB7XD4ZUtbATKXMMWWA/9DNncp/xS3+btcIAmbeA8F7DNE4XO0fNQ6Inpgm2fEM96a 0fxUZi5e/5S33p22yRNvnmmp1XDXQbny5AohsnaG2QyOu+mQkCFGCV1Xz7deMbt2ll kfeaviUYnSbiqFVPpzZJUMo+MGp95UEG4EqNpLpg8FPmQdjUzVXFrRMeFg0inXXGop VNLAAllUIuaSg== Date: Sun, 02 Aug 2026 14:01:19 +0000 To: "libcamera-devel@lists.libcamera.org" From: j4niwzis Subject: [PATCH 3/3] ipa: simple: Add a tuning file for the IMX582 and IMX586 Message-ID: Feedback-ID: 156040633:user:proton X-Pm-Message-ID: bd650ad05445810ed48e09e90ab0b4f8ab9219e5 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" Without a tuning file of its own the sensor falls back to uncalibrated.yaml,which has no colour correction at all, and the picture comes out blue. The matrices here are the generic Sony daylight and tungsten ones, normalised so that each row sums to one; they are not measured on a particular module, but they are much closer than the identity that the uncalibrated file leaves in place.  A module specific profile can be built later from a colour target without touching this file. Signed-off-by: j4niwzis --- -- 2.51.0 diff --git a/src/ipa/simple/data/meson.build b/src/ipa/simple/data/meson.build --- a/src/ipa/simple/data/meson.build +++ b/src/ipa/simple/data/meson.build @@ -1,6 +1,7 @@  # SPDX-License-Identifier: CC0-1.0  conf_files = files([ +    'imx586.yaml',      'uncalibrated.yaml',  ]) diff --git a/src/ipa/simple/data/imx586.yaml b/src/ipa/simple/data/imx586.yaml new file mode 100644 --- /dev/null +++ b/src/ipa/simple/data/imx586.yaml @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: CC0-1.0 +%YAML 1.1 +--- +version: 1 +algorithms: +  - BlackLevel: +  - Awb: +  - Ccm: +      ccms: +        - ct: 2900 +          ccm: [  1.55, -0.44, -0.11, +                 -0.29,  1.61, -0.32, +                 -0.03, -0.72,  1.75 ] +        - ct: 6500 +          ccm: [  1.60, -0.52, -0.08, +                 -0.23,  1.60, -0.37, +                 -0.04, -0.55,  1.59 ] +  - Adjust: +  - Agc: +...