[libcamera-devel] ipa: rpi: vc4: Make the StatisticsPtr construction clearer
diff mbox series

Message ID 20230728124907.3113-1-david.plowman@raspberrypi.com
State Accepted
Commit 58e501c71c47e57f02afde1bd296a037038cd6d5
Headers show
Series
  • [libcamera-devel] ipa: rpi: vc4: Make the StatisticsPtr construction clearer
Related show

Commit Message

David Plowman July 28, 2023, 12:49 p.m. UTC
StatisticsPtr is a shared pointer, so the use of std::make_unique to
create it was a bit confusing. Use std::make_shared instead.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/ipa/rpi/vc4/vc4.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Naushir Patuck July 28, 2023, 12:52 p.m. UTC | #1
Hi David,

Oops, thanks for the fix!

On Fri, 28 Jul 2023 at 13:49, David Plowman via libcamera-devel
<libcamera-devel@lists.libcamera.org> wrote:
>
> StatisticsPtr is a shared pointer, so the use of std::make_unique to
> create it was a bit confusing. Use std::make_shared instead.
>
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>

Reviewed-by: Naushir Patuck <naush@raspberrypi.com>

> ---
>  src/ipa/rpi/vc4/vc4.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp
> index 789a345f..3eea40a6 100644
> --- a/src/ipa/rpi/vc4/vc4.cpp
> +++ b/src/ipa/rpi/vc4/vc4.cpp
> @@ -191,7 +191,7 @@ RPiController::StatisticsPtr IpaVc4::platformProcessStats(Span<uint8_t> mem)
>         using namespace RPiController;
>
>         const bcm2835_isp_stats *stats = reinterpret_cast<bcm2835_isp_stats *>(mem.data());
> -       StatisticsPtr statistics = std::make_unique<Statistics>(Statistics::AgcStatsPos::PreWb,
> +       StatisticsPtr statistics = std::make_shared<Statistics>(Statistics::AgcStatsPos::PreWb,
>                                                                 Statistics::ColourStatsPos::PostLsc);
>         const Controller::HardwareConfig &hw = controller_.getHardwareConfig();
>         unsigned int i;
> --
> 2.30.2
>
Kieran Bingham Sept. 4, 2023, 4:58 p.m. UTC | #2
Quoting David Plowman via libcamera-devel (2023-07-28 13:49:07)
> StatisticsPtr is a shared pointer, so the use of std::make_unique to
> create it was a bit confusing. Use std::make_shared instead.
> 
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/ipa/rpi/vc4/vc4.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp
> index 789a345f..3eea40a6 100644
> --- a/src/ipa/rpi/vc4/vc4.cpp
> +++ b/src/ipa/rpi/vc4/vc4.cpp
> @@ -191,7 +191,7 @@ RPiController::StatisticsPtr IpaVc4::platformProcessStats(Span<uint8_t> mem)
>         using namespace RPiController;
>  
>         const bcm2835_isp_stats *stats = reinterpret_cast<bcm2835_isp_stats *>(mem.data());
> -       StatisticsPtr statistics = std::make_unique<Statistics>(Statistics::AgcStatsPos::PreWb,
> +       StatisticsPtr statistics = std::make_shared<Statistics>(Statistics::AgcStatsPos::PreWb,
>                                                                 Statistics::ColourStatsPos::PostLsc);
>         const Controller::HardwareConfig &hw = controller_.getHardwareConfig();
>         unsigned int i;
> -- 
> 2.30.2
>

Patch
diff mbox series

diff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp
index 789a345f..3eea40a6 100644
--- a/src/ipa/rpi/vc4/vc4.cpp
+++ b/src/ipa/rpi/vc4/vc4.cpp
@@ -191,7 +191,7 @@  RPiController::StatisticsPtr IpaVc4::platformProcessStats(Span<uint8_t> mem)
 	using namespace RPiController;
 
 	const bcm2835_isp_stats *stats = reinterpret_cast<bcm2835_isp_stats *>(mem.data());
-	StatisticsPtr statistics = std::make_unique<Statistics>(Statistics::AgcStatsPos::PreWb,
+	StatisticsPtr statistics = std::make_shared<Statistics>(Statistics::AgcStatsPos::PreWb,
 								Statistics::ColourStatsPos::PostLsc);
 	const Controller::HardwareConfig &hw = controller_.getHardwareConfig();
 	unsigned int i;