]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/libaomenc: Add command-line options to control the use of partition tools
authorWang Cao <doubleecao@gmail.com>
Fri, 26 Jun 2020 00:55:13 +0000 (17:55 -0700)
committerJames Zern <jzern@google.com>
Wed, 1 Jul 2020 18:54:56 +0000 (11:54 -0700)
This patch adds the control for enabling rectangular partitions, 1:4/4:1
partitions and AB shape partitions.

Signed-off-by: Wang Cao <wangcao@google.com>
Signed-off-by: James Zern <jzern@google.com>
doc/encoders.texi
libavcodec/libaomenc.c
libavcodec/version.h

index 17a0f4c821dd01094ba12081fd024e0740bf9c87..aff55d96289f9009a9cb7fcb90511815af03b1d1 100644 (file)
@@ -1599,6 +1599,15 @@ Enable the use of global motion for block prediction. Default is true.
 Enable block copy mode for intra block prediction. This mode is
 useful for screen content. Default is true.
 
+@item enable-rect-partitions (@emph{boolean})
+Enable rectangular partitions. Default is true.
+
+@item enable-1to4-partitions (@emph{boolean})
+Enable 1:4/4:1 partitions. Default is true.
+
+@item enable-ab-partitions (@emph{boolean})
+Enable AB shape partitions. Default is true.
+
 @end table
 
 @section libkvazaar
index fe98449fa16f9616b06ec14556c209334f8b607a..fd3ad2bca0cecf9be296d4a5030c4e34c48317a4 100644 (file)
@@ -96,6 +96,9 @@ typedef struct AOMEncoderContext {
     int enable_restoration;
     int usage;
     int tune;
+    int enable_rect_partitions;
+    int enable_1to4_partitions;
+    int enable_ab_partitions;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -135,6 +138,9 @@ static const char *const ctlidstr[] = {
 #endif
     [AV1E_SET_ENABLE_CDEF]      = "AV1E_SET_ENABLE_CDEF",
     [AOME_SET_TUNING]           = "AOME_SET_TUNING",
+    [AV1E_SET_ENABLE_1TO4_PARTITIONS] = "AV1E_SET_ENABLE_1TO4_PARTITIONS",
+    [AV1E_SET_ENABLE_AB_PARTITIONS]   = "AV1E_SET_ENABLE_AB_PARTITIONS",
+    [AV1E_SET_ENABLE_RECT_PARTITIONS] = "AV1E_SET_ENABLE_RECT_PARTITIONS",
 };
 
 static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -698,6 +704,12 @@ static av_cold int aom_init(AVCodecContext *avctx,
         codecctl_int(avctx, AV1E_SET_ENABLE_CDEF, ctx->enable_cdef);
     if (ctx->enable_restoration >= 0)
         codecctl_int(avctx, AV1E_SET_ENABLE_RESTORATION, ctx->enable_restoration);
+    if (ctx->enable_rect_partitions >= 0)
+        codecctl_int(avctx, AV1E_SET_ENABLE_RECT_PARTITIONS, ctx->enable_rect_partitions);
+    if (ctx->enable_1to4_partitions >= 0)
+        codecctl_int(avctx, AV1E_SET_ENABLE_1TO4_PARTITIONS, ctx->enable_1to4_partitions);
+    if (ctx->enable_ab_partitions >= 0)
+        codecctl_int(avctx, AV1E_SET_ENABLE_AB_PARTITIONS, ctx->enable_ab_partitions);
 
     codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
     if (ctx->crf >= 0)
@@ -1108,6 +1120,9 @@ static const AVOption options[] = {
     { "psnr",            NULL,         0, AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_PSNR}, 0, 0, VE, "tune"},
     { "ssim",            NULL,         0, AV_OPT_TYPE_CONST, {.i64 = AOM_TUNE_SSIM}, 0, 0, VE, "tune"},
     FF_AV1_PROFILE_OPTS
+    { "enable-rect-partitions", "Enable rectangular partitions", OFFSET(enable_rect_partitions), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
+    { "enable-1to4-partitions", "Enable 1:4/4:1 partitions",     OFFSET(enable_1to4_partitions), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
+    { "enable-ab-partitions",   "Enable ab shape partitions",    OFFSET(enable_ab_partitions),   AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
     { NULL },
 };
 
index c9ce7981b5caae09e46986b60fb989f5e46ff873..78bac9f52a41c77930d73be340468731197ea24c 100644 (file)
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  93
-#define LIBAVCODEC_VERSION_MICRO 102
+#define LIBAVCODEC_VERSION_MICRO 103
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \