Message ID | 20250917-vd55g1_support-v2-2-101b53b66add@foss.st.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
Hi Benjamin, Thanks for the patch. On Wed, 17 Sept 2025 at 14:42, Benjamin Mugnier < benjamin.mugnier@foss.st.com> wrote: > The cam_helper gain formula and frameIntegrationDiff can be found in the > vd55g1 user manual. > > Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com> > Acked-by: Naushir Patuck <naush@raspberrypi.com> > --- > src/ipa/rpi/cam_helper/cam_helper_vd55g1.cpp | 49 > ++++++++++++++++++++++++++++ > src/ipa/rpi/cam_helper/meson.build | 1 + > 2 files changed, 50 insertions(+) > > diff --git a/src/ipa/rpi/cam_helper/cam_helper_vd55g1.cpp > b/src/ipa/rpi/cam_helper/cam_helper_vd55g1.cpp > new file mode 100644 > index > 0000000000000000000000000000000000000000..7a262e2332f3039b1fd35330abfb91099ff0e21e > --- /dev/null > +++ b/src/ipa/rpi/cam_helper/cam_helper_vd55g1.cpp > @@ -0,0 +1,49 @@ > +/* SPDX-License-Identifier: BSD-2-Clause */ > +/* > + * Copyright (C) STMicroelectronics SA 2025 > + * > + * Camera information for vd55g1 sensor > + */ > + > +#include <assert.h> > + > +#include "cam_helper.h" > + > +using namespace RPiController; > + > +class CamHelperVd55g1 : public CamHelper > +{ > +public: > + CamHelperVd55g1(); > + uint32_t gainCode(double gain) const override; > + double gain(uint32_t gainCode) const override; > + > +private: > + /* > + * Smallest difference between the frame length and integration > time, > + * in units of lines. > + */ > + static constexpr int frameIntegrationDiff = 64; > +}; > + > +CamHelperVd55g1::CamHelperVd55g1() > + : CamHelper({}, frameIntegrationDiff) > +{ > +} > + > +uint32_t CamHelperVd55g1::gainCode(double gain) const > +{ > + return static_cast<uint32_t>(32.0 - 32.0 / gain); > +} > + > +double CamHelperVd55g1::gain(uint32_t gainCode) const > +{ > + return 32.0 / (32.0 - static_cast<double>(gainCode)); > +} > + > +static CamHelper *create() > +{ > + return new CamHelperVd55g1(); > +} > + > +static RegisterCamHelper reg("vd55g1", &create); > diff --git a/src/ipa/rpi/cam_helper/meson.build > b/src/ipa/rpi/cam_helper/meson.build > index > b70acbee5fcaa94265da1f1ad75487563486679f..87b6a3600b18b5d380a9007f92cc620bfbafb830 > 100644 > --- a/src/ipa/rpi/cam_helper/meson.build > +++ b/src/ipa/rpi/cam_helper/meson.build > @@ -14,6 +14,7 @@ rpi_ipa_cam_helper_sources = files([ > 'cam_helper_ov64a40.cpp', > 'cam_helper_ov7251.cpp', > 'cam_helper_ov9281.cpp', > + 'cam_helper_vd55g1.cpp', > 'cam_helper_vd56g3.cpp', > 'md_parser_smia.cpp', > ]) > > -- > 2.25.1 > >
diff --git a/src/ipa/rpi/cam_helper/cam_helper_vd55g1.cpp b/src/ipa/rpi/cam_helper/cam_helper_vd55g1.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7a262e2332f3039b1fd35330abfb91099ff0e21e --- /dev/null +++ b/src/ipa/rpi/cam_helper/cam_helper_vd55g1.cpp @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) STMicroelectronics SA 2025 + * + * Camera information for vd55g1 sensor + */ + +#include <assert.h> + +#include "cam_helper.h" + +using namespace RPiController; + +class CamHelperVd55g1 : public CamHelper +{ +public: + CamHelperVd55g1(); + uint32_t gainCode(double gain) const override; + double gain(uint32_t gainCode) const override; + +private: + /* + * Smallest difference between the frame length and integration time, + * in units of lines. + */ + static constexpr int frameIntegrationDiff = 64; +}; + +CamHelperVd55g1::CamHelperVd55g1() + : CamHelper({}, frameIntegrationDiff) +{ +} + +uint32_t CamHelperVd55g1::gainCode(double gain) const +{ + return static_cast<uint32_t>(32.0 - 32.0 / gain); +} + +double CamHelperVd55g1::gain(uint32_t gainCode) const +{ + return 32.0 / (32.0 - static_cast<double>(gainCode)); +} + +static CamHelper *create() +{ + return new CamHelperVd55g1(); +} + +static RegisterCamHelper reg("vd55g1", &create); diff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build index b70acbee5fcaa94265da1f1ad75487563486679f..87b6a3600b18b5d380a9007f92cc620bfbafb830 100644 --- a/src/ipa/rpi/cam_helper/meson.build +++ b/src/ipa/rpi/cam_helper/meson.build @@ -14,6 +14,7 @@ rpi_ipa_cam_helper_sources = files([ 'cam_helper_ov64a40.cpp', 'cam_helper_ov7251.cpp', 'cam_helper_ov9281.cpp', + 'cam_helper_vd55g1.cpp', 'cam_helper_vd56g3.cpp', 'md_parser_smia.cpp', ])
The cam_helper gain formula and frameIntegrationDiff can be found in the vd55g1 user manual. Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com> --- src/ipa/rpi/cam_helper/cam_helper_vd55g1.cpp | 49 ++++++++++++++++++++++++++++ src/ipa/rpi/cam_helper/meson.build | 1 + 2 files changed, 50 insertions(+)