[libcamera-devel] [PATCH 1/2] libcamera: formats: Fix colour encoding for "R" raw greyscale formats

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Aug 4 20:25:26 CEST 2022


Hi David,

Thank you for the patch.

On Thu, Aug 04, 2022 at 11:45:49AM +0100, David Plowman via libcamera-devel wrote:
> These are being used for raw monochrome sensors and so the colour
> encoding should be "raw".

Ouch. This is something I didn't foresee, but we have a problem here.
These can refer to both raw data from monochrome sensors, but also
greyscale data processed by an ISP. We currently don't consider as RAW
formats, which means that

- The CameraConfiguration::validateColorSpaces() will accept other color
  spaces that ColorSpace::Raw.
- The IPU3 and Raspberry Pi pipeline handlers, and the Android HAL, will
  consider them as processed streams, not raw streams.

This patch will change that, quite likely introducing breakages.

Now, the interesting question is how to support both raw monochrome data
and processed monochrome data. Any idea ? :-)

> Signed-off-by: David Plowman <david.plowman at raspberrypi.com>
> ---
>  src/libcamera/formats.cpp | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
> index 283ecb3d..7b98fef2 100644
> --- a/src/libcamera/formats.cpp
> +++ b/src/libcamera/formats.cpp
> @@ -531,7 +531,7 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  			.multi = V4L2PixelFormat(),
>  		},
>  		.bitsPerPixel = 8,
> -		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
>  		.packed = false,
>  		.pixelsPerGroup = 1,
>  		.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},
> @@ -544,7 +544,7 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  			.multi = V4L2PixelFormat(),
>  		},
>  		.bitsPerPixel = 10,
> -		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
>  		.packed = false,
>  		.pixelsPerGroup = 1,
>  		.planes = {{ { 2, 1 }, { 0, 0 }, { 0, 0 } }},
> @@ -557,7 +557,7 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  			.multi = V4L2PixelFormat(),
>  		},
>  		.bitsPerPixel = 12,
> -		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
>  		.packed = false,
>  		.pixelsPerGroup = 1,
>  		.planes = {{ { 2, 1 }, { 0, 0 }, { 0, 0 } }},
> @@ -570,7 +570,7 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  			.multi = V4L2PixelFormat(),
>  		},
>  		.bitsPerPixel = 10,
> -		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
>  		.packed = true,
>  		.pixelsPerGroup = 4,
>  		.planes = {{ { 5, 1 }, { 0, 0 }, { 0, 0 } }},

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list