ipa: rpi: awb: Add a const for the default colour temperature

A default CT of 4500K is used in a couple of places. Add a constexpr
value for the default CT value and use it instead.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Naushir Patuck 2024-10-08 09:13:16 +01:00 committed by Kieran Bingham
parent 3513db6cc6
commit 692d0d66ac

View file

@ -21,6 +21,8 @@ using namespace libcamera;
LOG_DEFINE_CATEGORY(RPiAwb) LOG_DEFINE_CATEGORY(RPiAwb)
constexpr double kDefaultCT = 4500.0;
#define NAME "rpi.awb" #define NAME "rpi.awb"
/* /*
@ -215,7 +217,7 @@ void Awb::initialise()
syncResults_.gainB = 1.0 / config_.ctB.eval(syncResults_.temperatureK); syncResults_.gainB = 1.0 / config_.ctB.eval(syncResults_.temperatureK);
} else { } else {
/* random values just to stop the world blowing up */ /* random values just to stop the world blowing up */
syncResults_.temperatureK = 4500; syncResults_.temperatureK = kDefaultCT;
syncResults_.gainR = syncResults_.gainG = syncResults_.gainB = 1.0; syncResults_.gainR = syncResults_.gainG = syncResults_.gainB = 1.0;
} }
prevSyncResults_ = syncResults_; prevSyncResults_ = syncResults_;
@ -717,7 +719,11 @@ void Awb::awbGrey()
sumR += *ri, sumB += *bi; sumR += *ri, sumB += *bi;
double gainR = sumR.G / (sumR.R + 1), double gainR = sumR.G / (sumR.R + 1),
gainB = sumB.G / (sumB.B + 1); gainB = sumB.G / (sumB.B + 1);
asyncResults_.temperatureK = 4500; /* don't know what it is */ /*
* The grey world model can't estimate the colour temperature, use a
* default value.
*/
asyncResults_.temperatureK = kDefaultCT;
asyncResults_.gainR = gainR; asyncResults_.gainR = gainR;
asyncResults_.gainG = 1.0; asyncResults_.gainG = 1.0;
asyncResults_.gainB = gainB; asyncResults_.gainB = gainB;