[FFmpeg-devel] [PATCH] librav1e: Make tile options consistent with other encoders

Mark Thompson sw at jkqxz.net
Fri Jul 31 01:21:36 EEST 2020


In all other AV1 encoders these are set as log2 of the number of tile
columns/rows to use.  This does change not the accessible configuration,
since librav1e already requires these numbers to be powers of two.
---
Possibly this is too late to be acceptable without additional messing around, but I'm not sure how many users of these options there would be anyway.  (Or, for that matter, if anyone using it would 
notice that it doesn't do the same thing as libaom-av1.)


  doc/encoders.texi     | 4 ++--
  libavcodec/librav1e.c | 8 ++++----
  2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index af7d2ba983..8d33ac3369 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1397,10 +1397,10 @@ Selects the speed preset (0-10) to encode with.
  Selects how many tiles to encode with.

  @item tile-rows
-Selects how many rows of tiles to encode with.
+Sets log2 of how many rows of tiles to encode with.

  @item tile-columns
-Selects how many columns of tiles to encode with.
+Sets log2 of how many columns of tiles to encode with.

  @item rav1e-params
  Set rav1e options using a list of @var{key}=@var{value} pairs separated
diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index e9b82a724a..c455fd882e 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -319,7 +319,7 @@ static av_cold int librav1e_encode_init(AVCodecContext *avctx)
          }
      }
      if (ctx->tile_rows > 0) {
-        rret = rav1e_config_parse_int(cfg, "tile_rows", ctx->tile_rows);
+        rret = rav1e_config_parse_int(cfg, "tile_rows", 1 << ctx->tile_rows);
          if (rret < 0) {
              av_log(avctx, AV_LOG_ERROR, "Could not set number of tile rows to encode with.\n");
              ret = AVERROR_EXTERNAL;
@@ -327,7 +327,7 @@ static av_cold int librav1e_encode_init(AVCodecContext *avctx)
          }
      }
      if (ctx->tile_cols > 0) {
-        rret = rav1e_config_parse_int(cfg, "tile_cols", ctx->tile_cols);
+        rret = rav1e_config_parse_int(cfg, "tile_cols", 1 << ctx->tile_cols);
          if (rret < 0) {
              av_log(avctx, AV_LOG_ERROR, "Could not set number of tile cols to encode with.\n");
              ret = AVERROR_EXTERNAL;
@@ -564,8 +564,8 @@ static const AVOption options[] = {
      { "qp", "use constant quantizer mode", OFFSET(quantizer), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255, VE },
      { "speed", "what speed preset to use", OFFSET(speed), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 10, VE },
      { "tiles", "number of tiles encode with", OFFSET(tiles), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
-    { "tile-rows", "number of tiles rows to encode with", OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
-    { "tile-columns", "number of tiles columns to encode with", OFFSET(tile_cols), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
+    { "tile-rows", "log2 of number of tiles rows to encode with", OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
+    { "tile-columns", "log2 of number of tiles columns to encode with", OFFSET(tile_cols), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, VE },
      { "rav1e-params", "set the rav1e configuration using a :-separated list of key=value parameters", OFFSET(rav1e_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE },
      { NULL }
  };
-- 
2.27.0


More information about the ffmpeg-devel mailing list