summaryrefslogtreecommitdiff
path: root/libavcodec/vaapi_encode_h265.c
diff options
context:
space:
mode:
authorJun Zhao <mypopydev@gmail.com>2017-08-25 15:56:51 +0800
committerMark Thompson <sw@jkqxz.net>2017-12-02 15:21:30 +0000
commite7adf2250b437165bc30c3b277bfce50875a0909 (patch)
tree045bf16bdb0541dbdc7ec7c44e6a3bda155a43db /libavcodec/vaapi_encode_h265.c
parent5a6707e49b7710f48d658b2f2591b9a6337fb9b7 (diff)
vaapi_h265: Enable VBR mode
To match vaapi_h264. From ffmpeg commit 385cafb07ac1e46433931ea9749a134efd7350be. Signed-off-by: Mark Thompson <sw@jkqxz.net>
Diffstat (limited to 'libavcodec/vaapi_encode_h265.c')
-rw-r--r--libavcodec/vaapi_encode_h265.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 477065e2ce..0e5958d531 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -839,13 +839,15 @@ static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx)
"%d / %d / %d for IDR- / P- / B-frames.\n",
priv->fixed_qp_idr, priv->fixed_qp_p, priv->fixed_qp_b);
- } else if (ctx->va_rc_mode == VA_RC_CBR) {
+ } else if (ctx->va_rc_mode == VA_RC_CBR ||
+ ctx->va_rc_mode == VA_RC_VBR) {
// These still need to be set for pic_init_qp/slice_qp_delta.
priv->fixed_qp_idr = 30;
priv->fixed_qp_p = 30;
priv->fixed_qp_b = 30;
- av_log(avctx, AV_LOG_DEBUG, "Using constant-bitrate = %d bps.\n",
+ av_log(avctx, AV_LOG_DEBUG, "Using %s-bitrate = %d bps.\n",
+ ctx->va_rc_mode == VA_RC_CBR ? "constant" : "variable",
avctx->bit_rate);
} else {
@@ -905,9 +907,12 @@ static av_cold int vaapi_encode_h265_init(AVCodecContext *avctx)
}
ctx->va_entrypoint = VAEntrypointEncSlice;
- if (avctx->bit_rate > 0)
- ctx->va_rc_mode = VA_RC_CBR;
- else
+ if (avctx->bit_rate > 0) {
+ if (avctx->rc_max_rate == avctx->bit_rate)
+ ctx->va_rc_mode = VA_RC_CBR;
+ else
+ ctx->va_rc_mode = VA_RC_VBR;
+ } else
ctx->va_rc_mode = VA_RC_CQP;
ctx->va_packed_headers =