diff mbox series

[FFmpeg-devel] lavc/qsvenc: let the SDK to choose the encoding mode by default

Message ID 20200928073148.1293502-1-haihao.xiang@intel.com
State New
Headers show
Series [FFmpeg-devel] lavc/qsvenc: let the SDK to choose the encoding mode by default
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Xiang, Haihao Sept. 28, 2020, 7:31 a.m. UTC
The SDK may support LowPower and non-LowPower modes, some features are
available only under one of the two modes. It is hard for user to know
whether a feature is supported under the given mode, so let the SDK to
choose a mode for encoding by default.
---
 libavcodec/qsvenc.c | 6 ++++--
 libavcodec/qsvenc.h | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Max Dmitrichenko Sept. 28, 2020, 8:05 a.m. UTC | #1
it would be good to describe the change a bit more clearly,
something like: Allows MediaSDK *runtime *to choose LowPower/non-LowPower
modes, if not explicitly set.

regards
Max

On Mon, Sep 28, 2020 at 9:32 AM Haihao Xiang <haihao.xiang@intel.com> wrote:

> The SDK may support LowPower and non-LowPower modes, some features are
> available only under one of the two modes. It is hard for user to know
> whether a feature is supported under the given mode, so let the SDK to
> choose a mode for encoding by default.
> ---
>  libavcodec/qsvenc.c | 6 ++++--
>  libavcodec/qsvenc.h | 2 +-
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 1ed8f5d973..cff96e59c9 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -510,7 +510,7 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>          }
>      }
>
> -    if (q->low_power) {
> +    if (q->low_power == 1) {
>  #if QSV_HAVE_VDENC
>          q->param.mfx.LowPower = MFX_CODINGOPTION_ON;
>  #else
> @@ -519,7 +519,9 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>          q->low_power = 0;
>          q->param.mfx.LowPower = MFX_CODINGOPTION_OFF;
>  #endif
> -    } else
> +    } else if (q->low_power == -1)
> +        q->param.mfx.LowPower = MFX_CODINGOPTION_UNKNOWN;
> +    else
>          q->param.mfx.LowPower = MFX_CODINGOPTION_OFF;
>
>      q->param.mfx.CodecProfile       = q->profile;
> diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
> index 4f579d1db1..577775cc1a 100644
> --- a/libavcodec/qsvenc.h
> +++ b/libavcodec/qsvenc.h
> @@ -96,7 +96,7 @@
>  { "adaptive_b",     "Adaptive B-frame placement",
>  OFFSET(qsv.adaptive_b),     AV_OPT_TYPE_INT, { .i64 = -1 }, -1,
> 1, VE },                         \
>  { "b_strategy",     "Strategy to choose between I/P/B-frames",
> OFFSET(qsv.b_strategy),    AV_OPT_TYPE_INT, { .i64 = -1 }, -1,          1,
> VE },                         \
>  { "forced_idr",     "Forcing I frames as IDR frames",
>  OFFSET(qsv.forced_idr),     AV_OPT_TYPE_BOOL,{ .i64 = 0  },  0,
> 1, VE },                         \
> -{ "low_power", "enable low power mode(experimental: many limitations by
> mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, {
> .i64 = 0}, 0, 1, VE},\
> +{ "low_power", "enable low power mode(experimental: many limitations by
> mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, {
> .i64 = -1}, -1, 1, VE},\
>
>  extern const AVCodecHWConfigInternal *ff_qsv_enc_hw_configs[];
>
> --
> 2.25.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Xiang, Haihao Sept. 29, 2020, 2:34 a.m. UTC | #2
> it would be good to describe the change a bit more clearly,
> something like: Allows MediaSDK *runtime *to choose LowPower/non-LowPower
> modes, if not explicitly set.

Thanks for the comment, I will update the commit log.

Regards
Haihao

> regards
> Max
> 
> On Mon, Sep 28, 2020 at 9:32 AM Haihao Xiang <haihao.xiang@intel.com> wrote:
> 
> > The SDK may support LowPower and non-LowPower modes, some features are
> > available only under one of the two modes. It is hard for user to know
> > whether a feature is supported under the given mode, so let the SDK to
> > choose a mode for encoding by default.
> > ---
> >  libavcodec/qsvenc.c | 6 ++++--
> >  libavcodec/qsvenc.h | 2 +-
> >  2 files changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> > index 1ed8f5d973..cff96e59c9 100644
> > --- a/libavcodec/qsvenc.c
> > +++ b/libavcodec/qsvenc.c
> > @@ -510,7 +510,7 @@ static int init_video_param(AVCodecContext *avctx,
> > QSVEncContext *q)
> >          }
> >      }
> > 
> > -    if (q->low_power) {
> > +    if (q->low_power == 1) {
> >  #if QSV_HAVE_VDENC
> >          q->param.mfx.LowPower = MFX_CODINGOPTION_ON;
> >  #else
> > @@ -519,7 +519,9 @@ static int init_video_param(AVCodecContext *avctx,
> > QSVEncContext *q)
> >          q->low_power = 0;
> >          q->param.mfx.LowPower = MFX_CODINGOPTION_OFF;
> >  #endif
> > -    } else
> > +    } else if (q->low_power == -1)
> > +        q->param.mfx.LowPower = MFX_CODINGOPTION_UNKNOWN;
> > +    else
> >          q->param.mfx.LowPower = MFX_CODINGOPTION_OFF;
> > 
> >      q->param.mfx.CodecProfile       = q->profile;
> > diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
> > index 4f579d1db1..577775cc1a 100644
> > --- a/libavcodec/qsvenc.h
> > +++ b/libavcodec/qsvenc.h
> > @@ -96,7 +96,7 @@
> >  { "adaptive_b",     "Adaptive B-frame placement",
> >  OFFSET(qsv.adaptive_b),     AV_OPT_TYPE_INT, { .i64 = -1 }, -1,
> > 1, VE },                         \
> >  { "b_strategy",     "Strategy to choose between I/P/B-frames",
> > OFFSET(qsv.b_strategy),    AV_OPT_TYPE_INT, { .i64 = -1 }, -1,          1,
> > VE },                         \
> >  { "forced_idr",     "Forcing I frames as IDR frames",
> >  OFFSET(qsv.forced_idr),     AV_OPT_TYPE_BOOL,{ .i64 = 0  },  0,
> > 1, VE },                         \
> > -{ "low_power", "enable low power mode(experimental: many limitations by
> > mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, {
> > .i64 = 0}, 0, 1, VE},\
> > +{ "low_power", "enable low power mode(experimental: many limitations by
> > mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, {
> > .i64 = -1}, -1, 1, VE},\
> > 
> >  extern const AVCodecHWConfigInternal *ff_qsv_enc_hw_configs[];
> > 
> > --
> > 2.25.1
> > 
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > 
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 1ed8f5d973..cff96e59c9 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -510,7 +510,7 @@  static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
         }
     }
 
-    if (q->low_power) {
+    if (q->low_power == 1) {
 #if QSV_HAVE_VDENC
         q->param.mfx.LowPower = MFX_CODINGOPTION_ON;
 #else
@@ -519,7 +519,9 @@  static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
         q->low_power = 0;
         q->param.mfx.LowPower = MFX_CODINGOPTION_OFF;
 #endif
-    } else
+    } else if (q->low_power == -1)
+        q->param.mfx.LowPower = MFX_CODINGOPTION_UNKNOWN;
+    else
         q->param.mfx.LowPower = MFX_CODINGOPTION_OFF;
 
     q->param.mfx.CodecProfile       = q->profile;
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index 4f579d1db1..577775cc1a 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -96,7 +96,7 @@ 
 { "adaptive_b",     "Adaptive B-frame placement",             OFFSET(qsv.adaptive_b),     AV_OPT_TYPE_INT, { .i64 = -1 }, -1,          1, VE },                         \
 { "b_strategy",     "Strategy to choose between I/P/B-frames", OFFSET(qsv.b_strategy),    AV_OPT_TYPE_INT, { .i64 = -1 }, -1,          1, VE },                         \
 { "forced_idr",     "Forcing I frames as IDR frames",         OFFSET(qsv.forced_idr),     AV_OPT_TYPE_BOOL,{ .i64 = 0  },  0,          1, VE },                         \
-{ "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, VE},\
+{ "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = -1}, -1, 1, VE},\
 
 extern const AVCodecHWConfigInternal *ff_qsv_enc_hw_configs[];