camera: intel: ipu6: Report previous CCM during AWB lock
1. Report previous CCM during AWB lock
2. Dump metadata tag and value in one line
3. Add ipu v6 version support
BUG=b:237362274
TEST=Full tested pass for camera functions.
Cq-Depend: chrome-internal:4790353, chrome-internal:4793661
Change-Id: I6d121027140241b143d158c18c36dabdfc31a8f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/camera/+/3778946
Auto-Submit: Cheng Yueh <cyueh@chromium.org>
Commit-Queue: Cheng Yueh <cyueh@chromium.org>
Reviewed-by: Phoebe Wang <phoebewang@chromium.org>
Tested-by: Cheng Yueh <cyueh@chromium.org>
diff --git a/hal/intel/ipu6/aal/MetadataConvert.cpp b/hal/intel/ipu6/aal/MetadataConvert.cpp
index 5f005c9..0fd78ba 100644
--- a/hal/intel/ipu6/aal/MetadataConvert.cpp
+++ b/hal/intel/ipu6/aal/MetadataConvert.cpp
@@ -711,8 +711,7 @@
if (parameter.getColorTransform(transform) == 0) {
camera_metadata_rational_t matrix[9];
for (int i = 0; i < 9; i++) {
- // accuracy 0.01
- matrix[i].numerator = floor(transform.color_transform[i / 3][i % 3] * 100) * 10;
+ matrix[i].numerator = round(transform.color_transform[i / 3][i % 3] * 1000);
matrix[i].denominator = 1000;
}
settings->update(ANDROID_COLOR_CORRECTION_TRANSFORM, &matrix[0], 9);
@@ -2355,8 +2354,6 @@
} else {
typeName = camera_metadata_type_names[entry.type];
}
- LOG3("(%d)%s.%s (%05x): %s[%zu], type: %d", i, tagSection, tagName, entry.tag, typeName,
- entry.count, entry.type);
// Print data
size_t j;
@@ -2367,7 +2364,8 @@
const double* d;
const camera_metadata_rational_t* r;
std::ostringstream stringStream;
- stringStream << "[";
+ stringStream << "(" << i << ")" << tagSection << "." << tagName;
+ stringStream << ": " << typeName << "(" << entry.count << "), [";
switch (entry.type) {
case TYPE_BYTE:
diff --git a/hal/intel/ipu6/src/core/psysprocessor/PGUtils.cpp b/hal/intel/ipu6/src/core/psysprocessor/PGUtils.cpp
index bbd5537..ef81e2a 100644
--- a/hal/intel/ipu6/src/core/psysprocessor/PGUtils.cpp
+++ b/hal/intel/ipu6/src/core/psysprocessor/PGUtils.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019-2021 Intel Corporation.
+ * Copyright (C) 2019-2022 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -250,7 +250,7 @@
#define PG_BB_TERMINAL_ID_TNR_SIM_REF_OUT 7 // spetial_terminal
// the below terminals belong to PG_PSYS_IPU6_ISA_LB
-#ifdef IPU_SYSVER_ipu6v5
+#if defined(IPU_SYSVER_ipu6v5) || defined(IPU_SYSVER_ipu6v6)
#define ISA_LB_TERMINAL_ID_DVS_FE_IN_L0 20 // program_terminal
#define ISA_LB_TERMINAL_ID_DVS_FE_IN_L1 21 // program_terminal
#define ISA_LB_TERMINAL_ID_DVS_FE_IN_L2 22 // program_terminal
diff --git a/hal/intel/ipu6/src/metadata/ParameterGenerator.cpp b/hal/intel/ipu6/src/metadata/ParameterGenerator.cpp
index 3bee132..052736a 100644
--- a/hal/intel/ipu6/src/metadata/ParameterGenerator.cpp
+++ b/hal/intel/ipu6/src/metadata/ParameterGenerator.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2021 Intel Corporation.
+ * Copyright (C) 2015-2022 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,6 +74,7 @@
LOG1("<id%d>%s", mCameraId, __func__);
AutoMutex l(mParamsLock);
mRequestParamMap.clear();
+ CLEAR(mPaCcm);
return OK;
}
@@ -256,11 +257,7 @@
// Update AWB related parameters
updateAwbGainsL(params, aiqResult->mAwbResults);
- camera_color_transform_t ccm;
- MEMCPY_S(ccm.color_transform, sizeof(ccm.color_transform),
- aiqResult->mPaResults.color_conversion_matrix,
- sizeof(aiqResult->mPaResults.color_conversion_matrix));
- params->setColorTransform(ccm);
+ updateCcmL(params, aiqResult);
camera_color_gains_t colorGains;
colorGains.color_gains_rggb[0] = aiqResult->mPaResults.color_gains.r;
@@ -351,6 +348,34 @@
return OK;
}
+int ParameterGenerator::updateCcmL(Parameters* params, const AiqResult* aiqResult) {
+ // CCM has tiny changes (delta ~0.0002) during AWB lock.
+ // Report previous values if delta can be ignored to meet CTS requirement.
+ bool valueConsistent = false;
+ if (aiqResult->mAiqParam.awbForceLock) {
+ valueConsistent = true;
+ for (int i = 0; i < 3 && valueConsistent; i++) {
+ for (int j = 0; j < 3; j++) {
+ float delta = mPaCcm.color_transform[i][j] -
+ aiqResult->mPaResults.color_conversion_matrix[i][j];
+ if (fabs(delta) > 0.001) {
+ valueConsistent = false;
+ LOG2("<seq%ld>ccm changed during awb force lock", aiqResult->mSequence);
+ break;
+ }
+ }
+ }
+ }
+
+ if (!valueConsistent) {
+ MEMCPY_S(mPaCcm.color_transform, sizeof(mPaCcm.color_transform),
+ aiqResult->mPaResults.color_conversion_matrix,
+ sizeof(aiqResult->mPaResults.color_conversion_matrix));
+ }
+ params->setColorTransform(mPaCcm);
+ return OK;
+}
+
int ParameterGenerator::updateTonemapCurve(int64_t sequence, Parameters* params) {
if (!mTonemapMaxCurvePoints) return OK;
diff --git a/hal/intel/ipu6/src/metadata/ParameterGenerator.h b/hal/intel/ipu6/src/metadata/ParameterGenerator.h
index c0c56d8..bdb2c36 100644
--- a/hal/intel/ipu6/src/metadata/ParameterGenerator.h
+++ b/hal/intel/ipu6/src/metadata/ParameterGenerator.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2021 Intel Corporation.
+ * Copyright (C) 2015-2022 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,6 +66,7 @@
int generateParametersL(int64_t sequence, Parameters* params);
int updateWithAiqResultsL(int64_t sequence, Parameters* params);
int updateAwbGainsL(Parameters* params, const cca::cca_awb_results& result);
+ int updateCcmL(Parameters* params, const AiqResult* aiqResult);
int updateTonemapCurve(int64_t sequence, Parameters* params);
int updateCommonMetadata(Parameters* params, const AiqResult* aiqResult);
@@ -99,6 +100,8 @@
std::unique_ptr<float[]> mTonemapCurveBlue;
std::unique_ptr<float[]> mTonemapCurveGreen;
int32_t mTonemapMaxCurvePoints;
+
+ camera_color_transform_t mPaCcm;
};
} /* namespace icamera */