[FFmpeg-devel] [PATCH 4/5] libavcodec/libaomenc.c: Add command-line options for tx tools.

Wang Cao doubleecao at gmail.com
Fri Jun 26 03:55:15 EEST 2020


Signed-off-by: Wang Cao <wangcao at google.com>
---
 doc/encoders.texi      | 21 +++++++++++++++++++++
 libavcodec/libaomenc.c | 31 +++++++++++++++++++++++++++++++
 libavcodec/version.h   |  2 +-
 3 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index f052d68c46..329c887ce0 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1668,6 +1668,27 @@ Enable paeth predictor in intra prediction. Default is true.
 @item enable-palette (@emph{boolean})
 Enable palette prediction mode. Default is true.
 
+ at item enable-flip-idtx (@emph{boolean})
+Enable extended transform type (0: false, 1: true (default))
+including FLIPADST_DCT, DCT_FLIPADST, FLIPADST_FLIPADST,
+ADST_FLIPADST, FLIPADST_ADST, IDTX, V_DCT, H_DCT, V_ADST,
+ H_ADST, V_FLIPADST, H_FLIPADST
+
+ at item enable-tx64 (@emph{boolean})
+Enable 64-pt transform (0: false, 1: true (default))
+
+ at item reduced-tx-type-set (@emph{boolean})
+Use reduced set of transform types. Default is false.
+
+ at item use-intra-dct-only (@emph{boolean})
+Use DCT only for INTRA modes. Default is false.
+
+ at item use-inter-dct-only (@emph{boolean})
+Use DCT only for INTER modes. Default is false.
+
+ at item use-intra-default-tx-only (@emph{boolean})
+Use Default-transform only for INTRA modes. Default is false.
+
 @end table
 
 
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index d1615e75c6..745d7e09fc 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -112,6 +112,12 @@ typedef struct AOMEncoderContext {
     int enable_intra_edge_filter;
     int enable_palette;
     int enable_filter_intra;
+    int enable_flip_idtx;
+    int enable_tx64;
+    int reduced_tx_type_set;
+    int use_intra_dct_only;
+    int use_inter_dct_only;
+    int use_intra_default_tx_only;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -162,6 +168,12 @@ static const char *const ctlidstr[] = {
     [AV1E_SET_ENABLE_PAETH_INTRA]       = "AV1E_SET_ENABLE_PAETH_INTRA",
     [AV1E_SET_ENABLE_SMOOTH_INTRA]      = "AV1E_SET_ENABLE_SMOOTH_INTRA",
     [AV1E_SET_ENABLE_PALETTE]           = "AV1E_SET_ENABLE_PALETTE",
+    [AV1E_SET_ENABLE_FLIP_IDTX]      = "AV1E_SET_ENABLE_FLIP_IDTX",
+    [AV1E_SET_ENABLE_TX64]           = "AV1E_SET_ENABLE_TX64",
+    [AV1E_SET_INTRA_DCT_ONLY]        = "AV1E_SET_INTRA_DCT_ONLY",
+    [AV1E_SET_INTER_DCT_ONLY]        = "AV1E_SET_INTER_DCT_ONLY",
+    [AV1E_SET_INTRA_DEFAULT_TX_ONLY] = "AV1E_SET_INTRA_DEFAULT_TX_ONLY",
+    [AV1E_SET_REDUCED_TX_TYPE_SET]   = "AV1E_SET_REDUCED_TX_TYPE_SET",
 };
 
 static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -765,6 +777,19 @@ static av_cold int aom_init(AVCodecContext *avctx,
         codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTRA, ctx->enable_smooth_intra);
     if (ctx->enable_palette >= 0)
         codecctl_int(avctx, AV1E_SET_ENABLE_PALETTE, ctx->enable_palette);
+    if (ctx->enable_tx64 >= 0)
+        codecctl_int(avctx, AV1E_SET_ENABLE_TX64, ctx->enable_tx64);
+    if (ctx->enable_flip_idtx >= 0)
+        codecctl_int(avctx, AV1E_SET_ENABLE_FLIP_IDTX, ctx->enable_flip_idtx);
+    if (ctx->use_intra_dct_only >= 0)
+        codecctl_int(avctx, AV1E_SET_INTRA_DCT_ONLY, ctx->use_intra_dct_only);
+    if (ctx->use_inter_dct_only >= 0)
+        codecctl_int(avctx, AV1E_SET_INTER_DCT_ONLY, ctx->use_inter_dct_only);
+    if (ctx->use_intra_default_tx_only >= 0)
+        codecctl_int(avctx, AV1E_SET_INTRA_DEFAULT_TX_ONLY, ctx->use_intra_default_tx_only);
+    if (ctx->reduced_tx_type_set >= 0)
+        codecctl_int(avctx, AV1E_SET_REDUCED_TX_TYPE_SET, ctx->reduced_tx_type_set);
+
 
     codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
     if (ctx->crf >= 0)
@@ -1195,6 +1220,12 @@ static const AVOption options[] = {
     { "enable-smooth-intra",      "Enable smooth intra prediction mode",                OFFSET(enable_smooth_intra),      AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
     { "enable-paeth-intra",       "Enable paeth predictor in intra prediction",         OFFSET(enable_paeth_intra),       AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
     { "enable-palette",           "Enable palette prediction mode",                     OFFSET(enable_palette),           AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
+    { "enable-flip-idtx",          "Enable extended transform type",                       OFFSET(enable_flip_idtx),          AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
+    { "enable-tx64",               "Enable 64-pt transform",                               OFFSET(enable_tx64),               AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
+    { "reduced-tx-type-set",       "Use reduced set of transform types. Default is false", OFFSET(reduced_tx_type_set),       AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
+    { "use-intra-dct-only",        "Use DCT only for INTRA modes",                         OFFSET(use_intra_dct_only),        AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
+    { "use-inter-dct-only",        "Use DCT only for INTRA modes",                         OFFSET(use_inter_dct_only),        AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
+    { "use-intra-default-tx-only", "Use Default-transform only for INTRA modes",           OFFSET(use_intra_default_tx_only), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
     { NULL },
 };
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 78bac9f52a..bfe6abd92f 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 103
+#define LIBAVCODEC_VERSION_MICRO 104
 
 #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