diff mbox

[FFmpeg-devel] lavc/qsvenc: disable h264 look_ahead by default

Message ID 1519881619-15154-1-git-send-email-zhong.li@intel.com
State Accepted
Commit 0645698ecc2021ec422b625a6c1d235d2f252563
Headers show

Commit Message

Zhong Li March 1, 2018, 5:20 a.m. UTC
Look_ahead can provide quality improvements, but would better disable it by default due to some reasons:
1. It is only available for some codecs (e.g. HEVC is not supported) on Intel
   Haswell and plus platforms. Thus means it will be failed on some platforms.
2. It significantly increases encoding latency and memory consumption.
3. It may overwrite some other options such as CBR and CAVLC.

Signed-off-by: Zhong Li <zhong.li@intel.com>
---
 libavcodec/qsvenc_h264.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Thompson March 6, 2018, 12:31 a.m. UTC | #1
On 01/03/18 05:20, Zhong Li wrote:
> Look_ahead can provide quality improvements, but would better disable it by default due to some reasons:
> 1. It is only available for some codecs (e.g. HEVC is not supported) on Intel
>    Haswell and plus platforms. Thus means it will be failed on some platforms.
> 2. It significantly increases encoding latency and memory consumption.
> 3. It may overwrite some other options such as CBR and CAVLC.
> 
> Signed-off-by: Zhong Li <zhong.li@intel.com>
> ---
>  libavcodec/qsvenc_h264.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
> index 09e4c0e..e01a2a3 100644
> --- a/libavcodec/qsvenc_h264.c
> +++ b/libavcodec/qsvenc_h264.c
> @@ -109,7 +109,7 @@ static const AVOption options[] = {
>      { "max_dec_frame_buffering", "Maximum number of frames buffered in the DPB", OFFSET(qsv.max_dec_frame_buffering), AV_OPT_TYPE_INT, { .i64 = 0 },   0, UINT16_MAX, VE },
>  
>  #if QSV_HAVE_LA
> -    { "look_ahead",       "Use VBR algorithm with look ahead",    OFFSET(qsv.look_ahead),       AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
> +    { "look_ahead",       "Use VBR algorithm with look ahead",    OFFSET(qsv.look_ahead),       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 },
>  #endif
>  #if QSV_HAVE_LA_DS
> 

I agree with everything you've said, so applied.

(I held off from making essentially this change in previous merges for compatibility with existing command-lines, but I think given that the next release will be a new major version that shouldn't block it now.)

Thanks,

- Mark
Zhong Li March 6, 2018, 8:41 a.m. UTC | #2
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Mark Thompson

> Sent: Tuesday, March 6, 2018 8:32 AM

> To: ffmpeg-devel@ffmpeg.org

> Subject: Re: [FFmpeg-devel] [PATCH] lavc/qsvenc: disable h264 look_ahead

> by default

> 

> On 01/03/18 05:20, Zhong Li wrote:

> > Look_ahead can provide quality improvements, but would better disable it

> by default due to some reasons:

> > 1. It is only available for some codecs (e.g. HEVC is not supported) on Intel

> >    Haswell and plus platforms. Thus means it will be failed on some

> platforms.

> > 2. It significantly increases encoding latency and memory consumption.

> > 3. It may overwrite some other options such as CBR and CAVLC.

> >

> > Signed-off-by: Zhong Li <zhong.li@intel.com>

> > ---

> >  libavcodec/qsvenc_h264.c | 2 +-

> >  1 file changed, 1 insertion(+), 1 deletion(-)

> >

> > diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index

> > 09e4c0e..e01a2a3 100644

> > --- a/libavcodec/qsvenc_h264.c

> > +++ b/libavcodec/qsvenc_h264.c

> > @@ -109,7 +109,7 @@ static const AVOption options[] = {

> >      { "max_dec_frame_buffering", "Maximum number of frames

> buffered in the DPB", OFFSET(qsv.max_dec_frame_buffering),

> AV_OPT_TYPE_INT, { .i64 = 0 },   0, UINT16_MAX, VE },

> >

> >  #if QSV_HAVE_LA

> > -    { "look_ahead",       "Use VBR algorithm with look ahead",

> OFFSET(qsv.look_ahead),       AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },

> > +    { "look_ahead",       "Use VBR algorithm with look ahead",

> OFFSET(qsv.look_ahead),       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 },  #endif  #if QSV_HAVE_LA_DS

> >

> 

> I agree with everything you've said, so applied.


Thanks!
diff mbox

Patch

diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 09e4c0e..e01a2a3 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -109,7 +109,7 @@  static const AVOption options[] = {
     { "max_dec_frame_buffering", "Maximum number of frames buffered in the DPB", OFFSET(qsv.max_dec_frame_buffering), AV_OPT_TYPE_INT, { .i64 = 0 },   0, UINT16_MAX, VE },
 
 #if QSV_HAVE_LA
-    { "look_ahead",       "Use VBR algorithm with look ahead",    OFFSET(qsv.look_ahead),       AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
+    { "look_ahead",       "Use VBR algorithm with look ahead",    OFFSET(qsv.look_ahead),       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 },
 #endif
 #if QSV_HAVE_LA_DS