summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2020-09-07 08:16:00 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2020-09-29 11:43:06 +0100
commitdcae0513f799c78ad513c9c9c7dc5426e7a25161 (patch)
tree62d17d43aaea2c493eabab2169199bd34084a236
parent78cbd6a93fbb49a20b97793b925769eefb52e516 (diff)
libcamera: Add user Transform to CameraConfiguration
Add a field to the CameraConfiguration (including the necessary documentation) to represent a 2D transform requested by the application. All pipeline handlers are amended to coerce this to the Identity, marking the configuration as "adjusted" if something different had been requested. Pipeline handlers that support Transforms can be amended subsequently. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--include/libcamera/camera.h3
-rw-r--r--src/libcamera/camera.cpp16
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp5
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp5
-rw-r--r--src/libcamera/pipeline/rkisp1/rkisp1.cpp5
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp5
-rw-r--r--src/libcamera/pipeline/uvcvideo/uvcvideo.cpp5
-rw-r--r--src/libcamera/pipeline/vimc/vimc.cpp5
8 files changed, 48 insertions, 1 deletions
diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h
index 272c12c3..a2ee4e7e 100644
--- a/include/libcamera/camera.h
+++ b/include/libcamera/camera.h
@@ -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();
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index ae16a64a..fb76077f 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -94,7 +94,7 @@ LOG_DECLARE_CATEGORY(Camera)
* \brief Create an empty camera configuration
*/
CameraConfiguration::CameraConfiguration()
- : config_({})
+ : transform(Transform::Identity), config_({})
{
}
@@ -252,6 +252,20 @@ std::size_t CameraConfiguration::size() const
}
/**
+ * \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
*/
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 221259c7..7bb05efa 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -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);
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index ea32d371..36e38894 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -250,6 +250,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;
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index acd946d1..01c42023 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -586,6 +586,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() > 2) {
config_.resize(2);
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index eb72e3b8..10223a9b 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -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);
diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
index bafe6f19..ba0efc8b 100644
--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
@@ -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);
diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
index d192670b..fc8085f1 100644
--- a/src/libcamera/pipeline/vimc/vimc.cpp
+++ b/src/libcamera/pipeline/vimc/vimc.cpp
@@ -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);