@@ -17,6 +17,7 @@
#include <libcamera/request.h>
#include <libcamera/signal.h>
#include <libcamera/stream.h>
+#include <libcamera/transform.h>
namespace libcamera {
@@ -61,6 +62,8 @@ public:
bool empty() const;
std::size_t size() const;
+ Transform transform;
+
protected:
CameraConfiguration();
@@ -93,7 +93,7 @@ LOG_DECLARE_CATEGORY(Camera)
* \brief Create an empty camera configuration
*/
CameraConfiguration::CameraConfiguration()
- : config_({})
+ : transform(Transform::Identity), config_({})
{
}
@@ -250,6 +250,20 @@ std::size_t CameraConfiguration::size() const
return config_.size();
}
+/**
+ * \var CameraConfiguration::transform
+ * \brief User-specified transform to be applied to the image
+ *
+ * The transform is a user-specified 2D plane transform that will be applied
+ * to the camera images by the processing pipeline before being handed to
+ * the application. This is subsequent to any transform that is already
+ * required to fix up any platform-defined rotation.
+ *
+ * The usual 2D plane transforms are allowed here (horizontal/vertical
+ * flips, multiple of 90-degree rotations etc.), but the validate() function
+ * may adjust this field at its discretion if the selection is not supported.
+ */
+
/**
* \var CameraConfiguration::config_
* \brief The vector of stream configurations
@@ -138,6 +138,11 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
if (config_.empty())
return Invalid;
+ if (transform != Transform::Identity) {
+ transform = Transform::Identity;
+ status = Adjusted;
+ }
+
/* Cap the number of entries to the available streams. */
if (config_.size() > IPU3_MAX_STREAMS) {
config_.resize(IPU3_MAX_STREAMS);
@@ -400,6 +400,11 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
if (config_.empty())
return Invalid;
+ if (transform != Transform::Identity) {
+ transform = Transform::Identity;
+ status = Adjusted;
+ }
+
unsigned int rawCount = 0, outCount = 0, count = 0, maxIndex = 0;
std::pair<int, Size> outSize[2];
Size maxSize;
@@ -478,6 +478,11 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()
if (config_.empty())
return Invalid;
+ if (transform != Transform::Identity) {
+ transform = Transform::Identity;
+ status = Adjusted;
+ }
+
/* Cap the number of entries to the available streams. */
if (config_.size() > 1) {
config_.resize(1);
@@ -438,6 +438,11 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()
if (config_.empty())
return Invalid;
+ if (transform != Transform::Identity) {
+ transform = Transform::Identity;
+ status = Adjusted;
+ }
+
/* Cap the number of entries to the available streams. */
if (config_.size() > 1) {
config_.resize(1);
@@ -109,6 +109,11 @@ CameraConfiguration::Status UVCCameraConfiguration::validate()
if (config_.empty())
return Invalid;
+ if (transform != Transform::Identity) {
+ transform = Transform::Identity;
+ status = Adjusted;
+ }
+
/* Cap the number of entries to the available streams. */
if (config_.size() > 1) {
config_.resize(1);
@@ -130,6 +130,11 @@ CameraConfiguration::Status VimcCameraConfiguration::validate()
if (config_.empty())
return Invalid;
+ if (transform != Transform::Identity) {
+ transform = Transform::Identity;
+ status = Adjusted;
+ }
+
/* Cap the number of entries to the available streams. */
if (config_.size() > 1) {
config_.resize(1);