[FFmpeg-devel] [PATCH 4/4] vaapi_encode_h265: Insert content light level information

Xiang, Haihao haihao.xiang at intel.com
Fri May 4 16:08:45 EEST 2018


>-----Original Message-----
>From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of
>Mark Thompson
>Sent: Friday, May 4, 2018 5:49 AM
>To: ffmpeg-devel at ffmpeg.org
>Subject: Re: [FFmpeg-devel] [PATCH 4/4] vaapi_encode_h265: Insert content
>light level information
>
>On 03/05/18 04:07, Haihao Xiang wrote:
>> Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>
>> ---
>>  libavcodec/vaapi_encode_h265.c | 29 ++++++++++++++++++++++++++++-
>>  1 file changed, 28 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/vaapi_encode_h265.c
>> b/libavcodec/vaapi_encode_h265.c index 326fe4fe66..5fe487dfc5 100644
>> --- a/libavcodec/vaapi_encode_h265.c
>> +++ b/libavcodec/vaapi_encode_h265.c
>> @@ -37,6 +37,7 @@
>>
>>  enum {
>>      SEI_MASTERING_DISPLAY       = 0x08,
>> +    SEI_CONTENT_LIGHT_LEVLE     = 0x10,
>>  };
>>
>>  typedef struct VAAPIEncodeH265Context { @@ -55,6 +56,7 @@ typedef
>> struct VAAPIEncodeH265Context {
>>      H265RawSEI sei;
>>
>>      H265RawSEIMasteringDiplayColourVolume mastering_display;
>> +    H265RawSEIContentLightLevelInfo content_light_level;
>>
>>      int64_t last_idr_frame;
>>      int pic_order_cnt;
>> @@ -218,6 +220,12 @@ static int
>vaapi_encode_h265_write_extra_header(AVCodecContext *avctx,
>>              ++i;
>>          }
>>
>> +        if (priv->sei_needed & SEI_CONTENT_LIGHT_LEVLE) {
>> +            priv->sei.payload[i].payload_type =
>HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO;
>> +            priv->sei.payload[i].payload.content_light_level = priv-
>>content_light_level;
>> +            ++i;
>> +        }
>> +
>>          priv->sei.payload_count = i;
>>          av_assert0(priv->sei.payload_count > 0);
>>
>> @@ -702,6 +710,22 @@ static int
>vaapi_encode_h265_init_picture_params(AVCodecContext *avctx,
>>          }
>>      }
>>
>> +    if (opt->sei & SEI_CONTENT_LIGHT_LEVLE) {
>> +        AVFrameSideData *sd =
>> +            av_frame_get_side_data(pic->input_image,
>> +
>> + AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
>
>Same question about when this side data is set as for mastering display.
>

The persistence scope for content light level is also CLVS, my understanding is to set this side-data per I/IDR frame 

>> +
>> +        if (sd) {
>> +            AVContentLightMetadata *clm =
>> +                (AVContentLightMetadata *)sd->data;
>> +
>> +            priv->content_light_level.max_content_light_level = clm->MaxCLL;
>> +            priv->content_light_level.max_pic_average_light_level =
>> + clm->MaxFALL;
>
>Possibly needs to be clipped to 16 bits?


Yes, I will change it.

>
>> +
>> +            priv->sei_needed |= SEI_CONTENT_LIGHT_LEVLE;
>> +        }
>> +    }
>> +
>>      vpic->decoded_curr_pic = (VAPictureHEVC) {
>>          .picture_id    = pic->recon_surface,
>>          .pic_order_cnt = priv->pic_order_cnt, @@ -1123,11 +1147,14 @@
>> static const AVOption vaapi_encode_h265_options[] = {
>>
>>      { "sei", "Set SEI to include",
>>        OFFSET(sei), AV_OPT_TYPE_FLAGS,
>> -      { .i64 = SEI_MASTERING_DISPLAY },
>> +      { .i64 = SEI_MASTERING_DISPLAY | SEI_CONTENT_LIGHT_LEVLE },
>>        0, INT_MAX, FLAGS, "sei" },
>>      { "mastering_display", "Include mastering display colour volume",
>>        0, AV_OPT_TYPE_CONST, { .i64 = SEI_MASTERING_DISPLAY },
>>        INT_MIN, INT_MAX, FLAGS, "sei" },
>> +    { "content_light_level", "Include content light level information",
>> +      0, AV_OPT_TYPE_CONST, { .i64 = SEI_CONTENT_LIGHT_LEVLE },
>> +      INT_MIN, INT_MAX, FLAGS, "sei" },
>
>If you still like the idea of an "hdr" option (so that '-sei hdr' works), you can
>make it have the value SEI_MASTERING_DISPLAY|SEI_CONTENT_LIGHT_LEVEL.
>

Sure, I will change it to '-sei hdr'.

>>
>>      { NULL },
>>  };
>>
>_______________________________________________
>ffmpeg-devel mailing list
>ffmpeg-devel at ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list