summaryrefslogtreecommitdiff
path: root/libavcodec/libaomenc.c
diff options
context:
space:
mode:
authorWang Cao <doubleecao@gmail.com>2020-04-04 05:00:26 +0800
committerJames Zern <jzern@google.com>2020-04-11 15:12:34 -0700
commitbd3389e9f498dca74bc20b5f4e96520d23f072ed (patch)
tree740c593e72755a818c0a3df2d8ce6ee192a1b35d /libavcodec/libaomenc.c
parent9f4054a0cb27503e535804ab8c2b58cc91c72591 (diff)
avcodec/libaomenc.c: Add a libaom command-line option 'tune'
Signed-off-by: Wang Cao <wangcao@google.com> Signed-off-by: James Zern <jzern@google.com>
Diffstat (limited to 'libavcodec/libaomenc.c')
-rw-r--r--libavcodec/libaomenc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 096aadbe1c..747624ae54 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -94,6 +94,7 @@ typedef struct AOMEncoderContext {
int enable_intrabc;
int enable_restoration;
int usage;
+ int tune;
} AOMContext;
static const char *const ctlidstr[] = {
@@ -132,6 +133,7 @@ static const char *const ctlidstr[] = {
[AV1E_SET_ENABLE_INTRABC] = "AV1E_SET_ENABLE_INTRABC",
#endif
[AV1E_SET_ENABLE_CDEF] = "AV1E_SET_ENABLE_CDEF",
+ [AOME_SET_TUNING] = "AOME_SET_TUNING",
};
static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -699,6 +701,8 @@ static av_cold int aom_init(AVCodecContext *avctx,
codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
if (ctx->crf >= 0)
codecctl_int(avctx, AOME_SET_CQ_LEVEL, ctx->crf);
+ if (ctx->tune >= 0)
+ codecctl_int(avctx, AOME_SET_TUNING, ctx->tune);
codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries);
codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace);
@@ -1096,6 +1100,9 @@ static const AVOption options[] = {
{ "usage", "Quality and compression efficiency vs speed tradeof", OFFSET(usage), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, "usage"},
{ "good", "Good quality", 0, AV_OPT_TYPE_CONST, {.i64 = 0 /* AOM_USAGE_GOOD_QUALITY */}, 0, 0, VE, "usage"},
{ "realtime", "Realtime encoding", 0, AV_OPT_TYPE_CONST, {.i64 = 1 /* AOM_USAGE_REALTIME */}, 0, 0, VE, "usage"},
+ { "tune", "The metric that the encoder tunes for. Automatically chosen by the encoder by default", OFFSET(tune), AV_OPT_TYPE_INT, {.i64 = -1}, -1, AOM_TUNE_SSIM, VE, "tune"},
+ { "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"},
{ NULL },
};