[FFmpeg-cvslog] vaapi_h264: Add support for SEI recovery points
Mark Thompson
git at videolan.org
Tue Oct 17 22:58:33 EEST 2017
ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Sun May 7 23:02:09 2017 +0100| [0bc7575ced65bf4aa4678ac12d550aaf87890d0e] | committer: Mark Thompson
vaapi_h264: Add support for SEI recovery points
Included by default with non-IDR intra frames.
(cherry picked from commit a49ee60d5fdbdae1706a44cfbb814abb9793815f)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0bc7575ced65bf4aa4678ac12d550aaf87890d0e
---
libavcodec/vaapi_encode_h264.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index b147457b75..201e94a8ce 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -37,6 +37,7 @@
enum {
SEI_TIMING = 0x01,
SEI_IDENTIFIER = 0x02,
+ SEI_RECOVERY_POINT = 0x04,
};
// Random (version 4) ISO 11578 UUID.
@@ -61,6 +62,7 @@ typedef struct VAAPIEncodeH264Context {
H264RawSEIBufferingPeriod buffering_period;
H264RawSEIPicTiming pic_timing;
+ H264RawSEIRecoveryPoint recovery_point;
H264RawSEIUserDataUnregistered identifier;
char *identifier_string;
@@ -232,6 +234,11 @@ static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx,
priv->sei.payload[i].payload.pic_timing = priv->pic_timing;
++i;
}
+ if (opt->sei & SEI_RECOVERY_POINT && pic->type == PICTURE_TYPE_I) {
+ priv->sei.payload[i].payload_type = H264_SEI_TYPE_RECOVERY_POINT;
+ priv->sei.payload[i].payload.recovery_point = priv->recovery_point;
+ ++i;
+ }
priv->sei.payload_count = i;
av_assert0(priv->sei.payload_count > 0);
@@ -617,6 +624,14 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx,
priv->sei_needed = 1;
}
+ if (opt->sei & SEI_RECOVERY_POINT && pic->type == PICTURE_TYPE_I) {
+ priv->recovery_point.recovery_frame_cnt = 0;
+ priv->recovery_point.exact_match_flag = 1;
+ priv->recovery_point.broken_link_flag = ctx->b_per_p > 0;
+
+ priv->sei_needed = 1;
+ }
+
vpic->CurrPic = (VAPictureH264) {
.picture_id = pic->recon_surface,
.frame_idx = priv->frame_num,
@@ -966,7 +981,7 @@ static const AVOption vaapi_encode_h264_options[] = {
{ "sei", "Set SEI to include",
OFFSET(sei), AV_OPT_TYPE_FLAGS,
- { .i64 = SEI_IDENTIFIER | SEI_TIMING },
+ { .i64 = SEI_IDENTIFIER | SEI_TIMING | SEI_RECOVERY_POINT },
0, INT_MAX, FLAGS, "sei" },
{ "identifier", "Include encoder version identifier",
0, AV_OPT_TYPE_CONST, { .i64 = SEI_IDENTIFIER },
@@ -974,6 +989,9 @@ static const AVOption vaapi_encode_h264_options[] = {
{ "timing", "Include timing parameters (buffering_period and pic_timing)",
0, AV_OPT_TYPE_CONST, { .i64 = SEI_TIMING },
INT_MIN, INT_MAX, FLAGS, "sei" },
+ { "recovery_point", "Include recovery points where appropriate",
+ 0, AV_OPT_TYPE_CONST, { .i64 = SEI_RECOVERY_POINT },
+ INT_MIN, INT_MAX, FLAGS, "sei" },
{ NULL },
};
More information about the ffmpeg-cvslog
mailing list