diff mbox series

[RFC/WIP,1/4] media: Add HEIC compressed pixel format

Message ID 20210429132833.2802390-2-stanimir.varbanov@linaro.org
State New
Headers show
Series HEIC image encoder | expand

Commit Message

Stanimir Varbanov April 29, 2021, 1:28 p.m. UTC
Add HEIC (High-Efficiency Image Container) pixel format. This an
image container which use HEVC codec to encoded images.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

---
 .../userspace-api/media/v4l/pixfmt-compressed.rst    | 12 ++++++++++++
 drivers/media/v4l2-core/v4l2-ioctl.c                 |  1 +
 include/uapi/linux/videodev2.h                       |  1 +
 3 files changed, 14 insertions(+)

-- 
2.25.1

Comments

Nicolas Dufresne May 18, 2021, 5:11 p.m. UTC | #1
Le jeudi 29 avril 2021 à 16:28 +0300, Stanimir Varbanov a écrit :
> Add HEIC (High-Efficiency Image Container) pixel format. This an

> image container which use HEVC codec to encoded images.

> 

> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

> ---

>  .../userspace-api/media/v4l/pixfmt-compressed.rst    | 12 ++++++++++++

>  drivers/media/v4l2-core/v4l2-ioctl.c                 |  1 +

>  include/uapi/linux/videodev2.h                       |  1 +

>  3 files changed, 14 insertions(+)

> 

> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst

> index ba6c0c961204..246bff90dcac 100644

> --- a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst

> +++ b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst

> @@ -186,6 +186,18 @@ Compressed Formats

>  	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-HEIC:

> +

> +      - ``V4L2_PIX_FMT_HEIC``

> +      - 'HEIC'

> +      - High Efficiency Image Container is an image container file format which

> +        uses HEVC encoding and it is a variant of HEIF (High Efficiency Image File)

> +        format.


Can you clarify, is it expected that an HEIF container be compatible or not ?
Assuming this exist. The HEIC being a brand name, and not really a standard
seems rather confusing. Is this is right name, or should you introduce HEIF with
variant control, similar to HEVC profile control.

Speaking of profile, does it inherit anything from HEVC ? So we need to set HEVC
pofile/level ? Is there some way's to affect the quality or is it the HEVC QP
controls ?

> 

> 

> +	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-HEVC-SLICE:

>  

>        - ``V4L2_PIX_FMT_HEVC_SLICE``

> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c

> index 31d1342e61e8..3a1b4c3a76c8 100644

> --- a/drivers/media/v4l2-core/v4l2-ioctl.c

> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c

> @@ -1454,6 +1454,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)

>  		case V4L2_PIX_FMT_S5C_UYVY_JPG:	descr = "S5C73MX interleaved UYVY/JPEG"; break;

>  		case V4L2_PIX_FMT_MT21C:	descr = "Mediatek Compressed Format"; break;

>  		case V4L2_PIX_FMT_SUNXI_TILED_NV12: descr = "Sunxi Tiled NV12 Format"; break;

> +		case V4L2_PIX_FMT_HEIC:		descr = "HEIC Image Format"; break;

>  		default:

>  			if (fmt->description[0])

>  				return;

> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h

> index 79dbde3bcf8d..2153b5c31d46 100644

> --- a/include/uapi/linux/videodev2.h

> +++ b/include/uapi/linux/videodev2.h

> @@ -699,6 +699,7 @@ struct v4l2_pix_format {

>  #define V4L2_PIX_FMT_FWHT     v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh Hadamard Transform (vicodec) */

>  #define V4L2_PIX_FMT_FWHT_STATELESS     v4l2_fourcc('S', 'F', 'W', 'H') /* Stateless FWHT (vicodec) */

>  #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */

> +#define V4L2_PIX_FMT_HEIC	v4l2_fourcc('H', 'E', 'I', 'C') /* HEIC HEVC image format */

>  

>  /*  Vendor-specific formats   */

>  #define V4L2_PIX_FMT_CPIA1    v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
Stanimir Varbanov May 25, 2021, 7:42 a.m. UTC | #2
On 5/18/21 8:11 PM, Nicolas Dufresne wrote:
> Le jeudi 29 avril 2021 à 16:28 +0300, Stanimir Varbanov a écrit :

>> Add HEIC (High-Efficiency Image Container) pixel format. This an

>> image container which use HEVC codec to encoded images.

>>

>> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

>> ---

>>  .../userspace-api/media/v4l/pixfmt-compressed.rst    | 12 ++++++++++++

>>  drivers/media/v4l2-core/v4l2-ioctl.c                 |  1 +

>>  include/uapi/linux/videodev2.h                       |  1 +

>>  3 files changed, 14 insertions(+)

>>

>> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst

>> index ba6c0c961204..246bff90dcac 100644

>> --- a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst

>> +++ b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst

>> @@ -186,6 +186,18 @@ Compressed Formats

>>  	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-HEIC:

>> +

>> +      - ``V4L2_PIX_FMT_HEIC``

>> +      - 'HEIC'

>> +      - High Efficiency Image Container is an image container file format which

>> +        uses HEVC encoding and it is a variant of HEIF (High Efficiency Image File)

>> +        format.

> 

> Can you clarify, is it expected that an HEIF container be compatible or not ?

> Assuming this exist. The HEIC being a brand name, and not really a standard

> seems rather confusing. Is this is right name, or should you introduce HEIF with

> variant control, similar to HEVC profile control.



V4L2_PIX_FMT_HFIF_HEVC is a good option, I guess.

> 

> Speaking of profile, does it inherit anything from HEVC ? So we need to set HEVC

> pofile/level ? Is there some way's to affect the quality or is it the HEVC QP

> controls ?


V4L2_PIX_FMT_HFIF_HEVC will accept
V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE profile and the image
quality is set through V4L2_CID_MPEG_VIDEO_CONSTANT_QUALITY

> 

>>

>>

>> +	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-HEVC-SLICE:

>>  

>>        - ``V4L2_PIX_FMT_HEVC_SLICE``

>> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c

>> index 31d1342e61e8..3a1b4c3a76c8 100644

>> --- a/drivers/media/v4l2-core/v4l2-ioctl.c

>> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c

>> @@ -1454,6 +1454,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)

>>  		case V4L2_PIX_FMT_S5C_UYVY_JPG:	descr = "S5C73MX interleaved UYVY/JPEG"; break;

>>  		case V4L2_PIX_FMT_MT21C:	descr = "Mediatek Compressed Format"; break;

>>  		case V4L2_PIX_FMT_SUNXI_TILED_NV12: descr = "Sunxi Tiled NV12 Format"; break;

>> +		case V4L2_PIX_FMT_HEIC:		descr = "HEIC Image Format"; break;

>>  		default:

>>  			if (fmt->description[0])

>>  				return;

>> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h

>> index 79dbde3bcf8d..2153b5c31d46 100644

>> --- a/include/uapi/linux/videodev2.h

>> +++ b/include/uapi/linux/videodev2.h

>> @@ -699,6 +699,7 @@ struct v4l2_pix_format {

>>  #define V4L2_PIX_FMT_FWHT     v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh Hadamard Transform (vicodec) */

>>  #define V4L2_PIX_FMT_FWHT_STATELESS     v4l2_fourcc('S', 'F', 'W', 'H') /* Stateless FWHT (vicodec) */

>>  #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */

>> +#define V4L2_PIX_FMT_HEIC	v4l2_fourcc('H', 'E', 'I', 'C') /* HEIC HEVC image format */

>>  

>>  /*  Vendor-specific formats   */

>>  #define V4L2_PIX_FMT_CPIA1    v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */

> 

> 


-- 
regards,
Stan
diff mbox series

Patch

diff --git a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
index ba6c0c961204..246bff90dcac 100644
--- a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
+++ b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
@@ -186,6 +186,18 @@  Compressed Formats
 	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-HEIC:
+
+      - ``V4L2_PIX_FMT_HEIC``
+      - 'HEIC'
+      - High Efficiency Image Container is an image container file format which
+        uses HEVC encoding and it is a variant of HEIF (High Efficiency Image File)
+        format.
+	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-HEVC-SLICE:
 
       - ``V4L2_PIX_FMT_HEVC_SLICE``
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 31d1342e61e8..3a1b4c3a76c8 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1454,6 +1454,7 @@  static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
 		case V4L2_PIX_FMT_S5C_UYVY_JPG:	descr = "S5C73MX interleaved UYVY/JPEG"; break;
 		case V4L2_PIX_FMT_MT21C:	descr = "Mediatek Compressed Format"; break;
 		case V4L2_PIX_FMT_SUNXI_TILED_NV12: descr = "Sunxi Tiled NV12 Format"; break;
+		case V4L2_PIX_FMT_HEIC:		descr = "HEIC Image Format"; break;
 		default:
 			if (fmt->description[0])
 				return;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 79dbde3bcf8d..2153b5c31d46 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -699,6 +699,7 @@  struct v4l2_pix_format {
 #define V4L2_PIX_FMT_FWHT     v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh Hadamard Transform (vicodec) */
 #define V4L2_PIX_FMT_FWHT_STATELESS     v4l2_fourcc('S', 'F', 'W', 'H') /* Stateless FWHT (vicodec) */
 #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */
+#define V4L2_PIX_FMT_HEIC	v4l2_fourcc('H', 'E', 'I', 'C') /* HEIC HEVC image format */
 
 /*  Vendor-specific formats   */
 #define V4L2_PIX_FMT_CPIA1    v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */