Follow vaapi_h264 style, enable the VBR mode.
Unified · Split
| @@ -1185,13 +1185,15 @@ static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx) · 1184 unmodified lines | |||
| 1185 | "%d / %d / %d for IDR- / P- / B-frames.\n", | 1185 | "%d / %d / %d for IDR- / P- / B-frames.\n", |
| 1186 | priv->fixed_qp_idr, priv->fixed_qp_p, priv->fixed_qp_b); | 1186 | priv->fixed_qp_idr, priv->fixed_qp_p, priv->fixed_qp_b); |
| 1187 | 1187 | ||
| 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) { | ||
| 1189 | // These still need to be set for pic_init_qp/slice_qp_delta. | 1190 | // These still need to be set for pic_init_qp/slice_qp_delta. |
| 1190 | priv->fixed_qp_idr = 30; | 1191 | priv->fixed_qp_idr = 30; |
| 1191 | priv->fixed_qp_p = 30; | 1192 | priv->fixed_qp_p = 30; |
| 1192 | priv->fixed_qp_b = 30; | 1193 | priv->fixed_qp_b = 30; |
| 1193 | 1194 | ||
| 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", | ||
| 1195 | avctx->bit_rate); | 1197 | avctx->bit_rate); |
| 1196 | 1198 | ||
| 1197 | } else { | 1199 | } else { |
| @@ -1251,9 +1253,12 @@ static av_cold int vaapi_encode_h265_init(AVCodecContext *avctx) · 53 unmodified lines | |||
| 1251 | } | 1253 | } |
| 1252 | ctx->va_entrypoint = VAEntrypointEncSlice; | 1254 | ctx->va_entrypoint = VAEntrypointEncSlice; |
| 1253 | 1255 | ||
| 1254 | if (avctx->bit_rate > 0) | 1256 | if (avctx->bit_rate > 0) { |
| 1255 | ctx->va_rc_mode = VA_RC_CBR; | 1257 | if (avctx->rc_max_rate == avctx->bit_rate) |
| 1256 | else | 1258 | ctx->va_rc_mode = VA_RC_CBR; |
| 1259 | else | ||
| 1260 | ctx->va_rc_mode = VA_RC_VBR; | ||
| 1261 | } else | ||
| 1257 | ctx->va_rc_mode = VA_RC_CQP; | 1262 | ctx->va_rc_mode = VA_RC_CQP; |
| 1258 | 1263 | ||
| 1259 | ctx->va_packed_headers = | 1264 | ctx->va_packed_headers = |