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
188 memset(pce, 0, sizeof(*pce));188 memset(pce, 0, sizeof(*pce));
189 189
190 190
191 if (avctx->bit_rate > 0) {191 if (ctx->va_bit_rate > 0) {
192 priv->bit_rate = (avctx->bit_rate + 399) / 400;192 priv->bit_rate = (ctx->va_bit_rate + 399) / 400;
193 } else {193 } else {
194 // Unknown (not a bitrate-targetting mode), so just use the194 // Unknown (not a bitrate-targetting mode), so just use the
195 // highest value.195 // highest value.
@@ -361,7 +361,7 @@ static int vaapi_encode_mpeg2_init_sequence_params(AVCodecContext *avctx) · 165 unmodified lines
361 .picture_width = avctx->width,361 .picture_width = avctx->width,
362 .picture_height = avctx->height,362 .picture_height = avctx->height,
363 363
364 .bits_per_second = avctx->bit_rate,364 .bits_per_second = ctx->va_bit_rate,
365 .frame_rate = av_q2d(priv->frame_rate),365 .frame_rate = av_q2d(priv->frame_rate),
366 .aspect_ratio_information = sh->aspect_ratio_information,366 .aspect_ratio_information = sh->aspect_ratio_information,
367 .vbv_buffer_size = priv->vbv_buffer_size,367 .vbv_buffer_size = priv->vbv_buffer_size,
@@ -615,8 +615,6 @@ static av_cold int vaapi_encode_mpeg2_init(AVCodecContext *avctx) · 247 unmodified lines
615 return AVERROR(EINVAL);615 return AVERROR(EINVAL);
616 }616 }
617 617
618 ctx->va_rc_mode = VA_RC_CQP;
619
620 ctx->va_packed_headers = VA_ENC_PACKED_HEADER_SEQUENCE |618 ctx->va_packed_headers = VA_ENC_PACKED_HEADER_SEQUENCE |
621 VA_ENC_PACKED_HEADER_PICTURE;619 VA_ENC_PACKED_HEADER_PICTURE;
622 620
@@ -666,6 +664,7 @@ static const AVOption vaapi_encode_mpeg2_options[] = { · 43 unmodified lines
666};664};
667 665
668static const AVCodecDefault vaapi_encode_mpeg2_defaults[] = {666static const AVCodecDefault vaapi_encode_mpeg2_defaults[] = {
667 { "b", "0" },
669 { "bf", "1" },668 { "bf", "1" },
670 { "g", "120" },669 { "g", "120" },
671 { "i_qfactor", "1" },670 { "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