Browse Source

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>
tags/n4.3
Wang Cao James Zern 5 years ago
parent
commit
bd3389e9f4
3 changed files with 17 additions and 1 deletions
  1. +9
    -0
      doc/encoders.texi
  2. +7
    -0
      libavcodec/libaomenc.c
  3. +1
    -1
      libavcodec/version.h

+ 9
- 0
doc/encoders.texi View File

@@ -1508,6 +1508,15 @@ Complexity-based.
Cyclic refresh. Cyclic refresh.
@end table @end table


@item tune (@emph{tune})
Set the distortion metric the encoder is tuned with. Default is @code{psnr}.

@table @samp
@item psnr (@emph{0})

@item ssim (@emph{1})
@end table

@item lag-in-frames @item lag-in-frames
Set the maximum number of frames which the encoder may keep in flight Set the maximum number of frames which the encoder may keep in flight
at any one time for lookahead purposes. Defaults to the internal at any one time for lookahead purposes. Defaults to the internal


+ 7
- 0
libavcodec/libaomenc.c View File

@@ -94,6 +94,7 @@ typedef struct AOMEncoderContext {
int enable_intrabc; int enable_intrabc;
int enable_restoration; int enable_restoration;
int usage; int usage;
int tune;
} AOMContext; } AOMContext;


static const char *const ctlidstr[] = { static const char *const ctlidstr[] = {
@@ -132,6 +133,7 @@ static const char *const ctlidstr[] = {
[AV1E_SET_ENABLE_INTRABC] = "AV1E_SET_ENABLE_INTRABC", [AV1E_SET_ENABLE_INTRABC] = "AV1E_SET_ENABLE_INTRABC",
#endif #endif
[AV1E_SET_ENABLE_CDEF] = "AV1E_SET_ENABLE_CDEF", [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) 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); codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
if (ctx->crf >= 0) if (ctx->crf >= 0)
codecctl_int(avctx, AOME_SET_CQ_LEVEL, ctx->crf); 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_COLOR_PRIMARIES, avctx->color_primaries);
codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace); 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"}, { "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"}, { "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"}, { "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 }, { NULL },
}; };




+ 1
- 1
libavcodec/version.h View File

@@ -29,7 +29,7 @@


#define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR 78 #define LIBAVCODEC_VERSION_MINOR 78
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_MICRO 102


#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \ LIBAVCODEC_VERSION_MINOR, \


Loading…
Cancel
Save