diff mbox series

[FFmpeg-devel,2/5] libavcodec/libaomenc: Add command-line options to control the use of partition tools.

Message ID 20200626005516.678811-2-wangcao@google.com
State Accepted
Headers show
Series [FFmpeg-devel,1/5] avcodec/libaomenc.c: Add super-resolution options to libaom wrapper | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Wang Cao June 26, 2020, 12:55 a.m. UTC
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>
---
 doc/encoders.texi      | 10 ++++++++++
 libavcodec/libaomenc.c | 15 +++++++++++++++
 libavcodec/version.h   |  2 +-
 3 files changed, 26 insertions(+), 1 deletion(-)

Comments

James Zern June 29, 2020, 6:13 p.m. UTC | #1
On Thu, Jun 25, 2020 at 6:02 PM Wang Cao <doubleecao@gmail.com> wrote:
>
> 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>
> ---
>  doc/encoders.texi      | 10 ++++++++++
>  libavcodec/libaomenc.c | 15 +++++++++++++++
>  libavcodec/version.h   |  2 +-
>  3 files changed, 26 insertions(+), 1 deletion(-)
>

lgtm. I'll apply this soon if there aren't any other comments.
James Zern July 1, 2020, 6:57 p.m. UTC | #2
On Mon, Jun 29, 2020 at 11:13 AM James Zern <jzern@google.com> wrote:
>
> On Thu, Jun 25, 2020 at 6:02 PM Wang Cao <doubleecao@gmail.com> wrote:
> >
> > 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>
> > ---
> >  doc/encoders.texi      | 10 ++++++++++
> >  libavcodec/libaomenc.c | 15 +++++++++++++++
> >  libavcodec/version.h   |  2 +-
> >  3 files changed, 26 insertions(+), 1 deletion(-)
> >
>
> lgtm. I'll apply this soon if there aren't any other comments.

applied, thanks.
diff mbox series

Patch

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 045535accb..6513f6c3ef 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1638,8 +1638,18 @@  is @option{qthresh}. Valid value ranges from 1 to 63.
 The q level threshold after which superres is used for key frames when
 @option{superres-mode} is @option{qthresh}. Valid value ranges from 1 to 63.
 
+@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
 
 Kvazaar H.265/HEVC encoder.
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 17e130d8ec..ab2f456518 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -102,6 +102,9 @@  typedef struct AOMEncoderContext {
     int superres_qthresh;
     int superres_kf_denominator;
     int superres_kf_qthresh;
+    int enable_rect_partitions;
+    int enable_1to4_partitions;
+    int enable_ab_partitions;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -142,6 +145,9 @@  static const char *const ctlidstr[] = {
     [AV1E_SET_ENABLE_CDEF]      = "AV1E_SET_ENABLE_CDEF",
     [AOME_SET_TUNING]           = "AOME_SET_TUNING",
     [AV1E_SET_ENABLE_SUPERRES]  = "AV1E_SET_ENABLE_SUPERRES",
+    [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)
@@ -725,6 +731,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)
@@ -1145,6 +1157,9 @@  static const AVOption options[] = {
     { "superres-qthresh",        "The q level threshold after which superres is used, range [1, 63]",                OFFSET(superres_qthresh),        AV_OPT_TYPE_INT, {.i64 = 0}, 0, 63, VE},
     { "superres-kf-denominator", "The denominator for superres to use on key frames, range [8, 16]",                 OFFSET(superres_kf_denominator), AV_OPT_TYPE_INT, {.i64 = 8}, 8, 16, VE},
     { "superres-kf-qthresh",     "The q level threshold after which superres is used for key frames, range [1, 63]", OFFSET(superres_kf_qthresh),     AV_OPT_TYPE_INT, {.i64 = 0}, 0, 63, VE},
+    { "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 },
 };
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 05f59901ff..c9ce7981b5 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@ 
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  93
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \