diff options
author | Konda Raju <kraju@nvidia.com> | 2017-03-07 12:02:14 +0530 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2017-03-09 17:24:00 +0100 |
commit | f6790b5e1075133ee39be91105f1135db7afd259 (patch) | |
tree | 7c8caceebb5bef4bccdd82da29fc04b8cdf689b3 /libavcodec/nvenc.c | |
parent | 8a60bba0aef77015111570058d5a72f0428dc748 (diff) | |
download | ffmpeg-streaming-f6790b5e1075133ee39be91105f1135db7afd259.zip ffmpeg-streaming-f6790b5e1075133ee39be91105f1135db7afd259.tar.gz |
add initial QP value options
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavcodec/nvenc.c')
-rw-r--r-- | libavcodec/nvenc.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 738a77e..2e76ee8 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -519,6 +519,8 @@ static void set_constqp(AVCodecContext *avctx, NV_ENC_RC_PARAMS *rc) static void set_vbr(AVCodecContext *avctx, NV_ENC_RC_PARAMS *rc) { + NVENCContext *ctx = avctx->priv_data; + if (avctx->qmin >= 0) { rc->enableMinQP = 1; rc->minQP.qpInterB = avctx->qmin; @@ -532,6 +534,30 @@ static void set_vbr(AVCodecContext *avctx, NV_ENC_RC_PARAMS *rc) rc->maxQP.qpInterP = avctx->qmax; rc->maxQP.qpIntra = avctx->qmax; } + + if (ctx->init_qp_p >= 0) { + rc->enableInitialRCQP = 1; + rc->initialRCQP.qpInterP = ctx->init_qp_p; + if (ctx->init_qp_i < 0) { + if (avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) { + rc->initialRCQP.qpIntra = av_clip(rc->initialRCQP.qpInterP * fabs(avctx->i_quant_factor) + avctx->i_quant_offset + 0.5, 0, 51); + } else { + rc->initialRCQP.qpIntra = rc->initialRCQP.qpInterP; + } + } else { + rc->initialRCQP.qpIntra = ctx->init_qp_i; + } + + if (ctx->init_qp_b < 0) { + if (avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) { + rc->initialRCQP.qpInterB = av_clip(rc->initialRCQP.qpInterP * fabs(avctx->b_quant_factor) + avctx->b_quant_offset + 0.5, 0, 51); + } else { + rc->initialRCQP.qpInterB = rc->initialRCQP.qpInterP; + } + } else { + rc->initialRCQP.qpInterB = ctx->init_qp_b; + } + } } static void set_lossless(AVCodecContext *avctx, NV_ENC_RC_PARAMS *rc) |