Message ID | 20211009015949.1510-1-haihao.xiang@intel.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] qsvenc_hevc: Enable look ahead with ExtBRC | expand |
On Sat, 2021-10-09 at 09:59 +0800, Haihao Xiang wrote: > From: Daniel Socek <daniel.socek@intel.com> > > Signed-off-by: Daniel Socek <daniel.socek@intel.com> > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> > --- > libavcodec/qsvenc.c | 3 +++ > libavcodec/qsvenc_hevc.c | 1 + > 2 files changed, 4 insertions(+) > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c > index 06f55604b5..e21a9b1207 100644 > --- a/libavcodec/qsvenc.c > +++ b/libavcodec/qsvenc.c > @@ -610,6 +610,9 @@ static int init_video_param(AVCodecContext *avctx, > QSVEncContext *q) > switch (q->param.mfx.RateControlMethod) { > case MFX_RATECONTROL_CBR: > case MFX_RATECONTROL_VBR: > + if (q->extbrc) { > + q->extco2.LookAheadDepth = q->look_ahead_depth; > + } > #if QSV_HAVE_VCM > case MFX_RATECONTROL_VCM: > #endif > diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c > index b7b2f5633e..8af2aa0c07 100644 > --- a/libavcodec/qsvenc_hevc.c > +++ b/libavcodec/qsvenc_hevc.c > @@ -248,6 +248,7 @@ static const AVOption options[] = { > { "tile_rows", "Number of rows for tiled > encoding", OFFSET(qsv.tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, > UINT16_MAX, VE }, > { "recovery_point_sei", "Insert recovery point SEI > messages", OFFSET(qsv.recovery_point_sei), AV_OPT_TYPE_INT, { .i64 > = -1 }, -1, 1, VE }, > { "aud", "Insert the Access Unit Delimiter NAL", OFFSET(qsv.aud), > AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE}, > + { "look_ahead_depth", "Depth of look ahead in number frames", > OFFSET(qsv.look_ahead_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, VE }, > > { NULL }, > }; Any comment for this patch ? Could someone help to merge this patch if no objection ? Thanks Haihao
>Xiang, Haihao <haihao.xiang@intel.com> 于2021年12月6日周一 上午11:09写道: > Any comment for this patch ? Could someone help to merge this patch if no > objection ? LGTM, will apply.
Xiang, Haihao <haihao.xiang@intel.com> 于2021年12月6日周一 11:09写道: > > --- a/libavcodec/qsvenc_hevc.c > > +++ b/libavcodec/qsvenc_hevc.c > > @@ -248,6 +248,7 @@ static const AVOption options[] = { > > { "tile_rows", "Number of rows for tiled > > encoding", OFFSET(qsv.tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, > > UINT16_MAX, VE }, > > { "recovery_point_sei", "Insert recovery point SEI > > messages", OFFSET(qsv.recovery_point_sei), AV_OPT_TYPE_INT, { .i64 > > = -1 }, -1, 1, VE }, > > { "aud", "Insert the Access Unit Delimiter NAL", OFFSET(qsv.aud), > > AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE}, > > + { "look_ahead_depth", "Depth of look ahead in number frames", > > OFFSET(qsv.look_ahead_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, VE }, > > > > { NULL }, > > }; > > Any comment for this patch ? Could someone help to merge this patch if no > objection ? How to verify this function? is it depended on a special version of MSDK && vaapi-driver? I tried to enable extbrc and disable/enable look_ahead_depth (set to zero/20) for hevc_qsv but found there are no difference of the encoded files.
On Sun, 2021-12-19 at 23:55 +0800, Zhong Li wrote: > Xiang, Haihao <haihao.xiang@intel.com> 于2021年12月6日周一 11:09写道: > > > --- a/libavcodec/qsvenc_hevc.c > > > +++ b/libavcodec/qsvenc_hevc.c > > > @@ -248,6 +248,7 @@ static const AVOption options[] = { > > > { "tile_rows", "Number of rows for tiled > > > encoding", OFFSET(qsv.tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, > > > 0, > > > UINT16_MAX, VE }, > > > { "recovery_point_sei", "Insert recovery point SEI > > > messages", OFFSET(qsv.recovery_point_sei), AV_OPT_TYPE_INT, { > > > .i64 > > > = -1 }, -1, 1, VE }, > > > { "aud", "Insert the Access Unit Delimiter NAL", OFFSET(qsv.aud), > > > AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE}, > > > + { "look_ahead_depth", "Depth of look ahead in number frames", > > > OFFSET(qsv.look_ahead_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, VE }, > > > > > > { NULL }, > > > }; > > > > Any comment for this patch ? Could someone help to merge this patch if no > > objection ? > > How to verify this function? is it depended on a special version of > MSDK && vaapi-driver? > I tried to enable extbrc and disable/enable look_ahead_depth (set to > zero/20) for hevc_qsv but found there are no difference of the encoded > files. AFAIK this function depends on your MSDK runtime. There is no impact when user turns on this option but the MSDK runtime doesn't support it. Thanks Haihao
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 06f55604b5..e21a9b1207 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -610,6 +610,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) switch (q->param.mfx.RateControlMethod) { case MFX_RATECONTROL_CBR: case MFX_RATECONTROL_VBR: + if (q->extbrc) { + q->extco2.LookAheadDepth = q->look_ahead_depth; + } #if QSV_HAVE_VCM case MFX_RATECONTROL_VCM: #endif diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index b7b2f5633e..8af2aa0c07 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -248,6 +248,7 @@ static const AVOption options[] = { { "tile_rows", "Number of rows for tiled encoding", OFFSET(qsv.tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT16_MAX, VE }, { "recovery_point_sei", "Insert recovery point SEI messages", OFFSET(qsv.recovery_point_sei), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, { "aud", "Insert the Access Unit Delimiter NAL", OFFSET(qsv.aud), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE}, + { "look_ahead_depth", "Depth of look ahead in number frames", OFFSET(qsv.look_ahead_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, VE }, { NULL }, };