[1/3] ipa: rpi: cam_helper: Add Mira220 cam helper
diff mbox series

Message ID 20260722-mira220-v1-1-1006a4cbd2a8@ideasonboard.com
State Superseded
Headers show
Series
  • ipa: rpi: Add support for Mira220 RGB version
Related show

Commit Message

Jacopo Mondi July 22, 2026, 11:57 a.m. UTC
AMS-OSRAM Mira220 is a global shutter sensor with a maximum
resolution of 1600x1400.

This patch upports the Mira220 support available at
https://github.com/ams-OSRAM/libcamera.git at revision d7d5e17ec961
("update json files so they are truly mono")

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
 src/ipa/rpi/cam_helper/cam_helper_mira220.cpp | 61 +++++++++++++++++++++++++++
 src/ipa/rpi/cam_helper/meson.build            |  1 +
 2 files changed, 62 insertions(+)

Comments

Kieran Bingham July 22, 2026, 12:33 p.m. UTC | #1
Quoting Jacopo Mondi (2026-07-22 12:57:11)
> AMS-OSRAM Mira220 is a global shutter sensor with a maximum
> resolution of 1600x1400.
> 
> This patch upports the Mira220 support available at
> https://github.com/ams-OSRAM/libcamera.git at revision d7d5e17ec961
> ("update json files so they are truly mono")
> 
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> ---
>  src/ipa/rpi/cam_helper/cam_helper_mira220.cpp | 61 +++++++++++++++++++++++++++
>  src/ipa/rpi/cam_helper/meson.build            |  1 +
>  2 files changed, 62 insertions(+)
> 
> diff --git a/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp b/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp
> new file mode 100644
> index 000000000000..235546ccf7c5
> --- /dev/null
> +++ b/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp
> @@ -0,0 +1,61 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +/*
> + * Copyright (C) 2024, Raspberry Pi Ltd

I expect that should be ams-osram ... I don't think RPi made this
helper.


Aside from that, I think this series should add the libipa camera sensor
helper and the camera sensor properties ?

--
Kieran

> + *
> + * 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);
> diff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build
> index eabd55dce5a1..a8756a1a0226 100644
> --- a/src/ipa/rpi/cam_helper/meson.build
> +++ b/src/ipa/rpi/cam_helper/meson.build
> @@ -12,6 +12,7 @@ rpi_ipa_cam_helper_sources = files([
>      'cam_helper_imx519.cpp',
>      'cam_helper_imx678.cpp',
>      'cam_helper_imx708.cpp',
> +    'cam_helper_mira220.cpp',
>      'cam_helper_ov64a40.cpp',
>      'cam_helper_ov7251.cpp',
>      'cam_helper_ov9281.cpp',
> 
> -- 
> 2.54.0
>
Laurent Pinchart July 23, 2026, 1:55 p.m. UTC | #2
On Wed, Jul 22, 2026 at 01:33:12PM +0100, Kieran Bingham wrote:
> Quoting Jacopo Mondi (2026-07-22 12:57:11)
> > AMS-OSRAM Mira220 is a global shutter sensor with a maximum
> > resolution of 1600x1400.
> > 
> > This patch upports the Mira220 support available at
> > https://github.com/ams-OSRAM/libcamera.git at revision d7d5e17ec961
> > ("update json files so they are truly mono")
> > 
> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> > ---
> >  src/ipa/rpi/cam_helper/cam_helper_mira220.cpp | 61 +++++++++++++++++++++++++++
> >  src/ipa/rpi/cam_helper/meson.build            |  1 +
> >  2 files changed, 62 insertions(+)
> > 
> > diff --git a/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp b/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp
> > new file mode 100644
> > index 000000000000..235546ccf7c5
> > --- /dev/null
> > +++ b/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp
> > @@ -0,0 +1,61 @@
> > +/* SPDX-License-Identifier: BSD-2-Clause */
> > +/*
> > + * Copyright (C) 2024, Raspberry Pi Ltd
> 
> I expect that should be ams-osram ... I don't think RPi made this
> helper.
> 
> Aside from that, I think this series should add the libipa camera sensor
> helper and the camera sensor properties ?
> 
> > + *
> > + * 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;

Could you confirm you've tested this, not just copied it from another
helper ?

> > +}
> > +
> > +static CamHelper *create()
> > +{
> > +       return new CamHelperMira220();
> > +}
> > +
> > +static RegisterCamHelper reg("mira220", &create);
> > diff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build
> > index eabd55dce5a1..a8756a1a0226 100644
> > --- a/src/ipa/rpi/cam_helper/meson.build
> > +++ b/src/ipa/rpi/cam_helper/meson.build
> > @@ -12,6 +12,7 @@ rpi_ipa_cam_helper_sources = files([
> >      'cam_helper_imx519.cpp',
> >      'cam_helper_imx678.cpp',
> >      'cam_helper_imx708.cpp',
> > +    'cam_helper_mira220.cpp',
> >      'cam_helper_ov64a40.cpp',
> >      'cam_helper_ov7251.cpp',
> >      'cam_helper_ov9281.cpp',
Jacopo Mondi July 23, 2026, 3:13 p.m. UTC | #3
On Thu, Jul 23, 2026 at 04:55:21PM +0300, Laurent Pinchart wrote:
> On Wed, Jul 22, 2026 at 01:33:12PM +0100, Kieran Bingham wrote:
> > Quoting Jacopo Mondi (2026-07-22 12:57:11)
> > > AMS-OSRAM Mira220 is a global shutter sensor with a maximum
> > > resolution of 1600x1400.
> > >
> > > This patch upports the Mira220 support available at
> > > https://github.com/ams-OSRAM/libcamera.git at revision d7d5e17ec961
> > > ("update json files so they are truly mono")
> > >
> > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> > > ---
> > >  src/ipa/rpi/cam_helper/cam_helper_mira220.cpp | 61 +++++++++++++++++++++++++++
> > >  src/ipa/rpi/cam_helper/meson.build            |  1 +
> > >  2 files changed, 62 insertions(+)
> > >
> > > diff --git a/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp b/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp
> > > new file mode 100644
> > > index 000000000000..235546ccf7c5
> > > --- /dev/null
> > > +++ b/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp
> > > @@ -0,0 +1,61 @@
> > > +/* SPDX-License-Identifier: BSD-2-Clause */
> > > +/*
> > > + * Copyright (C) 2024, Raspberry Pi Ltd
> >
> > I expect that should be ams-osram ... I don't think RPi made this
> > helper.

Surely not, it's probably a bad copy&paste.

Actually it's not only Copyright, I should attribute the patch to
Philippe as this file comes from multiple of his commits in their bsp

> >
> > Aside from that, I think this series should add the libipa camera sensor
> > helper and the camera sensor properties ?
> >

I can't test other platforms them at the moment, I would prefer not to
send untested things ?

> > > + *
> > > + * 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;
>
> Could you confirm you've tested this, not just copied it from another
> helper ?
>

Maybe a question for Philippe, but as the sensor supports a single
mode maybe this is not needed ?

Thanks
  j

> > > +}
> > > +
> > > +static CamHelper *create()
> > > +{
> > > +       return new CamHelperMira220();
> > > +}
> > > +
> > > +static RegisterCamHelper reg("mira220", &create);
> > > diff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build
> > > index eabd55dce5a1..a8756a1a0226 100644
> > > --- a/src/ipa/rpi/cam_helper/meson.build
> > > +++ b/src/ipa/rpi/cam_helper/meson.build
> > > @@ -12,6 +12,7 @@ rpi_ipa_cam_helper_sources = files([
> > >      'cam_helper_imx519.cpp',
> > >      'cam_helper_imx678.cpp',
> > >      'cam_helper_imx708.cpp',
> > > +    'cam_helper_mira220.cpp',
> > >      'cam_helper_ov64a40.cpp',
> > >      'cam_helper_ov7251.cpp',
> > >      'cam_helper_ov9281.cpp',
>
> --
> Regards,
>
> Laurent Pinchart
Laurent Pinchart July 23, 2026, 3:27 p.m. UTC | #4
On Thu, Jul 23, 2026 at 05:13:09PM +0200, Jacopo Mondi wrote:
> On Thu, Jul 23, 2026 at 04:55:21PM +0300, Laurent Pinchart wrote:
> > On Wed, Jul 22, 2026 at 01:33:12PM +0100, Kieran Bingham wrote:
> > > Quoting Jacopo Mondi (2026-07-22 12:57:11)
> > > > AMS-OSRAM Mira220 is a global shutter sensor with a maximum
> > > > resolution of 1600x1400.
> > > >
> > > > This patch upports the Mira220 support available at
> > > > https://github.com/ams-OSRAM/libcamera.git at revision d7d5e17ec961
> > > > ("update json files so they are truly mono")
> > > >
> > > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> > > > ---
> > > >  src/ipa/rpi/cam_helper/cam_helper_mira220.cpp | 61 +++++++++++++++++++++++++++
> > > >  src/ipa/rpi/cam_helper/meson.build            |  1 +
> > > >  2 files changed, 62 insertions(+)
> > > >
> > > > diff --git a/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp b/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp
> > > > new file mode 100644
> > > > index 000000000000..235546ccf7c5
> > > > --- /dev/null
> > > > +++ b/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp
> > > > @@ -0,0 +1,61 @@
> > > > +/* SPDX-License-Identifier: BSD-2-Clause */
> > > > +/*
> > > > + * Copyright (C) 2024, Raspberry Pi Ltd
> > >
> > > I expect that should be ams-osram ... I don't think RPi made this
> > > helper.
> 
> Surely not, it's probably a bad copy&paste.
> 
> Actually it's not only Copyright, I should attribute the patch to
> Philippe as this file comes from multiple of his commits in their bsp
> 
> > >
> > > Aside from that, I think this series should add the libipa camera sensor
> > > helper and the camera sensor properties ?
> > >
> 
> I can't test other platforms them at the moment, I would prefer not to
> send untested things ?

We require libipa helpers for all sensors libcamera supports. It's fine
if you can't test it right now. 

> > > > + *
> > > > + * 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;
> >
> > Could you confirm you've tested this, not just copied it from another
> > helper ?
> 
> Maybe a question for Philippe, but as the sensor supports a single
> mode maybe this is not needed ?

Unless there's a known reason for hiding the first frame, I would prefer
dropping this indeed.

> > > > +}
> > > > +
> > > > +static CamHelper *create()
> > > > +{
> > > > +       return new CamHelperMira220();
> > > > +}
> > > > +
> > > > +static RegisterCamHelper reg("mira220", &create);
> > > > diff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build
> > > > index eabd55dce5a1..a8756a1a0226 100644
> > > > --- a/src/ipa/rpi/cam_helper/meson.build
> > > > +++ b/src/ipa/rpi/cam_helper/meson.build
> > > > @@ -12,6 +12,7 @@ rpi_ipa_cam_helper_sources = files([
> > > >      'cam_helper_imx519.cpp',
> > > >      'cam_helper_imx678.cpp',
> > > >      'cam_helper_imx708.cpp',
> > > > +    'cam_helper_mira220.cpp',
> > > >      'cam_helper_ov64a40.cpp',
> > > >      'cam_helper_ov7251.cpp',
> > > >      'cam_helper_ov9281.cpp',

Patch
diff mbox series

diff --git a/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp b/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp
new file mode 100644
index 000000000000..235546ccf7c5
--- /dev/null
+++ b/src/ipa/rpi/cam_helper/cam_helper_mira220.cpp
@@ -0,0 +1,61 @@ 
+/* 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);
diff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build
index eabd55dce5a1..a8756a1a0226 100644
--- a/src/ipa/rpi/cam_helper/meson.build
+++ b/src/ipa/rpi/cam_helper/meson.build
@@ -12,6 +12,7 @@  rpi_ipa_cam_helper_sources = files([
     'cam_helper_imx519.cpp',
     'cam_helper_imx678.cpp',
     'cam_helper_imx708.cpp',
+    'cam_helper_mira220.cpp',
     'cam_helper_ov64a40.cpp',
     'cam_helper_ov7251.cpp',
     'cam_helper_ov9281.cpp',