[libcamera-devel] qcam: format_converter: Support R8 Greyscale

Message ID 20200911132824.1287513-1-kieran.bingham@ideasonboard.com
State Accepted
Headers show
Series
  • [libcamera-devel] qcam: format_converter: Support R8 Greyscale
Related show

Commit Message

Kieran Bingham Sept. 11, 2020, 1:28 p.m. UTC
Support Greyscale images in the format converter by expanding the R8
component to each of the output RGB components.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
This enables viewing of my IR camera with Qcam.

 src/qcam/format_converter.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Laurent Pinchart Sept. 11, 2020, 5:38 p.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Fri, Sep 11, 2020 at 02:28:24PM +0100, Kieran Bingham wrote:
> Support Greyscale images in the format converter by expanding the R8
> component to each of the output RGB components.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

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

> ---
> This enables viewing of my IR camera with Qcam.
> 
>  src/qcam/format_converter.cpp | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/qcam/format_converter.cpp b/src/qcam/format_converter.cpp
> index 4b9722d4ecf7..b63d077e41cc 100644
> --- a/src/qcam/format_converter.cpp
> +++ b/src/qcam/format_converter.cpp
> @@ -68,6 +68,13 @@ int FormatConverter::configure(const libcamera::PixelFormat &format,
>  		nvSwap_ = true;
>  		break;
>  
> +	case libcamera::formats::R8:
> +		formatFamily_ = RGB;
> +		r_pos_ = 0;
> +		g_pos_ = 0;
> +		b_pos_ = 0;
> +		bpp_= 1;
> +		break;
>  	case libcamera::formats::RGB888:
>  		formatFamily_ = RGB;
>  		r_pos_ = 2;
Niklas Söderlund Sept. 12, 2020, 1:59 p.m. UTC | #2
Hi Kieran,

On 2020-09-11 14:28:24 +0100, Kieran Bingham wrote:
> Support Greyscale images in the format converter by expanding the R8
> component to each of the output RGB components.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
> This enables viewing of my IR camera with Qcam.
> 
>  src/qcam/format_converter.cpp | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/qcam/format_converter.cpp b/src/qcam/format_converter.cpp
> index 4b9722d4ecf7..b63d077e41cc 100644
> --- a/src/qcam/format_converter.cpp
> +++ b/src/qcam/format_converter.cpp
> @@ -68,6 +68,13 @@ int FormatConverter::configure(const libcamera::PixelFormat &format,
>  		nvSwap_ = true;
>  		break;
>  
> +	case libcamera::formats::R8:
> +		formatFamily_ = RGB;
> +		r_pos_ = 0;
> +		g_pos_ = 0;
> +		b_pos_ = 0;
> +		bpp_= 1;
> +		break;
>  	case libcamera::formats::RGB888:
>  		formatFamily_ = RGB;
>  		r_pos_ = 2;
> -- 
> 2.25.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/qcam/format_converter.cpp b/src/qcam/format_converter.cpp
index 4b9722d4ecf7..b63d077e41cc 100644
--- a/src/qcam/format_converter.cpp
+++ b/src/qcam/format_converter.cpp
@@ -68,6 +68,13 @@  int FormatConverter::configure(const libcamera::PixelFormat &format,
 		nvSwap_ = true;
 		break;
 
+	case libcamera::formats::R8:
+		formatFamily_ = RGB;
+		r_pos_ = 0;
+		g_pos_ = 0;
+		b_pos_ = 0;
+		bpp_= 1;
+		break;
 	case libcamera::formats::RGB888:
 		formatFamily_ = RGB;
 		r_pos_ = 2;