{"id":26932,"url":"https://patchwork.libcamera.org/api/patches/26932/?format=json","web_url":"https://patchwork.libcamera.org/patch/26932/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260618-imx678-v1-2-646e09a63692@ideasonboard.com>","date":"2026-06-18T11:48:40","name":"[2/2] ipa: rpi: Add cam_helper for Sony IMX678","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"fbaadde6c298def1aee9fff2f76c1e96079305ed","submitter":{"id":223,"url":"https://patchwork.libcamera.org/api/people/223/?format=json","name":"Jai Luthra","email":"jai.luthra@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/26932/mbox/","series":[{"id":6004,"url":"https://patchwork.libcamera.org/api/series/6004/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6004","date":"2026-06-18T11:48:38","name":"libcamera: sensor: Add support for Sony IMX678","version":1,"mbox":"https://patchwork.libcamera.org/series/6004/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26932/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26932/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id BED9DBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Jun 2026 11:49:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 76CE2629DF;\n\tThu, 18 Jun 2026 13:49:12 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 912E162980\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2026 13:49:11 +0200 (CEST)","from mail.ideasonboard.com (unknown\n\t[IPv6:2401:4900:1c68:bcf2:9325:a9bd:32b:e71])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 47F77741;\n\tThu, 18 Jun 2026 13:48:36 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"UANy+Yr6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1781783316;\n\tbh=LPgz76ddpT2JNEF2/Xmzw0geV9dOyTDvMznp3O8e3fM=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=UANy+Yr6khUEzvNipkJZz7zf7alS46T/KYltOcu46OmA4tmykCQ3AL2kqTqbRyhFQ\n\tWbYspAd63UJTxRAMhelCwdtzvd3OubH2JqAo012e6BZhmmQUK+orEF0uYg878OfAQg\n\t+vuvOwbU4tXLyJ43lGmTX5D1/xhmtNOXvUika7Zc=","From":"Jai Luthra <jai.luthra@ideasonboard.com>","Date":"Thu, 18 Jun 2026 17:18:40 +0530","Subject":"[PATCH 2/2] ipa: rpi: Add cam_helper for Sony IMX678","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"<20260618-imx678-v1-2-646e09a63692@ideasonboard.com>","References":"<20260618-imx678-v1-0-646e09a63692@ideasonboard.com>","In-Reply-To":"<20260618-imx678-v1-0-646e09a63692@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>, \n\tJai Luthra <jai.luthra@ideasonboard.com>, will whang <will@willwhang.com>","X-Mailer":"b4 0.14.3","X-Developer-Signature":"v=1; a=openpgp-sha256; l=2839;\n\ti=jai.luthra@ideasonboard.com; h=from:subject:message-id;\n\tbh=uy4+uYyp2Soft2iFzyiUKkc07xlanfxVKAZSQtYLIwQ=;\n\tb=owEBbQKS/ZANAwAKAUPekfkkmnFFAcsmYgBqM9sl9nulGAeyIniMoXZDPPd8KetjO/pO8pYwg\n\tT1YxZ19DCKJAjMEAAEKAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCajPbJQAKCRBD3pH5JJpx\n\tRdsoD/9MuBkJJLWkMenfww7uvw6hqrKcpfV/X/uWo1IbG2eB5/tmCQBfEz+a2mbbbtoqv8SjpQF\n\to7FakwlZZrBgWOfiZyRWuuBcnZ6JhPSXQtNm7dPOXggMXALbg13LBSclc4tBTg2+CJQLlXYRGzD\n\t7y1VqocxrYNleefiCzNhYnQ7JAc22JZ34icRjeGhGgccPDUIrU3LVNx3x3b9f1UPyuXncDD45Ig\n\takpfi2HL3GhYpvwssLBQUMxmEX9VCZ5FskOnrludlJ4Lzw5SRMUNVGqRKLX18jOB+fs6Pq2wq1p\n\tHvWZTmkpE8b1QITjNWsn8/Vme2s5/0W15dBwmKqWTL37LjL6rFVERMNxi8AqTZjCMqQEWda81EP\n\txvmppg99E6EYGUKn/TIHRpgM3jhB9WrfYVCOFMH4A09mj6ocJQjlIYsZ1YNtFY3EvGwb5FdsZNm\n\ttWfOURzJJ2XIpXMW+RUuU0pJZtcUo7HCrVyrLjNyhtXQ0MRPGbtDlY2lj7z0SQVVI51Ca/Tul2F\n\t3voa2+hRVu64ioBdk+SGlbulMIhEmtBcb/vRKoL1V2xEtjXHW0V0IbBChQT+NQ/LCW4SVHJg5f5\n\tu9qDVfyw0Dk3ZIIb1HvIy9yd08N2+6alb3rJ/6TJecZzGAQdAtr5VR17lkcgT1KybCyJEcDk/O1\n\tppOBXGPplKbwrJw==","X-Developer-Key":"i=jai.luthra@ideasonboard.com; a=openpgp;\n\tfpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: will whang <will@willwhang.com>\n\nThis adds a basic cam helper for Sony IMX678, taken from Will Whang's\ngithub.\n\nLink: https://github.com/will127534/libcamera/commit/619459e7c70306ba18476\nSigned-off-by: will whang <will@willwhang.com>\n[fix copyright notice, comments and whitespace]\nSigned-off-by: Jai Luthra <jai.luthra@ideasonboard.com>\n---\n src/ipa/rpi/cam_helper/cam_helper_imx678.cpp | 69 ++++++++++++++++++++++++++++\n src/ipa/rpi/cam_helper/meson.build           |  1 +\n 2 files changed, 70 insertions(+)","diff":"diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx678.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx678.cpp\nnew file mode 100644\nindex 000000000..43fc6ae54\n--- /dev/null\n+++ b/src/ipa/rpi/cam_helper/cam_helper_imx678.cpp\n@@ -0,0 +1,69 @@\n+/* SPDX-License-Identifier: BSD-2-Clause */\n+/*\n+ * Copyright (C) 2026, Will Whang\n+ *\n+ * cam_helper_imx678.cpp - camera information for Sony IMX678 sensor\n+ */\n+\n+#include <assert.h>\n+\n+#include \"cam_helper.h\"\n+#include \"math.h\"\n+using namespace RPiController;\n+\n+class CamHelperImx678 : public CamHelper\n+{\n+public:\n+\tCamHelperImx678();\n+\tuint32_t gainCode(double gain) const override;\n+\tdouble gain(uint32_t gainCode) const override;\n+\tunsigned int hideFramesStartup() const override;\n+\tunsigned int hideFramesModeSwitch() const override;\n+\n+private:\n+\t/*\n+\t * Smallest difference between the frame length and integration time,\n+\t * in units of lines.\n+\t */\n+\tstatic constexpr int frameIntegrationDiff = 4;\n+};\n+\n+/*\n+ * IMX678 doesn't output metadata, so we have to use the \"unicam parser\" which\n+ * works by counting frames.\n+ */\n+\n+CamHelperImx678::CamHelperImx678()\n+\t: CamHelper({}, frameIntegrationDiff)\n+{\n+}\n+\n+uint32_t CamHelperImx678::gainCode(double gain) const\n+{\n+\tint code = 66.6667 * log10(gain);\n+\treturn std::max(0, std::min(code, 0xf0));\n+}\n+\n+double CamHelperImx678::gain(uint32_t gainCode) const\n+{\n+\treturn pow(10, 0.015 * gainCode);\n+}\n+\n+unsigned int CamHelperImx678::hideFramesStartup() const\n+{\n+\t/* On startup, we seem to get 1 bad frame. */\n+\treturn 1;\n+}\n+\n+unsigned int CamHelperImx678::hideFramesModeSwitch() const\n+{\n+\t/* After a mode switch, we seem to get 1 bad frame. */\n+\treturn 1;\n+}\n+\n+static CamHelper *create()\n+{\n+\treturn new CamHelperImx678();\n+}\n+\n+static RegisterCamHelper reg(\"imx678\", &create);\ndiff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build\nindex 87b6a3600..eabd55dce 100644\n--- a/src/ipa/rpi/cam_helper/meson.build\n+++ b/src/ipa/rpi/cam_helper/meson.build\n@@ -10,6 +10,7 @@ rpi_ipa_cam_helper_sources = files([\n     'cam_helper_imx415.cpp',\n     'cam_helper_imx477.cpp',\n     'cam_helper_imx519.cpp',\n+    'cam_helper_imx678.cpp',\n     'cam_helper_imx708.cpp',\n     'cam_helper_ov64a40.cpp',\n     'cam_helper_ov7251.cpp',\n","prefixes":["2/2"]}