Skip to content

add support for mira220 image sensor #248

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/ipa/libipa/camera_sensor_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,12 @@ class CameraSensorHelperImx296 : public CameraSensorHelper
};
REGISTER_CAMERA_SENSOR_HELPER("imx296", CameraSensorHelperImx296)

class CameraSensorHelperMira220 : public CameraSensorHelper
{
};
REGISTER_CAMERA_SENSOR_HELPER("mira220", CameraSensorHelperMira220)


class CameraSensorHelperImx327 : public CameraSensorHelperImx290
{
};
Expand Down
62 changes: 62 additions & 0 deletions src/ipa/rpi/cam_helper/cam_helper_mira220.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
* Copyright (C) 2024, Raspberry Pi Ltd
*
* cam_helper_Mira220.cpp - camera information for Mira220 sensor
*/

#include <assert.h>

#include "cam_helper.h"

using namespace RPiController;

class CamHelperMira220 : public CamHelper
{
public:
CamHelperMira220();
uint32_t gainCode(double gain) const override;
double gain(uint32_t gainCode) 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 = 4;
};

/*
* Mira220 doesn't output metadata, so we have to use the delayed controls which
* works by counting frames.
*/

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

uint32_t CamHelperMira220::gainCode(double gain) const
{
return static_cast<uint32_t>(2048.0 - 2048.0 / gain);
}

double CamHelperMira220::gain(uint32_t gainCode) const
{
return static_cast<double>(2048.0 / (2048 - gainCode));
}

unsigned int CamHelperMira220::hideFramesModeSwitch() const
{
/* After a mode switch, we seem to get 1 bad frame. */
return 1;
}

static CamHelper *create()
{
return new CamHelperMira220();
}

static RegisterCamHelper reg("mira220", &create);

1 change: 1 addition & 0 deletions src/ipa/rpi/cam_helper/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
rpi_ipa_cam_helper_sources = files([
'cam_helper.cpp',
'cam_helper_ov5647.cpp',
'cam_helper_mira220.cpp',
'cam_helper_imx219.cpp',
'cam_helper_imx283.cpp',
'cam_helper_imx290.cpp',
Expand Down
2 changes: 2 additions & 0 deletions src/ipa/rpi/pisp/data/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# SPDX-License-Identifier: CC0-1.0

conf_files = files([
'mira220.json',
'mira220_mono.json',
'imx219.json',
'imx219_noir.json',
'imx290.json',
Expand Down
Loading