[FFmpeg-devel] [PATCH] lavc/vaapi_encode_h265: add low_delay_b option for HEVC

Fu, Linjie linjie.fu at intel.com
Mon Apr 13 12:11:32 EEST 2020


> From: mypopy at gmail.com <mypopy at gmail.com>
> Sent: Monday, April 13, 2020 15:43
> To: FFmpeg development discussions and patches <ffmpeg-
> devel at ffmpeg.org>
> Cc: Fu, Linjie <linjie.fu at intel.com>
> Subject: Re: [FFmpeg-devel] [PATCH] lavc/vaapi_encode_h265: add
> low_delay_b option for HEVC
> 
> On Mon, Apr 13, 2020 at 12:39 PM Linjie Fu <linjie.fu at intel.com> wrote:
> >
> > Low delay B-frame is supported on ICL+ platform.
> >
> > For low power encoding, low_delay_b should be enabled by default.
> >
> > Low delay B:
> > <http://what-when-how.com/Tutorial/topic-397pct9eq3/High-Efficiency-
> Video-Coding-HEVC-288.html>
> >
> > There is an on-going work in libva and media-driver to add querys
> > support for low delay b, would add it once it's ready:
> > https://github.com/intel/libva/pull/220
> > https://github.com/intel/libva/pull/364
> > https://github.com/intel/media-driver/issues/721
> >
> > Signed-off-by: Linjie Fu <linjie.fu at intel.com>
> > ---
> >  doc/encoders.texi              |  8 ++++++++
> >  libavcodec/vaapi_encode_h265.c | 19 +++++++++++++++++--
> >  2 files changed, 25 insertions(+), 2 deletions(-)
> >
> > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > index e23b6b3..b0812be 100644
> > --- a/doc/encoders.texi
> > +++ b/doc/encoders.texi
> > @@ -3089,6 +3089,14 @@ Some combination of the following values:
> >  Include HDR metadata if the input frames have it
> >  (@emph{mastering_display_colour_volume} and
> @emph{content_light_level}
> >  messages).
> > +
> > + at item low_delay_b
> > +Use low delay B-frames instead of P frames. Reordering of pictures is
> > +not allowed. The first picture is encoded as an I picture and subsequent
> > +pictures are encoded as B pictures. Moreover, since past B pictures are
> > +used for prediction, a low coding delay but with higher coding efficiency
> > +(because of bi-prediction) is achieved.
> > +
> >  @end table
> >
> >  @end table
> > diff --git a/libavcodec/vaapi_encode_h265.c
> b/libavcodec/vaapi_encode_h265.c
> > index 97dc5a7..cd48545 100644
> > --- a/libavcodec/vaapi_encode_h265.c
> > +++ b/libavcodec/vaapi_encode_h265.c
> > @@ -62,6 +62,7 @@ typedef struct VAAPIEncodeH265Context {
> >      int tier;
> >      int level;
> >      int sei;
> > +    int low_delay_b;
> >
> >      // Derived settings.
> >      int fixed_qp_idr;
> > @@ -894,6 +895,9 @@ static int
> vaapi_encode_h265_init_slice_params(AVCodecContext *avctx,
> >
> >      sh->slice_type = hpic->slice_type;
> >
> > +    if (sh->slice_type == HEVC_SLICE_P && priv->low_delay_b)
> > +        sh->slice_type = HEVC_SLICE_B;
> Add a trace or info message in this, it's will help to reduce the
> sudden surprises, 

Yes, considered this and the trace/info message for low_delay_b change
was added in vaapi_encode_h265_init() as a AV_LOG_VERBOSE Information,
so I didn't prompt a debug information for each slice.

> the other question is, if enable the  low_delay_b in
>  ICL-  platform, what is the result of this?

Possibly leads to encoding failure.
And that's why a query support is necessary for this option/feature on ICL-.


While replying this mail, I noticed this patch is insufficient. 
Will update a new one, sorry for the noise.

- Linjie


More information about the ffmpeg-devel mailing list