[libcamera-devel] [PATCH 4/5] src: ipa: raspberrypi: Move initial frame drop decision to AGC

Naushir Patuck naush at raspberrypi.com
Fri Dec 4 17:01:42 CET 2020


Hi David,

Thank you for your patch.

On Wed, 2 Dec 2020 at 11:53, David Plowman <david.plowman at raspberrypi.com>
wrote:

> Previously the CamHelper was returning the number of frames to drop
> (on account of AGC converging). This wasn't really appropriate, it's
> better for the AGC to do it, which now also knows when exposure and
> gain have been explicitly set and therefore fewer (or no) frame drops
> are necessary at all.
>
> The CamHelper::HideFramesStartup method should now just be returning
> the number of frames to hide because they're bad/invalid in some way,
> not worrying about the AGC. For many sensors, the correct value for
> this is zero.
>
> Signed-off-by: David Plowman <david.plowman at raspberrypi.com>
> ---
>  src/ipa/raspberrypi/cam_helper.cpp  | 6 +++---
>  src/ipa/raspberrypi/raspberrypi.cpp | 8 ++++++++
>  2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/src/ipa/raspberrypi/cam_helper.cpp
> b/src/ipa/raspberrypi/cam_helper.cpp
> index c8ac3232..6efa0d7f 100644
> --- a/src/ipa/raspberrypi/cam_helper.cpp
> +++ b/src/ipa/raspberrypi/cam_helper.cpp
> @@ -82,10 +82,10 @@ bool CamHelper::SensorEmbeddedDataPresent() const
>  unsigned int CamHelper::HideFramesStartup() const
>  {
>         /*
> -        * By default, hide 6 frames completely at start-up while AGC etc.
> sort
> -        * themselves out (converge).
> +        * The number of frames when a camera first starts that shouldn't
> be
> +        * displayed as they are invalid in some way.
>          */
> -       return 6;
> +       return 0;
>  }
>
>  unsigned int CamHelper::HideFramesModeSwitch() const
> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp
> b/src/ipa/raspberrypi/raspberrypi.cpp
> index 0300b8d9..ddabdb31 100644
> --- a/src/ipa/raspberrypi/raspberrypi.cpp
> +++ b/src/ipa/raspberrypi/raspberrypi.cpp
> @@ -192,6 +192,14 @@ int IPARPi::start(const IPAOperationData &ipaConfig,
> IPAOperationData *result)
>         unsigned int dropFrame = 0;
>         if (firstStart_) {
>                 dropFrame = helper_->HideFramesStartup();
> +
> +               /* The AGC algorithm may want us to drop more frames. */
> +               RPiController::AgcAlgorithm *agc =
> dynamic_cast<RPiController::AgcAlgorithm *>(
> +                       controller_.GetAlgorithm("agc"));
> +               if (agc)
> +                       dropFrame = std::max(dropFrame,
> agc->GetDropFrames());
> +               LOG(IPARPI, Debug) << "Drop " << dropFrame << " frames on
> startup";
> +
>

All looks good with this change, however, I have a possibly silly
question.  In the previous code, our startup frames would account for
convergence in AGC, AWB, and ALS.  Here we are explicitly accounting for
convergence only in AGC since helper_->HideFramesStartup()  will return 0
by default.  Does it matter? Should each derived CamHelper return a
non-zero number here?

Regards,
Naush



>                 mistrustCount_ = helper_->MistrustFramesStartup();
>         } else {
>                 dropFrame = helper_->HideFramesModeSwitch();
> --
> 2.20.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20201204/860d80ea/attachment.htm>


More information about the libcamera-devel mailing list