@@ -69,6 +69,7 @@ uniform sampler2D red_param;
uniform sampler2D green_param;
uniform sampler2D blue_param;
uniform mat3 ccm;
+uniform vec3 awb;
void main(void)
{
@@ -216,6 +217,11 @@ void main(void)
vec3(patterns.y, C, patterns.x) :
vec3(patterns.wz, C));
+ /* Apply white balance before colour correction matrix */
+ rgb.r = rgb.r * awb.r;
+ rgb.g = rgb.g * awb.g;
+ rgb.b = rgb.b * awb.b;
+
#if defined(APPLY_CCM_PARAMETERS)
/*
* CCM is a 3x3 in the format
@@ -28,6 +28,7 @@ varying vec4 center;
varying vec4 yCoord;
varying vec4 xCoord;
uniform mat3 ccm;
+uniform vec3 awb;
void main(void) {
vec3 rgb;
@@ -111,6 +112,11 @@ void main(void) {
vec3(PATTERN.w, C, PATTERN.z) :
vec3(PATTERN.yx, C));
+ /* Apply white balance before colour correction matrix */
+ rgb.r = rgb.r * awb.r;
+ rgb.g = rgb.g * awb.g;
+ rgb.b = rgb.b * awb.b;
+
#if defined(APPLY_CCM_PARAMETERS)
/*
* CCM is a 3x3 in the format
Add the ability to apply a vec3 AWB array against the demosaiced data prior to application of colour correction data. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> --- include/libcamera/internal/shaders/bayer_1x_packed.frag | 6 ++++++ include/libcamera/internal/shaders/bayer_unpacked.frag | 6 ++++++ 2 files changed, 12 insertions(+)