From 427f4b7f0dc6fc1d8cf263568a270d65c484acf3 Mon Sep 17 00:00:00 2001 From: Han-Lin Chen Date: Thu, 14 Oct 2021 15:05:32 +0800 Subject: ipu3: Change Macro migrated from Chrome OS to its std version accordingly Change the Macro STDCOPY, MEMCPY_S and CLEAR to its std version to better suit the style. The patch also fix misusage of STDCOPY as memcpy, which leads to copying overflown in PA and SA results. Signed-off-by: Han-Lin Chen Reviewed-by: Umang Jain Reviewed-by: Kieran Bingham Signed-off-by: Kieran Bingham --- aiq/aiq_input_parameters.cpp | 50 +++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 29 deletions(-) (limited to 'aiq/aiq_input_parameters.cpp') diff --git a/aiq/aiq_input_parameters.cpp b/aiq/aiq_input_parameters.cpp index 56301f6..8a53849 100644 --- a/aiq/aiq_input_parameters.cpp +++ b/aiq/aiq_input_parameters.cpp @@ -14,11 +14,6 @@ #include -/* Macros used by imported code */ -#define STDCOPY(dst, src, size) std::copy((src), ((src) + (size)), (dst)) -#define MEMCPY_S(dest, dmax, src, smax) memcpy((dest), (src), std::min((size_t)(dmax), (size_t)(smax))) -#define CLEAR(x) memset(&(x), 0, sizeof(x)) - namespace libcamera { LOG_DEFINE_CATEGORY(AIQInputParameters) @@ -27,26 +22,26 @@ namespace ipa::ipu3::aiq { void AiqInputParameters::init() { - CLEAR(aeInputParams); - CLEAR(afParams); - CLEAR(afBracketParams); - CLEAR(awbParams); - CLEAR(gbceParams); - CLEAR(paParams); - CLEAR(saParams); - CLEAR(sensorDescriptor); - CLEAR(exposureWindow); - CLEAR(exposureCoordinate); - CLEAR(aeFeatures); - CLEAR(aeManualLimits); - CLEAR(manualFocusParams); - CLEAR(focusRect); - CLEAR(manualCctRange); - CLEAR(manualWhiteCoordinate); - CLEAR(awbResults); - CLEAR(colorGains); - CLEAR(exposureParams); - CLEAR(sensorFrameParams); + aeInputParams = {}; + afParams = {}; + afBracketParams = {}; + awbParams = {}; + gbceParams = {}; + paParams = {}; + saParams = {}; + sensorDescriptor = {}; + exposureWindow = {}; + exposureCoordinate = {}; + aeFeatures = {}; + aeManualLimits = {}; + manualFocusParams = {}; + focusRect = {}; + manualCctRange = {}; + manualWhiteCoordinate = {}; + awbResults = {}; + colorGains = {}; + exposureParams = {}; + sensorFrameParams = {}; aeLock = false; awbLock = false; blackLevelLock = false; @@ -102,10 +97,7 @@ AiqInputParameters &AiqInputParameters::operator=(const AiqInputParameters &othe if (this == &other) return *this; - MEMCPY_S(this, - sizeof(AiqInputParameters), - &other, - sizeof(AiqInputParameters)); + memcpy(this, &other, sizeof(AiqInputParameters)); reset(); /* Exposure coordinate is nullptr in other than SPOT mode. */ -- cgit v1.2.1