summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo_enc.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-09-11 00:01:12 +0200
committerVittorio Giovara <vittorio.giovara@gmail.com>2016-01-21 15:33:19 -0500
commit84c4714f397c9c50eb9d49008cc1c08385f68f31 (patch)
tree493619c3ddb4410e9ea581dacf04e61192833d21 /libavcodec/mpegvideo_enc.c
parent0e6c8532215790bbe560a9eea4f3cc82bb55cf92 (diff)
lavc: Move brd_scale to codec private options
This option is only used by mpegvideoenc, It is a very codec-specific option, so deprecate the global variant. Set proper limits to the maximum allowed values. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r--libavcodec/mpegvideo_enc.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 585631232f..b56450ca14 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -876,6 +876,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
#endif
+#if FF_API_PRIVATE_OPT
+ FF_DISABLE_DEPRECATION_WARNINGS
+ if (avctx->brd_scale)
+ s->brd_scale = avctx->brd_scale;
+ FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
if (s->b_frame_strategy == 2) {
for (i = 0; i < s->max_b_frames + 2; i++) {
s->tmp_frames[i] = av_frame_alloc();
@@ -883,8 +890,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
return AVERROR(ENOMEM);
s->tmp_frames[i]->format = AV_PIX_FMT_YUV420P;
- s->tmp_frames[i]->width = s->width >> avctx->brd_scale;
- s->tmp_frames[i]->height = s->height >> avctx->brd_scale;
+ s->tmp_frames[i]->width = s->width >> s->brd_scale;
+ s->tmp_frames[i]->height = s->height >> s->brd_scale;
ret = av_frame_get_buffer(s->tmp_frames[i], 32);
if (ret < 0)
@@ -1182,7 +1189,7 @@ static int estimate_best_b_count(MpegEncContext *s)
{
AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id);
AVCodecContext *c = avcodec_alloc_context3(NULL);
- const int scale = s->avctx->brd_scale;
+ const int scale = s->brd_scale;
int i, j, out_size, p_lambda, b_lambda, lambda2;
int64_t best_rd = INT64_MAX;
int best_b_count = -1;