@@ -94,8 +94,7 @@ void Ccm::prepare(IPAContext &context, const uint32_t frame,
if (frame > 0 &&
utils::abs_diff(ct, lastCt_) < kTemperatureThreshold &&
saturation == lastSaturation_) {
- frameContext.ccm = context.activeState.ccm.ccm;
- context.activeState.ccm.changed = false;
+ frameContext.ccm = context.activeState.ccm;
return;
}
@@ -105,9 +104,9 @@ void Ccm::prepare(IPAContext &context, const uint32_t frame,
if (saturation)
applySaturation(ccm, saturation.value());
- context.activeState.ccm.ccm = ccm;
+ context.activeState.ccm = ccm;
frameContext.saturation = saturation;
- context.activeState.ccm.changed = true;
+ context.activeState.matrixChanged = true;
frameContext.ccm = ccm;
}
@@ -125,11 +125,11 @@ void Lut::prepare(IPAContext &context,
params->green[i] = gammaTable[static_cast<unsigned int>(lutGains.g())];
params->blue[i] = gammaTable[static_cast<unsigned int>(lutGains.b())];
}
- } else if (context.activeState.ccm.changed || gammaUpdateNeeded) {
+ } else if (context.activeState.matrixChanged || gammaUpdateNeeded) {
Matrix<float, 3, 3> gainCcm = { { gains.r(), 0, 0,
0, gains.g(), 0,
0, 0, gains.b() } };
- auto ccm = context.activeState.ccm.ccm * gainCcm;
+ auto ccm = context.activeState.ccm * gainCcm;
auto &red = params->redCcm;
auto &green = params->greenCcm;
auto &blue = params->blueCcm;
@@ -145,6 +145,7 @@ void Lut::prepare(IPAContext &context,
blue[i].b = ccmValue(i, ccm[2][2]);
params->gammaLut[i] = gammaTable[i / div];
}
+ context.activeState.matrixChanged = false;
}
}
@@ -60,10 +60,8 @@ struct IPAActiveState {
double contrast;
} gamma;
- struct {
- Matrix<float, 3, 3> ccm;
- bool changed;
- } ccm;
+ Matrix<float, 3, 3> ccm;
+ bool matrixChanged = false;
struct {
/* 0..2 range, 1.0 = normal */
IPAActiveState::ccm stores the colour correction matrix (CCM) and whether it has been changed. The change flag is later used when recomputing or not the lookup tables. But the CCM may include other corrections than just the sensor colour correction, for example white balance and saturation adjustments. These things should be separated and IPAActiveState::ccm should represent just the CCM itself. As the first step towards that cleanup, let's separate the change flag from the CCM. And wrap the only remaining member of IPAActiveState::ccm. Also, let's reset the separated change flag in the lookup tables; it'll be no longer tied to just CCM handling. This patch doesn't change actual behaviour and it still reports the combined matrix as CCM in metadata. This is addressed in the followup patches. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> --- src/ipa/simple/algorithms/ccm.cpp | 7 +++---- src/ipa/simple/algorithms/lut.cpp | 5 +++-- src/ipa/simple/ipa_context.h | 6 ++---- 3 files changed, 8 insertions(+), 10 deletions(-)