| Message ID | 20260122161935.208562-11-mzamazal@redhat.com |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
Reviewed-by: Robert Mader <robert.mader@collabora.com> On 22.01.26 17:19, Milan Zamazal wrote: > Now, when we have a combined matrix, we can apply AWB gains to it > directly in awb.cpp. > > Signed-off-by: Milan Zamazal <mzamazal@redhat.com> > --- > src/ipa/simple/algorithms/awb.cpp | 7 ++++++- > src/ipa/simple/algorithms/lut.cpp | 5 +---- > 2 files changed, 7 insertions(+), 5 deletions(-) > > diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp > index a391359fb..4d2f1df15 100644 > --- a/src/ipa/simple/algorithms/awb.cpp > +++ b/src/ipa/simple/algorithms/awb.cpp > @@ -1,6 +1,6 @@ > /* SPDX-License-Identifier: LGPL-2.1-or-later */ > /* > - * Copyright (C) 2024, Red Hat Inc. > + * Copyright (C) 2024-2025 Red Hat Inc. > * > * Auto white balance > */ > @@ -40,6 +40,11 @@ void Awb::prepare(IPAContext &context, > [[maybe_unused]] DebayerParams *params) > { > auto &gains = context.activeState.awb.gains; > + Matrix<float, 3, 3> gainMatrix = { { gains.r(), 0, 0, > + 0, gains.g(), 0, > + 0, 0, gains.b() } }; > + context.activeState.combinedMatrix = > + context.activeState.combinedMatrix * gainMatrix; > /* Just report, the gains are applied in LUT algorithm. */ > frameContext.gains.red = gains.r(); > frameContext.gains.blue = gains.b(); > diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp > index 9740f8c8d..d8e92c613 100644 > --- a/src/ipa/simple/algorithms/lut.cpp > +++ b/src/ipa/simple/algorithms/lut.cpp > @@ -107,10 +107,7 @@ void Lut::prepare(IPAContext &context, > params->blue[i] = gammaTable[static_cast<unsigned int>(lutGains.b())]; > } > } else if (context.activeState.matrixChanged || gammaUpdateNeeded) { > - Matrix<float, 3, 3> gainMatrix = { { gains.r(), 0, 0, > - 0, gains.g(), 0, > - 0, 0, gains.b() } }; > - auto matrix = context.activeState.combinedMatrix * gainMatrix; > + auto &matrix = context.activeState.combinedMatrix; > auto &red = params->redCcm; > auto &green = params->greenCcm; > auto &blue = params->blueCcm;
diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp index a391359fb..4d2f1df15 100644 --- a/src/ipa/simple/algorithms/awb.cpp +++ b/src/ipa/simple/algorithms/awb.cpp @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ /* - * Copyright (C) 2024, Red Hat Inc. + * Copyright (C) 2024-2025 Red Hat Inc. * * Auto white balance */ @@ -40,6 +40,11 @@ void Awb::prepare(IPAContext &context, [[maybe_unused]] DebayerParams *params) { auto &gains = context.activeState.awb.gains; + Matrix<float, 3, 3> gainMatrix = { { gains.r(), 0, 0, + 0, gains.g(), 0, + 0, 0, gains.b() } }; + context.activeState.combinedMatrix = + context.activeState.combinedMatrix * gainMatrix; /* Just report, the gains are applied in LUT algorithm. */ frameContext.gains.red = gains.r(); frameContext.gains.blue = gains.b(); diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp index 9740f8c8d..d8e92c613 100644 --- a/src/ipa/simple/algorithms/lut.cpp +++ b/src/ipa/simple/algorithms/lut.cpp @@ -107,10 +107,7 @@ void Lut::prepare(IPAContext &context, params->blue[i] = gammaTable[static_cast<unsigned int>(lutGains.b())]; } } else if (context.activeState.matrixChanged || gammaUpdateNeeded) { - Matrix<float, 3, 3> gainMatrix = { { gains.r(), 0, 0, - 0, gains.g(), 0, - 0, 0, gains.b() } }; - auto matrix = context.activeState.combinedMatrix * gainMatrix; + auto &matrix = context.activeState.combinedMatrix; auto &red = params->redCcm; auto &green = params->greenCcm; auto &blue = params->blueCcm;
Now, when we have a combined matrix, we can apply AWB gains to it directly in awb.cpp. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> --- src/ipa/simple/algorithms/awb.cpp | 7 ++++++- src/ipa/simple/algorithms/lut.cpp | 5 +---- 2 files changed, 7 insertions(+), 5 deletions(-)