[libcamera-devel] [PATCH v2 1/4] libcamera: camera_sensor: Adjust CameraSensorInfo::analogCrop
Jacopo Mondi
jacopo at jmondi.org
Wed Dec 2 16:59:41 CET 2020
Hi list,
On Wed, Dec 02, 2020 at 02:53:51PM +0100, Jacopo Mondi wrote:
> The CameraSensorInfo::analogCrop top-left corner is defined relatively
> to the sensor active area.
>
> The analogCrop rectangle is constucted by retrieving the V4L2
> selection target V4L2_SEL_TGT_CROP which is instead defined relatively
> to the whole sensor's pixel array size.
>
> Adjust the the analogCrop rectangle subtracting from its top-left corner
> the active area distance from the full pixel array.
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
>
> ---
> This patch depends on kernel patch:
> "media: i2c: imx219: Selection compliance fixes":
>
> RPi downstream: https://github.com/raspberrypi/linux/pull/3983
> Linux mainline (should land in v5.11)
> https://patchwork.linuxtv.org/project/linux-media/patch/20200805105721.15445-5-jacopo@jmondi.org/
Both patches have now been collected
> ---
> src/libcamera/camera_sensor.cpp | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
> index 935de528c496..c5fa89143ac8 100644
> --- a/src/libcamera/camera_sensor.cpp
> +++ b/src/libcamera/camera_sensor.cpp
> @@ -527,6 +527,16 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const
> return ret;
> }
>
> + /*
> + * CameraSensorInfo::analogCrop::x and CameraSensorInfo::analogCrop::y
> + * are defined relatively to the active pixel area, while V4L2's
> + * TGT_CROP target is defined in respect to the full pixel array.
> + *
> + * Compensate it by subtracting the active areas offset.
> + */
> + info->analogCrop.x -= rect.x;
> + info->analogCrop.y -= rect.y;
> +
> /* The bit depth and image size depend on the currently applied format. */
> V4L2SubdeviceFormat format{};
> ret = subdev_->getFormat(pad_, &format);
> --
> 2.29.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
More information about the libcamera-devel
mailing list