diff mbox series

[FFmpeg-devel,V2] libavcodec/qsvenc: Add DisableDeblockingIdc support to qsv

Message ID 20220112052850.1147160-1-wenbin.chen@intel.com
State New
Headers show
Series [FFmpeg-devel,V2] libavcodec/qsvenc: Add DisableDeblockingIdc support to qsv | expand

Checks

Context Check Description
andriy/configurex86 warning Failed to apply patch
andriy/configureppc warning Failed to apply patch
andriy/configureaarch64_jetson warning Failed to apply patch
andriy/configurearmv7_RPi4 warning Failed to apply patch

Commit Message

Wenbin Chen Jan. 12, 2022, 5:28 a.m. UTC
Add dblk_idc option to 264_qsv and hevc_qsv. Turining on this opion can
disable deblocking.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
---
 doc/encoders.texi   | 6 ++++++
 libavcodec/qsvenc.c | 8 ++++++++
 libavcodec/qsvenc.h | 3 +++
 3 files changed, 17 insertions(+)

Comments

Xiang, Haihao Jan. 13, 2022, 4:08 a.m. UTC | #1
On Wed, 2022-01-12 at 13:28 +0800, Wenbin Chen wrote:
> Add dblk_idc option to 264_qsv and hevc_qsv. Turining on this opion can
> disable deblocking.
> 
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> ---
>  doc/encoders.texi   | 6 ++++++
>  libavcodec/qsvenc.c | 8 ++++++++
>  libavcodec/qsvenc.h | 3 +++
>  3 files changed, 17 insertions(+)
> 
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index 68921fbd40..6fc94daa11 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -3299,6 +3299,9 @@ This flag controls changing of frame type from B to P.
>  @item @var{b_strategy}
>  This option controls usage of B frames as reference.
>  
> +@item @var{dblk_idc}
> +This option disable deblocking. It has value in range 0~2.
> +
>  @item @var{cavlc}
>  If set, CAVLC is used; if unset, CABAC is used for encoding.
>  
> @@ -3391,6 +3394,9 @@ Enable rate distortion optimization.
>  @item @var{max_frame_size}
>  Maximum encoded frame size in bytes.
>  
> +@item @var{dblk_idc}
> +This option disable deblocking. It has value in range 0~2.
> +
>  @item @var{idr_interval}
>  Distance (in I-frames) between IDR frames.
>  @table @samp
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index a13718652e..3a51d00ca9 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -346,6 +346,10 @@ static void dump_video_param(AVCodecContext *avctx,
> QSVEncContext *q,
>      av_log(avctx, AV_LOG_VERBOSE, "FrameRateExtD: %"PRIu32"; FrameRateExtN:
> %"PRIu32" \n",
>             info->FrameInfo.FrameRateExtD, info->FrameInfo.FrameRateExtN);
>  
> +#if QSV_HAVE_DISABLEDEBLOCKIDC
> +    av_log(avctx, AV_LOG_VERBOSE, "DisableDeblockingIdc: %"PRIu32" \n", co2-
> >DisableDeblockingIdc);
> +#endif
> +
>  }
>  
>  static void dump_video_vp9_param(AVCodecContext *avctx, QSVEncContext *q,
> @@ -885,6 +889,10 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>                  q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
>              if (q->max_frame_size >= 0)
>                  q->extco2.MaxFrameSize = q->max_frame_size;
> +#if QSV_HAVE_DISABLEDEBLOCKIDC
> +            if(q->dblk_idc >= 0)
> +                q->extco2.DisableDeblockingIdc = q->dblk_idc;
> +#endif
>  
>  #if QSV_VERSION_ATLEAST(1, 9)
>              if (avctx->qmin >= 0 && avctx->qmax >= 0 && avctx->qmin > avctx-
> >qmax) {
> diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
> index 31516b8e55..aa49b35f07 100644
> --- a/libavcodec/qsvenc.h
> +++ b/libavcodec/qsvenc.h
> @@ -44,6 +44,7 @@
>  
>  #define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8)
>  #define QSV_HAVE_MAX_SLICE_SIZE QSV_VERSION_ATLEAST(1, 9)
> +#define QSV_HAVE_DISABLEDEBLOCKIDC QSV_VERSION_ATLEAST(1, 9)
>  #define QSV_HAVE_BREF_TYPE      QSV_VERSION_ATLEAST(1, 8)
>  
>  #define QSV_HAVE_LA     QSV_VERSION_ATLEAST(1, 7)
> @@ -97,6 +98,7 @@
>  { "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 =
> -1}, -1, 1, VE},\
> +{ "dblk_idc", "This option disable deblocking. It has value in range
> 0~2.",   OFFSET(qsv.dblk_idc),   AV_OPT_TYPE_INT,    { .i64 = -1 },   -
> 1,  2,  VE},    \
>  
>  extern const AVCodecHWConfigInternal *const ff_qsv_enc_hw_configs[];
>  
> @@ -169,6 +171,7 @@ typedef struct QSVEncContext {
>      int rdo;
>      int max_frame_size;
>      int max_slice_size;
> +    int dblk_idc;
>  
>      int tile_cols;
>      int tile_rows;


patchwork failed to apply this patch, see 
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20220112052850.1147160-1-wenbin.chen@intel.com/

Thanks
Haihao
Wenbin Chen Jan. 13, 2022, 5:11 a.m. UTC | #2
> On Wed, 2022-01-12 at 13:28 +0800, Wenbin Chen wrote:
> > Add dblk_idc option to 264_qsv and hevc_qsv. Turining on this opion can
> > disable deblocking.
> >
> > Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> > ---
> >  doc/encoders.texi   | 6 ++++++
> >  libavcodec/qsvenc.c | 8 ++++++++
> >  libavcodec/qsvenc.h | 3 +++
> >  3 files changed, 17 insertions(+)
> >
> > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > index 68921fbd40..6fc94daa11 100644
> > --- a/doc/encoders.texi
> > +++ b/doc/encoders.texi
> > @@ -3299,6 +3299,9 @@ This flag controls changing of frame type from B
> to P.
> >  @item @var{b_strategy}
> >  This option controls usage of B frames as reference.
> >
> > +@item @var{dblk_idc}
> > +This option disable deblocking. It has value in range 0~2.
> > +
> >  @item @var{cavlc}
> >  If set, CAVLC is used; if unset, CABAC is used for encoding.
> >
> > @@ -3391,6 +3394,9 @@ Enable rate distortion optimization.
> >  @item @var{max_frame_size}
> >  Maximum encoded frame size in bytes.
> >
> > +@item @var{dblk_idc}
> > +This option disable deblocking. It has value in range 0~2.
> > +
> >  @item @var{idr_interval}
> >  Distance (in I-frames) between IDR frames.
> >  @table @samp
> > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> > index a13718652e..3a51d00ca9 100644
> > --- a/libavcodec/qsvenc.c
> > +++ b/libavcodec/qsvenc.c
> > @@ -346,6 +346,10 @@ static void dump_video_param(AVCodecContext
> *avctx,
> > QSVEncContext *q,
> >      av_log(avctx, AV_LOG_VERBOSE, "FrameRateExtD: %"PRIu32";
> FrameRateExtN:
> > %"PRIu32" \n",
> >             info->FrameInfo.FrameRateExtD, info->FrameInfo.FrameRateExtN);
> >
> > +#if QSV_HAVE_DISABLEDEBLOCKIDC
> > +    av_log(avctx, AV_LOG_VERBOSE, "DisableDeblockingIdc: %"PRIu32" \n",
> co2-
> > >DisableDeblockingIdc);
> > +#endif
> > +
> >  }
> >
> >  static void dump_video_vp9_param(AVCodecContext *avctx,
> QSVEncContext *q,
> > @@ -885,6 +889,10 @@ static int init_video_param(AVCodecContext
> *avctx,
> > QSVEncContext *q)
> >                  q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON :
> > MFX_CODINGOPTION_OFF;
> >              if (q->max_frame_size >= 0)
> >                  q->extco2.MaxFrameSize = q->max_frame_size;
> > +#if QSV_HAVE_DISABLEDEBLOCKIDC
> > +            if(q->dblk_idc >= 0)
> > +                q->extco2.DisableDeblockingIdc = q->dblk_idc;
> > +#endif
> >
> >  #if QSV_VERSION_ATLEAST(1, 9)
> >              if (avctx->qmin >= 0 && avctx->qmax >= 0 && avctx->qmin > avctx-
> > >qmax) {
> > diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
> > index 31516b8e55..aa49b35f07 100644
> > --- a/libavcodec/qsvenc.h
> > +++ b/libavcodec/qsvenc.h
> > @@ -44,6 +44,7 @@
> >
> >  #define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8)
> >  #define QSV_HAVE_MAX_SLICE_SIZE QSV_VERSION_ATLEAST(1, 9)
> > +#define QSV_HAVE_DISABLEDEBLOCKIDC QSV_VERSION_ATLEAST(1, 9)
> >  #define QSV_HAVE_BREF_TYPE      QSV_VERSION_ATLEAST(1, 8)
> >
> >  #define QSV_HAVE_LA     QSV_VERSION_ATLEAST(1, 7)
> > @@ -97,6 +98,7 @@
> >  { "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 =
> > -1}, -1, 1, VE},\
> > +{ "dblk_idc", "This option disable deblocking. It has value in range
> > 0~2.",   OFFSET(qsv.dblk_idc),   AV_OPT_TYPE_INT,    { .i64 = -1 },   -
> > 1,  2,  VE},    \
> >
> >  extern const AVCodecHWConfigInternal *const ff_qsv_enc_hw_configs[];
> >
> > @@ -169,6 +171,7 @@ typedef struct QSVEncContext {
> >      int rdo;
> >      int max_frame_size;
> >      int max_slice_size;
> > +    int dblk_idc;
> >
> >      int tile_cols;
> >      int tile_rows;
> 
> 
> patchwork failed to apply this patch, see
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20220112052850.1147
> 160-1-wenbin.chen@intel.com/
> 
> Thanks
> Haihao

I see. I should submit patches in one patchset. I will resubmit them.

Thanks
Wenbin
> 
> 
> _______________________________________________
> 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/doc/encoders.texi b/doc/encoders.texi
index 68921fbd40..6fc94daa11 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -3299,6 +3299,9 @@  This flag controls changing of frame type from B to P.
 @item @var{b_strategy}
 This option controls usage of B frames as reference.
 
+@item @var{dblk_idc}
+This option disable deblocking. It has value in range 0~2.
+
 @item @var{cavlc}
 If set, CAVLC is used; if unset, CABAC is used for encoding.
 
@@ -3391,6 +3394,9 @@  Enable rate distortion optimization.
 @item @var{max_frame_size}
 Maximum encoded frame size in bytes.
 
+@item @var{dblk_idc}
+This option disable deblocking. It has value in range 0~2.
+
 @item @var{idr_interval}
 Distance (in I-frames) between IDR frames.
 @table @samp
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index a13718652e..3a51d00ca9 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -346,6 +346,10 @@  static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q,
     av_log(avctx, AV_LOG_VERBOSE, "FrameRateExtD: %"PRIu32"; FrameRateExtN: %"PRIu32" \n",
            info->FrameInfo.FrameRateExtD, info->FrameInfo.FrameRateExtN);
 
+#if QSV_HAVE_DISABLEDEBLOCKIDC
+    av_log(avctx, AV_LOG_VERBOSE, "DisableDeblockingIdc: %"PRIu32" \n", co2->DisableDeblockingIdc);
+#endif
+
 }
 
 static void dump_video_vp9_param(AVCodecContext *avctx, QSVEncContext *q,
@@ -885,6 +889,10 @@  static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
                 q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
             if (q->max_frame_size >= 0)
                 q->extco2.MaxFrameSize = q->max_frame_size;
+#if QSV_HAVE_DISABLEDEBLOCKIDC
+            if(q->dblk_idc >= 0)
+                q->extco2.DisableDeblockingIdc = q->dblk_idc;
+#endif
 
 #if QSV_VERSION_ATLEAST(1, 9)
             if (avctx->qmin >= 0 && avctx->qmax >= 0 && avctx->qmin > avctx->qmax) {
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index 31516b8e55..aa49b35f07 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -44,6 +44,7 @@ 
 
 #define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8)
 #define QSV_HAVE_MAX_SLICE_SIZE QSV_VERSION_ATLEAST(1, 9)
+#define QSV_HAVE_DISABLEDEBLOCKIDC QSV_VERSION_ATLEAST(1, 9)
 #define QSV_HAVE_BREF_TYPE      QSV_VERSION_ATLEAST(1, 8)
 
 #define QSV_HAVE_LA     QSV_VERSION_ATLEAST(1, 7)
@@ -97,6 +98,7 @@ 
 { "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 = -1}, -1, 1, VE},\
+{ "dblk_idc", "This option disable deblocking. It has value in range 0~2.",   OFFSET(qsv.dblk_idc),   AV_OPT_TYPE_INT,    { .i64 = -1 },   -1,  2,  VE},    \
 
 extern const AVCodecHWConfigInternal *const ff_qsv_enc_hw_configs[];
 
@@ -169,6 +171,7 @@  typedef struct QSVEncContext {
     int rdo;
     int max_frame_size;
     int max_slice_size;
+    int dblk_idc;
 
     int tile_cols;
     int tile_rows;