From patchwork Wed Dec 6 11:43:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 19290 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 E3317C32BC for ; Wed, 6 Dec 2023 11:43:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 86BC6629DC; Wed, 6 Dec 2023 12:43:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1701863004; bh=wc0KAwvhiTNCw8hGq7rRLgZ71Qhfpucra5q8wIcnAPk=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ppuOLPxAEFkAM7o1r0RHa/zeQ3tUAYbKR4B1pDfGEBgxFqA7LeEE2QWdg5QIGXsmh VAZFnNkq7w2KVF2KWFBVDO0aCghWFCURirwYcKMo9KT3kk7geKPsfHNGHa9JTflaDM SKkkZ0J8L/nkmGYLcgCD+wdUspQN2zraQ4jFN1xrLnSzgPBvAT70EDz79BqE+F0Ul2 MnKybR7qV1SLrQABijH/wumJdNKUflvM7wbGroLc9bIiUnFMC4dWEqp5o8CzMGijRY Mxt/co6iIerjjeRzgnFOhMZhzPm3RowiU0N0qnNoE3/4861uyoMvR5vIUk9ktmSdfV i8EhzRv5e3+rA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 172CB629DC for ; Wed, 6 Dec 2023 12:43:22 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PA1AbDdB"; dkim-atps=neutral Received: from localhost.localdomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 49F7FE45; Wed, 6 Dec 2023 12:42:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1701862961; bh=wc0KAwvhiTNCw8hGq7rRLgZ71Qhfpucra5q8wIcnAPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PA1AbDdB/8sqLgv1RtH3YjFhRdJbapHgDVeBa+FR19lRppb71L9CpnuWIgaD8IADJ MgLLrX0j/fUWdwU+5aVOKwNNqdhoLNGLGwEnyHreaxeQ8dH9VgvHYZ8sYW8hNsNKxJ FUJBUU19rxvCnC4vtQhzfPeVvhOuypYgclASaNEo= To: libcamera-devel@lists.libcamera.org Date: Wed, 6 Dec 2023 12:43:05 +0100 Message-ID: <20231206114307.94241-2-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231206114307.94241-1-jacopo.mondi@ideasonboard.com> References: <20231206114044.94068-1-jacopo.mondi@ideasonboard.com> <20231206114307.94241-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/4] ipa: rpi: Provide a Camera Helper for the OV64A40 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: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Support the OV64A40 sensor with a camera helper to manage the gain model, light sensitivity, and control delays. Signed-off-by: Lee Jackson Signed-off-by: Jacopo Mondi Reviewed-by: Naushir Patuck Reviewed-by: Kieran Bingham --- src/ipa/rpi/cam_helper/cam_helper_ov64a40.cpp | 73 +++++++++++++++++++ src/ipa/rpi/cam_helper/meson.build | 1 + 2 files changed, 74 insertions(+) create mode 100644 src/ipa/rpi/cam_helper/cam_helper_ov64a40.cpp diff --git a/src/ipa/rpi/cam_helper/cam_helper_ov64a40.cpp b/src/ipa/rpi/cam_helper/cam_helper_ov64a40.cpp new file mode 100644 index 000000000000..4575cc4e11d7 --- /dev/null +++ b/src/ipa/rpi/cam_helper/cam_helper_ov64a40.cpp @@ -0,0 +1,73 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) 2021, Raspberry Pi Ltd + * + * cam_helper_ov64a40.cpp - camera information for ov64a40 sensor + */ + +#include + +#include "cam_helper.h" + +using namespace RPiController; + +class CamHelperOv64a40 : public CamHelper +{ +public: + CamHelperOv64a40(); + uint32_t gainCode(double gain) const override; + double gain(uint32_t gainCode) const override; + void getDelays(int &exposureDelay, int &gainDelay, + int &vblankDelay, int &hblankDelay) const override; + double getModeSensitivity(const CameraMode &mode) const override; + +private: + /* + * Smallest difference between the frame length and integration time, + * in units of lines. + */ + static constexpr int frameIntegrationDiff = 32; +}; + +CamHelperOv64a40::CamHelperOv64a40() + : CamHelper({}, frameIntegrationDiff) +{ +} + +uint32_t CamHelperOv64a40::gainCode(double gain) const +{ + return static_cast(gain * 128.0); +} + +double CamHelperOv64a40::gain(uint32_t gainCode) const +{ + return static_cast(gainCode) / 128.0; +} + +void CamHelperOv64a40::getDelays(int &exposureDelay, int &gainDelay, + int &vblankDelay, int &hblankDelay) const +{ + /* The driver appears to behave as follows: */ + exposureDelay = 2; + gainDelay = 2; + vblankDelay = 2; + hblankDelay = 2; +} + +double CamHelperOv64a40::getModeSensitivity(const CameraMode &mode) const +{ + if (mode.binX >= 2 && mode.scaleX >= 4) { + return 4.0; + } else if (mode.binX >= 2 && mode.scaleX >= 2) { + return 2.0; + } else { + return 1.0; + } +} + +static CamHelper *create() +{ + return new CamHelperOv64a40(); +} + +static RegisterCamHelper reg("ov64a40", &create); diff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build index bdf2db8eb742..7262505742f3 100644 --- a/src/ipa/rpi/cam_helper/meson.build +++ b/src/ipa/rpi/cam_helper/meson.build @@ -9,6 +9,7 @@ rpi_ipa_cam_helper_sources = files([ 'cam_helper_imx477.cpp', 'cam_helper_imx519.cpp', 'cam_helper_imx708.cpp', + 'cam_helper_ov64a40.cpp', 'cam_helper_ov9281.cpp', 'md_parser_smia.cpp', ])