|
@@ -245,14 +245,7 @@ static av_cold int vp8_init(AVCodecContext *avctx) |
|
|
enccfg.g_timebase.num = avctx->time_base.num; |
|
|
enccfg.g_timebase.num = avctx->time_base.num; |
|
|
enccfg.g_timebase.den = avctx->time_base.den; |
|
|
enccfg.g_timebase.den = avctx->time_base.den; |
|
|
enccfg.g_threads = avctx->thread_count; |
|
|
enccfg.g_threads = avctx->thread_count; |
|
|
#if FF_API_X264_GLOBAL_OPTS |
|
|
|
|
|
if(avctx->rc_lookahead >= 0) |
|
|
|
|
|
enccfg.g_lag_in_frames= FFMIN(avctx->rc_lookahead, 25); //0-25, avoids init failure |
|
|
|
|
|
if (ctx->lag_in_frames >= 0) |
|
|
|
|
|
enccfg.g_lag_in_frames = ctx->lag_in_frames; |
|
|
|
|
|
#else |
|
|
|
|
|
enccfg.g_lag_in_frames= ctx->lag_in_frames; |
|
|
enccfg.g_lag_in_frames= ctx->lag_in_frames; |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
if (avctx->flags & CODEC_FLAG_PASS1) |
|
|
if (avctx->flags & CODEC_FLAG_PASS1) |
|
|
enccfg.g_pass = VPX_RC_FIRST_PASS; |
|
|
enccfg.g_pass = VPX_RC_FIRST_PASS; |
|
@@ -264,11 +257,7 @@ static av_cold int vp8_init(AVCodecContext *avctx) |
|
|
if (avctx->rc_min_rate == avctx->rc_max_rate && |
|
|
if (avctx->rc_min_rate == avctx->rc_max_rate && |
|
|
avctx->rc_min_rate == avctx->bit_rate) |
|
|
avctx->rc_min_rate == avctx->bit_rate) |
|
|
enccfg.rc_end_usage = VPX_CBR; |
|
|
enccfg.rc_end_usage = VPX_CBR; |
|
|
#if FF_API_X264_GLOBAL_OPTS |
|
|
|
|
|
else if (avctx->crf || ctx->crf > 0) |
|
|
|
|
|
#else |
|
|
|
|
|
else if (ctx->crf) |
|
|
else if (ctx->crf) |
|
|
#endif |
|
|
|
|
|
enccfg.rc_end_usage = VPX_CQ; |
|
|
enccfg.rc_end_usage = VPX_CQ; |
|
|
enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000, |
|
|
enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000, |
|
|
AV_ROUND_NEAR_INF); |
|
|
AV_ROUND_NEAR_INF); |
|
@@ -363,13 +352,7 @@ static av_cold int vp8_init(AVCodecContext *avctx) |
|
|
codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction); |
|
|
codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction); |
|
|
codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices)); |
|
|
codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices)); |
|
|
codecctl_int(avctx, VP8E_SET_STATIC_THRESHOLD, avctx->mb_threshold); |
|
|
codecctl_int(avctx, VP8E_SET_STATIC_THRESHOLD, avctx->mb_threshold); |
|
|
#if FF_API_X264_GLOBAL_OPTS |
|
|
|
|
|
codecctl_int(avctx, VP8E_SET_CQ_LEVEL, (int)avctx->crf); |
|
|
|
|
|
if (ctx->crf >= 0) |
|
|
|
|
|
codecctl_int(avctx, VP8E_SET_CQ_LEVEL, ctx->crf); |
|
|
|
|
|
#else |
|
|
|
|
|
codecctl_int(avctx, VP8E_SET_CQ_LEVEL, ctx->crf); |
|
|
codecctl_int(avctx, VP8E_SET_CQ_LEVEL, ctx->crf); |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
av_log(avctx, AV_LOG_DEBUG, "Using deadline: %d\n", ctx->deadline); |
|
|
av_log(avctx, AV_LOG_DEBUG, "Using deadline: %d\n", ctx->deadline); |
|
|
|
|
|
|
|
@@ -589,13 +572,8 @@ static const AVOption options[] = { |
|
|
{"arnr_max_frames", "altref noise reduction max frame count", offsetof(VP8Context, arnr_max_frames), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 15, VE}, |
|
|
{"arnr_max_frames", "altref noise reduction max frame count", offsetof(VP8Context, arnr_max_frames), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 15, VE}, |
|
|
{"arnr_strength", "altref noise reduction filter strength", offsetof(VP8Context, arnr_strength), AV_OPT_TYPE_INT, {.dbl = 3}, 0, 6, VE}, |
|
|
{"arnr_strength", "altref noise reduction filter strength", offsetof(VP8Context, arnr_strength), AV_OPT_TYPE_INT, {.dbl = 3}, 0, 6, VE}, |
|
|
{"arnr_type", "altref noise reduction filter type", offsetof(VP8Context, arnr_type), AV_OPT_TYPE_INT, {.dbl = 3}, 1, 3, VE}, |
|
|
{"arnr_type", "altref noise reduction filter type", offsetof(VP8Context, arnr_type), AV_OPT_TYPE_INT, {.dbl = 3}, 1, 3, VE}, |
|
|
#if FF_API_X264_GLOBAL_OPTS |
|
|
|
|
|
{"rc_lookahead", "Number of frames to look ahead for alternate reference frame selection", offsetof(VP8Context, lag_in_frames), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 25, VE}, |
|
|
|
|
|
{"crf", "Select the quality for constant quality mode", offsetof(VP8Context, crf), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 63, VE}, |
|
|
|
|
|
#else |
|
|
|
|
|
{"rc_lookahead", "Number of frames to look ahead for alternate reference frame selection", offsetof(VP8Context, lag_in_frames), AV_OPT_TYPE_INT, {.dbl = 25}, 0, 25, VE}, |
|
|
{"rc_lookahead", "Number of frames to look ahead for alternate reference frame selection", offsetof(VP8Context, lag_in_frames), AV_OPT_TYPE_INT, {.dbl = 25}, 0, 25, VE}, |
|
|
{"crf", "Select the quality for constant quality mode", offsetof(VP8Context, crf), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 63, VE}, |
|
|
{"crf", "Select the quality for constant quality mode", offsetof(VP8Context, crf), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 63, VE}, |
|
|
#endif |
|
|
|
|
|
{NULL} |
|
|
{NULL} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|