diff options
author | Oliver Collyer <ovcollyer@mac.com> | 2016-08-25 16:20:03 +0100 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2016-08-28 16:47:54 +0200 |
commit | a81b398e869ed2f7f972f797f8992ad32bfb8ba1 (patch) | |
tree | be443154b73f714d7aef3a190e0898c5bc4f836b /libavcodec/nvenc.c | |
parent | d1bf8a3aa878003f5019bb97c3228f8027e5d116 (diff) | |
download | ffmpeg-a81b398e869ed2f7f972f797f8992ad32bfb8ba1.tar.gz |
avcodec/nvenc: added support for rate control lookahead
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec/nvenc.c')
-rw-r--r-- | libavcodec/nvenc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 5706590334..d1c7d934a7 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -328,6 +328,12 @@ static int nvenc_check_capabilities(AVCodecContext *avctx) return AVERROR(ENOSYS); } + ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_LOOKAHEAD); + if (ctx->rc_lookahead > 0 && ret <= 0) { + av_log(avctx, AV_LOG_VERBOSE, "RC lookahead not supported\n"); + return AVERROR(ENOSYS); + } + return 0; } @@ -687,6 +693,11 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) } else if (ctx->encode_config.rcParams.averageBitRate > 0) { ctx->encode_config.rcParams.vbvBufferSize = 2 * ctx->encode_config.rcParams.averageBitRate; } + + if (ctx->rc_lookahead > 0) { + ctx->encode_config.rcParams.enableLookahead = 1; + ctx->encode_config.rcParams.lookaheadDepth = FFMIN(ctx->rc_lookahead, 32); + } } static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) |