[v4,1/9] libcamera: Document ScalerCrop in physical pixel-array coordinates
diff mbox series

Message ID 20261029132631.370507-2-halfline@gmail.com
State Superseded
Headers show
Series
  • software-isp: Align metering and report the configured crop
Related show

Commit Message

Ray Strode Oct. 29, 2026, 1:26 p.m. UTC
From: Ray Strode <rstrode@redhat.com>

The ScalerCrop documentation describes its origin relative to an active
area, while pipelines report physical pixel-array coordinates. The
ScalerCropMaximum description also refers to the active pixel array.

Describe both rectangles relative to PixelArrayArea, with coordinates and
dimensions in native sensor pixels.

Reported-by: Stefan Klug <stefan.klug@ideasonboard.com>
Signed-off-by: Ray Strode <rstrode@redhat.com>
---
 src/libcamera/control_ids_core.yaml  | 7 +++----
 src/libcamera/property_ids_core.yaml | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)


base-commit: b174b52cb8700320b20cd3a5cb275107f908e0c1

Patch
diff mbox series

diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml
index 73643e7e..5c33db5f 100644
--- a/src/libcamera/control_ids_core.yaml
+++ b/src/libcamera/control_ids_core.yaml
@@ -668,64 +668,63 @@  controls:
         method of combination is platform dependent. In this respect, it is not
         necessarily aimed at providing a way to implement a focus algorithm by
         the application, rather an indication of how in-focus a frame is.
 
   - ColourCorrectionMatrix:
       type: float
       direction: inout
       description: |
         The 3x3 matrix that converts camera RGB to sRGB within the imaging
         pipeline.
 
         This should describe the matrix that is used after pixels have been
         white-balanced, but before any gamma transformation. The 3x3 matrix is
         stored in conventional reading order in an array of 9 floating point
         values.
 
         ColourCorrectionMatrix can only be applied in a Request when the AWB is
         disabled.
 
         \sa AwbEnable
         \sa ColourTemperature
       size: [3,3]
 
   - ScalerCrop:
       type: Rectangle
       direction: inout
       description: |
         Sets the image portion that will be scaled to form the whole of
         the final output image.
 
-        The (x,y) location of this rectangle is relative to the
-        PixelArrayActiveAreas that is being used. The units remain native
-        sensor pixels, even if the sensor is being used in a binning or
-        skipping mode.
+        The rectangle is expressed in native sensor pixels relative to the
+        properties::PixelArrayArea rectangle, even if the sensor is being used
+        in a binning or skipping mode.
 
         This control is only present when the pipeline supports scaling. Its
         maximum valid value is given by the properties::ScalerCropMaximum
         property, and the two can be used to implement digital zoom.
 
   - DigitalGain:
       type: float
       direction: inout
       description: |
         Digital gain value applied during the processing steps applied
         to the image as captured from the sensor.
 
         The global digital gain factor is applied to all the colour channels
         of the RAW image. Different pipeline models are free to
         specify how the global gain factor applies to each separate
         channel.
 
         If an imaging pipeline applies digital gain in distinct
         processing steps, this value indicates their total sum.
         Pipelines are free to decide how to adjust each processing
         step to respect the received gain factor and shall report
         their total value in the request metadata.
 
   - FrameDuration:
       type: int64_t
       direction: out
       description: |
         The instantaneous frame duration from start of frame exposure to start
         of next exposure, expressed in microseconds.
 
diff --git a/src/libcamera/property_ids_core.yaml b/src/libcamera/property_ids_core.yaml
index 171af2a3..f3b4a4aa 100644
--- a/src/libcamera/property_ids_core.yaml
+++ b/src/libcamera/property_ids_core.yaml
@@ -560,62 +560,62 @@  controls:
                     |    |//////|    |  |
                  y2 o+---+------+---+|  |
                     ||///|//////|///||  | PixelArrayArea.height
                  y3 o+---+------+---+|  |
                     |    |//////|    |  |
                  y4 o    +------+    |  |
                     +----+------+----+  /
 
         The property reports two rectangles
 
                 PixelArrayActiveAreas = ((x2, y1, x3 - x2 + 1, y4 - y1 + 1),
                                          (x1, y2, x4 - x1 + 1, y3 - y2 + 1))
 
         The first rectangle describes the maximum field-of-view of all image
         formats in the 4:3 resolutions, while the second one describes the
         maximum field of view for all image formats in the 16:9 resolutions.
 
         Multiple rectangles shall only be reported when the sensor can't capture
         the pixels in the corner regions. If all the pixels in the (x1,y1) -
         (x4,y4) area can be captured, the PixelArrayActiveAreas property shall
         contains the single rectangle (x1,y1) - (x4,y4).
 
         \todo Rename this property to ActiveAreas once we will have property
               categories (i.e. Properties::PixelArray::ActiveAreas)
 
   - ScalerCropMaximum:
       type: Rectangle
       description: |
         The maximum valid rectangle for the controls::ScalerCrop control. This
         reflects the minimum mandatory cropping applied in the camera sensor and
-        the rest of the pipeline. Just as the ScalerCrop control, it defines a
-        rectangle taken from the sensor's active pixel array.
+        the rest of the pipeline. The rectangle is expressed in native sensor
+        pixels relative to the PixelArrayArea rectangle.
 
         This property is valid only after the camera has been successfully
         configured and its value may change whenever a new configuration is
         applied.
 
         \todo Turn this property into a "maximum control value" for the
         ScalerCrop control once "dynamic" controls have been implemented.
 
   - SensorSensitivity:
       type: float
       description: |
         The relative sensitivity of the chosen sensor mode.
 
         Some sensors have readout modes with different sensitivities. For example,
         a binned camera mode might, with the same exposure and gains, produce
         twice the signal level of the full resolution readout. This would be
         signalled by the binned mode, when it is chosen, indicating a value here
         that is twice that of the full resolution mode. This value will be valid
         after the configure method has returned successfully.
 
   - SystemDevices:
       type: int64_t
       size: [n]
       description: |
         A list of integer values of type dev_t denoting the major and minor
         device numbers of the underlying devices used in the operation of this
         camera.
 
         Different cameras may report identical devices.