[FFmpeg-cvslog] avcodec/hevc: add support for Frame Duplication (Doubling/Tripling)

Praveen Karadugattu git at videolan.org
Thu Feb 6 18:08:53 EET 2020


ffmpeg | branch: master | Praveen Karadugattu <praveenkumar at outlook.com> | Thu Jan 23 19:12:17 2020 +0530| [31d7b17c4671329a372e2762b4c5892dd0314ee5] | committer: Paul B Mahol

avcodec/hevc: add support for Frame Duplication (Doubling/Tripling)

Parse picture_struct SEI value.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=31d7b17c4671329a372e2762b4c5892dd0314ee5
---

 libavcodec/hevc_parser.c | 5 +++++
 libavcodec/hevc_sei.c    | 6 ++++++
 libavcodec/hevc_sei.h    | 5 +++++
 3 files changed, 16 insertions(+)

diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
index 87d5dba4f5..84f19b485c 100644
--- a/libavcodec/hevc_parser.c
+++ b/libavcodec/hevc_parser.c
@@ -235,6 +235,11 @@ static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
         case HEVC_NAL_RADL_R:
         case HEVC_NAL_RASL_N:
         case HEVC_NAL_RASL_R:
+            if (ctx->sei.picture_timing.picture_struct == HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING) {
+                s->repeat_pict = 1;
+            } else if (ctx->sei.picture_timing.picture_struct == HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING) {
+                s->repeat_pict = 2;
+            }
             ret = hevc_parse_slice_header(s, nal, avctx);
             if (ret)
                 return ret;
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 562ce8b516..60570690cf 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -144,6 +144,12 @@ static int decode_nal_sei_pic_timing(HEVCSEI *s, GetBitContext *gb, const HEVCPa
         } else if (pic_struct == 1 || pic_struct == 9 || pic_struct == 11) {
             av_log(logctx, AV_LOG_DEBUG, "TOP Field\n");
             h->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD;
+        } else if (pic_struct == 7) {
+            av_log(logctx, AV_LOG_DEBUG, "Frame/Field Doubling\n");
+            h->picture_struct = HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING;
+        } else if (pic_struct == 8) {
+            av_log(logctx, AV_LOG_DEBUG, "Frame/Field Tripling\n");
+            h->picture_struct = HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING;
         }
         get_bits(gb, 2);                   // source_scan_type
         get_bits(gb, 1);                   // duplicate_flag
diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
index 2769d41445..a44ccca7f8 100644
--- a/libavcodec/hevc_sei.h
+++ b/libavcodec/hevc_sei.h
@@ -59,6 +59,11 @@ typedef enum {
     HEVC_SEI_TYPE_ALPHA_CHANNEL_INFO                   = 165,
 } HEVC_SEI_Type;
 
+typedef enum {
+        HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
+        HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING = 8
+} HEVC_SEI_PicStructType;
+
 typedef struct HEVCSEIPictureHash {
     uint8_t       md5[3][16];
     uint8_t is_md5;



More information about the ffmpeg-cvslog mailing list