[FFmpeg-devel] [PATCH 1/2] lavc/vaapi_encode_mpeg2: add support for CBR/VBR

Linjie Fu linjie.fu at intel.com
Wed Jan 16 16:34:01 EET 2019


Add support for VBR/CBR mode in mpeg2_vaapi encode.

Fix #7650.

Signed-off-by: Linjie Fu <linjie.fu at intel.com>
---
 libavcodec/vaapi_encode_mpeg2.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c
index 22d7e306bb..a625b15461 100644
--- a/libavcodec/vaapi_encode_mpeg2.c
+++ b/libavcodec/vaapi_encode_mpeg2.c
@@ -541,6 +541,13 @@ static av_cold int vaapi_encode_mpeg2_configure(AVCodecContext *avctx)
                "%d / %d / %d for I- / P- / B-frames.\n",
                priv->quant_i, priv->quant_p, priv->quant_b);
 
+    } else if (ctx->va_rc_mode == VA_RC_CBR ||
+               ctx->va_rc_mode == VA_RC_VBR) {
+        // These still need to be set for quantiser_scale_code.
+        priv->quant_i = 10;
+        priv->quant_p = 10;
+        priv->quant_b = 10;
+
     } else {
         av_assert0(0 && "Invalid RC mode.");
     }
-- 
2.17.1



More information about the ffmpeg-devel mailing list