Message ID | 1596280963-15526-4-git-send-email-lance.lmwang@gmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/5] avcodec/libsvtav1: fix copy and paste error | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On 8/1/2020 8:22 AM, lance.lmwang@gmail.com wrote: > From: Limin Wang <lance.lmwang@gmail.com> > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > --- > doc/encoders.texi | 9 +++++++++ > libavcodec/libsvtav1.c | 9 +++++++++ > 2 files changed, 18 insertions(+) > > diff --git a/doc/encoders.texi b/doc/encoders.texi > index 2f5457f..da0b68d 100644 > --- a/doc/encoders.texi > +++ b/doc/encoders.texi > @@ -1747,6 +1747,15 @@ Set log2 of the number of rows of tiles to use (0-6). > @item tile_columns > Set log2 of the number of columns of tiles to use (0-4). > > +@item cores > +Set the number of logical processor which encoder threads run on. Default is: 0 > +which is unset. If cores and socket are not set, threads are managed by OS thread > +scheduler. > + > +@item socket > +Set which target socket to run on. For multiple socket systems, this can specify which > +socket the encoder runs on. Default is: -1 which is unset. > + > @end table > > @section libkvazaar > diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c > index 3e3b907..78e0ee5 100644 > --- a/libavcodec/libsvtav1.c > +++ b/libavcodec/libsvtav1.c > @@ -71,6 +71,9 @@ typedef struct SvtContext { > > int tile_columns; > int tile_rows; > + > + int cores; > + int socket; > } SvtContext; > > static const struct { > @@ -204,6 +207,10 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param, > > param->tile_columns = svt_enc->tile_columns; > param->tile_rows = svt_enc->tile_rows; > + if (svt_enc->cores > 0) > + param->logical_processors = svt_enc->cores; > + if (svt_enc->socket >= 0) > + param->target_socket = svt_enc->socket; > > return 0; > } > @@ -519,6 +526,8 @@ static const AVOption options[] = { > > { "tile_columns", "Log2 of number of tile columns to use", OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VE}, > { "tile_rows", "Log2 of number of tile rows to use", OFFSET(tile_rows), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 6, VE}, > + { "cores", "Number of logical cores, 0: unset", OFFSET(cores), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE}, > + { "socket", "Target socket to run on. -1: unset", OFFSET(socket), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, > > {NULL}, > }; There's a WIP merge request that attempts to introduce a threads option that maps well with our AVCodecContext->threads field in https://github.com/OpenVisualCloud/SVT-AV1/pull/1367, so i personally think it's best to wait for it instead. Also, there's work to introduce a key=value option parsing API, which would let us add a x264-params style option and avoid adding a hundred options for every single EbSvtAv1EncConfiguration field.
On Sat, Aug 01, 2020 at 10:15:02AM -0300, James Almer wrote: > On 8/1/2020 8:22 AM, lance.lmwang@gmail.com wrote: > > From: Limin Wang <lance.lmwang@gmail.com> > > > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > > --- > > doc/encoders.texi | 9 +++++++++ > > libavcodec/libsvtav1.c | 9 +++++++++ > > 2 files changed, 18 insertions(+) > > > > diff --git a/doc/encoders.texi b/doc/encoders.texi > > index 2f5457f..da0b68d 100644 > > --- a/doc/encoders.texi > > +++ b/doc/encoders.texi > > @@ -1747,6 +1747,15 @@ Set log2 of the number of rows of tiles to use (0-6). > > @item tile_columns > > Set log2 of the number of columns of tiles to use (0-4). > > > > +@item cores > > +Set the number of logical processor which encoder threads run on. Default is: 0 > > +which is unset. If cores and socket are not set, threads are managed by OS thread > > +scheduler. > > + > > +@item socket > > +Set which target socket to run on. For multiple socket systems, this can specify which > > +socket the encoder runs on. Default is: -1 which is unset. > > + > > @end table > > > > @section libkvazaar > > diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c > > index 3e3b907..78e0ee5 100644 > > --- a/libavcodec/libsvtav1.c > > +++ b/libavcodec/libsvtav1.c > > @@ -71,6 +71,9 @@ typedef struct SvtContext { > > > > int tile_columns; > > int tile_rows; > > + > > + int cores; > > + int socket; > > } SvtContext; > > > > static const struct { > > @@ -204,6 +207,10 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param, > > > > param->tile_columns = svt_enc->tile_columns; > > param->tile_rows = svt_enc->tile_rows; > > + if (svt_enc->cores > 0) > > + param->logical_processors = svt_enc->cores; > > + if (svt_enc->socket >= 0) > > + param->target_socket = svt_enc->socket; > > > > return 0; > > } > > @@ -519,6 +526,8 @@ static const AVOption options[] = { > > > > { "tile_columns", "Log2 of number of tile columns to use", OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VE}, > > { "tile_rows", "Log2 of number of tile rows to use", OFFSET(tile_rows), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 6, VE}, > > + { "cores", "Number of logical cores, 0: unset", OFFSET(cores), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE}, > > + { "socket", "Target socket to run on. -1: unset", OFFSET(socket), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, > > > > {NULL}, > > }; > > There's a WIP merge request that attempts to introduce a threads option > that maps well with our AVCodecContext->threads field in > https://github.com/OpenVisualCloud/SVT-AV1/pull/1367, so i personally > think it's best to wait for it instead. Sorry, I haven't notice that, threads have no knowledge for socket or numa node, it'll depend on system tool to finished it. I recall x265 have pools option also. > > Also, there's work to introduce a key=value option parsing API, which > would let us add a x264-params style option and avoid adding a hundred > options for every single EbSvtAv1EncConfiguration field. So, please wait for the svt-params options for the new options. > _______________________________________________ > 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 --git a/doc/encoders.texi b/doc/encoders.texi index 2f5457f..da0b68d 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1747,6 +1747,15 @@ Set log2 of the number of rows of tiles to use (0-6). @item tile_columns Set log2 of the number of columns of tiles to use (0-4). +@item cores +Set the number of logical processor which encoder threads run on. Default is: 0 +which is unset. If cores and socket are not set, threads are managed by OS thread +scheduler. + +@item socket +Set which target socket to run on. For multiple socket systems, this can specify which +socket the encoder runs on. Default is: -1 which is unset. + @end table @section libkvazaar diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c index 3e3b907..78e0ee5 100644 --- a/libavcodec/libsvtav1.c +++ b/libavcodec/libsvtav1.c @@ -71,6 +71,9 @@ typedef struct SvtContext { int tile_columns; int tile_rows; + + int cores; + int socket; } SvtContext; static const struct { @@ -204,6 +207,10 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param, param->tile_columns = svt_enc->tile_columns; param->tile_rows = svt_enc->tile_rows; + if (svt_enc->cores > 0) + param->logical_processors = svt_enc->cores; + if (svt_enc->socket >= 0) + param->target_socket = svt_enc->socket; return 0; } @@ -519,6 +526,8 @@ static const AVOption options[] = { { "tile_columns", "Log2 of number of tile columns to use", OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VE}, { "tile_rows", "Log2 of number of tile rows to use", OFFSET(tile_rows), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 6, VE}, + { "cores", "Number of logical cores, 0: unset", OFFSET(cores), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE}, + { "socket", "Target socket to run on. -1: unset", OFFSET(socket), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, {NULL}, };