[libcamera-devel,v2,04/10] ipa: raspberrypi: Remove initialized_ field from CamHelper
diff mbox series

Message ID 20221006131744.5179-5-naush@raspberrypi.com
State Accepted
Headers show
Series
  • Raspberry Pi: Horizontal blanking control
Related show

Commit Message

Naushir Patuck Oct. 6, 2022, 1:17 p.m. UTC
Given that the single user of the CamHelper is the Raspberry Pi IPA, the
initialized_ field check is unnecessary. Remove the check and the field.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 src/ipa/raspberrypi/cam_helper.cpp | 9 +--------
 src/ipa/raspberrypi/cam_helper.h   | 1 -
 2 files changed, 1 insertion(+), 9 deletions(-)

Comments

Laurent Pinchart Oct. 7, 2022, 10:36 p.m. UTC | #1
Hi Naush,

Thank you for the patch.

On Thu, Oct 06, 2022 at 02:17:38PM +0100, Naushir Patuck via libcamera-devel wrote:
> Given that the single user of the CamHelper is the Raspberry Pi IPA, the
> initialized_ field check is unnecessary. Remove the check and the field.
> 
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/ipa/raspberrypi/cam_helper.cpp | 9 +--------
>  src/ipa/raspberrypi/cam_helper.h   | 1 -
>  2 files changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp
> index fd3527b94501..45214531626e 100644
> --- a/src/ipa/raspberrypi/cam_helper.cpp
> +++ b/src/ipa/raspberrypi/cam_helper.cpp
> @@ -7,7 +7,6 @@
>  
>  #include <linux/videodev2.h>
>  
> -#include <assert.h>
>  #include <map>
>  #include <string.h>
>  
> @@ -41,8 +40,7 @@ CamHelper *CamHelper::create(std::string const &camName)
>  }
>  
>  CamHelper::CamHelper(std::unique_ptr<MdParser> parser, unsigned int frameIntegrationDiff)
> -	: parser_(std::move(parser)), initialized_(false),
> -	  frameIntegrationDiff_(frameIntegrationDiff)
> +	: parser_(std::move(parser)), frameIntegrationDiff_(frameIntegrationDiff)
>  {
>  }
>  
> @@ -63,13 +61,11 @@ void CamHelper::process([[maybe_unused]] StatisticsPtr &stats,
>  
>  uint32_t CamHelper::exposureLines(const Duration exposure, const Duration lineLength) const
>  {
> -	assert(initialized_);
>  	return exposure / lineLength;
>  }
>  
>  Duration CamHelper::exposure(uint32_t exposureLines, const Duration lineLength) const
>  {
> -	assert(initialized_);
>  	return exposureLines * lineLength;
>  }
>  
> @@ -80,8 +76,6 @@ uint32_t CamHelper::getVBlanking(Duration &exposure,
>  	uint32_t frameLengthMin, frameLengthMax, vblank;
>  	uint32_t exposureLines = CamHelper::exposureLines(exposure, mode_.minLineLength);
>  
> -	assert(initialized_);
> -
>  	/*
>  	 * minFrameDuration and maxFrameDuration are clamped by the caller
>  	 * based on the limits for the active sensor mode.
> @@ -110,7 +104,6 @@ void CamHelper::setCameraMode(const CameraMode &mode)
>  		parser_->setBitsPerPixel(mode.bitdepth);
>  		parser_->setLineLengthBytes(0); /* We use SetBufferSize. */
>  	}
> -	initialized_ = true;
>  }
>  
>  void CamHelper::getDelays(int &exposureDelay, int &gainDelay,
> diff --git a/src/ipa/raspberrypi/cam_helper.h b/src/ipa/raspberrypi/cam_helper.h
> index 9b5e602689f3..6771829a56da 100644
> --- a/src/ipa/raspberrypi/cam_helper.h
> +++ b/src/ipa/raspberrypi/cam_helper.h
> @@ -106,7 +106,6 @@ protected:
>  	CameraMode mode_;
>  
>  private:
> -	bool initialized_;
>  	/*
>  	 * Smallest difference between the frame length and integration time,
>  	 * in units of lines.

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp
index fd3527b94501..45214531626e 100644
--- a/src/ipa/raspberrypi/cam_helper.cpp
+++ b/src/ipa/raspberrypi/cam_helper.cpp
@@ -7,7 +7,6 @@ 
 
 #include <linux/videodev2.h>
 
-#include <assert.h>
 #include <map>
 #include <string.h>
 
@@ -41,8 +40,7 @@  CamHelper *CamHelper::create(std::string const &camName)
 }
 
 CamHelper::CamHelper(std::unique_ptr<MdParser> parser, unsigned int frameIntegrationDiff)
-	: parser_(std::move(parser)), initialized_(false),
-	  frameIntegrationDiff_(frameIntegrationDiff)
+	: parser_(std::move(parser)), frameIntegrationDiff_(frameIntegrationDiff)
 {
 }
 
@@ -63,13 +61,11 @@  void CamHelper::process([[maybe_unused]] StatisticsPtr &stats,
 
 uint32_t CamHelper::exposureLines(const Duration exposure, const Duration lineLength) const
 {
-	assert(initialized_);
 	return exposure / lineLength;
 }
 
 Duration CamHelper::exposure(uint32_t exposureLines, const Duration lineLength) const
 {
-	assert(initialized_);
 	return exposureLines * lineLength;
 }
 
@@ -80,8 +76,6 @@  uint32_t CamHelper::getVBlanking(Duration &exposure,
 	uint32_t frameLengthMin, frameLengthMax, vblank;
 	uint32_t exposureLines = CamHelper::exposureLines(exposure, mode_.minLineLength);
 
-	assert(initialized_);
-
 	/*
 	 * minFrameDuration and maxFrameDuration are clamped by the caller
 	 * based on the limits for the active sensor mode.
@@ -110,7 +104,6 @@  void CamHelper::setCameraMode(const CameraMode &mode)
 		parser_->setBitsPerPixel(mode.bitdepth);
 		parser_->setLineLengthBytes(0); /* We use SetBufferSize. */
 	}
-	initialized_ = true;
 }
 
 void CamHelper::getDelays(int &exposureDelay, int &gainDelay,
diff --git a/src/ipa/raspberrypi/cam_helper.h b/src/ipa/raspberrypi/cam_helper.h
index 9b5e602689f3..6771829a56da 100644
--- a/src/ipa/raspberrypi/cam_helper.h
+++ b/src/ipa/raspberrypi/cam_helper.h
@@ -106,7 +106,6 @@  protected:
 	CameraMode mode_;
 
 private:
-	bool initialized_;
 	/*
 	 * Smallest difference between the frame length and integration time,
 	 * in units of lines.