[PATCH v3 14/16] ipa: rkisp1: Damp color temperature regulation
Paul Elder
paul.elder at ideasonboard.com
Wed May 7 19:30:06 CEST 2025
On Thu, Apr 03, 2025 at 05:49:19PM +0200, Stefan Klug wrote:
> Damp the regulation of the color temperature with the same factor as the
> gains. Not damping the color temperature leads to visible flicker, as
> the CCM changes too much.
>
> Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
>
> ---
>
> Changes in v2:
> - Collected tags
>
> Changes in v3:
> - Dropped incorrect call to estimateCCT()
> ---
> src/ipa/rkisp1/algorithms/awb.cpp | 5 +++--
> src/ipa/rkisp1/algorithms/ccm.cpp | 4 ----
> 2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
> index f5415a0bb99d..47b29725af51 100644
> --- a/src/ipa/rkisp1/algorithms/awb.cpp
> +++ b/src/ipa/rkisp1/algorithms/awb.cpp
> @@ -317,8 +317,6 @@ void Awb::process(IPAContext &context,
> RkISP1AwbStats awbStats{ rgbMeans };
> AwbResult awbResult = awbAlgo_->calculateAwb(awbStats, frameContext.lux.lux);
>
> - activeState.awb.automatic.temperatureK = awbResult.colourTemperature;
> -
> /*
> * Clamp the gain values to the hardware, which expresses gains as Q2.8
> * unsigned integer values. Set the minimum just above zero to avoid
> @@ -329,9 +327,12 @@ void Awb::process(IPAContext &context,
>
> /* Filter the values to avoid oscillations. */
> double speed = 0.2;
> + double ct = awbResult.colourTemperature;
> + ct = ct * speed + activeState.awb.automatic.temperatureK * (1 - speed);
> awbResult.gains = awbResult.gains * speed +
> activeState.awb.automatic.gains * (1 - speed);
>
> + activeState.awb.automatic.temperatureK = static_cast<unsigned int>(ct);
> activeState.awb.automatic.gains = awbResult.gains;
>
> LOG(RkISP1Awb, Debug)
> diff --git a/src/ipa/rkisp1/algorithms/ccm.cpp b/src/ipa/rkisp1/algorithms/ccm.cpp
> index 3a96a5427bc6..de2b6fe775aa 100644
> --- a/src/ipa/rkisp1/algorithms/ccm.cpp
> +++ b/src/ipa/rkisp1/algorithms/ccm.cpp
> @@ -142,10 +142,6 @@ void Ccm::prepare(IPAContext &context, const uint32_t frame,
> }
>
> uint32_t ct = frameContext.awb.temperatureK;
> - /*
> - * \todo The colour temperature will likely be noisy, add filtering to
> - * avoid updating the CCM matrix all the time.
> - */
> if (frame > 0 && ct == ct_) {
> frameContext.ccm.ccm = context.activeState.ccm.automatic;
> return;
> --
> 2.43.0
>
More information about the libcamera-devel
mailing list