[libcamera-devel,1/2] libipa: Add CameraSensorHelper for ov2680
diff mbox series

Message ID 20211130213411.20149-2-djrscally@gmail.com
State New
Headers show
Series
  • Add support for OV2680 driver
Related show

Commit Message

Daniel Scally Nov. 30, 2021, 9:34 p.m. UTC
Add a CameraSensorHelperOv2680 class. The OV2680 is found in concert
with an IPU3 on the Lenovo Miix 510. The constants set are a bit of a
guess, as the datasheet doesn't document the gain control field any
further than giving its width in bits, but the default is 0x10 so we
assume that to be 1x gain.

Signed-off-by: Daniel Scally <djrscally@gmail.com>
---
 src/ipa/libipa/camera_sensor_helper.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Laurent Pinchart Nov. 30, 2021, 9:56 p.m. UTC | #1
Hi Daniel,

Thank you for the patch.

On Tue, Nov 30, 2021 at 09:34:10PM +0000, Daniel Scally wrote:
> Add a CameraSensorHelperOv2680 class. The OV2680 is found in concert
> with an IPU3 on the Lenovo Miix 510. The constants set are a bit of a
> guess, as the datasheet doesn't document the gain control field any
> further than giving its width in bits, but the default is 0x10 so we
> assume that to be 1x gain.

Would you be able to test if the gain is linear by capturing images
with, for instance, gains set to 16, 32, 48 and 64 and see if the
average relative luminance increases linearly ?

> Signed-off-by: Daniel Scally <djrscally@gmail.com>
> ---
>  src/ipa/libipa/camera_sensor_helper.cpp | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
> index 0b0eb503..fd951505 100644
> --- a/src/ipa/libipa/camera_sensor_helper.cpp
> +++ b/src/ipa/libipa/camera_sensor_helper.cpp
> @@ -305,6 +305,16 @@ public:
>  };
>  REGISTER_CAMERA_SENSOR_HELPER("imx258", CameraSensorHelperImx258)
>  
> +class CameraSensorHelperOv2680 : public CameraSensorHelper
> +{
> +public:
> +	CameraSensorHelperOv2680()
> +	{
> +		analogueGainConstants_ = { AnalogueGainLinear, 1, 0, 0, 16 };
> +	}
> +};
> +REGISTER_CAMERA_SENSOR_HELPER("ov2680", CameraSensorHelperOv2680)
> +
>  class CameraSensorHelperOv5670 : public CameraSensorHelper
>  {
>  public:
Daniel Scally Nov. 30, 2021, 10:09 p.m. UTC | #2
Hi Laurent

On 30/11/2021 21:56, Laurent Pinchart wrote:
> Hi Daniel,
> 
> Thank you for the patch.
> 
> On Tue, Nov 30, 2021 at 09:34:10PM +0000, Daniel Scally wrote:
>> Add a CameraSensorHelperOv2680 class. The OV2680 is found in concert
>> with an IPU3 on the Lenovo Miix 510. The constants set are a bit of a
>> guess, as the datasheet doesn't document the gain control field any
>> further than giving its width in bits, but the default is 0x10 so we
>> assume that to be 1x gain.
> 
> Would you be able to test if the gain is linear by capturing images
> with, for instance, gains set to 16, 32, 48 and 64 and see if the
> average relative luminance increases linearly ?

Sure; judging by eye you mean, or something more sophisticated?
> 
>> Signed-off-by: Daniel Scally <djrscally@gmail.com>
>> ---
>>  src/ipa/libipa/camera_sensor_helper.cpp | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
>> index 0b0eb503..fd951505 100644
>> --- a/src/ipa/libipa/camera_sensor_helper.cpp
>> +++ b/src/ipa/libipa/camera_sensor_helper.cpp
>> @@ -305,6 +305,16 @@ public:
>>  };
>>  REGISTER_CAMERA_SENSOR_HELPER("imx258", CameraSensorHelperImx258)
>>  
>> +class CameraSensorHelperOv2680 : public CameraSensorHelper
>> +{
>> +public:
>> +	CameraSensorHelperOv2680()
>> +	{
>> +		analogueGainConstants_ = { AnalogueGainLinear, 1, 0, 0, 16 };
>> +	}
>> +};
>> +REGISTER_CAMERA_SENSOR_HELPER("ov2680", CameraSensorHelperOv2680)
>> +
>>  class CameraSensorHelperOv5670 : public CameraSensorHelper
>>  {
>>  public:
>
Laurent Pinchart Nov. 30, 2021, 10:41 p.m. UTC | #3
Hi Daniel,

On Tue, Nov 30, 2021 at 10:09:18PM +0000, Daniel Scally wrote:
> On 30/11/2021 21:56, Laurent Pinchart wrote:
> > On Tue, Nov 30, 2021 at 09:34:10PM +0000, Daniel Scally wrote:
> >> Add a CameraSensorHelperOv2680 class. The OV2680 is found in concert
> >> with an IPU3 on the Lenovo Miix 510. The constants set are a bit of a
> >> guess, as the datasheet doesn't document the gain control field any
> >> further than giving its width in bits, but the default is 0x10 so we
> >> assume that to be 1x gain.
> > 
> > Would you be able to test if the gain is linear by capturing images
> > with, for instance, gains set to 16, 32, 48 and 64 and see if the
> > average relative luminance increases linearly ?
> 
> Sure; judging by eye you mean, or something more sophisticated?

Averaging the pixel values in the image would be better. You should try
to keep the scene luminance constant, and set the exposure time so that
a gain of 64 will be a below saturation (80% of the range would be good
for instance).

> >> Signed-off-by: Daniel Scally <djrscally@gmail.com>
> >> ---
> >>  src/ipa/libipa/camera_sensor_helper.cpp | 10 ++++++++++
> >>  1 file changed, 10 insertions(+)
> >>
> >> diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
> >> index 0b0eb503..fd951505 100644
> >> --- a/src/ipa/libipa/camera_sensor_helper.cpp
> >> +++ b/src/ipa/libipa/camera_sensor_helper.cpp
> >> @@ -305,6 +305,16 @@ public:
> >>  };
> >>  REGISTER_CAMERA_SENSOR_HELPER("imx258", CameraSensorHelperImx258)
> >>  
> >> +class CameraSensorHelperOv2680 : public CameraSensorHelper
> >> +{
> >> +public:
> >> +	CameraSensorHelperOv2680()
> >> +	{
> >> +		analogueGainConstants_ = { AnalogueGainLinear, 1, 0, 0, 16 };
> >> +	}
> >> +};
> >> +REGISTER_CAMERA_SENSOR_HELPER("ov2680", CameraSensorHelperOv2680)
> >> +
> >>  class CameraSensorHelperOv5670 : public CameraSensorHelper
> >>  {
> >>  public:

Patch
diff mbox series

diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp
index 0b0eb503..fd951505 100644
--- a/src/ipa/libipa/camera_sensor_helper.cpp
+++ b/src/ipa/libipa/camera_sensor_helper.cpp
@@ -305,6 +305,16 @@  public:
 };
 REGISTER_CAMERA_SENSOR_HELPER("imx258", CameraSensorHelperImx258)
 
+class CameraSensorHelperOv2680 : public CameraSensorHelper
+{
+public:
+	CameraSensorHelperOv2680()
+	{
+		analogueGainConstants_ = { AnalogueGainLinear, 1, 0, 0, 16 };
+	}
+};
+REGISTER_CAMERA_SENSOR_HELPER("ov2680", CameraSensorHelperOv2680)
+
 class CameraSensorHelperOv5670 : public CameraSensorHelper
 {
 public: