Skip to contentSkip to conversation

media: usb: uvc: Add UVC_GUID_FORMAT_H265

PATCH In review James_Lin 4 participants 7 messages Apr 18, 2022 – Apr 24, 2022

Subsystems (3)
lore
Share & tools
lore

James_Lin

author
#0 lore raw

PATCH v3 1/1 media: usb: uvc: Add UVC_GUID_FORMAT_H265

This patch aims to add UVC_GUID_FORMAT_H265
High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2. They describe the same video encoding method.
So for handling their behavior is the same.
However, when external camera device describes this encoding method, some use hevc, some use h265.
There is no uniform specification to describe this encoding method. So if an external camera device use h265 to describe this encoding method, driver will not recognize it.
Therefore, this patch is to enable driver to read HEVC/H265
and convert it to V4L2_PIX_FMT_HEVC.

---
 drivers/media/usb/uvc/uvc_driver.c | 5 +++++
 drivers/media/usb/uvc/uvcvideo.h   | 3 +++
 2 files changed, 8 insertions(+)
drivers/media/usb/uvc/uvc_driver.c +5 -0
index dda0f0aa78b8..e437e9f95890 100644
@@ -154,6 +154,11 @@ static struct uvc_format_desc uvc_fmts[] = {
 		.guid		= UVC_GUID_FORMAT_H264,
 		.fcc		= V4L2_PIX_FMT_H264,
 	},
+	{
+		.name		= "H.265",
+		.guid		= UVC_GUID_FORMAT_H265,
+		.fcc		= V4L2_PIX_FMT_HEVC,
+	},
 	{
 		.name		= "Greyscale 8 L/R (Y8I)",
 		.guid		= UVC_GUID_FORMAT_Y8I,
drivers/media/usb/uvc/uvcvideo.h +3 -0
index 143230b3275b..41f4d8c33f2a 100644
@@ -139,6 +139,9 @@
 #define UVC_GUID_FORMAT_H264 \
 	{ 'H',  '2',  '6',  '4', 0x00, 0x00, 0x10, 0x00, \
 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_H265 \
+	{ 'H',  '2',  '6',  '5', 0x00, 0x00, 0x10, 0x00, \
+	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
 #define UVC_GUID_FORMAT_Y8I \
 	{ 'Y',  '8',  'I',  ' ', 0x00, 0x00, 0x10, 0x00, \
 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
Signature · 1 line
2.18.0
Reviewed-by on v3 1/1
#1 lore raw

Hi James

Thanks for your patch

Quoted 13 lines · James_Lin

This patch aims to add UVC_GUID_FORMAT_H265
High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2. They describe the same video encoding method.
So for handling their behavior is the same.
However, when external camera device describes this encoding method, some use hevc, some use h265.
There is no uniform specification to describe this encoding method. So if an external camera device use h265 to describe this encoding method, driver will not recognize it.
Therefore, this patch is to enable driver to read HEVC/H265
and convert it to V4L2_PIX_FMT_HEVC.

Quoted 1 line

drivers/media/usb/uvc/uvc_driver.c static struct uvc_format_desc uvc_fmts[] = { · line 156

Quoted 13 lines
---
 drivers/media/usb/uvc/uvc_driver.c | 5 +++++
 drivers/media/usb/uvc/uvcvideo.h   | 3 +++
 2 files changed, 8 insertions(+)
drivers/media/usb/uvc/uvc_driver.c +0 -0
index dda0f0aa78b8..e437e9f95890 100644
@@ -154,6 +154,11 @@ static struct uvc_format_desc uvc_fmts[] = {
                .guid           = UVC_GUID_FORMAT_H264,
                .fcc            = V4L2_PIX_FMT_H264,
        },

Maybe I would add a comment here saying that some cameras represent hevc as h265.

Quoted 25 lines
drivers/media/usb/uvc/uvc_driver.c +5 -0
+       {
+               .name           = "H.265",
+               .guid           = UVC_GUID_FORMAT_H265,
+               .fcc            = V4L2_PIX_FMT_HEVC,
+       },
        {
                .name           = "Greyscale 8 L/R (Y8I)",
                .guid           = UVC_GUID_FORMAT_Y8I,
drivers/media/usb/uvc/uvcvideo.h +3 -1
index 143230b3275b..41f4d8c33f2a 100644
@@ -139,6 +139,9 @@
 #define UVC_GUID_FORMAT_H264 \
        { 'H',  '2',  '6',  '4', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_H265 \
+       { 'H',  '2',  '6',  '5', 0x00, 0x00, 0x10, 0x00, \
+        0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
 #define UVC_GUID_FORMAT_Y8I \
        { 'Y',  '8',  'I',  ' ', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
--

2.18.0

Signature · 1 line
Ricardo Ribalda
maintainer Reviewed-by
#2 lore raw

Hello,

Quoted 22 lines · Ricardo Ribalda
Quoted 13 lines · James_Lin

This patch aims to add UVC_GUID_FORMAT_H265
High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2. They describe the same video encoding method.
So for handling their behavior is the same.
However, when external camera device describes this encoding method, some use hevc, some use h265.
There is no uniform specification to describe this encoding method. So if an external camera device use h265 to describe this encoding method, driver will not recognize it.
Therefore, this patch is to enable driver to read HEVC/H265
and convert it to V4L2_PIX_FMT_HEVC.

Quoted 1 line
Quoted 5 lines
---
 drivers/media/usb/uvc/uvc_driver.c | 5 +++++
 drivers/media/usb/uvc/uvcvideo.h   | 3 +++
 2 files changed, 8 insertions(+)
Quoted 11 lines

drivers/media/usb/uvc/uvc_driver.c static struct uvc_format_desc uvc_fmts[] = { · line 156

Quoted 8 lines
drivers/media/usb/uvc/uvc_driver.c +0 -0
index dda0f0aa78b8..e437e9f95890 100644
@@ -154,6 +154,11 @@ static struct uvc_format_desc uvc_fmts[] = {
                .guid           = UVC_GUID_FORMAT_H264,
                .fcc            = V4L2_PIX_FMT_H264,
        },

Maybe I would add a comment here saying that some cameras represent hevc as h265.

I wish there would be a 4CC and GUID standard with a centralized registry...

Quoted 22 lines
Quoted 22 lines
drivers/media/usb/uvc/uvc_driver.c +5 -0
+       {
+               .name           = "H.265",
+               .guid           = UVC_GUID_FORMAT_H265,
+               .fcc            = V4L2_PIX_FMT_HEVC,
+       },
        {
                .name           = "Greyscale 8 L/R (Y8I)",
                .guid           = UVC_GUID_FORMAT_Y8I,
drivers/media/usb/uvc/uvcvideo.h +3 -0
index 143230b3275b..41f4d8c33f2a 100644
@@ -139,6 +139,9 @@
 #define UVC_GUID_FORMAT_H264 \
        { 'H',  '2',  '6',  '4', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_H265 \
+       { 'H',  '2',  '6',  '5', 0x00, 0x00, 0x10, 0x00, \
+        0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
 #define UVC_GUID_FORMAT_Y8I \
        { 'Y',  '8',  'I',  ' ', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
Signature · 3 lines
Regards,

Laurent Pinchart
#3 lore raw
Quoted 38 lines · Laurent Pinchart

Hello,

Quoted 22 lines · Ricardo Ribalda
Quoted 13 lines · James_Lin

This patch aims to add UVC_GUID_FORMAT_H265
High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2. They describe the same video encoding method.
So for handling their behavior is the same.
However, when external camera device describes this encoding method, some use hevc, some use h265.
There is no uniform specification to describe this encoding method. So if an external camera device use h265 to describe this encoding method, driver will not recognize it.
Therefore, this patch is to enable driver to read HEVC/H265
and convert it to V4L2_PIX_FMT_HEVC.

Quoted 1 line
Quoted 5 lines
---
 drivers/media/usb/uvc/uvc_driver.c | 5 +++++
 drivers/media/usb/uvc/uvcvideo.h   | 3 +++
 2 files changed, 8 insertions(+)
Quoted 11 lines

drivers/media/usb/uvc/uvc_driver.c static struct uvc_format_desc uvc_fmts[] = { · line 156

Quoted 8 lines
drivers/media/usb/uvc/uvc_driver.c +0 -0
index dda0f0aa78b8..e437e9f95890 100644
@@ -154,6 +154,11 @@ static struct uvc_format_desc uvc_fmts[] = {
                .guid           = UVC_GUID_FORMAT_H264,
                .fcc            = V4L2_PIX_FMT_H264,
        },

Maybe I would add a comment here saying that some cameras represent hevc as h265.

Quoted 2 lines

I wish there would be a 4CC and GUID standard with a centralized registry...

Thought that was the kernel codebase :)

Quoted 30 lines
Quoted 14 lines
Quoted 14 lines
drivers/media/usb/uvc/uvc_driver.c +5 -0
+       {
+               .name           = "H.265",
+               .guid           = UVC_GUID_FORMAT_H265,
+               .fcc            = V4L2_PIX_FMT_HEVC,
+       },
        {
                .name           = "Greyscale 8 L/R (Y8I)",
                .guid           = UVC_GUID_FORMAT_Y8I,
drivers/media/usb/uvc/uvcvideo.h +0 -0
index 143230b3275b..41f4d8c33f2a 100644
@@ -139,6 +139,9 @@
 #define UVC_GUID_FORMAT_H264 \
Quoted 8 lines

drivers/media/usb/uvc/uvcvideo.h line 147

Quoted 8 lines
drivers/media/usb/uvc/uvcvideo.h +3 -0
        { 'H',  '2',  '6',  '4', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_H265 \
+       { 'H',  '2',  '6',  '5', 0x00, 0x00, 0x10, 0x00, \
+        0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
 #define UVC_GUID_FORMAT_Y8I \
        { 'Y',  '8',  'I',  ' ', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}

--
Regards,

Laurent Pinchart

Signature · 1 line
Ricardo Ribalda
#4 lore raw

Le mardi 19 avril 2022 à 14:18 +0200, Ricardo Ribalda a écrit :

Quoted 40 lines
Quoted 38 lines · Laurent Pinchart

Hello,

Quoted 33 lines · Ricardo Ribalda
Quoted 13 lines · James_Lin

This patch aims to add UVC_GUID_FORMAT_H265
High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2. They describe the same video encoding method.
So for handling their behavior is the same.
However, when external camera device describes this encoding method, some use hevc, some use h265.
There is no uniform specification to describe this encoding method. So if an external camera device use h265 to describe this encoding method, driver will not recognize it.
Therefore, this patch is to enable driver to read HEVC/H265
and convert it to V4L2_PIX_FMT_HEVC.

Quoted 1 line

drivers/media/usb/uvc/uvc_driver.c static struct uvc_format_desc uvc_fmts[] = { · line 156

Quoted 13 lines
---
 drivers/media/usb/uvc/uvc_driver.c | 5 +++++
 drivers/media/usb/uvc/uvcvideo.h   | 3 +++
 2 files changed, 8 insertions(+)
drivers/media/usb/uvc/uvc_driver.c +0 -0
index dda0f0aa78b8..e437e9f95890 100644
@@ -154,6 +154,11 @@ static struct uvc_format_desc uvc_fmts[] = {
                .guid           = UVC_GUID_FORMAT_H264,
                .fcc            = V4L2_PIX_FMT_H264,
        },

Maybe I would add a comment here saying that some cameras represent hevc as h265.

Quoted 4 lines
Quoted 2 lines

I wish there would be a 4CC and GUID standard with a centralized registry...

Thought that was the kernel codebase :)

You'll find multiple fourcc for the same thing in the linux kernel ;-P

Quoted 34 lines
Quoted 31 lines
Quoted 14 lines
Quoted 14 lines
drivers/media/usb/uvc/uvc_driver.c +5 -0
+       {
+               .name           = "H.265",
+               .guid           = UVC_GUID_FORMAT_H265,
+               .fcc            = V4L2_PIX_FMT_HEVC,
+       },
        {
                .name           = "Greyscale 8 L/R (Y8I)",
                .guid           = UVC_GUID_FORMAT_Y8I,
drivers/media/usb/uvc/uvcvideo.h +0 -0
index 143230b3275b..41f4d8c33f2a 100644
@@ -139,6 +139,9 @@
 #define UVC_GUID_FORMAT_H264 \
Quoted 8 lines

drivers/media/usb/uvc/uvcvideo.h line 147

Quoted 8 lines
drivers/media/usb/uvc/uvcvideo.h +3 -0
        { 'H',  '2',  '6',  '4', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_H265 \
+       { 'H',  '2',  '6',  '5', 0x00, 0x00, 0x10, 0x00, \
+        0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
 #define UVC_GUID_FORMAT_Y8I \
        { 'Y',  '8',  'I',  ' ', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}

--
Regards,

Laurent Pinchart

author
#5 lore raw

Hi All,

Do I need to add the comment
"some cameras represent hevc as h265"
at /drivers/media/usb/uvc/uvc_driver.c ?
Also, is there anything else that needs to be modified?

Or can it move to queue on next merged window?
thanks for your reply

Best regards,
James_Lin

Quoted 84 lines · Nicolas Dufresne
Quoted 41 lines · Ricardo Ribalda
Quoted 39 lines · Laurent Pinchart

Hello,

Quoted 34 lines · Ricardo Ribalda
Quoted 13 lines · James_Lin

This patch aims to add UVC_GUID_FORMAT_H265 High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2. They describe the same video encoding method.
So for handling their behavior is the same.
However, when external camera device describes this encoding method, some use hevc, some use h265.
There is no uniform specification to describe this encoding method. So if an external camera device use h265 to describe this encoding method, driver will not recognize it. Therefore, this patch is to enable driver to read HEVC/H265 and convert it to V4L2_PIX_FMT_HEVC.

Quoted 1 line
Quoted 11 lines
---
 drivers/media/usb/uvc/uvc_driver.c | 5 +++++
 drivers/media/usb/uvc/uvcvideo.h   | 3 +++
 2 files changed, 8 insertions(+)
drivers/media/usb/uvc/uvc_driver.c +0 -0
index dda0f0aa78b8..e437e9f95890 100644

drivers/media/usb/uvc/uvc_driver.c static struct uvc_format_desc uvc_fmts[] = { · line 156

Quoted 3 lines
drivers/media/usb/uvc/uvc_driver.c +0 -0
@@ -154,6 +154,11 @@ static struct uvc_format_desc uvc_fmts[] = {
                .guid           = UVC_GUID_FORMAT_H264,
                .fcc            = V4L2_PIX_FMT_H264,
        },

Maybe I would add a comment here saying that some cameras represent hevc as h265.

Quoted 4 lines
Quoted 2 lines

I wish there would be a 4CC and GUID standard with a centralized registry...

Thought that was the kernel codebase :)

You'll find multiple fourcc for the same thing in the linux kernel ;-P

Quoted 35 lines
Quoted 32 lines
Quoted 15 lines
Quoted 15 lines
drivers/media/usb/uvc/uvc_driver.c +5 -0
+       {
+               .name           = "H.265",
+               .guid           = UVC_GUID_FORMAT_H265,
+               .fcc            = V4L2_PIX_FMT_HEVC,
+       },
        {
                .name           = "Greyscale 8 L/R (Y8I)",
                .guid           = UVC_GUID_FORMAT_Y8I,
drivers/media/usb/uvc/uvcvideo.h +0 -0
index 143230b3275b..41f4d8c33f2a 100644
@@ -139,6 +139,9 @@
 #define UVC_GUID_FORMAT_H264 \
Quoted 8 lines

drivers/media/usb/uvc/uvcvideo.h line 147

Quoted 8 lines
drivers/media/usb/uvc/uvcvideo.h +3 -0
        { 'H',  '2',  '6',  '4', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_H265 \
+       { 'H',  '2',  '6',  '5', 0x00, 0x00, 0x10, 0x00, \
+        0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
 #define UVC_GUID_FORMAT_Y8I \
        { 'Y',  '8',  'I',  ' ', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}

--
Regards,

Laurent Pinchart

maintainer
#6 lore raw

Hi James,

Quoted 9 lines · James_Lin

Hi All,

Do I need to add the comment
"some cameras represent hevc as h265"
at /drivers/media/usb/uvc/uvc_driver.c ?
Also, is there anything else that needs to be modified?

Or can it move to queue on next merged window?
thanks for your reply

I've queued the patch in my tree and will send a pull request. I don't think we need an additional comment, H.265 and HEVC being used interchangeably isn't specific to UVC, and if someone gets puzzled by this in the uvcvideo driver, there's always the git history.

Quoted 71 lines · Nicolas Dufresne
Quoted 70 lines · Ricardo Ribalda
Quoted 37 lines · Laurent Pinchart
Quoted 36 lines · Ricardo Ribalda
Quoted 34 lines · James_Lin
Quoted 13 lines

This patch aims to add UVC_GUID_FORMAT_H265 High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2. They describe the same video encoding method.
So for handling their behavior is the same.
However, when external camera device describes this encoding method, some use hevc, some use h265.
There is no uniform specification to describe this encoding method. So if an external camera device use h265 to describe this encoding method, driver will not recognize it. Therefore, this patch is to enable driver to read HEVC/H265 and convert it to V4L2_PIX_FMT_HEVC.

Quoted 1 line
Quoted 11 lines
---
 drivers/media/usb/uvc/uvc_driver.c | 5 +++++
 drivers/media/usb/uvc/uvcvideo.h   | 3 +++
 2 files changed, 8 insertions(+)
drivers/media/usb/uvc/uvc_driver.c +0 -0
index dda0f0aa78b8..e437e9f95890 100644

drivers/media/usb/uvc/uvc_driver.c static struct uvc_format_desc uvc_fmts[] = { · line 156

Quoted 3 lines
drivers/media/usb/uvc/uvc_driver.c +0 -0
@@ -154,6 +154,11 @@ static struct uvc_format_desc uvc_fmts[] = {
                .guid           = UVC_GUID_FORMAT_H264,
                .fcc            = V4L2_PIX_FMT_H264,
        },

Maybe I would add a comment here saying that some cameras represent hevc as h265.

Quoted 4 lines
Quoted 2 lines

I wish there would be a 4CC and GUID standard with a centralized registry...

Thought that was the kernel codebase :)

You'll find multiple fourcc for the same thing in the linux kernel ;-P

Quoted 25 lines
Quoted 25 lines
Quoted 23 lines
Quoted 23 lines
drivers/media/usb/uvc/uvc_driver.c +5 -0
+       {
+               .name           = "H.265",
+               .guid           = UVC_GUID_FORMAT_H265,
+               .fcc            = V4L2_PIX_FMT_HEVC,
+       },
        {
                .name           = "Greyscale 8 L/R (Y8I)",
                .guid           = UVC_GUID_FORMAT_Y8I,
drivers/media/usb/uvc/uvcvideo.h +3 -0
index 143230b3275b..41f4d8c33f2a 100644
@@ -139,6 +139,9 @@
 #define UVC_GUID_FORMAT_H264 \
        { 'H',  '2',  '6',  '4', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_H265 \
+       { 'H',  '2',  '6',  '5', 0x00, 0x00, 0x10, 0x00, \
+        0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
 #define UVC_GUID_FORMAT_Y8I \
        { 'Y',  '8',  'I',  ' ', 0x00, 0x00, 0x10, 0x00, \
         0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
Signature · 3 lines
Regards,

Laurent Pinchart