Commit 385cafb0 authored by Jun Zhao's avatar Jun Zhao Committed by Mark Thompson

lavc/vaapi_encode_h265: Enable VBR mode

Follow vaapi_h264 style, enable the VBR mode.
Signed-off-by: 's avatarJun Zhao <jun.zhao@intel.com>
Signed-off-by: 's avatarMark Thompson <sw@jkqxz.net>
parent ef0c6d9b
...@@ -1185,13 +1185,15 @@ static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx) ...@@ -1185,13 +1185,15 @@ static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx)
"%d / %d / %d for IDR- / P- / B-frames.\n", "%d / %d / %d for IDR- / P- / B-frames.\n",
priv->fixed_qp_idr, priv->fixed_qp_p, priv->fixed_qp_b); 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. // These still need to be set for pic_init_qp/slice_qp_delta.
priv->fixed_qp_idr = 30; priv->fixed_qp_idr = 30;
priv->fixed_qp_p = 30; priv->fixed_qp_p = 30;
priv->fixed_qp_b = 30; priv->fixed_qp_b = 30;
av_log(avctx, AV_LOG_DEBUG, "Using constant-bitrate = %"PRId64" bps.\n", av_log(avctx, AV_LOG_DEBUG, "Using %s-bitrate = %"PRId64" bps.\n",
ctx->va_rc_mode == VA_RC_CBR ? "constant" : "variable",
avctx->bit_rate); avctx->bit_rate);
} else { } else {
...@@ -1251,9 +1253,12 @@ static av_cold int vaapi_encode_h265_init(AVCodecContext *avctx) ...@@ -1251,9 +1253,12 @@ static av_cold int vaapi_encode_h265_init(AVCodecContext *avctx)
} }
ctx->va_entrypoint = VAEntrypointEncSlice; ctx->va_entrypoint = VAEntrypointEncSlice;
if (avctx->bit_rate > 0) if (avctx->bit_rate > 0) {
ctx->va_rc_mode = VA_RC_CBR; if (avctx->rc_max_rate == avctx->bit_rate)
else 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_rc_mode = VA_RC_CQP;
ctx->va_packed_headers = ctx->va_packed_headers =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment