]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/libaomenc: add row-mt option
authorJames Almer <jamrial@gmail.com>
Sat, 8 Dec 2018 23:14:12 +0000 (20:14 -0300)
committerJames Almer <jamrial@gmail.com>
Sun, 9 Dec 2018 18:23:00 +0000 (15:23 -0300)
Default to disable, same as aomenc.

Fixes ticket #7598

Signed-off-by: James Almer <jamrial@gmail.com>
doc/encoders.texi
libavcodec/libaomenc.c

index 4db7764f4d9ce3a51192d038cc31970bd616519a..ca3892d6822836ab6fa6fc7058e06120b6dad1e5 100644 (file)
@@ -1411,9 +1411,9 @@ to unconstrained variable bitrate.
 
 @item threads
 Set the number of threads to use while encoding.  This may require the
-@option{tiles} option to also be set to actually use the specified
-number of threads fully.  Defaults to the number of hardware threads
-supported by the host machine.
+@option{tiles} or @option{row-mt} options to also be set to actually
+use the specified number of threads fully. Defaults to the number of
+hardware threads supported by the host machine.
 
 @item profile
 Set the encoding profile.  Defaults to using the profile which matches
@@ -1477,6 +1477,9 @@ number of tiles required by the size of the input video (this is 1x1
 Set the number of tiles as log2 of the number of tile rows and columns.
 Provided for compatibility with libvpx/VP9.
 
+@item row-mt (Requires libaom >= 1.0.0-759-g90a15f4f2)
+Enable row based multi-threading. Disabled by default.
+
 @end table
 
 @section libkvazaar
index 17565017b4cdcf2a26e11f6ed6455db3303b5f82..09ef423ce1610d1b0b4368e68daa0927ef910b5d 100644 (file)
@@ -78,6 +78,7 @@ typedef struct AOMEncoderContext {
     int tile_cols_log2, tile_rows_log2;
     aom_superblock_size_t superblock_size;
     int uniform_tiles;
+    int row_mt;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -92,6 +93,9 @@ static const char *const ctlidstr[] = {
     [AV1E_SET_SUPERBLOCK_SIZE]  = "AV1E_SET_SUPERBLOCK_SIZE",
     [AV1E_SET_TILE_COLUMNS]     = "AV1E_SET_TILE_COLUMNS",
     [AV1E_SET_TILE_ROWS]        = "AV1E_SET_TILE_ROWS",
+#ifdef AOM_CTRL_AV1E_SET_ROW_MT
+    [AV1E_SET_ROW_MT]           = "AV1E_SET_ROW_MT",
+#endif
 };
 
 static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -650,6 +654,10 @@ static av_cold int aom_init(AVCodecContext *avctx,
         codecctl_int(avctx, AV1E_SET_TILE_ROWS,    ctx->tile_rows_log2);
     }
 
+#ifdef AOM_CTRL_AV1E_SET_ROW_MT
+    codecctl_int(avctx, AV1E_SET_ROW_MT, ctx->row_mt);
+#endif
+
     // provide dummy value to initialize wrapper, values will be updated each _encode()
     aom_img_wrap(&ctx->rawimg, img_fmt, avctx->width, avctx->height, 1,
                  (unsigned char*)1);
@@ -983,6 +991,7 @@ static const AVOption options[] = {
     { "tiles",            "Tile columns x rows", OFFSET(tile_cols), AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, 0, VE },
     { "tile-columns",     "Log2 of number of tile columns to use", OFFSET(tile_cols_log2), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
     { "tile-rows",        "Log2 of number of tile rows to use",    OFFSET(tile_rows_log2), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
+    { "row-mt",           "Enable row based multi-threading",      OFFSET(row_mt),         AV_OPT_TYPE_BOOL, {.i64 = 0},  0, 1, VE},
     { NULL }
 };