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

Submitted by Haihao Xiang on May 10, 2018, 5:47 a.m.

Details

Message ID 20180510054747.7967-3-haihao.xiang@intel.com
State New
Headers show

Commit Message

Haihao Xiang May 10, 2018, 5:47 a.m.
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
---
 libavcodec/cbs_h2645.c                |  1 +
 libavcodec/cbs_h265.h                 |  6 ++++++
 libavcodec/cbs_h265_syntax_template.c | 17 +++++++++++++++++
 3 files changed, 24 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index dd13d8ab5f..54f7e93755 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 b5715aed03..46d28dd2ec 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 593b6afd10..9b39201e39 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -1526,6 +1526,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)
 {
@@ -1545,6 +1556,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:
         {
 #ifdef READ