[FFmpeg-devel] [PATCH 3/4] cbs_h265: read/write content light level information SEI message

Haihao Xiang haihao.xiang at intel.com
Thu May 3 06:07:29 EEST 2018


Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>
---
 libavcodec/cbs_h2645.c                |  1 +
 libavcodec/cbs_h265.h                 |  6 ++++++
 libavcodec/cbs_h265_syntax_template.c | 17 +++++++++++++++++
 3 files changed, 24 insertions(+)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index a4cc7eb990..feb01462ae 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -488,6 +488,7 @@ static void cbs_h265_free_sei_payload(H265RawSEIPayload *payload)
 {
     switch (payload->payload_type) {
     case HEVC_SEI_TYPE_MASTERING_DISPLAY_INFO:
+    case HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:
         break;
     default:
         av_buffer_unref(&payload->payload.other.data_ref);
diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h
index 36d71e40c1..3f61686ea8 100644
--- a/libavcodec/cbs_h265.h
+++ b/libavcodec/cbs_h265.h
@@ -533,11 +533,17 @@ typedef struct H265RawSEIMasteringDiplayColourVolume {
     uint32_t min_display_mastering_luminance;
 } H265RawSEIMasteringDiplayColourVolume;
 
+typedef struct H265RawSEIContentLightLevelInfo {
+    uint16_t max_content_light_level;
+    uint16_t max_pic_average_light_level;
+} H265RawSEIContentLightLevelInfo;
+
 typedef struct H265RawSEIPayload {
     uint32_t payload_type;
     uint32_t payload_size;
     union {
         H265RawSEIMasteringDiplayColourVolume mastering_display;
+        H265RawSEIContentLightLevelInfo content_light_level;
         struct {
             uint8_t *data;
             size_t data_length;
diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c
index 387056618f..490978ce51 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -1528,6 +1528,17 @@ static int FUNC(sei_mastering_display)(CodedBitstreamContext *ctx, RWContext *rw
     return 0;
 }
 
+static int FUNC(sei_content_light_level)(CodedBitstreamContext *ctx, RWContext *rw,
+                                         H265RawSEIContentLightLevelInfo *current)
+{
+    int err;
+
+    u(16, max_content_light_level, 0, MAX_UINT_BITS(16));
+    u(16, max_pic_average_light_level, 0, MAX_UINT_BITS(16));
+
+    return 0;
+}
+
 static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
                              H265RawSEIPayload *current)
 {
@@ -1547,6 +1558,12 @@ static int FUNC(sei_payload)(CodedBitstreamContext *ctx, RWContext *rw,
 
         break;
 
+    case HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:
+        CHECK(FUNC(sei_content_light_level)
+              (ctx, rw, &current->payload.content_light_level));
+
+        break;
+
     default:
         {
             allocate(current->payload.other.data, current->payload_size);
-- 
2.14.1



More information about the ffmpeg-devel mailing list