ipa: rkisp1: awb: Take the CCM into account for the AWB gains calculation

The AWB measurements are taken after the CCM. This can be seen by
enabling debug logging on AWB, disabling AWB (stats will still be
processed) and manually chaning the CCM.

This means that the estimated colour temperature and the corresponding
CCM also lead to changed rgbMeans which in turn leads to oscillations.
Fix that by applying the inverse transform on the rgbMeans.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
Stefan Klug 2025-04-03 17:49:20 +02:00
parent 71b680c863
commit 7991293cec

View file

@ -404,6 +404,12 @@ RGB<double> Awb::calculateRgbMeans(const IPAFrameContext &frameContext, const rk
rgbMeans = rgbMeans.max(0.0); rgbMeans = rgbMeans.max(0.0);
} }
/*
* The ISP computes the AWB means after applying the CCM. Apply the
* inverse as we want to get the raw means before the colour gains.
*/
rgbMeans = frameContext.ccm.ccm.inverse() * rgbMeans;
/* /*
* The ISP computes the AWB means after applying the colour gains, * The ISP computes the AWB means after applying the colour gains,
* divide by the gains that were used to get the raw means from the * divide by the gains that were used to get the raw means from the