diff options
author | Daniel Scally <dan.scally@ideasonboard.com> | 2024-11-15 07:46:24 +0000 |
---|---|---|
committer | Daniel Scally <dan.scally@ideasonboard.com> | 2024-11-18 15:48:25 +0000 |
commit | edfe10997b4839f8376ba78dfb3261da4c51b9d7 (patch) | |
tree | 1ba07b99d016170e8bc3ade0d54860790f5d12bd /src/ipa/ipu3/algorithms/awb.cpp | |
parent | b1439c87d118776274296ef07136919a693e73fc (diff) |
ipa: ipu3: Use centralised libipa helpers
Use the centralised libipa helpers instead of open coding common
functions.
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa/ipu3/algorithms/awb.cpp')
-rw-r--r-- | src/ipa/ipu3/algorithms/awb.cpp | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp index 4d6e3994..c3c8b074 100644 --- a/src/ipa/ipu3/algorithms/awb.cpp +++ b/src/ipa/ipu3/algorithms/awb.cpp @@ -13,6 +13,8 @@ #include <libcamera/control_ids.h> +#include "libipa/colours.h" + /** * \file awb.h */ @@ -301,36 +303,6 @@ void Awb::prepare(IPAContext &context, params->use.acc_ccm = 1; } -/** - * The function estimates the correlated color temperature using - * from RGB color space input. - * In physics and color science, the Planckian locus or black body locus is - * the path or locus that the color of an incandescent black body would take - * in a particular chromaticity space as the blackbody temperature changes. - * - * If a narrow range of color temperatures is considered (those encapsulating - * daylight being the most practical case) one can approximate the Planckian - * locus in order to calculate the CCT in terms of chromaticity coordinates. - * - * More detailed information can be found in: - * https://en.wikipedia.org/wiki/Color_temperature#Approximation - */ -uint32_t Awb::estimateCCT(double red, double green, double blue) -{ - /* Convert the RGB values to CIE tristimulus values (XYZ) */ - double X = (-0.14282) * (red) + (1.54924) * (green) + (-0.95641) * (blue); - double Y = (-0.32466) * (red) + (1.57837) * (green) + (-0.73191) * (blue); - double Z = (-0.68202) * (red) + (0.77073) * (green) + (0.56332) * (blue); - - /* Calculate the normalized chromaticity values */ - double x = X / (X + Y + Z); - double y = Y / (X + Y + Z); - - /* Calculate CCT */ - double n = (x - 0.3320) / (0.1858 - y); - return 449 * n * n * n + 3525 * n * n + 6823.3 * n + 5520.33; -} - /* Generate an RGB vector with the average values for each zone */ void Awb::generateZones() { |