[libcamera-devel] [PATCH 08/10] libcamera: src: ipa: raspberrypi: agc: Fix uninitialised members in status_

Naushir Patuck naush at raspberrypi.com
Tue Nov 17 11:58:45 CET 2020


Hi David,

On Mon, 16 Nov 2020 at 16:49, David Plowman <david.plowman at raspberrypi.com>
wrote:

> Use memset in the constructor, it is tidier and initialises
> everything.
>
> Signed-off-by: David Plowman <david.plowman at raspberrypi.com>
> ---
>  src/ipa/raspberrypi/controller/rpi/agc.cpp | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp
> b/src/ipa/raspberrypi/controller/rpi/agc.cpp
> index 7c7944e8..1037f968 100644
> --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp
> +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp
> @@ -157,14 +157,13 @@ Agc::Agc(Controller *controller)
>           exposure_mode_(nullptr), constraint_mode_(nullptr),
>           frame_count_(0), lock_count_(0)
>  {
> +       // Setting status_.total_exposure_value_ to zero initially tells us
> +       // it's not been calculated yet (i.e. Process hasn't yet run).
> +       memset(&status_, 0, sizeof(status_));
>         ev_ = status_.ev = 1.0;
> -       flicker_period_ = status_.flicker_period = 0.0;
> -       fixed_shutter_ = status_.fixed_shutter = 0;
> -       fixed_analogue_gain_ = status_.fixed_analogue_gain = 0.0;
> -       // set to zero initially, so we can tell it's not been calculated
> -       status_.total_exposure_value = 0.0;
> -       status_.target_exposure_value = 0.0;
> -       status_.locked = false;
> +       flicker_period_ = 0.0;
> +       fixed_shutter_ = 0;
> +       fixed_analogue_gain_ = 0.0;
>

Minor nit, but could these be initialised by the constructor's initialiser
list?  Apart from that:

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


>  }
>
>  char const *Agc::Name() const
> --
> 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/20201117/294a7254/attachment.htm>


More information about the libcamera-devel mailing list