[libcamera-devel] libipa: Correct OV5670 CameraSensorHelper gain values
diff mbox series

Message ID 20210715101709.202034-1-jeanmichel.hautbois@ideasonboard.com
State Accepted
Headers show
Series
  • [libcamera-devel] libipa: Correct OV5670 CameraSensorHelper gain values
Related show

Commit Message

Jean-Michel Hautbois July 15, 2021, 10:17 a.m. UTC
The datasheet states that the low 7 bits are fraction bits.
real_gain = GainCode/128
For example, 0x080 is 1x gain, 0x100 is 2x gain.

It means that we should have m0=1 and c1=128.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
---
 src/ipa/libipa/camera_sensor_helper.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart July 15, 2021, 2:12 p.m. UTC | #1
Hi Jean-Michel,

Thank you for the patch.

On Thu, Jul 15, 2021 at 12:17:09PM +0200, Jean-Michel Hautbois wrote:
> The datasheet states that the low 7 bits are fraction bits.
> real_gain = GainCode/128
> For example, 0x080 is 1x gain, 0x100 is 2x gain.
> 
> It means that we should have m0=1 and c1=128.
> 
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>

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

> ---
>  src/ipa/libipa/camera_sensor_helper.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
> index 17e4f0b2..709835a8 100644
> --- a/src/ipa/libipa/camera_sensor_helper.cpp
> +++ b/src/ipa/libipa/camera_sensor_helper.cpp
> @@ -300,7 +300,7 @@ class CameraSensorHelperOv5670 : public CameraSensorHelper
>  public:
>  	CameraSensorHelperOv5670()
>  	{
> -		analogueGainConstants_ = { AnalogueGainLinear, 1, 0, 0, 256 };
> +		analogueGainConstants_ = { AnalogueGainLinear, 1, 0, 0, 128 };
>  	}
>  };
>  REGISTER_CAMERA_SENSOR_HELPER("ov5670", CameraSensorHelperOv5670)
Kieran Bingham July 15, 2021, 2:38 p.m. UTC | #2
On 15/07/2021 11:17, Jean-Michel Hautbois wrote:
> The datasheet states that the low 7 bits are fraction bits.
> real_gain = GainCode/128
> For example, 0x080 is 1x gain, 0x100 is 2x gain.
> 
> It means that we should have m0=1 and c1=128.
> 
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


> ---
>  src/ipa/libipa/camera_sensor_helper.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
> index 17e4f0b2..709835a8 100644
> --- a/src/ipa/libipa/camera_sensor_helper.cpp
> +++ b/src/ipa/libipa/camera_sensor_helper.cpp
> @@ -300,7 +300,7 @@ class CameraSensorHelperOv5670 : public CameraSensorHelper
>  public:
>  	CameraSensorHelperOv5670()
>  	{
> -		analogueGainConstants_ = { AnalogueGainLinear, 1, 0, 0, 256 };
> +		analogueGainConstants_ = { AnalogueGainLinear, 1, 0, 0, 128 };
>  	}
>  };
>  REGISTER_CAMERA_SENSOR_HELPER("ov5670", CameraSensorHelperOv5670)
>

Patch
diff mbox series

diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
index 17e4f0b2..709835a8 100644
--- a/src/ipa/libipa/camera_sensor_helper.cpp
+++ b/src/ipa/libipa/camera_sensor_helper.cpp
@@ -300,7 +300,7 @@  class CameraSensorHelperOv5670 : public CameraSensorHelper
 public:
 	CameraSensorHelperOv5670()
 	{
-		analogueGainConstants_ = { AnalogueGainLinear, 1, 0, 0, 256 };
+		analogueGainConstants_ = { AnalogueGainLinear, 1, 0, 0, 128 };
 	}
 };
 REGISTER_CAMERA_SENSOR_HELPER("ov5670", CameraSensorHelperOv5670)