Commit 8479f99c authored by Mark Thompson's avatar Mark Thompson

vaapi_encode: Add support for max QP in rate control

This was added in libva 2.1.0 (VAAPI 1.1.0).  Use AVCodecContext.qmax,
matching the existing behaviour for qmin, and clean up the defaults so
that we only pass min/max when explicitly set.
parent af532c92
...@@ -2588,7 +2588,8 @@ Speed / quality tradeoff: higher values are faster / worse quality. ...@@ -2588,7 +2588,8 @@ Speed / quality tradeoff: higher values are faster / worse quality.
Size / quality tradeoff: higher values are smaller / worse quality. Size / quality tradeoff: higher values are smaller / worse quality.
@item @item
@option{qmin} @option{qmin}
(only: @option{qmax} is not supported) @item
@option{qmax}
@item @item
@option{i_qfactor} / @option{i_quant_factor} @option{i_qfactor} / @option{i_quant_factor}
@item @item
......
...@@ -1436,6 +1436,9 @@ static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx) ...@@ -1436,6 +1436,9 @@ static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx)
.initial_qp = 0, .initial_qp = 0,
.min_qp = (avctx->qmin > 0 ? avctx->qmin : 0), .min_qp = (avctx->qmin > 0 ? avctx->qmin : 0),
.basic_unit_size = 0, .basic_unit_size = 0,
#if VA_CHECK_VERSION(1, 1, 0)
.max_qp = (avctx->qmax > 0 ? avctx->qmax : 0),
#endif
}; };
vaapi_encode_add_global_param(avctx, &ctx->rc_params.misc, vaapi_encode_add_global_param(avctx, &ctx->rc_params.misc,
sizeof(ctx->rc_params)); sizeof(ctx->rc_params));
......
...@@ -1033,7 +1033,8 @@ static const AVCodecDefault vaapi_encode_h264_defaults[] = { ...@@ -1033,7 +1033,8 @@ static const AVCodecDefault vaapi_encode_h264_defaults[] = {
{ "i_qoffset", "0" }, { "i_qoffset", "0" },
{ "b_qfactor", "6/5" }, { "b_qfactor", "6/5" },
{ "b_qoffset", "0" }, { "b_qoffset", "0" },
{ "qmin", "0" }, { "qmin", "-1" },
{ "qmax", "-1" },
{ NULL }, { NULL },
}; };
......
...@@ -1148,6 +1148,8 @@ static const AVCodecDefault vaapi_encode_h265_defaults[] = { ...@@ -1148,6 +1148,8 @@ static const AVCodecDefault vaapi_encode_h265_defaults[] = {
{ "i_qoffset", "0" }, { "i_qoffset", "0" },
{ "b_qfactor", "6/5" }, { "b_qfactor", "6/5" },
{ "b_qoffset", "0" }, { "b_qoffset", "0" },
{ "qmin", "-1" },
{ "qmax", "-1" },
{ NULL }, { NULL },
}; };
......
...@@ -672,6 +672,8 @@ static const AVCodecDefault vaapi_encode_mpeg2_defaults[] = { ...@@ -672,6 +672,8 @@ static const AVCodecDefault vaapi_encode_mpeg2_defaults[] = {
{ "b_qfactor", "6/5" }, { "b_qfactor", "6/5" },
{ "b_qoffset", "0" }, { "b_qoffset", "0" },
{ "global_quality", "10" }, { "global_quality", "10" },
{ "qmin", "-1" },
{ "qmax", "-1" },
{ NULL }, { NULL },
}; };
......
...@@ -230,6 +230,8 @@ static const AVCodecDefault vaapi_encode_vp8_defaults[] = { ...@@ -230,6 +230,8 @@ static const AVCodecDefault vaapi_encode_vp8_defaults[] = {
{ "bf", "0" }, { "bf", "0" },
{ "g", "120" }, { "g", "120" },
{ "global_quality", "40" }, { "global_quality", "40" },
{ "qmin", "-1" },
{ "qmax", "-1" },
{ NULL }, { NULL },
}; };
......
...@@ -253,6 +253,8 @@ static const AVCodecDefault vaapi_encode_vp9_defaults[] = { ...@@ -253,6 +253,8 @@ static const AVCodecDefault vaapi_encode_vp9_defaults[] = {
{ "bf", "0" }, { "bf", "0" },
{ "g", "250" }, { "g", "250" },
{ "global_quality", "100" }, { "global_quality", "100" },
{ "qmin", "-1" },
{ "qmax", "-1" },
{ NULL }, { NULL },
}; };
......
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