summaryrefslogtreecommitdiff
path: root/src/ipa
diff options
context:
space:
mode:
authorDaniel Scally <dan.scally@ideasonboard.com>2024-11-15 07:46:26 +0000
committerDaniel Scally <dan.scally@ideasonboard.com>2024-11-18 15:48:25 +0000
commitd5217b16020c659145f9d6dbf5849129b8500967 (patch)
treed1cda8a6849d8fbd7fdeab2b049d1e42e6be5be1 /src/ipa
parent1cc6d926ac9636fc7a4211bae363511610c83029 (diff)
ipa: rpi: Use centralised libipa helpersHEADmaster
Use the centralised libipa helpers rather than open coding common functions. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Diffstat (limited to 'src/ipa')
-rw-r--r--src/ipa/rpi/controller/rpi/agc_channel.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp
index c9df9b5b..8583f4f3 100644
--- a/src/ipa/rpi/controller/rpi/agc_channel.cpp
+++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp
@@ -12,6 +12,8 @@
#include <libcamera/base/log.h>
+#include "libipa/colours.h"
+
#include "../awb_status.h"
#include "../device_status.h"
#include "../histogram.h"
@@ -694,11 +696,11 @@ static double computeInitialY(StatisticsPtr &stats, AwbStatus const &awb,
double ySum;
/* Factor in the AWB correction if needed. */
if (stats->agcStatsPos == Statistics::AgcStatsPos::PreWb) {
- ySum = rSum * awb.gainR * .299 +
- gSum * awb.gainG * .587 +
- bSum * awb.gainB * .114;
+ ySum = ipa::rec601LuminanceFromRGB(rSum * awb.gainR,
+ gSum * awb.gainG,
+ bSum * awb.gainB);
} else
- ySum = rSum * .299 + gSum * .587 + bSum * .114;
+ ySum = ipa::rec601LuminanceFromRGB(rSum, gSum, bSum);
return ySum / pixelSum / (1 << 16);
}