History

lavc/vaapi_encode_h265: Enable VBR mode

Follow vaapi_h264 style, enable the VBR mode.

Jun Zhao committed 9 years ago

Commit 385cafb1 parent ef0c6d91 file · +10 −5Browse files

Unified · Split

libavcodec/vaapi_encode_h265.c+10−5
@@ -1185,13 +1185,15 @@ static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx) · 1184 unmodified lines
11851185 "%d / %d / %d for IDR- / P- / B-frames.\n",
11861186 priv->fixed_qp_idr, priv->fixed_qp_p, priv->fixed_qp_b);
11871187
1188− } else if (ctx->va_rc_mode == VA_RC_CBR) {
1188+ } else if (ctx->va_rc_mode == VA_RC_CBR ||
1189+ ctx->va_rc_mode == VA_RC_VBR) {
11891190 // These still need to be set for pic_init_qp/slice_qp_delta.
11901191 priv->fixed_qp_idr = 30;
11911192 priv->fixed_qp_p = 30;
11921193 priv->fixed_qp_b = 30;
11931194
1194− av_log(avctx, AV_LOG_DEBUG, "Using constant-bitrate = %"PRId64" bps.\n",
1195+ av_log(avctx, AV_LOG_DEBUG, "Using %s-bitrate = %"PRId64" bps.\n",
1196+ ctx->va_rc_mode == VA_RC_CBR ? "constant" : "variable",
11951197 avctx->bit_rate);
11961198
11971199 } else {
@@ -1251,9 +1253,12 @@ static av_cold int vaapi_encode_h265_init(AVCodecContext *avctx) · 53 unmodified lines
12511253 }
12521254 ctx->va_entrypoint = VAEntrypointEncSlice;
12531255
1254− if (avctx->bit_rate > 0)
1255− ctx->va_rc_mode = VA_RC_CBR;
1256− else
1256+ if (avctx->bit_rate > 0) {
1257+ if (avctx->rc_max_rate == avctx->bit_rate)
1258+ ctx->va_rc_mode = VA_RC_CBR;
1259+ else
1260+ ctx->va_rc_mode = VA_RC_VBR;
1261+ } else
12571262 ctx->va_rc_mode = VA_RC_CQP;
12581263
12591264 ctx->va_packed_headers =

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t