[libcamera-devel,1/3] libcamera: Add ColourCorrectionMatrix control

Message ID 20200704095914.17344-2-david.plowman@raspberrypi.com
State Accepted
Headers show
Series
  • ColourCorrectionMatrixControl
Related show

Commit Message

David Plowman July 4, 2020, 9:59 a.m. UTC
This control is principally for returning, in the image metadata, the
CCM (Colour Correction Matrix) used by the imaging pipeline. By which
we mean the 3x3 matrix that is applied to the camera RGB pixels after
subtraction of black levels and white-balancing, but before any gamma
transformation.

Some implementations may also choose to let an application set
explicit colour matrices, using this as a control.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/libcamera/control_ids.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Laurent Pinchart July 24, 2020, 12:19 a.m. UTC | #1
Hi David,

Thank you for the patch, and sorry for the late review.

On Sat, Jul 04, 2020 at 10:59:12AM +0100, David Plowman wrote:
> This control is principally for returning, in the image metadata, the
> CCM (Colour Correction Matrix) used by the imaging pipeline. By which
> we mean the 3x3 matrix that is applied to the camera RGB pixels after
> subtraction of black levels and white-balancing, but before any gamma
> transformation.
> 
> Some implementations may also choose to let an application set
> explicit colour matrices, using this as a control.
> 
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
> ---
>  src/libcamera/control_ids.yaml | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml
> index 8c3e4c7..23c3f06 100644
> --- a/src/libcamera/control_ids.yaml
> +++ b/src/libcamera/control_ids.yaml
> @@ -251,4 +251,16 @@ controls:
>          higher than anyone could reasonably want. Negative values are
>          not allowed. Note also that sharpening is not applied to raw
>          streams.
> +
> +  - ColourCorrectionMatrix:
> +      type: float
> +      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.
> +
> +      size: [9]

I'd write this

      size: [3x3]

We don't parse the size value yet, libcamera only uses it to determine
if a control contains a single value or is an array. With this changed,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

If this is the only change needed, I'll update the code when applying
the patch.

> +
>  ...

Patch

diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml
index 8c3e4c7..23c3f06 100644
--- a/src/libcamera/control_ids.yaml
+++ b/src/libcamera/control_ids.yaml
@@ -251,4 +251,16 @@  controls:
         higher than anyone could reasonably want. Negative values are
         not allowed. Note also that sharpening is not applied to raw
         streams.
+
+  - ColourCorrectionMatrix:
+      type: float
+      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.
+
+      size: [9]
+
 ...