Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding support for VP9
@ 2022-01-13  5:45 Haihao Xiang
  2022-01-17  8:30 ` Xiang, Haihao
  0 siblings, 1 reply; 8+ messages in thread
From: Haihao Xiang @ 2022-01-13  5:45 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Haihao Xiang

Add -tile_rows and -tile_cols options to specify the number of tile
rows and columns

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
---
v2: add option descriptions in the doc

 doc/encoders.texi       |  6 ++++++
 libavcodec/qsvenc.c     |  4 ++++
 libavcodec/qsvenc.h     |  1 +
 libavcodec/qsvenc_vp9.c | 10 ++++++++++
 4 files changed, 21 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 7cc8be1209..a4176089d5 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -3457,6 +3457,12 @@ These options are used by vp9_qsv
 @item profile2
 @item profile3
 @end table
+
+@item @var{tile_cols}
+Number of columns for tiled encoding (requires libmfx >= 1.29).
+
+@item @var{tile_rows}
+Number of rows for tiled encoding (requires libmfx  >= 1.29).
 @end table
 
 @section snow
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 4e7a15f060..4cbc9ff4dc 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -939,6 +939,10 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
         q->extvp9param.Header.BufferId = MFX_EXTBUFF_VP9_PARAM;
         q->extvp9param.Header.BufferSz = sizeof(q->extvp9param);
         q->extvp9param.WriteIVFHeaders = MFX_CODINGOPTION_OFF;
+#if QSV_HAVE_EXT_VP9_TILES
+        q->extvp9param.NumTileColumns  = q->tile_cols;
+        q->extvp9param.NumTileRows     = q->tile_rows;
+#endif
         q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extvp9param;
     }
 #endif
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index 31516b8e55..00ee52a5d1 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -41,6 +41,7 @@
 
 #define QSV_HAVE_EXT_HEVC_TILES QSV_VERSION_ATLEAST(1, 13)
 #define QSV_HAVE_EXT_VP9_PARAM QSV_VERSION_ATLEAST(1, 26)
+#define QSV_HAVE_EXT_VP9_TILES QSV_VERSION_ATLEAST(1, 29)
 
 #define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8)
 #define QSV_HAVE_MAX_SLICE_SIZE QSV_VERSION_ATLEAST(1, 9)
diff --git a/libavcodec/qsvenc_vp9.c b/libavcodec/qsvenc_vp9.c
index 9329990d11..1168ddda0e 100644
--- a/libavcodec/qsvenc_vp9.c
+++ b/libavcodec/qsvenc_vp9.c
@@ -73,6 +73,16 @@ static const AVOption options[] = {
     { "profile2",  NULL, 0,                   AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_VP9_2   },  INT_MIN,  INT_MAX,  VE,  "profile" },
     { "profile3",  NULL, 0,                   AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_VP9_3   },  INT_MIN,  INT_MAX,  VE,  "profile" },
 
+#if QSV_HAVE_EXT_VP9_TILES
+    /* The minimum tile width in luma pixels is 256, set maximum tile_cols to 32 for 8K video */
+    { "tile_cols",  "Number of columns for tiled encoding",   OFFSET(qsv.tile_cols),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 32, VE },
+    /* Set maximum tile_rows to 4 per VP9 spec */
+    { "tile_rows",  "Number of rows for tiled encoding",      OFFSET(qsv.tile_rows),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 4, VE },
+#else
+    { "tile_cols",  "(not supported)",                        OFFSET(qsv.tile_cols),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 0, VE },
+    { "tile_rows",  "(not supported)",                        OFFSET(qsv.tile_rows),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 0, VE },
+#endif
+
     { NULL },
 };
 
-- 
2.17.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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding support for VP9
  2022-01-13  5:45 [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding support for VP9 Haihao Xiang
@ 2022-01-17  8:30 ` Xiang, Haihao
  2022-01-17 10:36   ` mypopy
  0 siblings, 1 reply; 8+ messages in thread
From: Xiang, Haihao @ 2022-01-17  8:30 UTC (permalink / raw)
  To: ffmpeg-devel

On Thu, 2022-01-13 at 13:45 +0800, Haihao Xiang wrote:
> Add -tile_rows and -tile_cols options to specify the number of tile
> rows and columns
> 
> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> ---
> v2: add option descriptions in the doc
> 
>  doc/encoders.texi       |  6 ++++++
>  libavcodec/qsvenc.c     |  4 ++++
>  libavcodec/qsvenc.h     |  1 +
>  libavcodec/qsvenc_vp9.c | 10 ++++++++++
>  4 files changed, 21 insertions(+)
> 
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index 7cc8be1209..a4176089d5 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -3457,6 +3457,12 @@ These options are used by vp9_qsv
>  @item profile2
>  @item profile3
>  @end table
> +
> +@item @var{tile_cols}
> +Number of columns for tiled encoding (requires libmfx >= 1.29).
> +
> +@item @var{tile_rows}
> +Number of rows for tiled encoding (requires libmfx  >= 1.29).
>  @end table
>  
>  @section snow
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 4e7a15f060..4cbc9ff4dc 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -939,6 +939,10 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>          q->extvp9param.Header.BufferId = MFX_EXTBUFF_VP9_PARAM;
>          q->extvp9param.Header.BufferSz = sizeof(q->extvp9param);
>          q->extvp9param.WriteIVFHeaders = MFX_CODINGOPTION_OFF;
> +#if QSV_HAVE_EXT_VP9_TILES
> +        q->extvp9param.NumTileColumns  = q->tile_cols;
> +        q->extvp9param.NumTileRows     = q->tile_rows;
> +#endif
>          q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q-
> >extvp9param;
>      }
>  #endif
> diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
> index 31516b8e55..00ee52a5d1 100644
> --- a/libavcodec/qsvenc.h
> +++ b/libavcodec/qsvenc.h
> @@ -41,6 +41,7 @@
>  
>  #define QSV_HAVE_EXT_HEVC_TILES QSV_VERSION_ATLEAST(1, 13)
>  #define QSV_HAVE_EXT_VP9_PARAM QSV_VERSION_ATLEAST(1, 26)
> +#define QSV_HAVE_EXT_VP9_TILES QSV_VERSION_ATLEAST(1, 29)
>  
>  #define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8)
>  #define QSV_HAVE_MAX_SLICE_SIZE QSV_VERSION_ATLEAST(1, 9)
> diff --git a/libavcodec/qsvenc_vp9.c b/libavcodec/qsvenc_vp9.c
> index 9329990d11..1168ddda0e 100644
> --- a/libavcodec/qsvenc_vp9.c
> +++ b/libavcodec/qsvenc_vp9.c
> @@ -73,6 +73,16 @@ static const AVOption options[] = {
>      { "profile2",  NULL, 0,                   AV_OPT_TYPE_CONST, { .i64 =
> MFX_PROFILE_VP9_2   },  INT_MIN,  INT_MAX,  VE,  "profile" },
>      { "profile3",  NULL, 0,                   AV_OPT_TYPE_CONST, { .i64 =
> MFX_PROFILE_VP9_3   },  INT_MIN,  INT_MAX,  VE,  "profile" },
>  
> +#if QSV_HAVE_EXT_VP9_TILES
> +    /* The minimum tile width in luma pixels is 256, set maximum tile_cols to
> 32 for 8K video */
> +    { "tile_cols",  "Number of columns for tiled
> encoding",   OFFSET(qsv.tile_cols),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 32,
> VE },
> +    /* Set maximum tile_rows to 4 per VP9 spec */
> +    { "tile_rows",  "Number of rows for tiled
> encoding",      OFFSET(qsv.tile_rows),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 4,
> VE },
> +#else
> +    { "tile_cols",  "(not
> supported)",                        OFFSET(qsv.tile_cols),    AV_OPT_TYPE_INT,
> { .i64 = 0 }, 0, 0, VE },
> +    { "tile_rows",  "(not
> supported)",                        OFFSET(qsv.tile_rows),    AV_OPT_TYPE_INT,
> { .i64 = 0 }, 0, 0, VE },
> +#endif
> +
>      { NULL },
>  };
>  

Will apply,

-Haihao

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding support for VP9
  2022-01-17  8:30 ` Xiang, Haihao
@ 2022-01-17 10:36   ` mypopy
  2022-01-17 10:57     ` Soft Works
  0 siblings, 1 reply; 8+ messages in thread
From: mypopy @ 2022-01-17 10:36 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Mon, Jan 17, 2022 at 4:30 PM Xiang, Haihao
<haihao.xiang-at-intel.com@ffmpeg.org> wrote:
>
> On Thu, 2022-01-13 at 13:45 +0800, Haihao Xiang wrote:
> > Add -tile_rows and -tile_cols options to specify the number of tile
> > rows and columns
> >
> > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> > ---
> > v2: add option descriptions in the doc
> >
> >  doc/encoders.texi       |  6 ++++++
> >  libavcodec/qsvenc.c     |  4 ++++
> >  libavcodec/qsvenc.h     |  1 +
> >  libavcodec/qsvenc_vp9.c | 10 ++++++++++
> >  4 files changed, 21 insertions(+)
> >
> > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > index 7cc8be1209..a4176089d5 100644
> > --- a/doc/encoders.texi
> > +++ b/doc/encoders.texi
> > @@ -3457,6 +3457,12 @@ These options are used by vp9_qsv
> >  @item profile2
> >  @item profile3
> >  @end table
> > +
> > +@item @var{tile_cols}
> > +Number of columns for tiled encoding (requires libmfx >= 1.29).
> > +
> > +@item @var{tile_rows}
> > +Number of rows for tiled encoding (requires libmfx  >= 1.29).
> >  @end table
> >
> >  @section snow
> > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> > index 4e7a15f060..4cbc9ff4dc 100644
> > --- a/libavcodec/qsvenc.c
> > +++ b/libavcodec/qsvenc.c
> > @@ -939,6 +939,10 @@ static int init_video_param(AVCodecContext *avctx,
> > QSVEncContext *q)
> >          q->extvp9param.Header.BufferId = MFX_EXTBUFF_VP9_PARAM;
> >          q->extvp9param.Header.BufferSz = sizeof(q->extvp9param);
> >          q->extvp9param.WriteIVFHeaders = MFX_CODINGOPTION_OFF;
> > +#if QSV_HAVE_EXT_VP9_TILES
> > +        q->extvp9param.NumTileColumns  = q->tile_cols;
> > +        q->extvp9param.NumTileRows     = q->tile_rows;
> > +#endif
> >          q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q-
> > >extvp9param;
> >      }
> >  #endif
> > diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
> > index 31516b8e55..00ee52a5d1 100644
> > --- a/libavcodec/qsvenc.h
> > +++ b/libavcodec/qsvenc.h
> > @@ -41,6 +41,7 @@
> >
> >  #define QSV_HAVE_EXT_HEVC_TILES QSV_VERSION_ATLEAST(1, 13)
> >  #define QSV_HAVE_EXT_VP9_PARAM QSV_VERSION_ATLEAST(1, 26)
> > +#define QSV_HAVE_EXT_VP9_TILES QSV_VERSION_ATLEAST(1, 29)
> >
> >  #define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8)
> >  #define QSV_HAVE_MAX_SLICE_SIZE QSV_VERSION_ATLEAST(1, 9)
> > diff --git a/libavcodec/qsvenc_vp9.c b/libavcodec/qsvenc_vp9.c
> > index 9329990d11..1168ddda0e 100644
> > --- a/libavcodec/qsvenc_vp9.c
> > +++ b/libavcodec/qsvenc_vp9.c
> > @@ -73,6 +73,16 @@ static const AVOption options[] = {
> >      { "profile2",  NULL, 0,                   AV_OPT_TYPE_CONST, { .i64 =
> > MFX_PROFILE_VP9_2   },  INT_MIN,  INT_MAX,  VE,  "profile" },
> >      { "profile3",  NULL, 0,                   AV_OPT_TYPE_CONST, { .i64 =
> > MFX_PROFILE_VP9_3   },  INT_MIN,  INT_MAX,  VE,  "profile" },
> >
> > +#if QSV_HAVE_EXT_VP9_TILES
> > +    /* The minimum tile width in luma pixels is 256, set maximum tile_cols to
> > 32 for 8K video */
> > +    { "tile_cols",  "Number of columns for tiled
> > encoding",   OFFSET(qsv.tile_cols),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 32,
> > VE },
> > +    /* Set maximum tile_rows to 4 per VP9 spec */
> > +    { "tile_rows",  "Number of rows for tiled
> > encoding",      OFFSET(qsv.tile_rows),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 4,
> > VE },
> > +#else
> > +    { "tile_cols",  "(not
> > supported)",                        OFFSET(qsv.tile_cols),    AV_OPT_TYPE_INT,
> > { .i64 = 0 }, 0, 0, VE },
> > +    { "tile_rows",  "(not
> > supported)",                        OFFSET(qsv.tile_rows),    AV_OPT_TYPE_INT,
> > { .i64 = 0 }, 0, 0, VE },
> > +#endif
> > +
perfer one option like "-tile rows x cols" than two options like
"-tile_rows  row  -tile_cols  col"
> >      { NULL },
> >  };
> >
>
> Will apply,
>
> -Haihao
>
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding support for VP9
  2022-01-17 10:36   ` mypopy
@ 2022-01-17 10:57     ` Soft Works
  2022-01-17 11:29       ` mypopy
  2022-01-17 12:12       ` James Almer
  0 siblings, 2 replies; 8+ messages in thread
From: Soft Works @ 2022-01-17 10:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> mypopy@gmail.com
> Sent: Monday, January 17, 2022 11:36 AM
> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding support
> for VP9
> 
> On Mon, Jan 17, 2022 at 4:30 PM Xiang, Haihao
> <haihao.xiang-at-intel.com@ffmpeg.org> wrote:
> >
> > On Thu, 2022-01-13 at 13:45 +0800, Haihao Xiang wrote:
> > > Add -tile_rows and -tile_cols options to specify the number of tile
> > > rows and columns
> > >
> > > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> > > ---
> > > v2: add option descriptions in the doc
> > >
> > >  doc/encoders.texi       |  6 ++++++
> > >  libavcodec/qsvenc.c     |  4 ++++
> > >  libavcodec/qsvenc.h     |  1 +
> > >  libavcodec/qsvenc_vp9.c | 10 ++++++++++
> > >  4 files changed, 21 insertions(+)
> > >
> > > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > > index 7cc8be1209..a4176089d5 100644
> > > --- a/doc/encoders.texi
> > > +++ b/doc/encoders.texi
> > > @@ -3457,6 +3457,12 @@ These options are used by vp9_qsv
> > >  @item profile2
> > >  @item profile3
> > >  @end table
> > > +
> > > +@item @var{tile_cols}
> > > +Number of columns for tiled encoding (requires libmfx >= 1.29).
> > > +
> > > +@item @var{tile_rows}
> > > +Number of rows for tiled encoding (requires libmfx  >= 1.29).
> > >  @end table
> > >
> > >  @section snow
> > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> > > index 4e7a15f060..4cbc9ff4dc 100644
> > > --- a/libavcodec/qsvenc.c
> > > +++ b/libavcodec/qsvenc.c
> > > @@ -939,6 +939,10 @@ static int init_video_param(AVCodecContext *avctx,
> > > QSVEncContext *q)
> > >          q->extvp9param.Header.BufferId = MFX_EXTBUFF_VP9_PARAM;
> > >          q->extvp9param.Header.BufferSz = sizeof(q->extvp9param);
> > >          q->extvp9param.WriteIVFHeaders = MFX_CODINGOPTION_OFF;
> > > +#if QSV_HAVE_EXT_VP9_TILES
> > > +        q->extvp9param.NumTileColumns  = q->tile_cols;
> > > +        q->extvp9param.NumTileRows     = q->tile_rows;
> > > +#endif
> > >          q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer
> *)&q-
> > > >extvp9param;
> > >      }
> > >  #endif
> > > diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
> > > index 31516b8e55..00ee52a5d1 100644
> > > --- a/libavcodec/qsvenc.h
> > > +++ b/libavcodec/qsvenc.h
> > > @@ -41,6 +41,7 @@
> > >
> > >  #define QSV_HAVE_EXT_HEVC_TILES QSV_VERSION_ATLEAST(1, 13)
> > >  #define QSV_HAVE_EXT_VP9_PARAM QSV_VERSION_ATLEAST(1, 26)
> > > +#define QSV_HAVE_EXT_VP9_TILES QSV_VERSION_ATLEAST(1, 29)
> > >
> > >  #define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8)
> > >  #define QSV_HAVE_MAX_SLICE_SIZE QSV_VERSION_ATLEAST(1, 9)
> > > diff --git a/libavcodec/qsvenc_vp9.c b/libavcodec/qsvenc_vp9.c
> > > index 9329990d11..1168ddda0e 100644
> > > --- a/libavcodec/qsvenc_vp9.c
> > > +++ b/libavcodec/qsvenc_vp9.c
> > > @@ -73,6 +73,16 @@ static const AVOption options[] = {
> > >      { "profile2",  NULL, 0,                   AV_OPT_TYPE_CONST, { .i64
> =
> > > MFX_PROFILE_VP9_2   },  INT_MIN,  INT_MAX,  VE,  "profile" },
> > >      { "profile3",  NULL, 0,                   AV_OPT_TYPE_CONST, { .i64
> =
> > > MFX_PROFILE_VP9_3   },  INT_MIN,  INT_MAX,  VE,  "profile" },
> > >
> > > +#if QSV_HAVE_EXT_VP9_TILES
> > > +    /* The minimum tile width in luma pixels is 256, set maximum
> tile_cols to
> > > 32 for 8K video */
> > > +    { "tile_cols",  "Number of columns for tiled
> > > encoding",   OFFSET(qsv.tile_cols),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0,
> 32,
> > > VE },
> > > +    /* Set maximum tile_rows to 4 per VP9 spec */
> > > +    { "tile_rows",  "Number of rows for tiled
> > > encoding",      OFFSET(qsv.tile_rows),    AV_OPT_TYPE_INT, { .i64 = 0 },
> 0, 4,
> > > VE },
> > > +#else
> > > +    { "tile_cols",  "(not
> > > supported)",                        OFFSET(qsv.tile_cols),
> AV_OPT_TYPE_INT,
> > > { .i64 = 0 }, 0, 0, VE },
> > > +    { "tile_rows",  "(not
> > > supported)",                        OFFSET(qsv.tile_rows),
> AV_OPT_TYPE_INT,
> > > { .i64 = 0 }, 0, 0, VE },
> > > +#endif
> > > +
> perfer one option like "-tile rows x cols" than two options like

The example is invalid. (spaces)

> "-tile_rows  row  -tile_cols  col"

This way, the options are typed, have min, max and default values,
without needing any code to write and maintain.

if you mean "-tile rowsxcols", there's no option type for this, 
unless you would want to mis-use the video size type for it.
Otherwise you'd need to make it string and write all the parsing
and checking code for it. 
Do you think that it would be worth the effort?

Also, in most use cases, you will probably have rows or cols,
rather than both..

sw


_______________________________________________
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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding support for VP9
  2022-01-17 10:57     ` Soft Works
@ 2022-01-17 11:29       ` mypopy
  2022-01-17 12:12       ` James Almer
  1 sibling, 0 replies; 8+ messages in thread
From: mypopy @ 2022-01-17 11:29 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Mon, Jan 17, 2022 at 6:57 PM Soft Works <softworkz@hotmail.com> wrote:
>
>
>
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > mypopy@gmail.com
> > Sent: Monday, January 17, 2022 11:36 AM
> > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding support
> > for VP9
> >
> > On Mon, Jan 17, 2022 at 4:30 PM Xiang, Haihao
> > <haihao.xiang-at-intel.com@ffmpeg.org> wrote:
> > >
> > > On Thu, 2022-01-13 at 13:45 +0800, Haihao Xiang wrote:
> > > > Add -tile_rows and -tile_cols options to specify the number of tile
> > > > rows and columns
> > > >
> > > > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> > > > ---
> > > > v2: add option descriptions in the doc
> > > >
> > > >  doc/encoders.texi       |  6 ++++++
> > > >  libavcodec/qsvenc.c     |  4 ++++
> > > >  libavcodec/qsvenc.h     |  1 +
> > > >  libavcodec/qsvenc_vp9.c | 10 ++++++++++
> > > >  4 files changed, 21 insertions(+)
> > > >
> > > > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > > > index 7cc8be1209..a4176089d5 100644
> > > > --- a/doc/encoders.texi
> > > > +++ b/doc/encoders.texi
> > > > @@ -3457,6 +3457,12 @@ These options are used by vp9_qsv
> > > >  @item profile2
> > > >  @item profile3
> > > >  @end table
> > > > +
> > > > +@item @var{tile_cols}
> > > > +Number of columns for tiled encoding (requires libmfx >= 1.29).
> > > > +
> > > > +@item @var{tile_rows}
> > > > +Number of rows for tiled encoding (requires libmfx  >= 1.29).
> > > >  @end table
> > > >
> > > >  @section snow
> > > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> > > > index 4e7a15f060..4cbc9ff4dc 100644
> > > > --- a/libavcodec/qsvenc.c
> > > > +++ b/libavcodec/qsvenc.c
> > > > @@ -939,6 +939,10 @@ static int init_video_param(AVCodecContext *avctx,
> > > > QSVEncContext *q)
> > > >          q->extvp9param.Header.BufferId = MFX_EXTBUFF_VP9_PARAM;
> > > >          q->extvp9param.Header.BufferSz = sizeof(q->extvp9param);
> > > >          q->extvp9param.WriteIVFHeaders = MFX_CODINGOPTION_OFF;
> > > > +#if QSV_HAVE_EXT_VP9_TILES
> > > > +        q->extvp9param.NumTileColumns  = q->tile_cols;
> > > > +        q->extvp9param.NumTileRows     = q->tile_rows;
> > > > +#endif
> > > >          q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer
> > *)&q-
> > > > >extvp9param;
> > > >      }
> > > >  #endif
> > > > diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
> > > > index 31516b8e55..00ee52a5d1 100644
> > > > --- a/libavcodec/qsvenc.h
> > > > +++ b/libavcodec/qsvenc.h
> > > > @@ -41,6 +41,7 @@
> > > >
> > > >  #define QSV_HAVE_EXT_HEVC_TILES QSV_VERSION_ATLEAST(1, 13)
> > > >  #define QSV_HAVE_EXT_VP9_PARAM QSV_VERSION_ATLEAST(1, 26)
> > > > +#define QSV_HAVE_EXT_VP9_TILES QSV_VERSION_ATLEAST(1, 29)
> > > >
> > > >  #define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8)
> > > >  #define QSV_HAVE_MAX_SLICE_SIZE QSV_VERSION_ATLEAST(1, 9)
> > > > diff --git a/libavcodec/qsvenc_vp9.c b/libavcodec/qsvenc_vp9.c
> > > > index 9329990d11..1168ddda0e 100644
> > > > --- a/libavcodec/qsvenc_vp9.c
> > > > +++ b/libavcodec/qsvenc_vp9.c
> > > > @@ -73,6 +73,16 @@ static const AVOption options[] = {
> > > >      { "profile2",  NULL, 0,                   AV_OPT_TYPE_CONST, { .i64
> > =
> > > > MFX_PROFILE_VP9_2   },  INT_MIN,  INT_MAX,  VE,  "profile" },
> > > >      { "profile3",  NULL, 0,                   AV_OPT_TYPE_CONST, { .i64
> > =
> > > > MFX_PROFILE_VP9_3   },  INT_MIN,  INT_MAX,  VE,  "profile" },
> > > >
> > > > +#if QSV_HAVE_EXT_VP9_TILES
> > > > +    /* The minimum tile width in luma pixels is 256, set maximum
> > tile_cols to
> > > > 32 for 8K video */
> > > > +    { "tile_cols",  "Number of columns for tiled
> > > > encoding",   OFFSET(qsv.tile_cols),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0,
> > 32,
> > > > VE },
> > > > +    /* Set maximum tile_rows to 4 per VP9 spec */
> > > > +    { "tile_rows",  "Number of rows for tiled
> > > > encoding",      OFFSET(qsv.tile_rows),    AV_OPT_TYPE_INT, { .i64 = 0 },
> > 0, 4,
> > > > VE },
> > > > +#else
> > > > +    { "tile_cols",  "(not
> > > > supported)",                        OFFSET(qsv.tile_cols),
> > AV_OPT_TYPE_INT,
> > > > { .i64 = 0 }, 0, 0, VE },
> > > > +    { "tile_rows",  "(not
> > > > supported)",                        OFFSET(qsv.tile_rows),
> > AV_OPT_TYPE_INT,
> > > > { .i64 = 0 }, 0, 0, VE },
> > > > +#endif
> > > > +
> > perfer one option like "-tile rows x cols" than two options like
>
> The example is invalid. (spaces)
>
> > "-tile_rows  row  -tile_cols  col"
>
> This way, the options are typed, have min, max and default values,
> without needing any code to write and maintain.
>
> if you mean "-tile rowsxcols", there's no option type for this,
> unless you would want to mis-use the video size type for it.
> Otherwise you'd need to make it string and write all the parsing
> and checking code for it.
> Do you think that it would be worth the effort?
You convinced me
>
> Also, in most use cases, you will probably have rows or cols,
> rather than both..
>
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding support for VP9
  2022-01-17 10:57     ` Soft Works
  2022-01-17 11:29       ` mypopy
@ 2022-01-17 12:12       ` James Almer
  2022-01-18  8:08         ` Xiang, Haihao
  1 sibling, 1 reply; 8+ messages in thread
From: James Almer @ 2022-01-17 12:12 UTC (permalink / raw)
  To: ffmpeg-devel

On 1/17/2022 7:57 AM, Soft Works wrote:
> 
> 
>> -----Original Message-----
>> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
>> mypopy@gmail.com
>> Sent: Monday, January 17, 2022 11:36 AM
>> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
>> Subject: Re: [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding support
>> for VP9
>>
>> On Mon, Jan 17, 2022 at 4:30 PM Xiang, Haihao
>> <haihao.xiang-at-intel.com@ffmpeg.org> wrote:
>>>
>>> On Thu, 2022-01-13 at 13:45 +0800, Haihao Xiang wrote:
>>>> Add -tile_rows and -tile_cols options to specify the number of tile
>>>> rows and columns
>>>>
>>>> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
>>>> ---
>>>> v2: add option descriptions in the doc
>>>>
>>>>   doc/encoders.texi       |  6 ++++++
>>>>   libavcodec/qsvenc.c     |  4 ++++
>>>>   libavcodec/qsvenc.h     |  1 +
>>>>   libavcodec/qsvenc_vp9.c | 10 ++++++++++
>>>>   4 files changed, 21 insertions(+)
>>>>
>>>> diff --git a/doc/encoders.texi b/doc/encoders.texi
>>>> index 7cc8be1209..a4176089d5 100644
>>>> --- a/doc/encoders.texi
>>>> +++ b/doc/encoders.texi
>>>> @@ -3457,6 +3457,12 @@ These options are used by vp9_qsv
>>>>   @item profile2
>>>>   @item profile3
>>>>   @end table
>>>> +
>>>> +@item @var{tile_cols}
>>>> +Number of columns for tiled encoding (requires libmfx >= 1.29).
>>>> +
>>>> +@item @var{tile_rows}
>>>> +Number of rows for tiled encoding (requires libmfx  >= 1.29).
>>>>   @end table
>>>>
>>>>   @section snow
>>>> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
>>>> index 4e7a15f060..4cbc9ff4dc 100644
>>>> --- a/libavcodec/qsvenc.c
>>>> +++ b/libavcodec/qsvenc.c
>>>> @@ -939,6 +939,10 @@ static int init_video_param(AVCodecContext *avctx,
>>>> QSVEncContext *q)
>>>>           q->extvp9param.Header.BufferId = MFX_EXTBUFF_VP9_PARAM;
>>>>           q->extvp9param.Header.BufferSz = sizeof(q->extvp9param);
>>>>           q->extvp9param.WriteIVFHeaders = MFX_CODINGOPTION_OFF;
>>>> +#if QSV_HAVE_EXT_VP9_TILES
>>>> +        q->extvp9param.NumTileColumns  = q->tile_cols;
>>>> +        q->extvp9param.NumTileRows     = q->tile_rows;
>>>> +#endif
>>>>           q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer
>> *)&q-
>>>>> extvp9param;
>>>>       }
>>>>   #endif
>>>> diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
>>>> index 31516b8e55..00ee52a5d1 100644
>>>> --- a/libavcodec/qsvenc.h
>>>> +++ b/libavcodec/qsvenc.h
>>>> @@ -41,6 +41,7 @@
>>>>
>>>>   #define QSV_HAVE_EXT_HEVC_TILES QSV_VERSION_ATLEAST(1, 13)
>>>>   #define QSV_HAVE_EXT_VP9_PARAM QSV_VERSION_ATLEAST(1, 26)
>>>> +#define QSV_HAVE_EXT_VP9_TILES QSV_VERSION_ATLEAST(1, 29)
>>>>
>>>>   #define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8)
>>>>   #define QSV_HAVE_MAX_SLICE_SIZE QSV_VERSION_ATLEAST(1, 9)
>>>> diff --git a/libavcodec/qsvenc_vp9.c b/libavcodec/qsvenc_vp9.c
>>>> index 9329990d11..1168ddda0e 100644
>>>> --- a/libavcodec/qsvenc_vp9.c
>>>> +++ b/libavcodec/qsvenc_vp9.c
>>>> @@ -73,6 +73,16 @@ static const AVOption options[] = {
>>>>       { "profile2",  NULL, 0,                   AV_OPT_TYPE_CONST, { .i64
>> =
>>>> MFX_PROFILE_VP9_2   },  INT_MIN,  INT_MAX,  VE,  "profile" },
>>>>       { "profile3",  NULL, 0,                   AV_OPT_TYPE_CONST, { .i64
>> =
>>>> MFX_PROFILE_VP9_3   },  INT_MIN,  INT_MAX,  VE,  "profile" },
>>>>
>>>> +#if QSV_HAVE_EXT_VP9_TILES
>>>> +    /* The minimum tile width in luma pixels is 256, set maximum
>> tile_cols to
>>>> 32 for 8K video */
>>>> +    { "tile_cols",  "Number of columns for tiled
>>>> encoding",   OFFSET(qsv.tile_cols),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0,
>> 32,
>>>> VE },
>>>> +    /* Set maximum tile_rows to 4 per VP9 spec */
>>>> +    { "tile_rows",  "Number of rows for tiled
>>>> encoding",      OFFSET(qsv.tile_rows),    AV_OPT_TYPE_INT, { .i64 = 0 },
>> 0, 4,
>>>> VE },
>>>> +#else
>>>> +    { "tile_cols",  "(not
>>>> supported)",                        OFFSET(qsv.tile_cols),
>> AV_OPT_TYPE_INT,
>>>> { .i64 = 0 }, 0, 0, VE },
>>>> +    { "tile_rows",  "(not
>>>> supported)",                        OFFSET(qsv.tile_rows),
>> AV_OPT_TYPE_INT,
>>>> { .i64 = 0 }, 0, 0, VE },
>>>> +#endif
>>>> +
>> perfer one option like "-tile rows x cols" than two options like
> 
> The example is invalid. (spaces)
> 
>> "-tile_rows  row  -tile_cols  col"
> 
> This way, the options are typed, have min, max and default values,
> without needing any code to write and maintain.
> 
> if you mean "-tile rowsxcols", there's no option type for this,
> unless you would want to mis-use the video size type for it.
> Otherwise you'd need to make it string and write all the parsing
> and checking code for it.

We already have code for this. see libaomenc.

> Do you think that it would be worth the effort?
> 
> Also, in most use cases, you will probably have rows or cols,
> rather than both..
> 
> sw
> 
> 
> _______________________________________________
> 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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding support for VP9
  2022-01-17 12:12       ` James Almer
@ 2022-01-18  8:08         ` Xiang, Haihao
  2022-01-24  2:13           ` Xiang, Haihao
  0 siblings, 1 reply; 8+ messages in thread
From: Xiang, Haihao @ 2022-01-18  8:08 UTC (permalink / raw)
  To: ffmpeg-devel

On Mon, 2022-01-17 at 09:12 -0300, James Almer wrote:
> On 1/17/2022 7:57 AM, Soft Works wrote:
> > 
> > 
> > > -----Original Message-----
> > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > > mypopy@gmail.com
> > > Sent: Monday, January 17, 2022 11:36 AM
> > > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> > > Subject: Re: [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding
> > > support
> > > for VP9
> > > 
> > > On Mon, Jan 17, 2022 at 4:30 PM Xiang, Haihao
> > > <haihao.xiang-at-intel.com@ffmpeg.org> wrote:
> > > > 
> > > > On Thu, 2022-01-13 at 13:45 +0800, Haihao Xiang wrote:
> > > > > Add -tile_rows and -tile_cols options to specify the number of tile
> > > > > rows and columns
> > > > > 
> > > > > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> > > > > ---
> > > > > v2: add option descriptions in the doc
> > > > > 
> > > > >   doc/encoders.texi       |  6 ++++++
> > > > >   libavcodec/qsvenc.c     |  4 ++++
> > > > >   libavcodec/qsvenc.h     |  1 +
> > > > >   libavcodec/qsvenc_vp9.c | 10 ++++++++++
> > > > >   4 files changed, 21 insertions(+)
> > > > > 
> > > > > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > > > > index 7cc8be1209..a4176089d5 100644
> > > > > --- a/doc/encoders.texi
> > > > > +++ b/doc/encoders.texi
> > > > > @@ -3457,6 +3457,12 @@ These options are used by vp9_qsv
> > > > >   @item profile2
> > > > >   @item profile3
> > > > >   @end table
> > > > > +
> > > > > +@item @var{tile_cols}
> > > > > +Number of columns for tiled encoding (requires libmfx >= 1.29).
> > > > > +
> > > > > +@item @var{tile_rows}
> > > > > +Number of rows for tiled encoding (requires libmfx  >= 1.29).
> > > > >   @end table
> > > > > 
> > > > >   @section snow
> > > > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> > > > > index 4e7a15f060..4cbc9ff4dc 100644
> > > > > --- a/libavcodec/qsvenc.c
> > > > > +++ b/libavcodec/qsvenc.c
> > > > > @@ -939,6 +939,10 @@ static int init_video_param(AVCodecContext
> > > > > *avctx,
> > > > > QSVEncContext *q)
> > > > >           q->extvp9param.Header.BufferId = MFX_EXTBUFF_VP9_PARAM;
> > > > >           q->extvp9param.Header.BufferSz = sizeof(q->extvp9param);
> > > > >           q->extvp9param.WriteIVFHeaders = MFX_CODINGOPTION_OFF;
> > > > > +#if QSV_HAVE_EXT_VP9_TILES
> > > > > +        q->extvp9param.NumTileColumns  = q->tile_cols;
> > > > > +        q->extvp9param.NumTileRows     = q->tile_rows;
> > > > > +#endif
> > > > >           q->extparam_internal[q->nb_extparam_internal++] =
> > > > > (mfxExtBuffer
> > > 
> > > *)&q-
> > > > > > extvp9param;
> > > > > 
> > > > >       }
> > > > >   #endif
> > > > > diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
> > > > > index 31516b8e55..00ee52a5d1 100644
> > > > > --- a/libavcodec/qsvenc.h
> > > > > +++ b/libavcodec/qsvenc.h
> > > > > @@ -41,6 +41,7 @@
> > > > > 
> > > > >   #define QSV_HAVE_EXT_HEVC_TILES QSV_VERSION_ATLEAST(1, 13)
> > > > >   #define QSV_HAVE_EXT_VP9_PARAM QSV_VERSION_ATLEAST(1, 26)
> > > > > +#define QSV_HAVE_EXT_VP9_TILES QSV_VERSION_ATLEAST(1, 29)
> > > > > 
> > > > >   #define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8)
> > > > >   #define QSV_HAVE_MAX_SLICE_SIZE QSV_VERSION_ATLEAST(1, 9)
> > > > > diff --git a/libavcodec/qsvenc_vp9.c b/libavcodec/qsvenc_vp9.c
> > > > > index 9329990d11..1168ddda0e 100644
> > > > > --- a/libavcodec/qsvenc_vp9.c
> > > > > +++ b/libavcodec/qsvenc_vp9.c
> > > > > @@ -73,6 +73,16 @@ static const AVOption options[] = {
> > > > >       { "profile2",  NULL, 0,                   AV_OPT_TYPE_CONST, {
> > > > > .i64
> > > 
> > > =
> > > > > MFX_PROFILE_VP9_2   },  INT_MIN,  INT_MAX,  VE,  "profile" },
> > > > >       { "profile3",  NULL, 0,                   AV_OPT_TYPE_CONST, {
> > > > > .i64
> > > 
> > > =
> > > > > MFX_PROFILE_VP9_3   },  INT_MIN,  INT_MAX,  VE,  "profile" },
> > > > > 
> > > > > +#if QSV_HAVE_EXT_VP9_TILES
> > > > > +    /* The minimum tile width in luma pixels is 256, set maximum
> > > 
> > > tile_cols to
> > > > > 32 for 8K video */
> > > > > +    { "tile_cols",  "Number of columns for tiled
> > > > > encoding",   OFFSET(qsv.tile_cols),    AV_OPT_TYPE_INT, { .i64 = 0 },
> > > > > 0,
> > > 
> > > 32,
> > > > > VE },
> > > > > +    /* Set maximum tile_rows to 4 per VP9 spec */
> > > > > +    { "tile_rows",  "Number of rows for tiled
> > > > > encoding",      OFFSET(qsv.tile_rows),    AV_OPT_TYPE_INT, { .i64 = 0
> > > > > },
> > > 
> > > 0, 4,
> > > > > VE },
> > > > > +#else
> > > > > +    { "tile_cols",  "(not
> > > > > supported)",                        OFFSET(qsv.tile_cols),
> > > 
> > > AV_OPT_TYPE_INT,
> > > > > { .i64 = 0 }, 0, 0, VE },
> > > > > +    { "tile_rows",  "(not
> > > > > supported)",                        OFFSET(qsv.tile_rows),
> > > 
> > > AV_OPT_TYPE_INT,
> > > > > { .i64 = 0 }, 0, 0, VE },
> > > > > +#endif
> > > > > +
> > > 
> > > perfer one option like "-tile rows x cols" than two options like
> > 
> > The example is invalid. (spaces)
> > 
> > > "-tile_rows  row  -tile_cols  col"
> > 
> > This way, the options are typed, have min, max and default values,
> > without needing any code to write and maintain.
> > 
> > if you mean "-tile rowsxcols", there's no option type for this,
> > unless you would want to mis-use the video size type for it.
> > Otherwise you'd need to make it string and write all the parsing
> > and checking code for it.
> 
> We already have code for this. see libaomenc.

Thanks for the comments. There are -tile_rows and -tile_cols options for
hevc_qsv encoder, I'd like to keep the style consistent in qsv encoders and
prefer to add the two options for vp9 encoder too. 

BRs
Haihao


> 
> > Do you think that it would be worth the effort?
> > 
> > Also, in most use cases, you will probably have rows or cols,
> > rather than both..
> > 
> > sw
> > 
> > 
> > _______________________________________________
> > 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".
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding support for VP9
  2022-01-18  8:08         ` Xiang, Haihao
@ 2022-01-24  2:13           ` Xiang, Haihao
  0 siblings, 0 replies; 8+ messages in thread
From: Xiang, Haihao @ 2022-01-24  2:13 UTC (permalink / raw)
  To: ffmpeg-devel

On Tue, 2022-01-18 at 08:08 +0000, Xiang, Haihao wrote:
> On Mon, 2022-01-17 at 09:12 -0300, James Almer wrote:
> > On 1/17/2022 7:57 AM, Soft Works wrote:
> > > 
> > > 
> > > > -----Original Message-----
> > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > > > mypopy@gmail.com
> > > > Sent: Monday, January 17, 2022 11:36 AM
> > > > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> > > > Subject: Re: [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding
> > > > support
> > > > for VP9
> > > > 
> > > > On Mon, Jan 17, 2022 at 4:30 PM Xiang, Haihao
> > > > <haihao.xiang-at-intel.com@ffmpeg.org> wrote:
> > > > > 
> > > > > On Thu, 2022-01-13 at 13:45 +0800, Haihao Xiang wrote:
> > > > > > Add -tile_rows and -tile_cols options to specify the number of tile
> > > > > > rows and columns
> > > > > > 
> > > > > > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> > > > > > ---
> > > > > > v2: add option descriptions in the doc
> > > > > > 
> > > > > >   doc/encoders.texi       |  6 ++++++
> > > > > >   libavcodec/qsvenc.c     |  4 ++++
> > > > > >   libavcodec/qsvenc.h     |  1 +
> > > > > >   libavcodec/qsvenc_vp9.c | 10 ++++++++++
> > > > > >   4 files changed, 21 insertions(+)
> > > > > > 
> > > > > > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > > > > > index 7cc8be1209..a4176089d5 100644
> > > > > > --- a/doc/encoders.texi
> > > > > > +++ b/doc/encoders.texi
> > > > > > @@ -3457,6 +3457,12 @@ These options are used by vp9_qsv
> > > > > >   @item profile2
> > > > > >   @item profile3
> > > > > >   @end table
> > > > > > +
> > > > > > +@item @var{tile_cols}
> > > > > > +Number of columns for tiled encoding (requires libmfx >= 1.29).
> > > > > > +
> > > > > > +@item @var{tile_rows}
> > > > > > +Number of rows for tiled encoding (requires libmfx  >= 1.29).
> > > > > >   @end table
> > > > > > 
> > > > > >   @section snow
> > > > > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> > > > > > index 4e7a15f060..4cbc9ff4dc 100644
> > > > > > --- a/libavcodec/qsvenc.c
> > > > > > +++ b/libavcodec/qsvenc.c
> > > > > > @@ -939,6 +939,10 @@ static int init_video_param(AVCodecContext
> > > > > > *avctx,
> > > > > > QSVEncContext *q)
> > > > > >           q->extvp9param.Header.BufferId = MFX_EXTBUFF_VP9_PARAM;
> > > > > >           q->extvp9param.Header.BufferSz = sizeof(q->extvp9param);
> > > > > >           q->extvp9param.WriteIVFHeaders = MFX_CODINGOPTION_OFF;
> > > > > > +#if QSV_HAVE_EXT_VP9_TILES
> > > > > > +        q->extvp9param.NumTileColumns  = q->tile_cols;
> > > > > > +        q->extvp9param.NumTileRows     = q->tile_rows;
> > > > > > +#endif
> > > > > >           q->extparam_internal[q->nb_extparam_internal++] =
> > > > > > (mfxExtBuffer
> > > > 
> > > > *)&q-
> > > > > > > extvp9param;
> > > > > > 
> > > > > >       }
> > > > > >   #endif
> > > > > > diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
> > > > > > index 31516b8e55..00ee52a5d1 100644
> > > > > > --- a/libavcodec/qsvenc.h
> > > > > > +++ b/libavcodec/qsvenc.h
> > > > > > @@ -41,6 +41,7 @@
> > > > > > 
> > > > > >   #define QSV_HAVE_EXT_HEVC_TILES QSV_VERSION_ATLEAST(1, 13)
> > > > > >   #define QSV_HAVE_EXT_VP9_PARAM QSV_VERSION_ATLEAST(1, 26)
> > > > > > +#define QSV_HAVE_EXT_VP9_TILES QSV_VERSION_ATLEAST(1, 29)
> > > > > > 
> > > > > >   #define QSV_HAVE_TRELLIS QSV_VERSION_ATLEAST(1, 8)
> > > > > >   #define QSV_HAVE_MAX_SLICE_SIZE QSV_VERSION_ATLEAST(1, 9)
> > > > > > diff --git a/libavcodec/qsvenc_vp9.c b/libavcodec/qsvenc_vp9.c
> > > > > > index 9329990d11..1168ddda0e 100644
> > > > > > --- a/libavcodec/qsvenc_vp9.c
> > > > > > +++ b/libavcodec/qsvenc_vp9.c
> > > > > > @@ -73,6 +73,16 @@ static const AVOption options[] = {
> > > > > >       { "profile2",  NULL, 0,                   AV_OPT_TYPE_CONST, {
> > > > > > .i64
> > > > 
> > > > =
> > > > > > MFX_PROFILE_VP9_2   },  INT_MIN,  INT_MAX,  VE,  "profile" },
> > > > > >       { "profile3",  NULL, 0,                   AV_OPT_TYPE_CONST, {
> > > > > > .i64
> > > > 
> > > > =
> > > > > > MFX_PROFILE_VP9_3   },  INT_MIN,  INT_MAX,  VE,  "profile" },
> > > > > > 
> > > > > > +#if QSV_HAVE_EXT_VP9_TILES
> > > > > > +    /* The minimum tile width in luma pixels is 256, set maximum
> > > > 
> > > > tile_cols to
> > > > > > 32 for 8K video */
> > > > > > +    { "tile_cols",  "Number of columns for tiled
> > > > > > encoding",   OFFSET(qsv.tile_cols),    AV_OPT_TYPE_INT, { .i64 = 0
> > > > > > },
> > > > > > 0,
> > > > 
> > > > 32,
> > > > > > VE },
> > > > > > +    /* Set maximum tile_rows to 4 per VP9 spec */
> > > > > > +    { "tile_rows",  "Number of rows for tiled
> > > > > > encoding",      OFFSET(qsv.tile_rows),    AV_OPT_TYPE_INT, { .i64 =
> > > > > > 0
> > > > > > },
> > > > 
> > > > 0, 4,
> > > > > > VE },
> > > > > > +#else
> > > > > > +    { "tile_cols",  "(not
> > > > > > supported)",                        OFFSET(qsv.tile_cols),
> > > > 
> > > > AV_OPT_TYPE_INT,
> > > > > > { .i64 = 0 }, 0, 0, VE },
> > > > > > +    { "tile_rows",  "(not
> > > > > > supported)",                        OFFSET(qsv.tile_rows),
> > > > 
> > > > AV_OPT_TYPE_INT,
> > > > > > { .i64 = 0 }, 0, 0, VE },
> > > > > > +#endif
> > > > > > +
> > > > 
> > > > perfer one option like "-tile rows x cols" than two options like
> > > 
> > > The example is invalid. (spaces)
> > > 
> > > > "-tile_rows  row  -tile_cols  col"
> > > 
> > > This way, the options are typed, have min, max and default values,
> > > without needing any code to write and maintain.
> > > 
> > > if you mean "-tile rowsxcols", there's no option type for this,
> > > unless you would want to mis-use the video size type for it.
> > > Otherwise you'd need to make it string and write all the parsing
> > > and checking code for it.
> > 
> > We already have code for this. see libaomenc.
> 
> Thanks for the comments. There are -tile_rows and -tile_cols options for
> hevc_qsv encoder, I'd like to keep the style consistent in qsv encoders and
> prefer to add the two options for vp9 encoder too. 
> 

Any other concern ?

Thanks
Haihao


> 
> 
> > 
> > > Do you think that it would be worth the effort?
> > > 
> > > Also, in most use cases, you will probably have rows or cols,
> > > rather than both..
> > > 
> > > sw
> > > 
> > > 
> > > _______________________________________________
> > > 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".
> 
> _______________________________________________
> 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".

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-01-24  2:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13  5:45 [FFmpeg-devel] [PATCH v2] lavc/qsvenc: add tile encoding support for VP9 Haihao Xiang
2022-01-17  8:30 ` Xiang, Haihao
2022-01-17 10:36   ` mypopy
2022-01-17 10:57     ` Soft Works
2022-01-17 11:29       ` mypopy
2022-01-17 12:12       ` James Almer
2022-01-18  8:08         ` Xiang, Haihao
2022-01-24  2:13           ` Xiang, Haihao

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git