diff --git a/doc/encoders.texi b/doc/encoders.texi index c485f903b7..e9311eb432 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1584,6 +1584,12 @@ follows: @code{(minrate * 100 / bitrate)}. @item crf (@emph{end-usage=cq}, @emph{cq-level}) +@item tune (@emph{tune}) +@table @samp +@item psnr (@emph{psnr}) +@item ssim (@emph{ssim}) +@end table + @item quality, deadline (@emph{deadline}) @table @samp @item best diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 643855accc..8992497c70 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -88,6 +88,8 @@ typedef struct VP8EncoderContext { int arnr_strength; int arnr_type; + int tune; + int lag_in_frames; int error_resilient; int crf; @@ -116,6 +118,7 @@ static const char *const ctlidstr[] = { [VP8E_SET_ARNR_MAXFRAMES] = "VP8E_SET_ARNR_MAXFRAMES", [VP8E_SET_ARNR_STRENGTH] = "VP8E_SET_ARNR_STRENGTH", [VP8E_SET_ARNR_TYPE] = "VP8E_SET_ARNR_TYPE", + [VP8E_SET_TUNING] = "VP8E_SET_TUNING", [VP8E_SET_CQ_LEVEL] = "VP8E_SET_CQ_LEVEL", [VP8E_SET_MAX_INTRA_BITRATE_PCT] = "VP8E_SET_MAX_INTRA_BITRATE_PCT", #if CONFIG_LIBVPX_VP9_ENCODER @@ -611,6 +614,8 @@ FF_ENABLE_DEPRECATION_WARNINGS codecctl_int(avctx, VP8E_SET_ARNR_STRENGTH, ctx->arnr_strength); if (ctx->arnr_type >= 0) codecctl_int(avctx, VP8E_SET_ARNR_TYPE, ctx->arnr_type); + if (ctx->tune >= 0) + codecctl_int(avctx, VP8E_SET_TUNING, ctx->tune); if (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8) { #if FF_API_PRIVATE_OPT @@ -1010,6 +1015,9 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt, { "backward", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0, VE, "arnr_type" }, \ { "forward", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0, VE, "arnr_type" }, \ { "centered", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0, VE, "arnr_type" }, \ + { "tune", "Tune the encoding to a specific scenario", OFFSET(tune), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE, "tune"}, \ + { "psnr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VP8_TUNE_PSNR}, 0, 0, VE, "tune"}, \ + { "ssim", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VP8_TUNE_SSIM}, 0, 0, VE, "tune"}, \ { "deadline", "Time to spend encoding, in microseconds.", OFFSET(deadline), AV_OPT_TYPE_INT, {.i64 = VPX_DL_GOOD_QUALITY}, INT_MIN, INT_MAX, VE, "quality"}, \ { "best", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VPX_DL_BEST_QUALITY}, 0, 0, VE, "quality"}, \ { "good", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VPX_DL_GOOD_QUALITY}, 0, 0, VE, "quality"}, \