[libcamera-devel,v5,1/5] ipa: raspberrypi: Store dropped frame count in a member variable
diff mbox series

Message ID 20210419133451.263733-2-naush@raspberrypi.com
State Accepted
Headers show
Series
  • ipa: raspberrypi: Rate-limit the controller algorithms
Related show

Commit Message

Naushir Patuck April 19, 2021, 1:34 p.m. UTC
Store the number of dropped frames on startup in a member variable. This
will be used in a subsequent change for rate limiting the controller
algorithms.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/ipa/raspberrypi/raspberrypi.cpp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Laurent Pinchart April 27, 2021, 7:13 a.m. UTC | #1
Hi Naush,

Thank you for the patch.

On Mon, Apr 19, 2021 at 02:34:47PM +0100, Naushir Patuck wrote:
> Store the number of dropped frames on startup in a member variable. This
> will be used in a subsequent change for rate limiting the controller
> algorithms.

So far so good. Assuming it will be used in a subsequent patch in the
series,

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

> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
> ---
>  src/ipa/raspberrypi/raspberrypi.cpp | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
> index b0f61d351e3a..f6d1ab16a290 100644
> --- a/src/ipa/raspberrypi/raspberrypi.cpp
> +++ b/src/ipa/raspberrypi/raspberrypi.cpp
> @@ -143,6 +143,9 @@ private:
>  	/* How many frames we should avoid running control algos on. */
>  	unsigned int mistrustCount_;
>  
> +	/* Number of frames that need to be dropped on startup. */
> +	unsigned int dropFrameCount_;
> +
>  	/* LS table allocation passed in from the pipeline handler. */
>  	FileDescriptor lsTableHandle_;
>  	void *lsTable_;
> @@ -220,9 +223,8 @@ void IPARPi::start(const ControlList &controls, ipa::RPi::StartConfig *startConf
>  	 */
>  	frameCount_ = 0;
>  	checkCount_ = 0;
> -	unsigned int dropFrame = 0;
>  	if (firstStart_) {
> -		dropFrame = helper_->HideFramesStartup();
> +		dropFrameCount_ = helper_->HideFramesStartup();
>  		mistrustCount_ = helper_->MistrustFramesStartup();
>  
>  		/*
> @@ -250,14 +252,14 @@ void IPARPi::start(const ControlList &controls, ipa::RPi::StartConfig *startConf
>  				awbConvergenceFrames += mistrustCount_;
>  		}
>  
> -		dropFrame = std::max({ dropFrame, agcConvergenceFrames, awbConvergenceFrames });
> -		LOG(IPARPI, Debug) << "Drop " << dropFrame << " frames on startup";
> +		dropFrameCount_ = std::max({ dropFrameCount_, agcConvergenceFrames, awbConvergenceFrames });
> +		LOG(IPARPI, Debug) << "Drop " << dropFrameCount_ << " frames on startup";
>  	} else {
> -		dropFrame = helper_->HideFramesModeSwitch();
> +		dropFrameCount_ = helper_->HideFramesModeSwitch();
>  		mistrustCount_ = helper_->MistrustFramesModeSwitch();
>  	}
>  
> -	startConfig->dropFrameCount = dropFrame;
> +	startConfig->dropFrameCount = dropFrameCount_;
>  
>  	firstStart_ = false;
>  }

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index b0f61d351e3a..f6d1ab16a290 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -143,6 +143,9 @@  private:
 	/* How many frames we should avoid running control algos on. */
 	unsigned int mistrustCount_;
 
+	/* Number of frames that need to be dropped on startup. */
+	unsigned int dropFrameCount_;
+
 	/* LS table allocation passed in from the pipeline handler. */
 	FileDescriptor lsTableHandle_;
 	void *lsTable_;
@@ -220,9 +223,8 @@  void IPARPi::start(const ControlList &controls, ipa::RPi::StartConfig *startConf
 	 */
 	frameCount_ = 0;
 	checkCount_ = 0;
-	unsigned int dropFrame = 0;
 	if (firstStart_) {
-		dropFrame = helper_->HideFramesStartup();
+		dropFrameCount_ = helper_->HideFramesStartup();
 		mistrustCount_ = helper_->MistrustFramesStartup();
 
 		/*
@@ -250,14 +252,14 @@  void IPARPi::start(const ControlList &controls, ipa::RPi::StartConfig *startConf
 				awbConvergenceFrames += mistrustCount_;
 		}
 
-		dropFrame = std::max({ dropFrame, agcConvergenceFrames, awbConvergenceFrames });
-		LOG(IPARPI, Debug) << "Drop " << dropFrame << " frames on startup";
+		dropFrameCount_ = std::max({ dropFrameCount_, agcConvergenceFrames, awbConvergenceFrames });
+		LOG(IPARPI, Debug) << "Drop " << dropFrameCount_ << " frames on startup";
 	} else {
-		dropFrame = helper_->HideFramesModeSwitch();
+		dropFrameCount_ = helper_->HideFramesModeSwitch();
 		mistrustCount_ = helper_->MistrustFramesModeSwitch();
 	}
 
-	startConfig->dropFrameCount = dropFrame;
+	startConfig->dropFrameCount = dropFrameCount_;
 
 	firstStart_ = false;
 }