@@ -30,6 +30,7 @@
#include "h2645_parse.h"
#include "internal.h"
#include "parser.h"
+#include "mpegutils.h"
#define START_CODE 0x000001 ///< start_code_prefix_one_3bytes
@@ -232,6 +233,13 @@ 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) {
+ avctx->ticks_per_frame = 2;
+ s->repeat_pict = 3;
+ } else if (ctx->sei.picture_timing.picture_struct == HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING) {
+ avctx->ticks_per_frame = 2;
+ s->repeat_pict = 5;
+ }
ret = hevc_parse_slice_header(s, nal, avctx);
if (ret)
return ret;
@@ -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
@@ -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;
Hi, Re-sending the patch after incorporating the review comments over the previous patch sent yesterday. This patch has the implementation for supporting frame duplication (doubling/ tripling) by FFmpeg's HEVC decoder based on the picture_structre SEI value present in the encoded video. picture_structure value of 7 implies doubling and 8 implies tripling. The value of picture_structure is set while encoding. This addresses the requirement mentioned in the thread http://ffmpeg.org/pipermail/ffmpeg-devel/2019-June/245521.html Thanks & Regards, Praveen From a118cb7b050a29ef6ca6724e44d82c8c519e9a05 Mon Sep 17 00:00:00 2001 From: Praveen Karadugattu <praveenkumar@outlook.com> Date: Thu, 9 Jan 2020 15:23:41 +0530 Subject: [PATCH] Support for Frame Duplication (Doubling/Tripling) by FFMPEG's HEVC Decoder by parsing the picture_struct SEI value(Requirement:http://ffmpeg.org/pipermail/ffmpeg-devel/2019-June/245521.html) --- libavcodec/hevc_parser.c | 8 ++++++++ libavcodec/hevc_sei.c | 6 ++++++ libavcodec/hevc_sei.h | 5 +++++ 3 files changed, 19 insertions(+)