From 971c4904ff91e3525fb807567fdb4408b15df00e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 16 Feb 2024 20:54:37 +0200 Subject: ipa: rkisp1: agc: Wrap variable length C arrays in spans The RkISP1 statistics structure contains multiple arrays whose length varies depending on the hardware revision. Accessing those arrays is error-prone, wrap them in spans at the top level to reduce risks of out-of-bound accesses. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Stefan Klug --- src/ipa/rkisp1/algorithms/agc.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/ipa/rkisp1/algorithms/agc.h') diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h index 8a222637..ce8594f3 100644 --- a/src/ipa/rkisp1/algorithms/agc.h +++ b/src/ipa/rkisp1/algorithms/agc.h @@ -9,6 +9,7 @@ #include +#include #include #include @@ -42,8 +43,8 @@ private: void computeExposure(IPAContext &Context, IPAFrameContext &frameContext, double yGain, double iqMeanGain); utils::Duration filterExposure(utils::Duration exposureValue); - double estimateLuminance(const rkisp1_cif_isp_ae_stat *ae, double gain); - double measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const; + double estimateLuminance(Span expMeans, double gain); + double measureBrightness(Span hist) const; void fillMetadata(IPAContext &context, IPAFrameContext &frameContext, ControlList &metadata); -- cgit v1.2.1