[FFmpeg-devel] [PATCH 2/5] libavcodec/libaomenc: Add command-line options to control the use of partition tools.
Wang Cao
doubleecao at gmail.com
Fri Jun 26 03:55:13 EEST 2020
This patch adds the control for enabling rectangular partitions, 1:4/4:1
partitions and AB shape partitions.
Signed-off-by: Wang Cao <wangcao at google.com>
---
doc/encoders.texi | 10 ++++++++++
libavcodec/libaomenc.c | 15 +++++++++++++++
libavcodec/version.h | 2 +-
3 files changed, 26 insertions(+), 1 deletion(-)
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.
+ at item enable-rect-partitions (@emph{boolean})
+Enable rectangular partitions. Default is true.
+
+ at item enable-1to4-partitions (@emph{boolean})
+Enable 1:4/4:1 partitions. Default is true.
+
+ at 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, \
--
2.27.0.111.gc72c7da667-goog
More information about the ffmpeg-devel
mailing list