[libcamera-devel,2/6] libcamera: Initialise the SensorOutputSize property

Message ID 20200922100400.30766-3-david.plowman@raspberrypi.com
State Superseded
Headers show
Series
  • Digital zoom
Related show

Commit Message

David Plowman Sept. 22, 2020, 10:03 a.m. UTC
Add a default initialisation according to the sensor resolution,
though it will need updating when the camera mode changes.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/libcamera/camera_sensor.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Jacopo Mondi Sept. 23, 2020, 9:09 a.m. UTC | #1
Hi David,

On Tue, Sep 22, 2020 at 11:03:56AM +0100, David Plowman wrote:
> Add a default initialisation according to the sensor resolution,
> though it will need updating when the camera mode changes.
>
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
> ---
>  src/libcamera/camera_sensor.cpp | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
> index d2679a4..c9a19b0 100644
> --- a/src/libcamera/camera_sensor.cpp
> +++ b/src/libcamera/camera_sensor.cpp
> @@ -277,6 +277,12 @@ int CameraSensor::init()
>  	 */
>  	resolution_ = sizes_.back();
>
> +	/*
> +	 * Set a default value for the SensorOutputSize, though it will have to
> +	 * be updated when new camera modes are chosen.
> +	 */
> +	properties_.set(properties::SensorOutputSize, resolution_);
> +

This doesn't actually reflect what's applied to the sensor, but I
guess it does not make much sense to inspect the property before the
Camera has been configured. This should probably be made more explicit
in the property description. Something like:

Maybe change the last two lines of the proposed description in 1/4

  - SensorOutputSize:
      type: Size
      description: |
        The size, in pixels, of the image being used to produce the
        desired output streams. The image size might correspond to the
        size of the frames produced by the image sensor but would also
        take into account additional cropping (or even re-scaling)
        performed by the CSI-2 receiver to adjust the sensor frame
        size to conform to the output image sizes and aspect ratios.
   -->  Note that this property changes with every newly selected
        camera mode. It can be used to implement digital zoom.

With:
        The property is meaningful only after the Camera has been
        successfully configured and its value changes whenever a new
        configuration is applied. It can be used to implement digital
        zoom.

        \sa controls::ISPCrop

        \todo Move this property to CameraConfiguration once the
        feature is made available

On this specific patch
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

>  	return 0;
>  }
>
> --
> 2.20.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index d2679a4..c9a19b0 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -277,6 +277,12 @@  int CameraSensor::init()
 	 */
 	resolution_ = sizes_.back();
 
+	/*
+	 * Set a default value for the SensorOutputSize, though it will have to
+	 * be updated when new camera modes are chosen.
+	 */
+	properties_.set(properties::SensorOutputSize, resolution_);
+
 	return 0;
 }