mbox series

[0/3] HDR10 static metadata

Message ID 20201109173153.23720-1-stanimir.varbanov@linaro.org
Headers show
Series HDR10 static metadata | expand

Message

Stanimir Varbanov Nov. 9, 2020, 5:31 p.m. UTC
Hello,

This patchset adds two HDR10 HEVC v4l2 controls for Content Light Level
and Mastering display colour volume plus implenmentation in Venus encoder
driver.

Comments are welcome!

regards,
Stan

Stanimir Varbanov (3):
  v4l: Add HDR10 HEVC static metadata controls
  docs: media: Document CLL and Mastering display
  venus: venc: Add support for CLL and Mastering display controls

 .../media/v4l/ext-ctrls-codec.rst             | 61 +++++++++++++++++++
 drivers/media/platform/qcom/venus/core.h      |  3 +
 drivers/media/platform/qcom/venus/hfi_cmds.c  |  8 +++
 .../media/platform/qcom/venus/hfi_helper.h    | 20 ++++++
 drivers/media/platform/qcom/venus/venc.c      | 29 +++++++++
 .../media/platform/qcom/venus/venc_ctrls.c    | 16 ++++-
 drivers/media/v4l2-core/v4l2-ctrls.c          | 61 +++++++++++++++++++
 include/media/hevc-ctrls.h                    | 41 +++++++++++++
 include/media/v4l2-ctrls.h                    |  2 +
 9 files changed, 240 insertions(+), 1 deletion(-)

-- 
2.17.1

Comments

Nicolas Dufresne Nov. 9, 2020, 7:53 p.m. UTC | #1
Le lundi 09 novembre 2020 à 19:31 +0200, Stanimir Varbanov a écrit :
> Hello,

> 

> This patchset adds two HDR10 HEVC v4l2 controls for Content Light Level

> and Mastering display colour volume plus implenmentation in Venus encoder

> driver.

> 

> Comments are welcome!


It is not a formal review, but I did walked through the new API and
everything looks fine to me. One question though, are you aware that
the H.264/AVC equivalent is identical ? What is you plan for that ?

> 

> regards,

> Stan

> 

> Stanimir Varbanov (3):

>   v4l: Add HDR10 HEVC static metadata controls

>   docs: media: Document CLL and Mastering display

>   venus: venc: Add support for CLL and Mastering display controls

> 

>  .../media/v4l/ext-ctrls-codec.rst             | 61 +++++++++++++++++++

>  drivers/media/platform/qcom/venus/core.h      |  3 +

>  drivers/media/platform/qcom/venus/hfi_cmds.c  |  8 +++

>  .../media/platform/qcom/venus/hfi_helper.h    | 20 ++++++

>  drivers/media/platform/qcom/venus/venc.c      | 29 +++++++++

>  .../media/platform/qcom/venus/venc_ctrls.c    | 16 ++++-

>  drivers/media/v4l2-core/v4l2-ctrls.c          | 61 +++++++++++++++++++

>  include/media/hevc-ctrls.h                    | 41 +++++++++++++

>  include/media/v4l2-ctrls.h                    |  2 +

>  9 files changed, 240 insertions(+), 1 deletion(-)

>
Stanimir Varbanov Nov. 9, 2020, 11:44 p.m. UTC | #2
On 11/9/20 9:53 PM, Nicolas Dufresne wrote:
> Le lundi 09 novembre 2020 à 19:31 +0200, Stanimir Varbanov a écrit :

>> Hello,

>>

>> This patchset adds two HDR10 HEVC v4l2 controls for Content Light Level

>> and Mastering display colour volume plus implenmentation in Venus encoder

>> driver.

>>

>> Comments are welcome!

> 

> It is not a formal review, but I did walked through the new API and

> everything looks fine to me. One question though, are you aware that

> the H.264/AVC equivalent is identical ? What is you plan for that ?


Thanks for the question, I haven't thought for avc, yet.

I guess we have few options:

1. introduce hdr10-ctrls.h, common control IDs
2. duplicate structures and control IDs in hevc/h264-ctrls.h
3. common structures and separate control IDs for avc and hevc
4. another option?

I'd prefer option 1. We could extend later option 1 with hdr10+.

> 

>>

>> regards,

>> Stan

>>

>> Stanimir Varbanov (3):

>>   v4l: Add HDR10 HEVC static metadata controls

>>   docs: media: Document CLL and Mastering display

>>   venus: venc: Add support for CLL and Mastering display controls

>>

>>  .../media/v4l/ext-ctrls-codec.rst             | 61 +++++++++++++++++++

>>  drivers/media/platform/qcom/venus/core.h      |  3 +

>>  drivers/media/platform/qcom/venus/hfi_cmds.c  |  8 +++

>>  .../media/platform/qcom/venus/hfi_helper.h    | 20 ++++++

>>  drivers/media/platform/qcom/venus/venc.c      | 29 +++++++++

>>  .../media/platform/qcom/venus/venc_ctrls.c    | 16 ++++-

>>  drivers/media/v4l2-core/v4l2-ctrls.c          | 61 +++++++++++++++++++

>>  include/media/hevc-ctrls.h                    | 41 +++++++++++++

>>  include/media/v4l2-ctrls.h                    |  2 +

>>  9 files changed, 240 insertions(+), 1 deletion(-)

>>

> 


-- 
regards,
Stan
Hans Verkuil Nov. 10, 2020, 9:38 a.m. UTC | #3
On 09/11/2020 20:53, Nicolas Dufresne wrote:
> Le lundi 09 novembre 2020 à 19:31 +0200, Stanimir Varbanov a écrit :
>> Hello,
>>
>> This patchset adds two HDR10 HEVC v4l2 controls for Content Light Level
>> and Mastering display colour volume plus implenmentation in Venus encoder
>> driver.
>>
>> Comments are welcome!
> 
> It is not a formal review, but I did walked through the new API and
> everything looks fine to me. One question though, are you aware that
> the H.264/AVC equivalent is identical ? What is you plan for that ?

Not only that, but these structures are lifted straight from the
CTA-861-G standard: see "6.9 Dynamic Range and Mastering InfoFrame"
and "6.9.1 Static Metadata Type 1".

So this is equally useful for HDMI receivers and transmitters.

Actually, include/linux/hdmi.h contains a struct for that, but it seems
to be missing a lot of fields. But we need a v4l2 control anyway and hdmi.h
isn't a good fit for that.

Regards,

	Hans

> 
>>
>> regards,
>> Stan
>>
>> Stanimir Varbanov (3):
>>   v4l: Add HDR10 HEVC static metadata controls
>>   docs: media: Document CLL and Mastering display
>>   venus: venc: Add support for CLL and Mastering display controls
>>
>>  .../media/v4l/ext-ctrls-codec.rst             | 61 +++++++++++++++++++
>>  drivers/media/platform/qcom/venus/core.h      |  3 +
>>  drivers/media/platform/qcom/venus/hfi_cmds.c  |  8 +++
>>  .../media/platform/qcom/venus/hfi_helper.h    | 20 ++++++
>>  drivers/media/platform/qcom/venus/venc.c      | 29 +++++++++
>>  .../media/platform/qcom/venus/venc_ctrls.c    | 16 ++++-
>>  drivers/media/v4l2-core/v4l2-ctrls.c          | 61 +++++++++++++++++++
>>  include/media/hevc-ctrls.h                    | 41 +++++++++++++
>>  include/media/v4l2-ctrls.h                    |  2 +
>>  9 files changed, 240 insertions(+), 1 deletion(-)
>>
>
Stanimir Varbanov Nov. 10, 2020, 10:28 a.m. UTC | #4
On 11/10/20 11:50 AM, Hans Verkuil wrote:
> On 09/11/2020 18:31, Stanimir Varbanov wrote:

>> Document Content light level and Mastering display colour volume.

>>

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

>> ---

>>  .../media/v4l/ext-ctrls-codec.rst             | 61 +++++++++++++++++++

>>  1 file changed, 61 insertions(+)

>>

>> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst

>> index ce728c757eaf..39d0aab5ca3d 100644

>> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst

>> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst

>> @@ -4382,3 +4382,64 @@ enum v4l2_mpeg_video_hevc_size_of_length_field -

>>        - Selecting this value specifies that HEVC slices are expected

>>          to be prefixed by Annex B start codes. According to :ref:`hevc`

>>          valid start codes can be 3-bytes 0x000001 or 4-bytes 0x00000001.

>> +

>> +``V4L2_CID_MPEG_VIDEO_HEVC_CLL_INFO (struct)``

>> +    The Content Light Level defines upper bounds for the nominal target

>> +    brightness light level of the pictures.

>> +

>> +.. c:type:: v4l2_ctrl_hevc_cll_info

>> +

>> +.. cssclass:: longtable

>> +

>> +.. flat-table:: struct v4l2_ctrl_hevc_cll_info

>> +    :header-rows:  0

>> +    :stub-columns: 0

>> +    :widths:       1 1 2

>> +

>> +    * - __u16

>> +      - ``max_content_light_level``

>> +      - An upper bound on the maximum light level among all individual

>> +        samples for the pictures of coded video sequence, cd/m2.

>> +    * - __u16

>> +      - ``max_pic_average_light_level``

>> +      - An upper bound on the maximum average light level among the

>> +        samples for any idividual picture of coded video sequence, cd/m2.

> 

> idividual -> individual

> 

> In the CTA-861-G spec value 0 is used to indicate that this information is

> not present. How is that handled here? Can it be 0 as well in an HEVC stream?


ITU-T Rec. H265 says: When equal to 0, no such upper bound is indicated
by max_content_light_level.

So, the meaning is the same as in CTA-861-G.

> 

> Same for the next control.

> 

>> +

>> +``V4L2_CID_MPEG_VIDEO_HEVC_MASTERING_DISPLAY (struct)``

>> +    The mastering display defines the colour volume (the colour primaries,

>> +    white point and luminance range) of a display considered to be the

>> +    mastering display for current video content.

>> +

>> +.. c:type:: v4l2_ctrl_hevc_mastering_display

>> +

>> +.. cssclass:: longtable

>> +

>> +.. flat-table:: struct v4l2_ctrl_hevc_mastering_display

>> +    :header-rows:  0

>> +    :stub-columns: 0

>> +    :widths:       1 1 2

>> +

>> +    * - __u16

>> +      - ``display_primaries_x[3]``

>> +      - Specifies the normalized x chromaticity coordinate of the colour

>> +        primary component of the mastering display.

> 

> CTA-861-G defines this as: "coded as unsigned 16-bit values in units

> of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000."

> 

> Is that true here as well? If so, then this should be documented because

> "normalized x chromaticity coordinate" doesn't say anything meaningful.


Yes, it is the same. Will document that in next version.

> 

>> +    * - __u16

>> +      - ``display_primaries_y[3]``

>> +      - Specifies the normalized y chromaticity coordinate of the colour

>> +        primary component of the mastering display.

>> +    * - __u16

>> +      - ``white_point_x``

>> +      - Specifies the normalized x chromaticity coordinate of the white

>> +        point of the mastering display.

>> +    * - __u16

>> +      - ``white_point_y``

>> +      - Specifies the normalized y chromaticity coordinate of the white

>> +        point of the mastering display.

>> +    * - __u32

>> +      - ``max_luminance``

>> +      - Specifies the nominal maximum display luminance of the mastering

>> +        display.

> 

> In CTA-861-G this is in 1 cd/m^2 units.


In Rec. H265 max_luminance is in the range of 50 000 to 100 000 000 and
units of 0.0001 cd/m2.

> 

>> +    * - __u32

>> +      - ``min_luminance``

>> +      - specifies the nominal minimum display luminance of the mastering

>> +        display.

> 

> And this in units of 0.0001 cd/m^2.


min_luminance - range of 1 to 50 000 and units of 0.0001 cd/m2.

I will update all these in next patchset version.

> 

> Regards,

> 

> 	Hans

> 


-- 
regards,
Stan