[libcamera-devel] gstreamer: Support planar formats
diff mbox series

Message ID 20210921153515.2785148-1-kieran.bingham@ideasonboard.com
State Accepted
Headers show
Series
  • [libcamera-devel] gstreamer: Support planar formats
Related show

Commit Message

Kieran Bingham Sept. 21, 2021, 3:35 p.m. UTC
Existing pipeline handlers already support planar YUV formats.
Extend the gstreamer format map to incorporate them.

While here, split the formats into distinct groups.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/gstreamer/gstlibcamera-utils.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Laurent Pinchart Sept. 21, 2021, 4:40 p.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Tue, Sep 21, 2021 at 04:35:15PM +0100, Kieran Bingham wrote:
> Existing pipeline handlers already support planar YUV formats.
> Extend the gstreamer format map to incorporate them.
> 
> While here, split the formats into distinct groups.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  src/gstreamer/gstlibcamera-utils.cpp | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> index 0af91c1acb67..5636f3e7e1a6 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -16,19 +16,32 @@ static struct {
>  	GstVideoFormat gst_format;
>  	PixelFormat format;
>  } format_map[] = {
> +	/* Compressed */
>  	{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },
> +
> +	/* RGB */
>  	{ GST_VIDEO_FORMAT_RGB, formats::BGR888 },
>  	{ GST_VIDEO_FORMAT_BGR, formats::RGB888 },
>  	{ GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 },
> +
> +	/* YUV Semiplanar */
>  	{ GST_VIDEO_FORMAT_NV12, formats::NV12 },
>  	{ GST_VIDEO_FORMAT_NV21, formats::NV21 },
>  	{ GST_VIDEO_FORMAT_NV16, formats::NV16 },
>  	{ GST_VIDEO_FORMAT_NV61, formats::NV61 },
>  	{ GST_VIDEO_FORMAT_NV24, formats::NV24 },
> +
> +	/* YUV Packed */
>  	{ GST_VIDEO_FORMAT_UYVY, formats::UYVY },
>  	{ GST_VIDEO_FORMAT_VYUY, formats::VYUY },
>  	{ GST_VIDEO_FORMAT_YUY2, formats::YUYV },
>  	{ GST_VIDEO_FORMAT_YVYU, formats::YVYU },
> +
> +	/* Planar Formats */
> +	{ GST_VIDEO_FORMAT_I420, formats::YUV420 },
> +	{ GST_VIDEO_FORMAT_YV12, formats::YVU420 },
> +	{ GST_VIDEO_FORMAT_Y42B, formats::YUV422 },

I would have put the planar formats just after the semi-planar, but that
doesn't matter much.

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

> +
>  	/* \todo NV42 is used in libcamera but is not mapped in GStreamer yet. */
>  };
>
Jean-Michel Hautbois Sept. 21, 2021, 4:44 p.m. UTC | #2
Hi Kieran,

On 21/09/2021 18:40, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Tue, Sep 21, 2021 at 04:35:15PM +0100, Kieran Bingham wrote:
>> Existing pipeline handlers already support planar YUV formats.
>> Extend the gstreamer format map to incorporate them.
>>
>> While here, split the formats into distinct groups.
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>> ---
>>  src/gstreamer/gstlibcamera-utils.cpp | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
>>
>> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
>> index 0af91c1acb67..5636f3e7e1a6 100644
>> --- a/src/gstreamer/gstlibcamera-utils.cpp
>> +++ b/src/gstreamer/gstlibcamera-utils.cpp
>> @@ -16,19 +16,32 @@ static struct {
>>  	GstVideoFormat gst_format;
>>  	PixelFormat format;
>>  } format_map[] = {
>> +	/* Compressed */
>>  	{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },
>> +
>> +	/* RGB */
>>  	{ GST_VIDEO_FORMAT_RGB, formats::BGR888 },
>>  	{ GST_VIDEO_FORMAT_BGR, formats::RGB888 },
>>  	{ GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 },
>> +
>> +	/* YUV Semiplanar */
>>  	{ GST_VIDEO_FORMAT_NV12, formats::NV12 },
>>  	{ GST_VIDEO_FORMAT_NV21, formats::NV21 },
>>  	{ GST_VIDEO_FORMAT_NV16, formats::NV16 },
>>  	{ GST_VIDEO_FORMAT_NV61, formats::NV61 },
>>  	{ GST_VIDEO_FORMAT_NV24, formats::NV24 },
>> +
>> +	/* YUV Packed */
>>  	{ GST_VIDEO_FORMAT_UYVY, formats::UYVY },
>>  	{ GST_VIDEO_FORMAT_VYUY, formats::VYUY },
>>  	{ GST_VIDEO_FORMAT_YUY2, formats::YUYV },
>>  	{ GST_VIDEO_FORMAT_YVYU, formats::YVYU },
>> +
>> +	/* Planar Formats */
>> +	{ GST_VIDEO_FORMAT_I420, formats::YUV420 },
>> +	{ GST_VIDEO_FORMAT_YV12, formats::YVU420 },
>> +	{ GST_VIDEO_FORMAT_Y42B, formats::YUV422 },
> 
> I would have put the planar formats just after the semi-planar, but that
> doesn't matter much.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> +
>>  	/* \todo NV42 is used in libcamera but is not mapped in GStreamer yet. */

Isn't it the right time for it ? Or is there a big issue to solve to
remove this todo ?

For the patch:
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>

>>  };
>>  
>
Laurent Pinchart Sept. 21, 2021, 4:51 p.m. UTC | #3
On Tue, Sep 21, 2021 at 06:44:10PM +0200, Jean-Michel Hautbois wrote:
> On 21/09/2021 18:40, Laurent Pinchart wrote:
> > On Tue, Sep 21, 2021 at 04:35:15PM +0100, Kieran Bingham wrote:
> >> Existing pipeline handlers already support planar YUV formats.
> >> Extend the gstreamer format map to incorporate them.
> >>
> >> While here, split the formats into distinct groups.
> >>
> >> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> >> ---
> >>  src/gstreamer/gstlibcamera-utils.cpp | 13 +++++++++++++
> >>  1 file changed, 13 insertions(+)
> >>
> >> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> >> index 0af91c1acb67..5636f3e7e1a6 100644
> >> --- a/src/gstreamer/gstlibcamera-utils.cpp
> >> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> >> @@ -16,19 +16,32 @@ static struct {
> >>  	GstVideoFormat gst_format;
> >>  	PixelFormat format;
> >>  } format_map[] = {
> >> +	/* Compressed */
> >>  	{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },
> >> +
> >> +	/* RGB */
> >>  	{ GST_VIDEO_FORMAT_RGB, formats::BGR888 },
> >>  	{ GST_VIDEO_FORMAT_BGR, formats::RGB888 },
> >>  	{ GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 },
> >> +
> >> +	/* YUV Semiplanar */
> >>  	{ GST_VIDEO_FORMAT_NV12, formats::NV12 },
> >>  	{ GST_VIDEO_FORMAT_NV21, formats::NV21 },
> >>  	{ GST_VIDEO_FORMAT_NV16, formats::NV16 },
> >>  	{ GST_VIDEO_FORMAT_NV61, formats::NV61 },
> >>  	{ GST_VIDEO_FORMAT_NV24, formats::NV24 },
> >> +
> >> +	/* YUV Packed */
> >>  	{ GST_VIDEO_FORMAT_UYVY, formats::UYVY },
> >>  	{ GST_VIDEO_FORMAT_VYUY, formats::VYUY },
> >>  	{ GST_VIDEO_FORMAT_YUY2, formats::YUYV },
> >>  	{ GST_VIDEO_FORMAT_YVYU, formats::YVYU },
> >> +
> >> +	/* Planar Formats */
> >> +	{ GST_VIDEO_FORMAT_I420, formats::YUV420 },
> >> +	{ GST_VIDEO_FORMAT_YV12, formats::YVU420 },
> >> +	{ GST_VIDEO_FORMAT_Y42B, formats::YUV422 },
> > 
> > I would have put the planar formats just after the semi-planar, but that
> > doesn't matter much.
> > 
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > 
> >> +
> >>  	/* \todo NV42 is used in libcamera but is not mapped in GStreamer yet. */
> 
> Isn't it the right time for it ? Or is there a big issue to solve to
> remove this todo ?

As far as I know, GStreamer doesn't have a semi-planar YUV 4:4:4 format
with the chroma data interleaved in VU order
(https://gstreamer.freedesktop.org/documentation/video/video-format.html).

> For the patch:
> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> 
> >>  };
> >>
Thorsten von Eicken Sept. 21, 2021, 7:47 p.m. UTC | #4
Thanks!!

On 9/21/21 08:35, Kieran Bingham wrote:
> Existing pipeline handlers already support planar YUV formats.
> Extend the gstreamer format map to incorporate them.
>
> While here, split the formats into distinct groups.
>
> Signed-off-by: Kieran Bingham<kieran.bingham@ideasonboard.com>
> ---
>   src/gstreamer/gstlibcamera-utils.cpp | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
>
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> index 0af91c1acb67..5636f3e7e1a6 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -16,19 +16,32 @@ static struct {
>   	GstVideoFormat gst_format;
>   	PixelFormat format;
>   } format_map[] = {
> +	/* Compressed */
>   	{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },
> +
> +	/* RGB */
>   	{ GST_VIDEO_FORMAT_RGB, formats::BGR888 },
>   	{ GST_VIDEO_FORMAT_BGR, formats::RGB888 },
>   	{ GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 },
> +
> +	/* YUV Semiplanar */
>   	{ GST_VIDEO_FORMAT_NV12, formats::NV12 },
>   	{ GST_VIDEO_FORMAT_NV21, formats::NV21 },
>   	{ GST_VIDEO_FORMAT_NV16, formats::NV16 },
>   	{ GST_VIDEO_FORMAT_NV61, formats::NV61 },
>   	{ GST_VIDEO_FORMAT_NV24, formats::NV24 },
> +
> +	/* YUV Packed */
>   	{ GST_VIDEO_FORMAT_UYVY, formats::UYVY },
>   	{ GST_VIDEO_FORMAT_VYUY, formats::VYUY },
>   	{ GST_VIDEO_FORMAT_YUY2, formats::YUYV },
>   	{ GST_VIDEO_FORMAT_YVYU, formats::YVYU },
> +
> +	/* Planar Formats */
> +	{ GST_VIDEO_FORMAT_I420, formats::YUV420 },
> +	{ GST_VIDEO_FORMAT_YV12, formats::YVU420 },
> +	{ GST_VIDEO_FORMAT_Y42B, formats::YUV422 },
> +
>   	/* \todo NV42 is used in libcamera but is not mapped in GStreamer yet. */
>   };
>
Nicolas Dufresne Sept. 21, 2021, 8:27 p.m. UTC | #5
Le mardi 21 septembre 2021 à 19:51 +0300, Laurent Pinchart a écrit :
> On Tue, Sep 21, 2021 at 06:44:10PM +0200, Jean-Michel Hautbois wrote:
> > On 21/09/2021 18:40, Laurent Pinchart wrote:
> > > On Tue, Sep 21, 2021 at 04:35:15PM +0100, Kieran Bingham wrote:
> > > > Existing pipeline handlers already support planar YUV formats.
> > > > Extend the gstreamer format map to incorporate them.
> > > > 
> > > > While here, split the formats into distinct groups.
> > > > 
> > > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > > > ---
> > > >  src/gstreamer/gstlibcamera-utils.cpp | 13 +++++++++++++
> > > >  1 file changed, 13 insertions(+)
> > > > 
> > > > diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> > > > index 0af91c1acb67..5636f3e7e1a6 100644
> > > > --- a/src/gstreamer/gstlibcamera-utils.cpp
> > > > +++ b/src/gstreamer/gstlibcamera-utils.cpp
> > > > @@ -16,19 +16,32 @@ static struct {
> > > >  	GstVideoFormat gst_format;
> > > >  	PixelFormat format;
> > > >  } format_map[] = {
> > > > +	/* Compressed */
> > > >  	{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },
> > > > +
> > > > +	/* RGB */
> > > >  	{ GST_VIDEO_FORMAT_RGB, formats::BGR888 },
> > > >  	{ GST_VIDEO_FORMAT_BGR, formats::RGB888 },
> > > >  	{ GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 },
> > > > +
> > > > +	/* YUV Semiplanar */
> > > >  	{ GST_VIDEO_FORMAT_NV12, formats::NV12 },
> > > >  	{ GST_VIDEO_FORMAT_NV21, formats::NV21 },
> > > >  	{ GST_VIDEO_FORMAT_NV16, formats::NV16 },
> > > >  	{ GST_VIDEO_FORMAT_NV61, formats::NV61 },
> > > >  	{ GST_VIDEO_FORMAT_NV24, formats::NV24 },
> > > > +
> > > > +	/* YUV Packed */
> > > >  	{ GST_VIDEO_FORMAT_UYVY, formats::UYVY },
> > > >  	{ GST_VIDEO_FORMAT_VYUY, formats::VYUY },
> > > >  	{ GST_VIDEO_FORMAT_YUY2, formats::YUYV },
> > > >  	{ GST_VIDEO_FORMAT_YVYU, formats::YVYU },
> > > > +
> > > > +	/* Planar Formats */
> > > > +	{ GST_VIDEO_FORMAT_I420, formats::YUV420 },
> > > > +	{ GST_VIDEO_FORMAT_YV12, formats::YVU420 },
> > > > +	{ GST_VIDEO_FORMAT_Y42B, formats::YUV422 },
> > > 
> > > I would have put the planar formats just after the semi-planar, but that
> > > doesn't matter much.
> > > 
> > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > 
> > > > +
> > > >  	/* \todo NV42 is used in libcamera but is not mapped in GStreamer yet. */
> > 
> > Isn't it the right time for it ? Or is there a big issue to solve to
> > remove this todo ?
> 
> As far as I know, GStreamer doesn't have a semi-planar YUV 4:4:4 format
> with the chroma data interleaved in VU order
> (https://gstreamer.freedesktop.org/documentation/video/video-format.html).

This is a simple thing to add to GStreamer, since NV24 is nearly identical, but
thi is about adding it in libgstvideo.

> 
> > For the patch:
> > Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> > 
> > > >  };
> > > >  
>
Paul Elder Sept. 22, 2021, 5 a.m. UTC | #6
Hi Kieran,

On Tue, Sep 21, 2021 at 04:35:15PM +0100, Kieran Bingham wrote:
> Existing pipeline handlers already support planar YUV formats.
> Extend the gstreamer format map to incorporate them.
> 
> While here, split the formats into distinct groups.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/gstreamer/gstlibcamera-utils.cpp | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> index 0af91c1acb67..5636f3e7e1a6 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -16,19 +16,32 @@ static struct {
>  	GstVideoFormat gst_format;
>  	PixelFormat format;
>  } format_map[] = {
> +	/* Compressed */
>  	{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },
> +
> +	/* RGB */
>  	{ GST_VIDEO_FORMAT_RGB, formats::BGR888 },
>  	{ GST_VIDEO_FORMAT_BGR, formats::RGB888 },
>  	{ GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 },
> +
> +	/* YUV Semiplanar */
>  	{ GST_VIDEO_FORMAT_NV12, formats::NV12 },
>  	{ GST_VIDEO_FORMAT_NV21, formats::NV21 },
>  	{ GST_VIDEO_FORMAT_NV16, formats::NV16 },
>  	{ GST_VIDEO_FORMAT_NV61, formats::NV61 },
>  	{ GST_VIDEO_FORMAT_NV24, formats::NV24 },
> +
> +	/* YUV Packed */
>  	{ GST_VIDEO_FORMAT_UYVY, formats::UYVY },
>  	{ GST_VIDEO_FORMAT_VYUY, formats::VYUY },
>  	{ GST_VIDEO_FORMAT_YUY2, formats::YUYV },
>  	{ GST_VIDEO_FORMAT_YVYU, formats::YVYU },
> +
> +	/* Planar Formats */
> +	{ GST_VIDEO_FORMAT_I420, formats::YUV420 },
> +	{ GST_VIDEO_FORMAT_YV12, formats::YVU420 },
> +	{ GST_VIDEO_FORMAT_Y42B, formats::YUV422 },
> +
>  	/* \todo NV42 is used in libcamera but is not mapped in GStreamer yet. */
>  };
>  
> -- 
> 2.30.2
>
Nicolas Dufresne Sept. 22, 2021, 2:21 p.m. UTC | #7
Le mercredi 22 septembre 2021 à 14:00 +0900, paul.elder@ideasonboard.com a
écrit :
> Hi Kieran,
> 
> On Tue, Sep 21, 2021 at 04:35:15PM +0100, Kieran Bingham wrote:
> > Existing pipeline handlers already support planar YUV formats.
> > Extend the gstreamer format map to incorporate them.
> > 
> > While here, split the formats into distinct groups.
> > 
> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> 
> > ---
> >  src/gstreamer/gstlibcamera-utils.cpp | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> > 
> > diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> > index 0af91c1acb67..5636f3e7e1a6 100644
> > --- a/src/gstreamer/gstlibcamera-utils.cpp
> > +++ b/src/gstreamer/gstlibcamera-utils.cpp
> > @@ -16,19 +16,32 @@ static struct {
> >  	GstVideoFormat gst_format;
> >  	PixelFormat format;
> >  } format_map[] = {
> > +	/* Compressed */
> >  	{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },
> > +
> > +	/* RGB */
> >  	{ GST_VIDEO_FORMAT_RGB, formats::BGR888 },
> >  	{ GST_VIDEO_FORMAT_BGR, formats::RGB888 },
> >  	{ GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 },
> > +
> > +	/* YUV Semiplanar */
> >  	{ GST_VIDEO_FORMAT_NV12, formats::NV12 },
> >  	{ GST_VIDEO_FORMAT_NV21, formats::NV21 },
> >  	{ GST_VIDEO_FORMAT_NV16, formats::NV16 },
> >  	{ GST_VIDEO_FORMAT_NV61, formats::NV61 },
> >  	{ GST_VIDEO_FORMAT_NV24, formats::NV24 },
> > +
> > +	/* YUV Packed */
> >  	{ GST_VIDEO_FORMAT_UYVY, formats::UYVY },
> >  	{ GST_VIDEO_FORMAT_VYUY, formats::VYUY },
> >  	{ GST_VIDEO_FORMAT_YUY2, formats::YUYV },
> >  	{ GST_VIDEO_FORMAT_YVYU, formats::YVYU },
> > +
> > +	/* Planar Formats */
> > +	{ GST_VIDEO_FORMAT_I420, formats::YUV420 },
> > +	{ GST_VIDEO_FORMAT_YV12, formats::YVU420 },
> > +	{ GST_VIDEO_FORMAT_Y42B, formats::YUV422 },
> > +
> >  	/* \todo NV42 is used in libcamera but is not mapped in GStreamer yet. */
> >  };
> >  
> > -- 
> > 2.30.2
> >
Kieran Bingham Sept. 22, 2021, 2:35 p.m. UTC | #8
Hi Nicolas,

On 22/09/2021 15:21, Nicolas Dufresne wrote:
> Le mercredi 22 septembre 2021 à 14:00 +0900, paul.elder@ideasonboard.com a
> écrit :
>> Hi Kieran,
>>
>> On Tue, Sep 21, 2021 at 04:35:15PM +0100, Kieran Bingham wrote:
>>> Existing pipeline handlers already support planar YUV formats.
>>> Extend the gstreamer format map to incorporate them.
>>>
>>> While here, split the formats into distinct groups.
>>>
>>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>>
>> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
> 
> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

Thanks, I'll collect this, but a v2 was posted this morning swapping the
ordering as suggested by Laurent.

Anyone have any good solutions for marking patches as superceeded in
e-mail based reviews to prevent reviewing older versions of patches?

--
Kieran


>>
>>> ---
>>>  src/gstreamer/gstlibcamera-utils.cpp | 13 +++++++++++++
>>>  1 file changed, 13 insertions(+)
>>>
>>> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
>>> index 0af91c1acb67..5636f3e7e1a6 100644
>>> --- a/src/gstreamer/gstlibcamera-utils.cpp
>>> +++ b/src/gstreamer/gstlibcamera-utils.cpp
>>> @@ -16,19 +16,32 @@ static struct {
>>>  	GstVideoFormat gst_format;
>>>  	PixelFormat format;
>>>  } format_map[] = {
>>> +	/* Compressed */
>>>  	{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },
>>> +
>>> +	/* RGB */
>>>  	{ GST_VIDEO_FORMAT_RGB, formats::BGR888 },
>>>  	{ GST_VIDEO_FORMAT_BGR, formats::RGB888 },
>>>  	{ GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 },
>>> +
>>> +	/* YUV Semiplanar */
>>>  	{ GST_VIDEO_FORMAT_NV12, formats::NV12 },
>>>  	{ GST_VIDEO_FORMAT_NV21, formats::NV21 },
>>>  	{ GST_VIDEO_FORMAT_NV16, formats::NV16 },
>>>  	{ GST_VIDEO_FORMAT_NV61, formats::NV61 },
>>>  	{ GST_VIDEO_FORMAT_NV24, formats::NV24 },
>>> +
>>> +	/* YUV Packed */
>>>  	{ GST_VIDEO_FORMAT_UYVY, formats::UYVY },
>>>  	{ GST_VIDEO_FORMAT_VYUY, formats::VYUY },
>>>  	{ GST_VIDEO_FORMAT_YUY2, formats::YUYV },
>>>  	{ GST_VIDEO_FORMAT_YVYU, formats::YVYU },
>>> +
>>> +	/* Planar Formats */
>>> +	{ GST_VIDEO_FORMAT_I420, formats::YUV420 },
>>> +	{ GST_VIDEO_FORMAT_YV12, formats::YVU420 },
>>> +	{ GST_VIDEO_FORMAT_Y42B, formats::YUV422 },
>>> +
>>>  	/* \todo NV42 is used in libcamera but is not mapped in GStreamer yet. */
>>>  };
>>>  
>>> -- 
>>> 2.30.2
>>>
> 
>
Nicolas Dufresne Sept. 22, 2021, 3:31 p.m. UTC | #9
Le mercredi 22 septembre 2021 à 15:35 +0100, Kieran Bingham a écrit :
> Hi Nicolas,
> 
> On 22/09/2021 15:21, Nicolas Dufresne wrote:
> > Le mercredi 22 septembre 2021 à 14:00 +0900, paul.elder@ideasonboard.com a
> > écrit :
> > > Hi Kieran,
> > > 
> > > On Tue, Sep 21, 2021 at 04:35:15PM +0100, Kieran Bingham wrote:
> > > > Existing pipeline handlers already support planar YUV formats.
> > > > Extend the gstreamer format map to incorporate them.
> > > > 
> > > > While here, split the formats into distinct groups.
> > > > 
> > > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > > 
> > > Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
> > 
> > Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> 
> Thanks, I'll collect this, but a v2 was posted this morning swapping the
> ordering as suggested by Laurent.
> 
> Anyone have any good solutions for marking patches as superceeded in
> e-mail based reviews to prevent reviewing older versions of patches?

Beauty of emails reviews. I don't think you can fix this one.

regards,
Nicolas

> 
> --
> Kieran
> 
> 
> > > 
> > > > ---
> > > >  src/gstreamer/gstlibcamera-utils.cpp | 13 +++++++++++++
> > > >  1 file changed, 13 insertions(+)
> > > > 
> > > > diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> > > > index 0af91c1acb67..5636f3e7e1a6 100644
> > > > --- a/src/gstreamer/gstlibcamera-utils.cpp
> > > > +++ b/src/gstreamer/gstlibcamera-utils.cpp
> > > > @@ -16,19 +16,32 @@ static struct {
> > > >  	GstVideoFormat gst_format;
> > > >  	PixelFormat format;
> > > >  } format_map[] = {
> > > > +	/* Compressed */
> > > >  	{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },
> > > > +
> > > > +	/* RGB */
> > > >  	{ GST_VIDEO_FORMAT_RGB, formats::BGR888 },
> > > >  	{ GST_VIDEO_FORMAT_BGR, formats::RGB888 },
> > > >  	{ GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 },
> > > > +
> > > > +	/* YUV Semiplanar */
> > > >  	{ GST_VIDEO_FORMAT_NV12, formats::NV12 },
> > > >  	{ GST_VIDEO_FORMAT_NV21, formats::NV21 },
> > > >  	{ GST_VIDEO_FORMAT_NV16, formats::NV16 },
> > > >  	{ GST_VIDEO_FORMAT_NV61, formats::NV61 },
> > > >  	{ GST_VIDEO_FORMAT_NV24, formats::NV24 },
> > > > +
> > > > +	/* YUV Packed */
> > > >  	{ GST_VIDEO_FORMAT_UYVY, formats::UYVY },
> > > >  	{ GST_VIDEO_FORMAT_VYUY, formats::VYUY },
> > > >  	{ GST_VIDEO_FORMAT_YUY2, formats::YUYV },
> > > >  	{ GST_VIDEO_FORMAT_YVYU, formats::YVYU },
> > > > +
> > > > +	/* Planar Formats */
> > > > +	{ GST_VIDEO_FORMAT_I420, formats::YUV420 },
> > > > +	{ GST_VIDEO_FORMAT_YV12, formats::YVU420 },
> > > > +	{ GST_VIDEO_FORMAT_Y42B, formats::YUV422 },
> > > > +
> > > >  	/* \todo NV42 is used in libcamera but is not mapped in GStreamer yet. */
> > > >  };
> > > >  
> > > > -- 
> > > > 2.30.2
> > > > 
> > 
> >

Patch
diff mbox series

diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
index 0af91c1acb67..5636f3e7e1a6 100644
--- a/src/gstreamer/gstlibcamera-utils.cpp
+++ b/src/gstreamer/gstlibcamera-utils.cpp
@@ -16,19 +16,32 @@  static struct {
 	GstVideoFormat gst_format;
 	PixelFormat format;
 } format_map[] = {
+	/* Compressed */
 	{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },
+
+	/* RGB */
 	{ GST_VIDEO_FORMAT_RGB, formats::BGR888 },
 	{ GST_VIDEO_FORMAT_BGR, formats::RGB888 },
 	{ GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 },
+
+	/* YUV Semiplanar */
 	{ GST_VIDEO_FORMAT_NV12, formats::NV12 },
 	{ GST_VIDEO_FORMAT_NV21, formats::NV21 },
 	{ GST_VIDEO_FORMAT_NV16, formats::NV16 },
 	{ GST_VIDEO_FORMAT_NV61, formats::NV61 },
 	{ GST_VIDEO_FORMAT_NV24, formats::NV24 },
+
+	/* YUV Packed */
 	{ GST_VIDEO_FORMAT_UYVY, formats::UYVY },
 	{ GST_VIDEO_FORMAT_VYUY, formats::VYUY },
 	{ GST_VIDEO_FORMAT_YUY2, formats::YUYV },
 	{ GST_VIDEO_FORMAT_YVYU, formats::YVYU },
+
+	/* Planar Formats */
+	{ GST_VIDEO_FORMAT_I420, formats::YUV420 },
+	{ GST_VIDEO_FORMAT_YV12, formats::YVU420 },
+	{ GST_VIDEO_FORMAT_Y42B, formats::YUV422 },
+
 	/* \todo NV42 is used in libcamera but is not mapped in GStreamer yet. */
 };