From patchwork Wed Jan 8 09:03:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 22458 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 6F39CBD80A for ; Wed, 8 Jan 2025 09:03:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1F93568500; Wed, 8 Jan 2025 10:03:38 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="D53KJnuW"; dkim-atps=neutral Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 54A3361891 for ; Wed, 8 Jan 2025 10:03:35 +0100 (CET) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-43658c452f5so23368385e9.0 for ; Wed, 08 Jan 2025 01:03:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1736327014; x=1736931814; 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=Q/rAkgB4C+3aKWnizj9Q0Giz/Otf49vHp4xQ/IR4WzQ=; b=D53KJnuWn34Pj693jBY3g0IPAFEuKOEqX1DvITIijdqubaTxMN6irgfDgazMIkHaJz Z81+bPiLiUfRcKlJb2uHHYSSBL2ynd6kIQ/RoPKHjgai0vpgImYzFMYi0EyCAggfyvhg 3mnPqKSTHU1akWJw2mRy+/MhcIYUBnn8WluSEh8wsthTB6BZ9UdifqSOdZY18FqmTkSl ZTenkOcDnNG8x3yAtPluwwZubq9jMDCjW0PQWHVwS9Ub9+ybJqxF7DphDBXoa4yGX2/L xU3KWO+0hwtsi6xK7YNbTDmaxKgM+7c/ZbbliYh53J0gtqwgWqQPzJSf9let3jUIvFnN xh+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736327014; x=1736931814; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q/rAkgB4C+3aKWnizj9Q0Giz/Otf49vHp4xQ/IR4WzQ=; b=Y1mQnqcVeFRHL/9LIUWjub0qIYBry2AgpaSJhCwayOgSo/rc3JF3rNujPJ9fBptaUG B3Dg0xKDjfPIIh7KzR6tuYrPvD7L3VqOnpIL7JuRaB+UEzroCJEuAMQKxCKvJPUjfAC9 zjWHNKPLTJQjL2LWx/oTJSnagk3E8tuR1btTHiVmFDHTxND3ovocTataxhhy9PsWnZU5 r2s9O9nSut6qM8lpfOPKjb8L3dGlPwW3KSWHyx9EJi3rdJqb+SpPAhDTa06EdGebfjeF 7M+GYhWkz+Jl8ZhGfmvjSFy+twq3f+yTZqN1Ekn6QoyNv5DdqCYfXhJrnsQ8MsKW0aY7 vseg== X-Gm-Message-State: AOJu0Yy7xiwS9YezycJ6saN4daEY7Fv1BAVd9K++ZGVZ8eHksyfDOWM4 0Ayi7/T6sT5yzJkO42NEwUxJoyBMffUDN5NdT21bm+MlbVed/zx5TfxZJyMCsOPBfezwvMkEhV/ gGkk= X-Gm-Gg: ASbGncutwyzFpuQj3IN9wGQMcsRFvChm/YirFpzS4d/lUxItinL/WipKHyfql43QIYz 8aYChbU//26Pp79JhJpxkom2Dcxms6XqX2TidxaonbIyriQW0B7uM/0f8QoHNGmnZGb4eFzkXBD Pta9buXxIj2o+yAVWEMgKT7WrxTH9yxLu3wMMMQr3tkFMlBKKpkgoVBW+u65PqqQB7FQ1YLovt2 S3HIokmX2QTea54b86eCW55vsTLRyq2Iaut8Wlnt1PIrbv6h4AJ0tyrI6SWsgIkuJMrlS1h3GGE X-Google-Smtp-Source: AGHT+IG32tmglQxlRCHo/SKfdIybwYsHO0d9YNGwljCL0SZcPBpnIeLu4vPnPGtWAkAG7cimK4MOsg== X-Received: by 2002:a5d:64ac:0:b0:385:e8e7:d0ac with SMTP id ffacd0b85a97d-38a8731f78fmr520609f8f.13.1736327013869; Wed, 08 Jan 2025 01:03:33 -0800 (PST) Received: from NAUSH-P-DELL.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e2da6271sm13624475e9.9.2025.01.08.01.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 01:03:33 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Dave Stevenson , Naushir Patuck Subject: [PATCH v1 2/3] ipa: rpi: Add cam_helper for imx415 Date: Wed, 8 Jan 2025 09:03:21 +0000 Message-ID: <20250108090329.3185026-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250108090329.3185026-1-naush@raspberrypi.com> References: <20250108090329.3185026-1-naush@raspberrypi.com> 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: Dave Stevenson As another Starvis sensor, it is near identical to imx290/327. Signed-off-by: Dave Stevenson Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- src/ipa/rpi/cam_helper/cam_helper_imx415.cpp | 64 ++++++++++++++++++++ src/ipa/rpi/cam_helper/meson.build | 1 + 2 files changed, 65 insertions(+) create mode 100644 src/ipa/rpi/cam_helper/cam_helper_imx415.cpp diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx415.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx415.cpp new file mode 100644 index 000000000000..c0a09eee3dee --- /dev/null +++ b/src/ipa/rpi/cam_helper/cam_helper_imx415.cpp @@ -0,0 +1,64 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) 2025, Raspberry Pi Ltd + * + * camera helper for imx415 sensor + */ + +#include + +#include "cam_helper.h" + +using namespace RPiController; + +class CamHelperImx415 : public CamHelper +{ +public: + CamHelperImx415(); + uint32_t gainCode(double gain) const override; + double gain(uint32_t gainCode) const override; + unsigned int hideFramesStartup() const override; + unsigned int hideFramesModeSwitch() const override; + +private: + /* + * Smallest difference between the frame length and integration time, + * in units of lines. + */ + static constexpr int frameIntegrationDiff = 8; +}; + +CamHelperImx415::CamHelperImx415() + : CamHelper({}, frameIntegrationDiff) +{ +} + +uint32_t CamHelperImx415::gainCode(double gain) const +{ + int code = 66.6667 * std::log10(gain); + return std::max(0, std::min(code, 0xf0)); +} + +double CamHelperImx415::gain(uint32_t gainCode) const +{ + return std::pow(10, 0.015 * gainCode); +} + +unsigned int CamHelperImx415::hideFramesStartup() const +{ + /* On startup, we seem to get 1 bad frame. */ + return 1; +} + +unsigned int CamHelperImx415::hideFramesModeSwitch() const +{ + /* After a mode switch, we seem to get 1 bad frame. */ + return 1; +} + +static CamHelper *create() +{ + return new CamHelperImx415(); +} + +static RegisterCamHelper reg("imx415", &create); diff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build index 03e88fe082e2..abf021474b5c 100644 --- a/src/ipa/rpi/cam_helper/meson.build +++ b/src/ipa/rpi/cam_helper/meson.build @@ -7,6 +7,7 @@ rpi_ipa_cam_helper_sources = files([ 'cam_helper_imx283.cpp', 'cam_helper_imx290.cpp', 'cam_helper_imx296.cpp', + 'cam_helper_imx415.cpp', 'cam_helper_imx477.cpp', 'cam_helper_imx519.cpp', 'cam_helper_imx708.cpp',