summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo_enc.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-09-11 03:30:38 +0200
committerVittorio Giovara <vittorio.giovara@gmail.com>2016-01-21 15:33:19 -0500
commit0ac9f33a9e69c64eee592791be3c5441a6a3d6b7 (patch)
tree2c02352942c60bade8ff88b7518b875f39c0312e /libavcodec/mpegvideo_enc.c
parent84c4714f397c9c50eb9d49008cc1c08385f68f31 (diff)
lavc: Move frame_skip_* to codec private options
These options are only used by mpegvideoenc and vpx. They are very codec-specific options, so deprecate the global variants. Add an allowed value to the private options for frame_skip_cmp which seems to have been forgotten, but perfectly working. The libvpx frame dropping feature uses one of such option (frame_skip_threshold) without the other three. For this reason rename the option to something more consistent with the other libvpx variables. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r--libavcodec/mpegvideo_enc.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index b56450ca14..9c0f01509b 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -780,8 +780,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
s->quant_precision = 5;
+#if FF_API_PRIVATE_OPT
+FF_DISABLE_DEPRECATION_WARNINGS
+ if (avctx->frame_skip_threshold)
+ s->frame_skip_threshold = avctx->frame_skip_threshold;
+ if (avctx->frame_skip_factor)
+ s->frame_skip_factor = avctx->frame_skip_factor;
+ if (avctx->frame_skip_exp)
+ s->frame_skip_exp = avctx->frame_skip_exp;
+ if (avctx->frame_skip_cmp != FF_CMP_DCTMAX)
+ s->frame_skip_cmp = avctx->frame_skip_cmp;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
ff_set_cmp(&s->mecc, s->mecc.ildct_cmp, s->avctx->ildct_cmp);
- ff_set_cmp(&s->mecc, s->mecc.frame_skip_cmp, s->avctx->frame_skip_cmp);
+ ff_set_cmp(&s->mecc, s->mecc.frame_skip_cmp, s->frame_skip_cmp);
if (CONFIG_H261_ENCODER && s->out_format == FMT_H261)
ff_h261_encode_init(s);
@@ -1149,7 +1162,7 @@ static int skip_check(MpegEncContext *s, Picture *p, Picture *ref)
uint8_t *rptr = ref->f->data[plane] + 8 * (x + y * stride);
int v = s->mecc.frame_skip_cmp[1](s, dptr, rptr, stride, 8);
- switch (s->avctx->frame_skip_exp) {
+ switch (s->frame_skip_exp) {
case 0: score = FFMAX(score, v); break;
case 1: score += FFABS(v); break;
case 2: score += v * v; break;
@@ -1163,9 +1176,9 @@ static int skip_check(MpegEncContext *s, Picture *p, Picture *ref)
if (score)
score64 = score;
- if (score64 < s->avctx->frame_skip_threshold)
+ if (score64 < s->frame_skip_threshold)
return 1;
- if (score64 < ((s->avctx->frame_skip_factor * (int64_t)s->lambda) >> 8))
+ if (score64 < ((s->frame_skip_factor * (int64_t) s->lambda) >> 8))
return 1;
return 0;
}
@@ -1320,7 +1333,7 @@ static int select_input_picture(MpegEncContext *s)
} else {
int b_frames = 0;
- if (s->avctx->frame_skip_threshold || s->avctx->frame_skip_factor) {
+ if (s->frame_skip_threshold || s->frame_skip_factor) {
if (s->picture_in_gop_number < s->gop_size &&
skip_check(s, s->input_picture[0], s->next_picture_ptr)) {
// FIXME check that te gop check above is +-1 correct