Commit 32fed702 authored by Timothy Gu's avatar Timothy Gu

libvpxenc: Allow setting tune parameter

parent 671761d7
...@@ -1584,6 +1584,12 @@ follows: @code{(minrate * 100 / bitrate)}. ...@@ -1584,6 +1584,12 @@ follows: @code{(minrate * 100 / bitrate)}.
@item crf (@emph{end-usage=cq}, @emph{cq-level}) @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}) @item quality, deadline (@emph{deadline})
@table @samp @table @samp
@item best @item best
......
...@@ -88,6 +88,8 @@ typedef struct VP8EncoderContext { ...@@ -88,6 +88,8 @@ typedef struct VP8EncoderContext {
int arnr_strength; int arnr_strength;
int arnr_type; int arnr_type;
int tune;
int lag_in_frames; int lag_in_frames;
int error_resilient; int error_resilient;
int crf; int crf;
...@@ -116,6 +118,7 @@ static const char *const ctlidstr[] = { ...@@ -116,6 +118,7 @@ static const char *const ctlidstr[] = {
[VP8E_SET_ARNR_MAXFRAMES] = "VP8E_SET_ARNR_MAXFRAMES", [VP8E_SET_ARNR_MAXFRAMES] = "VP8E_SET_ARNR_MAXFRAMES",
[VP8E_SET_ARNR_STRENGTH] = "VP8E_SET_ARNR_STRENGTH", [VP8E_SET_ARNR_STRENGTH] = "VP8E_SET_ARNR_STRENGTH",
[VP8E_SET_ARNR_TYPE] = "VP8E_SET_ARNR_TYPE", [VP8E_SET_ARNR_TYPE] = "VP8E_SET_ARNR_TYPE",
[VP8E_SET_TUNING] = "VP8E_SET_TUNING",
[VP8E_SET_CQ_LEVEL] = "VP8E_SET_CQ_LEVEL", [VP8E_SET_CQ_LEVEL] = "VP8E_SET_CQ_LEVEL",
[VP8E_SET_MAX_INTRA_BITRATE_PCT] = "VP8E_SET_MAX_INTRA_BITRATE_PCT", [VP8E_SET_MAX_INTRA_BITRATE_PCT] = "VP8E_SET_MAX_INTRA_BITRATE_PCT",
#if CONFIG_LIBVPX_VP9_ENCODER #if CONFIG_LIBVPX_VP9_ENCODER
...@@ -611,6 +614,8 @@ FF_ENABLE_DEPRECATION_WARNINGS ...@@ -611,6 +614,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
codecctl_int(avctx, VP8E_SET_ARNR_STRENGTH, ctx->arnr_strength); codecctl_int(avctx, VP8E_SET_ARNR_STRENGTH, ctx->arnr_strength);
if (ctx->arnr_type >= 0) if (ctx->arnr_type >= 0)
codecctl_int(avctx, VP8E_SET_ARNR_TYPE, ctx->arnr_type); 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 (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8) {
#if FF_API_PRIVATE_OPT #if FF_API_PRIVATE_OPT
...@@ -1010,6 +1015,9 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt, ...@@ -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" }, \ { "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" }, \ { "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" }, \ { "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"}, \ { "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"}, \ { "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"}, \ { "good", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VPX_DL_GOOD_QUALITY}, 0, 0, VE, "quality"}, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment