Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Arducam OV64A40 64MPx camera module #84

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
be13578
meson: Add libpisp.wrap
naushir May 4, 2023
f0cf7c1
libcamera: formats: Add PiSP specific image and config buffer formats
naushir Nov 17, 2022
98be53f
ipa: rpi: hdr: Add the ability to alter the LSC table
davidplowman Oct 10, 2023
18b8db1
ipa: rpi: alsc: Do not re-read the alsc.status metadata
davidplowman Oct 10, 2023
1768689
ipa: rpi: agc: Allow AGC channels to avoid using "fast desaturation"
davidplowman Oct 12, 2023
7516374
ipa: rpi: vc4: Move denoise control handling into the VC4 derived IPA
naushir Oct 16, 2023
54ecd61
ipa: rpi: agc: Fetch AWB status in the prepare method
davidplowman Oct 18, 2023
b51c2dc
ipa: rpi: agc: Make AGC controls affect all channels
davidplowman Oct 18, 2023
8782dbf
libcamera: controls: Add controls for HDR
davidplowman Sep 25, 2023
4eb5f28
ipa: rpi: Add HDR support
naushir Oct 6, 2023
b61527d
pipeline: rpi: Add support for Raspberry Pi 5
naushir Jun 19, 2023
b866eaa
ipa: rpi: Add support for Raspberry Pi 5
naushir May 4, 2023
8be0303
utils: raspberrypi: ctt: Adapt tuning tool for both VC4 and PiSP
davidplowman Mar 17, 2023
ac34a10
utils: raspberrypi: ctt: Added CAC support to the CTT
bebon901 Aug 25, 2023
a9d0eb3
utils: raspberrypi: ctt: Changed CTT handling of VC4 and PiSP
bebon901 Sep 4, 2023
bb894e5
utils: raspberrypi: ctt: Update tuning tool for HDR
davidplowman Oct 6, 2023
abe7174
RASPBERRYPI ONLY: Add Sony IMX708 sensor properties
njhollinghurst Dec 8, 2022
4a23664
RASPBERRYPI ONLY: Handle mandatory stream flags
naushir May 23, 2023
b775911
libcamera: camera_sensor: Add OV64A40 sensor properties
kbingham Oct 17, 2023
83a5acf
ipa: rpi: Provide a Camera Helper for the OV64A40
Jul 25, 2023
c409c4a
ipa: rpi: vc4: Add OV64A40 tuning files
kbingham Oct 17, 2023
5fc413f
ipa: rpi: pisp: Add OV64A40 tuning file
Nov 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Documentation/guides/pipeline-handler.rst
Expand Up @@ -183,7 +183,7 @@ to the libcamera build options in the top level ``meson_options.txt``.

option('pipelines',
type : 'array',
choices : ['ipu3', 'rkisp1', 'rpi/vc4', 'simple', 'uvcvideo', 'vimc', 'vivid'],
choices : ['ipu3', 'rkisp1', 'rpi/pisp', 'rpi/vc4', 'simple', 'uvcvideo', 'vimc', 'vivid'],
description : 'Select which pipeline handlers to include')


Expand Down
2 changes: 2 additions & 0 deletions include/libcamera/internal/bayer_format.h
Expand Up @@ -34,6 +34,8 @@ class BayerFormat
None = 0,
CSI2 = 1,
IPU3 = 2,
PISP1 = 3,
PISP2 = 4,
};

constexpr BayerFormat()
Expand Down
1 change: 1 addition & 0 deletions include/libcamera/ipa/meson.build
Expand Up @@ -64,6 +64,7 @@ libcamera_generated_ipa_headers += custom_target('core_ipa_serializer_h',
pipeline_ipa_mojom_mapping = {
'ipu3': 'ipu3.mojom',
'rkisp1': 'rkisp1.mojom',
'rpi/pisp': 'raspberrypi.mojom',
'rpi/vc4': 'raspberrypi.mojom',
'vimc': 'vimc.mojom',
}
Expand Down
4 changes: 4 additions & 0 deletions include/linux/drm_fourcc.h
Expand Up @@ -448,6 +448,7 @@ extern "C" {
#define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09
#define DRM_FORMAT_MOD_VENDOR_AMLOGIC 0x0a
#define DRM_FORMAT_MOD_VENDOR_MIPI 0x0b
#define DRM_FORMAT_MOD_VENDOR_RPI 0x0c

/* add more to the end as needed */

Expand Down Expand Up @@ -1554,6 +1555,9 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
*/
#define MIPI_FORMAT_MOD_CSI2_PACKED fourcc_mod_code(MIPI, 1)

#define PISP_FORMAT_MOD_COMPRESS_MODE1 fourcc_mod_code(RPI, 1)
#define PISP_FORMAT_MOD_COMPRESS_MODE2 fourcc_mod_code(RPI, 2)

#if defined(__cplusplus)
}
#endif
Expand Down
20 changes: 20 additions & 0 deletions include/linux/videodev2.h
Expand Up @@ -752,6 +752,17 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_IPU3_SGRBG10 v4l2_fourcc('i', 'p', '3', 'G') /* IPU3 packed 10-bit GRBG bayer */
#define V4L2_PIX_FMT_IPU3_SRGGB10 v4l2_fourcc('i', 'p', '3', 'r') /* IPU3 packed 10-bit RGGB bayer */

/* The pixel format for all our buffers (the precise format is found in the config buffer). */
#define V4L2_PIX_FMT_RPI_BE v4l2_fourcc('R', 'P', 'B', 'P')
#define V4L2_PIX_FMT_PISP_COMP1_RGGB v4l2_fourcc('P', 'C', '1', 'R')
#define V4L2_PIX_FMT_PISP_COMP1_GRBG v4l2_fourcc('P', 'C', '1', 'G')
#define V4L2_PIX_FMT_PISP_COMP1_GBRG v4l2_fourcc('P', 'C', '1', 'g')
#define V4L2_PIX_FMT_PISP_COMP1_BGGR v4l2_fourcc('P', 'C', '1', 'B')
#define V4L2_PIX_FMT_PISP_COMP2_RGGB v4l2_fourcc('P', 'C', '2', 'R')
#define V4L2_PIX_FMT_PISP_COMP2_GRBG v4l2_fourcc('P', 'C', '2', 'G')
#define V4L2_PIX_FMT_PISP_COMP2_GBRG v4l2_fourcc('P', 'C', '2', 'g')
#define V4L2_PIX_FMT_PISP_COMP2_BGGR v4l2_fourcc('P', 'C', '2', 'B')

/* SDR formats - used only for Software Defined Radio devices */
#define V4L2_SDR_FMT_CU8 v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */
#define V4L2_SDR_FMT_CU16LE v4l2_fourcc('C', 'U', '1', '6') /* IQ u16le */
Expand Down Expand Up @@ -781,6 +792,15 @@ struct v4l2_pix_format {
#define V4L2_META_FMT_RK_ISP1_PARAMS v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */
#define V4L2_META_FMT_RK_ISP1_STAT_3A v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */

/* The metadata format identifier for BE configuration buffers. */
#define V4L2_META_FMT_RPI_BE_CFG v4l2_fourcc('R', 'P', 'B', 'C')

/* The metadata format identifier for FE configuration buffers. */
#define V4L2_META_FMT_RPI_FE_CFG v4l2_fourcc('R', 'P', 'F', 'C')

/* The metadata format identifier for FE stats buffers. */
#define V4L2_META_FMT_RPI_FE_STATS v4l2_fourcc('R', 'P', 'F', 'S')

/* priv field value to indicates that subsequent fields are valid. */
#define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe

Expand Down
1 change: 1 addition & 0 deletions meson.build
Expand Up @@ -199,6 +199,7 @@ pipelines_support = {
'imx8-isi': arch_arm,
'ipu3': arch_x86,
'rkisp1': arch_arm,
'rpi/pisp': arch_arm,
'rpi/vc4': arch_arm,
'simple': arch_arm,
'uvcvideo': ['any'],
Expand Down
3 changes: 2 additions & 1 deletion meson_options.txt
Expand Up @@ -27,7 +27,7 @@ option('gstreamer',

option('ipas',
type : 'array',
choices : ['ipu3', 'rkisp1', 'rpi/vc4', 'vimc'],
choices : ['ipu3', 'rkisp1', 'rpi/pisp', 'rpi/vc4', 'vimc'],
description : 'Select which IPA modules to build')

option('lc-compliance',
Expand All @@ -44,6 +44,7 @@ option('pipelines',
'imx8-isi',
'ipu3',
'rkisp1',
'rpi/pisp',
'rpi/vc4',
'simple',
'uvcvideo',
Expand Down
73 changes: 73 additions & 0 deletions 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 <assert.h>

#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 = 4;
};

CamHelperOv64a40::CamHelperOv64a40()
: CamHelper({}, frameIntegrationDiff)
{
}

uint32_t CamHelperOv64a40::gainCode(double gain) const
{
return static_cast<uint32_t>(gain * 128.0);
}

double CamHelperOv64a40::gain(uint32_t gainCode) const
{
return static_cast<double>(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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment doesn't seem to match what the routine is doing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll drop both comments ;)

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);
1 change: 1 addition & 0 deletions src/ipa/rpi/cam_helper/meson.build
Expand Up @@ -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',
])
Expand Down