]> git.sesse.net Git - ffmpeg/commitdiff
vaapi_encode: Add support for max QP in rate control
authorMark Thompson <sw@jkqxz.net>
Tue, 18 Sep 2018 22:30:46 +0000 (23:30 +0100)
committerMark Thompson <sw@jkqxz.net>
Sun, 23 Sep 2018 13:42:33 +0000 (14:42 +0100)
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.

doc/encoders.texi
libavcodec/vaapi_encode.c
libavcodec/vaapi_encode_h264.c
libavcodec/vaapi_encode_h265.c
libavcodec/vaapi_encode_mpeg2.c
libavcodec/vaapi_encode_vp8.c
libavcodec/vaapi_encode_vp9.c

index e550bd989364c0393badc6f3105991dc44358c02..4133bc15ee6b8cb39fc879d36a627d2ac30675ec 100644 (file)
@@ -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
index 25d89c65c93738adc136f39ff7edfc19e12443b4..e9eeb6eb835688d9f11f1e0e403707871e7416c1 100644 (file)
@@ -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));
index c63766d9186e118e26b84f1784f540b35cc5c583..e903b251c028956ac145f1bbce04a5d9653d1e38 100644 (file)
@@ -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 },
 };
 
index b296919b37a99b3ce6cc67f9b4dd22d609d586e6..13ddad79ae4f86d18731bd525d859e0a43c01067 100644 (file)
@@ -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 },
 };
 
index ff86b8817ef7a5bb8acfead7123e422021afe502..db72516187dd70a763d82d9e39ec79706aa25fbf 100644 (file)
@@ -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 },
 };
 
index 40871a6bbfed9dfc34446ab905d1d19a079724f4..db67136556fb6ca411be3e972c2a874aaca0c26c 100644 (file)
@@ -230,6 +230,8 @@ static const AVCodecDefault vaapi_encode_vp8_defaults[] = {
     { "bf",             "0"   },
     { "g",              "120" },
     { "global_quality", "40"  },
+    { "qmin",           "-1"  },
+    { "qmax",           "-1"  },
     { NULL },
 };
 
index e400bc8b7904b9931f468c8a0326d24cad1812f4..2b0658ec1f114edb5e7bc96c70a24ebb847291d7 100644 (file)
@@ -253,6 +253,8 @@ static const AVCodecDefault vaapi_encode_vp9_defaults[] = {
     { "bf",             "0"   },
     { "g",              "250" },
     { "global_quality", "100" },
+    { "qmin",           "-1"  },
+    { "qmax",           "-1"  },
     { NULL },
 };