diff options
author | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2022-11-24 10:33:06 +0100 |
---|---|---|
committer | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2023-01-30 11:04:50 +0100 |
commit | 6f6e1bf704feec3a9bcfc1f5490ae82fe8d63065 (patch) | |
tree | 1144cde876d28953d34c9973d561b14d1c7e8a90 /src/libcamera/pipeline/ipu3/cio2.cpp | |
parent | 1a614866a29ce1e3c185d72975ad9fc37c4f99bd (diff) |
libcamera: camera_sensor: Apply flips at setFormat()
Augment the CameraSensor::setFormat() function to configure horizontal
and vertical flips before applying the image format on the sensor.
Applying flips before format is crucial as they might change the Bayer
pattern ordering.
To allow users of the CameraSensor class to specify a Transform,
add to the V4L2SubdeviceFormat class a 'transform' member, by
default initialized to Transform::Identity.
Moving the handling of H/V flips to the CameraSensor class allows to
remove quite some boilerplate code from the IPU3 and RaspberryPi
pipeline handlers.
No functional changes intended.
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Diffstat (limited to 'src/libcamera/pipeline/ipu3/cio2.cpp')
-rw-r--r-- | src/libcamera/pipeline/ipu3/cio2.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp index d4e523af..a819884f 100644 --- a/src/libcamera/pipeline/ipu3/cio2.cpp +++ b/src/libcamera/pipeline/ipu3/cio2.cpp @@ -15,6 +15,7 @@ #include <libcamera/formats.h> #include <libcamera/geometry.h> #include <libcamera/stream.h> +#include <libcamera/transform.h> #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/framebuffer.h" @@ -177,10 +178,12 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index) /** * \brief Configure the CIO2 unit * \param[in] size The requested CIO2 output frame size + * \param[in] transform The transformation to be applied on the image sensor * \param[out] outputFormat The CIO2 unit output image format * \return 0 on success or a negative error code otherwise */ -int CIO2Device::configure(const Size &size, V4L2DeviceFormat *outputFormat) +int CIO2Device::configure(const Size &size, const Transform &transform, + V4L2DeviceFormat *outputFormat) { V4L2SubdeviceFormat sensorFormat; int ret; @@ -191,6 +194,7 @@ int CIO2Device::configure(const Size &size, V4L2DeviceFormat *outputFormat) */ std::vector<unsigned int> mbusCodes = utils::map_keys(mbusCodesToPixelFormat); sensorFormat = getSensorFormat(mbusCodes, size); + sensorFormat.transform = transform; ret = sensor_->setFormat(&sensorFormat); if (ret) return ret; |