| Message ID | 20251112082715.17823-5-mzamazal@redhat.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
Quoting Milan Zamazal (2025-11-12 08:27:12) > Let's rename the identifiers that are related to general colour > corrections applied by matrix operations, rather than directly to the > sensor colour correction matrix. This seems reasonable. But now I'm trying to think about what the terms are defined as. src/libcamera/control_ids_core.yaml: - ColourCorrectionMatrix: type: float direction: inout description: | The 3x3 matrix that converts camera RGB to sRGB within the imaging pipeline. This should describe the matrix that is used after pixels have been white-balanced, but before any gamma transformation. The 3x3 matrix is stored in conventional reading order in an array of 9 floating point values. ColourCorrectionMatrix can only be applied in a Request when the AWB is disabled. \sa AwbEnable \sa ColourTemperature size: [3,3] Are we reporting/referencing this correctly? > Signed-off-by: Milan Zamazal <mzamazal@redhat.com> > --- > src/ipa/simple/algorithms/lut.cpp | 28 ++++++++++++++-------------- > src/ipa/simple/algorithms/lut.h | 2 +- > 2 files changed, 15 insertions(+), 15 deletions(-) > > diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp > index dead55f34..b27491042 100644 > --- a/src/ipa/simple/algorithms/lut.cpp > +++ b/src/ipa/simple/algorithms/lut.cpp > @@ -80,7 +80,7 @@ void Lut::updateGammaTable(IPAContext &context) > context.activeState.gamma.contrast = contrast; > } > > -int16_t Lut::ccmValue(unsigned int i, float ccm) const > +int16_t Lut::matrixValue(unsigned int i, float ccm) const > { > return std::round(i * ccm); > } > @@ -120,23 +120,23 @@ void Lut::prepare(IPAContext &context, > } > > } 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 * gainCcm; > + Matrix<float, 3, 3> gainMatrix = { { gains.r(), 0, 0, > + 0, gains.g(), 0, > + 0, 0, gains.b() } }; > + auto matrix = context.activeState.ccm * gainMatrix; > auto &red = params->redCcm; > auto &green = params->greenCcm; > auto &blue = params->blueCcm; > for (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) { > - red[i].r = ccmValue(i, ccm[0][0]); > - red[i].g = ccmValue(i, ccm[1][0]); > - red[i].b = ccmValue(i, ccm[2][0]); > - green[i].r = ccmValue(i, ccm[0][1]); > - green[i].g = ccmValue(i, ccm[1][1]); > - green[i].b = ccmValue(i, ccm[2][1]); > - blue[i].r = ccmValue(i, ccm[0][2]); > - blue[i].g = ccmValue(i, ccm[1][2]); > - blue[i].b = ccmValue(i, ccm[2][2]); > + red[i].r = matrixValue(i, matrix[0][0]); > + red[i].g = matrixValue(i, matrix[1][0]); > + red[i].b = matrixValue(i, matrix[2][0]); > + green[i].r = matrixValue(i, matrix[0][1]); > + green[i].g = matrixValue(i, matrix[1][1]); > + green[i].b = matrixValue(i, matrix[2][1]); > + blue[i].r = matrixValue(i, matrix[0][2]); > + blue[i].g = matrixValue(i, matrix[1][2]); > + blue[i].b = matrixValue(i, matrix[2][2]); > params->gammaLut[i] = gammaTable[i / div]; > } > context.activeState.matrixChanged = false; > diff --git a/src/ipa/simple/algorithms/lut.h b/src/ipa/simple/algorithms/lut.h > index ba8b9021b..0eafd0695 100644 > --- a/src/ipa/simple/algorithms/lut.h > +++ b/src/ipa/simple/algorithms/lut.h > @@ -38,7 +38,7 @@ public: > > private: > void updateGammaTable(IPAContext &context); > - int16_t ccmValue(unsigned int i, float ccm) const; > + int16_t matrixValue(unsigned int i, float ccm) const; > }; > > } /* namespace ipa::soft::algorithms */ > -- > 2.51.1 >
diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp index dead55f34..b27491042 100644 --- a/src/ipa/simple/algorithms/lut.cpp +++ b/src/ipa/simple/algorithms/lut.cpp @@ -80,7 +80,7 @@ void Lut::updateGammaTable(IPAContext &context) context.activeState.gamma.contrast = contrast; } -int16_t Lut::ccmValue(unsigned int i, float ccm) const +int16_t Lut::matrixValue(unsigned int i, float ccm) const { return std::round(i * ccm); } @@ -120,23 +120,23 @@ void Lut::prepare(IPAContext &context, } } 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 * gainCcm; + Matrix<float, 3, 3> gainMatrix = { { gains.r(), 0, 0, + 0, gains.g(), 0, + 0, 0, gains.b() } }; + auto matrix = context.activeState.ccm * gainMatrix; auto &red = params->redCcm; auto &green = params->greenCcm; auto &blue = params->blueCcm; for (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) { - red[i].r = ccmValue(i, ccm[0][0]); - red[i].g = ccmValue(i, ccm[1][0]); - red[i].b = ccmValue(i, ccm[2][0]); - green[i].r = ccmValue(i, ccm[0][1]); - green[i].g = ccmValue(i, ccm[1][1]); - green[i].b = ccmValue(i, ccm[2][1]); - blue[i].r = ccmValue(i, ccm[0][2]); - blue[i].g = ccmValue(i, ccm[1][2]); - blue[i].b = ccmValue(i, ccm[2][2]); + red[i].r = matrixValue(i, matrix[0][0]); + red[i].g = matrixValue(i, matrix[1][0]); + red[i].b = matrixValue(i, matrix[2][0]); + green[i].r = matrixValue(i, matrix[0][1]); + green[i].g = matrixValue(i, matrix[1][1]); + green[i].b = matrixValue(i, matrix[2][1]); + blue[i].r = matrixValue(i, matrix[0][2]); + blue[i].g = matrixValue(i, matrix[1][2]); + blue[i].b = matrixValue(i, matrix[2][2]); params->gammaLut[i] = gammaTable[i / div]; } context.activeState.matrixChanged = false; diff --git a/src/ipa/simple/algorithms/lut.h b/src/ipa/simple/algorithms/lut.h index ba8b9021b..0eafd0695 100644 --- a/src/ipa/simple/algorithms/lut.h +++ b/src/ipa/simple/algorithms/lut.h @@ -38,7 +38,7 @@ public: private: void updateGammaTable(IPAContext &context); - int16_t ccmValue(unsigned int i, float ccm) const; + int16_t matrixValue(unsigned int i, float ccm) const; }; } /* namespace ipa::soft::algorithms */
Let's rename the identifiers that are related to general colour corrections applied by matrix operations, rather than directly to the sensor colour correction matrix. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> --- src/ipa/simple/algorithms/lut.cpp | 28 ++++++++++++++-------------- src/ipa/simple/algorithms/lut.h | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-)