ipa: rpi: controller: rpi: Fix colour gain typo in AGC
diff mbox series

Message ID 20250522130318.35533-1-david.plowman@raspberrypi.com
State New
Headers show
Series
  • ipa: rpi: controller: rpi: Fix colour gain typo in AGC
Related show

Commit Message

David Plowman May 22, 2025, 1:03 p.m. UTC
A simple typo crept in where the red gain had been re-typed rather
than using the correct green gain. In particular, this was causing
very dark images for sensors that use large red gains, such as the
IMX477 outdoors.

Fixes: 29892f1c56c6 ("ipa: libipa: colour: Use the RGB class to model RGB values")
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/ipa/rpi/controller/rpi/agc_channel.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart May 22, 2025, 1:22 p.m. UTC | #1
Hi David,

On Thu, May 22, 2025 at 02:03:18PM +0100, David Plowman wrote:
> A simple typo crept in where the red gain had been re-typed rather
> than using the correct green gain. In particular, this was causing
> very dark images for sensors that use large red gains, such as the
> IMX477 outdoors.
> 
> Fixes: 29892f1c56c6 ("ipa: libipa: colour: Use the RGB class to model RGB values")

Oops :-S Sorry about that.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
> ---
>  src/ipa/rpi/controller/rpi/agc_channel.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp
> index a5562760..b2999364 100644
> --- a/src/ipa/rpi/controller/rpi/agc_channel.cpp
> +++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp
> @@ -717,7 +717,7 @@ static double computeInitialY(StatisticsPtr &stats, AwbStatus const &awb,
>  
>  	/* Factor in the AWB correction if needed. */
>  	if (stats->agcStatsPos == Statistics::AgcStatsPos::PreWb)
> -		sum *= RGB<double>{ { awb.gainR, awb.gainR, awb.gainB } };
> +		sum *= RGB<double>{ { awb.gainR, awb.gainG, awb.gainB } };
>  
>  	double ySum = ipa::rec601LuminanceFromRGB(sum);
>
Naushir Patuck May 22, 2025, 1:25 p.m. UTC | #2
Hi David,


On Thu, 22 May 2025 at 14:03, David Plowman <david.plowman@raspberrypi.com>
wrote:

> A simple typo crept in where the red gain had been re-typed rather
> than using the correct green gain. In particular, this was causing
> very dark images for sensors that use large red gains, such as the
> IMX477 outdoors.
>
> Fixes: 29892f1c56c6 ("ipa: libipa: colour: Use the RGB class to model RGB
> values")
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
>

Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>


> ---
>  src/ipa/rpi/controller/rpi/agc_channel.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp
> b/src/ipa/rpi/controller/rpi/agc_channel.cpp
> index a5562760..b2999364 100644
> --- a/src/ipa/rpi/controller/rpi/agc_channel.cpp
> +++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp
> @@ -717,7 +717,7 @@ static double computeInitialY(StatisticsPtr &stats,
> AwbStatus const &awb,
>
>         /* Factor in the AWB correction if needed. */
>         if (stats->agcStatsPos == Statistics::AgcStatsPos::PreWb)
> -               sum *= RGB<double>{ { awb.gainR, awb.gainR, awb.gainB } };
> +               sum *= RGB<double>{ { awb.gainR, awb.gainG, awb.gainB } };
>
>         double ySum = ipa::rec601LuminanceFromRGB(sum);
>
> --
> 2.34.1
>
>

Patch
diff mbox series

diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp
index a5562760..b2999364 100644
--- a/src/ipa/rpi/controller/rpi/agc_channel.cpp
+++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp
@@ -717,7 +717,7 @@  static double computeInitialY(StatisticsPtr &stats, AwbStatus const &awb,
 
 	/* Factor in the AWB correction if needed. */
 	if (stats->agcStatsPos == Statistics::AgcStatsPos::PreWb)
-		sum *= RGB<double>{ { awb.gainR, awb.gainR, awb.gainB } };
+		sum *= RGB<double>{ { awb.gainR, awb.gainG, awb.gainB } };
 
 	double ySum = ipa::rec601LuminanceFromRGB(sum);