[libcamera-devel] [PATCH 1/3] ipa: raspberrypi: Embed the metadata parser in the sensor CamHelper classes
Kieran Bingham
kieran.bingham at ideasonboard.com
Fri Jun 18 23:53:00 CEST 2021
Hi Naush,
On 15/06/2021 15:42, Naushir Patuck wrote:
> This avoids the need for any dynamic allocations and lifetime management. The
> base CamHelper class still accesses the parser through a pointer that is setup
> by the derived class constructor.
>
Reducing allocations always sounds like a win.
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> ---
> src/ipa/raspberrypi/cam_helper.cpp | 1 -
> src/ipa/raspberrypi/cam_helper_imx219.cpp | 4 +++-
> src/ipa/raspberrypi/cam_helper_imx477.cpp | 4 +++-
> 3 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp
> index 062e94c4fef3..1474464c9257 100644
> --- a/src/ipa/raspberrypi/cam_helper.cpp
> +++ b/src/ipa/raspberrypi/cam_helper.cpp
> @@ -48,7 +48,6 @@ CamHelper::CamHelper(MdParser *parser, unsigned int frameIntegrationDiff)
>
> CamHelper::~CamHelper()
> {
> - delete parser_;
> }
>
> void CamHelper::Prepare(Span<const uint8_t> buffer,
> diff --git a/src/ipa/raspberrypi/cam_helper_imx219.cpp b/src/ipa/raspberrypi/cam_helper_imx219.cpp
> index ec218dce5456..d951cd552a21 100644
> --- a/src/ipa/raspberrypi/cam_helper_imx219.cpp
> +++ b/src/ipa/raspberrypi/cam_helper_imx219.cpp
> @@ -54,11 +54,13 @@ private:
> * in units of lines.
> */
> static constexpr int frameIntegrationDiff = 4;
> +
> + MdParserImx219 imx219_parser;
> };
>
> CamHelperImx219::CamHelperImx219()
> #if ENABLE_EMBEDDED_DATA
> - : CamHelper(new MdParserImx219(), frameIntegrationDiff)
> + : CamHelper(&imx219_parser, frameIntegrationDiff)
> #else
> : CamHelper(nullptr, frameIntegrationDiff)
> #endif
> diff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp
> index 25b36bce0dac..44f030ed7da9 100644
> --- a/src/ipa/raspberrypi/cam_helper_imx477.cpp
> +++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp
> @@ -47,10 +47,12 @@ private:
> * in units of lines.
> */
> static constexpr int frameIntegrationDiff = 22;
> +
> + MdParserImx477 imx477_parser;
> };
>
> CamHelperImx477::CamHelperImx477()
> - : CamHelper(new MdParserImx477(), frameIntegrationDiff)
> + : CamHelper(&imx477_parser, frameIntegrationDiff)
> {
> }
>
>
--
Regards
--
Kieran
More information about the libcamera-devel
mailing list