avcodec/libsvtav1: update some options and defaults
And bump the minimum required version to 0.9.0 Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
353195fb38
commit
1dddb930aa
2
configure
vendored
2
configure
vendored
@ -6595,7 +6595,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
|
||||
enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
|
||||
enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
|
||||
enabled libsrt && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
|
||||
enabled libsvtav1 && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.8.4" EbSvtAv1Enc.h svt_av1_enc_init_handle
|
||||
enabled libsvtav1 && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.9.0" EbSvtAv1Enc.h svt_av1_enc_init_handle
|
||||
enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow
|
||||
enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
|
||||
enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
|
||||
|
@ -1775,28 +1775,15 @@ This is the default.
|
||||
@item high
|
||||
@end table
|
||||
|
||||
@item rc
|
||||
Set the rate control mode to use.
|
||||
|
||||
Possible modes:
|
||||
@table @option
|
||||
@item cqp
|
||||
Constant quantizer: use fixed values of qindex (dependent on the frame type)
|
||||
throughout the stream. This mode is the default.
|
||||
|
||||
@item vbr
|
||||
Variable bitrate: use a target bitrate for the whole stream.
|
||||
|
||||
@item cvbr
|
||||
Constrained variable bitrate: use a target bitrate for each GOP.
|
||||
@end table
|
||||
|
||||
@item qmax
|
||||
Set the maximum quantizer to use when using a bitrate mode.
|
||||
|
||||
@item qmin
|
||||
Set the minimum quantizer to use when using a bitrate mode.
|
||||
|
||||
@item crf
|
||||
Constant rate factor value used in crf rate control mode (0-63).
|
||||
|
||||
@item qp
|
||||
Set the quantizer used in cqp rate control mode (0-63).
|
||||
|
||||
@ -1807,8 +1794,8 @@ Enable scene change detection.
|
||||
Set number of frames to look ahead (0-120).
|
||||
|
||||
@item preset
|
||||
Set the quality-speed tradeoff, in the range 0 to 8. Higher values are
|
||||
faster but lower quality. Defaults to 8 (highest speed).
|
||||
Set the quality-speed tradeoff, in the range 0 to 13. Higher values are
|
||||
faster but lower quality.
|
||||
|
||||
@item tile_rows
|
||||
Set log2 of the number of rows of tiles to use (0-6).
|
||||
|
@ -68,7 +68,7 @@ typedef struct SvtContext {
|
||||
int hierarchical_level;
|
||||
int la_depth;
|
||||
int enc_mode;
|
||||
int rc_mode;
|
||||
int crf;
|
||||
int scd;
|
||||
int qp;
|
||||
|
||||
@ -160,11 +160,32 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
|
||||
|
||||
// Update param from options
|
||||
param->hierarchical_levels = svt_enc->hierarchical_level;
|
||||
param->enc_mode = svt_enc->enc_mode;
|
||||
|
||||
if (svt_enc->enc_mode >= 0)
|
||||
param->enc_mode = svt_enc->enc_mode;
|
||||
|
||||
param->tier = svt_enc->tier;
|
||||
param->rate_control_mode = svt_enc->rc_mode;
|
||||
|
||||
if (avctx->bit_rate) {
|
||||
param->target_bit_rate = avctx->bit_rate;
|
||||
if (avctx->rc_max_rate != avctx->bit_rate)
|
||||
param->rate_control_mode = 1;
|
||||
else
|
||||
param->rate_control_mode = 2;
|
||||
}
|
||||
param->max_bit_rate = avctx->rc_max_rate;
|
||||
param->vbv_bufsize = avctx->rc_buffer_size;
|
||||
|
||||
if (svt_enc->crf > 0) {
|
||||
param->qp = svt_enc->crf;
|
||||
param->rate_control_mode = 0;
|
||||
param->enable_tpl_la = 1;
|
||||
} else if (svt_enc->qp > 0) {
|
||||
param->qp = svt_enc->qp;
|
||||
param->rate_control_mode = 0;
|
||||
param->enable_tpl_la = 0;
|
||||
}
|
||||
param->scene_change_detection = svt_enc->scd;
|
||||
param->qp = svt_enc->qp;
|
||||
|
||||
if (svt_enc->la_depth >= 0)
|
||||
param->look_ahead_distance = svt_enc->la_depth;
|
||||
@ -224,8 +245,6 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
|
||||
param->profile = FF_PROFILE_AV1_HIGH;
|
||||
}
|
||||
|
||||
param->target_bit_rate = avctx->bit_rate;
|
||||
|
||||
if (avctx->gop_size > 0)
|
||||
param->intra_period_length = avctx->gop_size - 1;
|
||||
|
||||
@ -237,8 +256,8 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
|
||||
param->frame_rate_denominator = avctx->time_base.num * avctx->ticks_per_frame;
|
||||
}
|
||||
|
||||
param->enable_tpl_la = !!param->rate_control_mode;
|
||||
if (param->rate_control_mode) {
|
||||
avctx->bit_rate = param->target_bit_rate;
|
||||
if (avctx->bit_rate) {
|
||||
param->max_qp_allowed = avctx->qmax;
|
||||
param->min_qp_allowed = avctx->qmin;
|
||||
}
|
||||
@ -508,8 +527,8 @@ static const AVOption options[] = {
|
||||
{ "la_depth", "Look ahead distance [0, 120]", OFFSET(la_depth),
|
||||
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 120, VE },
|
||||
|
||||
{ "preset", "Encoding preset [0, 8]",
|
||||
OFFSET(enc_mode), AV_OPT_TYPE_INT, { .i64 = MAX_ENC_PRESET }, 0, MAX_ENC_PRESET, VE },
|
||||
{ "preset", "Encoding preset",
|
||||
OFFSET(enc_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, MAX_ENC_PRESET, VE },
|
||||
|
||||
{ "tier", "Set operating point tier", OFFSET(tier),
|
||||
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE, "tier" },
|
||||
@ -546,14 +565,10 @@ static const AVOption options[] = {
|
||||
{ LEVEL("7.3", 73) },
|
||||
#undef LEVEL
|
||||
|
||||
{ "rc", "Bit rate control mode", OFFSET(rc_mode),
|
||||
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, VE , "rc"},
|
||||
{ "cqp", "Constant quantizer", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "rc" },
|
||||
{ "vbr", "Variable Bit Rate, use a target bitrate for the entire stream", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "rc" },
|
||||
{ "cvbr", "Constrained Variable Bit Rate, use a target bitrate for each GOP", 0, AV_OPT_TYPE_CONST,{ .i64 = 2 }, INT_MIN, INT_MAX, VE, "rc" },
|
||||
|
||||
{ "qp", "Quantizer to use with cqp rate control mode", OFFSET(qp),
|
||||
AV_OPT_TYPE_INT, { .i64 = 50 }, 0, 63, VE },
|
||||
{ "crf", "Constant Rate Factor value", OFFSET(crf),
|
||||
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 63, VE },
|
||||
{ "qp", "Initial Quantizer level value", OFFSET(qp),
|
||||
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 63, VE },
|
||||
|
||||
{ "sc_detection", "Scene change detection", OFFSET(scd),
|
||||
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
@ -574,10 +589,10 @@ static const AVClass class = {
|
||||
};
|
||||
|
||||
static const AVCodecDefault eb_enc_defaults[] = {
|
||||
{ "b", "7M" },
|
||||
{ "b", "0" },
|
||||
{ "flags", "+cgop" },
|
||||
{ "g", "-1" },
|
||||
{ "qmin", "0" },
|
||||
{ "qmin", "1" },
|
||||
{ "qmax", "63" },
|
||||
{ NULL },
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user