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

Parse picture_struct SEI value.
This commit is contained in:
Praveen Karadugattu 2020-01-23 18:54:17 +05:30 committed by Paul B Mahol
parent 270068b5af
commit 31d7b17c46
3 changed files with 16 additions and 0 deletions

View File

@ -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;

View File

@ -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

View File

@ -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;