diff options
author | Mark Thompson <sw@jkqxz.net> | 2018-09-18 23:30:45 +0100 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2018-09-23 14:42:33 +0100 |
commit | af532c921575eb8ee805cc2c64a914f6302442e1 (patch) | |
tree | 374d7b38b0f404530c2102cda7e77c947d57b354 /libavcodec/vaapi_encode_mpeg2.c | |
parent | 2562dd9e7831743ba6dc5680501fb7d26a2ec62c (diff) | |
download | ffmpeg-af532c921575eb8ee805cc2c64a914f6302442e1.tar.gz |
vaapi_encode: Clean up rate control configuration
Query which modes are supported and select between VBR and CBR based
on that - this removes all of the codec-specific rate control mode
selection code.
Diffstat (limited to 'libavcodec/vaapi_encode_mpeg2.c')
-rw-r--r-- | libavcodec/vaapi_encode_mpeg2.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c index db79d72115..ff86b8817e 100644 --- a/libavcodec/vaapi_encode_mpeg2.c +++ b/libavcodec/vaapi_encode_mpeg2.c @@ -188,8 +188,8 @@ static int vaapi_encode_mpeg2_init_sequence_params(AVCodecContext *avctx) memset(pce, 0, sizeof(*pce)); - if (avctx->bit_rate > 0) { - priv->bit_rate = (avctx->bit_rate + 399) / 400; + if (ctx->va_bit_rate > 0) { + priv->bit_rate = (ctx->va_bit_rate + 399) / 400; } else { // Unknown (not a bitrate-targetting mode), so just use the // highest value. @@ -361,7 +361,7 @@ static int vaapi_encode_mpeg2_init_sequence_params(AVCodecContext *avctx) .picture_width = avctx->width, .picture_height = avctx->height, - .bits_per_second = avctx->bit_rate, + .bits_per_second = ctx->va_bit_rate, .frame_rate = av_q2d(priv->frame_rate), .aspect_ratio_information = sh->aspect_ratio_information, .vbv_buffer_size = priv->vbv_buffer_size, @@ -615,8 +615,6 @@ static av_cold int vaapi_encode_mpeg2_init(AVCodecContext *avctx) return AVERROR(EINVAL); } - ctx->va_rc_mode = VA_RC_CQP; - ctx->va_packed_headers = VA_ENC_PACKED_HEADER_SEQUENCE | VA_ENC_PACKED_HEADER_PICTURE; @@ -666,6 +664,7 @@ static const AVOption vaapi_encode_mpeg2_options[] = { }; static const AVCodecDefault vaapi_encode_mpeg2_defaults[] = { + { "b", "0" }, { "bf", "1" }, { "g", "120" }, { "i_qfactor", "1" }, |