History

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.

Mark Thompson committed 8 years ago

Commit af532c91 parent 2562dd99 files · +145 −114Browse files

Showing the changes to libavcodec/vaapi_encode_mpeg2.c (1 of 9 files). Show all

Unified · Split

libavcodec/vaapi_encode_mpeg2.c+4−5
@@ -188,8 +188,8 @@ static int vaapi_encode_mpeg2_init_sequence_params(AVCodecContext *avctx) · 187 unmodified lines
188188 memset(pce, 0, sizeof(*pce));
189189
190190
191− if (avctx->bit_rate > 0) {
192− priv->bit_rate = (avctx->bit_rate + 399) / 400;
191+ if (ctx->va_bit_rate > 0) {
192+ priv->bit_rate = (ctx->va_bit_rate + 399) / 400;
193193 } else {
194194 // Unknown (not a bitrate-targetting mode), so just use the
195195 // highest value.
@@ -361,7 +361,7 @@ static int vaapi_encode_mpeg2_init_sequence_params(AVCodecContext *avctx) · 165 unmodified lines
361361 .picture_width = avctx->width,
362362 .picture_height = avctx->height,
363363
364− .bits_per_second = avctx->bit_rate,
364+ .bits_per_second = ctx->va_bit_rate,
365365 .frame_rate = av_q2d(priv->frame_rate),
366366 .aspect_ratio_information = sh->aspect_ratio_information,
367367 .vbv_buffer_size = priv->vbv_buffer_size,
@@ -615,8 +615,6 @@ static av_cold int vaapi_encode_mpeg2_init(AVCodecContext *avctx) · 247 unmodified lines
615615 return AVERROR(EINVAL);
616616 }
617617
618− ctx->va_rc_mode = VA_RC_CQP;
619−
620618 ctx->va_packed_headers = VA_ENC_PACKED_HEADER_SEQUENCE |
621619 VA_ENC_PACKED_HEADER_PICTURE;
622620
@@ -666,6 +664,7 @@ static const AVOption vaapi_encode_mpeg2_options[] = { · 43 unmodified lines
666664 };
667665
668666 static const AVCodecDefault vaapi_encode_mpeg2_defaults[] = {
667+ { "b", "0" },
669668 { "bf", "1" },
670669 { "g", "120" },
671670 { "i_qfactor", "1" },

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t