media: Add H265 pixel format
Subsystems (3)
v2 cover media: Add H265 pixel format
Hi All,
This patch series aims to add H265 pixel format (aka hevc). 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 series aims to add H265 pixel format
to avoid this situation
James_Lin (2):
media: usb: uvc: Add H265 pixel format
media: v4l: Add H265 pixel format
.../userspace-api/media/v4l/pixfmt-compressed.rst | 10 ++++++++++ drivers/media/usb/uvc/uvc_driver.c | 5 +++++ drivers/media/usb/uvc/uvcvideo.h | 3 +++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 5 files changed, 20 insertions(+)
Signature · 1 line
2.18.0
PATCH v2 1/2 media: usb: uvc: Add H265 pixel format
Add H265 pixel format.
So driver can recognize external camera devices
whom use h265 to describe High Efficiency Video Coding method.
--- 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
@@ -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_H265, + }, { .name = "Greyscale 8 L/R (Y8I)", .guid = UVC_GUID_FORMAT_Y8I,
drivers/media/usb/uvc/uvcvideo.h +3 -0
@@ -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
Re: [PATCH v2 1/2] media: usb: uvc: Add H265 pixel format
Quoting James_Lin (2022-04-11 09:01:19)
Quoted 15 lines
Add H265 pixel format.
So driver can recognize external camera devices
whom use h265 to describe High Efficiency Video Coding method.Signed-off-by James_Lin <[email protected]>--- 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
drivers/media/usb/uvc/uvc_driver.c static struct uvc_format_desc uvc_fmts[] = { · line 160
Quoted 7 lines
drivers/media/usb/uvc/uvc_driver.c +4
-0@@ -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_H265,
This is not yet defined I believe, so this patch needs to be 2/2 in this series - with your following patch first so that they can both compile independently.
Quoted 21 lines
drivers/media/usb/uvc/uvc_driver.c +1
-0+ }, { .name = "Greyscale 8 L/R (Y8I)", .guid = UVC_GUID_FORMAT_Y8I,drivers/media/usb/uvc/uvcvideo.h +3
-0@@ -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
PATCH v2 2/2 media: v4l: Add H265 pixel format
In reply to James_LinAdd H265 pixel format.
So driver can recognize external camera devices
whom use h265 to describe High Efficiency Video Coding method.
--- .../userspace-api/media/v4l/pixfmt-compressed.rst | 10 ++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 12 insertions(+)
Documentation/userspace-api/media/v4l/pixfmt-compressed.rst +10 -0
@@ -36,6 +36,16 @@ Compressed Formats - MPEG multiplexed stream. The actual format is determined by extended control ``V4L2_CID_MPEG_STREAM_TYPE``, see :ref:`mpeg-control-id`. + * .. _V4L2-PIX-FMT-H265: + + - ``V4L2_PIX_FMT_H265`` + - 'H265' + - H.265 Access Unit. + The decoder expects one Access Unit per buffer. + The encoder generates one Access Unit per buffer. + If :ref:`VIDIOC_ENUM_FMT` reports ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM`` + then the decoder has no requirements since it can parse all the + information from the raw bytestream. * .. _V4L2-PIX-FMT-H264: - ``V4L2_PIX_FMT_H264``
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1402,6 +1402,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_JPEG : descr ="JFIF JPEG" ;break ;case V4L2_PIX_FMT_DV : descr ="1394" ;break ;case V4L2_PIX_FMT_MPEG : descr ="MPEG-1/2/4" ;break ; +case V4L2_PIX_FMT_H265 : descr ="H.265" ;break ;case V4L2_PIX_FMT_H264 : descr ="H.264" ;break ;case V4L2_PIX_FMT_H264_NO_SC : descr ="H.264 (No Start Codes)" ;break ;case V4L2_PIX_FMT_H264_MVC : descr ="H.264 MVC" ;break ;
include/uapi/linux/videodev2.h +1 -0
@@ -691,6 +691,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G')/* JFIF JPEG */ #define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd')/* 1394 */ #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G')/* MPEG-1/2/4 Multiplexed */ +#define V4L2_PIX_FMT_H265 v4l2_fourcc('H', '2', '6', '5')/* H265 with start codes */ #define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4')/* H264 with start codes */ #define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1')/* H264 without start codes */ #define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4')/* H264 MVC */
Signature · 1 line
2.18.0
Re: [PATCH v2 2/2] media: v4l: Add H265 pixel format
Quoting James_Lin (2022-04-11 09:01:20)
Quoted 37 lines
Add H265 pixel format.
So driver can recognize external camera devices
whom use h265 to describe High Efficiency Video Coding method.Signed-off-by James_Lin <[email protected]>--- .../userspace-api/media/v4l/pixfmt-compressed.rst | 10 ++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 12 insertions(+)Documentation/userspace-api/media/v4l/pixfmt-compressed.rst +10
-0@@ -36,6 +36,16 @@ Compressed Formats - MPEG multiplexed stream. The actual format is determined by extended control ``V4L2_CID_MPEG_STREAM_TYPE``, see :ref:`mpeg-control-id`. + * .. _V4L2-PIX-FMT-H265: + + - ``V4L2_PIX_FMT_H265`` + - 'H265' + - H.265 Access Unit. + The decoder expects one Access Unit per buffer. + The encoder generates one Access Unit per buffer. + If :ref:`VIDIOC_ENUM_FMT` reports ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM`` + then the decoder has no requirements since it can parse all the + information from the raw bytestream. * .. _V4L2-PIX-FMT-H264: - ``V4L2_PIX_FMT_H264``drivers/media/v4l2-core/v4l2-ioctl.c +0
-0
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1405
Quoted 4 lines
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1402,6 +1402,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_JPEG : descr ="JFIF JPEG" ;break ;case V4L2_PIX_FMT_DV : descr ="1394" ;break ;case V4L2_PIX_FMT_MPEG : descr ="MPEG-1/2/4" ;break ; +case V4L2_PIX_FMT_H265 : descr ="H.265" ;break ;
I'd probably expect H265 to be sorted after H264 ? But I'm not sure this list is sorted otherwise.
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 694
Quoted 12 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0case V4L2_PIX_FMT_H264 : descr ="H.264" ;break ;case V4L2_PIX_FMT_H264_NO_SC : descr ="H.264 (No Start Codes)" ;break ;case V4L2_PIX_FMT_H264_MVC : descr ="H.264 MVC" ;break ;include/uapi/linux/videodev2.h +1
-0@@ -691,6 +691,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G')/* JFIF JPEG */ #define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd')/* 1394 */ #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G')/* MPEG-1/2/4 Multiplexed */ +#define V4L2_PIX_FMT_H265 v4l2_fourcc('H', '2', '6', '5')/* H265 with start codes */
Likewise.
Quoted 6 lines
include/uapi/linux/videodev2.h +0
-0#define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4')/* H264 with start codes */ #define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1')/* H264 without start codes */ #define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4')/* H264 MVC */ Signature · 1 line
2.18.0
Re: [PATCH v2 2/2] media: v4l: Add H265 pixel format
In reply to James_LinLe lundi 11 avril 2022 à 16:01 +0800, James_Lin a écrit :
Quoted 16 lines
Add H265 pixel format.
So driver can recognize external camera devices
whom use h265 to describe High Efficiency Video Coding method.Signed-off-by James_Lin <[email protected]>--- .../userspace-api/media/v4l/pixfmt-compressed.rst | 10 ++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 12 insertions(+)Documentation/userspace-api/media/v4l/pixfmt-compressed.rst +0
-0
Documentation/userspace-api/media/v4l/pixfmt-compressed.rst Compressed Formats · line 41
Quoted 6 lines
Documentation/userspace-api/media/v4l/pixfmt-compressed.rst +3
-0@@ -36,6 +36,16 @@ Compressed Formats - MPEG multiplexed stream. The actual format is determined by extended control ``V4L2_CID_MPEG_STREAM_TYPE``, see :ref:`mpeg-control-id`. + * .. _V4L2-PIX-FMT-H265: + + - ``V4L2_PIX_FMT_H265``
Please name this V4L2_PIX_FMT_HEVC. This has been discussed few years ago, related to the staging V4L2_PIX_FMT_HEVC_SLICE format (which is being worked on to be taken out of staging). HEVC was preferred over H.265, so lets be consistent now that decision has been made.
Quoted 27 lines
Documentation/userspace-api/media/v4l/pixfmt-compressed.rst +7
-0+ - 'H265' + - H.265 Access Unit. + The decoder expects one Access Unit per buffer. + The encoder generates one Access Unit per buffer. + If :ref:`VIDIOC_ENUM_FMT` reports ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM`` + then the decoder has no requirements since it can parse all the + information from the raw bytestream. * .. _V4L2-PIX-FMT-H264: - ``V4L2_PIX_FMT_H264``drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1402,6 +1402,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_JPEG : descr ="JFIF JPEG" ;break ;case V4L2_PIX_FMT_DV : descr ="1394" ;break ;case V4L2_PIX_FMT_MPEG : descr ="MPEG-1/2/4" ;break ; +case V4L2_PIX_FMT_H265 : descr ="H.265" ;break ;case V4L2_PIX_FMT_H264 : descr ="H.264" ;break ;case V4L2_PIX_FMT_H264_NO_SC : descr ="H.264 (No Start Codes)" ;break ;case V4L2_PIX_FMT_H264_MVC : descr ="H.264 MVC" ;break ;include/uapi/linux/videodev2.h +0
-0
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 697
Quoted 7 lines
include/uapi/linux/videodev2.h +1
-0@@ -691,6 +691,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G')/* JFIF JPEG */ #define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd')/* 1394 */ #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G')/* MPEG-1/2/4 Multiplexed */ +#define V4L2_PIX_FMT_H265 v4l2_fourcc('H', '2', '6', '5')/* H265 with start codes */ #define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4')/* H264 with start codes */ #define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1')/* H264 without start codes */ #define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4')/* H264 MVC */
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek