diff options
author | Ben Chang <benc@nvidia.com> | 2017-05-10 09:41:17 +0300 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2017-05-10 11:21:25 +0300 |
commit | 18a659d1b653c24de1a691c13f7db1b6e6a95aee (patch) | |
tree | 5a27182c9a933c35554e212123ba3f406b089846 /libavcodec/nvenc.c | |
parent | 984e2218f2a0e96b8180cddf7a805d07908eb8fb (diff) |
avcodec/nvenc: add fractional CQ support
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec/nvenc.c')
-rw-r--r-- | libavcodec/nvenc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index b7723fe949..d6c1005625 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -796,7 +796,12 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) ctx->encode_config.rcParams.zeroReorderDelay = 1; if (ctx->quality) - ctx->encode_config.rcParams.targetQuality = ctx->quality; + { + //convert from float to fixed point 8.8 + int tmp_quality = (int)(ctx->quality * 256.0f); + ctx->encode_config.rcParams.targetQuality = (uint8_t)(tmp_quality >> 8); + ctx->encode_config.rcParams.targetQualityLSB = (uint8_t)(tmp_quality & 0xff); + } } static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) |