[libcamera-devel,1/2] libcamera: camera_sensor: Define CameraSensorInfo

Message ID 20200326233751.341320-2-jacopo@jmondi.org
State Accepted
Headers show
Series
  • WIP: Define CameraSensorInfo
Related show

Commit Message

Jacopo Mondi March 26, 2020, 11:37 p.m. UTC
Define the CameraSensorInfo structure that reports the current image sensor
configuration.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/camera_sensor.cpp       | 84 +++++++++++++++++++++++++++
 src/libcamera/include/camera_sensor.h | 19 ++++++
 2 files changed, 103 insertions(+)

Patch

diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 09771fc40bbb..250ea99bfcf7 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -30,6 +30,90 @@  namespace libcamera {
 
 LOG_DEFINE_CATEGORY(CameraSensor);
 
+/**
+ * \struct CameraSensorInfo
+ * \brief Report the image sensor characteristics
+ *
+ * The structure reports image sensor characteristics used by IPA modules tune
+ * their algorithms based on the image sensor model currently in use and its
+ * configuration.
+ *
+ * The here reported information describe the sensor's intrinsics
+ * characteristics, such as its pixel array size and the sensor model name,
+ * as well as information relative to the currently configured mode, such as
+ * the produced image size and the bit depth of the requested image format.
+ *
+ * Instances of this structure are meant to be assembled by the CameraSensor
+ * class and its specialized subclasses by inspecting the sensor static
+ * properties as well as the currently configured sensor mode.
+ */
+
+/**
+ * \var CameraSensorInfo::name
+ * \brief The image sensor name
+ */
+
+/**
+ * \var CameraSensorInfo::bitsPerPixel
+ * \brief The bits per-pixel of the image format produced by the image sensor
+ */
+
+/**
+ * \var CameraSensorInfo::activeAreaSize
+ * \brief The size of the active pixel array area of the sensor
+ *
+ * \todo Reference the corresponding property
+ */
+
+/**
+ * \var CameraSensorInfo::outputImage
+ * \brief The output image cropping rectangle, with its top-left corner
+ * defined as the horizontal and vertical displacements from the top-left corner
+ * of the active pixel array, and its size defined as the output image size
+ */
+
+/**
+ * \var CameraSensorInfo::horizontalBinning
+ * \brief The binning factor, in the horizontal direction, of the image sensor
+ * configuration
+ */
+
+/**
+ * \var CameraSensorInfo::verticalBinning
+ * \brief The binning factor, in the vertical direction, of the image sensor
+ * configuration
+ */
+
+/**
+ * \var CameraSensorInfo::horizontalScaling
+ * \brief The horizontal scaling factor, calculated as the ratio between
+ * the active pixel array horizontal size and the horizontal size of the
+ * output image
+ *
+ * \todo Remove this field and compute the scaling factor in the IPA
+ */
+
+/**
+ * \var CameraSensorInfo::verticalScaling:
+ * \brief The vertical scaling factor, calculated as the ratio between
+ * the active pixel array vertical size and the vertical size of the
+ * output image
+ *
+ * \todo Remove this field and compute the scaling factor in the IPA
+ */
+
+/**
+ * \var CameraSensorInfo::noiseFactor
+ * \brief Scaling of the noise compared to the native sensor mode
+ *
+ * \todo Improve this description
+ */
+
+/**
+ * \var CameraSensorInfo::lineDuration
+ * \brief Line scan-out duration in nanoseconds
+ */
+
 /**
  * \class CameraSensor
  * \brief A camera sensor based on V4L2 subdevices
diff --git a/src/libcamera/include/camera_sensor.h b/src/libcamera/include/camera_sensor.h
index 6e4d2b0118bc..77b258ce63f0 100644
--- a/src/libcamera/include/camera_sensor.h
+++ b/src/libcamera/include/camera_sensor.h
@@ -24,6 +24,25 @@  class V4L2Subdevice;
 
 struct V4L2SubdeviceFormat;
 
+struct CameraSensorInfo {
+	std::string name;
+
+	uint32_t bitsPerPixel;
+
+	Size activeAreaSize;
+	Rectangle outputImage;
+
+	uint8_t horizontalBinning;
+	uint8_t verticalBinning;
+
+	double horizontalScaling;
+	double verticalScaling;
+
+	double noiseFactor;
+
+	double lineDuration;
+};
+
 class CameraSensor : protected Loggable
 {
 public: