aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-09-18 23:30:46 +0100
committerMark Thompson <sw@jkqxz.net>2018-09-23 14:42:33 +0100
commit8479f99c7dd227d9cb94d262602f1298f71cf33b (patch)
tree1911420d4a3bb8c65fe1d884f2211cff3948b7a6
parentaf532c921575eb8ee805cc2c64a914f6302442e1 (diff)
downloadffmpeg-8479f99c7dd227d9cb94d262602f1298f71cf33b.tar.gz
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.
-rw-r--r--doc/encoders.texi3
-rw-r--r--libavcodec/vaapi_encode.c3
-rw-r--r--libavcodec/vaapi_encode_h264.c3
-rw-r--r--libavcodec/vaapi_encode_h265.c2
-rw-r--r--libavcodec/vaapi_encode_mpeg2.c2
-rw-r--r--libavcodec/vaapi_encode_vp8.c2
-rw-r--r--libavcodec/vaapi_encode_vp9.c2
7 files changed, 15 insertions, 2 deletions
diff --git a/doc/encoders.texi b/doc/encoders.texi
index e550bd9893..4133bc15ee 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2588,7 +2588,8 @@ Speed / quality tradeoff: higher values are faster / worse quality.
Size / quality tradeoff: higher values are smaller / worse quality.
@item
@option{qmin}
-(only: @option{qmax} is not supported)
+@item
+@option{qmax}
@item
@option{i_qfactor} / @option{i_quant_factor}
@item
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 25d89c65c9..e9eeb6eb83 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1436,6 +1436,9 @@ static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx)
.initial_qp = 0,
.min_qp = (avctx->qmin > 0 ? avctx->qmin : 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,
sizeof(ctx->rc_params));
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index c63766d918..e903b251c0 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -1033,7 +1033,8 @@ static const AVCodecDefault vaapi_encode_h264_defaults[] = {
{ "i_qoffset", "0" },
{ "b_qfactor", "6/5" },
{ "b_qoffset", "0" },
- { "qmin", "0" },
+ { "qmin", "-1" },
+ { "qmax", "-1" },
{ NULL },
};
diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index b296919b37..13ddad79ae 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -1148,6 +1148,8 @@ static const AVCodecDefault vaapi_encode_h265_defaults[] = {
{ "i_qoffset", "0" },
{ "b_qfactor", "6/5" },
{ "b_qoffset", "0" },
+ { "qmin", "-1" },
+ { "qmax", "-1" },
{ NULL },
};
diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c
index ff86b8817e..db72516187 100644
--- a/libavcodec/vaapi_encode_mpeg2.c
+++ b/libavcodec/vaapi_encode_mpeg2.c
@@ -672,6 +672,8 @@ static const AVCodecDefault vaapi_encode_mpeg2_defaults[] = {
{ "b_qfactor", "6/5" },
{ "b_qoffset", "0" },
{ "global_quality", "10" },
+ { "qmin", "-1" },
+ { "qmax", "-1" },
{ NULL },
};
diff --git a/libavcodec/vaapi_encode_vp8.c b/libavcodec/vaapi_encode_vp8.c
index 40871a6bbf..db67136556 100644
--- a/libavcodec/vaapi_encode_vp8.c
+++ b/libavcodec/vaapi_encode_vp8.c
@@ -230,6 +230,8 @@ static const AVCodecDefault vaapi_encode_vp8_defaults[] = {
{ "bf", "0" },
{ "g", "120" },
{ "global_quality", "40" },
+ { "qmin", "-1" },
+ { "qmax", "-1" },
{ NULL },
};
diff --git a/libavcodec/vaapi_encode_vp9.c b/libavcodec/vaapi_encode_vp9.c
index e400bc8b79..2b0658ec1f 100644
--- a/libavcodec/vaapi_encode_vp9.c
+++ b/libavcodec/vaapi_encode_vp9.c
@@ -253,6 +253,8 @@ static const AVCodecDefault vaapi_encode_vp9_defaults[] = {
{ "bf", "0" },
{ "g", "250" },
{ "global_quality", "100" },
+ { "qmin", "-1" },
+ { "qmax", "-1" },
{ NULL },
};